@onflow/decode
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -5,2 +5,6 @@ ### Unreleased | ||
### 0.0.11 -- 2021-02-02 | ||
- 2021-02-02 -- Adds support for Block Header decoding | ||
### 0.0.9 -- 2020-10-28 | ||
@@ -7,0 +11,0 @@ |
@@ -1,2 +0,2 @@ | ||
function e(){return(e=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var r=function(e,r,t){try{try{return Promise.resolve(Number(e))}catch(e){throw new Error("Decode Number Error : "+t.join("."))}}catch(e){return Promise.reject(e)}},t=function(e){return Promise.resolve(e)},n=function(e,r,t){try{return Promise.resolve(e.fields.reduce(function(e,n){try{return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(i(n.value,r,[].concat(t,[n.name]))).then(function(r){return e[n.name]=r,e})})}catch(e){return Promise.reject(e)}},Promise.resolve({}))).then(function(t){var n=e.id&&c(r,e.id);return n?Promise.resolve(n(t)):t})}catch(e){return Promise.reject(e)}},o={UInt:r,Int:r,UInt8:r,Int8:r,UInt16:r,Int16:r,UInt32:r,Int32:r,UInt64:r,Int64:r,UInt128:r,Int128:r,UInt256:r,Int256:r,Word8:r,Word16:r,Word32:r,Word64:r,UFix64:t,Fix64:t,String:t,Character:t,Bool:t,Address:t,Void:function(){return Promise.resolve(null)},Optional:function(e,r,t){return Promise.resolve(e?i(e,r,t):null)},Reference:function(e){try{return Promise.resolve({address:e.address,type:e.type})}catch(e){return Promise.reject(e)}},Array:function(e,r,t){try{return Promise.resolve(Promise.all(e.map(function(e){return new Promise(function(n){try{return Promise.resolve(i(e,r,[].concat(t,[e.type]))).then(n)}catch(e){return Promise.reject(e)}})})))}catch(e){return Promise.reject(e)}},Dictionary:function(e,r,t){try{return Promise.resolve(e.reduce(function(e,n){try{return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(i(n.key,r,[].concat(t,[n.key]))).then(function(o){return Promise.resolve(i(n.value,r,[].concat(t,[n.key]))).then(function(r){return e[o]=r,e})})})}catch(e){return Promise.reject(e)}},Promise.resolve({})))}catch(e){return Promise.reject(e)}},Event:n,Resource:n,Struct:n},c=function(e,r){var t=Object.keys(e).find(function(e){return/^\/.*\/$/.test(e)?new RegExp(e.substring(1,e.length-1)).test(r):e===r});return r&&t&&e[t]},i=function(e,r,t){try{var n=c(r,e.type);if(!n)throw new Error("Undefined Decoder Error: "+e.type+"@"+t.join("."));return Promise.resolve(n(e.value,r,t))}catch(e){return Promise.reject(e)}},s=function(r,t,n){void 0===t&&(t={}),void 0===n&&(n=[]);var c=e({},o,{},t);return Promise.resolve(i(r,c,n))};exports.decode=s,exports.decodeResponse=function(r,t){void 0===t&&(t={});try{var n=!1,c=e({},o,{},t),i=r.encodedData?(n=!0,Promise.resolve(s(r.encodedData,c))):r.transaction?(n=!0,Promise.resolve(Promise.all(r.transaction.events.map(function(e){try{var r=e.eventIndex,t=e.transactionIndex,n=e.transactionId,o=e.type;return Promise.resolve(s(e.payload,c)).then(function(e){return{type:o,transactionId:n,transactionIndex:t,eventIndex:r,data:e}})}catch(e){return Promise.reject(e)}}))).then(function(t){return e({},r.transaction,{events:t})})):r.events?(n=!0,Promise.resolve(Promise.all(r.events.map(function(e){try{var r=e.eventIndex,t=e.transactionIndex,n=e.transactionId,o=e.type;return Promise.resolve(s(e.payload,c)).then(function(e){return{type:o,transactionId:n,transactionIndex:t,eventIndex:r,data:e}})}catch(e){return Promise.reject(e)}})))):r.account?(n=!0,r.account):r.block?(n=!0,r.block):r.latestBlock?(console.error("\n %c@onflow/decode Deprecation Notice\n ========================\n\n Operating upon data of the latestBlock field of the response object is deprecated and will no longer be recognized in future releases of @onflow/decode.\n Find out more here: https://github.com/onflow/flow-js-sdk/blob/master/packages/decode/WARNINGS.md#0001-Deprecating-latestBlock-field\n\n =======================\n ".replace(/\n\s+/g,"\n").trim(),"font-weight:bold;font-family:monospace;"),n=!0,r.latestBlock):r.transactionId?(n=!0,r.transactionId):void 0;return Promise.resolve(i&&i.then?i.then(function(e){return n?e:null}):n?i:null)}catch(e){return Promise.reject(e)}}; | ||
function e(){return(e=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var r=function(e,r,t){try{try{return Promise.resolve(Number(e))}catch(e){throw new Error("Decode Number Error : "+t.join("."))}}catch(e){return Promise.reject(e)}},t=function(e){return Promise.resolve(e)},n=function(e,r,t){try{return Promise.resolve(e.fields.reduce(function(e,n){try{return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(i(n.value,r,[].concat(t,[n.name]))).then(function(r){return e[n.name]=r,e})})}catch(e){return Promise.reject(e)}},Promise.resolve({}))).then(function(t){var n=e.id&&c(r,e.id);return n?Promise.resolve(n(t)):t})}catch(e){return Promise.reject(e)}},o={UInt:r,Int:r,UInt8:r,Int8:r,UInt16:r,Int16:r,UInt32:r,Int32:r,UInt64:r,Int64:r,UInt128:r,Int128:r,UInt256:r,Int256:r,Word8:r,Word16:r,Word32:r,Word64:r,UFix64:t,Fix64:t,String:t,Character:t,Bool:t,Address:t,Void:function(){return Promise.resolve(null)},Optional:function(e,r,t){return Promise.resolve(e?i(e,r,t):null)},Reference:function(e){try{return Promise.resolve({address:e.address,type:e.type})}catch(e){return Promise.reject(e)}},Array:function(e,r,t){try{return Promise.resolve(Promise.all(e.map(function(e){return new Promise(function(n){try{return Promise.resolve(i(e,r,[].concat(t,[e.type]))).then(n)}catch(e){return Promise.reject(e)}})})))}catch(e){return Promise.reject(e)}},Dictionary:function(e,r,t){try{return Promise.resolve(e.reduce(function(e,n){try{return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(i(n.key,r,[].concat(t,[n.key]))).then(function(o){return Promise.resolve(i(n.value,r,[].concat(t,[n.key]))).then(function(r){return e[o]=r,e})})})}catch(e){return Promise.reject(e)}},Promise.resolve({})))}catch(e){return Promise.reject(e)}},Event:n,Resource:n,Struct:n},c=function(e,r){var t=Object.keys(e).find(function(e){return/^\/.*\/$/.test(e)?new RegExp(e.substring(1,e.length-1)).test(r):e===r});return r&&t&&e[t]},i=function(e,r,t){try{var n=c(r,e.type);if(!n)throw new Error("Undefined Decoder Error: "+e.type+"@"+t.join("."));return Promise.resolve(n(e.value,r,t))}catch(e){return Promise.reject(e)}},s=function(r,t,n){void 0===t&&(t={}),void 0===n&&(n=[]);var c=e({},o,{},t);return Promise.resolve(i(r,c,n))};exports.decode=s,exports.decodeResponse=function(r,t){void 0===t&&(t={});try{var n=!1,c=e({},o,{},t),i=r.encodedData?(n=!0,Promise.resolve(s(r.encodedData,c))):r.transaction?(n=!0,Promise.resolve(Promise.all(r.transaction.events.map(function(e){try{var r=e.eventIndex,t=e.transactionIndex,n=e.transactionId,o=e.type;return Promise.resolve(s(e.payload,c)).then(function(e){return{type:o,transactionId:n,transactionIndex:t,eventIndex:r,data:e}})}catch(e){return Promise.reject(e)}}))).then(function(t){return e({},r.transaction,{events:t})})):r.events?(n=!0,Promise.resolve(Promise.all(r.events.map(function(e){try{var r=e.eventIndex,t=e.transactionIndex,n=e.transactionId,o=e.type;return Promise.resolve(s(e.payload,c)).then(function(e){return{type:o,transactionId:n,transactionIndex:t,eventIndex:r,data:e}})}catch(e){return Promise.reject(e)}})))):r.account?(n=!0,r.account):r.block?(n=!0,r.block):r.blockHeader?(n=!0,r.blockHeader):r.latestBlock?(console.error("\n %c@onflow/decode Deprecation Notice\n ========================\n\n Operating upon data of the latestBlock field of the response object is deprecated and will no longer be recognized in future releases of @onflow/decode.\n Find out more here: https://github.com/onflow/flow-js-sdk/blob/master/packages/decode/WARNINGS.md#0001-Deprecating-latestBlock-field\n\n =======================\n ".replace(/\n\s+/g,"\n").trim(),"font-weight:bold;font-family:monospace;"),n=!0,r.latestBlock):r.transactionId?(n=!0,r.transactionId):void 0;return Promise.resolve(i&&i.then?i.then(function(e){return n?e:null}):n?i:null)}catch(e){return Promise.reject(e)}}; | ||
//# sourceMappingURL=decode.js.map |
@@ -1,2 +0,2 @@ | ||
function e(){return(e=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var r=function(e,r,t){try{try{return Promise.resolve(Number(e))}catch(e){throw new Error("Decode Number Error : "+t.join("."))}}catch(e){return Promise.reject(e)}},t=function(e){return Promise.resolve(e)},n=function(e,r,t){try{return Promise.resolve(e.fields.reduce(function(e,n){try{return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(i(n.value,r,[].concat(t,[n.name]))).then(function(r){return e[n.name]=r,e})})}catch(e){return Promise.reject(e)}},Promise.resolve({}))).then(function(t){var n=e.id&&c(r,e.id);return n?Promise.resolve(n(t)):t})}catch(e){return Promise.reject(e)}},o={UInt:r,Int:r,UInt8:r,Int8:r,UInt16:r,Int16:r,UInt32:r,Int32:r,UInt64:r,Int64:r,UInt128:r,Int128:r,UInt256:r,Int256:r,Word8:r,Word16:r,Word32:r,Word64:r,UFix64:t,Fix64:t,String:t,Character:t,Bool:t,Address:t,Void:function(){return Promise.resolve(null)},Optional:function(e,r,t){return Promise.resolve(e?i(e,r,t):null)},Reference:function(e){try{return Promise.resolve({address:e.address,type:e.type})}catch(e){return Promise.reject(e)}},Array:function(e,r,t){try{return Promise.resolve(Promise.all(e.map(function(e){return new Promise(function(n){try{return Promise.resolve(i(e,r,[].concat(t,[e.type]))).then(n)}catch(e){return Promise.reject(e)}})})))}catch(e){return Promise.reject(e)}},Dictionary:function(e,r,t){try{return Promise.resolve(e.reduce(function(e,n){try{return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(i(n.key,r,[].concat(t,[n.key]))).then(function(o){return Promise.resolve(i(n.value,r,[].concat(t,[n.key]))).then(function(r){return e[o]=r,e})})})}catch(e){return Promise.reject(e)}},Promise.resolve({})))}catch(e){return Promise.reject(e)}},Event:n,Resource:n,Struct:n},c=function(e,r){var t=Object.keys(e).find(function(e){return/^\/.*\/$/.test(e)?new RegExp(e.substring(1,e.length-1)).test(r):e===r});return r&&t&&e[t]},i=function(e,r,t){try{var n=c(r,e.type);if(!n)throw new Error("Undefined Decoder Error: "+e.type+"@"+t.join("."));return Promise.resolve(n(e.value,r,t))}catch(e){return Promise.reject(e)}},s=function(r,t,n){void 0===t&&(t={}),void 0===n&&(n=[]);var c=e({},o,{},t);return Promise.resolve(i(r,c,n))},a=function(r,t){void 0===t&&(t={});try{var n=!1,c=e({},o,{},t),i=r.encodedData?(n=!0,Promise.resolve(s(r.encodedData,c))):r.transaction?(n=!0,Promise.resolve(Promise.all(r.transaction.events.map(function(e){try{var r=e.eventIndex,t=e.transactionIndex,n=e.transactionId,o=e.type;return Promise.resolve(s(e.payload,c)).then(function(e){return{type:o,transactionId:n,transactionIndex:t,eventIndex:r,data:e}})}catch(e){return Promise.reject(e)}}))).then(function(t){return e({},r.transaction,{events:t})})):r.events?(n=!0,Promise.resolve(Promise.all(r.events.map(function(e){try{var r=e.eventIndex,t=e.transactionIndex,n=e.transactionId,o=e.type;return Promise.resolve(s(e.payload,c)).then(function(e){return{type:o,transactionId:n,transactionIndex:t,eventIndex:r,data:e}})}catch(e){return Promise.reject(e)}})))):r.account?(n=!0,r.account):r.block?(n=!0,r.block):r.latestBlock?(console.error("\n %c@onflow/decode Deprecation Notice\n ========================\n\n Operating upon data of the latestBlock field of the response object is deprecated and will no longer be recognized in future releases of @onflow/decode.\n Find out more here: https://github.com/onflow/flow-js-sdk/blob/master/packages/decode/WARNINGS.md#0001-Deprecating-latestBlock-field\n\n =======================\n ".replace(/\n\s+/g,"\n").trim(),"font-weight:bold;font-family:monospace;"),n=!0,r.latestBlock):r.transactionId?(n=!0,r.transactionId):void 0;return Promise.resolve(i&&i.then?i.then(function(e){return n?e:null}):n?i:null)}catch(e){return Promise.reject(e)}};export{s as decode,a as decodeResponse}; | ||
function e(){return(e=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var r=function(e,r,t){try{try{return Promise.resolve(Number(e))}catch(e){throw new Error("Decode Number Error : "+t.join("."))}}catch(e){return Promise.reject(e)}},t=function(e){return Promise.resolve(e)},n=function(e,r,t){try{return Promise.resolve(e.fields.reduce(function(e,n){try{return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(i(n.value,r,[].concat(t,[n.name]))).then(function(r){return e[n.name]=r,e})})}catch(e){return Promise.reject(e)}},Promise.resolve({}))).then(function(t){var n=e.id&&c(r,e.id);return n?Promise.resolve(n(t)):t})}catch(e){return Promise.reject(e)}},o={UInt:r,Int:r,UInt8:r,Int8:r,UInt16:r,Int16:r,UInt32:r,Int32:r,UInt64:r,Int64:r,UInt128:r,Int128:r,UInt256:r,Int256:r,Word8:r,Word16:r,Word32:r,Word64:r,UFix64:t,Fix64:t,String:t,Character:t,Bool:t,Address:t,Void:function(){return Promise.resolve(null)},Optional:function(e,r,t){return Promise.resolve(e?i(e,r,t):null)},Reference:function(e){try{return Promise.resolve({address:e.address,type:e.type})}catch(e){return Promise.reject(e)}},Array:function(e,r,t){try{return Promise.resolve(Promise.all(e.map(function(e){return new Promise(function(n){try{return Promise.resolve(i(e,r,[].concat(t,[e.type]))).then(n)}catch(e){return Promise.reject(e)}})})))}catch(e){return Promise.reject(e)}},Dictionary:function(e,r,t){try{return Promise.resolve(e.reduce(function(e,n){try{return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(i(n.key,r,[].concat(t,[n.key]))).then(function(o){return Promise.resolve(i(n.value,r,[].concat(t,[n.key]))).then(function(r){return e[o]=r,e})})})}catch(e){return Promise.reject(e)}},Promise.resolve({})))}catch(e){return Promise.reject(e)}},Event:n,Resource:n,Struct:n},c=function(e,r){var t=Object.keys(e).find(function(e){return/^\/.*\/$/.test(e)?new RegExp(e.substring(1,e.length-1)).test(r):e===r});return r&&t&&e[t]},i=function(e,r,t){try{var n=c(r,e.type);if(!n)throw new Error("Undefined Decoder Error: "+e.type+"@"+t.join("."));return Promise.resolve(n(e.value,r,t))}catch(e){return Promise.reject(e)}},s=function(r,t,n){void 0===t&&(t={}),void 0===n&&(n=[]);var c=e({},o,{},t);return Promise.resolve(i(r,c,n))},a=function(r,t){void 0===t&&(t={});try{var n=!1,c=e({},o,{},t),i=r.encodedData?(n=!0,Promise.resolve(s(r.encodedData,c))):r.transaction?(n=!0,Promise.resolve(Promise.all(r.transaction.events.map(function(e){try{var r=e.eventIndex,t=e.transactionIndex,n=e.transactionId,o=e.type;return Promise.resolve(s(e.payload,c)).then(function(e){return{type:o,transactionId:n,transactionIndex:t,eventIndex:r,data:e}})}catch(e){return Promise.reject(e)}}))).then(function(t){return e({},r.transaction,{events:t})})):r.events?(n=!0,Promise.resolve(Promise.all(r.events.map(function(e){try{var r=e.eventIndex,t=e.transactionIndex,n=e.transactionId,o=e.type;return Promise.resolve(s(e.payload,c)).then(function(e){return{type:o,transactionId:n,transactionIndex:t,eventIndex:r,data:e}})}catch(e){return Promise.reject(e)}})))):r.account?(n=!0,r.account):r.block?(n=!0,r.block):r.blockHeader?(n=!0,r.blockHeader):r.latestBlock?(console.error("\n %c@onflow/decode Deprecation Notice\n ========================\n\n Operating upon data of the latestBlock field of the response object is deprecated and will no longer be recognized in future releases of @onflow/decode.\n Find out more here: https://github.com/onflow/flow-js-sdk/blob/master/packages/decode/WARNINGS.md#0001-Deprecating-latestBlock-field\n\n =======================\n ".replace(/\n\s+/g,"\n").trim(),"font-weight:bold;font-family:monospace;"),n=!0,r.latestBlock):r.transactionId?(n=!0,r.transactionId):void 0;return Promise.resolve(i&&i.then?i.then(function(e){return n?e:null}):n?i:null)}catch(e){return Promise.reject(e)}};export{s as decode,a as decodeResponse}; | ||
//# sourceMappingURL=decode.modern.js.map |
@@ -1,2 +0,2 @@ | ||
function e(){return(e=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var r=function(e,r,t){try{try{return Promise.resolve(Number(e))}catch(e){throw new Error("Decode Number Error : "+t.join("."))}}catch(e){return Promise.reject(e)}},t=function(e){return Promise.resolve(e)},n=function(e,r,t){try{return Promise.resolve(e.fields.reduce(function(e,n){try{return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(i(n.value,r,[].concat(t,[n.name]))).then(function(r){return e[n.name]=r,e})})}catch(e){return Promise.reject(e)}},Promise.resolve({}))).then(function(t){var n=e.id&&c(r,e.id);return n?Promise.resolve(n(t)):t})}catch(e){return Promise.reject(e)}},o={UInt:r,Int:r,UInt8:r,Int8:r,UInt16:r,Int16:r,UInt32:r,Int32:r,UInt64:r,Int64:r,UInt128:r,Int128:r,UInt256:r,Int256:r,Word8:r,Word16:r,Word32:r,Word64:r,UFix64:t,Fix64:t,String:t,Character:t,Bool:t,Address:t,Void:function(){return Promise.resolve(null)},Optional:function(e,r,t){return Promise.resolve(e?i(e,r,t):null)},Reference:function(e){try{return Promise.resolve({address:e.address,type:e.type})}catch(e){return Promise.reject(e)}},Array:function(e,r,t){try{return Promise.resolve(Promise.all(e.map(function(e){return new Promise(function(n){try{return Promise.resolve(i(e,r,[].concat(t,[e.type]))).then(n)}catch(e){return Promise.reject(e)}})})))}catch(e){return Promise.reject(e)}},Dictionary:function(e,r,t){try{return Promise.resolve(e.reduce(function(e,n){try{return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(i(n.key,r,[].concat(t,[n.key]))).then(function(o){return Promise.resolve(i(n.value,r,[].concat(t,[n.key]))).then(function(r){return e[o]=r,e})})})}catch(e){return Promise.reject(e)}},Promise.resolve({})))}catch(e){return Promise.reject(e)}},Event:n,Resource:n,Struct:n},c=function(e,r){var t=Object.keys(e).find(function(e){return/^\/.*\/$/.test(e)?new RegExp(e.substring(1,e.length-1)).test(r):e===r});return r&&t&&e[t]},i=function(e,r,t){try{var n=c(r,e.type);if(!n)throw new Error("Undefined Decoder Error: "+e.type+"@"+t.join("."));return Promise.resolve(n(e.value,r,t))}catch(e){return Promise.reject(e)}},s=function(r,t,n){void 0===t&&(t={}),void 0===n&&(n=[]);var c=e({},o,{},t);return Promise.resolve(i(r,c,n))},a=function(r,t){void 0===t&&(t={});try{var n=!1,c=e({},o,{},t),i=r.encodedData?(n=!0,Promise.resolve(s(r.encodedData,c))):r.transaction?(n=!0,Promise.resolve(Promise.all(r.transaction.events.map(function(e){try{var r=e.eventIndex,t=e.transactionIndex,n=e.transactionId,o=e.type;return Promise.resolve(s(e.payload,c)).then(function(e){return{type:o,transactionId:n,transactionIndex:t,eventIndex:r,data:e}})}catch(e){return Promise.reject(e)}}))).then(function(t){return e({},r.transaction,{events:t})})):r.events?(n=!0,Promise.resolve(Promise.all(r.events.map(function(e){try{var r=e.eventIndex,t=e.transactionIndex,n=e.transactionId,o=e.type;return Promise.resolve(s(e.payload,c)).then(function(e){return{type:o,transactionId:n,transactionIndex:t,eventIndex:r,data:e}})}catch(e){return Promise.reject(e)}})))):r.account?(n=!0,r.account):r.block?(n=!0,r.block):r.latestBlock?(console.error("\n %c@onflow/decode Deprecation Notice\n ========================\n\n Operating upon data of the latestBlock field of the response object is deprecated and will no longer be recognized in future releases of @onflow/decode.\n Find out more here: https://github.com/onflow/flow-js-sdk/blob/master/packages/decode/WARNINGS.md#0001-Deprecating-latestBlock-field\n\n =======================\n ".replace(/\n\s+/g,"\n").trim(),"font-weight:bold;font-family:monospace;"),n=!0,r.latestBlock):r.transactionId?(n=!0,r.transactionId):void 0;return Promise.resolve(i&&i.then?i.then(function(e){return n?e:null}):n?i:null)}catch(e){return Promise.reject(e)}};export{s as decode,a as decodeResponse}; | ||
function e(){return(e=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var r=function(e,r,t){try{try{return Promise.resolve(Number(e))}catch(e){throw new Error("Decode Number Error : "+t.join("."))}}catch(e){return Promise.reject(e)}},t=function(e){return Promise.resolve(e)},n=function(e,r,t){try{return Promise.resolve(e.fields.reduce(function(e,n){try{return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(i(n.value,r,[].concat(t,[n.name]))).then(function(r){return e[n.name]=r,e})})}catch(e){return Promise.reject(e)}},Promise.resolve({}))).then(function(t){var n=e.id&&c(r,e.id);return n?Promise.resolve(n(t)):t})}catch(e){return Promise.reject(e)}},o={UInt:r,Int:r,UInt8:r,Int8:r,UInt16:r,Int16:r,UInt32:r,Int32:r,UInt64:r,Int64:r,UInt128:r,Int128:r,UInt256:r,Int256:r,Word8:r,Word16:r,Word32:r,Word64:r,UFix64:t,Fix64:t,String:t,Character:t,Bool:t,Address:t,Void:function(){return Promise.resolve(null)},Optional:function(e,r,t){return Promise.resolve(e?i(e,r,t):null)},Reference:function(e){try{return Promise.resolve({address:e.address,type:e.type})}catch(e){return Promise.reject(e)}},Array:function(e,r,t){try{return Promise.resolve(Promise.all(e.map(function(e){return new Promise(function(n){try{return Promise.resolve(i(e,r,[].concat(t,[e.type]))).then(n)}catch(e){return Promise.reject(e)}})})))}catch(e){return Promise.reject(e)}},Dictionary:function(e,r,t){try{return Promise.resolve(e.reduce(function(e,n){try{return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(i(n.key,r,[].concat(t,[n.key]))).then(function(o){return Promise.resolve(i(n.value,r,[].concat(t,[n.key]))).then(function(r){return e[o]=r,e})})})}catch(e){return Promise.reject(e)}},Promise.resolve({})))}catch(e){return Promise.reject(e)}},Event:n,Resource:n,Struct:n},c=function(e,r){var t=Object.keys(e).find(function(e){return/^\/.*\/$/.test(e)?new RegExp(e.substring(1,e.length-1)).test(r):e===r});return r&&t&&e[t]},i=function(e,r,t){try{var n=c(r,e.type);if(!n)throw new Error("Undefined Decoder Error: "+e.type+"@"+t.join("."));return Promise.resolve(n(e.value,r,t))}catch(e){return Promise.reject(e)}},s=function(r,t,n){void 0===t&&(t={}),void 0===n&&(n=[]);var c=e({},o,{},t);return Promise.resolve(i(r,c,n))},a=function(r,t){void 0===t&&(t={});try{var n=!1,c=e({},o,{},t),i=r.encodedData?(n=!0,Promise.resolve(s(r.encodedData,c))):r.transaction?(n=!0,Promise.resolve(Promise.all(r.transaction.events.map(function(e){try{var r=e.eventIndex,t=e.transactionIndex,n=e.transactionId,o=e.type;return Promise.resolve(s(e.payload,c)).then(function(e){return{type:o,transactionId:n,transactionIndex:t,eventIndex:r,data:e}})}catch(e){return Promise.reject(e)}}))).then(function(t){return e({},r.transaction,{events:t})})):r.events?(n=!0,Promise.resolve(Promise.all(r.events.map(function(e){try{var r=e.eventIndex,t=e.transactionIndex,n=e.transactionId,o=e.type;return Promise.resolve(s(e.payload,c)).then(function(e){return{type:o,transactionId:n,transactionIndex:t,eventIndex:r,data:e}})}catch(e){return Promise.reject(e)}})))):r.account?(n=!0,r.account):r.block?(n=!0,r.block):r.blockHeader?(n=!0,r.blockHeader):r.latestBlock?(console.error("\n %c@onflow/decode Deprecation Notice\n ========================\n\n Operating upon data of the latestBlock field of the response object is deprecated and will no longer be recognized in future releases of @onflow/decode.\n Find out more here: https://github.com/onflow/flow-js-sdk/blob/master/packages/decode/WARNINGS.md#0001-Deprecating-latestBlock-field\n\n =======================\n ".replace(/\n\s+/g,"\n").trim(),"font-weight:bold;font-family:monospace;"),n=!0,r.latestBlock):r.transactionId?(n=!0,r.transactionId):void 0;return Promise.resolve(i&&i.then?i.then(function(e){return n?e:null}):n?i:null)}catch(e){return Promise.reject(e)}};export{s as decode,a as decodeResponse}; | ||
//# sourceMappingURL=decode.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e=e||self).decode={})}(this,function(e){function r(){return(r=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var t=function(e,r,t){try{try{return Promise.resolve(Number(e))}catch(e){throw new Error("Decode Number Error : "+t.join("."))}}catch(e){return Promise.reject(e)}},n=function(e){return Promise.resolve(e)},o=function(e,r,t){try{return Promise.resolve(e.fields.reduce(function(e,n){try{return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(s(n.value,r,[].concat(t,[n.name]))).then(function(r){return e[n.name]=r,e})})}catch(e){return Promise.reject(e)}},Promise.resolve({}))).then(function(t){var n=e.id&&i(r,e.id);return n?Promise.resolve(n(t)):t})}catch(e){return Promise.reject(e)}},c={UInt:t,Int:t,UInt8:t,Int8:t,UInt16:t,Int16:t,UInt32:t,Int32:t,UInt64:t,Int64:t,UInt128:t,Int128:t,UInt256:t,Int256:t,Word8:t,Word16:t,Word32:t,Word64:t,UFix64:n,Fix64:n,String:n,Character:n,Bool:n,Address:n,Void:function(){return Promise.resolve(null)},Optional:function(e,r,t){return Promise.resolve(e?s(e,r,t):null)},Reference:function(e){try{return Promise.resolve({address:e.address,type:e.type})}catch(e){return Promise.reject(e)}},Array:function(e,r,t){try{return Promise.resolve(Promise.all(e.map(function(e){return new Promise(function(n){try{return Promise.resolve(s(e,r,[].concat(t,[e.type]))).then(n)}catch(e){return Promise.reject(e)}})})))}catch(e){return Promise.reject(e)}},Dictionary:function(e,r,t){try{return Promise.resolve(e.reduce(function(e,n){try{return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(s(n.key,r,[].concat(t,[n.key]))).then(function(o){return Promise.resolve(s(n.value,r,[].concat(t,[n.key]))).then(function(r){return e[o]=r,e})})})}catch(e){return Promise.reject(e)}},Promise.resolve({})))}catch(e){return Promise.reject(e)}},Event:o,Resource:o,Struct:o},i=function(e,r){var t=Object.keys(e).find(function(e){return/^\/.*\/$/.test(e)?new RegExp(e.substring(1,e.length-1)).test(r):e===r});return r&&t&&e[t]},s=function(e,r,t){try{var n=i(r,e.type);if(!n)throw new Error("Undefined Decoder Error: "+e.type+"@"+t.join("."));return Promise.resolve(n(e.value,r,t))}catch(e){return Promise.reject(e)}},a=function(e,t,n){void 0===t&&(t={}),void 0===n&&(n=[]);var o=r({},c,{},t);return Promise.resolve(s(e,o,n))};e.decode=a,e.decodeResponse=function(e,t){void 0===t&&(t={});try{var n=!1,o=r({},c,{},t),i=e.encodedData?(n=!0,Promise.resolve(a(e.encodedData,o))):e.transaction?(n=!0,Promise.resolve(Promise.all(e.transaction.events.map(function(e){try{var r=e.eventIndex,t=e.transactionIndex,n=e.transactionId,c=e.type;return Promise.resolve(a(e.payload,o)).then(function(e){return{type:c,transactionId:n,transactionIndex:t,eventIndex:r,data:e}})}catch(e){return Promise.reject(e)}}))).then(function(t){return r({},e.transaction,{events:t})})):e.events?(n=!0,Promise.resolve(Promise.all(e.events.map(function(e){try{var r=e.eventIndex,t=e.transactionIndex,n=e.transactionId,c=e.type;return Promise.resolve(a(e.payload,o)).then(function(e){return{type:c,transactionId:n,transactionIndex:t,eventIndex:r,data:e}})}catch(e){return Promise.reject(e)}})))):e.account?(n=!0,e.account):e.block?(n=!0,e.block):e.latestBlock?(console.error("\n %c@onflow/decode Deprecation Notice\n ========================\n\n Operating upon data of the latestBlock field of the response object is deprecated and will no longer be recognized in future releases of @onflow/decode.\n Find out more here: https://github.com/onflow/flow-js-sdk/blob/master/packages/decode/WARNINGS.md#0001-Deprecating-latestBlock-field\n\n =======================\n ".replace(/\n\s+/g,"\n").trim(),"font-weight:bold;font-family:monospace;"),n=!0,e.latestBlock):e.transactionId?(n=!0,e.transactionId):void 0;return Promise.resolve(i&&i.then?i.then(function(e){return n?e:null}):n?i:null)}catch(e){return Promise.reject(e)}}}); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e=e||self).decode={})}(this,function(e){function r(){return(r=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var t=function(e,r,t){try{try{return Promise.resolve(Number(e))}catch(e){throw new Error("Decode Number Error : "+t.join("."))}}catch(e){return Promise.reject(e)}},n=function(e){return Promise.resolve(e)},o=function(e,r,t){try{return Promise.resolve(e.fields.reduce(function(e,n){try{return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(s(n.value,r,[].concat(t,[n.name]))).then(function(r){return e[n.name]=r,e})})}catch(e){return Promise.reject(e)}},Promise.resolve({}))).then(function(t){var n=e.id&&i(r,e.id);return n?Promise.resolve(n(t)):t})}catch(e){return Promise.reject(e)}},c={UInt:t,Int:t,UInt8:t,Int8:t,UInt16:t,Int16:t,UInt32:t,Int32:t,UInt64:t,Int64:t,UInt128:t,Int128:t,UInt256:t,Int256:t,Word8:t,Word16:t,Word32:t,Word64:t,UFix64:n,Fix64:n,String:n,Character:n,Bool:n,Address:n,Void:function(){return Promise.resolve(null)},Optional:function(e,r,t){return Promise.resolve(e?s(e,r,t):null)},Reference:function(e){try{return Promise.resolve({address:e.address,type:e.type})}catch(e){return Promise.reject(e)}},Array:function(e,r,t){try{return Promise.resolve(Promise.all(e.map(function(e){return new Promise(function(n){try{return Promise.resolve(s(e,r,[].concat(t,[e.type]))).then(n)}catch(e){return Promise.reject(e)}})})))}catch(e){return Promise.reject(e)}},Dictionary:function(e,r,t){try{return Promise.resolve(e.reduce(function(e,n){try{return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(s(n.key,r,[].concat(t,[n.key]))).then(function(o){return Promise.resolve(s(n.value,r,[].concat(t,[n.key]))).then(function(r){return e[o]=r,e})})})}catch(e){return Promise.reject(e)}},Promise.resolve({})))}catch(e){return Promise.reject(e)}},Event:o,Resource:o,Struct:o},i=function(e,r){var t=Object.keys(e).find(function(e){return/^\/.*\/$/.test(e)?new RegExp(e.substring(1,e.length-1)).test(r):e===r});return r&&t&&e[t]},s=function(e,r,t){try{var n=i(r,e.type);if(!n)throw new Error("Undefined Decoder Error: "+e.type+"@"+t.join("."));return Promise.resolve(n(e.value,r,t))}catch(e){return Promise.reject(e)}},a=function(e,t,n){void 0===t&&(t={}),void 0===n&&(n=[]);var o=r({},c,{},t);return Promise.resolve(s(e,o,n))};e.decode=a,e.decodeResponse=function(e,t){void 0===t&&(t={});try{var n=!1,o=r({},c,{},t),i=e.encodedData?(n=!0,Promise.resolve(a(e.encodedData,o))):e.transaction?(n=!0,Promise.resolve(Promise.all(e.transaction.events.map(function(e){try{var r=e.eventIndex,t=e.transactionIndex,n=e.transactionId,c=e.type;return Promise.resolve(a(e.payload,o)).then(function(e){return{type:c,transactionId:n,transactionIndex:t,eventIndex:r,data:e}})}catch(e){return Promise.reject(e)}}))).then(function(t){return r({},e.transaction,{events:t})})):e.events?(n=!0,Promise.resolve(Promise.all(e.events.map(function(e){try{var r=e.eventIndex,t=e.transactionIndex,n=e.transactionId,c=e.type;return Promise.resolve(a(e.payload,o)).then(function(e){return{type:c,transactionId:n,transactionIndex:t,eventIndex:r,data:e}})}catch(e){return Promise.reject(e)}})))):e.account?(n=!0,e.account):e.block?(n=!0,e.block):e.blockHeader?(n=!0,e.blockHeader):e.latestBlock?(console.error("\n %c@onflow/decode Deprecation Notice\n ========================\n\n Operating upon data of the latestBlock field of the response object is deprecated and will no longer be recognized in future releases of @onflow/decode.\n Find out more here: https://github.com/onflow/flow-js-sdk/blob/master/packages/decode/WARNINGS.md#0001-Deprecating-latestBlock-field\n\n =======================\n ".replace(/\n\s+/g,"\n").trim(),"font-weight:bold;font-family:monospace;"),n=!0,e.latestBlock):e.transactionId?(n=!0,e.transactionId):void 0;return Promise.resolve(i&&i.then?i.then(function(e){return n?e:null}):n?i:null)}catch(e){return Promise.reject(e)}}}); | ||
//# sourceMappingURL=decode.umd.js.map |
{ | ||
"name": "@onflow/decode", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "Flow SDK Decoder", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -164,2 +164,4 @@ const latestBlockDeprecationNotice = () => { | ||
return response.block | ||
} else if (response.blockHeader) { | ||
return response.blockHeader | ||
} else if (response.latestBlock) { | ||
@@ -166,0 +168,0 @@ latestBlockDeprecationNotice() |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
93537
1252