@onflow/decode
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -5,2 +5,6 @@ ### Unreleased | ||
### 0.0.8 -- 2020-10-08 | ||
- 2020-10-08 -- Auto decode account code | ||
### 0.0.7 -- 2020-08-25 | ||
@@ -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})})):function(){if(r.events)return 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)}})));if(r.account){var e=r.account;return e.code=new TextDecoder("utf-8").decode(e),n=!0,e}return 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)}}; | ||
//# 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})})):function(){if(r.events)return 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)}})));if(r.account){var e=r.account;return e.code=new TextDecoder("utf-8").decode(e),n=!0,e}return 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}; | ||
//# 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})})):function(){if(r.events)return 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)}})));if(r.account){var e=r.account;return e.code=new TextDecoder("utf-8").decode(e),n=!0,e}return 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}; | ||
//# 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})})):function(){if(e.events)return 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)}})));if(e.account){var r=e.account;return r.code=new TextDecoder("utf-8").decode(r),n=!0,r}return 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)}}}); | ||
//# sourceMappingURL=decode.umd.js.map |
{ | ||
"name": "@onflow/decode", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Flow SDK Decoder", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -161,3 +161,5 @@ const latestBlockDeprecationNotice = () => { | ||
} else if (response.account) { | ||
return response.account | ||
const acct = response.account | ||
acct.code = new TextDecoder("utf-8").decode(acct) | ||
return acct | ||
} else if (response.block) { | ||
@@ -164,0 +166,0 @@ return response.block |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
93910
1252
0