Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@onflow/sdk

Package Overview
Dependencies
Maintainers
12
Versions
166
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@onflow/sdk - npm Package Compare versions

Comparing version 0.0.57-alpha.4 to 0.0.57-multisig.0

src/utils/logger.js

16

CHANGELOG.md
## Unreleased
- 2022-03-16 -- [@bthaile](https://github.com/bthaile) Payer can now be an array of keys on a single account. Non-array payer is deprecated and will error in future versions of sdk.
- 2022-03-16 -- [@chasefleming](https://github.com/chasefleming): Warn about field renamings/deprecations. To turn on warnings, set config `log.level` to `2`.
```js
sdk.config("logger.level", 2)
```
- 2022-02-11 -- Uses Buffer from @onflow/rlp in encode.
- 2022-02-11 -- Injects Buffer from @onflow/rlp to transport send modules.
- 2022-02-04 -- [@chasefleming](https://github.com/chasefleming): Add options for for getting account by block height.
```javascript
await sdk.account("0x123") // Existing: get account at the latest block
await sdk.account("0x123", {height: 123}) // New: get account at the block with the provided height
```
## 0.0.57-alpha.3 -- 2022-02-02

@@ -4,0 +20,0 @@

2

dist/sdk.js

@@ -1,2 +0,2 @@

var e=require("@onflow/util-invariant"),n=require("@onflow/util-actor"),r=require("@onflow/util-address"),t=require("sha3"),o=require("@onflow/rlp"),i=require("@onflow/util-template");function u(){return u=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},u.apply(this,arguments)}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function s(e,n){return s=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},s(e,n)}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function l(e,n,r){return l=a()?Reflect.construct:function(e,n,r){var t=[null];t.push.apply(t,n);var o=new(Function.bind.apply(e,t));return r&&s(o,r.prototype),o},l.apply(null,arguments)}function f(e){var n="function"==typeof Map?new Map:void 0;return f=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,r)}function r(){return l(e,arguments,c(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),s(r,e)},f(e)}function d(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=new Array(n);r<n;r++)t[r]=e[r];return t}var p,m='{\n "tag":"UNKNOWN",\n "assigns":{},\n "status":"OK",\n "reason":null,\n "accounts":{},\n "params":{},\n "arguments":{},\n "message": {\n "cadence":null,\n "refBlock":null,\n "computeLimit":null,\n "proposer":null,\n "payer":null,\n "authorizations":[],\n "params":[],\n "arguments":[]\n },\n "proposer":null,\n "authorizations":[],\n "payer":null,\n "events": {\n "eventType":null,\n "start":null,\n "end":null,\n "blockIds":[]\n },\n "transaction": {\n "id":null\n },\n "block": {\n "id":null,\n "height":null,\n "isSealed":null\n },\n "account": {\n "addr":null\n },\n "collection": {\n "id":null\n }\n}',h=new Set(Object.keys(JSON.parse(m))),v=function(){return JSON.parse(m)},g="abcdefghijklmnopqrstuvwxyz0123456789".split(""),y=function(){return g[~~(Math.random()*g.length)]},k=function(){return Array.from({length:10},y).join("")},b=function(e){return"number"==typeof e},I=function(e){return Array.isArray(e)},P=function(e){return null!==e&&"object"==typeof e},x=function(e){return null==e},T=function(e){return"function"==typeof e},S=function(e){if(!P(e)||x(e)||b(e))return!1;for(var n,r=function(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,n){if(e){if("string"==typeof e)return d(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?d(e,n):void 0}}(e))){r&&(e=r);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(h);!(n=r()).done;)if(!e.hasOwnProperty(n.value))return!1;return!0},E=function(e){return e.status="OK",e},A=function(e,n){return e.status="BAD",e.reason=n,e},w=function(e){return function(n){return n.tag=e,E(n)}},N=function(n,r){return void 0===r&&(r={}),function(t){var o;e.invariant("function"==typeof n||"object"==typeof n,"prepAccount must be passed an authorization function or an account object"),e.invariant(null!=r.role,"Account must have a role");var i=JSON.parse('{\n "kind":"ACCOUNT",\n "tempId":null,\n "addr":null,\n "keyId":null,\n "sequenceNum":null,\n "signature":null,\n "signingFunction":null,\n "resolve":null,\n "role": {\n "proposer":false,\n "authorizer":false,\n "payer":false,\n "param":false\n }\n}'),c=r.role,s=k();return n.authorization&&T(n.authorization)&&(n={resolve:n.authorization}),!n.authorization&&T(n)&&(n={resolve:n}),t.accounts[s]=u({},i,{tempId:s},n,{role:u({},i.role,"object"==typeof n.role?n.role:{},(o={},o[c]=!0,o))}),"authorizer"===c?t.authorizations.push(s):t[c]=s,t}},O=function(e){return function(n){var r=k();return n.message.arguments.push(r),n.arguments[r]=JSON.parse('{\n "kind":"ARGUMENT",\n "tempId":null,\n "value":null,\n "asArgument":null,\n "xform":null,\n "resolve": null,\n "resolveArgument": null\n}'),n.arguments[r].tempId=r,n.arguments[r].value=e.value,n.arguments[r].asArgument=e.asArgument,n.arguments[r].xform=e.xform,n.arguments[r].resolve=e.resolve,n.arguments[r].resolveArgument=T(e.resolveArgument)?e.resolveArgument.bind(e):e.resolveArgument,E(n)}},B=w("UNKNOWN"),G=w("SCRIPT"),C=w("TRANSACTION"),_=w("GET_TRANSACTION_STATUS"),j=w("GET_TRANSACTION"),L=w("GET_ACCOUNT"),R=w("GET_EVENTS"),K=w("GET_LATEST_BLOCK"),D=w("GET_BLOCK_BY_ID"),U=w("GET_BLOCK_BY_HEIGHT"),F=w("PING"),z=w("GET_BLOCK"),H=w("GET_BLOCK_HEADER"),q=w("GET_COLLECTION"),M=function(e){return function(n){return n.tag===e}},Y=M("UNKNOWN"),V=M("SCRIPT"),W=M("TRANSACTION"),J=M("GET_TRANSACTION_STATUS"),$=M("GET_TRANSACTION"),Z=M("GET_ACCOUNT"),Q=M("GET_EVENTS"),X=M("GET_LATEST_BLOCK"),ee=M("GET_BLOCK_BY_ID"),ne=M("GET_BLOCK_BY_HEIGHT"),re=M("PING"),te=M("GET_BLOCK"),oe=M("GET_BLOCK_HEADER"),ie=M("GET_COLLECTION"),ue=function(e){return"OK"===e.status},ce=function(e){return"BAD"===e.status},se=function(e){return e.reason},ae=function e(n,r){void 0===r&&(r=[]);try{return Promise.resolve(function(t,o){try{var i=Promise.resolve(n).then(function(t){if(n=function(e){for(var n=0,r=Object.keys(e);n<r.length;n++){var t=r[n];if(!h.has(t))throw new Error('"'+t+'" is an invalid root level Interaction property.')}return e}(t),ce(n))throw new Error("Interaction Error: "+n.reason);if(!r.length)return n;var o=r[0],i=r.slice(1);return Promise.resolve(o).then(function(r){if(T(r))return e(r(n),i);if(x(r)||!r)return e(n,i);if(S(r))return e(r,i);throw new Error("Invalid Interaction Composition")})})}catch(e){return o(e)}return i&&i.then?i.then(void 0,o):i}(0,function(e){throw e}))}catch(e){return Promise.reject(e)}},le=function e(){var n=[].slice.call(arguments),r=n[0],t=n[1];return I(r)&&null==t?function(n){return e(n,r)}:ae(r,t)},fe=function(e){return e},de=function(e,n,r){return null==e.assigns[n]?r:e.assigns[n]},pe=function(e,n){return function(r){return r.assigns[e]=n,E(r)}},me=function(e,n){return void 0===n&&(n=fe),function(r){return r.assigns[e]=n(r.assigns[e],r),E(r)}},he=function(e){return function(n){return delete n.assigns[e],E(n)}},ve={__proto__:null,UNKNOWN:"UNKNOWN",SCRIPT:"SCRIPT",TRANSACTION:"TRANSACTION",GET_TRANSACTION_STATUS:"GET_TRANSACTION_STATUS",GET_ACCOUNT:"GET_ACCOUNT",GET_EVENTS:"GET_EVENTS",GET_LATEST_BLOCK:"GET_LATEST_BLOCK",PING:"PING",GET_TRANSACTION:"GET_TRANSACTION",GET_BLOCK_BY_ID:"GET_BLOCK_BY_ID",GET_BLOCK_BY_HEIGHT:"GET_BLOCK_BY_HEIGHT",GET_BLOCK:"GET_BLOCK",GET_BLOCK_HEADER:"GET_BLOCK_HEADER",GET_COLLECTION:"GET_COLLECTION",BAD:"BAD",OK:"OK",ACCOUNT:"ACCOUNT",PARAM:"PARAM",ARGUMENT:"ARGUMENT",AUTHORIZER:"authorizer",PAYER:"payer",PROPOSER:"proposer",interaction:v,uuid:k,isNumber:b,isArray:I,isObj:P,isNull:x,isFn:T,isInteraction:S,Ok:E,Bad:A,prepAccount:N,makeArgument:O,makeUnknown:B,makeScript:G,makeTransaction:C,makeGetTransactionStatus:_,makeGetTransaction:j,makeGetAccount:L,makeGetEvents:R,makeGetLatestBlock:K,makeGetBlockById:D,makeGetBlockByHeight:U,makePing:F,makeGetBlock:z,makeGetBlockHeader:H,makeGetCollection:q,isUnknown:Y,isScript:V,isTransaction:W,isGetTransactionStatus:J,isGetTransaction:$,isGetAccount:Z,isGetEvents:Q,isGetLatestBlock:X,isGetBlockById:ee,isGetBlockByHeight:ne,isPing:re,isGetBlock:te,isGetBlockHeader:oe,isGetCollection:ie,isOk:ue,isBad:ce,why:se,isAccount:function(e){return"ACCOUNT"===e.kind},isParam:function(e){return"PARAM"===e.kind},isArgument:function(e){return"ARGUMENT"===e.kind},pipe:le,get:de,put:pe,update:me,destroy:he};function ge(e){return void 0===e&&(e=[]),le(v(),e)}var ye=function e(n,r){void 0===n&&(n=[]);try{if(!n.length)return Promise.resolve(r);var t=n[0],o=n.slice(1);return Promise.resolve(Ee(t)).then(function(n){return null==n?e(o,r):n})}catch(e){return Promise.reject(e)}},ke="config",be="PUT_CONFIG",Ie="GET_CONFIG",Pe="CONFIG/UPDATED",xe=function(e){return e},Te=((p={})[be]=function(e,n,r){var t=r.key,o=r.value;if(null==t)throw new Error("Missing 'key' for config/put.");e.put(t,o),e.broadcast(Pe,u({},e.all()))},p[Ie]=function(e,n,r){var t=r.key,o=r.fallback;if(null==t)throw new Error("Missing 'key' for config/get");n.reply(e.get(t,o))},p.GET_ALL_CONFIG=function(e,n){n.reply(u({},e.all()))},p.UPDATE_CONFIG=function(e,n,r){var t=r.key,o=r.fn;if(null==t)throw new Error("Missing 'key' for config/update");e.update(t,o||xe),e.broadcast(Pe,u({},e.all()))},p.DELETE_CONFIG=function(e,n,r){var t=r.key;if(null==t)throw new Error("Missing 'key' for config/delete");e.delete(t),e.broadcast(Pe,u({},e.all()))},p.CLEAR_CONFIG=function(e,n){for(var r=0,t=Object.keys(e.all());r<t.length;r++)e.delete(t[r]);e.broadcast(Pe,u({},e.all()))},p.WHERE_CONFIG=function(e,n,r){var t=r.pattern;if(null==t)throw new Error("Missing 'pattern' for config/where");n.reply(e.where(t))},p[n.SUBSCRIBE]=function(e,n){e.subscribe(n.from),e.send(n.from,Pe,u({},e.all()))},p[n.UNSUBSCRIBE]=function(e,n){e.unsubscribe(n.from)},p);function Se(e,r){return n.send(ke,be,{key:e,value:r}),Ce()}function Ee(e,r){return n.send(ke,Ie,{key:e,fallback:r},{expectReply:!0,timeout:10})}function Ae(){return n.send(ke,"GET_ALL_CONFIG",null,{expectReply:!0,timeout:10})}function we(e,r){return void 0===r&&(r=xe),n.send(ke,"UPDATE_CONFIG",{key:e,fn:r}),Ce()}function Ne(e){return n.send(ke,"DELETE_CONFIG",{key:e}),Ce()}function Oe(e){return n.send(ke,"WHERE_CONFIG",{pattern:e},{expectReply:!0,timeout:10})}function Be(e){return n.subscriber(ke,function(){return n.spawn(Te,ke)},e)}function Ge(){return n.send(ke,"CLEAR_CONFIG")}function Ce(e){return null!=e&&"object"==typeof e&&Object.keys(e).map(function(n){return Se(n,e[n])}),{put:Se,get:Ee,all:Ae,first:ye,update:we,delete:Ne,where:Oe,subscribe:Be,overload:je}}n.spawn(Te,ke),Ce.put=Se,Ce.get=Ee,Ce.all=Ae,Ce.first=ye,Ce.update=we,Ce.delete=Ne,Ce.where=Oe,Ce.subscribe=Be,Ce.overload=je;var _e=function(e){return e};function je(e,n){return void 0===e&&(e={}),void 0===n&&(n=_e),new Promise(function(r,t){try{return Promise.resolve(Ae()).then(function(o){var i=function(t,i){try{var u=function(){Ce(e);var t=n;return Promise.resolve(Ae()).then(function(e){return Promise.resolve(t(e)).then(function(e){return Promise.resolve(Ge()).then(function(){return Promise.resolve(Ce(o)).then(function(){r(e)})})})})}()}catch(e){return i(e)}return u&&u.then?u.then(void 0,i):u}(0,function(e){return Promise.resolve(Ge()).then(function(){return Promise.resolve(Ce(o)).then(function(){t(e)})})});if(i&&i.then)return i.then(function(){})})}catch(e){return Promise.reject(e)}})}var Le=function(){return JSON.parse('{\n "tag":null,\n "transaction":null,\n "transactionStatus":null,\n "transactionId":null,\n "encodedData":null,\n "events":null,\n "account":null,\n "block":null,\n "blockHeader":null,\n "latestBlock":null,\n "collection":null\n}')};function Re(e){return void 0===e&&(e=null),le([z,function(n){return n.block.isSealed=e,E(n)}])}function Ke(e){return le([L,function(n){return n.account.addr=r.sansPrefix(e),E(n)}])}var De=function(e,n,r){try{try{return Promise.resolve(Number(e))}catch(e){throw new Error("Decode Number Error : "+r.join("."))}}catch(e){return Promise.reject(e)}},Ue=function(e){return Promise.resolve(e)},Fe=function(e,n,r){try{return Promise.resolve(e.fields.reduce(function(e,t){return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(qe(t.value,n,[].concat(r,[t.name]))).then(function(n){return e[t.name]=n,e})})},Promise.resolve({}))).then(function(r){var t=e.id&&He(n,e.id);return t?Promise.resolve(t(r)):r})}catch(e){return Promise.reject(e)}},ze={UInt:De,Int:De,UInt8:De,Int8:De,UInt16:De,Int16:De,UInt32:De,Int32:De,UInt64:De,Int64:De,UInt128:De,Int128:De,UInt256:De,Int256:De,Word8:De,Word16:De,Word32:De,Word64:De,UFix64:Ue,Fix64:Ue,String:Ue,Character:Ue,Bool:Ue,Address:Ue,Void:function(){return Promise.resolve(null)},Optional:function(e,n,r){return Promise.resolve(e?qe(e,n,r):null)},Reference:function(e){try{return Promise.resolve({address:e.address,type:e.type})}catch(e){return Promise.reject(e)}},Array:function(e,n,r){try{return Promise.resolve(Promise.all(e.map(function(e){return new Promise(function(t){try{return Promise.resolve(qe(e,n,[].concat(r,[e.type]))).then(t)}catch(e){return Promise.reject(e)}})})))}catch(e){return Promise.reject(e)}},Dictionary:function(e,n,r){try{return Promise.resolve(e.reduce(function(e,t){return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(qe(t.key,n,[].concat(r,[t.key]))).then(function(o){return Promise.resolve(qe(t.value,n,[].concat(r,[t.key]))).then(function(n){return e[o]=n,e})})})},Promise.resolve({})))}catch(e){return Promise.reject(e)}},Event:Fe,Resource:Fe,Struct:Fe,Enum:Fe,Type:function(e){try{return Promise.resolve(e.staticType)}catch(e){return Promise.reject(e)}},Path:function(e){try{return Promise.resolve({domain:e.domain,identifier:e.identifier})}catch(e){return Promise.reject(e)}},Capability:function(e){try{return Promise.resolve({path:e.path,address:e.address,borrowType:e.borrowType})}catch(e){return Promise.reject(e)}}},He=function(e,n){var r=Object.keys(e).find(function(e){return/^\/.*\/$/.test(e)?new RegExp(e.substring(1,e.length-1)).test(n):e===n});return n&&r&&e[r]},qe=function(e,n,r){try{var t=He(n,e.type);if(!t)throw new Error("Undefined Decoder Error: "+e.type+"@"+r.join("."));return Promise.resolve(t(e.value,n,r))}catch(e){return Promise.reject(e)}},Me=function(e,n,r){void 0===n&&(n={}),void 0===r&&(r=[]);var t=u({},ze,n);return Promise.resolve(qe(e,t,r))},Ye=function(e,n){void 0===n&&(n={});try{var r,t=u({},ze,n),o=e.encodedData?Promise.resolve(Me(e.encodedData,t)).then(function(e){return r=1,e}):e.transactionStatus?Promise.resolve(Promise.all(e.transactionStatus.events.map(function(e){try{var n=e.eventIndex,r=e.transactionIndex,o=e.transactionId,i=e.type;return Promise.resolve(Me(e.payload,t)).then(function(e){return{type:i,transactionId:o,transactionIndex:r,eventIndex:n,data:e}})}catch(e){return Promise.reject(e)}}))).then(function(n){var t=u({},e.transactionStatus,{events:n});return r=1,t}):e.transaction?(r=1,e.transaction):e.events?Promise.resolve(Promise.all(e.events.map(function(e){try{var n=e.eventIndex,r=e.transactionIndex,o=e.transactionId,i=e.type,u=e.blockTimestamp,c=e.blockHeight,s=e.blockId;return Promise.resolve(Me(e.payload,t)).then(function(e){return{blockId:s,blockHeight:c,blockTimestamp:u,type:i,transactionId:o,transactionIndex:r,eventIndex:n,data:e}})}catch(e){return Promise.reject(e)}}))).then(function(e){return r=1,e}):e.account?(r=1,e.account):e.block?(r=1,e.block):e.blockHeader?(r=1,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;"),r=1,e.latestBlock):e.transactionId?(r=1,e.transactionId):e.collection?(r=1,e.collection):void 0;return Promise.resolve(o&&o.then?o.then(function(e){return r?e:null}):r?o:null)}catch(e){return Promise.reject(e)}},Ve=function(n){try{var r=function(){if(W(n)||V(n)){var r=function(){return e.invariant(Je(t),"Cadence needs to be a string at this point."),Promise.resolve(Ce().where(/^0x/).then(function(e){return Object.entries(e).reduce(function(e,n){var r=n[1],t=new RegExp("(\\b"+n[0]+"\\b)","g");return e.replace(t,r)},t)})).then(function(e){n.message.cadence=e})},t=de(n,"ix.cadence");e.invariant(We(t)||Je(t),"Cadence needs to be a function or a string.");var o=function(){if(We(t))return Promise.resolve(t({})).then(function(e){t=e})}();return o&&o.then?o.then(r):r()}}();return Promise.resolve(r&&r.then?r.then(function(){return n}):n)}catch(e){return Promise.reject(e)}},We=function(e){return"function"==typeof e},Je=function(e){return"string"==typeof e};const $e="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function Ze(e,n,r){if(!e.s){if(r instanceof Qe){if(!r.s)return void(r.o=Ze.bind(null,e,n));1&n&&(n=r.s),r=r.v}if(r&&r.then)return void r.then(Ze.bind(null,e,n),Ze.bind(null,e,2));e.s=n,e.v=r;var t=e.o;t&&t(e)}}var Qe=function(){function e(){}return e.prototype.then=function(n,r){var t=new e,o=this.s;if(o){var i=1&o?n:r;if(i){try{Ze(t,1,i(this.v))}catch(e){Ze(t,2,e)}return t}return this}return this.o=function(e){try{var o=e.v;1&e.s?Ze(t,1,n?n(o):o):r?Ze(t,1,r(o)):Ze(t,2,o)}catch(e){Ze(t,2,e)}},t},e}();function Xe(e){return e instanceof Qe&&1&e.s}var en,nn=function(n){try{var r=function(){if(W(n)||V(n)){var r=function(e,n,r){if("function"==typeof e[$e]){var t,o,i,u=e[$e]();if(function e(r){try{for(;!(t=u.next()).done;)if((r=n(t.value))&&r.then){if(!Xe(r))return void r.then(e,i||(i=Ze.bind(null,o=new Qe,2)));r=r.v}o?Ze(o,1,r):o=r}catch(e){Ze(o||(o=new Qe),2,e)}}(),u.return){var c=function(e){try{t.done||u.return()}catch(e){}return e};if(o&&o.then)return o.then(c,function(e){throw c(e)});c()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var s=[],a=0;a<e.length;a++)s.push(e[a]);return function(e,n,r){var t,o,i=-1;return function r(u){try{for(;++i<e.length;)if((u=n(i))&&u.then){if(!Xe(u))return void u.then(r,o||(o=Ze.bind(null,t=new Qe,2)));u=u.v}t?Ze(t,1,u):t=u}catch(e){Ze(t||(t=new Qe),2,e)}}(),t}(s,function(e){return n(s[e])})}(Object.entries(n.arguments),function(r){var t=r[0];return Promise.resolve(rn(r[1])).then(function(r){var o;n.arguments[t].asArgument=(e.invariant(null!=typeof(o=r).xform,"No type specified for argument: "+o.value),tn(o.xform)?o.xform(o.value):tn(o.xform.asArgument)?o.xform.asArgument(o.value):void e.invariant(!1,"Invalid Argument",o))})});if(r&&r.then)return r.then(function(){})}}();return Promise.resolve(r&&r.then?r.then(function(){return n}):n)}catch(e){return Promise.reject(e)}},rn=function n(r,t){void 0===t&&(t=3);try{return e.invariant(t>0,"Argument Resolve Recursion Limit Exceeded for Arg: "+r.tempId),tn(r.resolveArgument)?Promise.resolve(r.resolveArgument()).then(function(e){return n(e,t-1)}):Promise.resolve(r)}catch(e){return Promise.reject(e)}},tn=function(e){return"function"==typeof e},on=function(e){return an(hn(vn(e)))},un=function(e){return an(hn(gn(e)))},cn=function(e,n){return Buffer.from(e.padStart(2*n,0),"hex")},sn=(en=Buffer.from("FLOW-V0.0-transaction").toString("hex"),Buffer.from(en.padEnd(64,0),"hex")).toString("hex"),an=function(e){return sn+e},ln=function(e){return cn(e,8)},fn=function(e){return cn(e,32)},dn=function(e){return Buffer.from(JSON.stringify(e),"utf8")},pn=function(e){return Buffer.from(e,"utf8")},mn=function(e){return Buffer.from(e,"hex")},hn=function(e){return o.encode(e).toString("hex")},vn=function(e){return bn(e),[pn(e.cadence),e.arguments.map(dn),fn(e.refBlock),e.computeLimit,ln(e.proposalKey.address),e.proposalKey.keyId,e.proposalKey.sequenceNum,ln(e.payer),e.authorizers.map(ln)]},gn=function(e){return In(e),[vn(e),yn(e)]},yn=function(e){var n=kn(e);return e.payloadSigs.map(function(e){return{signerIndex:n.get(e.address),keyId:e.keyId,sig:e.sig}}).sort(function(e,n){return e.signerIndex>n.signerIndex?1:e.signerIndex<n.signerIndex?-1:e.keyId>n.keyId?1:e.keyId<n.keyId?-1:void 0}).map(function(e){return[e.signerIndex,e.keyId,mn(e.sig)]})},kn=function(e){var n=new Map,r=0,t=function(e){n.has(e)||(n.set(e,r),r++)};return t(e.proposalKey.address),t(e.payer),e.authorizers.forEach(t),n},bn=function(e){En.forEach(function(n){return Gn(e,n)}),An.forEach(function(n){return Gn(e.proposalKey,n,"proposalKey")})},In=function(e){wn.forEach(function(n){return Gn(e,n)}),e.payloadSigs.forEach(function(e,n){Nn.forEach(function(r){return Gn(e,r,"payloadSigs",n)})})},Pn=function(e){return"number"==typeof e},xn=function(e){return"string"==typeof e},Tn=function(e){return null!==e&&"object"==typeof e},Sn=function(e){return Tn(e)&&e instanceof Array},En=[{name:"cadence",check:xn},{name:"arguments",check:Sn},{name:"refBlock",check:xn,defaultVal:"0"},{name:"computeLimit",check:Pn},{name:"proposalKey",check:Tn},{name:"payer",check:xn},{name:"authorizers",check:Sn}],An=[{name:"address",check:xn},{name:"keyId",check:Pn},{name:"sequenceNum",check:Pn}],wn=[{name:"payloadSigs",check:Sn}],Nn=[{name:"address",check:xn},{name:"keyId",check:Pn},{name:"sig",check:xn}],On=[{name:"envelopeSigs",check:Sn}],Bn=[{name:"address",check:xn},{name:"keyId",check:Pn},{name:"sig",check:xn}],Gn=function(e,n,r,t){var o=n.name,i=n.check,u=n.defaultVal;if(null==e[o]&&null!=u&&(e[o]=u),null==e[o])throw _n(o,r,t);if(!i(e[o]))throw jn(o,r,t)},Cn=function(e,n,r){return n?null==r?n+"."+e:n+"."+r+"."+e:e},_n=function(e,n,r){return new Error("Missing field "+Cn(e,n,r))},jn=function(e,n,r){return new Error("Invalid field "+Cn(e,n,r))};function Ln(e){var n=new Set(e.authorizations);return n.add(e.proposer),n.delete(e.payer),Array.from(n)}function Rn(e){var n=new Set([e.payer]);return Array.from(n)}var Kn=function(e){return{cadence:e.message.cadence,refBlock:e.message.refBlock||null,computeLimit:e.message.computeLimit,arguments:e.message.arguments.map(function(n){return e.arguments[n].asArgument}),proposalKey:{address:r.withPrefix(e.accounts[e.proposer].addr),keyId:e.accounts[e.proposer].keyId,sequenceNum:e.accounts[e.proposer].sequenceNum},payer:r.withPrefix(e.accounts[e.payer].addr),authorizers:(n=e.authorizations.map(function(n){return r.withPrefix(e.accounts[n].addr)}).reduce(function(e,n){return e.find(function(e){return e===n})?e:[].concat(e,[n])},[]),n[0]?n:[]),payloadSigs:Ln(e).map(function(n){return{address:r.withPrefix(e.accounts[n].addr),keyId:e.accounts[n].keyId,sig:e.accounts[n].signature}}),envelopeSigs:Rn(e).map(function(n){return{address:r.withPrefix(e.accounts[n].addr),keyId:e.accounts[n].keyId,sig:e.accounts[n].signature}})};var n},Dn="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function Un(e,n,r){if(!e.s){if(r instanceof Fn){if(!r.s)return void(r.o=Un.bind(null,e,n));1&n&&(n=r.s),r=r.v}if(r&&r.then)return void r.then(Un.bind(null,e,n),Un.bind(null,e,2));e.s=n,e.v=r;var t=e.o;t&&t(e)}}var Fn=function(){function e(){}return e.prototype.then=function(n,r){var t=new e,o=this.s;if(o){var i=1&o?n:r;if(i){try{Un(t,1,i(this.v))}catch(e){Un(t,2,e)}return t}return this}return this.o=function(e){try{var o=e.v;1&e.s?Un(t,1,n?n(o):o):r?Un(t,1,r(o)):Un(t,2,o)}catch(e){Un(t,2,e)}},t},e}();function zn(e){return e instanceof Fn&&1&e.s}var Hn=function(e){try{var n=function(){if(W(e))return function(n,r){try{var t=Promise.resolve(qn(e,Object.values(e.accounts))).then(function(){return Promise.resolve(qn(e,Object.values(e.accounts))).then(function(){})})}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}(0,function(e){throw console.error("=== SAD PANDA ===\n\n",e,"\n\n=== SAD PANDA ==="),e})}();return Promise.resolve(n&&n.then?n.then(function(n){return e}):e)}catch(e){return Promise.reject(e)}},qn=function n(r,t,o,i){void 0===i&&(i=3);try{var u=function(){o&&(r.authorizations=r.authorizations.map(function(e){return e===o.tempId?c:e}).reduce(function(e,n){return Array.isArray(n)?[].concat(e,n):[].concat(e,[n])},[]))};e.invariant(i,"Account Resolve Recursion Limit Exceeded",{ix:r,accounts:t});var c=[],s=function(e,n,r){if("function"==typeof e[Dn]){var t,o,i,u=e[Dn]();if(function e(r){try{for(;!(t=u.next()).done;)if((r=n(t.value))&&r.then){if(!zn(r))return void r.then(e,i||(i=Un.bind(null,o=new Fn,2)));r=r.v}o?Un(o,1,r):o=r}catch(e){Un(o||(o=new Fn),2,e)}}(),u.return){var c=function(e){try{t.done||u.return()}catch(e){}return e};if(o&&o.then)return o.then(c,function(e){throw c(e)});c()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var s=[],a=0;a<e.length;a++)s.push(e[a]);return function(e,n,r){var t,o,i=-1;return function r(u){try{for(;++i<e.length;)if((u=n(i))&&u.then){if(!zn(u))return void u.then(r,o||(o=Un.bind(null,t=new Fn,2)));u=u.v}t?Un(t,1,u):t=u}catch(e){Un(t||(t=new Fn),2,e)}}(),t}(s,function(e){return n(s[e])})}(t,function(e){function t(){function t(){u.tempId!=e.tempId&&delete r.accounts[u.tempId]}var s=function(){if(Array.isArray(e))return Promise.resolve(n(r,e,u,i-1)).then(function(){});null!=e.addr&&null!=e.keyId&&(e.tempId=e.addr+"-"+e.keyId),r.accounts[e.tempId]=r.accounts[e.tempId]||e,r.accounts[e.tempId].role.proposer=r.accounts[e.tempId].role.proposer||e.role.proposer,r.accounts[e.tempId].role.payer=r.accounts[e.tempId].role.payer||e.role.payer,r.accounts[e.tempId].role.authorizer=r.accounts[e.tempId].role.authorizer||e.role.authorizer,r.accounts[e.tempId].role.proposer&&r.proposer===u.tempId&&(r.proposer=e.tempId),r.accounts[e.tempId].role.payer&&r.payer===u.tempId&&(r.payer=e.tempId),r.accounts[e.tempId].role.authorizer&&(o?c=Array.from(new Set([].concat(c,[e.tempId]))):r.authorizations=r.authorizations.map(function(n){return n===u.tempId?e.tempId:n}))}();return s&&s.then?s.then(t):t()}var u=o||e,s=function(){if(Mn(e.resolve))return Promise.resolve(e.resolve(e,function(e,n){try{return{f_type:"PreSignable",f_vsn:"1.0.1",roles:e.role,cadence:n.message.cadence,args:n.message.arguments.map(function(e){return n.arguments[e].asArgument}),data:{},interaction:n,voucher:Kn(n)}}catch(e){throw console.error("buildPreSignable",e),e}}(e,r))).then(function(n){e=n})}();return s&&s.then?s.then(t):t()});return Promise.resolve(s&&s.then?s.then(u):u())}catch(e){return Promise.reject(e)}},Mn=function(e){return"function"==typeof e},Yn=function(e){try{var n=function(){if(W(e))return function(n,r){try{var t=(o=Ln(e),i=on(Wn(e)),Promise.resolve(Promise.all(o.map(Vn(e,i)))).then(function(){var n=Rn(e),r=un(u({},Wn(e),{payloadSigs:o.map(function(n){return{address:e.accounts[n].addr,keyId:e.accounts[n].keyId,sig:e.accounts[n].signature}})}));return Promise.resolve(Promise.all(n.map(Vn(e,r)))).then(function(){})}))}catch(e){return r(e)}var o,i;return t&&t.then?t.then(void 0,r):t}(0,function(n){throw console.error("Signatures",n,{ix:e}),n})}();return Promise.resolve(n&&n.then?n.then(function(n){return e}):e)}catch(e){return Promise.reject(e)}};function Vn(e,n){return function(t){try{var o=e.accounts[t];return null!=o.signature?Promise.resolve():Promise.resolve(o.signingFunction(function(e,n,t){try{return{f_type:"Signable",f_vsn:"1.0.1",message:n,addr:r.sansPrefix(e.addr),keyId:e.keyId,roles:e.role,cadence:t.message.cadence,args:t.message.arguments.map(function(e){return t.arguments[e].asArgument}),data:{},interaction:t,voucher:Kn(t)}}catch(e){throw console.error("buildSignable",e),e}}(o,n,e))).then(function(n){e.accounts[t].signature=n.signature})}catch(e){return Promise.reject(e)}}}function Wn(e){return{cadence:e.message.cadence,refBlock:e.message.refBlock||null,computeLimit:e.message.computeLimit,arguments:e.message.arguments.map(function(n){return e.arguments[n].asArgument}),proposalKey:{address:r.sansPrefix(e.accounts[e.proposer].addr),keyId:e.accounts[e.proposer].keyId,sequenceNum:e.accounts[e.proposer].sequenceNum},payer:r.sansPrefix(e.accounts[e.payer].addr),authorizers:e.authorizations.map(function(n){return r.sansPrefix(e.accounts[n].addr)}).reduce(function(e,n){return e.find(function(e){return e===n})?e:[].concat(e,[n])},[])}}var Jn=function(e){try{var n=de(e,"ix.validators",[]);return Promise.resolve(le(e,n.map(function(e){return function(n){return e(n,{Ok:E,Bad:A})}})))}catch(e){return Promise.reject(e)}},$n=function(e){try{for(var n=0,t=Object.keys(e.accounts);n<t.length;n++){var o=t[n];e.accounts[o].addr=r.sansPrefix(e.accounts[o].addr)}return Promise.resolve(e)}catch(e){return Promise.reject(e)}},Zn=function(e){try{var n=de(e,"ix.voucher-intercept"),r=function(){if(T(n))return Promise.resolve(n(Kn(e))).then(function(){})}();return Promise.resolve(r&&r.then?r.then(function(){return e}):e)}catch(e){return Promise.reject(e)}},Qn=function(e){return e},Xn=function(e,n){return void 0===n&&(n=Qn),function(r){try{var t=function(e){return["\nAccounts:",{proposer:e.proposer,authorizations:e.authorizations,payer:e.payer},"\n\nDetails:",e.accounts].filter(Boolean)},o=function(){var n;(n=console).log.apply(n,["debug["+e+"] ---\n"].concat([].slice.call(arguments),["\n\n\n---"]))};return Promise.resolve(Ce.get("debug."+e)).then(function(e){var i=function(){if(e)return Promise.resolve(n(r,o,t)).then(function(){})}();return i&&i.then?i.then(function(){return r}):r})}catch(e){return Promise.reject(e)}}},er=le([Ve,Xn("cadence",function(e,n){return n(e.message.cadence)}),nn,Xn("arguments",function(e,n){return n(e.message.arguments,e.message)}),Hn,Xn("accounts",function(e,n,r){return n.apply(void 0,r(e))}),function(n){try{var r=function(){if(W(n)&&null==n.message.refBlock)return Promise.resolve(Ce().get("accessNode.api")).then(function(r){return Promise.resolve(Ce.first(["sdk.transport","sdk.send"])).then(function(t){return e.invariant(t,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(t(ge([Re()]),{config:Ce,response:Le,ix:ve},{node:r}).then(Ye)).then(function(e){n.message.refBlock=e.id})})})}();return Promise.resolve(r&&r.then?r.then(function(){return n}):n)}catch(e){return Promise.reject(e)}},function(n){try{var r=function(){if(W(n)){var r=Object.values(n.accounts).find(function(e){return e.role.proposer});e.invariant(r,"Transactions require a proposer");var t=function(){if(null==r.sequenceNum)return Promise.resolve(Ce().get("accessNode.api")).then(function(t){return Promise.resolve(Ce.first(["sdk.transport","sdk.send"])).then(function(o){return e.invariant(o,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(ge([Ke(r.addr)])).then(function(e){return Promise.resolve(o(e,{config:Ce,response:Le,ix:ve},{node:t}).then(Ye).then(function(e){return e.keys}).then(function(e){return e.find(function(e){return e.index===r.keyId})}).then(function(e){return e.sequenceNumber})).then(function(e){n.accounts[r.tempId].sequenceNum=e})})})})}();if(t&&t.then)return t.then(function(){})}}();return Promise.resolve(r&&r.then?r.then(function(){return n}):n)}catch(e){return Promise.reject(e)}},Yn,Xn("signatures",function(e,n,r){return n.apply(void 0,r(e))}),$n,Jn,Zn,Xn("resolved",function(e,n){return n(e)})]);function nr(){var e=[].slice.call(arguments);if(e.length>1){var n=e,r=n[0],t=n[1];return nr(function(e,n){var o=n.Bad;return r?(0,n.Ok)(e):o(e,t)})}var o=e[0];return function(e){return o(e,{Ok:E,Bad:A})}}var rr=function(e,n){void 0===e&&(e=[]),void 0===n&&(n={});try{return Promise.resolve(Ce.first(["sdk.transport","sdk.send"],n.send)).then(function(r){return nr(r,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(Ce.first(["sdk.resolve"],n.resolve||er)).then(function(t){function o(o){return n.node=o,Array.isArray(e)&&(e=le(v(),e)),Promise.resolve(t(e)).then(function(e){return r(e,{config:Ce,response:Le,ix:ve},n)})}var i=n.node;return i?o(i):Promise.resolve(Ce().get("accessNode.api")).then(o)})})}catch(e){return Promise.reject(e)}},tr=function(e){var n,r;function t(n){var r,t=("\n Encode Message From Signable Error: Unable to determine message encoding for signer addresss: "+n+". \n Please ensure the address: "+n+" is intended to sign the given transaction as specified by the transaction signable.\n ").trim();return(r=e.call(this,t)||this).name="Unable To Determine Message Encoding For Signer Addresss",r}return r=e,(n=t).prototype=Object.create(r.prototype),n.prototype.constructor=n,s(n,r),t}(f(Error));function or(e){return me("ix.validators",function(n){return Array.isArray(n)?n.push(e):[e]})}function ir(e){return le([function(n){return n.block.height=e,n},or(function(e){if("boolean"==typeof e.block.isSealed)throw new Error("Unable to specify both block height and isSealed.");if(e.block.id)throw new Error("Unable to specify both block height and block id.");return e})])}function ur(e){return le([function(n){return n.block.id=e,E(n)},or(function(e,n){var r=n.Ok,t=n.Bad;return Z(e)?t(e,"Unable to specify a block id with a Get Account interaction."):"boolean"==typeof e.block.isSealed?t(e,"Unable to specify both block id and isSealed."):e.block.height?t(e,"Unable to specify both block id and block height."):r(e)})])}function cr(e){return le([function(n){return n.message.refBlock=e,E(n)}])}var sr=[],ar=function(e){return e},lr=["tempId"];function fr(e){return["SIGNATURE",e.addr,e.keyId].join(".")}function dr(e){return void 0===e&&(e={}),function(n){var r=u({},n,e,{signingFunction:e.signingFunction||n.signingFunction||function(e){return{addr:r.addr,keyId:r.keyId,signature:fr(r)}}});return r}}var pr={proposer:!1,authorizer:!1,payer:!1},mr={__proto__:null,mockSend:function(n){return void 0===n&&(n=ar),function(r){return Promise.resolve(r).then(function(t){switch(r=t,!0){case Z(r):return function(n,r){return void 0===r&&(r=5),e.invariant(n.account,"mockAccountResponse(ix) -- ix.account is missing",n),e.invariant(n.account.addr,"mockAccountResponse(ix) -- ix.account.addr is missing",n),{account:{addr:n.account.addr,keys:Array.from({length:r},function(e,n){return{index:n,sequenceNumber:42}})}}}(r);case te(r):return{tag:"GET_BLOCK",block:{id:"32"}};default:return n(r)}})}},authzFn:dr,authzResolve:function(e){return void 0===e&&(e={}),function(n){return u({},n,{tempId:e.tempId||"WITH_RESOLVE",resolve:dr(function(e,n){if(null==e)return{};var r,t,o={},i=Object.keys(e);for(t=0;t<i.length;t++)n.indexOf(r=i[t])>=0||(o[r]=e[r]);return o}(e,lr))})}},authzResolveMany:function(e){return void 0===e&&(e={}),function(n){return u({},n,{tempId:e.tempId||"AUTHZ_RESOLVE_MANY",resolve:function(){return[e.proposer&&dr(e.proposer)({role:u({},pr,{proposer:!0})})].concat(e.authorizations.map(dr).map(function(e){return e({role:u({},pr,{authorizer:!0})})}),[e.payer&&dr(e.payer)({role:u({},pr,{payer:!0})})]).filter(Boolean)}})}},sig:fr,idof:function(e){return e.addr+"-"+e.keyId},run:function(e){return void 0===e&&(e=[]),ge([cr("123")].concat(e)).then(er)}};Object.defineProperty(exports,"cadence",{enumerable:!0,get:function(){return i.template}}),Object.defineProperty(exports,"cdc",{enumerable:!0,get:function(){return i.template}}),exports.TestUtils=mr,exports.VERSION="0.0.57-alpha.4",exports.account=function(e,n){return rr([Ke(e)],n).then(Ye)},exports.arg=function(e,n){return{value:e,xform:n}},exports.args=function(e){return void 0===e&&(e=[]),le(e.map(O))},exports.atBlockHeight=ir,exports.atBlockId=ur,exports.authorization=function(e,n,r,t){return{addr:e,signingFunction:n,keyId:r,sequenceNum:t}},exports.authorizations=function(e){return void 0===e&&(e=[]),le(e.map(function(e){return N(e,{role:"authorizer"})}))},exports.block=function(n,r){var t=void 0===n?{}:n,o=t.sealed,i=void 0!==o&&o,u=t.id,c=t.height;return void 0===r&&(r={}),e.invariant(!(i&&u||i&&c),'Method: block -- Cannot pass "sealed" with "id" or "height"'),e.invariant(!(u&&c),'Method: block -- Cannot pass "id" and "height" simultaneously'),u?rr([Re(),ur(u)],r).then(Ye):c?rr([Re(),ir(c)],r).then(Ye):rr([Re(i)],r).then(Ye)},exports.build=ge,exports.config=Ce,exports.createSignableVoucher=Kn,exports.decode=function(e){try{return Promise.resolve(Ce().where(/^decoder\./)).then(function(n){var r=Object.entries(n).map(function(e){var n=e[0],r=e[1];return[n="/"+n.replace(/^decoder\./,"")+"$/",r]});return Ye(e,Object.fromEntries(r))})}catch(e){return Promise.reject(e)}},exports.destroy=he,exports.encodeMessageFromSignable=function(e,n){var t,o,i=(t=e.voucher,(o=new Set(t.authorizers)).add(t.proposalKey.address),o.delete(t.payer),Array.from(o).map(r.withPrefix)),c=function(e){var n=new Set([e.payer]);return Array.from(n).map(r.withPrefix)}(e.voucher),s=i.includes(r.withPrefix(n)),a=c.includes(r.withPrefix(n));if(!s&&!a)throw new tr(n);var l={cadence:e.voucher.cadence,refBlock:e.voucher.refBlock,computeLimit:e.voucher.computeLimit,arguments:e.voucher.arguments,proposalKey:u({},e.voucher.proposalKey,{address:r.sansPrefix(e.voucher.proposalKey.address)}),payer:r.sansPrefix(e.voucher.payer),authorizers:e.voucher.authorizers.map(r.sansPrefix),payloadSigs:e.voucher.payloadSigs.map(function(e){return u({},e,{address:r.sansPrefix(e.address)})})};return s?on(l):un(l)},exports.get=de,exports.getAccount=Ke,exports.getBlock=Re,exports.getBlockByHeight=function(e){return console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getBlockByHeight builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0003-deprecate-get-block-by-height-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),le([U,function(n){return n.block.height=e,E(n)}])},exports.getBlockById=function(e){return console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getBlockById builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0004-deprecate-get-block-by-id-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),le([D,function(n){return n.block.ids=[e],E(n)}])},exports.getBlockHeader=function(e){return void 0===e&&(e=null),le([H,function(n){return n.block.isSealed=e,E(n)}])},exports.getCollection=function(e){return void 0===e&&(e=null),le([q,function(n){return n.collection.id=e,n}])},exports.getEvents=function(e,n,r){return void 0===n&&void 0===r||console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n \n Passing a start and end into getEnvents has been deprecated and will not be supported in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0005-deprecate-start-end-get-events-builder\n \n ============================\n ","font-weight:bold;font-family:monospace;"),le([R,function(t){return t.events.eventType=e,t.events.start=n,t.events.end=r,E(t)}])},exports.getEventsAtBlockHeightRange=function(e,n,r){return le([R,function(t){return t.events.eventType=e,t.events.start=n,t.events.end=r,E(t)}])},exports.getEventsAtBlockIds=function(e,n){return void 0===n&&(n=[]),le([R,function(r){return r.events.eventType=e,r.events.blockIds=n,E(r)}])},exports.getLatestBlock=function(e){return void 0===e&&(e=!1),console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getLatestBlock builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0006-deprecate-get-latest-block-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),le([K,function(n){return n.block.isSealed=e,E(n)}])},exports.getTransaction=function(e){return le([j,function(n){return n.transaction.id=e,E(n)}])},exports.getTransactionStatus=function(e){return le([_,function(n){return n.transaction.id=e,E(n)}])},exports.interaction=v,exports.invariant=nr,exports.isBad=ce,exports.isGetAccount=Z,exports.isGetBlock=te,exports.isGetBlockByHeight=ne,exports.isGetBlockById=ee,exports.isGetBlockHeader=oe,exports.isGetCollection=ie,exports.isGetEvents=Q,exports.isGetLatestBlock=X,exports.isGetTransaction=$,exports.isGetTransactionStatus=J,exports.isOk=ue,exports.isPing=re,exports.isScript=V,exports.isTransaction=W,exports.isUnknown=Y,exports.latestBlock=function(e,n){return console.warn('\n %cFCL/SDK Deprecation Notice\n ============================\n \n "latestBlock()" is deprecated, please use "block()" for this and future versions of FCL\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0008-deprecate-latest-block-method\n \n ============================\n ',"font-weight:bold;font-family:monospace;"),rr([Re(e)],n).then(Ye)},exports.limit=function(e){return function(n){return n.message.computeLimit=e,n}},exports.param=function(e){return n={name:"param",transitionsPath:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params"},void console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n The "+n.name+" builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: "+n.transitionsPath+"\n ============================\n ","font-weight:bold;font-family:monospace;");var n},exports.params=function(e){return n={name:"params",transitionsPath:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params"},void console.error("\n %cFCL/SDK Deprecation Notice\n ============================\n The "+n.name+" builder has been removed from the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: "+n.transitionsPath+"\n ============================\n ","font-weight:bold;font-family:monospace;");var n},exports.payer=function(e){try{return Promise.resolve(N(e,{role:"payer"}))}catch(e){return Promise.reject(e)}},exports.ping=function(){return F},exports.pipe=le,exports.proposer=function(e){try{return Promise.resolve(N(e,{role:"proposer"}))}catch(e){return Promise.reject(e)}},exports.put=pe,exports.ref=cr,exports.resolve=er,exports.resolveAccounts=Hn,exports.resolveArguments=nn,exports.resolveCadence=Ve,exports.resolveFinalNormalization=$n,exports.resolveProposerSequenceNumber=function(n){var r=n.node;return function(n){try{return W(n)?n.accounts[n.proposer].sequenceNum?Promise.resolve(E(n)):Promise.resolve(Ce.first(["sdk.transport","sdk.send"])).then(function(t){return e.invariant(t,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(ge([Ke(n.accounts[n.proposer].addr)])).then(function(e){return Promise.resolve(t(e,{config:Ce,response:Le,ix:ve},{node:r})).then(function(e){return Promise.resolve(Ye(e)).then(function(e){return n.accounts[n.proposer].sequenceNum=e.keys[n.accounts[n.proposer].keyId].sequenceNumber,E(n)})})})}):Promise.resolve(E(n))}catch(e){return Promise.reject(e)}}},exports.resolveRefBlockId=function(n){return function(n){try{return W(n)?n.message.refBlock?Promise.resolve(E(n)):Promise.resolve(function(n){try{return Promise.resolve(Ce().get("accessNode.api")).then(function(n){return Promise.resolve(Ce.first(["sdk.transport","sdk.send"])).then(function(r){var t;return e.invariant(r,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(le(v(),[Re()])).then(function(e){return t=e,Promise.resolve(r(t,{config:Ce,response:Le,ix:ve},{node:n})).then(function(e){return t=e,Promise.resolve(Ye(t)).then(function(e){return(t=e).id})})})})})}catch(e){return Promise.reject(e)}}()).then(function(e){return n.message.refBlock=e,E(n)}):Promise.resolve(E(n))}catch(e){return Promise.reject(e)}}},exports.resolveSignatures=Yn,exports.resolveValidators=Jn,exports.resolveVoucherIntercept=Zn,exports.script=function(){return le([G,pe("ix.cadence",i.template.apply(void 0,[].slice.call(arguments)))])},exports.send=rr,exports.transaction=function(){return le([C,pe("ix.cadence",i.template.apply(void 0,[].slice.call(arguments))),function(e){return e.message.computeLimit=e.message.computeLimit||10,e.message.refBlock=e.message.refBlock||null,e.authorizations=e.authorizations||sr,E(e)}])},exports.update=me,exports.validator=or,exports.voucherIntercept=function(e){return pe("ix.voucher-intercept",e)},exports.voucherToTxId=function(e){return function(e){return n=hn(function(e){!function(e){En.forEach(function(n){return Gn(e,n)}),An.forEach(function(n){return Gn(e.proposalKey,n,"proposalKey")}),wn.forEach(function(n){return Gn(e,n)}),e.payloadSigs.forEach(function(e,n){Nn.forEach(function(r){return Gn(e,r,"payloadSigs",n)})}),On.forEach(function(n){return Gn(e,n)}),e.envelopeSigs.forEach(function(e,n){Bn.forEach(function(r){return Gn(e,r,"envelopeSigs",n)})})}(e);var n=kn(e),t=function(e){return e.map(function(e){var r=e.keyId,t=e.sig;return{signerIndex:n.get(e.address),keyId:r,sig:t}}).sort(function(e,n){return e.signerIndex>n.signerIndex?1:e.signerIndex<n.signerIndex?-1:e.keyId>n.keyId?1:e.keyId<n.keyId?-1:void 0}).map(function(e){return[e.signerIndex,e.keyId,mn(e.sig)]})};return[[pn(e.cadence),e.arguments.map(dn),fn(e.refBlock),e.computeLimit,ln(r.sansPrefix(e.proposalKey.address)),e.proposalKey.keyId,e.proposalKey.sequenceNum,ln(r.sansPrefix(e.payer)),e.authorizers.map(function(e){return ln(r.sansPrefix(e))})],t(e.payloadSigs),t(e.envelopeSigs)]}(e)),(o=new t.SHA3(256)).update(Buffer.from(n,"hex")),o.digest().toString("hex");var n,o}(e)},exports.why=se;
var e,n=require("@onflow/util-actor"),r=require("@onflow/util-invariant"),t=require("@onflow/rlp"),o=require("@onflow/util-address"),i=require("sha3"),u=require("@onflow/util-template");function a(){return a=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},a.apply(this,arguments)}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function s(e,n){return s=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},s(e,n)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function f(e,n,r){return f=l()?Reflect.construct:function(e,n,r){var t=[null];t.push.apply(t,n);var o=new(Function.bind.apply(e,t));return r&&s(o,r.prototype),o},f.apply(null,arguments)}function d(e){var n="function"==typeof Map?new Map:void 0;return d=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,r)}function r(){return f(e,arguments,c(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),s(r,e)},d(e)}function p(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=new Array(n);r<n;r++)t[r]=e[r];return t}function m(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,n){if(e){if("string"==typeof e)return p(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(e,n):void 0}}(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var h=function e(n,r){void 0===n&&(n=[]);try{if(!n.length)return Promise.resolve(r);var t=n[0],o=n.slice(1);return Promise.resolve(x(t)).then(function(n){return null==n?e(o,r):n})}catch(e){return Promise.reject(e)}},v="config",y="PUT_CONFIG",g="GET_CONFIG",k="CONFIG/UPDATED",b=function(e){return e},I=((e={})[y]=function(e,n,r){var t=r.key,o=r.value;if(null==t)throw new Error("Missing 'key' for config/put.");e.put(t,o),e.broadcast(k,a({},e.all()))},e[g]=function(e,n,r){var t=r.key,o=r.fallback;if(null==t)throw new Error("Missing 'key' for config/get");n.reply(e.get(t,o))},e.GET_ALL_CONFIG=function(e,n){n.reply(a({},e.all()))},e.UPDATE_CONFIG=function(e,n,r){var t=r.key,o=r.fn;if(null==t)throw new Error("Missing 'key' for config/update");e.update(t,o||b),e.broadcast(k,a({},e.all()))},e.DELETE_CONFIG=function(e,n,r){var t=r.key;if(null==t)throw new Error("Missing 'key' for config/delete");e.delete(t),e.broadcast(k,a({},e.all()))},e.CLEAR_CONFIG=function(e,n){for(var r=0,t=Object.keys(e.all());r<t.length;r++)e.delete(t[r]);e.broadcast(k,a({},e.all()))},e.WHERE_CONFIG=function(e,n,r){var t=r.pattern;if(null==t)throw new Error("Missing 'pattern' for config/where");n.reply(e.where(t))},e[n.SUBSCRIBE]=function(e,n){e.subscribe(n.from),e.send(n.from,k,a({},e.all()))},e[n.UNSUBSCRIBE]=function(e,n){e.unsubscribe(n.from)},e);function P(e,r){return n.send(v,y,{key:e,value:r}),O()}function x(e,r){return n.send(v,g,{key:e,fallback:r},{expectReply:!0,timeout:10})}function A(){return n.send(v,"GET_ALL_CONFIG",null,{expectReply:!0,timeout:10})}function S(e,r){return void 0===r&&(r=b),n.send(v,"UPDATE_CONFIG",{key:e,fn:r}),O()}function T(e){return n.send(v,"DELETE_CONFIG",{key:e}),O()}function w(e){return n.send(v,"WHERE_CONFIG",{pattern:e},{expectReply:!0,timeout:10})}function E(e){return n.subscriber(v,function(){return n.spawn(I,v)},e)}function N(){return n.send(v,"CLEAR_CONFIG")}function O(e){return null!=e&&"object"==typeof e&&Object.keys(e).map(function(n){return P(n,e[n])}),{put:P,get:x,all:A,first:h,update:S,delete:T,where:w,subscribe:E,overload:C}}n.spawn(I,v),O.put=P,O.get=x,O.all=A,O.first=h,O.update=S,O.delete=T,O.where=w,O.subscribe=E,O.overload=C;var B=function(e){return e};function C(e,n){return void 0===e&&(e={}),void 0===n&&(n=B),new Promise(function(r,t){try{return Promise.resolve(A()).then(function(o){var i=function(t,i){try{var u=function(){O(e);var t=n;return Promise.resolve(A()).then(function(e){return Promise.resolve(t(e)).then(function(e){return Promise.resolve(N()).then(function(){return Promise.resolve(O(o)).then(function(){r(e)})})})})}()}catch(e){return i(e)}return u&&u.then?u.then(void 0,i):u}(0,function(e){return Promise.resolve(N()).then(function(){return Promise.resolve(O(o)).then(function(){t(e)})})});if(i&&i.then)return i.then(function(){})})}catch(e){return Promise.reject(e)}})}var G=function(e,n){for(var r,t=m(e.entries());!(r=t()).done;){var o=r.value;if(o[1]===n)return o[0]}},_=function(e,n){return new Proxy(e,{get:function(e,r){if(G(n,r)){var t=G(n,r);return Reflect.get(e,t)}return n.has(r)&&function(e,n,r){try{Promise.resolve(O.get("logger.level",0)).then(function(e){var r;if(!(e<2)){var t,o=["\n %c"+(t={title:"FCL/SDK Deprecation Notice",message:n}).title+"\n ============================\n "+t.message+"\n ============================\n ","font-weight:bold;font-family:monospace;"];(r=console).warn.apply(r,o)}})}catch(e){return Promise.reject(e)}}(0,'"'+r+'" will be deprecated in a future version.\n Please use "'+n.get(r)+'" instead.'),Reflect.get(e,r)}})},j='{\n "tag":"UNKNOWN",\n "assigns":{},\n "status":"OK",\n "reason":null,\n "accounts":{},\n "params":{},\n "arguments":{},\n "message": {\n "cadence":null,\n "refBlock":null,\n "computeLimit":null,\n "proposer":null,\n "payer":null,\n "authorizations":[],\n "params":[],\n "arguments":[]\n },\n "proposer":null,\n "authorizations":[],\n "payer":[],\n "events": {\n "eventType":null,\n "start":null,\n "end":null,\n "blockIds":[]\n },\n "transaction": {\n "id":null\n },\n "block": {\n "id":null,\n "height":null,\n "isSealed":null\n },\n "account": {\n "addr":null\n },\n "collection": {\n "id":null\n }\n}',L=new Set(Object.keys(JSON.parse(j))),R=new Map([["addr","address"],["sequenceNum","seqNum"],["keyId","keyIndex"]]),K=function(){var e=JSON.parse(j);return a({},e,{account:_(e.account,R)})},D="abcdefghijklmnopqrstuvwxyz0123456789".split(""),F=function(){return D[~~(Math.random()*D.length)]},U=function(){return Array.from({length:10},F).join("")},z=function(e){return"number"==typeof e},H=function(e){return Array.isArray(e)},q=function(e){return null!==e&&"object"==typeof e},M=function(e){return null==e},Y=function(e){return"function"==typeof e},W=function(e){if(!q(e)||M(e)||z(e))return!1;for(var n,r=m(L);!(n=r()).done;)if(!e.hasOwnProperty(n.value))return!1;return!0},V=function(e){return e.status="OK",e},J=function(e,n){return e.status="BAD",e.reason=n,e},$=function(e){return function(n){return n.tag=e,V(n)}},Z=function(e,n){return void 0===n&&(n={}),function(t){var o;r.invariant("function"==typeof e||"object"==typeof e,"prepAccount must be passed an authorization function or an account object"),r.invariant(null!=n.role,"Account must have a role");var i=_(JSON.parse('{\n "kind":"ACCOUNT",\n "tempId":null,\n "addr":null,\n "keyId":null,\n "sequenceNum":null,\n "signature":null,\n "signingFunction":null,\n "resolve":null,\n "role": {\n "proposer":false,\n "authorizer":false,\n "payer":false,\n "param":false\n }\n}'),R),u=n.role,c=U();return e.authorization&&Y(e.authorization)&&(e={resolve:e.authorization}),!e.authorization&&Y(e)&&(e={resolve:e}),t.accounts[c]=a({},i,{tempId:c},e,{role:a({},i.role,"object"==typeof e.role?e.role:{},(o={},o[u]=!0,o))}),"authorizer"===u?t.authorizations.push(c):"payer"===u?t.payer.push(c):t[u]=c,t}},Q=function(e){return function(n){var r=U();return n.message.arguments.push(r),n.arguments[r]=JSON.parse('{\n "kind":"ARGUMENT",\n "tempId":null,\n "value":null,\n "asArgument":null,\n "xform":null,\n "resolve": null,\n "resolveArgument": null\n}'),n.arguments[r].tempId=r,n.arguments[r].value=e.value,n.arguments[r].asArgument=e.asArgument,n.arguments[r].xform=e.xform,n.arguments[r].resolve=e.resolve,n.arguments[r].resolveArgument=Y(e.resolveArgument)?e.resolveArgument.bind(e):e.resolveArgument,V(n)}},X=$("UNKNOWN"),ee=$("SCRIPT"),ne=$("TRANSACTION"),re=$("GET_TRANSACTION_STATUS"),te=$("GET_TRANSACTION"),oe=$("GET_ACCOUNT"),ie=$("GET_EVENTS"),ue=$("GET_LATEST_BLOCK"),ae=$("GET_BLOCK_BY_ID"),ce=$("GET_BLOCK_BY_HEIGHT"),se=$("PING"),le=$("GET_BLOCK"),fe=$("GET_BLOCK_HEADER"),de=$("GET_COLLECTION"),pe=function(e){return function(n){return n.tag===e}},me=pe("UNKNOWN"),he=pe("SCRIPT"),ve=pe("TRANSACTION"),ye=pe("GET_TRANSACTION_STATUS"),ge=pe("GET_TRANSACTION"),ke=pe("GET_ACCOUNT"),be=pe("GET_EVENTS"),Ie=pe("GET_LATEST_BLOCK"),Pe=pe("GET_BLOCK_BY_ID"),xe=pe("GET_BLOCK_BY_HEIGHT"),Ae=pe("PING"),Se=pe("GET_BLOCK"),Te=pe("GET_BLOCK_HEADER"),we=pe("GET_COLLECTION"),Ee=function(e){return"OK"===e.status},Ne=function(e){return"BAD"===e.status},Oe=function(e){return e.reason},Be=function e(n,r){void 0===r&&(r=[]);try{return Promise.resolve(function(t,o){try{var i=Promise.resolve(n).then(function(t){if(n=function(e){for(var n=0,r=Object.keys(e);n<r.length;n++){var t=r[n];if(!L.has(t))throw new Error('"'+t+'" is an invalid root level Interaction property.')}return e}(t),Ne(n))throw new Error("Interaction Error: "+n.reason);if(!r.length)return n;var o=r[0],i=r.slice(1);return Promise.resolve(o).then(function(r){if(Y(r))return e(r(n),i);if(M(r)||!r)return e(n,i);if(W(r))return e(r,i);throw new Error("Invalid Interaction Composition")})})}catch(e){return o(e)}return i&&i.then?i.then(void 0,o):i}(0,function(e){throw e}))}catch(e){return Promise.reject(e)}},Ce=function e(){var n=[].slice.call(arguments),r=n[0],t=n[1];return H(r)&&null==t?function(n){return e(n,r)}:Be(r,t)},Ge=function(e){return e},_e=function(e,n,r){return null==e.assigns[n]?r:e.assigns[n]},je=function(e,n){return function(r){return r.assigns[e]=n,V(r)}},Le=function(e,n){return void 0===n&&(n=Ge),function(r){return r.assigns[e]=n(r.assigns[e],r),V(r)}},Re=function(e){return function(n){return delete n.assigns[e],V(n)}},Ke={__proto__:null,UNKNOWN:"UNKNOWN",SCRIPT:"SCRIPT",TRANSACTION:"TRANSACTION",GET_TRANSACTION_STATUS:"GET_TRANSACTION_STATUS",GET_ACCOUNT:"GET_ACCOUNT",GET_EVENTS:"GET_EVENTS",GET_LATEST_BLOCK:"GET_LATEST_BLOCK",PING:"PING",GET_TRANSACTION:"GET_TRANSACTION",GET_BLOCK_BY_ID:"GET_BLOCK_BY_ID",GET_BLOCK_BY_HEIGHT:"GET_BLOCK_BY_HEIGHT",GET_BLOCK:"GET_BLOCK",GET_BLOCK_HEADER:"GET_BLOCK_HEADER",GET_COLLECTION:"GET_COLLECTION",BAD:"BAD",OK:"OK",ACCOUNT:"ACCOUNT",PARAM:"PARAM",ARGUMENT:"ARGUMENT",AUTHORIZER:"authorizer",PAYER:"payer",PROPOSER:"proposer",interaction:K,uuid:U,isNumber:z,isArray:H,isObj:q,isNull:M,isFn:Y,isInteraction:W,Ok:V,Bad:J,prepAccount:Z,makeArgument:Q,makeUnknown:X,makeScript:ee,makeTransaction:ne,makeGetTransactionStatus:re,makeGetTransaction:te,makeGetAccount:oe,makeGetEvents:ie,makeGetLatestBlock:ue,makeGetBlockById:ae,makeGetBlockByHeight:ce,makePing:se,makeGetBlock:le,makeGetBlockHeader:fe,makeGetCollection:de,isUnknown:me,isScript:he,isTransaction:ve,isGetTransactionStatus:ye,isGetTransaction:ge,isGetAccount:ke,isGetEvents:be,isGetLatestBlock:Ie,isGetBlockById:Pe,isGetBlockByHeight:xe,isPing:Ae,isGetBlock:Se,isGetBlockHeader:Te,isGetCollection:we,isOk:Ee,isBad:Ne,why:Oe,isAccount:function(e){return"ACCOUNT"===e.kind},isParam:function(e){return"PARAM"===e.kind},isArgument:function(e){return"ARGUMENT"===e.kind},pipe:Ce,get:_e,put:je,update:Le,destroy:Re};function De(e){return void 0===e&&(e=[]),Ce(K(),e)}var Fe=function(){return JSON.parse('{\n "tag":null,\n "transaction":null,\n "transactionStatus":null,\n "transactionId":null,\n "encodedData":null,\n "events":null,\n "account":null,\n "block":null,\n "blockHeader":null,\n "latestBlock":null,\n "collection":null\n}')};function Ue(e){return void 0===e&&(e=null),Ce([le,function(n){return n.block.isSealed=e,V(n)}])}function ze(e){return Ce([oe,function(n){return n.account.addr=o.sansPrefix(e),V(n)}])}var He=function(e,n,r){try{try{return Promise.resolve(Number(e))}catch(e){throw new Error("Decode Number Error : "+r.join("."))}}catch(e){return Promise.reject(e)}},qe=function(e){return Promise.resolve(e)},Me=function(e,n,r){try{return Promise.resolve(e.fields.reduce(function(e,t){return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(Ve(t.value,n,[].concat(r,[t.name]))).then(function(n){return e[t.name]=n,e})})},Promise.resolve({}))).then(function(r){var t=e.id&&We(n,e.id);return t?Promise.resolve(t(r)):r})}catch(e){return Promise.reject(e)}},Ye={UInt:He,Int:He,UInt8:He,Int8:He,UInt16:He,Int16:He,UInt32:He,Int32:He,UInt64:He,Int64:He,UInt128:He,Int128:He,UInt256:He,Int256:He,Word8:He,Word16:He,Word32:He,Word64:He,UFix64:qe,Fix64:qe,String:qe,Character:qe,Bool:qe,Address:qe,Void:function(){return Promise.resolve(null)},Optional:function(e,n,r){return Promise.resolve(e?Ve(e,n,r):null)},Reference:function(e){try{return Promise.resolve({address:e.address,type:e.type})}catch(e){return Promise.reject(e)}},Array:function(e,n,r){try{return Promise.resolve(Promise.all(e.map(function(e){return new Promise(function(t){try{return Promise.resolve(Ve(e,n,[].concat(r,[e.type]))).then(t)}catch(e){return Promise.reject(e)}})})))}catch(e){return Promise.reject(e)}},Dictionary:function(e,n,r){try{return Promise.resolve(e.reduce(function(e,t){return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(Ve(t.key,n,[].concat(r,[t.key]))).then(function(o){return Promise.resolve(Ve(t.value,n,[].concat(r,[t.key]))).then(function(n){return e[o]=n,e})})})},Promise.resolve({})))}catch(e){return Promise.reject(e)}},Event:Me,Resource:Me,Struct:Me,Enum:Me,Type:function(e){try{return Promise.resolve(e.staticType)}catch(e){return Promise.reject(e)}},Path:function(e){try{return Promise.resolve({domain:e.domain,identifier:e.identifier})}catch(e){return Promise.reject(e)}},Capability:function(e){try{return Promise.resolve({path:e.path,address:e.address,borrowType:e.borrowType})}catch(e){return Promise.reject(e)}}},We=function(e,n){var r=Object.keys(e).find(function(e){return/^\/.*\/$/.test(e)?new RegExp(e.substring(1,e.length-1)).test(n):e===n});return n&&r&&e[r]},Ve=function(e,n,r){try{var t=We(n,e.type);if(!t)throw new Error("Undefined Decoder Error: "+e.type+"@"+r.join("."));return Promise.resolve(t(e.value,n,r))}catch(e){return Promise.reject(e)}},Je=function(e,n,r){void 0===n&&(n={}),void 0===r&&(r=[]);var t=a({},Ye,n);return Promise.resolve(Ve(e,t,r))},$e=function(e,n){void 0===n&&(n={});try{var r,t=a({},Ye,n),o=e.encodedData?Promise.resolve(Je(e.encodedData,t)).then(function(e){return r=1,e}):e.transactionStatus?Promise.resolve(Promise.all(e.transactionStatus.events.map(function(e){try{var n=e.eventIndex,r=e.transactionIndex,o=e.transactionId,i=e.type;return Promise.resolve(Je(e.payload,t)).then(function(e){return{type:i,transactionId:o,transactionIndex:r,eventIndex:n,data:e}})}catch(e){return Promise.reject(e)}}))).then(function(n){var t=a({},e.transactionStatus,{events:n});return r=1,t}):e.transaction?(r=1,e.transaction):e.events?Promise.resolve(Promise.all(e.events.map(function(e){try{var n=e.eventIndex,r=e.transactionIndex,o=e.transactionId,i=e.type,u=e.blockTimestamp,a=e.blockHeight,c=e.blockId;return Promise.resolve(Je(e.payload,t)).then(function(e){return{blockId:c,blockHeight:a,blockTimestamp:u,type:i,transactionId:o,transactionIndex:r,eventIndex:n,data:e}})}catch(e){return Promise.reject(e)}}))).then(function(e){return r=1,e}):e.account?(r=1,e.account):e.block?(r=1,e.block):e.blockHeader?(r=1,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;"),r=1,e.latestBlock):e.transactionId?(r=1,e.transactionId):e.collection?(r=1,e.collection):void 0;return Promise.resolve(o&&o.then?o.then(function(e){return r?e:null}):r?o:null)}catch(e){return Promise.reject(e)}},Ze=function(e){try{var n=function(){if(ve(e)||he(e)){var n=function(){return r.invariant(Xe(t),"Cadence needs to be a string at this point."),Promise.resolve(O().where(/^0x/).then(function(e){return Object.entries(e).reduce(function(e,n){var r=n[1],t=new RegExp("(\\b"+n[0]+"\\b)","g");return e.replace(t,r)},t)})).then(function(n){e.message.cadence=n})},t=_e(e,"ix.cadence");r.invariant(Qe(t)||Xe(t),"Cadence needs to be a function or a string.");var o=function(){if(Qe(t))return Promise.resolve(t({})).then(function(e){t=e})}();return o&&o.then?o.then(n):n()}}();return Promise.resolve(n&&n.then?n.then(function(){return e}):e)}catch(e){return Promise.reject(e)}},Qe=function(e){return"function"==typeof e},Xe=function(e){return"string"==typeof e};const en="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function nn(e,n,r){if(!e.s){if(r instanceof rn){if(!r.s)return void(r.o=nn.bind(null,e,n));1&n&&(n=r.s),r=r.v}if(r&&r.then)return void r.then(nn.bind(null,e,n),nn.bind(null,e,2));e.s=n,e.v=r;var t=e.o;t&&t(e)}}var rn=function(){function e(){}return e.prototype.then=function(n,r){var t=new e,o=this.s;if(o){var i=1&o?n:r;if(i){try{nn(t,1,i(this.v))}catch(e){nn(t,2,e)}return t}return this}return this.o=function(e){try{var o=e.v;1&e.s?nn(t,1,n?n(o):o):r?nn(t,1,r(o)):nn(t,2,o)}catch(e){nn(t,2,e)}},t},e}();function tn(e){return e instanceof rn&&1&e.s}var on,un=function(e){try{var n=function(){if(ve(e)||he(e)){var n=function(e,n,r){if("function"==typeof e[en]){var t,o,i,u=e[en]();if(function e(r){try{for(;!(t=u.next()).done;)if((r=n(t.value))&&r.then){if(!tn(r))return void r.then(e,i||(i=nn.bind(null,o=new rn,2)));r=r.v}o?nn(o,1,r):o=r}catch(e){nn(o||(o=new rn),2,e)}}(),u.return){var a=function(e){try{t.done||u.return()}catch(e){}return e};if(o&&o.then)return o.then(a,function(e){throw a(e)});a()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var c=[],s=0;s<e.length;s++)c.push(e[s]);return function(e,n,r){var t,o,i=-1;return function r(u){try{for(;++i<e.length;)if((u=n(i))&&u.then){if(!tn(u))return void u.then(r,o||(o=nn.bind(null,t=new rn,2)));u=u.v}t?nn(t,1,u):t=u}catch(e){nn(t||(t=new rn),2,e)}}(),t}(c,function(e){return n(c[e])})}(Object.entries(e.arguments),function(n){var t=n[0];return Promise.resolve(an(n[1])).then(function(n){var o;e.arguments[t].asArgument=(r.invariant(null!=typeof(o=n).xform,"No type specified for argument: "+o.value),cn(o.xform)?o.xform(o.value):cn(o.xform.asArgument)?o.xform.asArgument(o.value):void r.invariant(!1,"Invalid Argument",o))})});if(n&&n.then)return n.then(function(){})}}();return Promise.resolve(n&&n.then?n.then(function(){return e}):e)}catch(e){return Promise.reject(e)}},an=function e(n,t){void 0===t&&(t=3);try{return r.invariant(t>0,"Argument Resolve Recursion Limit Exceeded for Arg: "+n.tempId),cn(n.resolveArgument)?Promise.resolve(n.resolveArgument()).then(function(n){return e(n,t-1)}):Promise.resolve(n)}catch(e){return Promise.reject(e)}},cn=function(e){return"function"==typeof e},sn=function(e){return pn(kn(bn(e)))},ln=function(e){return pn(kn(In(e)))},fn=function(e,n){return t.Buffer.from(e.padStart(2*n,0),"hex")},dn=(on=t.Buffer.from("FLOW-V0.0-transaction").toString("hex"),t.Buffer.from(on.padEnd(64,0),"hex")).toString("hex"),pn=function(e){return dn+e},mn=function(e){return fn(e,8)},hn=function(e){return fn(e,32)},vn=function(e){return t.Buffer.from(JSON.stringify(e),"utf8")},yn=function(e){return t.Buffer.from(e,"utf8")},gn=function(e){return t.Buffer.from(e,"hex")},kn=function(e){return t.encode(e).toString("hex")},bn=function(e){return An(e),[yn(e.cadence),e.arguments.map(vn),hn(e.refBlock),e.computeLimit,mn(e.proposalKey.address),e.proposalKey.keyId,e.proposalKey.sequenceNum,mn(e.payer),e.authorizers.map(mn)]},In=function(e){return Sn(e),[bn(e),Pn(e)]},Pn=function(e){var n=xn(e);return e.payloadSigs.map(function(e){return{signerIndex:n.get(e.address),keyId:e.keyId,sig:e.sig}}).sort(function(e,n){return e.signerIndex>n.signerIndex?1:e.signerIndex<n.signerIndex?-1:e.keyId>n.keyId?1:e.keyId<n.keyId?-1:void 0}).map(function(e){return[e.signerIndex,e.keyId,gn(e.sig)]})},xn=function(e){var n=new Map,r=0,t=function(e){n.has(e)||(n.set(e,r),r++)};return t(e.proposalKey.address),t(e.payer),e.authorizers.forEach(t),n},An=function(e){On.forEach(function(n){return Ln(e,n)}),Bn.forEach(function(n){return Ln(e.proposalKey,n,"proposalKey")})},Sn=function(e){Cn.forEach(function(n){return Ln(e,n)}),e.payloadSigs.forEach(function(e,n){Gn.forEach(function(r){return Ln(e,r,"payloadSigs",n)})})},Tn=function(e){return"number"==typeof e},wn=function(e){return"string"==typeof e},En=function(e){return null!==e&&"object"==typeof e},Nn=function(e){return En(e)&&e instanceof Array},On=[{name:"cadence",check:wn},{name:"arguments",check:Nn},{name:"refBlock",check:wn,defaultVal:"0"},{name:"computeLimit",check:Tn},{name:"proposalKey",check:En},{name:"payer",check:wn},{name:"authorizers",check:Nn}],Bn=[{name:"address",check:wn},{name:"keyId",check:Tn},{name:"sequenceNum",check:Tn}],Cn=[{name:"payloadSigs",check:Nn}],Gn=[{name:"address",check:wn},{name:"keyId",check:Tn},{name:"sig",check:wn}],_n=[{name:"envelopeSigs",check:Nn}],jn=[{name:"address",check:wn},{name:"keyId",check:Tn},{name:"sig",check:wn}],Ln=function(e,n,r,t){var o=n.name,i=n.check,u=n.defaultVal;if(null==e[o]&&null!=u&&(e[o]=u),null==e[o])throw Kn(o,r,t);if(!i(e[o]))throw Dn(o,r,t)},Rn=function(e,n,r){return n?null==r?n+"."+e:n+"."+r+"."+e:e},Kn=function(e,n,r){return new Error("Missing field "+Rn(e,n,r))},Dn=function(e,n,r){return new Error("Invalid field "+Rn(e,n,r))};function Fn(e){var n=new Set(e.authorizations);return n.add(e.proposer),Array.isArray(e.payer)?e.payer.forEach(function(e){return n.delete(e)}):n.delete(e.payer),Array.from(n)}function Un(e){var n=new Set(Array.isArray(e.payer)?e.payer:[e.payer]);return Array.from(n)}var zn=function(e){return{cadence:e.message.cadence,refBlock:e.message.refBlock||null,computeLimit:e.message.computeLimit,arguments:e.message.arguments.map(function(n){return e.arguments[n].asArgument}),proposalKey:{address:o.withPrefix(e.accounts[e.proposer].addr),keyId:e.accounts[e.proposer].keyId,sequenceNum:e.accounts[e.proposer].sequenceNum},payer:o.withPrefix(e.accounts[Array.isArray(e.payer)?e.payer[0]:e.payer].addr),authorizers:(n=e.authorizations.map(function(n){return o.withPrefix(e.accounts[n].addr)}).reduce(function(e,n){return e.find(function(e){return e===n})?e:[].concat(e,[n])},[]),n[0]?n:[]),payloadSigs:Fn(e).map(function(n){return{address:o.withPrefix(e.accounts[n].addr),keyId:e.accounts[n].keyId,sig:e.accounts[n].signature}}),envelopeSigs:Un(e).map(function(n){return{address:o.withPrefix(e.accounts[n].addr),keyId:e.accounts[n].keyId,sig:e.accounts[n].signature}})};var n},Hn="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function qn(e,n,r){if(!e.s){if(r instanceof Mn){if(!r.s)return void(r.o=qn.bind(null,e,n));1&n&&(n=r.s),r=r.v}if(r&&r.then)return void r.then(qn.bind(null,e,n),qn.bind(null,e,2));e.s=n,e.v=r;var t=e.o;t&&t(e)}}var Mn=function(){function e(){}return e.prototype.then=function(n,r){var t=new e,o=this.s;if(o){var i=1&o?n:r;if(i){try{qn(t,1,i(this.v))}catch(e){qn(t,2,e)}return t}return this}return this.o=function(e){try{var o=e.v;1&e.s?qn(t,1,n?n(o):o):r?qn(t,1,r(o)):qn(t,2,o)}catch(e){qn(t,2,e)}},t},e}();function Yn(e){return e instanceof Mn&&1&e.s}var Wn=function(e){try{var n=function(){if(ve(e))return Array.isArray(e.payer)||console.warn('\n %cFCL Warning\n ============================\n "ix.payer" must be an array. Support for ix.payer as a singular is deprecated,\n see changelog for more info.\n ============================\n ',"font-weight:bold;font-family:monospace;"),function(n,r){try{var t=Promise.resolve(Vn(e,Object.values(e.accounts))).then(function(){return Promise.resolve(Vn(e,Object.values(e.accounts))).then(function(){})})}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}(0,function(e){throw console.error("=== SAD PANDA ===\n\n",e,"\n\n=== SAD PANDA ==="),e})}();return Promise.resolve(n&&n.then?n.then(function(n){return e}):e)}catch(e){return Promise.reject(e)}},Vn=function e(n,t,o,i){void 0===i&&(i=3);try{var u=function(e){o&&(n.authorizations=n.authorizations.map(function(e){return e===o.tempId?a:e}).reduce(function(e,n){return Array.isArray(n)?[].concat(e,n):[].concat(e,[n])},[]))};r.invariant(i,"Account Resolve Recursion Limit Exceeded",{ix:n,accounts:t});var a=[],c=function(e,n,r){if("function"==typeof e[Hn]){var t,o,i,u=e[Hn]();if(function e(r){try{for(;!(t=u.next()).done;)if((r=n(t.value))&&r.then){if(!Yn(r))return void r.then(e,i||(i=qn.bind(null,o=new Mn,2)));r=r.v}o?qn(o,1,r):o=r}catch(e){qn(o||(o=new Mn),2,e)}}(),u.return){var a=function(e){try{t.done||u.return()}catch(e){}return e};if(o&&o.then)return o.then(a,function(e){throw a(e)});a()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var c=[],s=0;s<e.length;s++)c.push(e[s]);return function(e,n,r){var t,o,i=-1;return function r(u){try{for(;++i<e.length;)if((u=n(i))&&u.then){if(!Yn(u))return void u.then(r,o||(o=qn.bind(null,t=new Mn,2)));u=u.v}t?qn(t,1,u):t=u}catch(e){qn(t||(t=new Mn),2,e)}}(),t}(c,function(e){return n(c[e])})}(t,function(r){function t(){function t(e){u.tempId!=r.tempId&&delete n.accounts[u.tempId]}var c=function(){if(Array.isArray(r))return Promise.resolve(e(n,r,u,i-1)).then(function(){});if(null!=r.addr&&null!=r.keyId&&(r.tempId=r.addr+"-"+r.keyId),n.accounts[r.tempId]=n.accounts[r.tempId]||r,n.accounts[r.tempId].role.proposer=n.accounts[r.tempId].role.proposer||r.role.proposer,n.accounts[r.tempId].role.payer=n.accounts[r.tempId].role.payer||r.role.payer,n.accounts[r.tempId].role.authorizer=n.accounts[r.tempId].role.authorizer||r.role.authorizer,n.accounts[r.tempId].role.proposer&&n.proposer===u.tempId&&(n.proposer=r.tempId),n.accounts[r.tempId].role.payer&&(n.payer=Array.isArray(n.payer)?Array.from(new Set([].concat(n.payer,[r.tempId]).map(function(e){return e===u.tempId?r.tempId:e}))):Array.from(new Set([n.payer,r.tempId].map(function(e){return e===u.tempId?r.tempId:e}))),n.payer.length>1)){var t=[],c=[];if(n.payer=n.payer.reduce(function(e,r){var o=n.accounts[r],i=o.addr,u=i+"-"+o.keyId;return c.push(i),t.includes(u)?e:(t.push(u),[].concat(e,[r]))},[]),Array.from(new Set(c)).length>1)throw new Error("Payer can not be different accounts")}n.accounts[r.tempId].role.authorizer&&(o?a=Array.from(new Set([].concat(a,[r.tempId]))):n.authorizations=n.authorizations.map(function(e){return e===u.tempId?r.tempId:e}))}();return c&&c.then?c.then(t):t()}var u=o||r,c=function(){if(Jn(r.resolve))return Promise.resolve(r.resolve(r,function(e,n){try{return{f_type:"PreSignable",f_vsn:"1.0.1",roles:e.role,cadence:n.message.cadence,args:n.message.arguments.map(function(e){return n.arguments[e].asArgument}),data:{},interaction:n,voucher:zn(n)}}catch(e){throw console.error("buildPreSignable",e),e}}(r,n))).then(function(e){r=e})}();return c&&c.then?c.then(t):t()});return Promise.resolve(c&&c.then?c.then(u):u())}catch(e){return Promise.reject(e)}},Jn=function(e){return"function"==typeof e},$n=function(e){try{var n=function(){if(ve(e))return function(n,r){try{var t=(o=Fn(e),i=sn(Qn(e)),Promise.resolve(Promise.all(o.map(Zn(e,i)))).then(function(){var n=Un(e),r=ln(a({},Qn(e),{payloadSigs:o.map(function(n){return{address:e.accounts[n].addr,keyId:e.accounts[n].keyId,sig:e.accounts[n].signature}})}));return Promise.resolve(Promise.all(n.map(Zn(e,r)))).then(function(){})}))}catch(e){return r(e)}var o,i;return t&&t.then?t.then(void 0,r):t}(0,function(n){throw console.error("Signatures",n,{ix:e}),n})}();return Promise.resolve(n&&n.then?n.then(function(n){return e}):e)}catch(e){return Promise.reject(e)}};function Zn(e,n){return function(r){try{var t=e.accounts[r];return null!=t.signature?Promise.resolve():Promise.resolve(t.signingFunction(function(e,n,r){try{return{f_type:"Signable",f_vsn:"1.0.1",message:n,addr:o.sansPrefix(e.addr),keyId:e.keyId,roles:e.role,cadence:r.message.cadence,args:r.message.arguments.map(function(e){return r.arguments[e].asArgument}),data:{},interaction:r,voucher:zn(r)}}catch(e){throw console.error("buildSignable",e),e}}(t,n,e))).then(function(n){e.accounts[r].signature=n.signature})}catch(e){return Promise.reject(e)}}}function Qn(e){var n=o.sansPrefix((Array.isArray(e.payer)?e.accounts[e.payer[0]]:e.accounts[e.payer]).addr);return{cadence:e.message.cadence,refBlock:e.message.refBlock||null,computeLimit:e.message.computeLimit,arguments:e.message.arguments.map(function(n){return e.arguments[n].asArgument}),proposalKey:{address:o.sansPrefix(e.accounts[e.proposer].addr),keyId:e.accounts[e.proposer].keyId,sequenceNum:e.accounts[e.proposer].sequenceNum},payer:n,authorizers:e.authorizations.map(function(n){return o.sansPrefix(e.accounts[n].addr)}).reduce(function(e,n){return e.find(function(e){return e===n})?e:[].concat(e,[n])},[])}}var Xn=function(e){try{var n=_e(e,"ix.validators",[]);return Promise.resolve(Ce(e,n.map(function(e){return function(n){return e(n,{Ok:V,Bad:J})}})))}catch(e){return Promise.reject(e)}},er=function(e){try{for(var n=0,r=Object.keys(e.accounts);n<r.length;n++){var t=r[n];e.accounts[t].addr=o.sansPrefix(e.accounts[t].addr)}return Promise.resolve(e)}catch(e){return Promise.reject(e)}},nr=function(e){try{var n=_e(e,"ix.voucher-intercept"),r=function(){if(Y(n))return Promise.resolve(n(zn(e))).then(function(){})}();return Promise.resolve(r&&r.then?r.then(function(){return e}):e)}catch(e){return Promise.reject(e)}},rr=function(e){return e},tr=function(e,n){return void 0===n&&(n=rr),function(r){try{var t=function(e){return["\nAccounts:",{proposer:e.proposer,authorizations:e.authorizations,payer:e.payer},"\n\nDetails:",e.accounts].filter(Boolean)},o=function(){var n;(n=console).log.apply(n,["debug["+e+"] ---\n"].concat([].slice.call(arguments),["\n\n\n---"]))};return Promise.resolve(O.get("debug."+e)).then(function(e){var i=function(){if(e)return Promise.resolve(n(r,o,t)).then(function(){})}();return i&&i.then?i.then(function(){return r}):r})}catch(e){return Promise.reject(e)}}},or=Ce([Ze,tr("cadence",function(e,n){return n(e.message.cadence)}),un,tr("arguments",function(e,n){return n(e.message.arguments,e.message)}),Wn,tr("accounts",function(e,n,r){return n.apply(void 0,r(e))}),function(e){try{var n=function(){if(ve(e)&&null==e.message.refBlock)return Promise.resolve(O().get("accessNode.api")).then(function(n){return Promise.resolve(O.first(["sdk.transport","sdk.send"])).then(function(o){return r.invariant(o,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(o(De([Ue()]),{config:O,response:Fe,Buffer:t.Buffer,ix:Ke},{node:n}).then($e)).then(function(n){e.message.refBlock=n.id})})})}();return Promise.resolve(n&&n.then?n.then(function(){return e}):e)}catch(e){return Promise.reject(e)}},function(e){try{var n=function(){if(ve(e)){var n=Object.values(e.accounts).find(function(e){return e.role.proposer});r.invariant(n,"Transactions require a proposer");var o=function(){if(null==n.sequenceNum)return Promise.resolve(O().get("accessNode.api")).then(function(o){return Promise.resolve(O.first(["sdk.transport","sdk.send"])).then(function(i){return r.invariant(i,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(De([ze(n.addr)])).then(function(r){return Promise.resolve(i(r,{config:O,response:Fe,Buffer:t.Buffer,ix:Ke},{node:o}).then($e).then(function(e){return e.keys}).then(function(e){return e.find(function(e){return e.index===n.keyId})}).then(function(e){return e.sequenceNumber})).then(function(r){e.accounts[n.tempId].sequenceNum=r})})})})}();if(o&&o.then)return o.then(function(){})}}();return Promise.resolve(n&&n.then?n.then(function(){return e}):e)}catch(e){return Promise.reject(e)}},$n,tr("signatures",function(e,n,r){return n.apply(void 0,r(e))}),er,Xn,nr,tr("resolved",function(e,n){return n(e)})]);function ir(){var e=[].slice.call(arguments);if(e.length>1){var n=e,r=n[0],t=n[1];return ir(function(e,n){var o=n.Bad;return r?(0,n.Ok)(e):o(e,t)})}var o=e[0];return function(e){return o(e,{Ok:V,Bad:J})}}var ur=function(e,n){void 0===e&&(e=[]),void 0===n&&(n={});try{return Promise.resolve(O.first(["sdk.transport","sdk.send"],n.send)).then(function(r){return ir(r,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(O.first(["sdk.resolve"],n.resolve||or)).then(function(o){function i(i){return n.node=i,Array.isArray(e)&&(e=Ce(K(),e)),Promise.resolve(o(e)).then(function(e){return r(e,{config:O,response:Fe,ix:Ke,Buffer:t.Buffer},n)})}var u=n.node;return u?i(u):Promise.resolve(O().get("accessNode.api")).then(i)})})}catch(e){return Promise.reject(e)}},ar=function(e){var n,r;function t(n){var r,t=("\n Encode Message From Signable Error: Unable to determine message encoding for signer addresss: "+n+". \n Please ensure the address: "+n+" is intended to sign the given transaction as specified by the transaction signable.\n ").trim();return(r=e.call(this,t)||this).name="Unable To Determine Message Encoding For Signer Addresss",r}return r=e,(n=t).prototype=Object.create(r.prototype),n.prototype.constructor=n,s(n,r),t}(d(Error));function cr(e){return Le("ix.validators",function(n){return Array.isArray(n)?n.push(e):[e]})}function sr(e){return Ce([function(n){return n.block.height=e,n},cr(function(e){if("boolean"==typeof e.block.isSealed)throw new Error("Unable to specify both block height and isSealed.");if(e.block.id)throw new Error("Unable to specify both block height and block id.");return e})])}function lr(e){return Ce([function(n){return n.block.id=e,V(n)},cr(function(e,n){var r=n.Ok,t=n.Bad;return ke(e)?t(e,"Unable to specify a block id with a Get Account interaction."):"boolean"==typeof e.block.isSealed?t(e,"Unable to specify both block id and isSealed."):e.block.height?t(e,"Unable to specify both block id and block height."):r(e)})])}function fr(e){return Ce([function(n){return n.message.refBlock=e,V(n)}])}var dr=[],pr=function(e){return e},mr=["tempId"];function hr(e){return["SIGNATURE",e.addr,e.keyId].join(".")}function vr(e){return void 0===e&&(e={}),function(n){var r=a({},n,e,{signingFunction:e.signingFunction||n.signingFunction||function(e){return{addr:r.addr,keyId:r.keyId,signature:hr(r)}}});return r}}var yr={proposer:!1,authorizer:!1,payer:!1},gr={__proto__:null,mockSend:function(e){return void 0===e&&(e=pr),function(n){return Promise.resolve(n).then(function(t){switch(n=t,!0){case ke(n):return function(e,n){return void 0===n&&(n=5),r.invariant(e.account,"mockAccountResponse(ix) -- ix.account is missing",e),r.invariant(e.account.addr,"mockAccountResponse(ix) -- ix.account.addr is missing",e),{account:{addr:e.account.addr,keys:Array.from({length:n},function(e,n){return{index:n,sequenceNumber:42}})}}}(n);case Se(n):return{tag:"GET_BLOCK",block:{id:"32"}};default:return e(n)}})}},authzFn:vr,authzResolve:function(e){return void 0===e&&(e={}),function(n){return a({},n,{tempId:e.tempId||"WITH_RESOLVE",resolve:vr(function(e,n){if(null==e)return{};var r,t,o={},i=Object.keys(e);for(t=0;t<i.length;t++)n.indexOf(r=i[t])>=0||(o[r]=e[r]);return o}(e,mr))})}},authzResolveMany:function(e){return void 0===e&&(e={}),function(n){return a({},n,{tempId:e.tempId||"AUTHZ_RESOLVE_MANY",resolve:function(){return[e.proposer&&vr(e.proposer)({role:a({},yr,{proposer:!0})})].concat(e.authorizations.map(vr).map(function(e){return e({role:a({},yr,{authorizer:!0})})}),[e.payer&&vr(e.payer)({role:a({},yr,{payer:!0})})]).filter(Boolean)}})}},sig:hr,idof:function(e){return e.addr+"-"+e.keyId},run:function(e){return void 0===e&&(e=[]),De([fr("123")].concat(e)).then(or)}};Object.defineProperty(exports,"cadence",{enumerable:!0,get:function(){return u.template}}),Object.defineProperty(exports,"cdc",{enumerable:!0,get:function(){return u.template}}),exports.TestUtils=gr,exports.VERSION="0.0.57-multisig.0",exports.account=function(e,n,t){var o=void 0===n?{}:n,i=o.height,u=o.id;return r.invariant(!(u&&i),'Method: account -- Cannot pass "id" and "height" simultaneously'),u?ur([ze(e),lr(u)],t).then($e):i?ur([ze(e),sr(i)],t).then($e):ur([ze(e)],t).then($e)},exports.arg=function(e,n){return{value:e,xform:n}},exports.args=function(e){return void 0===e&&(e=[]),Ce(e.map(Q))},exports.atBlockHeight=sr,exports.atBlockId=lr,exports.authorization=function(e,n,r,t){return{addr:e,signingFunction:n,keyId:r,sequenceNum:t}},exports.authorizations=function(e){return void 0===e&&(e=[]),Ce(e.map(function(e){return Z(e,{role:"authorizer"})}))},exports.block=function(e,n){var t=void 0===e?{}:e,o=t.sealed,i=void 0!==o&&o,u=t.id,a=t.height;return void 0===n&&(n={}),r.invariant(!(i&&u||i&&a),'Method: block -- Cannot pass "sealed" with "id" or "height"'),r.invariant(!(u&&a),'Method: block -- Cannot pass "id" and "height" simultaneously'),u?ur([Ue(),lr(u)],n).then($e):a?ur([Ue(),sr(a)],n).then($e):ur([Ue(i)],n).then($e)},exports.build=De,exports.config=O,exports.createSignableVoucher=zn,exports.decode=function(e){try{return Promise.resolve(O().where(/^decoder\./)).then(function(n){var r=Object.entries(n).map(function(e){var n=e[0],r=e[1];return[n="/"+n.replace(/^decoder\./,"")+"$/",r]});return $e(e,Object.fromEntries(r))})}catch(e){return Promise.reject(e)}},exports.destroy=Re,exports.encodeMessageFromSignable=function(e,n){var r,t,i=(r=e.voucher,(t=new Set(r.authorizers)).add(r.proposalKey.address),t.delete(r.payer),Array.from(t).map(o.withPrefix)),u=function(e){var n=new Set([e.payer]);return Array.from(n).map(o.withPrefix)}(e.voucher),c=i.includes(o.withPrefix(n)),s=u.includes(o.withPrefix(n));if(!c&&!s)throw new ar(n);var l={cadence:e.voucher.cadence,refBlock:e.voucher.refBlock,computeLimit:e.voucher.computeLimit,arguments:e.voucher.arguments,proposalKey:a({},e.voucher.proposalKey,{address:o.sansPrefix(e.voucher.proposalKey.address)}),payer:o.sansPrefix(e.voucher.payer),authorizers:e.voucher.authorizers.map(o.sansPrefix),payloadSigs:e.voucher.payloadSigs.map(function(e){return a({},e,{address:o.sansPrefix(e.address)})})};return c?sn(l):ln(l)},exports.get=_e,exports.getAccount=ze,exports.getBlock=Ue,exports.getBlockByHeight=function(e){return console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getBlockByHeight builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0003-deprecate-get-block-by-height-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),Ce([ce,function(n){return n.block.height=e,V(n)}])},exports.getBlockById=function(e){return console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getBlockById builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0004-deprecate-get-block-by-id-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),Ce([ae,function(n){return n.block.ids=[e],V(n)}])},exports.getBlockHeader=function(e){return void 0===e&&(e=null),Ce([fe,function(n){return n.block.isSealed=e,V(n)}])},exports.getCollection=function(e){return void 0===e&&(e=null),Ce([de,function(n){return n.collection.id=e,n}])},exports.getEvents=function(e,n,r){return void 0===n&&void 0===r||console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n \n Passing a start and end into getEnvents has been deprecated and will not be supported in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0005-deprecate-start-end-get-events-builder\n \n ============================\n ","font-weight:bold;font-family:monospace;"),Ce([ie,function(t){return t.events.eventType=e,t.events.start=n,t.events.end=r,V(t)}])},exports.getEventsAtBlockHeightRange=function(e,n,r){return Ce([ie,function(t){return t.events.eventType=e,t.events.start=n,t.events.end=r,V(t)}])},exports.getEventsAtBlockIds=function(e,n){return void 0===n&&(n=[]),Ce([ie,function(r){return r.events.eventType=e,r.events.blockIds=n,V(r)}])},exports.getLatestBlock=function(e){return void 0===e&&(e=!1),console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getLatestBlock builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0006-deprecate-get-latest-block-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),Ce([ue,function(n){return n.block.isSealed=e,V(n)}])},exports.getTransaction=function(e){return Ce([te,function(n){return n.transaction.id=e,V(n)}])},exports.getTransactionStatus=function(e){return Ce([re,function(n){return n.transaction.id=e,V(n)}])},exports.interaction=K,exports.invariant=ir,exports.isBad=Ne,exports.isGetAccount=ke,exports.isGetBlock=Se,exports.isGetBlockByHeight=xe,exports.isGetBlockById=Pe,exports.isGetBlockHeader=Te,exports.isGetCollection=we,exports.isGetEvents=be,exports.isGetLatestBlock=Ie,exports.isGetTransaction=ge,exports.isGetTransactionStatus=ye,exports.isOk=Ee,exports.isPing=Ae,exports.isScript=he,exports.isTransaction=ve,exports.isUnknown=me,exports.latestBlock=function(e,n){return console.warn('\n %cFCL/SDK Deprecation Notice\n ============================\n \n "latestBlock()" is deprecated, please use "block()" for this and future versions of FCL\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0008-deprecate-latest-block-method\n \n ============================\n ',"font-weight:bold;font-family:monospace;"),ur([Ue(e)],n).then($e)},exports.limit=function(e){return function(n){return n.message.computeLimit=e,n}},exports.param=function(e){return n={name:"param",transitionsPath:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params"},void console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n The "+n.name+" builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: "+n.transitionsPath+"\n ============================\n ","font-weight:bold;font-family:monospace;");var n},exports.params=function(e){return n={name:"params",transitionsPath:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params"},void console.error("\n %cFCL/SDK Deprecation Notice\n ============================\n The "+n.name+" builder has been removed from the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: "+n.transitionsPath+"\n ============================\n ","font-weight:bold;font-family:monospace;");var n},exports.payer=function(e){try{return Promise.resolve(Z(e,{role:"payer"}))}catch(e){return Promise.reject(e)}},exports.ping=function(){return se},exports.pipe=Ce,exports.proposer=function(e){try{return Promise.resolve(Z(e,{role:"proposer"}))}catch(e){return Promise.reject(e)}},exports.put=je,exports.ref=fr,exports.resolve=or,exports.resolveAccounts=Wn,exports.resolveArguments=un,exports.resolveCadence=Ze,exports.resolveFinalNormalization=er,exports.resolveProposerSequenceNumber=function(e){var n=e.node;return function(e){try{return ve(e)?e.accounts[e.proposer].sequenceNum?Promise.resolve(V(e)):Promise.resolve(O.first(["sdk.transport","sdk.send"])).then(function(o){return r.invariant(o,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(De([ze(e.accounts[e.proposer].addr)])).then(function(r){return Promise.resolve(o(r,{config:O,response:Fe,Buffer:t.Buffer,ix:Ke},{node:n})).then(function(n){return Promise.resolve($e(n)).then(function(n){return e.accounts[e.proposer].sequenceNum=n.keys[e.accounts[e.proposer].keyId].sequenceNumber,V(e)})})})}):Promise.resolve(V(e))}catch(e){return Promise.reject(e)}}},exports.resolveRefBlockId=function(e){return function(e){try{return ve(e)?e.message.refBlock?Promise.resolve(V(e)):Promise.resolve(function(e){try{return Promise.resolve(O().get("accessNode.api")).then(function(e){return Promise.resolve(O.first(["sdk.transport","sdk.send"])).then(function(n){var o;return r.invariant(n,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(Ce(K(),[Ue()])).then(function(r){return o=r,Promise.resolve(n(o,{config:O,response:Fe,Buffer:t.Buffer,ix:Ke},{node:e})).then(function(e){return o=e,Promise.resolve($e(o)).then(function(e){return(o=e).id})})})})})}catch(e){return Promise.reject(e)}}()).then(function(n){return e.message.refBlock=n,V(e)}):Promise.resolve(V(e))}catch(e){return Promise.reject(e)}}},exports.resolveSignatures=$n,exports.resolveValidators=Xn,exports.resolveVoucherIntercept=nr,exports.script=function(){return Ce([ee,je("ix.cadence",u.template.apply(void 0,[].slice.call(arguments)))])},exports.send=ur,exports.transaction=function(){return Ce([ne,je("ix.cadence",u.template.apply(void 0,[].slice.call(arguments))),function(e){return e.message.computeLimit=e.message.computeLimit||10,e.message.refBlock=e.message.refBlock||null,e.authorizations=e.authorizations||dr,V(e)}])},exports.update=Le,exports.validator=cr,exports.voucherIntercept=function(e){return je("ix.voucher-intercept",e)},exports.voucherToTxId=function(e){return function(e){return n=kn(function(e){!function(e){On.forEach(function(n){return Ln(e,n)}),Bn.forEach(function(n){return Ln(e.proposalKey,n,"proposalKey")}),Cn.forEach(function(n){return Ln(e,n)}),e.payloadSigs.forEach(function(e,n){Gn.forEach(function(r){return Ln(e,r,"payloadSigs",n)})}),_n.forEach(function(n){return Ln(e,n)}),e.envelopeSigs.forEach(function(e,n){jn.forEach(function(r){return Ln(e,r,"envelopeSigs",n)})})}(e);var n=xn(e),r=function(e){return e.map(function(e){var r=e.keyId,t=e.sig;return{signerIndex:n.get(e.address),keyId:r,sig:t}}).sort(function(e,n){return e.signerIndex>n.signerIndex?1:e.signerIndex<n.signerIndex?-1:e.keyId>n.keyId?1:e.keyId<n.keyId?-1:void 0}).map(function(e){return[e.signerIndex,e.keyId,gn(e.sig)]})};return[[yn(e.cadence),e.arguments.map(vn),hn(e.refBlock),e.computeLimit,mn(o.sansPrefix(e.proposalKey.address)),e.proposalKey.keyId,e.proposalKey.sequenceNum,mn(o.sansPrefix(e.payer)),e.authorizers.map(function(e){return mn(o.sansPrefix(e))})],r(e.payloadSigs),r(e.envelopeSigs)]}(e)),(r=new i.SHA3(256)).update(t.Buffer.from(n,"hex")),r.digest().toString("hex");var n,r}(e)},exports.why=Oe;
//# sourceMappingURL=sdk.js.map

@@ -1,2 +0,2 @@

import{invariant as e}from"@onflow/util-invariant";import{spawn as n,SUBSCRIBE as t,UNSUBSCRIBE as r,send as o,subscriber as a}from"@onflow/util-actor";import{sansPrefix as s,withPrefix as c}from"@onflow/util-address";import{SHA3 as i}from"sha3";import{encode as u}from"@onflow/rlp";import{template as l}from"@onflow/util-template";export{template as cadence,template as cdc}from"@onflow/util-template";function d(){return d=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},d.apply(this,arguments)}const p='{\n "tag":"UNKNOWN",\n "assigns":{},\n "status":"OK",\n "reason":null,\n "accounts":{},\n "params":{},\n "arguments":{},\n "message": {\n "cadence":null,\n "refBlock":null,\n "computeLimit":null,\n "proposer":null,\n "payer":null,\n "authorizations":[],\n "params":[],\n "arguments":[]\n },\n "proposer":null,\n "authorizations":[],\n "payer":null,\n "events": {\n "eventType":null,\n "start":null,\n "end":null,\n "blockIds":[]\n },\n "transaction": {\n "id":null\n },\n "block": {\n "id":null,\n "height":null,\n "isSealed":null\n },\n "account": {\n "addr":null\n },\n "collection": {\n "id":null\n }\n}',m=new Set(Object.keys(JSON.parse(p))),f=()=>JSON.parse(p),g="abcdefghijklmnopqrstuvwxyz0123456789".split(""),h=()=>g[~~(Math.random()*g.length)],y=()=>Array.from({length:10},h).join(""),k=e=>"number"==typeof e,I=e=>Array.isArray(e),b=e=>null!==e&&"object"==typeof e,w=e=>null==e,T=e=>"function"==typeof e,E=e=>{if(!b(e)||w(e)||k(e))return!1;for(let n of m)if(!e.hasOwnProperty(n))return!1;return!0},A=e=>(e.status="OK",e),N=(e,n)=>(e.status="BAD",e.reason=n,e),v=e=>n=>(n.tag=e,A(n)),S=(n,t={})=>r=>{e("function"==typeof n||"object"==typeof n,"prepAccount must be passed an authorization function or an account object"),e(null!=t.role,"Account must have a role");const o=JSON.parse('{\n "kind":"ACCOUNT",\n "tempId":null,\n "addr":null,\n "keyId":null,\n "sequenceNum":null,\n "signature":null,\n "signingFunction":null,\n "resolve":null,\n "role": {\n "proposer":false,\n "authorizer":false,\n "payer":false,\n "param":false\n }\n}'),a=t.role,s=y();return n.authorization&&T(n.authorization)&&(n={resolve:n.authorization}),!n.authorization&&T(n)&&(n={resolve:n}),r.accounts[s]=d({},o,{tempId:s},n,{role:d({},o.role,"object"==typeof n.role?n.role:{},{[a]:!0})}),"authorizer"===a?r.authorizations.push(s):r[a]=s,r},O=e=>n=>{let t=y();return n.message.arguments.push(t),n.arguments[t]=JSON.parse('{\n "kind":"ARGUMENT",\n "tempId":null,\n "value":null,\n "asArgument":null,\n "xform":null,\n "resolve": null,\n "resolveArgument": null\n}'),n.arguments[t].tempId=t,n.arguments[t].value=e.value,n.arguments[t].asArgument=e.asArgument,n.arguments[t].xform=e.xform,n.arguments[t].resolve=e.resolve,n.arguments[t].resolveArgument=T(e.resolveArgument)?e.resolveArgument.bind(e):e.resolveArgument,A(n)},C=v("UNKNOWN"),G=v("SCRIPT"),_=v("TRANSACTION"),B=v("GET_TRANSACTION_STATUS"),L=v("GET_TRANSACTION"),x=v("GET_ACCOUNT"),R=v("GET_EVENTS"),K=v("GET_LATEST_BLOCK"),D=v("GET_BLOCK_BY_ID"),F=v("GET_BLOCK_BY_HEIGHT"),U=v("PING"),z=v("GET_BLOCK"),P=v("GET_BLOCK_HEADER"),j=v("GET_COLLECTION"),H=e=>n=>n.tag===e,$=H("UNKNOWN"),q=H("SCRIPT"),M=H("TRANSACTION"),Y=H("GET_TRANSACTION_STATUS"),W=H("GET_TRANSACTION"),J=H("GET_ACCOUNT"),V=H("GET_EVENTS"),Z=H("GET_LATEST_BLOCK"),Q=H("GET_BLOCK_BY_ID"),X=H("GET_BLOCK_BY_HEIGHT"),ee=H("PING"),ne=H("GET_BLOCK"),te=H("GET_BLOCK_HEADER"),re=H("GET_COLLECTION"),oe=e=>"OK"===e.status,ae=e=>"BAD"===e.status,se=e=>e.reason,ce=async(e,n=[])=>{try{if(e=(e=>{for(let n of Object.keys(e))if(!m.has(n))throw new Error(`"${n}" is an invalid root level Interaction property.`);return e})(await e),ae(e))throw new Error(`Interaction Error: ${e.reason}`);if(!n.length)return e;const[t,...r]=n,o=await t;if(T(o))return ce(o(e),r);if(w(o)||!o)return ce(e,r);if(E(o))return ce(o,r);throw new Error("Invalid Interaction Composition")}catch(e){throw e}},ie=(...e)=>{const[n,t]=e;return I(n)&&null==t?e=>ie(e,n):ce(n,t)},ue=e=>e,le=(e,n,t)=>null==e.assigns[n]?t:e.assigns[n],de=(e,n)=>t=>(t.assigns[e]=n,A(t)),pe=(e,n=ue)=>t=>(t.assigns[e]=n(t.assigns[e],t),A(t)),me=e=>n=>(delete n.assigns[e],A(n));var fe={__proto__:null,UNKNOWN:"UNKNOWN",SCRIPT:"SCRIPT",TRANSACTION:"TRANSACTION",GET_TRANSACTION_STATUS:"GET_TRANSACTION_STATUS",GET_ACCOUNT:"GET_ACCOUNT",GET_EVENTS:"GET_EVENTS",GET_LATEST_BLOCK:"GET_LATEST_BLOCK",PING:"PING",GET_TRANSACTION:"GET_TRANSACTION",GET_BLOCK_BY_ID:"GET_BLOCK_BY_ID",GET_BLOCK_BY_HEIGHT:"GET_BLOCK_BY_HEIGHT",GET_BLOCK:"GET_BLOCK",GET_BLOCK_HEADER:"GET_BLOCK_HEADER",GET_COLLECTION:"GET_COLLECTION",BAD:"BAD",OK:"OK",ACCOUNT:"ACCOUNT",PARAM:"PARAM",ARGUMENT:"ARGUMENT",AUTHORIZER:"authorizer",PAYER:"payer",PROPOSER:"proposer",interaction:f,uuid:y,isNumber:k,isArray:I,isObj:b,isNull:w,isFn:T,isInteraction:E,Ok:A,Bad:N,prepAccount:S,makeArgument:O,makeUnknown:C,makeScript:G,makeTransaction:_,makeGetTransactionStatus:B,makeGetTransaction:L,makeGetAccount:x,makeGetEvents:R,makeGetLatestBlock:K,makeGetBlockById:D,makeGetBlockByHeight:F,makePing:U,makeGetBlock:z,makeGetBlockHeader:P,makeGetCollection:j,isUnknown:$,isScript:q,isTransaction:M,isGetTransactionStatus:Y,isGetTransaction:W,isGetAccount:J,isGetEvents:V,isGetLatestBlock:Z,isGetBlockById:Q,isGetBlockByHeight:X,isPing:ee,isGetBlock:ne,isGetBlockHeader:te,isGetCollection:re,isOk:oe,isBad:ae,why:se,isAccount:e=>"ACCOUNT"===e.kind,isParam:e=>"PARAM"===e.kind,isArgument:e=>"ARGUMENT"===e.kind,pipe:ie,get:le,put:de,update:pe,destroy:me};function ge(e=[]){return ie(f(),e)}const he="config",ye="PUT_CONFIG",ke="GET_CONFIG",Ie="CONFIG/UPDATED",be=e=>e,we={[ye]:(e,n,{key:t,value:r})=>{if(null==t)throw new Error("Missing 'key' for config/put.");e.put(t,r),e.broadcast(Ie,d({},e.all()))},[ke]:(e,n,{key:t,fallback:r})=>{if(null==t)throw new Error("Missing 'key' for config/get");n.reply(e.get(t,r))},GET_ALL_CONFIG:(e,n)=>{n.reply(d({},e.all()))},UPDATE_CONFIG:(e,n,{key:t,fn:r})=>{if(null==t)throw new Error("Missing 'key' for config/update");e.update(t,r||be),e.broadcast(Ie,d({},e.all()))},DELETE_CONFIG:(e,n,{key:t})=>{if(null==t)throw new Error("Missing 'key' for config/delete");e.delete(t),e.broadcast(Ie,d({},e.all()))},CLEAR_CONFIG:(e,n)=>{let t=Object.keys(e.all());for(let n of t)e.delete(n);e.broadcast(Ie,d({},e.all()))},WHERE_CONFIG:(e,n,{pattern:t})=>{if(null==t)throw new Error("Missing 'pattern' for config/where");n.reply(e.where(t))},[t]:(e,n)=>{e.subscribe(n.from),e.send(n.from,Ie,d({},e.all()))},[r]:(e,n)=>{e.unsubscribe(n.from)}};function Te(e,n){return o(he,ye,{key:e,value:n}),_e()}function Ee(e,n){return o(he,ke,{key:e,fallback:n},{expectReply:!0,timeout:10})}async function Ae(e=[],n){if(!e.length)return n;const[t,...r]=e,o=await Ee(t);return null==o?Ae(r,n):o}function Ne(){return o(he,"GET_ALL_CONFIG",null,{expectReply:!0,timeout:10})}function ve(e,n=be){return o(he,"UPDATE_CONFIG",{key:e,fn:n}),_e()}function Se(e){return o(he,"DELETE_CONFIG",{key:e}),_e()}function Oe(e){return o(he,"WHERE_CONFIG",{pattern:e},{expectReply:!0,timeout:10})}function Ce(e){return a(he,()=>n(we,he),e)}function Ge(){return o(he,"CLEAR_CONFIG")}function _e(e){return null!=e&&"object"==typeof e&&Object.keys(e).map(n=>Te(n,e[n])),{put:Te,get:Ee,all:Ne,first:Ae,update:ve,delete:Se,where:Oe,subscribe:Ce,overload:Le}}n(we,he),_e.put=Te,_e.get=Ee,_e.all=Ne,_e.first=Ae,_e.update=ve,_e.delete=Se,_e.where=Oe,_e.subscribe=Ce,_e.overload=Le;const Be=e=>e;function Le(e={},n=Be){return new Promise(async(t,r)=>{const o=await Ne();try{_e(e);var a=await n(await Ne());await Ge(),await _e(o),t(a)}catch(e){await Ge(),await _e(o),r(e)}})}const xe=()=>JSON.parse('{\n "tag":null,\n "transaction":null,\n "transactionStatus":null,\n "transactionId":null,\n "encodedData":null,\n "events":null,\n "account":null,\n "block":null,\n "blockHeader":null,\n "latestBlock":null,\n "collection":null\n}');function Re(e=null){return ie([z,n=>(n.block.isSealed=e,A(n))])}function Ke(e){return ie([x,n=>(n.account.addr=s(e),A(n))])}const De=async(e,n,t)=>{try{return Number(e)}catch(e){throw new Error(`Decode Number Error : ${t.join(".")}`)}},Fe=async e=>e,Ue=async(e,n,t)=>{const r=await e.fields.reduce(async(e,r)=>((e=await e)[r.name]=await je(r.value,n,[...t,r.name]),e),Promise.resolve({})),o=e.id&&Pe(n,e.id);return o?await o(r):r},ze={UInt:De,Int:De,UInt8:De,Int8:De,UInt16:De,Int16:De,UInt32:De,Int32:De,UInt64:De,Int64:De,UInt128:De,Int128:De,UInt256:De,Int256:De,Word8:De,Word16:De,Word32:De,Word64:De,UFix64:Fe,Fix64:Fe,String:Fe,Character:Fe,Bool:Fe,Address:Fe,Void:async()=>null,Optional:async(e,n,t)=>e?await je(e,n,t):null,Reference:async e=>({address:e.address,type:e.type}),Array:async(e,n,t)=>await Promise.all(e.map(e=>new Promise(async r=>r(await je(e,n,[...t,e.type]))))),Dictionary:async(e,n,t)=>await e.reduce(async(e,r)=>((e=await e)[await je(r.key,n,[...t,r.key])]=await je(r.value,n,[...t,r.key]),e),Promise.resolve({})),Event:Ue,Resource:Ue,Struct:Ue,Enum:Ue,Type:async e=>e.staticType,Path:async e=>({domain:e.domain,identifier:e.identifier}),Capability:async e=>({path:e.path,address:e.address,borrowType:e.borrowType})},Pe=(e,n)=>{const t=Object.keys(e).find(e=>/^\/.*\/$/.test(e)?new RegExp(e.substring(1,e.length-1)).test(n):e===n);return n&&t&&e[t]},je=async(e,n,t)=>{let r=Pe(n,e.type);if(!r)throw new Error(`Undefined Decoder Error: ${e.type}@${t.join(".")}`);return await r(e.value,n,t)},He=async(e,n={},t=[])=>{let r=d({},ze,n);return await je(e,r,t)},$e=async(e,n={})=>{let t=d({},ze,n);return e.encodedData?await He(e.encodedData,t):e.transactionStatus?d({},e.transactionStatus,{events:await Promise.all(e.transactionStatus.events.map(async function(e){return{type:e.type,transactionId:e.transactionId,transactionIndex:e.transactionIndex,eventIndex:e.eventIndex,data:await He(e.payload,t)}}))}):e.transaction?e.transaction:e.events?await Promise.all(e.events.map(async function(e){return{blockId:e.blockId,blockHeight:e.blockHeight,blockTimestamp:e.blockTimestamp,type:e.type,transactionId:e.transactionId,transactionIndex:e.transactionIndex,eventIndex:e.eventIndex,data:await He(e.payload,t)}})):e.account?e.account:e.block?e.block:e.blockHeader?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;"),e.latestBlock):e.transactionId?e.transactionId:e.collection?e.collection:null};function qe(n){return async n=>M(n)?(n.message.refBlock||(n.message.refBlock=await async function(n){const t=await _e().get("accessNode.api"),r=await _e.first(["sdk.transport","sdk.send"]);var o;return e(r,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),o=await ie(f(),[Re()]),o=await r(o,{config:_e,response:xe,ix:fe},{node:t}),(o=await $e(o)).id}()),A(n)):A(n)}const Me=e=>"function"==typeof e,Ye=e=>"string"==typeof e;async function We(n){if(M(n)||q(n)){var t=le(n,"ix.cadence");e(Me(t)||Ye(t),"Cadence needs to be a function or a string."),Me(t)&&(t=await t({})),e(Ye(t),"Cadence needs to be a string at this point."),n.message.cadence=await _e().where(/^0x/).then(e=>Object.entries(e).reduce((e,[n,t])=>{const r=new RegExp("(\\b"+n+"\\b)","g");return e.replace(r,t)},t))}return n}const Je=e=>"function"==typeof e;function Ve(n){return e(null!=typeof n.xform,`No type specified for argument: ${n.value}`),Je(n.xform)?n.xform(n.value):Je(n.xform.asArgument)?n.xform.asArgument(n.value):void e(!1,"Invalid Argument",n)}async function Ze(n,t=3){return e(t>0,`Argument Resolve Recursion Limit Exceeded for Arg: ${n.tempId}`),Je(n.resolveArgument)?Ze(await n.resolveArgument(),t-1):n}async function Qe(e){if(M(e)||q(e))for(let[n,t]of Object.entries(e.arguments)){const r=await Ze(t);e.arguments[n].asArgument=Ve(r)}return e}const Xe=e=>on(dn(pn(e))),en=e=>on(dn(mn(e))),nn=(e,n)=>Buffer.from(e.padStart(2*n,0),"hex"),tn=(rn=Buffer.from("FLOW-V0.0-transaction").toString("hex"),Buffer.from(rn.padEnd(64,0),"hex")).toString("hex");var rn;const on=e=>tn+e,an=e=>nn(e,8),sn=e=>nn(e,32),cn=e=>Buffer.from(JSON.stringify(e),"utf8"),un=e=>Buffer.from(e,"utf8"),ln=e=>Buffer.from(e,"hex"),dn=e=>u(e).toString("hex"),pn=e=>(hn(e),[un(e.cadence),e.arguments.map(cn),sn(e.refBlock),e.computeLimit,an(e.proposalKey.address),e.proposalKey.keyId,e.proposalKey.sequenceNum,an(e.payer),e.authorizers.map(an)]),mn=e=>(yn(e),[pn(e),fn(e)]),fn=e=>{const n=gn(e);return e.payloadSigs.map(e=>({signerIndex:n.get(e.address),keyId:e.keyId,sig:e.sig})).sort((e,n)=>e.signerIndex>n.signerIndex?1:e.signerIndex<n.signerIndex?-1:e.keyId>n.keyId?1:e.keyId<n.keyId?-1:void 0).map(e=>[e.signerIndex,e.keyId,ln(e.sig)])},gn=e=>{const n=new Map;let t=0;const r=e=>{n.has(e)||(n.set(e,t),t++)};return r(e.proposalKey.address),r(e.payer),e.authorizers.forEach(r),n},hn=e=>{Tn.forEach(n=>On(e,n)),En.forEach(n=>On(e.proposalKey,n,"proposalKey"))},yn=e=>{An.forEach(n=>On(e,n)),e.payloadSigs.forEach((e,n)=>{Nn.forEach(t=>On(e,t,"payloadSigs",n))})},kn=e=>"number"==typeof e,In=e=>"string"==typeof e,bn=e=>null!==e&&"object"==typeof e,wn=e=>bn(e)&&e instanceof Array,Tn=[{name:"cadence",check:In},{name:"arguments",check:wn},{name:"refBlock",check:In,defaultVal:"0"},{name:"computeLimit",check:kn},{name:"proposalKey",check:bn},{name:"payer",check:In},{name:"authorizers",check:wn}],En=[{name:"address",check:In},{name:"keyId",check:kn},{name:"sequenceNum",check:kn}],An=[{name:"payloadSigs",check:wn}],Nn=[{name:"address",check:In},{name:"keyId",check:kn},{name:"sig",check:In}],vn=[{name:"envelopeSigs",check:wn}],Sn=[{name:"address",check:In},{name:"keyId",check:kn},{name:"sig",check:In}],On=(e,n,t,r)=>{const{name:o,check:a,defaultVal:s}=n;if(null==e[o]&&null!=s&&(e[o]=s),null==e[o])throw Gn(o,t,r);if(!a(e[o]))throw _n(o,t,r)},Cn=(e,n,t)=>n?null==t?`${n}.${e}`:`${n}.${t}.${e}`:e,Gn=(e,n,t)=>new Error(`Missing field ${Cn(e,n,t)}`),_n=(e,n,t)=>new Error(`Invalid field ${Cn(e,n,t)}`);function Bn(e){let n=new Set(e.authorizations);return n.add(e.proposer),n.delete(e.payer),Array.from(n)}function Ln(e){let n=new Set([e.payer]);return Array.from(n)}const xn=e=>({cadence:e.message.cadence,refBlock:e.message.refBlock||null,computeLimit:e.message.computeLimit,arguments:e.message.arguments.map(n=>e.arguments[n].asArgument),proposalKey:{address:c(e.accounts[e.proposer].addr),keyId:e.accounts[e.proposer].keyId,sequenceNum:e.accounts[e.proposer].sequenceNum},payer:c(e.accounts[e.payer].addr),authorizers:(()=>{const n=e.authorizations.map(n=>c(e.accounts[n].addr)).reduce((e,n)=>e.find(e=>e===n)?e:[...e,n],[]);return n[0]?n:[]})(),payloadSigs:Bn(e).map(n=>({address:c(e.accounts[n].addr),keyId:e.accounts[n].keyId,sig:e.accounts[n].signature})),envelopeSigs:Ln(e).map(n=>({address:c(e.accounts[n].addr),keyId:e.accounts[n].keyId,sig:e.accounts[n].signature}))}),Rn=e=>(e=>(e=>{const n=new i(256);return n.update(Buffer.from(e,"hex")),n.digest().toString("hex")})(dn((e=>{(e=>{Tn.forEach(n=>On(e,n)),En.forEach(n=>On(e.proposalKey,n,"proposalKey")),An.forEach(n=>On(e,n)),e.payloadSigs.forEach((e,n)=>{Nn.forEach(t=>On(e,t,"payloadSigs",n))}),vn.forEach(n=>On(e,n)),e.envelopeSigs.forEach((e,n)=>{Sn.forEach(t=>On(e,t,"envelopeSigs",n))})})(e);const n=gn(e),t=e=>e.map(({address:e,keyId:t,sig:r})=>({signerIndex:n.get(e),keyId:t,sig:r})).sort((e,n)=>e.signerIndex>n.signerIndex?1:e.signerIndex<n.signerIndex?-1:e.keyId>n.keyId?1:e.keyId<n.keyId?-1:void 0).map(e=>[e.signerIndex,e.keyId,ln(e.sig)]);return[[un(e.cadence),e.arguments.map(cn),sn(e.refBlock),e.computeLimit,an(s(e.proposalKey.address)),e.proposalKey.keyId,e.proposalKey.sequenceNum,an(s(e.payer)),e.authorizers.map(e=>an(s(e)))],t(e.payloadSigs),t(e.envelopeSigs)]})(e))))(e);function Kn(e,n){try{return{f_type:"PreSignable",f_vsn:"1.0.1",roles:e.role,cadence:n.message.cadence,args:n.message.arguments.map(e=>n.arguments[e].asArgument),data:{},interaction:n,voucher:xn(n)}}catch(e){throw console.error("buildPreSignable",e),e}}async function Dn(n,t,r,o=3){e(o,"Account Resolve Recursion Limit Exceeded",{ix:n,accounts:t});let a=[];for(let e of t){var s=r||e;"function"==typeof e.resolve&&(e=await e.resolve(e,Kn(e,n))),Array.isArray(e)?await Dn(n,e,s,o-1):(null!=e.addr&&null!=e.keyId&&(e.tempId=`${e.addr}-${e.keyId}`),n.accounts[e.tempId]=n.accounts[e.tempId]||e,n.accounts[e.tempId].role.proposer=n.accounts[e.tempId].role.proposer||e.role.proposer,n.accounts[e.tempId].role.payer=n.accounts[e.tempId].role.payer||e.role.payer,n.accounts[e.tempId].role.authorizer=n.accounts[e.tempId].role.authorizer||e.role.authorizer,n.accounts[e.tempId].role.proposer&&n.proposer===s.tempId&&(n.proposer=e.tempId),n.accounts[e.tempId].role.payer&&n.payer===s.tempId&&(n.payer=e.tempId),n.accounts[e.tempId].role.authorizer&&(r?a=Array.from(new Set([...a,e.tempId])):n.authorizations=n.authorizations.map(n=>n===s.tempId?e.tempId:n))),s.tempId!=e.tempId&&delete n.accounts[s.tempId]}r&&(n.authorizations=n.authorizations.map(e=>e===r.tempId?a:e).reduce((e,n)=>Array.isArray(n)?[...e,...n]:[...e,n],[]))}async function Fn(e){if(M(e))try{await Dn(e,Object.values(e.accounts)),await Dn(e,Object.values(e.accounts))}catch(e){throw console.error("=== SAD PANDA ===\n\n",e,"\n\n=== SAD PANDA ==="),e}return e}async function Un(e){if(M(e))try{let n=Bn(e);const t=Xe(Pn(e));await Promise.all(n.map(zn(e,t)));let r=Ln(e);const o=en(d({},Pn(e),{payloadSigs:n.map(n=>({address:e.accounts[n].addr,keyId:e.accounts[n].keyId,sig:e.accounts[n].signature}))}));await Promise.all(r.map(zn(e,o)))}catch(n){throw console.error("Signatures",n,{ix:e}),n}return e}function zn(e,n){return async function(t){const r=e.accounts[t];if(null!=r.signature)return;const{signature:o}=await r.signingFunction(function(e,n,t){try{return{f_type:"Signable",f_vsn:"1.0.1",message:n,addr:s(e.addr),keyId:e.keyId,roles:e.role,cadence:t.message.cadence,args:t.message.arguments.map(e=>t.arguments[e].asArgument),data:{},interaction:t,voucher:xn(t)}}catch(e){throw console.error("buildSignable",e),e}}(r,n,e));e.accounts[t].signature=o}}function Pn(e){return{cadence:e.message.cadence,refBlock:e.message.refBlock||null,computeLimit:e.message.computeLimit,arguments:e.message.arguments.map(n=>e.arguments[n].asArgument),proposalKey:{address:s(e.accounts[e.proposer].addr),keyId:e.accounts[e.proposer].keyId,sequenceNum:e.accounts[e.proposer].sequenceNum},payer:s(e.accounts[e.payer].addr),authorizers:e.authorizations.map(n=>s(e.accounts[n].addr)).reduce((e,n)=>e.find(e=>e===n)?e:[...e,n],[])}}async function jn(e){const n=le(e,"ix.validators",[]);return ie(e,n.map(e=>n=>e(n,{Ok:A,Bad:N})))}async function Hn(e){for(let n of Object.keys(e.accounts))e.accounts[n].addr=s(e.accounts[n].addr);return e}async function $n(e){const n=le(e,"ix.voucher-intercept");return T(n)&&await n(xn(e)),e}const qn=e=>e,Mn=(e,n=qn)=>async t=>(await _e.get(`debug.${e}`)&&await n(t,(...n)=>{console.log(`debug[${e}] ---\n`,...n,"\n\n\n---")},e=>["\nAccounts:",{proposer:e.proposer,authorizations:e.authorizations,payer:e.payer},"\n\nDetails:",e.accounts].filter(Boolean)),t),Yn=ie([We,Mn("cadence",(e,n)=>n(e.message.cadence)),Qe,Mn("arguments",(e,n)=>n(e.message.arguments,e.message)),Fn,Mn("accounts",(e,n,t)=>n(...t(e))),async function(n){if(M(n)&&null==n.message.refBlock){const t=await _e().get("accessNode.api"),r=await _e.first(["sdk.transport","sdk.send"]);e(r,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),n.message.refBlock=(await r(ge([Re()]),{config:_e,response:xe,ix:fe},{node:t}).then($e)).id}return n},async function(n){if(M(n)){var t=Object.values(n.accounts).find(e=>e.role.proposer);if(e(t,"Transactions require a proposer"),null==t.sequenceNum){const r=await _e().get("accessNode.api"),o=await _e.first(["sdk.transport","sdk.send"]);e(o,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),n.accounts[t.tempId].sequenceNum=await o(await ge([Ke(t.addr)]),{config:_e,response:xe,ix:fe},{node:r}).then($e).then(e=>e.keys).then(e=>e.find(e=>e.index===t.keyId)).then(e=>e.sequenceNumber)}}return n},Un,Mn("signatures",(e,n,t)=>n(...t(e))),Hn,jn,$n,Mn("resolved",(e,n)=>n(e))]);function Wn(...e){if(e.length>1){const[n,t]=e;return Wn((e,{Ok:r,Bad:o})=>n?r(e):o(e,t))}const[n]=e;return e=>n(e,{Ok:A,Bad:N})}const Jn=async(e=[],n={})=>{const t=await _e.first(["sdk.transport","sdk.send"],n.send),r=await _e.first(["sdk.resolve"],n.resolve||Yn);return n.node=n.node||await _e().get("accessNode.api"),Array.isArray(e)&&(e=ie(f(),e)),t(await r(e),{config:_e,response:xe,ix:fe},n)};async function Vn(e){const n=await _e().where(/^decoder\./),t=Object.entries(n).map(([e,n])=>[e=`/${e.replace(/^decoder\./,"")}$/`,n]);return $e(e,Object.fromEntries(t))}class Zn extends Error{constructor(e){super(`\n Encode Message From Signable Error: Unable to determine message encoding for signer addresss: ${e}. \n Please ensure the address: ${e} is intended to sign the given transaction as specified by the transaction signable.\n `.trim()),this.name="Unable To Determine Message Encoding For Signer Addresss"}}const Qn=(e,n)=>{let t=(e=>{let n=new Set(e.authorizers);return n.add(e.proposalKey.address),n.delete(e.payer),Array.from(n).map(c)})(e.voucher),r=(e=>{let n=new Set([e.payer]);return Array.from(n).map(c)})(e.voucher);const o=t.includes(c(n)),a=r.includes(c(n));if(!o&&!a)throw new Zn(n);const i={cadence:e.voucher.cadence,refBlock:e.voucher.refBlock,computeLimit:e.voucher.computeLimit,arguments:e.voucher.arguments,proposalKey:d({},e.voucher.proposalKey,{address:s(e.voucher.proposalKey.address)}),payer:s(e.voucher.payer),authorizers:e.voucher.authorizers.map(s),payloadSigs:e.voucher.payloadSigs.map(e=>d({},e,{address:s(e.address)}))};return o?Xe(i):en(i)};function Xn(e,n){return console.warn('\n %cFCL/SDK Deprecation Notice\n ============================\n \n "latestBlock()" is deprecated, please use "block()" for this and future versions of FCL\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0008-deprecate-latest-block-method\n \n ============================\n ',"font-weight:bold;font-family:monospace;"),Jn([Re(e)],n).then($e)}function et(e,n){return Jn([Ke(e)],n).then($e)}function nt(e){return pe("ix.validators",n=>Array.isArray(n)?n.push(e):[e])}function tt(e){return ie([n=>(n.block.height=e,n),nt(e=>{if("boolean"==typeof e.block.isSealed)throw new Error("Unable to specify both block height and isSealed.");if(e.block.id)throw new Error("Unable to specify both block height and block id.");return e})])}function rt(e){return ie([n=>(n.block.id=e,A(n)),nt((e,{Ok:n,Bad:t})=>J(e)?t(e,"Unable to specify a block id with a Get Account interaction."):"boolean"==typeof e.block.isSealed?t(e,"Unable to specify both block id and isSealed."):e.block.height?t(e,"Unable to specify both block id and block height."):n(e))])}function ot({sealed:n=!1,id:t,height:r}={},o={}){return e(!(n&&t||n&&r),'Method: block -- Cannot pass "sealed" with "id" or "height"'),e(!(t&&r),'Method: block -- Cannot pass "id" and "height" simultaneously'),t?Jn([Re(),rt(t)],o).then($e):r?Jn([Re(),tt(r)],o).then($e):Jn([Re(n)],o).then($e)}function at(e=[]){return ie(e.map(e=>S(e,{role:"authorizer"})))}function st(e,n,t,r){return{addr:e,signingFunction:n,keyId:t,sequenceNum:r}}function ct(e,n,t){return void 0===n&&void 0===t||console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n \n Passing a start and end into getEnvents has been deprecated and will not be supported in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0005-deprecate-start-end-get-events-builder\n \n ============================\n ","font-weight:bold;font-family:monospace;"),ie([R,r=>(r.events.eventType=e,r.events.start=n,r.events.end=t,A(r))])}function it(e,n,t){return ie([R,r=>(r.events.eventType=e,r.events.start=n,r.events.end=t,A(r))])}function ut(e,n=[]){return ie([R,t=>(t.events.eventType=e,t.events.blockIds=n,A(t))])}function lt(e=null){return ie([P,n=>(n.block.isSealed=e,A(n))])}function dt(e=!1){return console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getLatestBlock builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0006-deprecate-get-latest-block-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),ie([K,n=>(n.block.isSealed=e,A(n))])}function pt(e){return console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getBlockById builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0004-deprecate-get-block-by-id-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),ie([D,n=>(n.block.ids=[e],A(n))])}function mt(e){return console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getBlockByHeight builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0003-deprecate-get-block-by-height-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),ie([F,n=>(n.block.height=e,A(n))])}function ft(e=null){return ie([j,n=>(n.collection.id=e,n)])}function gt(e){return ie([B,n=>(n.transaction.id=e,A(n))])}function ht(e){return ie([L,n=>(n.transaction.id=e,A(n))])}function yt(e){return n=>(n.message.computeLimit=e,n)}function kt(e=[]){return ie(e.map(O))}function It(e,n){return{value:e,xform:n}}async function bt(e){return S(e,{role:"proposer"})}async function wt(e){return S(e,{role:"payer"})}function Tt(){return U}function Et(e){return ie([n=>(n.message.refBlock=e,A(n))])}function At(...e){return ie([G,de("ix.cadence",l(...e))])}const Nt=[];function vt(...e){return ie([_,de("ix.cadence",l(...e)),e=>(e.message.computeLimit=e.message.computeLimit||10,e.message.refBlock=e.message.refBlock||null,e.authorizations=e.authorizations||Nt,A(e))])}function St(e){return de("ix.voucher-intercept",e)}const Ot=({node:n})=>async t=>{if(!M(t))return A(t);if(t.accounts[t.proposer].sequenceNum)return A(t);const r=await _e.first(["sdk.transport","sdk.send"]);e(r,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21");const o=await r(await ge([Ke(t.accounts[t.proposer].addr)]),{config:_e,response:xe,ix:fe},{node:n}),a=await $e(o);return t.accounts[t.proposer].sequenceNum=a.keys[t.accounts[t.proposer].keyId].sequenceNumber,A(t)},Ct=e=>e,Gt=["tempId"];function _t(e){return["SIGNATURE",e.addr,e.keyId].join(".")}function Bt(e={}){return function(n){const t=d({},n,e,{signingFunction:e.signingFunction||n.signingFunction||function(e){return{addr:t.addr,keyId:t.keyId,signature:_t(t)}}});return t}}const Lt={proposer:!1,authorizer:!1,payer:!1};var xt={__proto__:null,mockSend:function(n=Ct){return async function(t){switch(t=await t,!0){case J(t):return function(n,t=5){return e(n.account,"mockAccountResponse(ix) -- ix.account is missing",n),e(n.account.addr,"mockAccountResponse(ix) -- ix.account.addr is missing",n),{account:{addr:n.account.addr,keys:Array.from({length:t},(e,n)=>({index:n,sequenceNumber:42}))}}}(t);case ne(t):return{tag:"GET_BLOCK",block:{id:"32"}};default:return n(t)}}},authzFn:Bt,authzResolve:function(e={}){return function(n){const{tempId:t}=e;return d({},n,{tempId:t||"WITH_RESOLVE",resolve:Bt(function(e,n){if(null==e)return{};var t,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n.indexOf(t=a[r])>=0||(o[t]=e[t]);return o}(e,Gt))})}},authzResolveMany:function(e={}){return function(n){return d({},n,{tempId:e.tempId||"AUTHZ_RESOLVE_MANY",resolve:()=>[e.proposer&&Bt(e.proposer)({role:d({},Lt,{proposer:!0})}),...e.authorizations.map(Bt).map(e=>e({role:d({},Lt,{authorizer:!0})})),e.payer&&Bt(e.payer)({role:d({},Lt,{payer:!0})})].filter(Boolean)})}},sig:_t,idof:e=>`${e.addr}-${e.keyId}`,run:(e=[])=>ge([Et("123"),...e]).then(Yn)};const Rt="0.0.57-alpha.4",Kt=e=>{(({name:e,transitionsPath:n})=>{console.error(`\n %cFCL/SDK Deprecation Notice\n ============================\n The ${e} builder has been removed from the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: ${n}\n ============================\n `,"font-weight:bold;font-family:monospace;")})({name:"params",transitionsPath:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params"})},Dt=e=>(({name:e,transitionsPath:n})=>{console.warn(`\n %cFCL/SDK Deprecation Notice\n ============================\n The ${e} builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: ${n}\n ============================\n `,"font-weight:bold;font-family:monospace;")})({name:"param",transitionsPath:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params"});export{xt as TestUtils,Rt as VERSION,et as account,It as arg,kt as args,tt as atBlockHeight,rt as atBlockId,st as authorization,at as authorizations,ot as block,ge as build,_e as config,xn as createSignableVoucher,Vn as decode,me as destroy,Qn as encodeMessageFromSignable,le as get,Ke as getAccount,Re as getBlock,mt as getBlockByHeight,pt as getBlockById,lt as getBlockHeader,ft as getCollection,ct as getEvents,it as getEventsAtBlockHeightRange,ut as getEventsAtBlockIds,dt as getLatestBlock,ht as getTransaction,gt as getTransactionStatus,f as interaction,Wn as invariant,ae as isBad,J as isGetAccount,ne as isGetBlock,X as isGetBlockByHeight,Q as isGetBlockById,te as isGetBlockHeader,re as isGetCollection,V as isGetEvents,Z as isGetLatestBlock,W as isGetTransaction,Y as isGetTransactionStatus,oe as isOk,ee as isPing,q as isScript,M as isTransaction,$ as isUnknown,Xn as latestBlock,yt as limit,Dt as param,Kt as params,wt as payer,Tt as ping,ie as pipe,bt as proposer,de as put,Et as ref,Yn as resolve,Fn as resolveAccounts,Qe as resolveArguments,We as resolveCadence,Hn as resolveFinalNormalization,Ot as resolveProposerSequenceNumber,qe as resolveRefBlockId,Un as resolveSignatures,jn as resolveValidators,$n as resolveVoucherIntercept,At as script,Jn as send,vt as transaction,pe as update,nt as validator,St as voucherIntercept,Rn as voucherToTxId,se as why};
import{spawn as e,SUBSCRIBE as n,UNSUBSCRIBE as t,send as r,subscriber as a}from"@onflow/util-actor";import{invariant as o}from"@onflow/util-invariant";import{Buffer as s,encode as i}from"@onflow/rlp";import{sansPrefix as c,withPrefix as u}from"@onflow/util-address";import{SHA3 as l}from"sha3";import{template as d}from"@onflow/util-template";export{template as cadence,template as cdc}from"@onflow/util-template";function p(){return p=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},p.apply(this,arguments)}const m="config",f="PUT_CONFIG",g="GET_CONFIG",y="CONFIG/UPDATED",h=e=>e,k={[f]:(e,n,{key:t,value:r})=>{if(null==t)throw new Error("Missing 'key' for config/put.");e.put(t,r),e.broadcast(y,p({},e.all()))},[g]:(e,n,{key:t,fallback:r})=>{if(null==t)throw new Error("Missing 'key' for config/get");n.reply(e.get(t,r))},GET_ALL_CONFIG:(e,n)=>{n.reply(p({},e.all()))},UPDATE_CONFIG:(e,n,{key:t,fn:r})=>{if(null==t)throw new Error("Missing 'key' for config/update");e.update(t,r||h),e.broadcast(y,p({},e.all()))},DELETE_CONFIG:(e,n,{key:t})=>{if(null==t)throw new Error("Missing 'key' for config/delete");e.delete(t),e.broadcast(y,p({},e.all()))},CLEAR_CONFIG:(e,n)=>{let t=Object.keys(e.all());for(let n of t)e.delete(n);e.broadcast(y,p({},e.all()))},WHERE_CONFIG:(e,n,{pattern:t})=>{if(null==t)throw new Error("Missing 'pattern' for config/where");n.reply(e.where(t))},[n]:(e,n)=>{e.subscribe(n.from),e.send(n.from,y,p({},e.all()))},[t]:(e,n)=>{e.unsubscribe(n.from)}};function I(e,n){return r(m,f,{key:e,value:n}),O()}function w(e,n){return r(m,g,{key:e,fallback:n},{expectReply:!0,timeout:10})}async function b(e=[],n){if(!e.length)return n;const[t,...r]=e,a=await w(t);return null==a?b(r,n):a}function T(){return r(m,"GET_ALL_CONFIG",null,{expectReply:!0,timeout:10})}function A(e,n=h){return r(m,"UPDATE_CONFIG",{key:e,fn:n}),O()}function E(e){return r(m,"DELETE_CONFIG",{key:e}),O()}function N(e){return r(m,"WHERE_CONFIG",{pattern:e},{expectReply:!0,timeout:10})}function S(n){return a(m,()=>e(k,m),n)}function v(){return r(m,"CLEAR_CONFIG")}function O(e){return null!=e&&"object"==typeof e&&Object.keys(e).map(n=>I(n,e[n])),{put:I,get:w,all:T,first:b,update:A,delete:E,where:N,subscribe:S,overload:G}}e(k,m),O.put=I,O.get=w,O.all=T,O.first=b,O.update=A,O.delete=E,O.where=N,O.subscribe=S,O.overload=G;const C=e=>e;function G(e={},n=C){return new Promise(async(t,r)=>{const a=await T();try{O(e);var o=await n(await T());await v(),await O(a),t(o)}catch(e){await v(),await O(a),r(e)}})}const _=(e,n)=>{for(let[t,r]of e.entries())if(r===n)return t},B=(e,n)=>new Proxy(e,{get:(e,t)=>{if(_(n,t)){const r=_(n,t);return Reflect.get(e,r)}return n.has(t)&&(async(e,n,t)=>{if(await O.get("logger.level",0)<2)return;const r=(({title:e,message:n})=>[`\n %c${e}\n ============================\n ${n}\n ============================\n `,"font-weight:bold;font-family:monospace;"])({title:"FCL/SDK Deprecation Notice",message:n});console.warn(...r)})(0,`"${t}" will be deprecated in a future version.\n Please use "${n.get(t)}" instead.`),Reflect.get(e,t)}}),L='{\n "tag":"UNKNOWN",\n "assigns":{},\n "status":"OK",\n "reason":null,\n "accounts":{},\n "params":{},\n "arguments":{},\n "message": {\n "cadence":null,\n "refBlock":null,\n "computeLimit":null,\n "proposer":null,\n "payer":null,\n "authorizations":[],\n "params":[],\n "arguments":[]\n },\n "proposer":null,\n "authorizations":[],\n "payer":[],\n "events": {\n "eventType":null,\n "start":null,\n "end":null,\n "blockIds":[]\n },\n "transaction": {\n "id":null\n },\n "block": {\n "id":null,\n "height":null,\n "isSealed":null\n },\n "account": {\n "addr":null\n },\n "collection": {\n "id":null\n }\n}',x=new Set(Object.keys(JSON.parse(L))),R=new Map([["addr","address"],["sequenceNum","seqNum"],["keyId","keyIndex"]]),K=()=>{const e=JSON.parse(L);return p({},e,{account:B(e.account,R)})},D="abcdefghijklmnopqrstuvwxyz0123456789".split(""),F=()=>D[~~(Math.random()*D.length)],U=()=>Array.from({length:10},F).join(""),P=e=>"number"==typeof e,z=e=>Array.isArray(e),j=e=>null!==e&&"object"==typeof e,$=e=>null==e,H=e=>"function"==typeof e,q=e=>{if(!j(e)||$(e)||P(e))return!1;for(let n of x)if(!e.hasOwnProperty(n))return!1;return!0},M=e=>(e.status="OK",e),Y=(e,n)=>(e.status="BAD",e.reason=n,e),W=e=>n=>(n.tag=e,M(n)),J=(e,n={})=>t=>{o("function"==typeof e||"object"==typeof e,"prepAccount must be passed an authorization function or an account object"),o(null!=n.role,"Account must have a role");const r=B(JSON.parse('{\n "kind":"ACCOUNT",\n "tempId":null,\n "addr":null,\n "keyId":null,\n "sequenceNum":null,\n "signature":null,\n "signingFunction":null,\n "resolve":null,\n "role": {\n "proposer":false,\n "authorizer":false,\n "payer":false,\n "param":false\n }\n}'),R),a=n.role,s=U();return e.authorization&&H(e.authorization)&&(e={resolve:e.authorization}),!e.authorization&&H(e)&&(e={resolve:e}),t.accounts[s]=p({},r,{tempId:s},e,{role:p({},r.role,"object"==typeof e.role?e.role:{},{[a]:!0})}),"authorizer"===a?t.authorizations.push(s):"payer"===a?t.payer.push(s):t[a]=s,t},V=e=>n=>{let t=U();return n.message.arguments.push(t),n.arguments[t]=JSON.parse('{\n "kind":"ARGUMENT",\n "tempId":null,\n "value":null,\n "asArgument":null,\n "xform":null,\n "resolve": null,\n "resolveArgument": null\n}'),n.arguments[t].tempId=t,n.arguments[t].value=e.value,n.arguments[t].asArgument=e.asArgument,n.arguments[t].xform=e.xform,n.arguments[t].resolve=e.resolve,n.arguments[t].resolveArgument=H(e.resolveArgument)?e.resolveArgument.bind(e):e.resolveArgument,M(n)},Z=W("UNKNOWN"),Q=W("SCRIPT"),X=W("TRANSACTION"),ee=W("GET_TRANSACTION_STATUS"),ne=W("GET_TRANSACTION"),te=W("GET_ACCOUNT"),re=W("GET_EVENTS"),ae=W("GET_LATEST_BLOCK"),oe=W("GET_BLOCK_BY_ID"),se=W("GET_BLOCK_BY_HEIGHT"),ie=W("PING"),ce=W("GET_BLOCK"),ue=W("GET_BLOCK_HEADER"),le=W("GET_COLLECTION"),de=e=>n=>n.tag===e,pe=de("UNKNOWN"),me=de("SCRIPT"),fe=de("TRANSACTION"),ge=de("GET_TRANSACTION_STATUS"),ye=de("GET_TRANSACTION"),he=de("GET_ACCOUNT"),ke=de("GET_EVENTS"),Ie=de("GET_LATEST_BLOCK"),we=de("GET_BLOCK_BY_ID"),be=de("GET_BLOCK_BY_HEIGHT"),Te=de("PING"),Ae=de("GET_BLOCK"),Ee=de("GET_BLOCK_HEADER"),Ne=de("GET_COLLECTION"),Se=e=>"OK"===e.status,ve=e=>"BAD"===e.status,Oe=e=>e.reason,Ce=async(e,n=[])=>{try{if(e=(e=>{for(let n of Object.keys(e))if(!x.has(n))throw new Error(`"${n}" is an invalid root level Interaction property.`);return e})(await e),ve(e))throw new Error(`Interaction Error: ${e.reason}`);if(!n.length)return e;const[t,...r]=n,a=await t;if(H(a))return Ce(a(e),r);if($(a)||!a)return Ce(e,r);if(q(a))return Ce(a,r);throw new Error("Invalid Interaction Composition")}catch(e){throw e}},Ge=(...e)=>{const[n,t]=e;return z(n)&&null==t?e=>Ge(e,n):Ce(n,t)},_e=e=>e,Be=(e,n,t)=>null==e.assigns[n]?t:e.assigns[n],Le=(e,n)=>t=>(t.assigns[e]=n,M(t)),xe=(e,n=_e)=>t=>(t.assigns[e]=n(t.assigns[e],t),M(t)),Re=e=>n=>(delete n.assigns[e],M(n));var Ke={__proto__:null,UNKNOWN:"UNKNOWN",SCRIPT:"SCRIPT",TRANSACTION:"TRANSACTION",GET_TRANSACTION_STATUS:"GET_TRANSACTION_STATUS",GET_ACCOUNT:"GET_ACCOUNT",GET_EVENTS:"GET_EVENTS",GET_LATEST_BLOCK:"GET_LATEST_BLOCK",PING:"PING",GET_TRANSACTION:"GET_TRANSACTION",GET_BLOCK_BY_ID:"GET_BLOCK_BY_ID",GET_BLOCK_BY_HEIGHT:"GET_BLOCK_BY_HEIGHT",GET_BLOCK:"GET_BLOCK",GET_BLOCK_HEADER:"GET_BLOCK_HEADER",GET_COLLECTION:"GET_COLLECTION",BAD:"BAD",OK:"OK",ACCOUNT:"ACCOUNT",PARAM:"PARAM",ARGUMENT:"ARGUMENT",AUTHORIZER:"authorizer",PAYER:"payer",PROPOSER:"proposer",interaction:K,uuid:U,isNumber:P,isArray:z,isObj:j,isNull:$,isFn:H,isInteraction:q,Ok:M,Bad:Y,prepAccount:J,makeArgument:V,makeUnknown:Z,makeScript:Q,makeTransaction:X,makeGetTransactionStatus:ee,makeGetTransaction:ne,makeGetAccount:te,makeGetEvents:re,makeGetLatestBlock:ae,makeGetBlockById:oe,makeGetBlockByHeight:se,makePing:ie,makeGetBlock:ce,makeGetBlockHeader:ue,makeGetCollection:le,isUnknown:pe,isScript:me,isTransaction:fe,isGetTransactionStatus:ge,isGetTransaction:ye,isGetAccount:he,isGetEvents:ke,isGetLatestBlock:Ie,isGetBlockById:we,isGetBlockByHeight:be,isPing:Te,isGetBlock:Ae,isGetBlockHeader:Ee,isGetCollection:Ne,isOk:Se,isBad:ve,why:Oe,isAccount:e=>"ACCOUNT"===e.kind,isParam:e=>"PARAM"===e.kind,isArgument:e=>"ARGUMENT"===e.kind,pipe:Ge,get:Be,put:Le,update:xe,destroy:Re};function De(e=[]){return Ge(K(),e)}const Fe=()=>JSON.parse('{\n "tag":null,\n "transaction":null,\n "transactionStatus":null,\n "transactionId":null,\n "encodedData":null,\n "events":null,\n "account":null,\n "block":null,\n "blockHeader":null,\n "latestBlock":null,\n "collection":null\n}');function Ue(e=null){return Ge([ce,n=>(n.block.isSealed=e,M(n))])}function Pe(e){return Ge([te,n=>(n.account.addr=c(e),M(n))])}const ze=async(e,n,t)=>{try{return Number(e)}catch(e){throw new Error(`Decode Number Error : ${t.join(".")}`)}},je=async e=>e,$e=async(e,n,t)=>{const r=await e.fields.reduce(async(e,r)=>((e=await e)[r.name]=await Me(r.value,n,[...t,r.name]),e),Promise.resolve({})),a=e.id&&qe(n,e.id);return a?await a(r):r},He={UInt:ze,Int:ze,UInt8:ze,Int8:ze,UInt16:ze,Int16:ze,UInt32:ze,Int32:ze,UInt64:ze,Int64:ze,UInt128:ze,Int128:ze,UInt256:ze,Int256:ze,Word8:ze,Word16:ze,Word32:ze,Word64:ze,UFix64:je,Fix64:je,String:je,Character:je,Bool:je,Address:je,Void:async()=>null,Optional:async(e,n,t)=>e?await Me(e,n,t):null,Reference:async e=>({address:e.address,type:e.type}),Array:async(e,n,t)=>await Promise.all(e.map(e=>new Promise(async r=>r(await Me(e,n,[...t,e.type]))))),Dictionary:async(e,n,t)=>await e.reduce(async(e,r)=>((e=await e)[await Me(r.key,n,[...t,r.key])]=await Me(r.value,n,[...t,r.key]),e),Promise.resolve({})),Event:$e,Resource:$e,Struct:$e,Enum:$e,Type:async e=>e.staticType,Path:async e=>({domain:e.domain,identifier:e.identifier}),Capability:async e=>({path:e.path,address:e.address,borrowType:e.borrowType})},qe=(e,n)=>{const t=Object.keys(e).find(e=>/^\/.*\/$/.test(e)?new RegExp(e.substring(1,e.length-1)).test(n):e===n);return n&&t&&e[t]},Me=async(e,n,t)=>{let r=qe(n,e.type);if(!r)throw new Error(`Undefined Decoder Error: ${e.type}@${t.join(".")}`);return await r(e.value,n,t)},Ye=async(e,n={},t=[])=>{let r=p({},He,n);return await Me(e,r,t)},We=async(e,n={})=>{let t=p({},He,n);return e.encodedData?await Ye(e.encodedData,t):e.transactionStatus?p({},e.transactionStatus,{events:await Promise.all(e.transactionStatus.events.map(async function(e){return{type:e.type,transactionId:e.transactionId,transactionIndex:e.transactionIndex,eventIndex:e.eventIndex,data:await Ye(e.payload,t)}}))}):e.transaction?e.transaction:e.events?await Promise.all(e.events.map(async function(e){return{blockId:e.blockId,blockHeight:e.blockHeight,blockTimestamp:e.blockTimestamp,type:e.type,transactionId:e.transactionId,transactionIndex:e.transactionIndex,eventIndex:e.eventIndex,data:await Ye(e.payload,t)}})):e.account?e.account:e.block?e.block:e.blockHeader?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;"),e.latestBlock):e.transactionId?e.transactionId:e.collection?e.collection:null};function Je(e){return async e=>fe(e)?(e.message.refBlock||(e.message.refBlock=await async function(e){const n=await O().get("accessNode.api"),t=await O.first(["sdk.transport","sdk.send"]);var r;return o(t,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),r=await Ge(K(),[Ue()]),r=await t(r,{config:O,response:Fe,Buffer:s,ix:Ke},{node:n}),(r=await We(r)).id}()),M(e)):M(e)}const Ve=e=>"function"==typeof e,Ze=e=>"string"==typeof e;async function Qe(e){if(fe(e)||me(e)){var n=Be(e,"ix.cadence");o(Ve(n)||Ze(n),"Cadence needs to be a function or a string."),Ve(n)&&(n=await n({})),o(Ze(n),"Cadence needs to be a string at this point."),e.message.cadence=await O().where(/^0x/).then(e=>Object.entries(e).reduce((e,[n,t])=>{const r=new RegExp("(\\b"+n+"\\b)","g");return e.replace(r,t)},n))}return e}const Xe=e=>"function"==typeof e;function en(e){return o(null!=typeof e.xform,`No type specified for argument: ${e.value}`),Xe(e.xform)?e.xform(e.value):Xe(e.xform.asArgument)?e.xform.asArgument(e.value):void o(!1,"Invalid Argument",e)}async function nn(e,n=3){return o(n>0,`Argument Resolve Recursion Limit Exceeded for Arg: ${e.tempId}`),Xe(e.resolveArgument)?nn(await e.resolveArgument(),n-1):e}async function tn(e){if(fe(e)||me(e))for(let[n,t]of Object.entries(e.arguments)){const r=await nn(t);e.arguments[n].asArgument=en(r)}return e}const rn=e=>un(gn(yn(e))),an=e=>un(gn(hn(e))),on=(e,n)=>s.from(e.padStart(2*n,0),"hex"),sn=(cn=s.from("FLOW-V0.0-transaction").toString("hex"),s.from(cn.padEnd(64,0),"hex")).toString("hex");var cn;const un=e=>sn+e,ln=e=>on(e,8),dn=e=>on(e,32),pn=e=>s.from(JSON.stringify(e),"utf8"),mn=e=>s.from(e,"utf8"),fn=e=>s.from(e,"hex"),gn=e=>i(e).toString("hex"),yn=e=>(wn(e),[mn(e.cadence),e.arguments.map(pn),dn(e.refBlock),e.computeLimit,ln(e.proposalKey.address),e.proposalKey.keyId,e.proposalKey.sequenceNum,ln(e.payer),e.authorizers.map(ln)]),hn=e=>(bn(e),[yn(e),kn(e)]),kn=e=>{const n=In(e);return e.payloadSigs.map(e=>({signerIndex:n.get(e.address),keyId:e.keyId,sig:e.sig})).sort((e,n)=>e.signerIndex>n.signerIndex?1:e.signerIndex<n.signerIndex?-1:e.keyId>n.keyId?1:e.keyId<n.keyId?-1:void 0).map(e=>[e.signerIndex,e.keyId,fn(e.sig)])},In=e=>{const n=new Map;let t=0;const r=e=>{n.has(e)||(n.set(e,t),t++)};return r(e.proposalKey.address),r(e.payer),e.authorizers.forEach(r),n},wn=e=>{Sn.forEach(n=>Bn(e,n)),vn.forEach(n=>Bn(e.proposalKey,n,"proposalKey"))},bn=e=>{On.forEach(n=>Bn(e,n)),e.payloadSigs.forEach((e,n)=>{Cn.forEach(t=>Bn(e,t,"payloadSigs",n))})},Tn=e=>"number"==typeof e,An=e=>"string"==typeof e,En=e=>null!==e&&"object"==typeof e,Nn=e=>En(e)&&e instanceof Array,Sn=[{name:"cadence",check:An},{name:"arguments",check:Nn},{name:"refBlock",check:An,defaultVal:"0"},{name:"computeLimit",check:Tn},{name:"proposalKey",check:En},{name:"payer",check:An},{name:"authorizers",check:Nn}],vn=[{name:"address",check:An},{name:"keyId",check:Tn},{name:"sequenceNum",check:Tn}],On=[{name:"payloadSigs",check:Nn}],Cn=[{name:"address",check:An},{name:"keyId",check:Tn},{name:"sig",check:An}],Gn=[{name:"envelopeSigs",check:Nn}],_n=[{name:"address",check:An},{name:"keyId",check:Tn},{name:"sig",check:An}],Bn=(e,n,t,r)=>{const{name:a,check:o,defaultVal:s}=n;if(null==e[a]&&null!=s&&(e[a]=s),null==e[a])throw xn(a,t,r);if(!o(e[a]))throw Rn(a,t,r)},Ln=(e,n,t)=>n?null==t?`${n}.${e}`:`${n}.${t}.${e}`:e,xn=(e,n,t)=>new Error(`Missing field ${Ln(e,n,t)}`),Rn=(e,n,t)=>new Error(`Invalid field ${Ln(e,n,t)}`);function Kn(e){let n=new Set(e.authorizations);return n.add(e.proposer),Array.isArray(e.payer)?e.payer.forEach(e=>n.delete(e)):n.delete(e.payer),Array.from(n)}function Dn(e){let n=new Set(Array.isArray(e.payer)?e.payer:[e.payer]);return Array.from(n)}const Fn=e=>({cadence:e.message.cadence,refBlock:e.message.refBlock||null,computeLimit:e.message.computeLimit,arguments:e.message.arguments.map(n=>e.arguments[n].asArgument),proposalKey:{address:u(e.accounts[e.proposer].addr),keyId:e.accounts[e.proposer].keyId,sequenceNum:e.accounts[e.proposer].sequenceNum},payer:u(e.accounts[Array.isArray(e.payer)?e.payer[0]:e.payer].addr),authorizers:(()=>{const n=e.authorizations.map(n=>u(e.accounts[n].addr)).reduce((e,n)=>e.find(e=>e===n)?e:[...e,n],[]);return n[0]?n:[]})(),payloadSigs:Kn(e).map(n=>({address:u(e.accounts[n].addr),keyId:e.accounts[n].keyId,sig:e.accounts[n].signature})),envelopeSigs:Dn(e).map(n=>({address:u(e.accounts[n].addr),keyId:e.accounts[n].keyId,sig:e.accounts[n].signature}))}),Un=e=>(e=>(e=>{const n=new l(256);return n.update(s.from(e,"hex")),n.digest().toString("hex")})(gn((e=>{(e=>{Sn.forEach(n=>Bn(e,n)),vn.forEach(n=>Bn(e.proposalKey,n,"proposalKey")),On.forEach(n=>Bn(e,n)),e.payloadSigs.forEach((e,n)=>{Cn.forEach(t=>Bn(e,t,"payloadSigs",n))}),Gn.forEach(n=>Bn(e,n)),e.envelopeSigs.forEach((e,n)=>{_n.forEach(t=>Bn(e,t,"envelopeSigs",n))})})(e);const n=In(e),t=e=>e.map(({address:e,keyId:t,sig:r})=>({signerIndex:n.get(e),keyId:t,sig:r})).sort((e,n)=>e.signerIndex>n.signerIndex?1:e.signerIndex<n.signerIndex?-1:e.keyId>n.keyId?1:e.keyId<n.keyId?-1:void 0).map(e=>[e.signerIndex,e.keyId,fn(e.sig)]);return[[mn(e.cadence),e.arguments.map(pn),dn(e.refBlock),e.computeLimit,ln(c(e.proposalKey.address)),e.proposalKey.keyId,e.proposalKey.sequenceNum,ln(c(e.payer)),e.authorizers.map(e=>ln(c(e)))],t(e.payloadSigs),t(e.envelopeSigs)]})(e))))(e);function Pn(e,n){try{return{f_type:"PreSignable",f_vsn:"1.0.1",roles:e.role,cadence:n.message.cadence,args:n.message.arguments.map(e=>n.arguments[e].asArgument),data:{},interaction:n,voucher:Fn(n)}}catch(e){throw console.error("buildPreSignable",e),e}}async function zn(e,n,t,r=3){o(r,"Account Resolve Recursion Limit Exceeded",{ix:e,accounts:n});let a=[];for(let o of n){var s=t||o;if("function"==typeof o.resolve&&(o=await o.resolve(o,Pn(o,e))),Array.isArray(o))await zn(e,o,s,r-1);else{if(null!=o.addr&&null!=o.keyId&&(o.tempId=`${o.addr}-${o.keyId}`),e.accounts[o.tempId]=e.accounts[o.tempId]||o,e.accounts[o.tempId].role.proposer=e.accounts[o.tempId].role.proposer||o.role.proposer,e.accounts[o.tempId].role.payer=e.accounts[o.tempId].role.payer||o.role.payer,e.accounts[o.tempId].role.authorizer=e.accounts[o.tempId].role.authorizer||o.role.authorizer,e.accounts[o.tempId].role.proposer&&e.proposer===s.tempId&&(e.proposer=o.tempId),e.accounts[o.tempId].role.payer&&(e.payer=Array.isArray(e.payer)?Array.from(new Set([...e.payer,o.tempId].map(e=>e===s.tempId?o.tempId:e))):Array.from(new Set([e.payer,o.tempId].map(e=>e===s.tempId?o.tempId:e))),e.payer.length>1)){const n=[],t=[];if(e.payer=e.payer.reduce((r,a)=>{const{addr:o,keyId:s}=e.accounts[a],i=`${o}-${s}`;return t.push(o),n.includes(i)?r:(n.push(i),[...r,a])},[]),Array.from(new Set(t)).length>1)throw new Error("Payer can not be different accounts")}e.accounts[o.tempId].role.authorizer&&(t?a=Array.from(new Set([...a,o.tempId])):e.authorizations=e.authorizations.map(e=>e===s.tempId?o.tempId:e))}s.tempId!=o.tempId&&delete e.accounts[s.tempId]}t&&(e.authorizations=e.authorizations.map(e=>e===t.tempId?a:e).reduce((e,n)=>Array.isArray(n)?[...e,...n]:[...e,n],[]))}async function jn(e){if(fe(e)){Array.isArray(e.payer)||console.warn('\n %cFCL Warning\n ============================\n "ix.payer" must be an array. Support for ix.payer as a singular is deprecated,\n see changelog for more info.\n ============================\n ',"font-weight:bold;font-family:monospace;");try{await zn(e,Object.values(e.accounts)),await zn(e,Object.values(e.accounts))}catch(e){throw console.error("=== SAD PANDA ===\n\n",e,"\n\n=== SAD PANDA ==="),e}}return e}async function $n(e){if(fe(e))try{let n=Kn(e);const t=rn(qn(e));await Promise.all(n.map(Hn(e,t)));let r=Dn(e);const a=an(p({},qn(e),{payloadSigs:n.map(n=>({address:e.accounts[n].addr,keyId:e.accounts[n].keyId,sig:e.accounts[n].signature}))}));await Promise.all(r.map(Hn(e,a)))}catch(n){throw console.error("Signatures",n,{ix:e}),n}return e}function Hn(e,n){return async function(t){const r=e.accounts[t];if(null!=r.signature)return;const{signature:a}=await r.signingFunction(function(e,n,t){try{return{f_type:"Signable",f_vsn:"1.0.1",message:n,addr:c(e.addr),keyId:e.keyId,roles:e.role,cadence:t.message.cadence,args:t.message.arguments.map(e=>t.arguments[e].asArgument),data:{},interaction:t,voucher:Fn(t)}}catch(e){throw console.error("buildSignable",e),e}}(r,n,e));e.accounts[t].signature=a}}function qn(e){const n=c((Array.isArray(e.payer)?e.accounts[e.payer[0]]:e.accounts[e.payer]).addr);return{cadence:e.message.cadence,refBlock:e.message.refBlock||null,computeLimit:e.message.computeLimit,arguments:e.message.arguments.map(n=>e.arguments[n].asArgument),proposalKey:{address:c(e.accounts[e.proposer].addr),keyId:e.accounts[e.proposer].keyId,sequenceNum:e.accounts[e.proposer].sequenceNum},payer:n,authorizers:e.authorizations.map(n=>c(e.accounts[n].addr)).reduce((e,n)=>e.find(e=>e===n)?e:[...e,n],[])}}async function Mn(e){const n=Be(e,"ix.validators",[]);return Ge(e,n.map(e=>n=>e(n,{Ok:M,Bad:Y})))}async function Yn(e){for(let n of Object.keys(e.accounts))e.accounts[n].addr=c(e.accounts[n].addr);return e}async function Wn(e){const n=Be(e,"ix.voucher-intercept");return H(n)&&await n(Fn(e)),e}const Jn=e=>e,Vn=(e,n=Jn)=>async t=>(await O.get(`debug.${e}`)&&await n(t,(...n)=>{console.log(`debug[${e}] ---\n`,...n,"\n\n\n---")},e=>["\nAccounts:",{proposer:e.proposer,authorizations:e.authorizations,payer:e.payer},"\n\nDetails:",e.accounts].filter(Boolean)),t),Zn=Ge([Qe,Vn("cadence",(e,n)=>n(e.message.cadence)),tn,Vn("arguments",(e,n)=>n(e.message.arguments,e.message)),jn,Vn("accounts",(e,n,t)=>n(...t(e))),async function(e){if(fe(e)&&null==e.message.refBlock){const n=await O().get("accessNode.api"),t=await O.first(["sdk.transport","sdk.send"]);o(t,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),e.message.refBlock=(await t(De([Ue()]),{config:O,response:Fe,Buffer:s,ix:Ke},{node:n}).then(We)).id}return e},async function(e){if(fe(e)){var n=Object.values(e.accounts).find(e=>e.role.proposer);if(o(n,"Transactions require a proposer"),null==n.sequenceNum){const t=await O().get("accessNode.api"),r=await O.first(["sdk.transport","sdk.send"]);o(r,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),e.accounts[n.tempId].sequenceNum=await r(await De([Pe(n.addr)]),{config:O,response:Fe,Buffer:s,ix:Ke},{node:t}).then(We).then(e=>e.keys).then(e=>e.find(e=>e.index===n.keyId)).then(e=>e.sequenceNumber)}}return e},$n,Vn("signatures",(e,n,t)=>n(...t(e))),Yn,Mn,Wn,Vn("resolved",(e,n)=>n(e))]);function Qn(...e){if(e.length>1){const[n,t]=e;return Qn((e,{Ok:r,Bad:a})=>n?r(e):a(e,t))}const[n]=e;return e=>n(e,{Ok:M,Bad:Y})}const Xn=async(e=[],n={})=>{const t=await O.first(["sdk.transport","sdk.send"],n.send),r=await O.first(["sdk.resolve"],n.resolve||Zn);return n.node=n.node||await O().get("accessNode.api"),Array.isArray(e)&&(e=Ge(K(),e)),t(await r(e),{config:O,response:Fe,ix:Ke,Buffer:s},n)};async function et(e){const n=await O().where(/^decoder\./),t=Object.entries(n).map(([e,n])=>[e=`/${e.replace(/^decoder\./,"")}$/`,n]);return We(e,Object.fromEntries(t))}class nt extends Error{constructor(e){super(`\n Encode Message From Signable Error: Unable to determine message encoding for signer addresss: ${e}. \n Please ensure the address: ${e} is intended to sign the given transaction as specified by the transaction signable.\n `.trim()),this.name="Unable To Determine Message Encoding For Signer Addresss"}}const tt=(e,n)=>{let t=(e=>{let n=new Set(e.authorizers);return n.add(e.proposalKey.address),n.delete(e.payer),Array.from(n).map(u)})(e.voucher),r=(e=>{let n=new Set([e.payer]);return Array.from(n).map(u)})(e.voucher);const a=t.includes(u(n)),o=r.includes(u(n));if(!a&&!o)throw new nt(n);const s={cadence:e.voucher.cadence,refBlock:e.voucher.refBlock,computeLimit:e.voucher.computeLimit,arguments:e.voucher.arguments,proposalKey:p({},e.voucher.proposalKey,{address:c(e.voucher.proposalKey.address)}),payer:c(e.voucher.payer),authorizers:e.voucher.authorizers.map(c),payloadSigs:e.voucher.payloadSigs.map(e=>p({},e,{address:c(e.address)}))};return a?rn(s):an(s)};function rt(e,n){return console.warn('\n %cFCL/SDK Deprecation Notice\n ============================\n \n "latestBlock()" is deprecated, please use "block()" for this and future versions of FCL\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0008-deprecate-latest-block-method\n \n ============================\n ',"font-weight:bold;font-family:monospace;"),Xn([Ue(e)],n).then(We)}function at(e){return xe("ix.validators",n=>Array.isArray(n)?n.push(e):[e])}function ot(e){return Ge([n=>(n.block.height=e,n),at(e=>{if("boolean"==typeof e.block.isSealed)throw new Error("Unable to specify both block height and isSealed.");if(e.block.id)throw new Error("Unable to specify both block height and block id.");return e})])}function st(e){return Ge([n=>(n.block.id=e,M(n)),at((e,{Ok:n,Bad:t})=>he(e)?t(e,"Unable to specify a block id with a Get Account interaction."):"boolean"==typeof e.block.isSealed?t(e,"Unable to specify both block id and isSealed."):e.block.height?t(e,"Unable to specify both block id and block height."):n(e))])}function it(e,{height:n,id:t}={},r){return o(!(t&&n),'Method: account -- Cannot pass "id" and "height" simultaneously'),t?Xn([Pe(e),st(t)],r).then(We):n?Xn([Pe(e),ot(n)],r).then(We):Xn([Pe(e)],r).then(We)}function ct({sealed:e=!1,id:n,height:t}={},r={}){return o(!(e&&n||e&&t),'Method: block -- Cannot pass "sealed" with "id" or "height"'),o(!(n&&t),'Method: block -- Cannot pass "id" and "height" simultaneously'),n?Xn([Ue(),st(n)],r).then(We):t?Xn([Ue(),ot(t)],r).then(We):Xn([Ue(e)],r).then(We)}function ut(e=[]){return Ge(e.map(e=>J(e,{role:"authorizer"})))}function lt(e,n,t,r){return{addr:e,signingFunction:n,keyId:t,sequenceNum:r}}function dt(e,n,t){return void 0===n&&void 0===t||console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n \n Passing a start and end into getEnvents has been deprecated and will not be supported in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0005-deprecate-start-end-get-events-builder\n \n ============================\n ","font-weight:bold;font-family:monospace;"),Ge([re,r=>(r.events.eventType=e,r.events.start=n,r.events.end=t,M(r))])}function pt(e,n,t){return Ge([re,r=>(r.events.eventType=e,r.events.start=n,r.events.end=t,M(r))])}function mt(e,n=[]){return Ge([re,t=>(t.events.eventType=e,t.events.blockIds=n,M(t))])}function ft(e=null){return Ge([ue,n=>(n.block.isSealed=e,M(n))])}function gt(e=!1){return console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getLatestBlock builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0006-deprecate-get-latest-block-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),Ge([ae,n=>(n.block.isSealed=e,M(n))])}function yt(e){return console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getBlockById builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0004-deprecate-get-block-by-id-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),Ge([oe,n=>(n.block.ids=[e],M(n))])}function ht(e){return console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getBlockByHeight builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0003-deprecate-get-block-by-height-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),Ge([se,n=>(n.block.height=e,M(n))])}function kt(e=null){return Ge([le,n=>(n.collection.id=e,n)])}function It(e){return Ge([ee,n=>(n.transaction.id=e,M(n))])}function wt(e){return Ge([ne,n=>(n.transaction.id=e,M(n))])}function bt(e){return n=>(n.message.computeLimit=e,n)}function Tt(e=[]){return Ge(e.map(V))}function At(e,n){return{value:e,xform:n}}async function Et(e){return J(e,{role:"proposer"})}async function Nt(e){return J(e,{role:"payer"})}function St(){return ie}function vt(e){return Ge([n=>(n.message.refBlock=e,M(n))])}function Ot(...e){return Ge([Q,Le("ix.cadence",d(...e))])}const Ct=[];function Gt(...e){return Ge([X,Le("ix.cadence",d(...e)),e=>(e.message.computeLimit=e.message.computeLimit||10,e.message.refBlock=e.message.refBlock||null,e.authorizations=e.authorizations||Ct,M(e))])}function _t(e){return Le("ix.voucher-intercept",e)}const Bt=({node:e})=>async n=>{if(!fe(n))return M(n);if(n.accounts[n.proposer].sequenceNum)return M(n);const t=await O.first(["sdk.transport","sdk.send"]);o(t,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21");const r=await t(await De([Pe(n.accounts[n.proposer].addr)]),{config:O,response:Fe,Buffer:s,ix:Ke},{node:e}),a=await We(r);return n.accounts[n.proposer].sequenceNum=a.keys[n.accounts[n.proposer].keyId].sequenceNumber,M(n)},Lt=e=>e,xt=["tempId"];function Rt(e){return["SIGNATURE",e.addr,e.keyId].join(".")}function Kt(e={}){return function(n){const t=p({},n,e,{signingFunction:e.signingFunction||n.signingFunction||function(e){return{addr:t.addr,keyId:t.keyId,signature:Rt(t)}}});return t}}const Dt={proposer:!1,authorizer:!1,payer:!1};var Ft={__proto__:null,mockSend:function(e=Lt){return async function(n){switch(n=await n,!0){case he(n):return function(e,n=5){return o(e.account,"mockAccountResponse(ix) -- ix.account is missing",e),o(e.account.addr,"mockAccountResponse(ix) -- ix.account.addr is missing",e),{account:{addr:e.account.addr,keys:Array.from({length:n},(e,n)=>({index:n,sequenceNumber:42}))}}}(n);case Ae(n):return{tag:"GET_BLOCK",block:{id:"32"}};default:return e(n)}}},authzFn:Kt,authzResolve:function(e={}){return function(n){const{tempId:t}=e;return p({},n,{tempId:t||"WITH_RESOLVE",resolve:Kt(function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n.indexOf(t=o[r])>=0||(a[t]=e[t]);return a}(e,xt))})}},authzResolveMany:function(e={}){return function(n){return p({},n,{tempId:e.tempId||"AUTHZ_RESOLVE_MANY",resolve:()=>[e.proposer&&Kt(e.proposer)({role:p({},Dt,{proposer:!0})}),...e.authorizations.map(Kt).map(e=>e({role:p({},Dt,{authorizer:!0})})),e.payer&&Kt(e.payer)({role:p({},Dt,{payer:!0})})].filter(Boolean)})}},sig:Rt,idof:e=>`${e.addr}-${e.keyId}`,run:(e=[])=>De([vt("123"),...e]).then(Zn)};const Ut="0.0.57-multisig.0",Pt=e=>{(({name:e,transitionsPath:n})=>{console.error(`\n %cFCL/SDK Deprecation Notice\n ============================\n The ${e} builder has been removed from the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: ${n}\n ============================\n `,"font-weight:bold;font-family:monospace;")})({name:"params",transitionsPath:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params"})},zt=e=>(({name:e,transitionsPath:n})=>{console.warn(`\n %cFCL/SDK Deprecation Notice\n ============================\n The ${e} builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: ${n}\n ============================\n `,"font-weight:bold;font-family:monospace;")})({name:"param",transitionsPath:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params"});export{Ft as TestUtils,Ut as VERSION,it as account,At as arg,Tt as args,ot as atBlockHeight,st as atBlockId,lt as authorization,ut as authorizations,ct as block,De as build,O as config,Fn as createSignableVoucher,et as decode,Re as destroy,tt as encodeMessageFromSignable,Be as get,Pe as getAccount,Ue as getBlock,ht as getBlockByHeight,yt as getBlockById,ft as getBlockHeader,kt as getCollection,dt as getEvents,pt as getEventsAtBlockHeightRange,mt as getEventsAtBlockIds,gt as getLatestBlock,wt as getTransaction,It as getTransactionStatus,K as interaction,Qn as invariant,ve as isBad,he as isGetAccount,Ae as isGetBlock,be as isGetBlockByHeight,we as isGetBlockById,Ee as isGetBlockHeader,Ne as isGetCollection,ke as isGetEvents,Ie as isGetLatestBlock,ye as isGetTransaction,ge as isGetTransactionStatus,Se as isOk,Te as isPing,me as isScript,fe as isTransaction,pe as isUnknown,rt as latestBlock,bt as limit,zt as param,Pt as params,Nt as payer,St as ping,Ge as pipe,Et as proposer,Le as put,vt as ref,Zn as resolve,jn as resolveAccounts,tn as resolveArguments,Qe as resolveCadence,Yn as resolveFinalNormalization,Bt as resolveProposerSequenceNumber,Je as resolveRefBlockId,$n as resolveSignatures,Mn as resolveValidators,Wn as resolveVoucherIntercept,Ot as script,Xn as send,Gt as transaction,xe as update,at as validator,_t as voucherIntercept,Un as voucherToTxId,Oe as why};
//# sourceMappingURL=sdk.modern.js.map

@@ -1,2 +0,2 @@

import{invariant as e}from"@onflow/util-invariant";import{SUBSCRIBE as n,UNSUBSCRIBE as r,spawn as t,send as o,subscriber as i}from"@onflow/util-actor";import{sansPrefix as u,withPrefix as c}from"@onflow/util-address";import{SHA3 as a}from"sha3";import{encode as s}from"@onflow/rlp";import{template as l}from"@onflow/util-template";export{template as cadence,template as cdc}from"@onflow/util-template";function f(){return f=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},f.apply(this,arguments)}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function m(e,n){return m=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},m(e,n)}function p(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function h(e,n,r){return h=p()?Reflect.construct:function(e,n,r){var t=[null];t.push.apply(t,n);var o=new(Function.bind.apply(e,t));return r&&m(o,r.prototype),o},h.apply(null,arguments)}function v(e){var n="function"==typeof Map?new Map:void 0;return v=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,r)}function r(){return h(e,arguments,d(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),m(r,e)},v(e)}function g(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=new Array(n);r<n;r++)t[r]=e[r];return t}var y,k='{\n "tag":"UNKNOWN",\n "assigns":{},\n "status":"OK",\n "reason":null,\n "accounts":{},\n "params":{},\n "arguments":{},\n "message": {\n "cadence":null,\n "refBlock":null,\n "computeLimit":null,\n "proposer":null,\n "payer":null,\n "authorizations":[],\n "params":[],\n "arguments":[]\n },\n "proposer":null,\n "authorizations":[],\n "payer":null,\n "events": {\n "eventType":null,\n "start":null,\n "end":null,\n "blockIds":[]\n },\n "transaction": {\n "id":null\n },\n "block": {\n "id":null,\n "height":null,\n "isSealed":null\n },\n "account": {\n "addr":null\n },\n "collection": {\n "id":null\n }\n}',b=new Set(Object.keys(JSON.parse(k))),I=function(){return JSON.parse(k)},P="abcdefghijklmnopqrstuvwxyz0123456789".split(""),T=function(){return P[~~(Math.random()*P.length)]},E=function(){return Array.from({length:10},T).join("")},S=function(e){return"number"==typeof e},A=function(e){return Array.isArray(e)},w=function(e){return null!==e&&"object"==typeof e},N=function(e){return null==e},O=function(e){return"function"==typeof e},_=function(e){if(!w(e)||N(e)||S(e))return!1;for(var n,r=function(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,n){if(e){if("string"==typeof e)return g(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?g(e,n):void 0}}(e))){r&&(e=r);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(b);!(n=r()).done;)if(!e.hasOwnProperty(n.value))return!1;return!0},C=function(e){return e.status="OK",e},G=function(e,n){return e.status="BAD",e.reason=n,e},B=function(e){return function(n){return n.tag=e,C(n)}},j=function(n,r){return void 0===r&&(r={}),function(t){var o;e("function"==typeof n||"object"==typeof n,"prepAccount must be passed an authorization function or an account object"),e(null!=r.role,"Account must have a role");var i=JSON.parse('{\n "kind":"ACCOUNT",\n "tempId":null,\n "addr":null,\n "keyId":null,\n "sequenceNum":null,\n "signature":null,\n "signingFunction":null,\n "resolve":null,\n "role": {\n "proposer":false,\n "authorizer":false,\n "payer":false,\n "param":false\n }\n}'),u=r.role,c=E();return n.authorization&&O(n.authorization)&&(n={resolve:n.authorization}),!n.authorization&&O(n)&&(n={resolve:n}),t.accounts[c]=f({},i,{tempId:c},n,{role:f({},i.role,"object"==typeof n.role?n.role:{},(o={},o[u]=!0,o))}),"authorizer"===u?t.authorizations.push(c):t[u]=c,t}},L=function(e){return function(n){var r=E();return n.message.arguments.push(r),n.arguments[r]=JSON.parse('{\n "kind":"ARGUMENT",\n "tempId":null,\n "value":null,\n "asArgument":null,\n "xform":null,\n "resolve": null,\n "resolveArgument": null\n}'),n.arguments[r].tempId=r,n.arguments[r].value=e.value,n.arguments[r].asArgument=e.asArgument,n.arguments[r].xform=e.xform,n.arguments[r].resolve=e.resolve,n.arguments[r].resolveArgument=O(e.resolveArgument)?e.resolveArgument.bind(e):e.resolveArgument,C(n)}},x=B("UNKNOWN"),R=B("SCRIPT"),K=B("TRANSACTION"),D=B("GET_TRANSACTION_STATUS"),F=B("GET_TRANSACTION"),U=B("GET_ACCOUNT"),z=B("GET_EVENTS"),H=B("GET_LATEST_BLOCK"),M=B("GET_BLOCK_BY_ID"),q=B("GET_BLOCK_BY_HEIGHT"),Y=B("PING"),W=B("GET_BLOCK"),J=B("GET_BLOCK_HEADER"),V=B("GET_COLLECTION"),$=function(e){return function(n){return n.tag===e}},Z=$("UNKNOWN"),Q=$("SCRIPT"),X=$("TRANSACTION"),ee=$("GET_TRANSACTION_STATUS"),ne=$("GET_TRANSACTION"),re=$("GET_ACCOUNT"),te=$("GET_EVENTS"),oe=$("GET_LATEST_BLOCK"),ie=$("GET_BLOCK_BY_ID"),ue=$("GET_BLOCK_BY_HEIGHT"),ce=$("PING"),ae=$("GET_BLOCK"),se=$("GET_BLOCK_HEADER"),le=$("GET_COLLECTION"),fe=function(e){return"OK"===e.status},de=function(e){return"BAD"===e.status},me=function(e){return e.reason},pe=function e(n,r){void 0===r&&(r=[]);try{return Promise.resolve(function(t,o){try{var i=Promise.resolve(n).then(function(t){if(n=function(e){for(var n=0,r=Object.keys(e);n<r.length;n++){var t=r[n];if(!b.has(t))throw new Error('"'+t+'" is an invalid root level Interaction property.')}return e}(t),de(n))throw new Error("Interaction Error: "+n.reason);if(!r.length)return n;var o=r[0],i=r.slice(1);return Promise.resolve(o).then(function(r){if(O(r))return e(r(n),i);if(N(r)||!r)return e(n,i);if(_(r))return e(r,i);throw new Error("Invalid Interaction Composition")})})}catch(e){return o(e)}return i&&i.then?i.then(void 0,o):i}(0,function(e){throw e}))}catch(e){return Promise.reject(e)}},he=function e(){var n=[].slice.call(arguments),r=n[0],t=n[1];return A(r)&&null==t?function(n){return e(n,r)}:pe(r,t)},ve=function(e){return e},ge=function(e,n,r){return null==e.assigns[n]?r:e.assigns[n]},ye=function(e,n){return function(r){return r.assigns[e]=n,C(r)}},ke=function(e,n){return void 0===n&&(n=ve),function(r){return r.assigns[e]=n(r.assigns[e],r),C(r)}},be=function(e){return function(n){return delete n.assigns[e],C(n)}},Ie={__proto__:null,UNKNOWN:"UNKNOWN",SCRIPT:"SCRIPT",TRANSACTION:"TRANSACTION",GET_TRANSACTION_STATUS:"GET_TRANSACTION_STATUS",GET_ACCOUNT:"GET_ACCOUNT",GET_EVENTS:"GET_EVENTS",GET_LATEST_BLOCK:"GET_LATEST_BLOCK",PING:"PING",GET_TRANSACTION:"GET_TRANSACTION",GET_BLOCK_BY_ID:"GET_BLOCK_BY_ID",GET_BLOCK_BY_HEIGHT:"GET_BLOCK_BY_HEIGHT",GET_BLOCK:"GET_BLOCK",GET_BLOCK_HEADER:"GET_BLOCK_HEADER",GET_COLLECTION:"GET_COLLECTION",BAD:"BAD",OK:"OK",ACCOUNT:"ACCOUNT",PARAM:"PARAM",ARGUMENT:"ARGUMENT",AUTHORIZER:"authorizer",PAYER:"payer",PROPOSER:"proposer",interaction:I,uuid:E,isNumber:S,isArray:A,isObj:w,isNull:N,isFn:O,isInteraction:_,Ok:C,Bad:G,prepAccount:j,makeArgument:L,makeUnknown:x,makeScript:R,makeTransaction:K,makeGetTransactionStatus:D,makeGetTransaction:F,makeGetAccount:U,makeGetEvents:z,makeGetLatestBlock:H,makeGetBlockById:M,makeGetBlockByHeight:q,makePing:Y,makeGetBlock:W,makeGetBlockHeader:J,makeGetCollection:V,isUnknown:Z,isScript:Q,isTransaction:X,isGetTransactionStatus:ee,isGetTransaction:ne,isGetAccount:re,isGetEvents:te,isGetLatestBlock:oe,isGetBlockById:ie,isGetBlockByHeight:ue,isPing:ce,isGetBlock:ae,isGetBlockHeader:se,isGetCollection:le,isOk:fe,isBad:de,why:me,isAccount:function(e){return"ACCOUNT"===e.kind},isParam:function(e){return"PARAM"===e.kind},isArgument:function(e){return"ARGUMENT"===e.kind},pipe:he,get:ge,put:ye,update:ke,destroy:be};function Pe(e){return void 0===e&&(e=[]),he(I(),e)}var Te=function e(n,r){void 0===n&&(n=[]);try{if(!n.length)return Promise.resolve(r);var t=n[0],o=n.slice(1);return Promise.resolve(Ce(t)).then(function(n){return null==n?e(o,r):n})}catch(e){return Promise.reject(e)}},Ee="config",Se="PUT_CONFIG",Ae="GET_CONFIG",we="CONFIG/UPDATED",Ne=function(e){return e},Oe=((y={})[Se]=function(e,n,r){var t=r.key,o=r.value;if(null==t)throw new Error("Missing 'key' for config/put.");e.put(t,o),e.broadcast(we,f({},e.all()))},y[Ae]=function(e,n,r){var t=r.key,o=r.fallback;if(null==t)throw new Error("Missing 'key' for config/get");n.reply(e.get(t,o))},y.GET_ALL_CONFIG=function(e,n){n.reply(f({},e.all()))},y.UPDATE_CONFIG=function(e,n,r){var t=r.key,o=r.fn;if(null==t)throw new Error("Missing 'key' for config/update");e.update(t,o||Ne),e.broadcast(we,f({},e.all()))},y.DELETE_CONFIG=function(e,n,r){var t=r.key;if(null==t)throw new Error("Missing 'key' for config/delete");e.delete(t),e.broadcast(we,f({},e.all()))},y.CLEAR_CONFIG=function(e,n){for(var r=0,t=Object.keys(e.all());r<t.length;r++)e.delete(t[r]);e.broadcast(we,f({},e.all()))},y.WHERE_CONFIG=function(e,n,r){var t=r.pattern;if(null==t)throw new Error("Missing 'pattern' for config/where");n.reply(e.where(t))},y[n]=function(e,n){e.subscribe(n.from),e.send(n.from,we,f({},e.all()))},y[r]=function(e,n){e.unsubscribe(n.from)},y);function _e(e,n){return o(Ee,Se,{key:e,value:n}),Ke()}function Ce(e,n){return o(Ee,Ae,{key:e,fallback:n},{expectReply:!0,timeout:10})}function Ge(){return o(Ee,"GET_ALL_CONFIG",null,{expectReply:!0,timeout:10})}function Be(e,n){return void 0===n&&(n=Ne),o(Ee,"UPDATE_CONFIG",{key:e,fn:n}),Ke()}function je(e){return o(Ee,"DELETE_CONFIG",{key:e}),Ke()}function Le(e){return o(Ee,"WHERE_CONFIG",{pattern:e},{expectReply:!0,timeout:10})}function xe(e){return i(Ee,function(){return t(Oe,Ee)},e)}function Re(){return o(Ee,"CLEAR_CONFIG")}function Ke(e){return null!=e&&"object"==typeof e&&Object.keys(e).map(function(n){return _e(n,e[n])}),{put:_e,get:Ce,all:Ge,first:Te,update:Be,delete:je,where:Le,subscribe:xe,overload:Fe}}t(Oe,Ee),Ke.put=_e,Ke.get=Ce,Ke.all=Ge,Ke.first=Te,Ke.update=Be,Ke.delete=je,Ke.where=Le,Ke.subscribe=xe,Ke.overload=Fe;var De=function(e){return e};function Fe(e,n){return void 0===e&&(e={}),void 0===n&&(n=De),new Promise(function(r,t){try{return Promise.resolve(Ge()).then(function(o){var i=function(t,i){try{var u=function(){Ke(e);var t=n;return Promise.resolve(Ge()).then(function(e){return Promise.resolve(t(e)).then(function(e){return Promise.resolve(Re()).then(function(){return Promise.resolve(Ke(o)).then(function(){r(e)})})})})}()}catch(e){return i(e)}return u&&u.then?u.then(void 0,i):u}(0,function(e){return Promise.resolve(Re()).then(function(){return Promise.resolve(Ke(o)).then(function(){t(e)})})});if(i&&i.then)return i.then(function(){})})}catch(e){return Promise.reject(e)}})}var Ue=function(){return JSON.parse('{\n "tag":null,\n "transaction":null,\n "transactionStatus":null,\n "transactionId":null,\n "encodedData":null,\n "events":null,\n "account":null,\n "block":null,\n "blockHeader":null,\n "latestBlock":null,\n "collection":null\n}')};function ze(e){return void 0===e&&(e=null),he([W,function(n){return n.block.isSealed=e,C(n)}])}function He(e){return he([U,function(n){return n.account.addr=u(e),C(n)}])}var Me=function(e,n,r){try{try{return Promise.resolve(Number(e))}catch(e){throw new Error("Decode Number Error : "+r.join("."))}}catch(e){return Promise.reject(e)}},qe=function(e){return Promise.resolve(e)},Ye=function(e,n,r){try{return Promise.resolve(e.fields.reduce(function(e,t){return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(Ve(t.value,n,[].concat(r,[t.name]))).then(function(n){return e[t.name]=n,e})})},Promise.resolve({}))).then(function(r){var t=e.id&&Je(n,e.id);return t?Promise.resolve(t(r)):r})}catch(e){return Promise.reject(e)}},We={UInt:Me,Int:Me,UInt8:Me,Int8:Me,UInt16:Me,Int16:Me,UInt32:Me,Int32:Me,UInt64:Me,Int64:Me,UInt128:Me,Int128:Me,UInt256:Me,Int256:Me,Word8:Me,Word16:Me,Word32:Me,Word64:Me,UFix64:qe,Fix64:qe,String:qe,Character:qe,Bool:qe,Address:qe,Void:function(){return Promise.resolve(null)},Optional:function(e,n,r){return Promise.resolve(e?Ve(e,n,r):null)},Reference:function(e){try{return Promise.resolve({address:e.address,type:e.type})}catch(e){return Promise.reject(e)}},Array:function(e,n,r){try{return Promise.resolve(Promise.all(e.map(function(e){return new Promise(function(t){try{return Promise.resolve(Ve(e,n,[].concat(r,[e.type]))).then(t)}catch(e){return Promise.reject(e)}})})))}catch(e){return Promise.reject(e)}},Dictionary:function(e,n,r){try{return Promise.resolve(e.reduce(function(e,t){return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(Ve(t.key,n,[].concat(r,[t.key]))).then(function(o){return Promise.resolve(Ve(t.value,n,[].concat(r,[t.key]))).then(function(n){return e[o]=n,e})})})},Promise.resolve({})))}catch(e){return Promise.reject(e)}},Event:Ye,Resource:Ye,Struct:Ye,Enum:Ye,Type:function(e){try{return Promise.resolve(e.staticType)}catch(e){return Promise.reject(e)}},Path:function(e){try{return Promise.resolve({domain:e.domain,identifier:e.identifier})}catch(e){return Promise.reject(e)}},Capability:function(e){try{return Promise.resolve({path:e.path,address:e.address,borrowType:e.borrowType})}catch(e){return Promise.reject(e)}}},Je=function(e,n){var r=Object.keys(e).find(function(e){return/^\/.*\/$/.test(e)?new RegExp(e.substring(1,e.length-1)).test(n):e===n});return n&&r&&e[r]},Ve=function(e,n,r){try{var t=Je(n,e.type);if(!t)throw new Error("Undefined Decoder Error: "+e.type+"@"+r.join("."));return Promise.resolve(t(e.value,n,r))}catch(e){return Promise.reject(e)}},$e=function(e,n,r){void 0===n&&(n={}),void 0===r&&(r=[]);var t=f({},We,n);return Promise.resolve(Ve(e,t,r))},Ze=function(e,n){void 0===n&&(n={});try{var r,t=f({},We,n),o=e.encodedData?Promise.resolve($e(e.encodedData,t)).then(function(e){return r=1,e}):e.transactionStatus?Promise.resolve(Promise.all(e.transactionStatus.events.map(function(e){try{var n=e.eventIndex,r=e.transactionIndex,o=e.transactionId,i=e.type;return Promise.resolve($e(e.payload,t)).then(function(e){return{type:i,transactionId:o,transactionIndex:r,eventIndex:n,data:e}})}catch(e){return Promise.reject(e)}}))).then(function(n){var t=f({},e.transactionStatus,{events:n});return r=1,t}):e.transaction?(r=1,e.transaction):e.events?Promise.resolve(Promise.all(e.events.map(function(e){try{var n=e.eventIndex,r=e.transactionIndex,o=e.transactionId,i=e.type,u=e.blockTimestamp,c=e.blockHeight,a=e.blockId;return Promise.resolve($e(e.payload,t)).then(function(e){return{blockId:a,blockHeight:c,blockTimestamp:u,type:i,transactionId:o,transactionIndex:r,eventIndex:n,data:e}})}catch(e){return Promise.reject(e)}}))).then(function(e){return r=1,e}):e.account?(r=1,e.account):e.block?(r=1,e.block):e.blockHeader?(r=1,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;"),r=1,e.latestBlock):e.transactionId?(r=1,e.transactionId):e.collection?(r=1,e.collection):void 0;return Promise.resolve(o&&o.then?o.then(function(e){return r?e:null}):r?o:null)}catch(e){return Promise.reject(e)}};function Qe(n){return function(n){try{return X(n)?n.message.refBlock?Promise.resolve(C(n)):Promise.resolve(function(n){try{return Promise.resolve(Ke().get("accessNode.api")).then(function(n){return Promise.resolve(Ke.first(["sdk.transport","sdk.send"])).then(function(r){var t;return e(r,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(he(I(),[ze()])).then(function(e){return t=e,Promise.resolve(r(t,{config:Ke,response:Ue,ix:Ie},{node:n})).then(function(e){return t=e,Promise.resolve(Ze(t)).then(function(e){return(t=e).id})})})})})}catch(e){return Promise.reject(e)}}()).then(function(e){return n.message.refBlock=e,C(n)}):Promise.resolve(C(n))}catch(e){return Promise.reject(e)}}}var Xe=function(n){try{var r=function(){if(X(n)||Q(n)){var r=function(){return e(nn(t),"Cadence needs to be a string at this point."),Promise.resolve(Ke().where(/^0x/).then(function(e){return Object.entries(e).reduce(function(e,n){var r=n[1],t=new RegExp("(\\b"+n[0]+"\\b)","g");return e.replace(t,r)},t)})).then(function(e){n.message.cadence=e})},t=ge(n,"ix.cadence");e(en(t)||nn(t),"Cadence needs to be a function or a string.");var o=function(){if(en(t))return Promise.resolve(t({})).then(function(e){t=e})}();return o&&o.then?o.then(r):r()}}();return Promise.resolve(r&&r.then?r.then(function(){return n}):n)}catch(e){return Promise.reject(e)}},en=function(e){return"function"==typeof e},nn=function(e){return"string"==typeof e};const rn="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function tn(e,n,r){if(!e.s){if(r instanceof on){if(!r.s)return void(r.o=tn.bind(null,e,n));1&n&&(n=r.s),r=r.v}if(r&&r.then)return void r.then(tn.bind(null,e,n),tn.bind(null,e,2));e.s=n,e.v=r;var t=e.o;t&&t(e)}}var on=function(){function e(){}return e.prototype.then=function(n,r){var t=new e,o=this.s;if(o){var i=1&o?n:r;if(i){try{tn(t,1,i(this.v))}catch(e){tn(t,2,e)}return t}return this}return this.o=function(e){try{var o=e.v;1&e.s?tn(t,1,n?n(o):o):r?tn(t,1,r(o)):tn(t,2,o)}catch(e){tn(t,2,e)}},t},e}();function un(e){return e instanceof on&&1&e.s}var cn,an=function(n){try{var r=function(){if(X(n)||Q(n)){var r=function(e,n,r){if("function"==typeof e[rn]){var t,o,i,u=e[rn]();if(function e(r){try{for(;!(t=u.next()).done;)if((r=n(t.value))&&r.then){if(!un(r))return void r.then(e,i||(i=tn.bind(null,o=new on,2)));r=r.v}o?tn(o,1,r):o=r}catch(e){tn(o||(o=new on),2,e)}}(),u.return){var c=function(e){try{t.done||u.return()}catch(e){}return e};if(o&&o.then)return o.then(c,function(e){throw c(e)});c()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var a=[],s=0;s<e.length;s++)a.push(e[s]);return function(e,n,r){var t,o,i=-1;return function r(u){try{for(;++i<e.length;)if((u=n(i))&&u.then){if(!un(u))return void u.then(r,o||(o=tn.bind(null,t=new on,2)));u=u.v}t?tn(t,1,u):t=u}catch(e){tn(t||(t=new on),2,e)}}(),t}(a,function(e){return n(a[e])})}(Object.entries(n.arguments),function(r){var t=r[0];return Promise.resolve(sn(r[1])).then(function(r){n.arguments[t].asArgument=function(n){return e(null!=typeof n.xform,"No type specified for argument: "+n.value),ln(n.xform)?n.xform(n.value):ln(n.xform.asArgument)?n.xform.asArgument(n.value):void e(!1,"Invalid Argument",n)}(r)})});if(r&&r.then)return r.then(function(){})}}();return Promise.resolve(r&&r.then?r.then(function(){return n}):n)}catch(e){return Promise.reject(e)}},sn=function n(r,t){void 0===t&&(t=3);try{return e(t>0,"Argument Resolve Recursion Limit Exceeded for Arg: "+r.tempId),ln(r.resolveArgument)?Promise.resolve(r.resolveArgument()).then(function(e){return n(e,t-1)}):Promise.resolve(r)}catch(e){return Promise.reject(e)}},ln=function(e){return"function"==typeof e},fn=function(e){return hn(In(Pn(e)))},dn=function(e){return hn(In(Tn(e)))},mn=function(e,n){return Buffer.from(e.padStart(2*n,0),"hex")},pn=(cn=Buffer.from("FLOW-V0.0-transaction").toString("hex"),Buffer.from(cn.padEnd(64,0),"hex")).toString("hex"),hn=function(e){return pn+e},vn=function(e){return mn(e,8)},gn=function(e){return mn(e,32)},yn=function(e){return Buffer.from(JSON.stringify(e),"utf8")},kn=function(e){return Buffer.from(e,"utf8")},bn=function(e){return Buffer.from(e,"hex")},In=function(e){return s(e).toString("hex")},Pn=function(e){return An(e),[kn(e.cadence),e.arguments.map(yn),gn(e.refBlock),e.computeLimit,vn(e.proposalKey.address),e.proposalKey.keyId,e.proposalKey.sequenceNum,vn(e.payer),e.authorizers.map(vn)]},Tn=function(e){return wn(e),[Pn(e),En(e)]},En=function(e){var n=Sn(e);return e.payloadSigs.map(function(e){return{signerIndex:n.get(e.address),keyId:e.keyId,sig:e.sig}}).sort(function(e,n){return e.signerIndex>n.signerIndex?1:e.signerIndex<n.signerIndex?-1:e.keyId>n.keyId?1:e.keyId<n.keyId?-1:void 0}).map(function(e){return[e.signerIndex,e.keyId,bn(e.sig)]})},Sn=function(e){var n=new Map,r=0,t=function(e){n.has(e)||(n.set(e,r),r++)};return t(e.proposalKey.address),t(e.payer),e.authorizers.forEach(t),n},An=function(e){Gn.forEach(function(n){return Kn(e,n)}),Bn.forEach(function(n){return Kn(e.proposalKey,n,"proposalKey")})},wn=function(e){jn.forEach(function(n){return Kn(e,n)}),e.payloadSigs.forEach(function(e,n){Ln.forEach(function(r){return Kn(e,r,"payloadSigs",n)})})},Nn=function(e){return"number"==typeof e},On=function(e){return"string"==typeof e},_n=function(e){return null!==e&&"object"==typeof e},Cn=function(e){return _n(e)&&e instanceof Array},Gn=[{name:"cadence",check:On},{name:"arguments",check:Cn},{name:"refBlock",check:On,defaultVal:"0"},{name:"computeLimit",check:Nn},{name:"proposalKey",check:_n},{name:"payer",check:On},{name:"authorizers",check:Cn}],Bn=[{name:"address",check:On},{name:"keyId",check:Nn},{name:"sequenceNum",check:Nn}],jn=[{name:"payloadSigs",check:Cn}],Ln=[{name:"address",check:On},{name:"keyId",check:Nn},{name:"sig",check:On}],xn=[{name:"envelopeSigs",check:Cn}],Rn=[{name:"address",check:On},{name:"keyId",check:Nn},{name:"sig",check:On}],Kn=function(e,n,r,t){var o=n.name,i=n.check,u=n.defaultVal;if(null==e[o]&&null!=u&&(e[o]=u),null==e[o])throw Fn(o,r,t);if(!i(e[o]))throw Un(o,r,t)},Dn=function(e,n,r){return n?null==r?n+"."+e:n+"."+r+"."+e:e},Fn=function(e,n,r){return new Error("Missing field "+Dn(e,n,r))},Un=function(e,n,r){return new Error("Invalid field "+Dn(e,n,r))};function zn(e){var n=new Set(e.authorizations);return n.add(e.proposer),n.delete(e.payer),Array.from(n)}function Hn(e){var n=new Set([e.payer]);return Array.from(n)}var Mn=function(e){return{cadence:e.message.cadence,refBlock:e.message.refBlock||null,computeLimit:e.message.computeLimit,arguments:e.message.arguments.map(function(n){return e.arguments[n].asArgument}),proposalKey:{address:c(e.accounts[e.proposer].addr),keyId:e.accounts[e.proposer].keyId,sequenceNum:e.accounts[e.proposer].sequenceNum},payer:c(e.accounts[e.payer].addr),authorizers:function(){var n=e.authorizations.map(function(n){return c(e.accounts[n].addr)}).reduce(function(e,n){return e.find(function(e){return e===n})?e:[].concat(e,[n])},[]);return n[0]?n:[]}(),payloadSigs:zn(e).map(function(n){return{address:c(e.accounts[n].addr),keyId:e.accounts[n].keyId,sig:e.accounts[n].signature}}),envelopeSigs:Hn(e).map(function(n){return{address:c(e.accounts[n].addr),keyId:e.accounts[n].keyId,sig:e.accounts[n].signature}})}},qn=function(e){return function(e){return n=In(function(e){!function(e){Gn.forEach(function(n){return Kn(e,n)}),Bn.forEach(function(n){return Kn(e.proposalKey,n,"proposalKey")}),jn.forEach(function(n){return Kn(e,n)}),e.payloadSigs.forEach(function(e,n){Ln.forEach(function(r){return Kn(e,r,"payloadSigs",n)})}),xn.forEach(function(n){return Kn(e,n)}),e.envelopeSigs.forEach(function(e,n){Rn.forEach(function(r){return Kn(e,r,"envelopeSigs",n)})})}(e);var n=Sn(e),r=function(e){return e.map(function(e){var r=e.keyId,t=e.sig;return{signerIndex:n.get(e.address),keyId:r,sig:t}}).sort(function(e,n){return e.signerIndex>n.signerIndex?1:e.signerIndex<n.signerIndex?-1:e.keyId>n.keyId?1:e.keyId<n.keyId?-1:void 0}).map(function(e){return[e.signerIndex,e.keyId,bn(e.sig)]})};return[[kn(e.cadence),e.arguments.map(yn),gn(e.refBlock),e.computeLimit,vn(u(e.proposalKey.address)),e.proposalKey.keyId,e.proposalKey.sequenceNum,vn(u(e.payer)),e.authorizers.map(function(e){return vn(u(e))})],r(e.payloadSigs),r(e.envelopeSigs)]}(e)),(r=new a(256)).update(Buffer.from(n,"hex")),r.digest().toString("hex");var n,r}(e)},Yn="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function Wn(e,n,r){if(!e.s){if(r instanceof Jn){if(!r.s)return void(r.o=Wn.bind(null,e,n));1&n&&(n=r.s),r=r.v}if(r&&r.then)return void r.then(Wn.bind(null,e,n),Wn.bind(null,e,2));e.s=n,e.v=r;var t=e.o;t&&t(e)}}var Jn=function(){function e(){}return e.prototype.then=function(n,r){var t=new e,o=this.s;if(o){var i=1&o?n:r;if(i){try{Wn(t,1,i(this.v))}catch(e){Wn(t,2,e)}return t}return this}return this.o=function(e){try{var o=e.v;1&e.s?Wn(t,1,n?n(o):o):r?Wn(t,1,r(o)):Wn(t,2,o)}catch(e){Wn(t,2,e)}},t},e}();function Vn(e){return e instanceof Jn&&1&e.s}var $n=function(e){try{var n=function(){if(X(e))return function(n,r){try{var t=Promise.resolve(Zn(e,Object.values(e.accounts))).then(function(){return Promise.resolve(Zn(e,Object.values(e.accounts))).then(function(){})})}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}(0,function(e){throw console.error("=== SAD PANDA ===\n\n",e,"\n\n=== SAD PANDA ==="),e})}();return Promise.resolve(n&&n.then?n.then(function(n){return e}):e)}catch(e){return Promise.reject(e)}},Zn=function n(r,t,o,i){void 0===i&&(i=3);try{var u=function(){o&&(r.authorizations=r.authorizations.map(function(e){return e===o.tempId?c:e}).reduce(function(e,n){return Array.isArray(n)?[].concat(e,n):[].concat(e,[n])},[]))};e(i,"Account Resolve Recursion Limit Exceeded",{ix:r,accounts:t});var c=[],a=function(e,n,r){if("function"==typeof e[Yn]){var t,o,i,u=e[Yn]();if(function e(r){try{for(;!(t=u.next()).done;)if((r=n(t.value))&&r.then){if(!Vn(r))return void r.then(e,i||(i=Wn.bind(null,o=new Jn,2)));r=r.v}o?Wn(o,1,r):o=r}catch(e){Wn(o||(o=new Jn),2,e)}}(),u.return){var c=function(e){try{t.done||u.return()}catch(e){}return e};if(o&&o.then)return o.then(c,function(e){throw c(e)});c()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var a=[],s=0;s<e.length;s++)a.push(e[s]);return function(e,n,r){var t,o,i=-1;return function r(u){try{for(;++i<e.length;)if((u=n(i))&&u.then){if(!Vn(u))return void u.then(r,o||(o=Wn.bind(null,t=new Jn,2)));u=u.v}t?Wn(t,1,u):t=u}catch(e){Wn(t||(t=new Jn),2,e)}}(),t}(a,function(e){return n(a[e])})}(t,function(e){function t(){function t(){u.tempId!=e.tempId&&delete r.accounts[u.tempId]}var a=function(){if(Array.isArray(e))return Promise.resolve(n(r,e,u,i-1)).then(function(){});null!=e.addr&&null!=e.keyId&&(e.tempId=e.addr+"-"+e.keyId),r.accounts[e.tempId]=r.accounts[e.tempId]||e,r.accounts[e.tempId].role.proposer=r.accounts[e.tempId].role.proposer||e.role.proposer,r.accounts[e.tempId].role.payer=r.accounts[e.tempId].role.payer||e.role.payer,r.accounts[e.tempId].role.authorizer=r.accounts[e.tempId].role.authorizer||e.role.authorizer,r.accounts[e.tempId].role.proposer&&r.proposer===u.tempId&&(r.proposer=e.tempId),r.accounts[e.tempId].role.payer&&r.payer===u.tempId&&(r.payer=e.tempId),r.accounts[e.tempId].role.authorizer&&(o?c=Array.from(new Set([].concat(c,[e.tempId]))):r.authorizations=r.authorizations.map(function(n){return n===u.tempId?e.tempId:n}))}();return a&&a.then?a.then(t):t()}var u=o||e,a=function(){if(Qn(e.resolve))return Promise.resolve(e.resolve(e,function(e,n){try{return{f_type:"PreSignable",f_vsn:"1.0.1",roles:e.role,cadence:n.message.cadence,args:n.message.arguments.map(function(e){return n.arguments[e].asArgument}),data:{},interaction:n,voucher:Mn(n)}}catch(e){throw console.error("buildPreSignable",e),e}}(e,r))).then(function(n){e=n})}();return a&&a.then?a.then(t):t()});return Promise.resolve(a&&a.then?a.then(u):u())}catch(e){return Promise.reject(e)}},Qn=function(e){return"function"==typeof e},Xn=function(e){try{var n=function(){if(X(e))return function(n,r){try{var t=(o=zn(e),i=fn(nr(e)),Promise.resolve(Promise.all(o.map(er(e,i)))).then(function(){var n=Hn(e),r=dn(f({},nr(e),{payloadSigs:o.map(function(n){return{address:e.accounts[n].addr,keyId:e.accounts[n].keyId,sig:e.accounts[n].signature}})}));return Promise.resolve(Promise.all(n.map(er(e,r)))).then(function(){})}))}catch(e){return r(e)}var o,i;return t&&t.then?t.then(void 0,r):t}(0,function(n){throw console.error("Signatures",n,{ix:e}),n})}();return Promise.resolve(n&&n.then?n.then(function(n){return e}):e)}catch(e){return Promise.reject(e)}};function er(e,n){return function(r){try{var t=e.accounts[r];return null!=t.signature?Promise.resolve():Promise.resolve(t.signingFunction(function(e,n,r){try{return{f_type:"Signable",f_vsn:"1.0.1",message:n,addr:u(e.addr),keyId:e.keyId,roles:e.role,cadence:r.message.cadence,args:r.message.arguments.map(function(e){return r.arguments[e].asArgument}),data:{},interaction:r,voucher:Mn(r)}}catch(e){throw console.error("buildSignable",e),e}}(t,n,e))).then(function(n){e.accounts[r].signature=n.signature})}catch(e){return Promise.reject(e)}}}function nr(e){return{cadence:e.message.cadence,refBlock:e.message.refBlock||null,computeLimit:e.message.computeLimit,arguments:e.message.arguments.map(function(n){return e.arguments[n].asArgument}),proposalKey:{address:u(e.accounts[e.proposer].addr),keyId:e.accounts[e.proposer].keyId,sequenceNum:e.accounts[e.proposer].sequenceNum},payer:u(e.accounts[e.payer].addr),authorizers:e.authorizations.map(function(n){return u(e.accounts[n].addr)}).reduce(function(e,n){return e.find(function(e){return e===n})?e:[].concat(e,[n])},[])}}var rr=function(e){try{var n=ge(e,"ix.validators",[]);return Promise.resolve(he(e,n.map(function(e){return function(n){return e(n,{Ok:C,Bad:G})}})))}catch(e){return Promise.reject(e)}},tr=function(e){try{for(var n=0,r=Object.keys(e.accounts);n<r.length;n++){var t=r[n];e.accounts[t].addr=u(e.accounts[t].addr)}return Promise.resolve(e)}catch(e){return Promise.reject(e)}},or=function(e){try{var n=ge(e,"ix.voucher-intercept"),r=function(){if(O(n))return Promise.resolve(n(Mn(e))).then(function(){})}();return Promise.resolve(r&&r.then?r.then(function(){return e}):e)}catch(e){return Promise.reject(e)}},ir=function(e){return e},ur=function(e,n){return void 0===n&&(n=ir),function(r){try{var t=function(e){return["\nAccounts:",{proposer:e.proposer,authorizations:e.authorizations,payer:e.payer},"\n\nDetails:",e.accounts].filter(Boolean)},o=function(){var n;(n=console).log.apply(n,["debug["+e+"] ---\n"].concat([].slice.call(arguments),["\n\n\n---"]))};return Promise.resolve(Ke.get("debug."+e)).then(function(e){var i=function(){if(e)return Promise.resolve(n(r,o,t)).then(function(){})}();return i&&i.then?i.then(function(){return r}):r})}catch(e){return Promise.reject(e)}}},cr=he([Xe,ur("cadence",function(e,n){return n(e.message.cadence)}),an,ur("arguments",function(e,n){return n(e.message.arguments,e.message)}),$n,ur("accounts",function(e,n,r){return n.apply(void 0,r(e))}),function(n){try{var r=function(){if(X(n)&&null==n.message.refBlock)return Promise.resolve(Ke().get("accessNode.api")).then(function(r){return Promise.resolve(Ke.first(["sdk.transport","sdk.send"])).then(function(t){return e(t,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(t(Pe([ze()]),{config:Ke,response:Ue,ix:Ie},{node:r}).then(Ze)).then(function(e){n.message.refBlock=e.id})})})}();return Promise.resolve(r&&r.then?r.then(function(){return n}):n)}catch(e){return Promise.reject(e)}},function(n){try{var r=function(){if(X(n)){var r=Object.values(n.accounts).find(function(e){return e.role.proposer});e(r,"Transactions require a proposer");var t=function(){if(null==r.sequenceNum)return Promise.resolve(Ke().get("accessNode.api")).then(function(t){return Promise.resolve(Ke.first(["sdk.transport","sdk.send"])).then(function(o){return e(o,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(Pe([He(r.addr)])).then(function(e){return Promise.resolve(o(e,{config:Ke,response:Ue,ix:Ie},{node:t}).then(Ze).then(function(e){return e.keys}).then(function(e){return e.find(function(e){return e.index===r.keyId})}).then(function(e){return e.sequenceNumber})).then(function(e){n.accounts[r.tempId].sequenceNum=e})})})})}();if(t&&t.then)return t.then(function(){})}}();return Promise.resolve(r&&r.then?r.then(function(){return n}):n)}catch(e){return Promise.reject(e)}},Xn,ur("signatures",function(e,n,r){return n.apply(void 0,r(e))}),tr,rr,or,ur("resolved",function(e,n){return n(e)})]);function ar(){var e=[].slice.call(arguments);if(e.length>1){var n=e,r=n[0],t=n[1];return ar(function(e,n){var o=n.Bad;return r?(0,n.Ok)(e):o(e,t)})}var o=e[0];return function(e){return o(e,{Ok:C,Bad:G})}}var sr=function(e,n){void 0===e&&(e=[]),void 0===n&&(n={});try{return Promise.resolve(Ke.first(["sdk.transport","sdk.send"],n.send)).then(function(r){return ar(r,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(Ke.first(["sdk.resolve"],n.resolve||cr)).then(function(t){function o(o){return n.node=o,Array.isArray(e)&&(e=he(I(),e)),Promise.resolve(t(e)).then(function(e){return r(e,{config:Ke,response:Ue,ix:Ie},n)})}var i=n.node;return i?o(i):Promise.resolve(Ke().get("accessNode.api")).then(o)})})}catch(e){return Promise.reject(e)}},lr=function(e){try{return Promise.resolve(Ke().where(/^decoder\./)).then(function(n){var r=Object.entries(n).map(function(e){var n=e[0],r=e[1];return[n="/"+n.replace(/^decoder\./,"")+"$/",r]});return Ze(e,Object.fromEntries(r))})}catch(e){return Promise.reject(e)}},fr=function(e){var n,r;function t(n){var r,t=("\n Encode Message From Signable Error: Unable to determine message encoding for signer addresss: "+n+". \n Please ensure the address: "+n+" is intended to sign the given transaction as specified by the transaction signable.\n ").trim();return(r=e.call(this,t)||this).name="Unable To Determine Message Encoding For Signer Addresss",r}return r=e,(n=t).prototype=Object.create(r.prototype),n.prototype.constructor=n,m(n,r),t}(v(Error)),dr=function(e,n){var r,t,o=(r=e.voucher,(t=new Set(r.authorizers)).add(r.proposalKey.address),t.delete(r.payer),Array.from(t).map(c)),i=function(e){var n=new Set([e.payer]);return Array.from(n).map(c)}(e.voucher),a=o.includes(c(n)),s=i.includes(c(n));if(!a&&!s)throw new fr(n);var l={cadence:e.voucher.cadence,refBlock:e.voucher.refBlock,computeLimit:e.voucher.computeLimit,arguments:e.voucher.arguments,proposalKey:f({},e.voucher.proposalKey,{address:u(e.voucher.proposalKey.address)}),payer:u(e.voucher.payer),authorizers:e.voucher.authorizers.map(u),payloadSigs:e.voucher.payloadSigs.map(function(e){return f({},e,{address:u(e.address)})})};return a?fn(l):dn(l)};function mr(e,n){return console.warn('\n %cFCL/SDK Deprecation Notice\n ============================\n \n "latestBlock()" is deprecated, please use "block()" for this and future versions of FCL\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0008-deprecate-latest-block-method\n \n ============================\n ',"font-weight:bold;font-family:monospace;"),sr([ze(e)],n).then(Ze)}function pr(e,n){return sr([He(e)],n).then(Ze)}function hr(e){return ke("ix.validators",function(n){return Array.isArray(n)?n.push(e):[e]})}function vr(e){return he([function(n){return n.block.height=e,n},hr(function(e){if("boolean"==typeof e.block.isSealed)throw new Error("Unable to specify both block height and isSealed.");if(e.block.id)throw new Error("Unable to specify both block height and block id.");return e})])}function gr(e){return he([function(n){return n.block.id=e,C(n)},hr(function(e,n){var r=n.Ok,t=n.Bad;return re(e)?t(e,"Unable to specify a block id with a Get Account interaction."):"boolean"==typeof e.block.isSealed?t(e,"Unable to specify both block id and isSealed."):e.block.height?t(e,"Unable to specify both block id and block height."):r(e)})])}function yr(n,r){var t=void 0===n?{}:n,o=t.sealed,i=void 0!==o&&o,u=t.id,c=t.height;return void 0===r&&(r={}),e(!(i&&u||i&&c),'Method: block -- Cannot pass "sealed" with "id" or "height"'),e(!(u&&c),'Method: block -- Cannot pass "id" and "height" simultaneously'),u?sr([ze(),gr(u)],r).then(Ze):c?sr([ze(),vr(c)],r).then(Ze):sr([ze(i)],r).then(Ze)}function kr(e){return void 0===e&&(e=[]),he(e.map(function(e){return j(e,{role:"authorizer"})}))}function br(e,n,r,t){return{addr:e,signingFunction:n,keyId:r,sequenceNum:t}}function Ir(e,n,r){return void 0===n&&void 0===r||console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n \n Passing a start and end into getEnvents has been deprecated and will not be supported in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0005-deprecate-start-end-get-events-builder\n \n ============================\n ","font-weight:bold;font-family:monospace;"),he([z,function(t){return t.events.eventType=e,t.events.start=n,t.events.end=r,C(t)}])}function Pr(e,n,r){return he([z,function(t){return t.events.eventType=e,t.events.start=n,t.events.end=r,C(t)}])}function Tr(e,n){return void 0===n&&(n=[]),he([z,function(r){return r.events.eventType=e,r.events.blockIds=n,C(r)}])}function Er(e){return void 0===e&&(e=null),he([J,function(n){return n.block.isSealed=e,C(n)}])}function Sr(e){return void 0===e&&(e=!1),console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getLatestBlock builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0006-deprecate-get-latest-block-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),he([H,function(n){return n.block.isSealed=e,C(n)}])}function Ar(e){return console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getBlockById builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0004-deprecate-get-block-by-id-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),he([M,function(n){return n.block.ids=[e],C(n)}])}function wr(e){return console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getBlockByHeight builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0003-deprecate-get-block-by-height-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),he([q,function(n){return n.block.height=e,C(n)}])}function Nr(e){return void 0===e&&(e=null),he([V,function(n){return n.collection.id=e,n}])}function Or(e){return he([D,function(n){return n.transaction.id=e,C(n)}])}function _r(e){return he([F,function(n){return n.transaction.id=e,C(n)}])}function Cr(e){return function(n){return n.message.computeLimit=e,n}}function Gr(e){return void 0===e&&(e=[]),he(e.map(L))}function Br(e,n){return{value:e,xform:n}}var jr=function(e){try{return Promise.resolve(j(e,{role:"proposer"}))}catch(e){return Promise.reject(e)}},Lr=function(e){try{return Promise.resolve(j(e,{role:"payer"}))}catch(e){return Promise.reject(e)}};function xr(){return Y}function Rr(e){return he([function(n){return n.message.refBlock=e,C(n)}])}function Kr(){return he([R,ye("ix.cadence",l.apply(void 0,[].slice.call(arguments)))])}var Dr=[];function Fr(){return he([K,ye("ix.cadence",l.apply(void 0,[].slice.call(arguments))),function(e){return e.message.computeLimit=e.message.computeLimit||10,e.message.refBlock=e.message.refBlock||null,e.authorizations=e.authorizations||Dr,C(e)}])}function Ur(e){return ye("ix.voucher-intercept",e)}var zr=function(n){var r=n.node;return function(n){try{return X(n)?n.accounts[n.proposer].sequenceNum?Promise.resolve(C(n)):Promise.resolve(Ke.first(["sdk.transport","sdk.send"])).then(function(t){return e(t,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(Pe([He(n.accounts[n.proposer].addr)])).then(function(e){return Promise.resolve(t(e,{config:Ke,response:Ue,ix:Ie},{node:r})).then(function(e){return Promise.resolve(Ze(e)).then(function(e){return n.accounts[n.proposer].sequenceNum=e.keys[n.accounts[n.proposer].keyId].sequenceNumber,C(n)})})})}):Promise.resolve(C(n))}catch(e){return Promise.reject(e)}}},Hr=function(e){return e},Mr=["tempId"];function qr(e){return["SIGNATURE",e.addr,e.keyId].join(".")}function Yr(e){return void 0===e&&(e={}),function(n){var r=f({},n,e,{signingFunction:e.signingFunction||n.signingFunction||function(e){return{addr:r.addr,keyId:r.keyId,signature:qr(r)}}});return r}}var Wr={proposer:!1,authorizer:!1,payer:!1},Jr={__proto__:null,mockSend:function(n){return void 0===n&&(n=Hr),function(r){return Promise.resolve(r).then(function(t){switch(r=t,!0){case re(r):return function(n,r){return void 0===r&&(r=5),e(n.account,"mockAccountResponse(ix) -- ix.account is missing",n),e(n.account.addr,"mockAccountResponse(ix) -- ix.account.addr is missing",n),{account:{addr:n.account.addr,keys:Array.from({length:r},function(e,n){return{index:n,sequenceNumber:42}})}}}(r);case ae(r):return{tag:"GET_BLOCK",block:{id:"32"}};default:return n(r)}})}},authzFn:Yr,authzResolve:function(e){return void 0===e&&(e={}),function(n){return f({},n,{tempId:e.tempId||"WITH_RESOLVE",resolve:Yr(function(e,n){if(null==e)return{};var r,t,o={},i=Object.keys(e);for(t=0;t<i.length;t++)n.indexOf(r=i[t])>=0||(o[r]=e[r]);return o}(e,Mr))})}},authzResolveMany:function(e){return void 0===e&&(e={}),function(n){return f({},n,{tempId:e.tempId||"AUTHZ_RESOLVE_MANY",resolve:function(){return[e.proposer&&Yr(e.proposer)({role:f({},Wr,{proposer:!0})})].concat(e.authorizations.map(Yr).map(function(e){return e({role:f({},Wr,{authorizer:!0})})}),[e.payer&&Yr(e.payer)({role:f({},Wr,{payer:!0})})]).filter(Boolean)}})}},sig:qr,idof:function(e){return e.addr+"-"+e.keyId},run:function(e){return void 0===e&&(e=[]),Pe([Rr("123")].concat(e)).then(cr)}},Vr="0.0.57-alpha.4",$r=function(e){return n={name:"params",transitionsPath:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params"},void console.error("\n %cFCL/SDK Deprecation Notice\n ============================\n The "+n.name+" builder has been removed from the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: "+n.transitionsPath+"\n ============================\n ","font-weight:bold;font-family:monospace;");var n},Zr=function(e){return n={name:"param",transitionsPath:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params"},void console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n The "+n.name+" builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: "+n.transitionsPath+"\n ============================\n ","font-weight:bold;font-family:monospace;");var n};export{Jr as TestUtils,Vr as VERSION,pr as account,Br as arg,Gr as args,vr as atBlockHeight,gr as atBlockId,br as authorization,kr as authorizations,yr as block,Pe as build,Ke as config,Mn as createSignableVoucher,lr as decode,be as destroy,dr as encodeMessageFromSignable,ge as get,He as getAccount,ze as getBlock,wr as getBlockByHeight,Ar as getBlockById,Er as getBlockHeader,Nr as getCollection,Ir as getEvents,Pr as getEventsAtBlockHeightRange,Tr as getEventsAtBlockIds,Sr as getLatestBlock,_r as getTransaction,Or as getTransactionStatus,I as interaction,ar as invariant,de as isBad,re as isGetAccount,ae as isGetBlock,ue as isGetBlockByHeight,ie as isGetBlockById,se as isGetBlockHeader,le as isGetCollection,te as isGetEvents,oe as isGetLatestBlock,ne as isGetTransaction,ee as isGetTransactionStatus,fe as isOk,ce as isPing,Q as isScript,X as isTransaction,Z as isUnknown,mr as latestBlock,Cr as limit,Zr as param,$r as params,Lr as payer,xr as ping,he as pipe,jr as proposer,ye as put,Rr as ref,cr as resolve,$n as resolveAccounts,an as resolveArguments,Xe as resolveCadence,tr as resolveFinalNormalization,zr as resolveProposerSequenceNumber,Qe as resolveRefBlockId,Xn as resolveSignatures,rr as resolveValidators,or as resolveVoucherIntercept,Kr as script,sr as send,Fr as transaction,ke as update,hr as validator,Ur as voucherIntercept,qn as voucherToTxId,me as why};
import{SUBSCRIBE as e,UNSUBSCRIBE as n,spawn as r,send as t,subscriber as o}from"@onflow/util-actor";import{invariant as i}from"@onflow/util-invariant";import{Buffer as u,encode as c}from"@onflow/rlp";import{sansPrefix as a,withPrefix as s}from"@onflow/util-address";import{SHA3 as l}from"sha3";import{template as f}from"@onflow/util-template";export{template as cadence,template as cdc}from"@onflow/util-template";function d(){return d=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},d.apply(this,arguments)}function m(e){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},m(e)}function p(e,n){return p=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},p(e,n)}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function v(e,n,r){return v=h()?Reflect.construct:function(e,n,r){var t=[null];t.push.apply(t,n);var o=new(Function.bind.apply(e,t));return r&&p(o,r.prototype),o},v.apply(null,arguments)}function y(e){var n="function"==typeof Map?new Map:void 0;return y=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,r)}function r(){return v(e,arguments,m(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),p(r,e)},y(e)}function g(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=new Array(n);r<n;r++)t[r]=e[r];return t}function k(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,n){if(e){if("string"==typeof e)return g(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?g(e,n):void 0}}(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var b,I=function e(n,r){void 0===n&&(n=[]);try{if(!n.length)return Promise.resolve(r);var t=n[0],o=n.slice(1);return Promise.resolve(O(t)).then(function(n){return null==n?e(o,r):n})}catch(e){return Promise.reject(e)}},P="config",A="PUT_CONFIG",T="GET_CONFIG",S="CONFIG/UPDATED",E=function(e){return e},w=((b={})[A]=function(e,n,r){var t=r.key,o=r.value;if(null==t)throw new Error("Missing 'key' for config/put.");e.put(t,o),e.broadcast(S,d({},e.all()))},b[T]=function(e,n,r){var t=r.key,o=r.fallback;if(null==t)throw new Error("Missing 'key' for config/get");n.reply(e.get(t,o))},b.GET_ALL_CONFIG=function(e,n){n.reply(d({},e.all()))},b.UPDATE_CONFIG=function(e,n,r){var t=r.key,o=r.fn;if(null==t)throw new Error("Missing 'key' for config/update");e.update(t,o||E),e.broadcast(S,d({},e.all()))},b.DELETE_CONFIG=function(e,n,r){var t=r.key;if(null==t)throw new Error("Missing 'key' for config/delete");e.delete(t),e.broadcast(S,d({},e.all()))},b.CLEAR_CONFIG=function(e,n){for(var r=0,t=Object.keys(e.all());r<t.length;r++)e.delete(t[r]);e.broadcast(S,d({},e.all()))},b.WHERE_CONFIG=function(e,n,r){var t=r.pattern;if(null==t)throw new Error("Missing 'pattern' for config/where");n.reply(e.where(t))},b[e]=function(e,n){e.subscribe(n.from),e.send(n.from,S,d({},e.all()))},b[n]=function(e,n){e.unsubscribe(n.from)},b);function N(e,n){return t(P,A,{key:e,value:n}),x()}function O(e,n){return t(P,T,{key:e,fallback:n},{expectReply:!0,timeout:10})}function C(){return t(P,"GET_ALL_CONFIG",null,{expectReply:!0,timeout:10})}function _(e,n){return void 0===n&&(n=E),t(P,"UPDATE_CONFIG",{key:e,fn:n}),x()}function G(e){return t(P,"DELETE_CONFIG",{key:e}),x()}function B(e){return t(P,"WHERE_CONFIG",{pattern:e},{expectReply:!0,timeout:10})}function j(e){return o(P,function(){return r(w,P)},e)}function L(){return t(P,"CLEAR_CONFIG")}function x(e){return null!=e&&"object"==typeof e&&Object.keys(e).map(function(n){return N(n,e[n])}),{put:N,get:O,all:C,first:I,update:_,delete:G,where:B,subscribe:j,overload:K}}r(w,P),x.put=N,x.get=O,x.all=C,x.first=I,x.update=_,x.delete=G,x.where=B,x.subscribe=j,x.overload=K;var R=function(e){return e};function K(e,n){return void 0===e&&(e={}),void 0===n&&(n=R),new Promise(function(r,t){try{return Promise.resolve(C()).then(function(o){var i=function(t,i){try{var u=function(){x(e);var t=n;return Promise.resolve(C()).then(function(e){return Promise.resolve(t(e)).then(function(e){return Promise.resolve(L()).then(function(){return Promise.resolve(x(o)).then(function(){r(e)})})})})}()}catch(e){return i(e)}return u&&u.then?u.then(void 0,i):u}(0,function(e){return Promise.resolve(L()).then(function(){return Promise.resolve(x(o)).then(function(){t(e)})})});if(i&&i.then)return i.then(function(){})})}catch(e){return Promise.reject(e)}})}var D=function(e,n){for(var r,t=k(e.entries());!(r=t()).done;){var o=r.value;if(o[1]===n)return o[0]}},F=function(e,n){return new Proxy(e,{get:function(e,r){if(D(n,r)){var t=D(n,r);return Reflect.get(e,t)}return n.has(r)&&function(e,n,r){try{Promise.resolve(x.get("logger.level",0)).then(function(e){var r;if(!(e<2)){var t,o=["\n %c"+(t={title:"FCL/SDK Deprecation Notice",message:n}).title+"\n ============================\n "+t.message+"\n ============================\n ","font-weight:bold;font-family:monospace;"];(r=console).warn.apply(r,o)}})}catch(e){return Promise.reject(e)}}(0,'"'+r+'" will be deprecated in a future version.\n Please use "'+n.get(r)+'" instead.'),Reflect.get(e,r)}})},U='{\n "tag":"UNKNOWN",\n "assigns":{},\n "status":"OK",\n "reason":null,\n "accounts":{},\n "params":{},\n "arguments":{},\n "message": {\n "cadence":null,\n "refBlock":null,\n "computeLimit":null,\n "proposer":null,\n "payer":null,\n "authorizations":[],\n "params":[],\n "arguments":[]\n },\n "proposer":null,\n "authorizations":[],\n "payer":[],\n "events": {\n "eventType":null,\n "start":null,\n "end":null,\n "blockIds":[]\n },\n "transaction": {\n "id":null\n },\n "block": {\n "id":null,\n "height":null,\n "isSealed":null\n },\n "account": {\n "addr":null\n },\n "collection": {\n "id":null\n }\n}',z=new Set(Object.keys(JSON.parse(U))),H=new Map([["addr","address"],["sequenceNum","seqNum"],["keyId","keyIndex"]]),M=function(){var e=JSON.parse(U);return d({},e,{account:F(e.account,H)})},q="abcdefghijklmnopqrstuvwxyz0123456789".split(""),Y=function(){return q[~~(Math.random()*q.length)]},W=function(){return Array.from({length:10},Y).join("")},J=function(e){return"number"==typeof e},V=function(e){return Array.isArray(e)},$=function(e){return null!==e&&"object"==typeof e},Z=function(e){return null==e},Q=function(e){return"function"==typeof e},X=function(e){if(!$(e)||Z(e)||J(e))return!1;for(var n,r=k(z);!(n=r()).done;)if(!e.hasOwnProperty(n.value))return!1;return!0},ee=function(e){return e.status="OK",e},ne=function(e,n){return e.status="BAD",e.reason=n,e},re=function(e){return function(n){return n.tag=e,ee(n)}},te=function(e,n){return void 0===n&&(n={}),function(r){var t;i("function"==typeof e||"object"==typeof e,"prepAccount must be passed an authorization function or an account object"),i(null!=n.role,"Account must have a role");var o=F(JSON.parse('{\n "kind":"ACCOUNT",\n "tempId":null,\n "addr":null,\n "keyId":null,\n "sequenceNum":null,\n "signature":null,\n "signingFunction":null,\n "resolve":null,\n "role": {\n "proposer":false,\n "authorizer":false,\n "payer":false,\n "param":false\n }\n}'),H),u=n.role,c=W();return e.authorization&&Q(e.authorization)&&(e={resolve:e.authorization}),!e.authorization&&Q(e)&&(e={resolve:e}),r.accounts[c]=d({},o,{tempId:c},e,{role:d({},o.role,"object"==typeof e.role?e.role:{},(t={},t[u]=!0,t))}),"authorizer"===u?r.authorizations.push(c):"payer"===u?r.payer.push(c):r[u]=c,r}},oe=function(e){return function(n){var r=W();return n.message.arguments.push(r),n.arguments[r]=JSON.parse('{\n "kind":"ARGUMENT",\n "tempId":null,\n "value":null,\n "asArgument":null,\n "xform":null,\n "resolve": null,\n "resolveArgument": null\n}'),n.arguments[r].tempId=r,n.arguments[r].value=e.value,n.arguments[r].asArgument=e.asArgument,n.arguments[r].xform=e.xform,n.arguments[r].resolve=e.resolve,n.arguments[r].resolveArgument=Q(e.resolveArgument)?e.resolveArgument.bind(e):e.resolveArgument,ee(n)}},ie=re("UNKNOWN"),ue=re("SCRIPT"),ce=re("TRANSACTION"),ae=re("GET_TRANSACTION_STATUS"),se=re("GET_TRANSACTION"),le=re("GET_ACCOUNT"),fe=re("GET_EVENTS"),de=re("GET_LATEST_BLOCK"),me=re("GET_BLOCK_BY_ID"),pe=re("GET_BLOCK_BY_HEIGHT"),he=re("PING"),ve=re("GET_BLOCK"),ye=re("GET_BLOCK_HEADER"),ge=re("GET_COLLECTION"),ke=function(e){return function(n){return n.tag===e}},be=ke("UNKNOWN"),Ie=ke("SCRIPT"),Pe=ke("TRANSACTION"),Ae=ke("GET_TRANSACTION_STATUS"),Te=ke("GET_TRANSACTION"),Se=ke("GET_ACCOUNT"),Ee=ke("GET_EVENTS"),we=ke("GET_LATEST_BLOCK"),Ne=ke("GET_BLOCK_BY_ID"),Oe=ke("GET_BLOCK_BY_HEIGHT"),Ce=ke("PING"),_e=ke("GET_BLOCK"),Ge=ke("GET_BLOCK_HEADER"),Be=ke("GET_COLLECTION"),je=function(e){return"OK"===e.status},Le=function(e){return"BAD"===e.status},xe=function(e){return e.reason},Re=function e(n,r){void 0===r&&(r=[]);try{return Promise.resolve(function(t,o){try{var i=Promise.resolve(n).then(function(t){if(n=function(e){for(var n=0,r=Object.keys(e);n<r.length;n++){var t=r[n];if(!z.has(t))throw new Error('"'+t+'" is an invalid root level Interaction property.')}return e}(t),Le(n))throw new Error("Interaction Error: "+n.reason);if(!r.length)return n;var o=r[0],i=r.slice(1);return Promise.resolve(o).then(function(r){if(Q(r))return e(r(n),i);if(Z(r)||!r)return e(n,i);if(X(r))return e(r,i);throw new Error("Invalid Interaction Composition")})})}catch(e){return o(e)}return i&&i.then?i.then(void 0,o):i}(0,function(e){throw e}))}catch(e){return Promise.reject(e)}},Ke=function e(){var n=[].slice.call(arguments),r=n[0],t=n[1];return V(r)&&null==t?function(n){return e(n,r)}:Re(r,t)},De=function(e){return e},Fe=function(e,n,r){return null==e.assigns[n]?r:e.assigns[n]},Ue=function(e,n){return function(r){return r.assigns[e]=n,ee(r)}},ze=function(e,n){return void 0===n&&(n=De),function(r){return r.assigns[e]=n(r.assigns[e],r),ee(r)}},He=function(e){return function(n){return delete n.assigns[e],ee(n)}},Me={__proto__:null,UNKNOWN:"UNKNOWN",SCRIPT:"SCRIPT",TRANSACTION:"TRANSACTION",GET_TRANSACTION_STATUS:"GET_TRANSACTION_STATUS",GET_ACCOUNT:"GET_ACCOUNT",GET_EVENTS:"GET_EVENTS",GET_LATEST_BLOCK:"GET_LATEST_BLOCK",PING:"PING",GET_TRANSACTION:"GET_TRANSACTION",GET_BLOCK_BY_ID:"GET_BLOCK_BY_ID",GET_BLOCK_BY_HEIGHT:"GET_BLOCK_BY_HEIGHT",GET_BLOCK:"GET_BLOCK",GET_BLOCK_HEADER:"GET_BLOCK_HEADER",GET_COLLECTION:"GET_COLLECTION",BAD:"BAD",OK:"OK",ACCOUNT:"ACCOUNT",PARAM:"PARAM",ARGUMENT:"ARGUMENT",AUTHORIZER:"authorizer",PAYER:"payer",PROPOSER:"proposer",interaction:M,uuid:W,isNumber:J,isArray:V,isObj:$,isNull:Z,isFn:Q,isInteraction:X,Ok:ee,Bad:ne,prepAccount:te,makeArgument:oe,makeUnknown:ie,makeScript:ue,makeTransaction:ce,makeGetTransactionStatus:ae,makeGetTransaction:se,makeGetAccount:le,makeGetEvents:fe,makeGetLatestBlock:de,makeGetBlockById:me,makeGetBlockByHeight:pe,makePing:he,makeGetBlock:ve,makeGetBlockHeader:ye,makeGetCollection:ge,isUnknown:be,isScript:Ie,isTransaction:Pe,isGetTransactionStatus:Ae,isGetTransaction:Te,isGetAccount:Se,isGetEvents:Ee,isGetLatestBlock:we,isGetBlockById:Ne,isGetBlockByHeight:Oe,isPing:Ce,isGetBlock:_e,isGetBlockHeader:Ge,isGetCollection:Be,isOk:je,isBad:Le,why:xe,isAccount:function(e){return"ACCOUNT"===e.kind},isParam:function(e){return"PARAM"===e.kind},isArgument:function(e){return"ARGUMENT"===e.kind},pipe:Ke,get:Fe,put:Ue,update:ze,destroy:He};function qe(e){return void 0===e&&(e=[]),Ke(M(),e)}var Ye=function(){return JSON.parse('{\n "tag":null,\n "transaction":null,\n "transactionStatus":null,\n "transactionId":null,\n "encodedData":null,\n "events":null,\n "account":null,\n "block":null,\n "blockHeader":null,\n "latestBlock":null,\n "collection":null\n}')};function We(e){return void 0===e&&(e=null),Ke([ve,function(n){return n.block.isSealed=e,ee(n)}])}function Je(e){return Ke([le,function(n){return n.account.addr=a(e),ee(n)}])}var Ve=function(e,n,r){try{try{return Promise.resolve(Number(e))}catch(e){throw new Error("Decode Number Error : "+r.join("."))}}catch(e){return Promise.reject(e)}},$e=function(e){return Promise.resolve(e)},Ze=function(e,n,r){try{return Promise.resolve(e.fields.reduce(function(e,t){return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(en(t.value,n,[].concat(r,[t.name]))).then(function(n){return e[t.name]=n,e})})},Promise.resolve({}))).then(function(r){var t=e.id&&Xe(n,e.id);return t?Promise.resolve(t(r)):r})}catch(e){return Promise.reject(e)}},Qe={UInt:Ve,Int:Ve,UInt8:Ve,Int8:Ve,UInt16:Ve,Int16:Ve,UInt32:Ve,Int32:Ve,UInt64:Ve,Int64:Ve,UInt128:Ve,Int128:Ve,UInt256:Ve,Int256:Ve,Word8:Ve,Word16:Ve,Word32:Ve,Word64:Ve,UFix64:$e,Fix64:$e,String:$e,Character:$e,Bool:$e,Address:$e,Void:function(){return Promise.resolve(null)},Optional:function(e,n,r){return Promise.resolve(e?en(e,n,r):null)},Reference:function(e){try{return Promise.resolve({address:e.address,type:e.type})}catch(e){return Promise.reject(e)}},Array:function(e,n,r){try{return Promise.resolve(Promise.all(e.map(function(e){return new Promise(function(t){try{return Promise.resolve(en(e,n,[].concat(r,[e.type]))).then(t)}catch(e){return Promise.reject(e)}})})))}catch(e){return Promise.reject(e)}},Dictionary:function(e,n,r){try{return Promise.resolve(e.reduce(function(e,t){return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(en(t.key,n,[].concat(r,[t.key]))).then(function(o){return Promise.resolve(en(t.value,n,[].concat(r,[t.key]))).then(function(n){return e[o]=n,e})})})},Promise.resolve({})))}catch(e){return Promise.reject(e)}},Event:Ze,Resource:Ze,Struct:Ze,Enum:Ze,Type:function(e){try{return Promise.resolve(e.staticType)}catch(e){return Promise.reject(e)}},Path:function(e){try{return Promise.resolve({domain:e.domain,identifier:e.identifier})}catch(e){return Promise.reject(e)}},Capability:function(e){try{return Promise.resolve({path:e.path,address:e.address,borrowType:e.borrowType})}catch(e){return Promise.reject(e)}}},Xe=function(e,n){var r=Object.keys(e).find(function(e){return/^\/.*\/$/.test(e)?new RegExp(e.substring(1,e.length-1)).test(n):e===n});return n&&r&&e[r]},en=function(e,n,r){try{var t=Xe(n,e.type);if(!t)throw new Error("Undefined Decoder Error: "+e.type+"@"+r.join("."));return Promise.resolve(t(e.value,n,r))}catch(e){return Promise.reject(e)}},nn=function(e,n,r){void 0===n&&(n={}),void 0===r&&(r=[]);var t=d({},Qe,n);return Promise.resolve(en(e,t,r))},rn=function(e,n){void 0===n&&(n={});try{var r,t=d({},Qe,n),o=e.encodedData?Promise.resolve(nn(e.encodedData,t)).then(function(e){return r=1,e}):e.transactionStatus?Promise.resolve(Promise.all(e.transactionStatus.events.map(function(e){try{var n=e.eventIndex,r=e.transactionIndex,o=e.transactionId,i=e.type;return Promise.resolve(nn(e.payload,t)).then(function(e){return{type:i,transactionId:o,transactionIndex:r,eventIndex:n,data:e}})}catch(e){return Promise.reject(e)}}))).then(function(n){var t=d({},e.transactionStatus,{events:n});return r=1,t}):e.transaction?(r=1,e.transaction):e.events?Promise.resolve(Promise.all(e.events.map(function(e){try{var n=e.eventIndex,r=e.transactionIndex,o=e.transactionId,i=e.type,u=e.blockTimestamp,c=e.blockHeight,a=e.blockId;return Promise.resolve(nn(e.payload,t)).then(function(e){return{blockId:a,blockHeight:c,blockTimestamp:u,type:i,transactionId:o,transactionIndex:r,eventIndex:n,data:e}})}catch(e){return Promise.reject(e)}}))).then(function(e){return r=1,e}):e.account?(r=1,e.account):e.block?(r=1,e.block):e.blockHeader?(r=1,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;"),r=1,e.latestBlock):e.transactionId?(r=1,e.transactionId):e.collection?(r=1,e.collection):void 0;return Promise.resolve(o&&o.then?o.then(function(e){return r?e:null}):r?o:null)}catch(e){return Promise.reject(e)}};function tn(e){return function(e){try{return Pe(e)?e.message.refBlock?Promise.resolve(ee(e)):Promise.resolve(function(e){try{return Promise.resolve(x().get("accessNode.api")).then(function(e){return Promise.resolve(x.first(["sdk.transport","sdk.send"])).then(function(n){var r;return i(n,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(Ke(M(),[We()])).then(function(t){return r=t,Promise.resolve(n(r,{config:x,response:Ye,Buffer:u,ix:Me},{node:e})).then(function(e){return r=e,Promise.resolve(rn(r)).then(function(e){return(r=e).id})})})})})}catch(e){return Promise.reject(e)}}()).then(function(n){return e.message.refBlock=n,ee(e)}):Promise.resolve(ee(e))}catch(e){return Promise.reject(e)}}}var on=function(e){try{var n=function(){if(Pe(e)||Ie(e)){var n=function(){return i(cn(r),"Cadence needs to be a string at this point."),Promise.resolve(x().where(/^0x/).then(function(e){return Object.entries(e).reduce(function(e,n){var r=n[1],t=new RegExp("(\\b"+n[0]+"\\b)","g");return e.replace(t,r)},r)})).then(function(n){e.message.cadence=n})},r=Fe(e,"ix.cadence");i(un(r)||cn(r),"Cadence needs to be a function or a string.");var t=function(){if(un(r))return Promise.resolve(r({})).then(function(e){r=e})}();return t&&t.then?t.then(n):n()}}();return Promise.resolve(n&&n.then?n.then(function(){return e}):e)}catch(e){return Promise.reject(e)}},un=function(e){return"function"==typeof e},cn=function(e){return"string"==typeof e};const an="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function sn(e,n,r){if(!e.s){if(r instanceof ln){if(!r.s)return void(r.o=sn.bind(null,e,n));1&n&&(n=r.s),r=r.v}if(r&&r.then)return void r.then(sn.bind(null,e,n),sn.bind(null,e,2));e.s=n,e.v=r;var t=e.o;t&&t(e)}}var ln=function(){function e(){}return e.prototype.then=function(n,r){var t=new e,o=this.s;if(o){var i=1&o?n:r;if(i){try{sn(t,1,i(this.v))}catch(e){sn(t,2,e)}return t}return this}return this.o=function(e){try{var o=e.v;1&e.s?sn(t,1,n?n(o):o):r?sn(t,1,r(o)):sn(t,2,o)}catch(e){sn(t,2,e)}},t},e}();function fn(e){return e instanceof ln&&1&e.s}var dn,mn=function(e){try{var n=function(){if(Pe(e)||Ie(e)){var n=function(e,n,r){if("function"==typeof e[an]){var t,o,i,u=e[an]();if(function e(r){try{for(;!(t=u.next()).done;)if((r=n(t.value))&&r.then){if(!fn(r))return void r.then(e,i||(i=sn.bind(null,o=new ln,2)));r=r.v}o?sn(o,1,r):o=r}catch(e){sn(o||(o=new ln),2,e)}}(),u.return){var c=function(e){try{t.done||u.return()}catch(e){}return e};if(o&&o.then)return o.then(c,function(e){throw c(e)});c()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var a=[],s=0;s<e.length;s++)a.push(e[s]);return function(e,n,r){var t,o,i=-1;return function r(u){try{for(;++i<e.length;)if((u=n(i))&&u.then){if(!fn(u))return void u.then(r,o||(o=sn.bind(null,t=new ln,2)));u=u.v}t?sn(t,1,u):t=u}catch(e){sn(t||(t=new ln),2,e)}}(),t}(a,function(e){return n(a[e])})}(Object.entries(e.arguments),function(n){var r=n[0];return Promise.resolve(pn(n[1])).then(function(n){e.arguments[r].asArgument=function(e){return i(null!=typeof e.xform,"No type specified for argument: "+e.value),hn(e.xform)?e.xform(e.value):hn(e.xform.asArgument)?e.xform.asArgument(e.value):void i(!1,"Invalid Argument",e)}(n)})});if(n&&n.then)return n.then(function(){})}}();return Promise.resolve(n&&n.then?n.then(function(){return e}):e)}catch(e){return Promise.reject(e)}},pn=function e(n,r){void 0===r&&(r=3);try{return i(r>0,"Argument Resolve Recursion Limit Exceeded for Arg: "+n.tempId),hn(n.resolveArgument)?Promise.resolve(n.resolveArgument()).then(function(n){return e(n,r-1)}):Promise.resolve(n)}catch(e){return Promise.reject(e)}},hn=function(e){return"function"==typeof e},vn=function(e){return bn(En(wn(e)))},yn=function(e){return bn(En(Nn(e)))},gn=function(e,n){return u.from(e.padStart(2*n,0),"hex")},kn=(dn=u.from("FLOW-V0.0-transaction").toString("hex"),u.from(dn.padEnd(64,0),"hex")).toString("hex"),bn=function(e){return kn+e},In=function(e){return gn(e,8)},Pn=function(e){return gn(e,32)},An=function(e){return u.from(JSON.stringify(e),"utf8")},Tn=function(e){return u.from(e,"utf8")},Sn=function(e){return u.from(e,"hex")},En=function(e){return c(e).toString("hex")},wn=function(e){return _n(e),[Tn(e.cadence),e.arguments.map(An),Pn(e.refBlock),e.computeLimit,In(e.proposalKey.address),e.proposalKey.keyId,e.proposalKey.sequenceNum,In(e.payer),e.authorizers.map(In)]},Nn=function(e){return Gn(e),[wn(e),On(e)]},On=function(e){var n=Cn(e);return e.payloadSigs.map(function(e){return{signerIndex:n.get(e.address),keyId:e.keyId,sig:e.sig}}).sort(function(e,n){return e.signerIndex>n.signerIndex?1:e.signerIndex<n.signerIndex?-1:e.keyId>n.keyId?1:e.keyId<n.keyId?-1:void 0}).map(function(e){return[e.signerIndex,e.keyId,Sn(e.sig)]})},Cn=function(e){var n=new Map,r=0,t=function(e){n.has(e)||(n.set(e,r),r++)};return t(e.proposalKey.address),t(e.payer),e.authorizers.forEach(t),n},_n=function(e){Rn.forEach(function(n){return Hn(e,n)}),Kn.forEach(function(n){return Hn(e.proposalKey,n,"proposalKey")})},Gn=function(e){Dn.forEach(function(n){return Hn(e,n)}),e.payloadSigs.forEach(function(e,n){Fn.forEach(function(r){return Hn(e,r,"payloadSigs",n)})})},Bn=function(e){return"number"==typeof e},jn=function(e){return"string"==typeof e},Ln=function(e){return null!==e&&"object"==typeof e},xn=function(e){return Ln(e)&&e instanceof Array},Rn=[{name:"cadence",check:jn},{name:"arguments",check:xn},{name:"refBlock",check:jn,defaultVal:"0"},{name:"computeLimit",check:Bn},{name:"proposalKey",check:Ln},{name:"payer",check:jn},{name:"authorizers",check:xn}],Kn=[{name:"address",check:jn},{name:"keyId",check:Bn},{name:"sequenceNum",check:Bn}],Dn=[{name:"payloadSigs",check:xn}],Fn=[{name:"address",check:jn},{name:"keyId",check:Bn},{name:"sig",check:jn}],Un=[{name:"envelopeSigs",check:xn}],zn=[{name:"address",check:jn},{name:"keyId",check:Bn},{name:"sig",check:jn}],Hn=function(e,n,r,t){var o=n.name,i=n.check,u=n.defaultVal;if(null==e[o]&&null!=u&&(e[o]=u),null==e[o])throw qn(o,r,t);if(!i(e[o]))throw Yn(o,r,t)},Mn=function(e,n,r){return n?null==r?n+"."+e:n+"."+r+"."+e:e},qn=function(e,n,r){return new Error("Missing field "+Mn(e,n,r))},Yn=function(e,n,r){return new Error("Invalid field "+Mn(e,n,r))};function Wn(e){var n=new Set(e.authorizations);return n.add(e.proposer),Array.isArray(e.payer)?e.payer.forEach(function(e){return n.delete(e)}):n.delete(e.payer),Array.from(n)}function Jn(e){var n=new Set(Array.isArray(e.payer)?e.payer:[e.payer]);return Array.from(n)}var Vn=function(e){return{cadence:e.message.cadence,refBlock:e.message.refBlock||null,computeLimit:e.message.computeLimit,arguments:e.message.arguments.map(function(n){return e.arguments[n].asArgument}),proposalKey:{address:s(e.accounts[e.proposer].addr),keyId:e.accounts[e.proposer].keyId,sequenceNum:e.accounts[e.proposer].sequenceNum},payer:s(e.accounts[Array.isArray(e.payer)?e.payer[0]:e.payer].addr),authorizers:function(){var n=e.authorizations.map(function(n){return s(e.accounts[n].addr)}).reduce(function(e,n){return e.find(function(e){return e===n})?e:[].concat(e,[n])},[]);return n[0]?n:[]}(),payloadSigs:Wn(e).map(function(n){return{address:s(e.accounts[n].addr),keyId:e.accounts[n].keyId,sig:e.accounts[n].signature}}),envelopeSigs:Jn(e).map(function(n){return{address:s(e.accounts[n].addr),keyId:e.accounts[n].keyId,sig:e.accounts[n].signature}})}},$n=function(e){return function(e){return n=En(function(e){!function(e){Rn.forEach(function(n){return Hn(e,n)}),Kn.forEach(function(n){return Hn(e.proposalKey,n,"proposalKey")}),Dn.forEach(function(n){return Hn(e,n)}),e.payloadSigs.forEach(function(e,n){Fn.forEach(function(r){return Hn(e,r,"payloadSigs",n)})}),Un.forEach(function(n){return Hn(e,n)}),e.envelopeSigs.forEach(function(e,n){zn.forEach(function(r){return Hn(e,r,"envelopeSigs",n)})})}(e);var n=Cn(e),r=function(e){return e.map(function(e){var r=e.keyId,t=e.sig;return{signerIndex:n.get(e.address),keyId:r,sig:t}}).sort(function(e,n){return e.signerIndex>n.signerIndex?1:e.signerIndex<n.signerIndex?-1:e.keyId>n.keyId?1:e.keyId<n.keyId?-1:void 0}).map(function(e){return[e.signerIndex,e.keyId,Sn(e.sig)]})};return[[Tn(e.cadence),e.arguments.map(An),Pn(e.refBlock),e.computeLimit,In(a(e.proposalKey.address)),e.proposalKey.keyId,e.proposalKey.sequenceNum,In(a(e.payer)),e.authorizers.map(function(e){return In(a(e))})],r(e.payloadSigs),r(e.envelopeSigs)]}(e)),(r=new l(256)).update(u.from(n,"hex")),r.digest().toString("hex");var n,r}(e)},Zn="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function Qn(e,n,r){if(!e.s){if(r instanceof Xn){if(!r.s)return void(r.o=Qn.bind(null,e,n));1&n&&(n=r.s),r=r.v}if(r&&r.then)return void r.then(Qn.bind(null,e,n),Qn.bind(null,e,2));e.s=n,e.v=r;var t=e.o;t&&t(e)}}var Xn=function(){function e(){}return e.prototype.then=function(n,r){var t=new e,o=this.s;if(o){var i=1&o?n:r;if(i){try{Qn(t,1,i(this.v))}catch(e){Qn(t,2,e)}return t}return this}return this.o=function(e){try{var o=e.v;1&e.s?Qn(t,1,n?n(o):o):r?Qn(t,1,r(o)):Qn(t,2,o)}catch(e){Qn(t,2,e)}},t},e}();function er(e){return e instanceof Xn&&1&e.s}var nr=function(e){try{var n=function(){if(Pe(e))return Array.isArray(e.payer)||console.warn('\n %cFCL Warning\n ============================\n "ix.payer" must be an array. Support for ix.payer as a singular is deprecated,\n see changelog for more info.\n ============================\n ',"font-weight:bold;font-family:monospace;"),function(n,r){try{var t=Promise.resolve(rr(e,Object.values(e.accounts))).then(function(){return Promise.resolve(rr(e,Object.values(e.accounts))).then(function(){})})}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}(0,function(e){throw console.error("=== SAD PANDA ===\n\n",e,"\n\n=== SAD PANDA ==="),e})}();return Promise.resolve(n&&n.then?n.then(function(n){return e}):e)}catch(e){return Promise.reject(e)}},rr=function e(n,r,t,o){void 0===o&&(o=3);try{var u=function(e){t&&(n.authorizations=n.authorizations.map(function(e){return e===t.tempId?c:e}).reduce(function(e,n){return Array.isArray(n)?[].concat(e,n):[].concat(e,[n])},[]))};i(o,"Account Resolve Recursion Limit Exceeded",{ix:n,accounts:r});var c=[],a=function(e,n,r){if("function"==typeof e[Zn]){var t,o,i,u=e[Zn]();if(function e(r){try{for(;!(t=u.next()).done;)if((r=n(t.value))&&r.then){if(!er(r))return void r.then(e,i||(i=Qn.bind(null,o=new Xn,2)));r=r.v}o?Qn(o,1,r):o=r}catch(e){Qn(o||(o=new Xn),2,e)}}(),u.return){var c=function(e){try{t.done||u.return()}catch(e){}return e};if(o&&o.then)return o.then(c,function(e){throw c(e)});c()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var a=[],s=0;s<e.length;s++)a.push(e[s]);return function(e,n,r){var t,o,i=-1;return function r(u){try{for(;++i<e.length;)if((u=n(i))&&u.then){if(!er(u))return void u.then(r,o||(o=Qn.bind(null,t=new Xn,2)));u=u.v}t?Qn(t,1,u):t=u}catch(e){Qn(t||(t=new Xn),2,e)}}(),t}(a,function(e){return n(a[e])})}(r,function(r){function i(){function i(e){u.tempId!=r.tempId&&delete n.accounts[u.tempId]}var a=function(){if(Array.isArray(r))return Promise.resolve(e(n,r,u,o-1)).then(function(){});if(null!=r.addr&&null!=r.keyId&&(r.tempId=r.addr+"-"+r.keyId),n.accounts[r.tempId]=n.accounts[r.tempId]||r,n.accounts[r.tempId].role.proposer=n.accounts[r.tempId].role.proposer||r.role.proposer,n.accounts[r.tempId].role.payer=n.accounts[r.tempId].role.payer||r.role.payer,n.accounts[r.tempId].role.authorizer=n.accounts[r.tempId].role.authorizer||r.role.authorizer,n.accounts[r.tempId].role.proposer&&n.proposer===u.tempId&&(n.proposer=r.tempId),n.accounts[r.tempId].role.payer&&(n.payer=Array.isArray(n.payer)?Array.from(new Set([].concat(n.payer,[r.tempId]).map(function(e){return e===u.tempId?r.tempId:e}))):Array.from(new Set([n.payer,r.tempId].map(function(e){return e===u.tempId?r.tempId:e}))),n.payer.length>1)){var i=[],a=[];if(n.payer=n.payer.reduce(function(e,r){var t=n.accounts[r],o=t.addr,u=o+"-"+t.keyId;return a.push(o),i.includes(u)?e:(i.push(u),[].concat(e,[r]))},[]),Array.from(new Set(a)).length>1)throw new Error("Payer can not be different accounts")}n.accounts[r.tempId].role.authorizer&&(t?c=Array.from(new Set([].concat(c,[r.tempId]))):n.authorizations=n.authorizations.map(function(e){return e===u.tempId?r.tempId:e}))}();return a&&a.then?a.then(i):i()}var u=t||r,a=function(){if(tr(r.resolve))return Promise.resolve(r.resolve(r,function(e,n){try{return{f_type:"PreSignable",f_vsn:"1.0.1",roles:e.role,cadence:n.message.cadence,args:n.message.arguments.map(function(e){return n.arguments[e].asArgument}),data:{},interaction:n,voucher:Vn(n)}}catch(e){throw console.error("buildPreSignable",e),e}}(r,n))).then(function(e){r=e})}();return a&&a.then?a.then(i):i()});return Promise.resolve(a&&a.then?a.then(u):u())}catch(e){return Promise.reject(e)}},tr=function(e){return"function"==typeof e},or=function(e){try{var n=function(){if(Pe(e))return function(n,r){try{var t=(o=Wn(e),i=vn(ur(e)),Promise.resolve(Promise.all(o.map(ir(e,i)))).then(function(){var n=Jn(e),r=yn(d({},ur(e),{payloadSigs:o.map(function(n){return{address:e.accounts[n].addr,keyId:e.accounts[n].keyId,sig:e.accounts[n].signature}})}));return Promise.resolve(Promise.all(n.map(ir(e,r)))).then(function(){})}))}catch(e){return r(e)}var o,i;return t&&t.then?t.then(void 0,r):t}(0,function(n){throw console.error("Signatures",n,{ix:e}),n})}();return Promise.resolve(n&&n.then?n.then(function(n){return e}):e)}catch(e){return Promise.reject(e)}};function ir(e,n){return function(r){try{var t=e.accounts[r];return null!=t.signature?Promise.resolve():Promise.resolve(t.signingFunction(function(e,n,r){try{return{f_type:"Signable",f_vsn:"1.0.1",message:n,addr:a(e.addr),keyId:e.keyId,roles:e.role,cadence:r.message.cadence,args:r.message.arguments.map(function(e){return r.arguments[e].asArgument}),data:{},interaction:r,voucher:Vn(r)}}catch(e){throw console.error("buildSignable",e),e}}(t,n,e))).then(function(n){e.accounts[r].signature=n.signature})}catch(e){return Promise.reject(e)}}}function ur(e){var n=a((Array.isArray(e.payer)?e.accounts[e.payer[0]]:e.accounts[e.payer]).addr);return{cadence:e.message.cadence,refBlock:e.message.refBlock||null,computeLimit:e.message.computeLimit,arguments:e.message.arguments.map(function(n){return e.arguments[n].asArgument}),proposalKey:{address:a(e.accounts[e.proposer].addr),keyId:e.accounts[e.proposer].keyId,sequenceNum:e.accounts[e.proposer].sequenceNum},payer:n,authorizers:e.authorizations.map(function(n){return a(e.accounts[n].addr)}).reduce(function(e,n){return e.find(function(e){return e===n})?e:[].concat(e,[n])},[])}}var cr=function(e){try{var n=Fe(e,"ix.validators",[]);return Promise.resolve(Ke(e,n.map(function(e){return function(n){return e(n,{Ok:ee,Bad:ne})}})))}catch(e){return Promise.reject(e)}},ar=function(e){try{for(var n=0,r=Object.keys(e.accounts);n<r.length;n++){var t=r[n];e.accounts[t].addr=a(e.accounts[t].addr)}return Promise.resolve(e)}catch(e){return Promise.reject(e)}},sr=function(e){try{var n=Fe(e,"ix.voucher-intercept"),r=function(){if(Q(n))return Promise.resolve(n(Vn(e))).then(function(){})}();return Promise.resolve(r&&r.then?r.then(function(){return e}):e)}catch(e){return Promise.reject(e)}},lr=function(e){return e},fr=function(e,n){return void 0===n&&(n=lr),function(r){try{var t=function(e){return["\nAccounts:",{proposer:e.proposer,authorizations:e.authorizations,payer:e.payer},"\n\nDetails:",e.accounts].filter(Boolean)},o=function(){var n;(n=console).log.apply(n,["debug["+e+"] ---\n"].concat([].slice.call(arguments),["\n\n\n---"]))};return Promise.resolve(x.get("debug."+e)).then(function(e){var i=function(){if(e)return Promise.resolve(n(r,o,t)).then(function(){})}();return i&&i.then?i.then(function(){return r}):r})}catch(e){return Promise.reject(e)}}},dr=Ke([on,fr("cadence",function(e,n){return n(e.message.cadence)}),mn,fr("arguments",function(e,n){return n(e.message.arguments,e.message)}),nr,fr("accounts",function(e,n,r){return n.apply(void 0,r(e))}),function(e){try{var n=function(){if(Pe(e)&&null==e.message.refBlock)return Promise.resolve(x().get("accessNode.api")).then(function(n){return Promise.resolve(x.first(["sdk.transport","sdk.send"])).then(function(r){return i(r,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(r(qe([We()]),{config:x,response:Ye,Buffer:u,ix:Me},{node:n}).then(rn)).then(function(n){e.message.refBlock=n.id})})})}();return Promise.resolve(n&&n.then?n.then(function(){return e}):e)}catch(e){return Promise.reject(e)}},function(e){try{var n=function(){if(Pe(e)){var n=Object.values(e.accounts).find(function(e){return e.role.proposer});i(n,"Transactions require a proposer");var r=function(){if(null==n.sequenceNum)return Promise.resolve(x().get("accessNode.api")).then(function(r){return Promise.resolve(x.first(["sdk.transport","sdk.send"])).then(function(t){return i(t,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(qe([Je(n.addr)])).then(function(o){return Promise.resolve(t(o,{config:x,response:Ye,Buffer:u,ix:Me},{node:r}).then(rn).then(function(e){return e.keys}).then(function(e){return e.find(function(e){return e.index===n.keyId})}).then(function(e){return e.sequenceNumber})).then(function(r){e.accounts[n.tempId].sequenceNum=r})})})})}();if(r&&r.then)return r.then(function(){})}}();return Promise.resolve(n&&n.then?n.then(function(){return e}):e)}catch(e){return Promise.reject(e)}},or,fr("signatures",function(e,n,r){return n.apply(void 0,r(e))}),ar,cr,sr,fr("resolved",function(e,n){return n(e)})]);function mr(){var e=[].slice.call(arguments);if(e.length>1){var n=e,r=n[0],t=n[1];return mr(function(e,n){var o=n.Bad;return r?(0,n.Ok)(e):o(e,t)})}var o=e[0];return function(e){return o(e,{Ok:ee,Bad:ne})}}var pr=function(e,n){void 0===e&&(e=[]),void 0===n&&(n={});try{return Promise.resolve(x.first(["sdk.transport","sdk.send"],n.send)).then(function(r){return mr(r,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(x.first(["sdk.resolve"],n.resolve||dr)).then(function(t){function o(o){return n.node=o,Array.isArray(e)&&(e=Ke(M(),e)),Promise.resolve(t(e)).then(function(e){return r(e,{config:x,response:Ye,ix:Me,Buffer:u},n)})}var i=n.node;return i?o(i):Promise.resolve(x().get("accessNode.api")).then(o)})})}catch(e){return Promise.reject(e)}},hr=function(e){try{return Promise.resolve(x().where(/^decoder\./)).then(function(n){var r=Object.entries(n).map(function(e){var n=e[0],r=e[1];return[n="/"+n.replace(/^decoder\./,"")+"$/",r]});return rn(e,Object.fromEntries(r))})}catch(e){return Promise.reject(e)}},vr=function(e){var n,r;function t(n){var r,t=("\n Encode Message From Signable Error: Unable to determine message encoding for signer addresss: "+n+". \n Please ensure the address: "+n+" is intended to sign the given transaction as specified by the transaction signable.\n ").trim();return(r=e.call(this,t)||this).name="Unable To Determine Message Encoding For Signer Addresss",r}return r=e,(n=t).prototype=Object.create(r.prototype),n.prototype.constructor=n,p(n,r),t}(y(Error)),yr=function(e,n){var r,t,o=(r=e.voucher,(t=new Set(r.authorizers)).add(r.proposalKey.address),t.delete(r.payer),Array.from(t).map(s)),i=function(e){var n=new Set([e.payer]);return Array.from(n).map(s)}(e.voucher),u=o.includes(s(n)),c=i.includes(s(n));if(!u&&!c)throw new vr(n);var l={cadence:e.voucher.cadence,refBlock:e.voucher.refBlock,computeLimit:e.voucher.computeLimit,arguments:e.voucher.arguments,proposalKey:d({},e.voucher.proposalKey,{address:a(e.voucher.proposalKey.address)}),payer:a(e.voucher.payer),authorizers:e.voucher.authorizers.map(a),payloadSigs:e.voucher.payloadSigs.map(function(e){return d({},e,{address:a(e.address)})})};return u?vn(l):yn(l)};function gr(e,n){return console.warn('\n %cFCL/SDK Deprecation Notice\n ============================\n \n "latestBlock()" is deprecated, please use "block()" for this and future versions of FCL\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0008-deprecate-latest-block-method\n \n ============================\n ',"font-weight:bold;font-family:monospace;"),pr([We(e)],n).then(rn)}function kr(e){return ze("ix.validators",function(n){return Array.isArray(n)?n.push(e):[e]})}function br(e){return Ke([function(n){return n.block.height=e,n},kr(function(e){if("boolean"==typeof e.block.isSealed)throw new Error("Unable to specify both block height and isSealed.");if(e.block.id)throw new Error("Unable to specify both block height and block id.");return e})])}function Ir(e){return Ke([function(n){return n.block.id=e,ee(n)},kr(function(e,n){var r=n.Ok,t=n.Bad;return Se(e)?t(e,"Unable to specify a block id with a Get Account interaction."):"boolean"==typeof e.block.isSealed?t(e,"Unable to specify both block id and isSealed."):e.block.height?t(e,"Unable to specify both block id and block height."):r(e)})])}function Pr(e,n,r){var t=void 0===n?{}:n,o=t.height,u=t.id;return i(!(u&&o),'Method: account -- Cannot pass "id" and "height" simultaneously'),u?pr([Je(e),Ir(u)],r).then(rn):o?pr([Je(e),br(o)],r).then(rn):pr([Je(e)],r).then(rn)}function Ar(e,n){var r=void 0===e?{}:e,t=r.sealed,o=void 0!==t&&t,u=r.id,c=r.height;return void 0===n&&(n={}),i(!(o&&u||o&&c),'Method: block -- Cannot pass "sealed" with "id" or "height"'),i(!(u&&c),'Method: block -- Cannot pass "id" and "height" simultaneously'),u?pr([We(),Ir(u)],n).then(rn):c?pr([We(),br(c)],n).then(rn):pr([We(o)],n).then(rn)}function Tr(e){return void 0===e&&(e=[]),Ke(e.map(function(e){return te(e,{role:"authorizer"})}))}function Sr(e,n,r,t){return{addr:e,signingFunction:n,keyId:r,sequenceNum:t}}function Er(e,n,r){return void 0===n&&void 0===r||console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n \n Passing a start and end into getEnvents has been deprecated and will not be supported in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0005-deprecate-start-end-get-events-builder\n \n ============================\n ","font-weight:bold;font-family:monospace;"),Ke([fe,function(t){return t.events.eventType=e,t.events.start=n,t.events.end=r,ee(t)}])}function wr(e,n,r){return Ke([fe,function(t){return t.events.eventType=e,t.events.start=n,t.events.end=r,ee(t)}])}function Nr(e,n){return void 0===n&&(n=[]),Ke([fe,function(r){return r.events.eventType=e,r.events.blockIds=n,ee(r)}])}function Or(e){return void 0===e&&(e=null),Ke([ye,function(n){return n.block.isSealed=e,ee(n)}])}function Cr(e){return void 0===e&&(e=!1),console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getLatestBlock builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0006-deprecate-get-latest-block-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),Ke([de,function(n){return n.block.isSealed=e,ee(n)}])}function _r(e){return console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getBlockById builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0004-deprecate-get-block-by-id-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),Ke([me,function(n){return n.block.ids=[e],ee(n)}])}function Gr(e){return console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getBlockByHeight builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0003-deprecate-get-block-by-height-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),Ke([pe,function(n){return n.block.height=e,ee(n)}])}function Br(e){return void 0===e&&(e=null),Ke([ge,function(n){return n.collection.id=e,n}])}function jr(e){return Ke([ae,function(n){return n.transaction.id=e,ee(n)}])}function Lr(e){return Ke([se,function(n){return n.transaction.id=e,ee(n)}])}function xr(e){return function(n){return n.message.computeLimit=e,n}}function Rr(e){return void 0===e&&(e=[]),Ke(e.map(oe))}function Kr(e,n){return{value:e,xform:n}}var Dr=function(e){try{return Promise.resolve(te(e,{role:"proposer"}))}catch(e){return Promise.reject(e)}},Fr=function(e){try{return Promise.resolve(te(e,{role:"payer"}))}catch(e){return Promise.reject(e)}};function Ur(){return he}function zr(e){return Ke([function(n){return n.message.refBlock=e,ee(n)}])}function Hr(){return Ke([ue,Ue("ix.cadence",f.apply(void 0,[].slice.call(arguments)))])}var Mr=[];function qr(){return Ke([ce,Ue("ix.cadence",f.apply(void 0,[].slice.call(arguments))),function(e){return e.message.computeLimit=e.message.computeLimit||10,e.message.refBlock=e.message.refBlock||null,e.authorizations=e.authorizations||Mr,ee(e)}])}function Yr(e){return Ue("ix.voucher-intercept",e)}var Wr=function(e){var n=e.node;return function(e){try{return Pe(e)?e.accounts[e.proposer].sequenceNum?Promise.resolve(ee(e)):Promise.resolve(x.first(["sdk.transport","sdk.send"])).then(function(r){return i(r,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(qe([Je(e.accounts[e.proposer].addr)])).then(function(t){return Promise.resolve(r(t,{config:x,response:Ye,Buffer:u,ix:Me},{node:n})).then(function(n){return Promise.resolve(rn(n)).then(function(n){return e.accounts[e.proposer].sequenceNum=n.keys[e.accounts[e.proposer].keyId].sequenceNumber,ee(e)})})})}):Promise.resolve(ee(e))}catch(e){return Promise.reject(e)}}},Jr=function(e){return e},Vr=["tempId"];function $r(e){return["SIGNATURE",e.addr,e.keyId].join(".")}function Zr(e){return void 0===e&&(e={}),function(n){var r=d({},n,e,{signingFunction:e.signingFunction||n.signingFunction||function(e){return{addr:r.addr,keyId:r.keyId,signature:$r(r)}}});return r}}var Qr={proposer:!1,authorizer:!1,payer:!1},Xr={__proto__:null,mockSend:function(e){return void 0===e&&(e=Jr),function(n){return Promise.resolve(n).then(function(r){switch(n=r,!0){case Se(n):return function(e,n){return void 0===n&&(n=5),i(e.account,"mockAccountResponse(ix) -- ix.account is missing",e),i(e.account.addr,"mockAccountResponse(ix) -- ix.account.addr is missing",e),{account:{addr:e.account.addr,keys:Array.from({length:n},function(e,n){return{index:n,sequenceNumber:42}})}}}(n);case _e(n):return{tag:"GET_BLOCK",block:{id:"32"}};default:return e(n)}})}},authzFn:Zr,authzResolve:function(e){return void 0===e&&(e={}),function(n){return d({},n,{tempId:e.tempId||"WITH_RESOLVE",resolve:Zr(function(e,n){if(null==e)return{};var r,t,o={},i=Object.keys(e);for(t=0;t<i.length;t++)n.indexOf(r=i[t])>=0||(o[r]=e[r]);return o}(e,Vr))})}},authzResolveMany:function(e){return void 0===e&&(e={}),function(n){return d({},n,{tempId:e.tempId||"AUTHZ_RESOLVE_MANY",resolve:function(){return[e.proposer&&Zr(e.proposer)({role:d({},Qr,{proposer:!0})})].concat(e.authorizations.map(Zr).map(function(e){return e({role:d({},Qr,{authorizer:!0})})}),[e.payer&&Zr(e.payer)({role:d({},Qr,{payer:!0})})]).filter(Boolean)}})}},sig:$r,idof:function(e){return e.addr+"-"+e.keyId},run:function(e){return void 0===e&&(e=[]),qe([zr("123")].concat(e)).then(dr)}},et="0.0.57-multisig.0",nt=function(e){return n={name:"params",transitionsPath:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params"},void console.error("\n %cFCL/SDK Deprecation Notice\n ============================\n The "+n.name+" builder has been removed from the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: "+n.transitionsPath+"\n ============================\n ","font-weight:bold;font-family:monospace;");var n},rt=function(e){return n={name:"param",transitionsPath:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params"},void console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n The "+n.name+" builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: "+n.transitionsPath+"\n ============================\n ","font-weight:bold;font-family:monospace;");var n};export{Xr as TestUtils,et as VERSION,Pr as account,Kr as arg,Rr as args,br as atBlockHeight,Ir as atBlockId,Sr as authorization,Tr as authorizations,Ar as block,qe as build,x as config,Vn as createSignableVoucher,hr as decode,He as destroy,yr as encodeMessageFromSignable,Fe as get,Je as getAccount,We as getBlock,Gr as getBlockByHeight,_r as getBlockById,Or as getBlockHeader,Br as getCollection,Er as getEvents,wr as getEventsAtBlockHeightRange,Nr as getEventsAtBlockIds,Cr as getLatestBlock,Lr as getTransaction,jr as getTransactionStatus,M as interaction,mr as invariant,Le as isBad,Se as isGetAccount,_e as isGetBlock,Oe as isGetBlockByHeight,Ne as isGetBlockById,Ge as isGetBlockHeader,Be as isGetCollection,Ee as isGetEvents,we as isGetLatestBlock,Te as isGetTransaction,Ae as isGetTransactionStatus,je as isOk,Ce as isPing,Ie as isScript,Pe as isTransaction,be as isUnknown,gr as latestBlock,xr as limit,rt as param,nt as params,Fr as payer,Ur as ping,Ke as pipe,Dr as proposer,Ue as put,zr as ref,dr as resolve,nr as resolveAccounts,mn as resolveArguments,on as resolveCadence,ar as resolveFinalNormalization,Wr as resolveProposerSequenceNumber,tn as resolveRefBlockId,or as resolveSignatures,cr as resolveValidators,sr as resolveVoucherIntercept,Hr as script,pr as send,qr as transaction,ze as update,kr as validator,Yr as voucherIntercept,$n as voucherToTxId,xe as why};
//# sourceMappingURL=sdk.module.js.map

@@ -1,2 +0,2 @@

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@onflow/util-invariant"),require("@onflow/util-actor"),require("@onflow/util-address"),require("sha3"),require("@onflow/rlp"),require("@onflow/util-template")):"function"==typeof define&&define.amd?define(["exports","@onflow/util-invariant","@onflow/util-actor","@onflow/util-address","sha3","@onflow/rlp","@onflow/util-template"],n):n((e||self).sdk={},e.utilInvariant,e.utilActor,e.utilAddress,e.sha3,e.rlp,e.utilTemplate)}(this,function(e,n,r,t,o,i,u){function c(){return c=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},c.apply(this,arguments)}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function s(e,n){return s=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},s(e,n)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function f(e,n,r){return f=l()?Reflect.construct:function(e,n,r){var t=[null];t.push.apply(t,n);var o=new(Function.bind.apply(e,t));return r&&s(o,r.prototype),o},f.apply(null,arguments)}function d(e){var n="function"==typeof Map?new Map:void 0;return d=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,r)}function r(){return f(e,arguments,a(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),s(r,e)},d(e)}function m(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=new Array(n);r<n;r++)t[r]=e[r];return t}var p,h="UNKNOWN",v="SCRIPT",g="TRANSACTION",y="GET_TRANSACTION_STATUS",k="GET_ACCOUNT",b="GET_EVENTS",P="GET_LATEST_BLOCK",I="PING",w="GET_TRANSACTION",S="GET_BLOCK_BY_ID",A="GET_BLOCK_BY_HEIGHT",T="GET_BLOCK",E="GET_BLOCK_HEADER",O="GET_COLLECTION",N="BAD",B="OK",x="ACCOUNT",j="PARAM",G="ARGUMENT",C="authorizer",_="payer",L="proposer",R='{\n "tag":"UNKNOWN",\n "assigns":{},\n "status":"OK",\n "reason":null,\n "accounts":{},\n "params":{},\n "arguments":{},\n "message": {\n "cadence":null,\n "refBlock":null,\n "computeLimit":null,\n "proposer":null,\n "payer":null,\n "authorizations":[],\n "params":[],\n "arguments":[]\n },\n "proposer":null,\n "authorizations":[],\n "payer":null,\n "events": {\n "eventType":null,\n "start":null,\n "end":null,\n "blockIds":[]\n },\n "transaction": {\n "id":null\n },\n "block": {\n "id":null,\n "height":null,\n "isSealed":null\n },\n "account": {\n "addr":null\n },\n "collection": {\n "id":null\n }\n}',K=new Set(Object.keys(JSON.parse(R))),F=function(){return JSON.parse(R)},z="abcdefghijklmnopqrstuvwxyz0123456789".split(""),D=function(){return z[~~(Math.random()*z.length)]},U=function(){return Array.from({length:10},D).join("")},H=function(e){return"number"==typeof e},q=function(e){return Array.isArray(e)},M=function(e){return null!==e&&"object"==typeof e},Y=function(e){return null==e},J=function(e){return"function"==typeof e},V=function(e){if(!M(e)||Y(e)||H(e))return!1;for(var n,r=function(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,n){if(e){if("string"==typeof e)return m(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?m(e,n):void 0}}(e))){r&&(e=r);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(K);!(n=r()).done;)if(!e.hasOwnProperty(n.value))return!1;return!0},W=function(e){return e.status=B,e},$=function(e,n){return e.status=N,e.reason=n,e},Z=function(e){return function(n){return n.tag=e,W(n)}},Q=function(e,r){return void 0===r&&(r={}),function(t){var o;n.invariant("function"==typeof e||"object"==typeof e,"prepAccount must be passed an authorization function or an account object"),n.invariant(null!=r.role,"Account must have a role");var i=JSON.parse('{\n "kind":"ACCOUNT",\n "tempId":null,\n "addr":null,\n "keyId":null,\n "sequenceNum":null,\n "signature":null,\n "signingFunction":null,\n "resolve":null,\n "role": {\n "proposer":false,\n "authorizer":false,\n "payer":false,\n "param":false\n }\n}'),u=r.role,a=U();return e.authorization&&J(e.authorization)&&(e={resolve:e.authorization}),!e.authorization&&J(e)&&(e={resolve:e}),t.accounts[a]=c({},i,{tempId:a},e,{role:c({},i.role,"object"==typeof e.role?e.role:{},(o={},o[u]=!0,o))}),u===C?t.authorizations.push(a):t[u]=a,t}},X=function(e){return function(n){var r=U();return n.message.arguments.push(r),n.arguments[r]=JSON.parse('{\n "kind":"ARGUMENT",\n "tempId":null,\n "value":null,\n "asArgument":null,\n "xform":null,\n "resolve": null,\n "resolveArgument": null\n}'),n.arguments[r].tempId=r,n.arguments[r].value=e.value,n.arguments[r].asArgument=e.asArgument,n.arguments[r].xform=e.xform,n.arguments[r].resolve=e.resolve,n.arguments[r].resolveArgument=J(e.resolveArgument)?e.resolveArgument.bind(e):e.resolveArgument,W(n)}},ee=Z(h),ne=Z(v),re=Z(g),te=Z(y),oe=Z(w),ie=Z(k),ue=Z(b),ce=Z(P),ae=Z(S),se=Z(A),le=Z(I),fe=Z(T),de=Z(E),me=Z(O),pe=function(e){return function(n){return n.tag===e}},he=pe(h),ve=pe(v),ge=pe(g),ye=pe(y),ke=pe(w),be=pe(k),Pe=pe(b),Ie=pe(P),we=pe(S),Se=pe(A),Ae=pe(I),Te=pe(T),Ee=pe(E),Oe=pe(O),Ne=function(e){return e.status===B},Be=function(e){return e.status===N},xe=function(e){return e.reason},je=function e(n,r){void 0===r&&(r=[]);try{return Promise.resolve(function(t,o){try{var i=Promise.resolve(n).then(function(t){if(n=function(e){for(var n=0,r=Object.keys(e);n<r.length;n++){var t=r[n];if(!K.has(t))throw new Error('"'+t+'" is an invalid root level Interaction property.')}return e}(t),Be(n))throw new Error("Interaction Error: "+n.reason);if(!r.length)return n;var o=r[0],i=r.slice(1);return Promise.resolve(o).then(function(r){if(J(r))return e(r(n),i);if(Y(r)||!r)return e(n,i);if(V(r))return e(r,i);throw new Error("Invalid Interaction Composition")})})}catch(e){return o(e)}return i&&i.then?i.then(void 0,o):i}(0,function(e){throw e}))}catch(e){return Promise.reject(e)}},Ge=function e(){var n=[].slice.call(arguments),r=n[0],t=n[1];return q(r)&&null==t?function(n){return e(n,r)}:je(r,t)},Ce=function(e){return e},_e=function(e,n,r){return null==e.assigns[n]?r:e.assigns[n]},Le=function(e,n){return function(r){return r.assigns[e]=n,W(r)}},Re=function(e,n){return void 0===n&&(n=Ce),function(r){return r.assigns[e]=n(r.assigns[e],r),W(r)}},Ke=function(e){return function(n){return delete n.assigns[e],W(n)}},Fe={__proto__:null,UNKNOWN:h,SCRIPT:v,TRANSACTION:g,GET_TRANSACTION_STATUS:y,GET_ACCOUNT:k,GET_EVENTS:b,GET_LATEST_BLOCK:P,PING:I,GET_TRANSACTION:w,GET_BLOCK_BY_ID:S,GET_BLOCK_BY_HEIGHT:A,GET_BLOCK:T,GET_BLOCK_HEADER:E,GET_COLLECTION:O,BAD:N,OK:B,ACCOUNT:x,PARAM:j,ARGUMENT:G,AUTHORIZER:C,PAYER:_,PROPOSER:L,interaction:F,uuid:U,isNumber:H,isArray:q,isObj:M,isNull:Y,isFn:J,isInteraction:V,Ok:W,Bad:$,prepAccount:Q,makeArgument:X,makeUnknown:ee,makeScript:ne,makeTransaction:re,makeGetTransactionStatus:te,makeGetTransaction:oe,makeGetAccount:ie,makeGetEvents:ue,makeGetLatestBlock:ce,makeGetBlockById:ae,makeGetBlockByHeight:se,makePing:le,makeGetBlock:fe,makeGetBlockHeader:de,makeGetCollection:me,isUnknown:he,isScript:ve,isTransaction:ge,isGetTransactionStatus:ye,isGetTransaction:ke,isGetAccount:be,isGetEvents:Pe,isGetLatestBlock:Ie,isGetBlockById:we,isGetBlockByHeight:Se,isPing:Ae,isGetBlock:Te,isGetBlockHeader:Ee,isGetCollection:Oe,isOk:Ne,isBad:Be,why:xe,isAccount:function(e){return e.kind===x},isParam:function(e){return e.kind===j},isArgument:function(e){return e.kind===G},pipe:Ge,get:_e,put:Le,update:Re,destroy:Ke};function ze(e){return void 0===e&&(e=[]),Ge(F(),e)}var De=function e(n,r){void 0===n&&(n=[]);try{if(!n.length)return Promise.resolve(r);var t=n[0],o=n.slice(1);return Promise.resolve(en(t)).then(function(n){return null==n?e(o,r):n})}catch(e){return Promise.reject(e)}},Ue="config",He="PUT_CONFIG",qe="GET_CONFIG",Me="GET_ALL_CONFIG",Ye="UPDATE_CONFIG",Je="DELETE_CONFIG",Ve="CLEAR_CONFIG",We="WHERE_CONFIG",$e="CONFIG/UPDATED",Ze=function(e){return e},Qe=((p={})[He]=function(e,n,r){var t=r.key,o=r.value;if(null==t)throw new Error("Missing 'key' for config/put.");e.put(t,o),e.broadcast($e,c({},e.all()))},p[qe]=function(e,n,r){var t=r.key,o=r.fallback;if(null==t)throw new Error("Missing 'key' for config/get");n.reply(e.get(t,o))},p[Me]=function(e,n){n.reply(c({},e.all()))},p[Ye]=function(e,n,r){var t=r.key,o=r.fn;if(null==t)throw new Error("Missing 'key' for config/update");e.update(t,o||Ze),e.broadcast($e,c({},e.all()))},p[Je]=function(e,n,r){var t=r.key;if(null==t)throw new Error("Missing 'key' for config/delete");e.delete(t),e.broadcast($e,c({},e.all()))},p[Ve]=function(e,n){for(var r=0,t=Object.keys(e.all());r<t.length;r++)e.delete(t[r]);e.broadcast($e,c({},e.all()))},p[We]=function(e,n,r){var t=r.pattern;if(null==t)throw new Error("Missing 'pattern' for config/where");n.reply(e.where(t))},p[r.SUBSCRIBE]=function(e,n){e.subscribe(n.from),e.send(n.from,$e,c({},e.all()))},p[r.UNSUBSCRIBE]=function(e,n){e.unsubscribe(n.from)},p);function Xe(e,n){return r.send(Ue,He,{key:e,value:n}),an()}function en(e,n){return r.send(Ue,qe,{key:e,fallback:n},{expectReply:!0,timeout:10})}function nn(){return r.send(Ue,Me,null,{expectReply:!0,timeout:10})}function rn(e,n){return void 0===n&&(n=Ze),r.send(Ue,Ye,{key:e,fn:n}),an()}function tn(e){return r.send(Ue,Je,{key:e}),an()}function on(e){return r.send(Ue,We,{pattern:e},{expectReply:!0,timeout:10})}function un(e){return r.subscriber(Ue,function(){return r.spawn(Qe,Ue)},e)}function cn(){return r.send(Ue,Ve)}function an(e){return null!=e&&"object"==typeof e&&Object.keys(e).map(function(n){return Xe(n,e[n])}),{put:Xe,get:en,all:nn,first:De,update:rn,delete:tn,where:on,subscribe:un,overload:ln}}r.spawn(Qe,Ue),an.put=Xe,an.get=en,an.all=nn,an.first=De,an.update=rn,an.delete=tn,an.where=on,an.subscribe=un,an.overload=ln;var sn=function(e){return e};function ln(e,n){return void 0===e&&(e={}),void 0===n&&(n=sn),new Promise(function(r,t){try{return Promise.resolve(nn()).then(function(o){var i=function(t,i){try{var u=function(){an(e);var t=n;return Promise.resolve(nn()).then(function(e){return Promise.resolve(t(e)).then(function(e){return Promise.resolve(cn()).then(function(){return Promise.resolve(an(o)).then(function(){r(e)})})})})}()}catch(e){return i(e)}return u&&u.then?u.then(void 0,i):u}(0,function(e){return Promise.resolve(cn()).then(function(){return Promise.resolve(an(o)).then(function(){t(e)})})});if(i&&i.then)return i.then(function(){})})}catch(e){return Promise.reject(e)}})}var fn=function(){return JSON.parse('{\n "tag":null,\n "transaction":null,\n "transactionStatus":null,\n "transactionId":null,\n "encodedData":null,\n "events":null,\n "account":null,\n "block":null,\n "blockHeader":null,\n "latestBlock":null,\n "collection":null\n}')};function dn(e){return void 0===e&&(e=null),Ge([fe,function(n){return n.block.isSealed=e,W(n)}])}function mn(e){return Ge([ie,function(n){return n.account.addr=t.sansPrefix(e),W(n)}])}var pn=function(e,n,r){try{try{return Promise.resolve(Number(e))}catch(e){throw new Error("Decode Number Error : "+r.join("."))}}catch(e){return Promise.reject(e)}},hn=function(e){return Promise.resolve(e)},vn=function(e,n,r){try{return Promise.resolve(e.fields.reduce(function(e,t){return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(kn(t.value,n,[].concat(r,[t.name]))).then(function(n){return e[t.name]=n,e})})},Promise.resolve({}))).then(function(r){var t=e.id&&yn(n,e.id);return t?Promise.resolve(t(r)):r})}catch(e){return Promise.reject(e)}},gn={UInt:pn,Int:pn,UInt8:pn,Int8:pn,UInt16:pn,Int16:pn,UInt32:pn,Int32:pn,UInt64:pn,Int64:pn,UInt128:pn,Int128:pn,UInt256:pn,Int256:pn,Word8:pn,Word16:pn,Word32:pn,Word64:pn,UFix64:hn,Fix64:hn,String:hn,Character:hn,Bool:hn,Address:hn,Void:function(){return Promise.resolve(null)},Optional:function(e,n,r){return Promise.resolve(e?kn(e,n,r):null)},Reference:function(e){try{return Promise.resolve({address:e.address,type:e.type})}catch(e){return Promise.reject(e)}},Array:function(e,n,r){try{return Promise.resolve(Promise.all(e.map(function(e){return new Promise(function(t){try{return Promise.resolve(kn(e,n,[].concat(r,[e.type]))).then(t)}catch(e){return Promise.reject(e)}})})))}catch(e){return Promise.reject(e)}},Dictionary:function(e,n,r){try{return Promise.resolve(e.reduce(function(e,t){return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(kn(t.key,n,[].concat(r,[t.key]))).then(function(o){return Promise.resolve(kn(t.value,n,[].concat(r,[t.key]))).then(function(n){return e[o]=n,e})})})},Promise.resolve({})))}catch(e){return Promise.reject(e)}},Event:vn,Resource:vn,Struct:vn,Enum:vn,Type:function(e){try{return Promise.resolve(e.staticType)}catch(e){return Promise.reject(e)}},Path:function(e){try{return Promise.resolve({domain:e.domain,identifier:e.identifier})}catch(e){return Promise.reject(e)}},Capability:function(e){try{return Promise.resolve({path:e.path,address:e.address,borrowType:e.borrowType})}catch(e){return Promise.reject(e)}}},yn=function(e,n){var r=Object.keys(e).find(function(e){return/^\/.*\/$/.test(e)?new RegExp(e.substring(1,e.length-1)).test(n):e===n});return n&&r&&e[r]},kn=function(e,n,r){try{var t=yn(n,e.type);if(!t)throw new Error("Undefined Decoder Error: "+e.type+"@"+r.join("."));return Promise.resolve(t(e.value,n,r))}catch(e){return Promise.reject(e)}},bn=function(e,n,r){void 0===n&&(n={}),void 0===r&&(r=[]);var t=c({},gn,n);return Promise.resolve(kn(e,t,r))},Pn=function(e,n){void 0===n&&(n={});try{var r,t=c({},gn,n),o=e.encodedData?Promise.resolve(bn(e.encodedData,t)).then(function(e){return r=1,e}):e.transactionStatus?Promise.resolve(Promise.all(e.transactionStatus.events.map(function(e){try{var n=e.eventIndex,r=e.transactionIndex,o=e.transactionId,i=e.type;return Promise.resolve(bn(e.payload,t)).then(function(e){return{type:i,transactionId:o,transactionIndex:r,eventIndex:n,data:e}})}catch(e){return Promise.reject(e)}}))).then(function(n){var t=c({},e.transactionStatus,{events:n});return r=1,t}):e.transaction?(r=1,e.transaction):e.events?Promise.resolve(Promise.all(e.events.map(function(e){try{var n=e.eventIndex,r=e.transactionIndex,o=e.transactionId,i=e.type,u=e.blockTimestamp,c=e.blockHeight,a=e.blockId;return Promise.resolve(bn(e.payload,t)).then(function(e){return{blockId:a,blockHeight:c,blockTimestamp:u,type:i,transactionId:o,transactionIndex:r,eventIndex:n,data:e}})}catch(e){return Promise.reject(e)}}))).then(function(e){return r=1,e}):e.account?(r=1,e.account):e.block?(r=1,e.block):e.blockHeader?(r=1,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;"),r=1,e.latestBlock):e.transactionId?(r=1,e.transactionId):e.collection?(r=1,e.collection):void 0;return Promise.resolve(o&&o.then?o.then(function(e){return r?e:null}):r?o:null)}catch(e){return Promise.reject(e)}},In=function(e){try{var r=function(){if(ge(e)||ve(e)){var r=function(){return n.invariant(Sn(t),"Cadence needs to be a string at this point."),Promise.resolve(an().where(/^0x/).then(function(e){return Object.entries(e).reduce(function(e,n){var r=n[1],t=new RegExp("(\\b"+n[0]+"\\b)","g");return e.replace(t,r)},t)})).then(function(n){e.message.cadence=n})},t=_e(e,"ix.cadence");n.invariant(wn(t)||Sn(t),"Cadence needs to be a function or a string.");var o=function(){if(wn(t))return Promise.resolve(t({})).then(function(e){t=e})}();return o&&o.then?o.then(r):r()}}();return Promise.resolve(r&&r.then?r.then(function(){return e}):e)}catch(e){return Promise.reject(e)}},wn=function(e){return"function"==typeof e},Sn=function(e){return"string"==typeof e};const An="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function Tn(e,n,r){if(!e.s){if(r instanceof En){if(!r.s)return void(r.o=Tn.bind(null,e,n));1&n&&(n=r.s),r=r.v}if(r&&r.then)return void r.then(Tn.bind(null,e,n),Tn.bind(null,e,2));e.s=n,e.v=r;var t=e.o;t&&t(e)}}var En=function(){function e(){}return e.prototype.then=function(n,r){var t=new e,o=this.s;if(o){var i=1&o?n:r;if(i){try{Tn(t,1,i(this.v))}catch(e){Tn(t,2,e)}return t}return this}return this.o=function(e){try{var o=e.v;1&e.s?Tn(t,1,n?n(o):o):r?Tn(t,1,r(o)):Tn(t,2,o)}catch(e){Tn(t,2,e)}},t},e}();function On(e){return e instanceof En&&1&e.s}var Nn,Bn=function(e){try{var r=function(){if(ge(e)||ve(e)){var r=function(e,n,r){if("function"==typeof e[An]){var t,o,i,u=e[An]();if(function e(r){try{for(;!(t=u.next()).done;)if((r=n(t.value))&&r.then){if(!On(r))return void r.then(e,i||(i=Tn.bind(null,o=new En,2)));r=r.v}o?Tn(o,1,r):o=r}catch(e){Tn(o||(o=new En),2,e)}}(),u.return){var c=function(e){try{t.done||u.return()}catch(e){}return e};if(o&&o.then)return o.then(c,function(e){throw c(e)});c()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var a=[],s=0;s<e.length;s++)a.push(e[s]);return function(e,n,r){var t,o,i=-1;return function r(u){try{for(;++i<e.length;)if((u=n(i))&&u.then){if(!On(u))return void u.then(r,o||(o=Tn.bind(null,t=new En,2)));u=u.v}t?Tn(t,1,u):t=u}catch(e){Tn(t||(t=new En),2,e)}}(),t}(a,function(e){return n(a[e])})}(Object.entries(e.arguments),function(r){var t=r[0];return Promise.resolve(xn(r[1])).then(function(r){var o;e.arguments[t].asArgument=(n.invariant(null!=typeof(o=r).xform,"No type specified for argument: "+o.value),jn(o.xform)?o.xform(o.value):jn(o.xform.asArgument)?o.xform.asArgument(o.value):void n.invariant(!1,"Invalid Argument",o))})});if(r&&r.then)return r.then(function(){})}}();return Promise.resolve(r&&r.then?r.then(function(){return e}):e)}catch(e){return Promise.reject(e)}},xn=function e(r,t){void 0===t&&(t=3);try{return n.invariant(t>0,"Argument Resolve Recursion Limit Exceeded for Arg: "+r.tempId),jn(r.resolveArgument)?Promise.resolve(r.resolveArgument()).then(function(n){return e(n,t-1)}):Promise.resolve(r)}catch(e){return Promise.reject(e)}},jn=function(e){return"function"==typeof e},Gn=function(e){return Rn(Hn(qn(e)))},Cn=function(e){return Rn(Hn(Mn(e)))},_n=function(e,n){return Buffer.from(e.padStart(2*n,0),"hex")},Ln=(Nn=Buffer.from("FLOW-V0.0-transaction").toString("hex"),Buffer.from(Nn.padEnd(64,0),"hex")).toString("hex"),Rn=function(e){return Ln+e},Kn=function(e){return _n(e,8)},Fn=function(e){return _n(e,32)},zn=function(e){return Buffer.from(JSON.stringify(e),"utf8")},Dn=function(e){return Buffer.from(e,"utf8")},Un=function(e){return Buffer.from(e,"hex")},Hn=function(e){return i.encode(e).toString("hex")},qn=function(e){return Vn(e),[Dn(e.cadence),e.arguments.map(zn),Fn(e.refBlock),e.computeLimit,Kn(e.proposalKey.address),e.proposalKey.keyId,e.proposalKey.sequenceNum,Kn(e.payer),e.authorizers.map(Kn)]},Mn=function(e){return Wn(e),[qn(e),Yn(e)]},Yn=function(e){var n=Jn(e);return e.payloadSigs.map(function(e){return{signerIndex:n.get(e.address),keyId:e.keyId,sig:e.sig}}).sort(function(e,n){return e.signerIndex>n.signerIndex?1:e.signerIndex<n.signerIndex?-1:e.keyId>n.keyId?1:e.keyId<n.keyId?-1:void 0}).map(function(e){return[e.signerIndex,e.keyId,Un(e.sig)]})},Jn=function(e){var n=new Map,r=0,t=function(e){n.has(e)||(n.set(e,r),r++)};return t(e.proposalKey.address),t(e.payer),e.authorizers.forEach(t),n},Vn=function(e){er.forEach(function(n){return ur(e,n)}),nr.forEach(function(n){return ur(e.proposalKey,n,"proposalKey")})},Wn=function(e){rr.forEach(function(n){return ur(e,n)}),e.payloadSigs.forEach(function(e,n){tr.forEach(function(r){return ur(e,r,"payloadSigs",n)})})},$n=function(e){return"number"==typeof e},Zn=function(e){return"string"==typeof e},Qn=function(e){return null!==e&&"object"==typeof e},Xn=function(e){return Qn(e)&&e instanceof Array},er=[{name:"cadence",check:Zn},{name:"arguments",check:Xn},{name:"refBlock",check:Zn,defaultVal:"0"},{name:"computeLimit",check:$n},{name:"proposalKey",check:Qn},{name:"payer",check:Zn},{name:"authorizers",check:Xn}],nr=[{name:"address",check:Zn},{name:"keyId",check:$n},{name:"sequenceNum",check:$n}],rr=[{name:"payloadSigs",check:Xn}],tr=[{name:"address",check:Zn},{name:"keyId",check:$n},{name:"sig",check:Zn}],or=[{name:"envelopeSigs",check:Xn}],ir=[{name:"address",check:Zn},{name:"keyId",check:$n},{name:"sig",check:Zn}],ur=function(e,n,r,t){var o=n.name,i=n.check,u=n.defaultVal;if(null==e[o]&&null!=u&&(e[o]=u),null==e[o])throw ar(o,r,t);if(!i(e[o]))throw sr(o,r,t)},cr=function(e,n,r){return n?null==r?n+"."+e:n+"."+r+"."+e:e},ar=function(e,n,r){return new Error("Missing field "+cr(e,n,r))},sr=function(e,n,r){return new Error("Invalid field "+cr(e,n,r))};function lr(e){var n=new Set(e.authorizations);return n.add(e.proposer),n.delete(e.payer),Array.from(n)}function fr(e){var n=new Set([e.payer]);return Array.from(n)}var dr=function(e){return{cadence:e.message.cadence,refBlock:e.message.refBlock||null,computeLimit:e.message.computeLimit,arguments:e.message.arguments.map(function(n){return e.arguments[n].asArgument}),proposalKey:{address:t.withPrefix(e.accounts[e.proposer].addr),keyId:e.accounts[e.proposer].keyId,sequenceNum:e.accounts[e.proposer].sequenceNum},payer:t.withPrefix(e.accounts[e.payer].addr),authorizers:(n=e.authorizations.map(function(n){return t.withPrefix(e.accounts[n].addr)}).reduce(function(e,n){return e.find(function(e){return e===n})?e:[].concat(e,[n])},[]),n[0]?n:[]),payloadSigs:lr(e).map(function(n){return{address:t.withPrefix(e.accounts[n].addr),keyId:e.accounts[n].keyId,sig:e.accounts[n].signature}}),envelopeSigs:fr(e).map(function(n){return{address:t.withPrefix(e.accounts[n].addr),keyId:e.accounts[n].keyId,sig:e.accounts[n].signature}})};var n},mr="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function pr(e,n,r){if(!e.s){if(r instanceof hr){if(!r.s)return void(r.o=pr.bind(null,e,n));1&n&&(n=r.s),r=r.v}if(r&&r.then)return void r.then(pr.bind(null,e,n),pr.bind(null,e,2));e.s=n,e.v=r;var t=e.o;t&&t(e)}}var hr=function(){function e(){}return e.prototype.then=function(n,r){var t=new e,o=this.s;if(o){var i=1&o?n:r;if(i){try{pr(t,1,i(this.v))}catch(e){pr(t,2,e)}return t}return this}return this.o=function(e){try{var o=e.v;1&e.s?pr(t,1,n?n(o):o):r?pr(t,1,r(o)):pr(t,2,o)}catch(e){pr(t,2,e)}},t},e}();function vr(e){return e instanceof hr&&1&e.s}var gr=function(e){try{var n=function(){if(ge(e))return function(n,r){try{var t=Promise.resolve(yr(e,Object.values(e.accounts))).then(function(){return Promise.resolve(yr(e,Object.values(e.accounts))).then(function(){})})}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}(0,function(e){throw console.error("=== SAD PANDA ===\n\n",e,"\n\n=== SAD PANDA ==="),e})}();return Promise.resolve(n&&n.then?n.then(function(n){return e}):e)}catch(e){return Promise.reject(e)}},yr=function e(r,t,o,i){void 0===i&&(i=3);try{var u=function(){o&&(r.authorizations=r.authorizations.map(function(e){return e===o.tempId?c:e}).reduce(function(e,n){return Array.isArray(n)?[].concat(e,n):[].concat(e,[n])},[]))};n.invariant(i,"Account Resolve Recursion Limit Exceeded",{ix:r,accounts:t});var c=[],a=function(e,n,r){if("function"==typeof e[mr]){var t,o,i,u=e[mr]();if(function e(r){try{for(;!(t=u.next()).done;)if((r=n(t.value))&&r.then){if(!vr(r))return void r.then(e,i||(i=pr.bind(null,o=new hr,2)));r=r.v}o?pr(o,1,r):o=r}catch(e){pr(o||(o=new hr),2,e)}}(),u.return){var c=function(e){try{t.done||u.return()}catch(e){}return e};if(o&&o.then)return o.then(c,function(e){throw c(e)});c()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var a=[],s=0;s<e.length;s++)a.push(e[s]);return function(e,n,r){var t,o,i=-1;return function r(u){try{for(;++i<e.length;)if((u=n(i))&&u.then){if(!vr(u))return void u.then(r,o||(o=pr.bind(null,t=new hr,2)));u=u.v}t?pr(t,1,u):t=u}catch(e){pr(t||(t=new hr),2,e)}}(),t}(a,function(e){return n(a[e])})}(t,function(n){function t(){function t(){u.tempId!=n.tempId&&delete r.accounts[u.tempId]}var a=function(){if(Array.isArray(n))return Promise.resolve(e(r,n,u,i-1)).then(function(){});null!=n.addr&&null!=n.keyId&&(n.tempId=n.addr+"-"+n.keyId),r.accounts[n.tempId]=r.accounts[n.tempId]||n,r.accounts[n.tempId].role.proposer=r.accounts[n.tempId].role.proposer||n.role.proposer,r.accounts[n.tempId].role.payer=r.accounts[n.tempId].role.payer||n.role.payer,r.accounts[n.tempId].role.authorizer=r.accounts[n.tempId].role.authorizer||n.role.authorizer,r.accounts[n.tempId].role.proposer&&r.proposer===u.tempId&&(r.proposer=n.tempId),r.accounts[n.tempId].role.payer&&r.payer===u.tempId&&(r.payer=n.tempId),r.accounts[n.tempId].role.authorizer&&(o?c=Array.from(new Set([].concat(c,[n.tempId]))):r.authorizations=r.authorizations.map(function(e){return e===u.tempId?n.tempId:e}))}();return a&&a.then?a.then(t):t()}var u=o||n,a=function(){if(kr(n.resolve))return Promise.resolve(n.resolve(n,function(e,n){try{return{f_type:"PreSignable",f_vsn:"1.0.1",roles:e.role,cadence:n.message.cadence,args:n.message.arguments.map(function(e){return n.arguments[e].asArgument}),data:{},interaction:n,voucher:dr(n)}}catch(e){throw console.error("buildPreSignable",e),e}}(n,r))).then(function(e){n=e})}();return a&&a.then?a.then(t):t()});return Promise.resolve(a&&a.then?a.then(u):u())}catch(e){return Promise.reject(e)}},kr=function(e){return"function"==typeof e},br=function(e){try{var n=function(){if(ge(e))return function(n,r){try{var t=(o=lr(e),i=Gn(Ir(e)),Promise.resolve(Promise.all(o.map(Pr(e,i)))).then(function(){var n=fr(e),r=Cn(c({},Ir(e),{payloadSigs:o.map(function(n){return{address:e.accounts[n].addr,keyId:e.accounts[n].keyId,sig:e.accounts[n].signature}})}));return Promise.resolve(Promise.all(n.map(Pr(e,r)))).then(function(){})}))}catch(e){return r(e)}var o,i;return t&&t.then?t.then(void 0,r):t}(0,function(n){throw console.error("Signatures",n,{ix:e}),n})}();return Promise.resolve(n&&n.then?n.then(function(n){return e}):e)}catch(e){return Promise.reject(e)}};function Pr(e,n){return function(r){try{var o=e.accounts[r];return null!=o.signature?Promise.resolve():Promise.resolve(o.signingFunction(function(e,n,r){try{return{f_type:"Signable",f_vsn:"1.0.1",message:n,addr:t.sansPrefix(e.addr),keyId:e.keyId,roles:e.role,cadence:r.message.cadence,args:r.message.arguments.map(function(e){return r.arguments[e].asArgument}),data:{},interaction:r,voucher:dr(r)}}catch(e){throw console.error("buildSignable",e),e}}(o,n,e))).then(function(n){e.accounts[r].signature=n.signature})}catch(e){return Promise.reject(e)}}}function Ir(e){return{cadence:e.message.cadence,refBlock:e.message.refBlock||null,computeLimit:e.message.computeLimit,arguments:e.message.arguments.map(function(n){return e.arguments[n].asArgument}),proposalKey:{address:t.sansPrefix(e.accounts[e.proposer].addr),keyId:e.accounts[e.proposer].keyId,sequenceNum:e.accounts[e.proposer].sequenceNum},payer:t.sansPrefix(e.accounts[e.payer].addr),authorizers:e.authorizations.map(function(n){return t.sansPrefix(e.accounts[n].addr)}).reduce(function(e,n){return e.find(function(e){return e===n})?e:[].concat(e,[n])},[])}}var wr=function(e){try{var n=_e(e,"ix.validators",[]);return Promise.resolve(Ge(e,n.map(function(e){return function(n){return e(n,{Ok:W,Bad:$})}})))}catch(e){return Promise.reject(e)}},Sr=function(e){try{for(var n=0,r=Object.keys(e.accounts);n<r.length;n++){var o=r[n];e.accounts[o].addr=t.sansPrefix(e.accounts[o].addr)}return Promise.resolve(e)}catch(e){return Promise.reject(e)}},Ar=function(e){try{var n=_e(e,"ix.voucher-intercept"),r=function(){if(J(n))return Promise.resolve(n(dr(e))).then(function(){})}();return Promise.resolve(r&&r.then?r.then(function(){return e}):e)}catch(e){return Promise.reject(e)}},Tr=function(e){return e},Er=function(e,n){return void 0===n&&(n=Tr),function(r){try{var t=function(e){return["\nAccounts:",{proposer:e.proposer,authorizations:e.authorizations,payer:e.payer},"\n\nDetails:",e.accounts].filter(Boolean)},o=function(){var n;(n=console).log.apply(n,["debug["+e+"] ---\n"].concat([].slice.call(arguments),["\n\n\n---"]))};return Promise.resolve(an.get("debug."+e)).then(function(e){var i=function(){if(e)return Promise.resolve(n(r,o,t)).then(function(){})}();return i&&i.then?i.then(function(){return r}):r})}catch(e){return Promise.reject(e)}}},Or=Ge([In,Er("cadence",function(e,n){return n(e.message.cadence)}),Bn,Er("arguments",function(e,n){return n(e.message.arguments,e.message)}),gr,Er("accounts",function(e,n,r){return n.apply(void 0,r(e))}),function(e){try{var r=function(){if(ge(e)&&null==e.message.refBlock)return Promise.resolve(an().get("accessNode.api")).then(function(r){return Promise.resolve(an.first(["sdk.transport","sdk.send"])).then(function(t){return n.invariant(t,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(t(ze([dn()]),{config:an,response:fn,ix:Fe},{node:r}).then(Pn)).then(function(n){e.message.refBlock=n.id})})})}();return Promise.resolve(r&&r.then?r.then(function(){return e}):e)}catch(e){return Promise.reject(e)}},function(e){try{var r=function(){if(ge(e)){var r=Object.values(e.accounts).find(function(e){return e.role.proposer});n.invariant(r,"Transactions require a proposer");var t=function(){if(null==r.sequenceNum)return Promise.resolve(an().get("accessNode.api")).then(function(t){return Promise.resolve(an.first(["sdk.transport","sdk.send"])).then(function(o){return n.invariant(o,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(ze([mn(r.addr)])).then(function(n){return Promise.resolve(o(n,{config:an,response:fn,ix:Fe},{node:t}).then(Pn).then(function(e){return e.keys}).then(function(e){return e.find(function(e){return e.index===r.keyId})}).then(function(e){return e.sequenceNumber})).then(function(n){e.accounts[r.tempId].sequenceNum=n})})})})}();if(t&&t.then)return t.then(function(){})}}();return Promise.resolve(r&&r.then?r.then(function(){return e}):e)}catch(e){return Promise.reject(e)}},br,Er("signatures",function(e,n,r){return n.apply(void 0,r(e))}),Sr,wr,Ar,Er("resolved",function(e,n){return n(e)})]);function Nr(){var e=[].slice.call(arguments);if(e.length>1){var n=e,r=n[0],t=n[1];return Nr(function(e,n){var o=n.Bad;return r?(0,n.Ok)(e):o(e,t)})}var o=e[0];return function(e){return o(e,{Ok:W,Bad:$})}}var Br=function(e,n){void 0===e&&(e=[]),void 0===n&&(n={});try{return Promise.resolve(an.first(["sdk.transport","sdk.send"],n.send)).then(function(r){return Nr(r,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(an.first(["sdk.resolve"],n.resolve||Or)).then(function(t){function o(o){return n.node=o,Array.isArray(e)&&(e=Ge(F(),e)),Promise.resolve(t(e)).then(function(e){return r(e,{config:an,response:fn,ix:Fe},n)})}var i=n.node;return i?o(i):Promise.resolve(an().get("accessNode.api")).then(o)})})}catch(e){return Promise.reject(e)}},xr=function(e){var n,r;function t(n){var r,t=("\n Encode Message From Signable Error: Unable to determine message encoding for signer addresss: "+n+". \n Please ensure the address: "+n+" is intended to sign the given transaction as specified by the transaction signable.\n ").trim();return(r=e.call(this,t)||this).name="Unable To Determine Message Encoding For Signer Addresss",r}return r=e,(n=t).prototype=Object.create(r.prototype),n.prototype.constructor=n,s(n,r),t}(d(Error));function jr(e){return Re("ix.validators",function(n){return Array.isArray(n)?n.push(e):[e]})}function Gr(e){return Ge([function(n){return n.block.height=e,n},jr(function(e){if("boolean"==typeof e.block.isSealed)throw new Error("Unable to specify both block height and isSealed.");if(e.block.id)throw new Error("Unable to specify both block height and block id.");return e})])}function Cr(e){return Ge([function(n){return n.block.id=e,W(n)},jr(function(e,n){var r=n.Ok,t=n.Bad;return be(e)?t(e,"Unable to specify a block id with a Get Account interaction."):"boolean"==typeof e.block.isSealed?t(e,"Unable to specify both block id and isSealed."):e.block.height?t(e,"Unable to specify both block id and block height."):r(e)})])}function _r(e){return Ge([function(n){return n.message.refBlock=e,W(n)}])}var Lr=[],Rr=function(e){return e},Kr=["tempId"];function Fr(e){return["SIGNATURE",e.addr,e.keyId].join(".")}function zr(e){return void 0===e&&(e={}),function(n){var r=c({},n,e,{signingFunction:e.signingFunction||n.signingFunction||function(e){return{addr:r.addr,keyId:r.keyId,signature:Fr(r)}}});return r}}var Dr={proposer:!1,authorizer:!1,payer:!1},Ur={__proto__:null,mockSend:function(e){return void 0===e&&(e=Rr),function(r){return Promise.resolve(r).then(function(t){switch(r=t,!0){case be(r):return function(e,r){return void 0===r&&(r=5),n.invariant(e.account,"mockAccountResponse(ix) -- ix.account is missing",e),n.invariant(e.account.addr,"mockAccountResponse(ix) -- ix.account.addr is missing",e),{account:{addr:e.account.addr,keys:Array.from({length:r},function(e,n){return{index:n,sequenceNumber:42}})}}}(r);case Te(r):return{tag:"GET_BLOCK",block:{id:"32"}};default:return e(r)}})}},authzFn:zr,authzResolve:function(e){return void 0===e&&(e={}),function(n){return c({},n,{tempId:e.tempId||"WITH_RESOLVE",resolve:zr(function(e,n){if(null==e)return{};var r,t,o={},i=Object.keys(e);for(t=0;t<i.length;t++)n.indexOf(r=i[t])>=0||(o[r]=e[r]);return o}(e,Kr))})}},authzResolveMany:function(e){return void 0===e&&(e={}),function(n){return c({},n,{tempId:e.tempId||"AUTHZ_RESOLVE_MANY",resolve:function(){return[e.proposer&&zr(e.proposer)({role:c({},Dr,{proposer:!0})})].concat(e.authorizations.map(zr).map(function(e){return e({role:c({},Dr,{authorizer:!0})})}),[e.payer&&zr(e.payer)({role:c({},Dr,{payer:!0})})]).filter(Boolean)}})}},sig:Fr,idof:function(e){return e.addr+"-"+e.keyId},run:function(e){return void 0===e&&(e=[]),ze([_r("123")].concat(e)).then(Or)}};Object.defineProperty(e,"cadence",{enumerable:!0,get:function(){return u.template}}),Object.defineProperty(e,"cdc",{enumerable:!0,get:function(){return u.template}}),e.TestUtils=Ur,e.VERSION="0.0.57-alpha.4",e.account=function(e,n){return Br([mn(e)],n).then(Pn)},e.arg=function(e,n){return{value:e,xform:n}},e.args=function(e){return void 0===e&&(e=[]),Ge(e.map(X))},e.atBlockHeight=Gr,e.atBlockId=Cr,e.authorization=function(e,n,r,t){return{addr:e,signingFunction:n,keyId:r,sequenceNum:t}},e.authorizations=function(e){return void 0===e&&(e=[]),Ge(e.map(function(e){return Q(e,{role:C})}))},e.block=function(e,r){var t=void 0===e?{}:e,o=t.sealed,i=void 0!==o&&o,u=t.id,c=t.height;return void 0===r&&(r={}),n.invariant(!(i&&u||i&&c),'Method: block -- Cannot pass "sealed" with "id" or "height"'),n.invariant(!(u&&c),'Method: block -- Cannot pass "id" and "height" simultaneously'),u?Br([dn(),Cr(u)],r).then(Pn):c?Br([dn(),Gr(c)],r).then(Pn):Br([dn(i)],r).then(Pn)},e.build=ze,e.config=an,e.createSignableVoucher=dr,e.decode=function(e){try{return Promise.resolve(an().where(/^decoder\./)).then(function(n){var r=Object.entries(n).map(function(e){var n=e[0],r=e[1];return[n="/"+n.replace(/^decoder\./,"")+"$/",r]});return Pn(e,Object.fromEntries(r))})}catch(e){return Promise.reject(e)}},e.destroy=Ke,e.encodeMessageFromSignable=function(e,n){var r,o,i=(r=e.voucher,(o=new Set(r.authorizers)).add(r.proposalKey.address),o.delete(r.payer),Array.from(o).map(t.withPrefix)),u=function(e){var n=new Set([e.payer]);return Array.from(n).map(t.withPrefix)}(e.voucher),a=i.includes(t.withPrefix(n)),s=u.includes(t.withPrefix(n));if(!a&&!s)throw new xr(n);var l={cadence:e.voucher.cadence,refBlock:e.voucher.refBlock,computeLimit:e.voucher.computeLimit,arguments:e.voucher.arguments,proposalKey:c({},e.voucher.proposalKey,{address:t.sansPrefix(e.voucher.proposalKey.address)}),payer:t.sansPrefix(e.voucher.payer),authorizers:e.voucher.authorizers.map(t.sansPrefix),payloadSigs:e.voucher.payloadSigs.map(function(e){return c({},e,{address:t.sansPrefix(e.address)})})};return a?Gn(l):Cn(l)},e.get=_e,e.getAccount=mn,e.getBlock=dn,e.getBlockByHeight=function(e){return console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getBlockByHeight builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0003-deprecate-get-block-by-height-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),Ge([se,function(n){return n.block.height=e,W(n)}])},e.getBlockById=function(e){return console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getBlockById builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0004-deprecate-get-block-by-id-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),Ge([ae,function(n){return n.block.ids=[e],W(n)}])},e.getBlockHeader=function(e){return void 0===e&&(e=null),Ge([de,function(n){return n.block.isSealed=e,W(n)}])},e.getCollection=function(e){return void 0===e&&(e=null),Ge([me,function(n){return n.collection.id=e,n}])},e.getEvents=function(e,n,r){return void 0===n&&void 0===r||console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n \n Passing a start and end into getEnvents has been deprecated and will not be supported in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0005-deprecate-start-end-get-events-builder\n \n ============================\n ","font-weight:bold;font-family:monospace;"),Ge([ue,function(t){return t.events.eventType=e,t.events.start=n,t.events.end=r,W(t)}])},e.getEventsAtBlockHeightRange=function(e,n,r){return Ge([ue,function(t){return t.events.eventType=e,t.events.start=n,t.events.end=r,W(t)}])},e.getEventsAtBlockIds=function(e,n){return void 0===n&&(n=[]),Ge([ue,function(r){return r.events.eventType=e,r.events.blockIds=n,W(r)}])},e.getLatestBlock=function(e){return void 0===e&&(e=!1),console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getLatestBlock builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0006-deprecate-get-latest-block-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),Ge([ce,function(n){return n.block.isSealed=e,W(n)}])},e.getTransaction=function(e){return Ge([oe,function(n){return n.transaction.id=e,W(n)}])},e.getTransactionStatus=function(e){return Ge([te,function(n){return n.transaction.id=e,W(n)}])},e.interaction=F,e.invariant=Nr,e.isBad=Be,e.isGetAccount=be,e.isGetBlock=Te,e.isGetBlockByHeight=Se,e.isGetBlockById=we,e.isGetBlockHeader=Ee,e.isGetCollection=Oe,e.isGetEvents=Pe,e.isGetLatestBlock=Ie,e.isGetTransaction=ke,e.isGetTransactionStatus=ye,e.isOk=Ne,e.isPing=Ae,e.isScript=ve,e.isTransaction=ge,e.isUnknown=he,e.latestBlock=function(e,n){return console.warn('\n %cFCL/SDK Deprecation Notice\n ============================\n \n "latestBlock()" is deprecated, please use "block()" for this and future versions of FCL\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0008-deprecate-latest-block-method\n \n ============================\n ',"font-weight:bold;font-family:monospace;"),Br([dn(e)],n).then(Pn)},e.limit=function(e){return function(n){return n.message.computeLimit=e,n}},e.param=function(e){return n={name:"param",transitionsPath:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params"},void console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n The "+n.name+" builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: "+n.transitionsPath+"\n ============================\n ","font-weight:bold;font-family:monospace;");var n},e.params=function(e){return n={name:"params",transitionsPath:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params"},void console.error("\n %cFCL/SDK Deprecation Notice\n ============================\n The "+n.name+" builder has been removed from the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: "+n.transitionsPath+"\n ============================\n ","font-weight:bold;font-family:monospace;");var n},e.payer=function(e){try{return Promise.resolve(Q(e,{role:_}))}catch(e){return Promise.reject(e)}},e.ping=function(){return le},e.pipe=Ge,e.proposer=function(e){try{return Promise.resolve(Q(e,{role:L}))}catch(e){return Promise.reject(e)}},e.put=Le,e.ref=_r,e.resolve=Or,e.resolveAccounts=gr,e.resolveArguments=Bn,e.resolveCadence=In,e.resolveFinalNormalization=Sr,e.resolveProposerSequenceNumber=function(e){var r=e.node;return function(e){try{return ge(e)?e.accounts[e.proposer].sequenceNum?Promise.resolve(W(e)):Promise.resolve(an.first(["sdk.transport","sdk.send"])).then(function(t){return n.invariant(t,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(ze([mn(e.accounts[e.proposer].addr)])).then(function(n){return Promise.resolve(t(n,{config:an,response:fn,ix:Fe},{node:r})).then(function(n){return Promise.resolve(Pn(n)).then(function(n){return e.accounts[e.proposer].sequenceNum=n.keys[e.accounts[e.proposer].keyId].sequenceNumber,W(e)})})})}):Promise.resolve(W(e))}catch(e){return Promise.reject(e)}}},e.resolveRefBlockId=function(e){return function(e){try{return ge(e)?e.message.refBlock?Promise.resolve(W(e)):Promise.resolve(function(e){try{return Promise.resolve(an().get("accessNode.api")).then(function(e){return Promise.resolve(an.first(["sdk.transport","sdk.send"])).then(function(r){var t;return n.invariant(r,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(Ge(F(),[dn()])).then(function(n){return t=n,Promise.resolve(r(t,{config:an,response:fn,ix:Fe},{node:e})).then(function(e){return t=e,Promise.resolve(Pn(t)).then(function(e){return(t=e).id})})})})})}catch(e){return Promise.reject(e)}}()).then(function(n){return e.message.refBlock=n,W(e)}):Promise.resolve(W(e))}catch(e){return Promise.reject(e)}}},e.resolveSignatures=br,e.resolveValidators=wr,e.resolveVoucherIntercept=Ar,e.script=function(){return Ge([ne,Le("ix.cadence",u.template.apply(void 0,[].slice.call(arguments)))])},e.send=Br,e.transaction=function(){return Ge([re,Le("ix.cadence",u.template.apply(void 0,[].slice.call(arguments))),function(e){return e.message.computeLimit=e.message.computeLimit||10,e.message.refBlock=e.message.refBlock||null,e.authorizations=e.authorizations||Lr,W(e)}])},e.update=Re,e.validator=jr,e.voucherIntercept=function(e){return Le("ix.voucher-intercept",e)},e.voucherToTxId=function(e){return function(e){return n=Hn(function(e){!function(e){er.forEach(function(n){return ur(e,n)}),nr.forEach(function(n){return ur(e.proposalKey,n,"proposalKey")}),rr.forEach(function(n){return ur(e,n)}),e.payloadSigs.forEach(function(e,n){tr.forEach(function(r){return ur(e,r,"payloadSigs",n)})}),or.forEach(function(n){return ur(e,n)}),e.envelopeSigs.forEach(function(e,n){ir.forEach(function(r){return ur(e,r,"envelopeSigs",n)})})}(e);var n=Jn(e),r=function(e){return e.map(function(e){var r=e.keyId,t=e.sig;return{signerIndex:n.get(e.address),keyId:r,sig:t}}).sort(function(e,n){return e.signerIndex>n.signerIndex?1:e.signerIndex<n.signerIndex?-1:e.keyId>n.keyId?1:e.keyId<n.keyId?-1:void 0}).map(function(e){return[e.signerIndex,e.keyId,Un(e.sig)]})};return[[Dn(e.cadence),e.arguments.map(zn),Fn(e.refBlock),e.computeLimit,Kn(t.sansPrefix(e.proposalKey.address)),e.proposalKey.keyId,e.proposalKey.sequenceNum,Kn(t.sansPrefix(e.payer)),e.authorizers.map(function(e){return Kn(t.sansPrefix(e))})],r(e.payloadSigs),r(e.envelopeSigs)]}(e)),(r=new o.SHA3(256)).update(Buffer.from(n,"hex")),r.digest().toString("hex");var n,r}(e)},e.why=xe});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@onflow/util-actor"),require("@onflow/util-invariant"),require("@onflow/rlp"),require("@onflow/util-address"),require("sha3"),require("@onflow/util-template")):"function"==typeof define&&define.amd?define(["exports","@onflow/util-actor","@onflow/util-invariant","@onflow/rlp","@onflow/util-address","sha3","@onflow/util-template"],n):n((e||self).sdk={},e.utilActor,e.utilInvariant,e.rlp,e.utilAddress,e.sha3,e.utilTemplate)}(this,function(e,n,r,t,o,i,u){function a(){return a=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},a.apply(this,arguments)}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function s(e,n){return s=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},s(e,n)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function f(e,n,r){return f=l()?Reflect.construct:function(e,n,r){var t=[null];t.push.apply(t,n);var o=new(Function.bind.apply(e,t));return r&&s(o,r.prototype),o},f.apply(null,arguments)}function d(e){var n="function"==typeof Map?new Map:void 0;return d=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,r)}function r(){return f(e,arguments,c(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),s(r,e)},d(e)}function m(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=new Array(n);r<n;r++)t[r]=e[r];return t}function p(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,n){if(e){if("string"==typeof e)return m(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?m(e,n):void 0}}(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var h,v=function e(n,r){void 0===n&&(n=[]);try{if(!n.length)return Promise.resolve(r);var t=n[0],o=n.slice(1);return Promise.resolve(B(t)).then(function(n){return null==n?e(o,r):n})}catch(e){return Promise.reject(e)}},y="config",g="PUT_CONFIG",k="GET_CONFIG",b="GET_ALL_CONFIG",P="UPDATE_CONFIG",I="DELETE_CONFIG",w="CLEAR_CONFIG",S="WHERE_CONFIG",A="CONFIG/UPDATED",E=function(e){return e},T=((h={})[g]=function(e,n,r){var t=r.key,o=r.value;if(null==t)throw new Error("Missing 'key' for config/put.");e.put(t,o),e.broadcast(A,a({},e.all()))},h[k]=function(e,n,r){var t=r.key,o=r.fallback;if(null==t)throw new Error("Missing 'key' for config/get");n.reply(e.get(t,o))},h[b]=function(e,n){n.reply(a({},e.all()))},h[P]=function(e,n,r){var t=r.key,o=r.fn;if(null==t)throw new Error("Missing 'key' for config/update");e.update(t,o||E),e.broadcast(A,a({},e.all()))},h[I]=function(e,n,r){var t=r.key;if(null==t)throw new Error("Missing 'key' for config/delete");e.delete(t),e.broadcast(A,a({},e.all()))},h[w]=function(e,n){for(var r=0,t=Object.keys(e.all());r<t.length;r++)e.delete(t[r]);e.broadcast(A,a({},e.all()))},h[S]=function(e,n,r){var t=r.pattern;if(null==t)throw new Error("Missing 'pattern' for config/where");n.reply(e.where(t))},h[n.SUBSCRIBE]=function(e,n){e.subscribe(n.from),e.send(n.from,A,a({},e.all()))},h[n.UNSUBSCRIBE]=function(e,n){e.unsubscribe(n.from)},h);function N(e,r){return n.send(y,g,{key:e,value:r}),L()}function B(e,r){return n.send(y,k,{key:e,fallback:r},{expectReply:!0,timeout:10})}function O(){return n.send(y,b,null,{expectReply:!0,timeout:10})}function x(e,r){return void 0===r&&(r=E),n.send(y,P,{key:e,fn:r}),L()}function j(e){return n.send(y,I,{key:e}),L()}function G(e){return n.send(y,S,{pattern:e},{expectReply:!0,timeout:10})}function C(e){return n.subscriber(y,function(){return n.spawn(T,y)},e)}function _(){return n.send(y,w)}function L(e){return null!=e&&"object"==typeof e&&Object.keys(e).map(function(n){return N(n,e[n])}),{put:N,get:B,all:O,first:v,update:x,delete:j,where:G,subscribe:C,overload:K}}n.spawn(T,y),L.put=N,L.get=B,L.all=O,L.first=v,L.update=x,L.delete=j,L.where=G,L.subscribe=C,L.overload=K;var R=function(e){return e};function K(e,n){return void 0===e&&(e={}),void 0===n&&(n=R),new Promise(function(r,t){try{return Promise.resolve(O()).then(function(o){var i=function(t,i){try{var u=function(){L(e);var t=n;return Promise.resolve(O()).then(function(e){return Promise.resolve(t(e)).then(function(e){return Promise.resolve(_()).then(function(){return Promise.resolve(L(o)).then(function(){r(e)})})})})}()}catch(e){return i(e)}return u&&u.then?u.then(void 0,i):u}(0,function(e){return Promise.resolve(_()).then(function(){return Promise.resolve(L(o)).then(function(){t(e)})})});if(i&&i.then)return i.then(function(){})})}catch(e){return Promise.reject(e)}})}var F=function(e,n){for(var r,t=p(e.entries());!(r=t()).done;){var o=r.value;if(o[1]===n)return o[0]}},D=function(e,n){return new Proxy(e,{get:function(e,r){if(F(n,r)){var t=F(n,r);return Reflect.get(e,t)}return n.has(r)&&function(e,n,r){try{Promise.resolve(L.get("logger.level",0)).then(function(e){var r;if(!(e<2)){var t,o=["\n %c"+(t={title:"FCL/SDK Deprecation Notice",message:n}).title+"\n ============================\n "+t.message+"\n ============================\n ","font-weight:bold;font-family:monospace;"];(r=console).warn.apply(r,o)}})}catch(e){return Promise.reject(e)}}(0,'"'+r+'" will be deprecated in a future version.\n Please use "'+n.get(r)+'" instead.'),Reflect.get(e,r)}})},z="UNKNOWN",U="SCRIPT",q="TRANSACTION",H="GET_TRANSACTION_STATUS",M="GET_ACCOUNT",Y="GET_EVENTS",J="GET_LATEST_BLOCK",V="PING",W="GET_TRANSACTION",$="GET_BLOCK_BY_ID",Z="GET_BLOCK_BY_HEIGHT",Q="GET_BLOCK",X="GET_BLOCK_HEADER",ee="GET_COLLECTION",ne="BAD",re="OK",te="ACCOUNT",oe="PARAM",ie="ARGUMENT",ue="authorizer",ae="payer",ce="proposer",se='{\n "tag":"UNKNOWN",\n "assigns":{},\n "status":"OK",\n "reason":null,\n "accounts":{},\n "params":{},\n "arguments":{},\n "message": {\n "cadence":null,\n "refBlock":null,\n "computeLimit":null,\n "proposer":null,\n "payer":null,\n "authorizations":[],\n "params":[],\n "arguments":[]\n },\n "proposer":null,\n "authorizations":[],\n "payer":[],\n "events": {\n "eventType":null,\n "start":null,\n "end":null,\n "blockIds":[]\n },\n "transaction": {\n "id":null\n },\n "block": {\n "id":null,\n "height":null,\n "isSealed":null\n },\n "account": {\n "addr":null\n },\n "collection": {\n "id":null\n }\n}',le=new Set(Object.keys(JSON.parse(se))),fe=new Map([["addr","address"],["sequenceNum","seqNum"],["keyId","keyIndex"]]),de=function(){var e=JSON.parse(se);return a({},e,{account:D(e.account,fe)})},me="abcdefghijklmnopqrstuvwxyz0123456789".split(""),pe=function(){return me[~~(Math.random()*me.length)]},he=function(){return Array.from({length:10},pe).join("")},ve=function(e){return"number"==typeof e},ye=function(e){return Array.isArray(e)},ge=function(e){return null!==e&&"object"==typeof e},ke=function(e){return null==e},be=function(e){return"function"==typeof e},Pe=function(e){if(!ge(e)||ke(e)||ve(e))return!1;for(var n,r=p(le);!(n=r()).done;)if(!e.hasOwnProperty(n.value))return!1;return!0},Ie=function(e){return e.status=re,e},we=function(e,n){return e.status=ne,e.reason=n,e},Se=function(e){return function(n){return n.tag=e,Ie(n)}},Ae=function(e,n){return void 0===n&&(n={}),function(t){var o;r.invariant("function"==typeof e||"object"==typeof e,"prepAccount must be passed an authorization function or an account object"),r.invariant(null!=n.role,"Account must have a role");var i=D(JSON.parse('{\n "kind":"ACCOUNT",\n "tempId":null,\n "addr":null,\n "keyId":null,\n "sequenceNum":null,\n "signature":null,\n "signingFunction":null,\n "resolve":null,\n "role": {\n "proposer":false,\n "authorizer":false,\n "payer":false,\n "param":false\n }\n}'),fe),u=n.role,c=he();return e.authorization&&be(e.authorization)&&(e={resolve:e.authorization}),!e.authorization&&be(e)&&(e={resolve:e}),t.accounts[c]=a({},i,{tempId:c},e,{role:a({},i.role,"object"==typeof e.role?e.role:{},(o={},o[u]=!0,o))}),u===ue?t.authorizations.push(c):u===ae?t.payer.push(c):t[u]=c,t}},Ee=function(e){return function(n){var r=he();return n.message.arguments.push(r),n.arguments[r]=JSON.parse('{\n "kind":"ARGUMENT",\n "tempId":null,\n "value":null,\n "asArgument":null,\n "xform":null,\n "resolve": null,\n "resolveArgument": null\n}'),n.arguments[r].tempId=r,n.arguments[r].value=e.value,n.arguments[r].asArgument=e.asArgument,n.arguments[r].xform=e.xform,n.arguments[r].resolve=e.resolve,n.arguments[r].resolveArgument=be(e.resolveArgument)?e.resolveArgument.bind(e):e.resolveArgument,Ie(n)}},Te=Se(z),Ne=Se(U),Be=Se(q),Oe=Se(H),xe=Se(W),je=Se(M),Ge=Se(Y),Ce=Se(J),_e=Se($),Le=Se(Z),Re=Se(V),Ke=Se(Q),Fe=Se(X),De=Se(ee),ze=function(e){return function(n){return n.tag===e}},Ue=ze(z),qe=ze(U),He=ze(q),Me=ze(H),Ye=ze(W),Je=ze(M),Ve=ze(Y),We=ze(J),$e=ze($),Ze=ze(Z),Qe=ze(V),Xe=ze(Q),en=ze(X),nn=ze(ee),rn=function(e){return e.status===re},tn=function(e){return e.status===ne},on=function(e){return e.reason},un=function e(n,r){void 0===r&&(r=[]);try{return Promise.resolve(function(t,o){try{var i=Promise.resolve(n).then(function(t){if(n=function(e){for(var n=0,r=Object.keys(e);n<r.length;n++){var t=r[n];if(!le.has(t))throw new Error('"'+t+'" is an invalid root level Interaction property.')}return e}(t),tn(n))throw new Error("Interaction Error: "+n.reason);if(!r.length)return n;var o=r[0],i=r.slice(1);return Promise.resolve(o).then(function(r){if(be(r))return e(r(n),i);if(ke(r)||!r)return e(n,i);if(Pe(r))return e(r,i);throw new Error("Invalid Interaction Composition")})})}catch(e){return o(e)}return i&&i.then?i.then(void 0,o):i}(0,function(e){throw e}))}catch(e){return Promise.reject(e)}},an=function e(){var n=[].slice.call(arguments),r=n[0],t=n[1];return ye(r)&&null==t?function(n){return e(n,r)}:un(r,t)},cn=function(e){return e},sn=function(e,n,r){return null==e.assigns[n]?r:e.assigns[n]},ln=function(e,n){return function(r){return r.assigns[e]=n,Ie(r)}},fn=function(e,n){return void 0===n&&(n=cn),function(r){return r.assigns[e]=n(r.assigns[e],r),Ie(r)}},dn=function(e){return function(n){return delete n.assigns[e],Ie(n)}},mn={__proto__:null,UNKNOWN:z,SCRIPT:U,TRANSACTION:q,GET_TRANSACTION_STATUS:H,GET_ACCOUNT:M,GET_EVENTS:Y,GET_LATEST_BLOCK:J,PING:V,GET_TRANSACTION:W,GET_BLOCK_BY_ID:$,GET_BLOCK_BY_HEIGHT:Z,GET_BLOCK:Q,GET_BLOCK_HEADER:X,GET_COLLECTION:ee,BAD:ne,OK:re,ACCOUNT:te,PARAM:oe,ARGUMENT:ie,AUTHORIZER:ue,PAYER:ae,PROPOSER:ce,interaction:de,uuid:he,isNumber:ve,isArray:ye,isObj:ge,isNull:ke,isFn:be,isInteraction:Pe,Ok:Ie,Bad:we,prepAccount:Ae,makeArgument:Ee,makeUnknown:Te,makeScript:Ne,makeTransaction:Be,makeGetTransactionStatus:Oe,makeGetTransaction:xe,makeGetAccount:je,makeGetEvents:Ge,makeGetLatestBlock:Ce,makeGetBlockById:_e,makeGetBlockByHeight:Le,makePing:Re,makeGetBlock:Ke,makeGetBlockHeader:Fe,makeGetCollection:De,isUnknown:Ue,isScript:qe,isTransaction:He,isGetTransactionStatus:Me,isGetTransaction:Ye,isGetAccount:Je,isGetEvents:Ve,isGetLatestBlock:We,isGetBlockById:$e,isGetBlockByHeight:Ze,isPing:Qe,isGetBlock:Xe,isGetBlockHeader:en,isGetCollection:nn,isOk:rn,isBad:tn,why:on,isAccount:function(e){return e.kind===te},isParam:function(e){return e.kind===oe},isArgument:function(e){return e.kind===ie},pipe:an,get:sn,put:ln,update:fn,destroy:dn};function pn(e){return void 0===e&&(e=[]),an(de(),e)}var hn=function(){return JSON.parse('{\n "tag":null,\n "transaction":null,\n "transactionStatus":null,\n "transactionId":null,\n "encodedData":null,\n "events":null,\n "account":null,\n "block":null,\n "blockHeader":null,\n "latestBlock":null,\n "collection":null\n}')};function vn(e){return void 0===e&&(e=null),an([Ke,function(n){return n.block.isSealed=e,Ie(n)}])}function yn(e){return an([je,function(n){return n.account.addr=o.sansPrefix(e),Ie(n)}])}var gn=function(e,n,r){try{try{return Promise.resolve(Number(e))}catch(e){throw new Error("Decode Number Error : "+r.join("."))}}catch(e){return Promise.reject(e)}},kn=function(e){return Promise.resolve(e)},bn=function(e,n,r){try{return Promise.resolve(e.fields.reduce(function(e,t){return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(wn(t.value,n,[].concat(r,[t.name]))).then(function(n){return e[t.name]=n,e})})},Promise.resolve({}))).then(function(r){var t=e.id&&In(n,e.id);return t?Promise.resolve(t(r)):r})}catch(e){return Promise.reject(e)}},Pn={UInt:gn,Int:gn,UInt8:gn,Int8:gn,UInt16:gn,Int16:gn,UInt32:gn,Int32:gn,UInt64:gn,Int64:gn,UInt128:gn,Int128:gn,UInt256:gn,Int256:gn,Word8:gn,Word16:gn,Word32:gn,Word64:gn,UFix64:kn,Fix64:kn,String:kn,Character:kn,Bool:kn,Address:kn,Void:function(){return Promise.resolve(null)},Optional:function(e,n,r){return Promise.resolve(e?wn(e,n,r):null)},Reference:function(e){try{return Promise.resolve({address:e.address,type:e.type})}catch(e){return Promise.reject(e)}},Array:function(e,n,r){try{return Promise.resolve(Promise.all(e.map(function(e){return new Promise(function(t){try{return Promise.resolve(wn(e,n,[].concat(r,[e.type]))).then(t)}catch(e){return Promise.reject(e)}})})))}catch(e){return Promise.reject(e)}},Dictionary:function(e,n,r){try{return Promise.resolve(e.reduce(function(e,t){return Promise.resolve(e).then(function(o){return e=o,Promise.resolve(wn(t.key,n,[].concat(r,[t.key]))).then(function(o){return Promise.resolve(wn(t.value,n,[].concat(r,[t.key]))).then(function(n){return e[o]=n,e})})})},Promise.resolve({})))}catch(e){return Promise.reject(e)}},Event:bn,Resource:bn,Struct:bn,Enum:bn,Type:function(e){try{return Promise.resolve(e.staticType)}catch(e){return Promise.reject(e)}},Path:function(e){try{return Promise.resolve({domain:e.domain,identifier:e.identifier})}catch(e){return Promise.reject(e)}},Capability:function(e){try{return Promise.resolve({path:e.path,address:e.address,borrowType:e.borrowType})}catch(e){return Promise.reject(e)}}},In=function(e,n){var r=Object.keys(e).find(function(e){return/^\/.*\/$/.test(e)?new RegExp(e.substring(1,e.length-1)).test(n):e===n});return n&&r&&e[r]},wn=function(e,n,r){try{var t=In(n,e.type);if(!t)throw new Error("Undefined Decoder Error: "+e.type+"@"+r.join("."));return Promise.resolve(t(e.value,n,r))}catch(e){return Promise.reject(e)}},Sn=function(e,n,r){void 0===n&&(n={}),void 0===r&&(r=[]);var t=a({},Pn,n);return Promise.resolve(wn(e,t,r))},An=function(e,n){void 0===n&&(n={});try{var r,t=a({},Pn,n),o=e.encodedData?Promise.resolve(Sn(e.encodedData,t)).then(function(e){return r=1,e}):e.transactionStatus?Promise.resolve(Promise.all(e.transactionStatus.events.map(function(e){try{var n=e.eventIndex,r=e.transactionIndex,o=e.transactionId,i=e.type;return Promise.resolve(Sn(e.payload,t)).then(function(e){return{type:i,transactionId:o,transactionIndex:r,eventIndex:n,data:e}})}catch(e){return Promise.reject(e)}}))).then(function(n){var t=a({},e.transactionStatus,{events:n});return r=1,t}):e.transaction?(r=1,e.transaction):e.events?Promise.resolve(Promise.all(e.events.map(function(e){try{var n=e.eventIndex,r=e.transactionIndex,o=e.transactionId,i=e.type,u=e.blockTimestamp,a=e.blockHeight,c=e.blockId;return Promise.resolve(Sn(e.payload,t)).then(function(e){return{blockId:c,blockHeight:a,blockTimestamp:u,type:i,transactionId:o,transactionIndex:r,eventIndex:n,data:e}})}catch(e){return Promise.reject(e)}}))).then(function(e){return r=1,e}):e.account?(r=1,e.account):e.block?(r=1,e.block):e.blockHeader?(r=1,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;"),r=1,e.latestBlock):e.transactionId?(r=1,e.transactionId):e.collection?(r=1,e.collection):void 0;return Promise.resolve(o&&o.then?o.then(function(e){return r?e:null}):r?o:null)}catch(e){return Promise.reject(e)}},En=function(e){try{var n=function(){if(He(e)||qe(e)){var n=function(){return r.invariant(Nn(t),"Cadence needs to be a string at this point."),Promise.resolve(L().where(/^0x/).then(function(e){return Object.entries(e).reduce(function(e,n){var r=n[1],t=new RegExp("(\\b"+n[0]+"\\b)","g");return e.replace(t,r)},t)})).then(function(n){e.message.cadence=n})},t=sn(e,"ix.cadence");r.invariant(Tn(t)||Nn(t),"Cadence needs to be a function or a string.");var o=function(){if(Tn(t))return Promise.resolve(t({})).then(function(e){t=e})}();return o&&o.then?o.then(n):n()}}();return Promise.resolve(n&&n.then?n.then(function(){return e}):e)}catch(e){return Promise.reject(e)}},Tn=function(e){return"function"==typeof e},Nn=function(e){return"string"==typeof e};const Bn="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function On(e,n,r){if(!e.s){if(r instanceof xn){if(!r.s)return void(r.o=On.bind(null,e,n));1&n&&(n=r.s),r=r.v}if(r&&r.then)return void r.then(On.bind(null,e,n),On.bind(null,e,2));e.s=n,e.v=r;var t=e.o;t&&t(e)}}var xn=function(){function e(){}return e.prototype.then=function(n,r){var t=new e,o=this.s;if(o){var i=1&o?n:r;if(i){try{On(t,1,i(this.v))}catch(e){On(t,2,e)}return t}return this}return this.o=function(e){try{var o=e.v;1&e.s?On(t,1,n?n(o):o):r?On(t,1,r(o)):On(t,2,o)}catch(e){On(t,2,e)}},t},e}();function jn(e){return e instanceof xn&&1&e.s}var Gn,Cn=function(e){try{var n=function(){if(He(e)||qe(e)){var n=function(e,n,r){if("function"==typeof e[Bn]){var t,o,i,u=e[Bn]();if(function e(r){try{for(;!(t=u.next()).done;)if((r=n(t.value))&&r.then){if(!jn(r))return void r.then(e,i||(i=On.bind(null,o=new xn,2)));r=r.v}o?On(o,1,r):o=r}catch(e){On(o||(o=new xn),2,e)}}(),u.return){var a=function(e){try{t.done||u.return()}catch(e){}return e};if(o&&o.then)return o.then(a,function(e){throw a(e)});a()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var c=[],s=0;s<e.length;s++)c.push(e[s]);return function(e,n,r){var t,o,i=-1;return function r(u){try{for(;++i<e.length;)if((u=n(i))&&u.then){if(!jn(u))return void u.then(r,o||(o=On.bind(null,t=new xn,2)));u=u.v}t?On(t,1,u):t=u}catch(e){On(t||(t=new xn),2,e)}}(),t}(c,function(e){return n(c[e])})}(Object.entries(e.arguments),function(n){var t=n[0];return Promise.resolve(_n(n[1])).then(function(n){var o;e.arguments[t].asArgument=(r.invariant(null!=typeof(o=n).xform,"No type specified for argument: "+o.value),Ln(o.xform)?o.xform(o.value):Ln(o.xform.asArgument)?o.xform.asArgument(o.value):void r.invariant(!1,"Invalid Argument",o))})});if(n&&n.then)return n.then(function(){})}}();return Promise.resolve(n&&n.then?n.then(function(){return e}):e)}catch(e){return Promise.reject(e)}},_n=function e(n,t){void 0===t&&(t=3);try{return r.invariant(t>0,"Argument Resolve Recursion Limit Exceeded for Arg: "+n.tempId),Ln(n.resolveArgument)?Promise.resolve(n.resolveArgument()).then(function(n){return e(n,t-1)}):Promise.resolve(n)}catch(e){return Promise.reject(e)}},Ln=function(e){return"function"==typeof e},Rn=function(e){return zn(Jn(Vn(e)))},Kn=function(e){return zn(Jn(Wn(e)))},Fn=function(e,n){return t.Buffer.from(e.padStart(2*n,0),"hex")},Dn=(Gn=t.Buffer.from("FLOW-V0.0-transaction").toString("hex"),t.Buffer.from(Gn.padEnd(64,0),"hex")).toString("hex"),zn=function(e){return Dn+e},Un=function(e){return Fn(e,8)},qn=function(e){return Fn(e,32)},Hn=function(e){return t.Buffer.from(JSON.stringify(e),"utf8")},Mn=function(e){return t.Buffer.from(e,"utf8")},Yn=function(e){return t.Buffer.from(e,"hex")},Jn=function(e){return t.encode(e).toString("hex")},Vn=function(e){return Qn(e),[Mn(e.cadence),e.arguments.map(Hn),qn(e.refBlock),e.computeLimit,Un(e.proposalKey.address),e.proposalKey.keyId,e.proposalKey.sequenceNum,Un(e.payer),e.authorizers.map(Un)]},Wn=function(e){return Xn(e),[Vn(e),$n(e)]},$n=function(e){var n=Zn(e);return e.payloadSigs.map(function(e){return{signerIndex:n.get(e.address),keyId:e.keyId,sig:e.sig}}).sort(function(e,n){return e.signerIndex>n.signerIndex?1:e.signerIndex<n.signerIndex?-1:e.keyId>n.keyId?1:e.keyId<n.keyId?-1:void 0}).map(function(e){return[e.signerIndex,e.keyId,Yn(e.sig)]})},Zn=function(e){var n=new Map,r=0,t=function(e){n.has(e)||(n.set(e,r),r++)};return t(e.proposalKey.address),t(e.payer),e.authorizers.forEach(t),n},Qn=function(e){or.forEach(function(n){return lr(e,n)}),ir.forEach(function(n){return lr(e.proposalKey,n,"proposalKey")})},Xn=function(e){ur.forEach(function(n){return lr(e,n)}),e.payloadSigs.forEach(function(e,n){ar.forEach(function(r){return lr(e,r,"payloadSigs",n)})})},er=function(e){return"number"==typeof e},nr=function(e){return"string"==typeof e},rr=function(e){return null!==e&&"object"==typeof e},tr=function(e){return rr(e)&&e instanceof Array},or=[{name:"cadence",check:nr},{name:"arguments",check:tr},{name:"refBlock",check:nr,defaultVal:"0"},{name:"computeLimit",check:er},{name:"proposalKey",check:rr},{name:"payer",check:nr},{name:"authorizers",check:tr}],ir=[{name:"address",check:nr},{name:"keyId",check:er},{name:"sequenceNum",check:er}],ur=[{name:"payloadSigs",check:tr}],ar=[{name:"address",check:nr},{name:"keyId",check:er},{name:"sig",check:nr}],cr=[{name:"envelopeSigs",check:tr}],sr=[{name:"address",check:nr},{name:"keyId",check:er},{name:"sig",check:nr}],lr=function(e,n,r,t){var o=n.name,i=n.check,u=n.defaultVal;if(null==e[o]&&null!=u&&(e[o]=u),null==e[o])throw dr(o,r,t);if(!i(e[o]))throw mr(o,r,t)},fr=function(e,n,r){return n?null==r?n+"."+e:n+"."+r+"."+e:e},dr=function(e,n,r){return new Error("Missing field "+fr(e,n,r))},mr=function(e,n,r){return new Error("Invalid field "+fr(e,n,r))};function pr(e){var n=new Set(e.authorizations);return n.add(e.proposer),Array.isArray(e.payer)?e.payer.forEach(function(e){return n.delete(e)}):n.delete(e.payer),Array.from(n)}function hr(e){var n=new Set(Array.isArray(e.payer)?e.payer:[e.payer]);return Array.from(n)}var vr=function(e){return{cadence:e.message.cadence,refBlock:e.message.refBlock||null,computeLimit:e.message.computeLimit,arguments:e.message.arguments.map(function(n){return e.arguments[n].asArgument}),proposalKey:{address:o.withPrefix(e.accounts[e.proposer].addr),keyId:e.accounts[e.proposer].keyId,sequenceNum:e.accounts[e.proposer].sequenceNum},payer:o.withPrefix(e.accounts[Array.isArray(e.payer)?e.payer[0]:e.payer].addr),authorizers:(n=e.authorizations.map(function(n){return o.withPrefix(e.accounts[n].addr)}).reduce(function(e,n){return e.find(function(e){return e===n})?e:[].concat(e,[n])},[]),n[0]?n:[]),payloadSigs:pr(e).map(function(n){return{address:o.withPrefix(e.accounts[n].addr),keyId:e.accounts[n].keyId,sig:e.accounts[n].signature}}),envelopeSigs:hr(e).map(function(n){return{address:o.withPrefix(e.accounts[n].addr),keyId:e.accounts[n].keyId,sig:e.accounts[n].signature}})};var n},yr="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function gr(e,n,r){if(!e.s){if(r instanceof kr){if(!r.s)return void(r.o=gr.bind(null,e,n));1&n&&(n=r.s),r=r.v}if(r&&r.then)return void r.then(gr.bind(null,e,n),gr.bind(null,e,2));e.s=n,e.v=r;var t=e.o;t&&t(e)}}var kr=function(){function e(){}return e.prototype.then=function(n,r){var t=new e,o=this.s;if(o){var i=1&o?n:r;if(i){try{gr(t,1,i(this.v))}catch(e){gr(t,2,e)}return t}return this}return this.o=function(e){try{var o=e.v;1&e.s?gr(t,1,n?n(o):o):r?gr(t,1,r(o)):gr(t,2,o)}catch(e){gr(t,2,e)}},t},e}();function br(e){return e instanceof kr&&1&e.s}var Pr=function(e){try{var n=function(){if(He(e))return Array.isArray(e.payer)||console.warn('\n %cFCL Warning\n ============================\n "ix.payer" must be an array. Support for ix.payer as a singular is deprecated,\n see changelog for more info.\n ============================\n ',"font-weight:bold;font-family:monospace;"),function(n,r){try{var t=Promise.resolve(Ir(e,Object.values(e.accounts))).then(function(){return Promise.resolve(Ir(e,Object.values(e.accounts))).then(function(){})})}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}(0,function(e){throw console.error("=== SAD PANDA ===\n\n",e,"\n\n=== SAD PANDA ==="),e})}();return Promise.resolve(n&&n.then?n.then(function(n){return e}):e)}catch(e){return Promise.reject(e)}},Ir=function e(n,t,o,i){void 0===i&&(i=3);try{var u=function(e){o&&(n.authorizations=n.authorizations.map(function(e){return e===o.tempId?a:e}).reduce(function(e,n){return Array.isArray(n)?[].concat(e,n):[].concat(e,[n])},[]))};r.invariant(i,"Account Resolve Recursion Limit Exceeded",{ix:n,accounts:t});var a=[],c=function(e,n,r){if("function"==typeof e[yr]){var t,o,i,u=e[yr]();if(function e(r){try{for(;!(t=u.next()).done;)if((r=n(t.value))&&r.then){if(!br(r))return void r.then(e,i||(i=gr.bind(null,o=new kr,2)));r=r.v}o?gr(o,1,r):o=r}catch(e){gr(o||(o=new kr),2,e)}}(),u.return){var a=function(e){try{t.done||u.return()}catch(e){}return e};if(o&&o.then)return o.then(a,function(e){throw a(e)});a()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var c=[],s=0;s<e.length;s++)c.push(e[s]);return function(e,n,r){var t,o,i=-1;return function r(u){try{for(;++i<e.length;)if((u=n(i))&&u.then){if(!br(u))return void u.then(r,o||(o=gr.bind(null,t=new kr,2)));u=u.v}t?gr(t,1,u):t=u}catch(e){gr(t||(t=new kr),2,e)}}(),t}(c,function(e){return n(c[e])})}(t,function(r){function t(){function t(e){u.tempId!=r.tempId&&delete n.accounts[u.tempId]}var c=function(){if(Array.isArray(r))return Promise.resolve(e(n,r,u,i-1)).then(function(){});if(null!=r.addr&&null!=r.keyId&&(r.tempId=r.addr+"-"+r.keyId),n.accounts[r.tempId]=n.accounts[r.tempId]||r,n.accounts[r.tempId].role.proposer=n.accounts[r.tempId].role.proposer||r.role.proposer,n.accounts[r.tempId].role.payer=n.accounts[r.tempId].role.payer||r.role.payer,n.accounts[r.tempId].role.authorizer=n.accounts[r.tempId].role.authorizer||r.role.authorizer,n.accounts[r.tempId].role.proposer&&n.proposer===u.tempId&&(n.proposer=r.tempId),n.accounts[r.tempId].role.payer&&(n.payer=Array.isArray(n.payer)?Array.from(new Set([].concat(n.payer,[r.tempId]).map(function(e){return e===u.tempId?r.tempId:e}))):Array.from(new Set([n.payer,r.tempId].map(function(e){return e===u.tempId?r.tempId:e}))),n.payer.length>1)){var t=[],c=[];if(n.payer=n.payer.reduce(function(e,r){var o=n.accounts[r],i=o.addr,u=i+"-"+o.keyId;return c.push(i),t.includes(u)?e:(t.push(u),[].concat(e,[r]))},[]),Array.from(new Set(c)).length>1)throw new Error("Payer can not be different accounts")}n.accounts[r.tempId].role.authorizer&&(o?a=Array.from(new Set([].concat(a,[r.tempId]))):n.authorizations=n.authorizations.map(function(e){return e===u.tempId?r.tempId:e}))}();return c&&c.then?c.then(t):t()}var u=o||r,c=function(){if(wr(r.resolve))return Promise.resolve(r.resolve(r,function(e,n){try{return{f_type:"PreSignable",f_vsn:"1.0.1",roles:e.role,cadence:n.message.cadence,args:n.message.arguments.map(function(e){return n.arguments[e].asArgument}),data:{},interaction:n,voucher:vr(n)}}catch(e){throw console.error("buildPreSignable",e),e}}(r,n))).then(function(e){r=e})}();return c&&c.then?c.then(t):t()});return Promise.resolve(c&&c.then?c.then(u):u())}catch(e){return Promise.reject(e)}},wr=function(e){return"function"==typeof e},Sr=function(e){try{var n=function(){if(He(e))return function(n,r){try{var t=(o=pr(e),i=Rn(Er(e)),Promise.resolve(Promise.all(o.map(Ar(e,i)))).then(function(){var n=hr(e),r=Kn(a({},Er(e),{payloadSigs:o.map(function(n){return{address:e.accounts[n].addr,keyId:e.accounts[n].keyId,sig:e.accounts[n].signature}})}));return Promise.resolve(Promise.all(n.map(Ar(e,r)))).then(function(){})}))}catch(e){return r(e)}var o,i;return t&&t.then?t.then(void 0,r):t}(0,function(n){throw console.error("Signatures",n,{ix:e}),n})}();return Promise.resolve(n&&n.then?n.then(function(n){return e}):e)}catch(e){return Promise.reject(e)}};function Ar(e,n){return function(r){try{var t=e.accounts[r];return null!=t.signature?Promise.resolve():Promise.resolve(t.signingFunction(function(e,n,r){try{return{f_type:"Signable",f_vsn:"1.0.1",message:n,addr:o.sansPrefix(e.addr),keyId:e.keyId,roles:e.role,cadence:r.message.cadence,args:r.message.arguments.map(function(e){return r.arguments[e].asArgument}),data:{},interaction:r,voucher:vr(r)}}catch(e){throw console.error("buildSignable",e),e}}(t,n,e))).then(function(n){e.accounts[r].signature=n.signature})}catch(e){return Promise.reject(e)}}}function Er(e){var n=o.sansPrefix((Array.isArray(e.payer)?e.accounts[e.payer[0]]:e.accounts[e.payer]).addr);return{cadence:e.message.cadence,refBlock:e.message.refBlock||null,computeLimit:e.message.computeLimit,arguments:e.message.arguments.map(function(n){return e.arguments[n].asArgument}),proposalKey:{address:o.sansPrefix(e.accounts[e.proposer].addr),keyId:e.accounts[e.proposer].keyId,sequenceNum:e.accounts[e.proposer].sequenceNum},payer:n,authorizers:e.authorizations.map(function(n){return o.sansPrefix(e.accounts[n].addr)}).reduce(function(e,n){return e.find(function(e){return e===n})?e:[].concat(e,[n])},[])}}var Tr=function(e){try{var n=sn(e,"ix.validators",[]);return Promise.resolve(an(e,n.map(function(e){return function(n){return e(n,{Ok:Ie,Bad:we})}})))}catch(e){return Promise.reject(e)}},Nr=function(e){try{for(var n=0,r=Object.keys(e.accounts);n<r.length;n++){var t=r[n];e.accounts[t].addr=o.sansPrefix(e.accounts[t].addr)}return Promise.resolve(e)}catch(e){return Promise.reject(e)}},Br=function(e){try{var n=sn(e,"ix.voucher-intercept"),r=function(){if(be(n))return Promise.resolve(n(vr(e))).then(function(){})}();return Promise.resolve(r&&r.then?r.then(function(){return e}):e)}catch(e){return Promise.reject(e)}},Or=function(e){return e},xr=function(e,n){return void 0===n&&(n=Or),function(r){try{var t=function(e){return["\nAccounts:",{proposer:e.proposer,authorizations:e.authorizations,payer:e.payer},"\n\nDetails:",e.accounts].filter(Boolean)},o=function(){var n;(n=console).log.apply(n,["debug["+e+"] ---\n"].concat([].slice.call(arguments),["\n\n\n---"]))};return Promise.resolve(L.get("debug."+e)).then(function(e){var i=function(){if(e)return Promise.resolve(n(r,o,t)).then(function(){})}();return i&&i.then?i.then(function(){return r}):r})}catch(e){return Promise.reject(e)}}},jr=an([En,xr("cadence",function(e,n){return n(e.message.cadence)}),Cn,xr("arguments",function(e,n){return n(e.message.arguments,e.message)}),Pr,xr("accounts",function(e,n,r){return n.apply(void 0,r(e))}),function(e){try{var n=function(){if(He(e)&&null==e.message.refBlock)return Promise.resolve(L().get("accessNode.api")).then(function(n){return Promise.resolve(L.first(["sdk.transport","sdk.send"])).then(function(o){return r.invariant(o,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(o(pn([vn()]),{config:L,response:hn,Buffer:t.Buffer,ix:mn},{node:n}).then(An)).then(function(n){e.message.refBlock=n.id})})})}();return Promise.resolve(n&&n.then?n.then(function(){return e}):e)}catch(e){return Promise.reject(e)}},function(e){try{var n=function(){if(He(e)){var n=Object.values(e.accounts).find(function(e){return e.role.proposer});r.invariant(n,"Transactions require a proposer");var o=function(){if(null==n.sequenceNum)return Promise.resolve(L().get("accessNode.api")).then(function(o){return Promise.resolve(L.first(["sdk.transport","sdk.send"])).then(function(i){return r.invariant(i,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(pn([yn(n.addr)])).then(function(r){return Promise.resolve(i(r,{config:L,response:hn,Buffer:t.Buffer,ix:mn},{node:o}).then(An).then(function(e){return e.keys}).then(function(e){return e.find(function(e){return e.index===n.keyId})}).then(function(e){return e.sequenceNumber})).then(function(r){e.accounts[n.tempId].sequenceNum=r})})})})}();if(o&&o.then)return o.then(function(){})}}();return Promise.resolve(n&&n.then?n.then(function(){return e}):e)}catch(e){return Promise.reject(e)}},Sr,xr("signatures",function(e,n,r){return n.apply(void 0,r(e))}),Nr,Tr,Br,xr("resolved",function(e,n){return n(e)})]);function Gr(){var e=[].slice.call(arguments);if(e.length>1){var n=e,r=n[0],t=n[1];return Gr(function(e,n){var o=n.Bad;return r?(0,n.Ok)(e):o(e,t)})}var o=e[0];return function(e){return o(e,{Ok:Ie,Bad:we})}}var Cr=function(e,n){void 0===e&&(e=[]),void 0===n&&(n={});try{return Promise.resolve(L.first(["sdk.transport","sdk.send"],n.send)).then(function(r){return Gr(r,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(L.first(["sdk.resolve"],n.resolve||jr)).then(function(o){function i(i){return n.node=i,Array.isArray(e)&&(e=an(de(),e)),Promise.resolve(o(e)).then(function(e){return r(e,{config:L,response:hn,ix:mn,Buffer:t.Buffer},n)})}var u=n.node;return u?i(u):Promise.resolve(L().get("accessNode.api")).then(i)})})}catch(e){return Promise.reject(e)}},_r=function(e){var n,r;function t(n){var r,t=("\n Encode Message From Signable Error: Unable to determine message encoding for signer addresss: "+n+". \n Please ensure the address: "+n+" is intended to sign the given transaction as specified by the transaction signable.\n ").trim();return(r=e.call(this,t)||this).name="Unable To Determine Message Encoding For Signer Addresss",r}return r=e,(n=t).prototype=Object.create(r.prototype),n.prototype.constructor=n,s(n,r),t}(d(Error));function Lr(e){return fn("ix.validators",function(n){return Array.isArray(n)?n.push(e):[e]})}function Rr(e){return an([function(n){return n.block.height=e,n},Lr(function(e){if("boolean"==typeof e.block.isSealed)throw new Error("Unable to specify both block height and isSealed.");if(e.block.id)throw new Error("Unable to specify both block height and block id.");return e})])}function Kr(e){return an([function(n){return n.block.id=e,Ie(n)},Lr(function(e,n){var r=n.Ok,t=n.Bad;return Je(e)?t(e,"Unable to specify a block id with a Get Account interaction."):"boolean"==typeof e.block.isSealed?t(e,"Unable to specify both block id and isSealed."):e.block.height?t(e,"Unable to specify both block id and block height."):r(e)})])}function Fr(e){return an([function(n){return n.message.refBlock=e,Ie(n)}])}var Dr=[],zr=function(e){return e},Ur=["tempId"];function qr(e){return["SIGNATURE",e.addr,e.keyId].join(".")}function Hr(e){return void 0===e&&(e={}),function(n){var r=a({},n,e,{signingFunction:e.signingFunction||n.signingFunction||function(e){return{addr:r.addr,keyId:r.keyId,signature:qr(r)}}});return r}}var Mr={proposer:!1,authorizer:!1,payer:!1},Yr={__proto__:null,mockSend:function(e){return void 0===e&&(e=zr),function(n){return Promise.resolve(n).then(function(t){switch(n=t,!0){case Je(n):return function(e,n){return void 0===n&&(n=5),r.invariant(e.account,"mockAccountResponse(ix) -- ix.account is missing",e),r.invariant(e.account.addr,"mockAccountResponse(ix) -- ix.account.addr is missing",e),{account:{addr:e.account.addr,keys:Array.from({length:n},function(e,n){return{index:n,sequenceNumber:42}})}}}(n);case Xe(n):return{tag:"GET_BLOCK",block:{id:"32"}};default:return e(n)}})}},authzFn:Hr,authzResolve:function(e){return void 0===e&&(e={}),function(n){return a({},n,{tempId:e.tempId||"WITH_RESOLVE",resolve:Hr(function(e,n){if(null==e)return{};var r,t,o={},i=Object.keys(e);for(t=0;t<i.length;t++)n.indexOf(r=i[t])>=0||(o[r]=e[r]);return o}(e,Ur))})}},authzResolveMany:function(e){return void 0===e&&(e={}),function(n){return a({},n,{tempId:e.tempId||"AUTHZ_RESOLVE_MANY",resolve:function(){return[e.proposer&&Hr(e.proposer)({role:a({},Mr,{proposer:!0})})].concat(e.authorizations.map(Hr).map(function(e){return e({role:a({},Mr,{authorizer:!0})})}),[e.payer&&Hr(e.payer)({role:a({},Mr,{payer:!0})})]).filter(Boolean)}})}},sig:qr,idof:function(e){return e.addr+"-"+e.keyId},run:function(e){return void 0===e&&(e=[]),pn([Fr("123")].concat(e)).then(jr)}};Object.defineProperty(e,"cadence",{enumerable:!0,get:function(){return u.template}}),Object.defineProperty(e,"cdc",{enumerable:!0,get:function(){return u.template}}),e.TestUtils=Yr,e.VERSION="0.0.57-multisig.0",e.account=function(e,n,t){var o=void 0===n?{}:n,i=o.height,u=o.id;return r.invariant(!(u&&i),'Method: account -- Cannot pass "id" and "height" simultaneously'),u?Cr([yn(e),Kr(u)],t).then(An):i?Cr([yn(e),Rr(i)],t).then(An):Cr([yn(e)],t).then(An)},e.arg=function(e,n){return{value:e,xform:n}},e.args=function(e){return void 0===e&&(e=[]),an(e.map(Ee))},e.atBlockHeight=Rr,e.atBlockId=Kr,e.authorization=function(e,n,r,t){return{addr:e,signingFunction:n,keyId:r,sequenceNum:t}},e.authorizations=function(e){return void 0===e&&(e=[]),an(e.map(function(e){return Ae(e,{role:ue})}))},e.block=function(e,n){var t=void 0===e?{}:e,o=t.sealed,i=void 0!==o&&o,u=t.id,a=t.height;return void 0===n&&(n={}),r.invariant(!(i&&u||i&&a),'Method: block -- Cannot pass "sealed" with "id" or "height"'),r.invariant(!(u&&a),'Method: block -- Cannot pass "id" and "height" simultaneously'),u?Cr([vn(),Kr(u)],n).then(An):a?Cr([vn(),Rr(a)],n).then(An):Cr([vn(i)],n).then(An)},e.build=pn,e.config=L,e.createSignableVoucher=vr,e.decode=function(e){try{return Promise.resolve(L().where(/^decoder\./)).then(function(n){var r=Object.entries(n).map(function(e){var n=e[0],r=e[1];return[n="/"+n.replace(/^decoder\./,"")+"$/",r]});return An(e,Object.fromEntries(r))})}catch(e){return Promise.reject(e)}},e.destroy=dn,e.encodeMessageFromSignable=function(e,n){var r,t,i=(r=e.voucher,(t=new Set(r.authorizers)).add(r.proposalKey.address),t.delete(r.payer),Array.from(t).map(o.withPrefix)),u=function(e){var n=new Set([e.payer]);return Array.from(n).map(o.withPrefix)}(e.voucher),c=i.includes(o.withPrefix(n)),s=u.includes(o.withPrefix(n));if(!c&&!s)throw new _r(n);var l={cadence:e.voucher.cadence,refBlock:e.voucher.refBlock,computeLimit:e.voucher.computeLimit,arguments:e.voucher.arguments,proposalKey:a({},e.voucher.proposalKey,{address:o.sansPrefix(e.voucher.proposalKey.address)}),payer:o.sansPrefix(e.voucher.payer),authorizers:e.voucher.authorizers.map(o.sansPrefix),payloadSigs:e.voucher.payloadSigs.map(function(e){return a({},e,{address:o.sansPrefix(e.address)})})};return c?Rn(l):Kn(l)},e.get=sn,e.getAccount=yn,e.getBlock=vn,e.getBlockByHeight=function(e){return console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getBlockByHeight builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0003-deprecate-get-block-by-height-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),an([Le,function(n){return n.block.height=e,Ie(n)}])},e.getBlockById=function(e){return console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getBlockById builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0004-deprecate-get-block-by-id-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),an([_e,function(n){return n.block.ids=[e],Ie(n)}])},e.getBlockHeader=function(e){return void 0===e&&(e=null),an([Fe,function(n){return n.block.isSealed=e,Ie(n)}])},e.getCollection=function(e){return void 0===e&&(e=null),an([De,function(n){return n.collection.id=e,n}])},e.getEvents=function(e,n,r){return void 0===n&&void 0===r||console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n \n Passing a start and end into getEnvents has been deprecated and will not be supported in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0005-deprecate-start-end-get-events-builder\n \n ============================\n ","font-weight:bold;font-family:monospace;"),an([Ge,function(t){return t.events.eventType=e,t.events.start=n,t.events.end=r,Ie(t)}])},e.getEventsAtBlockHeightRange=function(e,n,r){return an([Ge,function(t){return t.events.eventType=e,t.events.start=n,t.events.end=r,Ie(t)}])},e.getEventsAtBlockIds=function(e,n){return void 0===n&&(n=[]),an([Ge,function(r){return r.events.eventType=e,r.events.blockIds=n,Ie(r)}])},e.getLatestBlock=function(e){return void 0===e&&(e=!1),console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The getLatestBlock builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0006-deprecate-get-latest-block-builder\n\n ============================\n ","font-weight:bold;font-family:monospace;"),an([Ce,function(n){return n.block.isSealed=e,Ie(n)}])},e.getTransaction=function(e){return an([xe,function(n){return n.transaction.id=e,Ie(n)}])},e.getTransactionStatus=function(e){return an([Oe,function(n){return n.transaction.id=e,Ie(n)}])},e.interaction=de,e.invariant=Gr,e.isBad=tn,e.isGetAccount=Je,e.isGetBlock=Xe,e.isGetBlockByHeight=Ze,e.isGetBlockById=$e,e.isGetBlockHeader=en,e.isGetCollection=nn,e.isGetEvents=Ve,e.isGetLatestBlock=We,e.isGetTransaction=Ye,e.isGetTransactionStatus=Me,e.isOk=rn,e.isPing=Qe,e.isScript=qe,e.isTransaction=He,e.isUnknown=Ue,e.latestBlock=function(e,n){return console.warn('\n %cFCL/SDK Deprecation Notice\n ============================\n \n "latestBlock()" is deprecated, please use "block()" for this and future versions of FCL\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0008-deprecate-latest-block-method\n \n ============================\n ',"font-weight:bold;font-family:monospace;"),Cr([vn(e)],n).then(An)},e.limit=function(e){return function(n){return n.message.computeLimit=e,n}},e.param=function(e){return n={name:"param",transitionsPath:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params"},void console.warn("\n %cFCL/SDK Deprecation Notice\n ============================\n The "+n.name+" builder has been deprecated and will be removed in future versions of the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: "+n.transitionsPath+"\n ============================\n ","font-weight:bold;font-family:monospace;");var n},e.params=function(e){return n={name:"params",transitionsPath:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params"},void console.error("\n %cFCL/SDK Deprecation Notice\n ============================\n The "+n.name+" builder has been removed from the Flow JS-SDK/FCL.\n You can learn more (including a guide on common transition paths) here: "+n.transitionsPath+"\n ============================\n ","font-weight:bold;font-family:monospace;");var n},e.payer=function(e){try{return Promise.resolve(Ae(e,{role:ae}))}catch(e){return Promise.reject(e)}},e.ping=function(){return Re},e.pipe=an,e.proposer=function(e){try{return Promise.resolve(Ae(e,{role:ce}))}catch(e){return Promise.reject(e)}},e.put=ln,e.ref=Fr,e.resolve=jr,e.resolveAccounts=Pr,e.resolveArguments=Cn,e.resolveCadence=En,e.resolveFinalNormalization=Nr,e.resolveProposerSequenceNumber=function(e){var n=e.node;return function(e){try{return He(e)?e.accounts[e.proposer].sequenceNum?Promise.resolve(Ie(e)):Promise.resolve(L.first(["sdk.transport","sdk.send"])).then(function(o){return r.invariant(o,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(pn([yn(e.accounts[e.proposer].addr)])).then(function(r){return Promise.resolve(o(r,{config:L,response:hn,Buffer:t.Buffer,ix:mn},{node:n})).then(function(n){return Promise.resolve(An(n)).then(function(n){return e.accounts[e.proposer].sequenceNum=n.keys[e.accounts[e.proposer].keyId].sequenceNumber,Ie(e)})})})}):Promise.resolve(Ie(e))}catch(e){return Promise.reject(e)}}},e.resolveRefBlockId=function(e){return function(e){try{return He(e)?e.message.refBlock?Promise.resolve(Ie(e)):Promise.resolve(function(e){try{return Promise.resolve(L().get("accessNode.api")).then(function(e){return Promise.resolve(L.first(["sdk.transport","sdk.send"])).then(function(n){var o;return r.invariant(n,"Required value for sdk.transport is not defined in config. See: https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"),Promise.resolve(an(de(),[vn()])).then(function(r){return o=r,Promise.resolve(n(o,{config:L,response:hn,Buffer:t.Buffer,ix:mn},{node:e})).then(function(e){return o=e,Promise.resolve(An(o)).then(function(e){return(o=e).id})})})})})}catch(e){return Promise.reject(e)}}()).then(function(n){return e.message.refBlock=n,Ie(e)}):Promise.resolve(Ie(e))}catch(e){return Promise.reject(e)}}},e.resolveSignatures=Sr,e.resolveValidators=Tr,e.resolveVoucherIntercept=Br,e.script=function(){return an([Ne,ln("ix.cadence",u.template.apply(void 0,[].slice.call(arguments)))])},e.send=Cr,e.transaction=function(){return an([Be,ln("ix.cadence",u.template.apply(void 0,[].slice.call(arguments))),function(e){return e.message.computeLimit=e.message.computeLimit||10,e.message.refBlock=e.message.refBlock||null,e.authorizations=e.authorizations||Dr,Ie(e)}])},e.update=fn,e.validator=Lr,e.voucherIntercept=function(e){return ln("ix.voucher-intercept",e)},e.voucherToTxId=function(e){return function(e){return n=Jn(function(e){!function(e){or.forEach(function(n){return lr(e,n)}),ir.forEach(function(n){return lr(e.proposalKey,n,"proposalKey")}),ur.forEach(function(n){return lr(e,n)}),e.payloadSigs.forEach(function(e,n){ar.forEach(function(r){return lr(e,r,"payloadSigs",n)})}),cr.forEach(function(n){return lr(e,n)}),e.envelopeSigs.forEach(function(e,n){sr.forEach(function(r){return lr(e,r,"envelopeSigs",n)})})}(e);var n=Zn(e),r=function(e){return e.map(function(e){var r=e.keyId,t=e.sig;return{signerIndex:n.get(e.address),keyId:r,sig:t}}).sort(function(e,n){return e.signerIndex>n.signerIndex?1:e.signerIndex<n.signerIndex?-1:e.keyId>n.keyId?1:e.keyId<n.keyId?-1:void 0}).map(function(e){return[e.signerIndex,e.keyId,Yn(e.sig)]})};return[[Mn(e.cadence),e.arguments.map(Hn),qn(e.refBlock),e.computeLimit,Un(o.sansPrefix(e.proposalKey.address)),e.proposalKey.keyId,e.proposalKey.sequenceNum,Un(o.sansPrefix(e.payer)),e.authorizers.map(function(e){return Un(o.sansPrefix(e))})],r(e.payloadSigs),r(e.envelopeSigs)]}(e)),(r=new i.SHA3(256)).update(t.Buffer.from(n,"hex")),r.digest().toString("hex");var n,r}(e)},e.why=on});
//# sourceMappingURL=sdk.umd.js.map
{
"name": "@onflow/sdk",
"version": "0.0.57-alpha.4",
"version": "0.0.57-multisig.0",
"description": "Flow SDK",

@@ -18,2 +18,5 @@ "license": "Apache-2.0",

".js": "jest-esm-transformer"
},
"globals": {
"MICROBUNDLE_CURRENT_VERSION": "TESTVERSION"
}

@@ -34,4 +37,4 @@ },

"test": "jest",
"build": "microbundle --define process.env.CURRENT_VERSION=\"$(node -e \"console.log(require('./package.json').version)\")\"",
"currentVersion": "node -e \"console.log(require('./package.json').version",
"build": "microbundle --define MICROBUNDLE_CURRENT_VERSION=$npm_package_version",
"currentVersion": "node -e MICROBUNDLE_CURRENT_VERSION=$npm_package_version",
"test:watch": "jest --watch",

@@ -41,3 +44,3 @@ "start": "microbundle watch"

"dependencies": {
"@onflow/rlp": "^0.0.3",
"@onflow/rlp": "^0.0.4-multisig.0",
"@onflow/util-actor": "0.0.2",

@@ -50,3 +53,3 @@ "@onflow/util-address": "^0.0.0",

},
"gitHead": "f843a85843363f14235447dbd5a3fc8468d571da"
"gitHead": "d70efd556f875139bde813b261fa537c2c4f0717"
}

@@ -0,7 +1,21 @@

import {atBlockHeight} from "../build/build-at-block-height.js"
import {atBlockId} from "../build/build-at-block-id.js"
import {getAccount} from "../build/build-get-account.js"
import {invariant} from "@onflow/util-invariant"
import {decodeResponse as decode} from "../decode/decode.js"
import {send} from "../send/send.js"
export function account(address, opts) {
export function account(address, {height, id} = {}, opts) {
invariant(
!(id && height),
`Method: account -- Cannot pass "id" and "height" simultaneously`
)
// Get account by ID
if (id) return send([getAccount(address), atBlockId(id)], opts).then(decode)
// Get account by height
if (height) return send([getAccount(address), atBlockHeight(height)], opts).then(decode)
return send([getAccount(address)], opts).then(decode)
}
import * as root from "./decode.js"
import {decode, decodeResponse} from "./decode.js"
import {Buffer} from "@onflow/rlp"

@@ -4,0 +5,0 @@ it("exported interface contract", () => {

import { SHA3 } from "sha3"
import { encode } from "@onflow/rlp"
import { encode, Buffer } from "@onflow/rlp"
import { sansPrefix } from "@onflow/util-address"

@@ -4,0 +4,0 @@

import {invariant} from "@onflow/util-invariant"
import {applyRenamings} from "../utils/deprecate"

@@ -86,3 +87,3 @@ export const UNKNOWN /* */ = "UNKNOWN"

"authorizations":[],
"payer":null,
"payer":[],
"events": {

@@ -112,4 +113,20 @@ "eventType":null,

export const interaction = () => JSON.parse(IX)
// Current field, followed by renaming
// addr => address
const PROP_DEPRECATIONS = new Map([
["addr", "address"],
["sequenceNum", "seqNum"],
["keyId", "keyIndex"]
])
export const interaction = () => {
const ix = JSON.parse(IX)
const account = applyRenamings(ix.account, PROP_DEPRECATIONS)
return {
...ix,
account
}
}
const CHARS = "abcdefghijklmnopqrstuvwxyz0123456789".split("")

@@ -153,3 +170,4 @@ const randChar = () => CHARS[~~(Math.random() * CHARS.length)]

const ACCOUNT = JSON.parse(ACCT)
const ACCOUNT = applyRenamings(JSON.parse(ACCT), PROP_DEPRECATIONS)
const role = opts.role

@@ -174,2 +192,4 @@ const tempId = uuid()

ix.authorizations.push(tempId)
} else if (role === PAYER) {
ix.payer.push(tempId)
} else {

@@ -176,0 +196,0 @@ ix[role] = tempId

@@ -37,3 +37,3 @@ import {config, TestUtils} from "../../sdk"

expect(ix.proposer).toBe(TestUtils.idof(S1a))
expect(ix.payer).toBe(TestUtils.idof(S1a))
expect(ix.payer).toEqual([TestUtils.idof(S1a)])
expect(ix.authorizations).toEqual([TestUtils.idof(S1a)])

@@ -64,3 +64,3 @@ }

expect(ix.proposer).toBe(TestUtils.idof(S1a))
expect(ix.payer).toBe(TestUtils.idof(S1a))
expect(ix.payer).toEqual([TestUtils.idof(S1a)])
expect(ix.authorizations).toEqual([

@@ -96,3 +96,3 @@ TestUtils.idof(S1a),

expect(ix.authorizations).toEqual([TestUtils.idof(S2a)])
expect(ix.payer).toBe(TestUtils.idof(S3a))
expect(ix.payer).toEqual([TestUtils.idof(S3a)])
}

@@ -128,3 +128,3 @@ )

expect(ix.proposer).toBe(TestUtils.idof(S1a))
expect(ix.payer).toBe(TestUtils.idof(S1a))
expect(ix.payer).toEqual([TestUtils.idof(S1a)])

@@ -166,3 +166,3 @@ expect(ix.authorizations.length).toBe(1)

expect(ix.proposer).toBe(TestUtils.idof(S1a))
expect(ix.payer).toBe(TestUtils.idof(S2a))
expect(ix.payer).toEqual([TestUtils.idof(S2a)])

@@ -169,0 +169,0 @@ expect(ix.authorizations.length).toBe(3)

@@ -50,4 +50,31 @@ import {invariant} from "@onflow/util-invariant"

if (ix.accounts[ax.tempId].role.payer && ix.payer === old.tempId) {
ix.payer = ax.tempId
if (ix.accounts[ax.tempId].role.payer) {
if (Array.isArray(ix.payer)) {
ix.payer = Array.from(new Set([...ix.payer, ax.tempId].map(d =>
d === old.tempId ? ax.tempId : d
)))
} else {
ix.payer = Array.from(new Set([ix.payer, ax.tempId].map(d =>
d === old.tempId ? ax.tempId : d
)))
}
if (ix.payer.length > 1) {
// remove payer dups based on addr and keyId
const dupList = []
const payerAccts = []
ix.payer = ix.payer.reduce((g, tempId) => {
const { addr, keyId } = ix.accounts[tempId];
const key = `${addr}-${keyId}`;
payerAccts.push(addr)
if (dupList.includes(key)) return g;
dupList.push(key)
return [...g, tempId]
}, [])
const multiAccts = Array.from(new Set(payerAccts))
if (multiAccts.length > 1) {
throw new Error(
"Payer can not be different accounts"
)
}
}
}

@@ -64,7 +91,2 @@

)
// if (!new Set(ix.authorizations).has(ax.tempId)) {
// ix.authorizations = Array.from(
// new Set([...ix.authorizations, ax.tempId])
// )
// }
}

@@ -90,2 +112,14 @@ }

if (isTransaction(ix)) {
if (!Array.isArray(ix.payer)) {
console.warn(
`
%cFCL Warning
============================
"ix.payer" must be an array. Support for ix.payer as a singular is deprecated,
see changelog for more info.
============================
`,
"font-weight:bold;font-family:monospace;"
)
}
try {

@@ -92,0 +126,0 @@ await collectAccounts(ix, Object.values(ix.accounts))

@@ -10,22 +10,5 @@ import {

authorizations,
authorization,
} from "../sdk.js"
import {buildPreSignable} from "./resolve-accounts"
import { buildPreSignable } from "./resolve-accounts"
const IX = {
proposer: "ba1132bc08f82fe2|1",
authorizations: ["ba1132bc08f82fe2|1"],
payer: "f086a545ce3c552d|18",
message: {
cadence: "",
refBlock: "123",
computeLimit: 156,
proposer: null,
payer: null,
authorizations: [],
params: [],
arguments: [],
},
}
test("Voucher in PreSignable", async () => {

@@ -46,2 +29,3 @@ const authz = {

addr: "0x02",
tempId: "payerAcct",
signingFunction: () => ({signature: "123"}),

@@ -72,1 +56,110 @@ keyId: 0,

})
test("Voucher in PreSignable multiple payer keys", async () => {
const authz = {
addr: "0x01",
tempId: "0x01-1",
signingFunction: () => ({ signature: "123" }),
keyId: 1,
sequenceNum: 123,
}
const authzPayer = {
addr: "0x02",
address: "0x02",
resolve: (account, preSignable) => [{
...account,
tempId: "0x02-0",
addr: "0x02",
keyId: 0,
sequenceNum: 123,
signingFunction: (signable) => ({ signature: "123", addr: "0x02", keyId: 0 }),
resolve: null,
}, {
...account,
tempId: "0x02-1",
addr: "0x02",
keyId: 1,
sequenceNum: 123,
signingFunction: (signable) => ({ signature: "333", addr: "0x02", keyId: 1 }),
resolve: null,
}]
}
const built = await build([
transaction``,
limit(156),
proposer(authz),
authorizations([authz]),
payer(authzPayer),
ref("123"),
]);
const ix = await resolve(built)
expect(ix.payer).toEqual(["0x02-0", "0x02-1"])
const ps = buildPreSignable(ix.accounts[ix.proposer], ix)
expect(ps.voucher).toEqual({
cadence: "",
refBlock: "123",
computeLimit: 156,
arguments: [],
proposalKey: { address: "0x01", keyId: 1, sequenceNum: 123 },
payer: "0x02",
authorizers: ["0x01"],
payloadSigs: [
{ address: "0x01", keyId: 1, sig: "123" },
{ address: "0x01", keyId: 1, sig: "123" },
],
envelopeSigs: [
{ address: "0x02", keyId: 0, sig: "123" },
{ address: "0x02", keyId: 1, sig: "333" }
],
})
})
test("Voucher in PreSignable multiple payer keys different accounts", async () => {
const authz = {
addr: "0x01",
tempId: "0x01-1",
signingFunction: () => ({ signature: "123" }),
keyId: 1,
sequenceNum: 123,
}
const authzPayer = {
addr: "0x02",
address: "0x02",
resolve: (account, preSignable) => [{
...account,
tempId: "0x02-0",
addr: "0x02",
keyId: 0,
sequenceNum: 123,
signingFunction: (signable) => ({ signature: "123", addr: "0x02", keyId: 0 }),
resolve: null,
}, {
...account,
tempId: "0x01-1",
addr: "0x01",
keyId: 1,
sequenceNum: 123,
signingFunction: (signable) => ({ signature: "333", addr: "0x02", keyId: 1 }),
resolve: null,
}]
}
const built = await build([
transaction``,
limit(156),
proposer(authz),
authorizations([authz]),
payer(authzPayer),
ref("123"),
]);
await expect(resolve(built)).rejects.toThrow()
})

@@ -9,2 +9,3 @@ import {isTransaction, Ok} from "../interaction/interaction.js"

import {invariant} from "@onflow/util-invariant"
import {Buffer} from "@onflow/rlp"

@@ -28,3 +29,3 @@ export const resolveProposerSequenceNumber = ({ node }) => async (ix) => {

]),
{config, response: responseModule, ix: ixModule},
{config, response: responseModule, Buffer, ix: ixModule},
{node}

@@ -31,0 +32,0 @@ )

@@ -8,2 +8,3 @@ import {isTransaction, Ok, interaction, pipe} from "../interaction/interaction.js"

import {invariant} from "@onflow/util-invariant"
import {Buffer} from "@onflow/rlp"

@@ -25,3 +26,3 @@ async function getRefId (opts) {

ix,
{config, response, ix: ixModule},
{config, response, Buffer, ix: ixModule},
{node}

@@ -28,0 +29,0 @@ )

@@ -45,5 +45,2 @@ import {isTransaction} from "../interaction/interaction.js"

)
// if (!acct.role.proposer) {
// ix.accounts[id].keyId = keyId
// }
ix.accounts[id].signature = signature

@@ -75,2 +72,5 @@ }

function prepForEncoding(ix) {
const payerAddress = sansPrefix((Array.isArray(ix.payer)
? ix.accounts[ix.payer[0]]
: ix.accounts[ix.payer]).addr);
return {

@@ -86,3 +86,3 @@ cadence: ix.message.cadence,

},
payer: sansPrefix(ix.accounts[ix.payer].addr),
payer: payerAddress,
authorizers: ix.authorizations

@@ -89,0 +89,0 @@ .map(cid => sansPrefix(ix.accounts[cid].addr))

import {pipe, isTransaction} from "../interaction/interaction.js"
import {config} from "../config"
import {invariant} from "@onflow/util-invariant"
import {Buffer} from "@onflow/rlp"
import * as ixModule from "../interaction/interaction.js"

@@ -79,3 +80,3 @@ import {response} from "../response/response.js"

build([getBlock()]),
{config, response, ix: ixModule},
{config, response, Buffer, ix: ixModule},
{node}

@@ -103,3 +104,3 @@ ).then(decode)

await build([getAccount(acct.addr)]),
{config, response, ix: ixModule},
{config, response, Buffer, ix: ixModule},
{node}

@@ -106,0 +107,0 @@ )

@@ -8,3 +8,7 @@ import {withPrefix} from "@onflow/util-address"

inside.add(ix.proposer)
inside.delete(ix.payer)
if (Array.isArray(ix.payer)) {
ix.payer.forEach(p => inside.delete(p));
} else {
inside.delete(ix.payer)
}
return Array.from(inside)

@@ -15,3 +19,3 @@ }

// Outside Signers Are: (payer)
let outside = new Set([ix.payer])
let outside = new Set(Array.isArray(ix.payer) ? ix.payer : [ix.payer])
return Array.from(outside)

@@ -37,3 +41,3 @@ }

const buildOutsideSigners = () =>
const buildOutsideSigners = () =>
findOutsideSigners(ix).map(id => ({

@@ -55,3 +59,3 @@ address: withPrefix(ix.accounts[id].addr),

},
payer: withPrefix(ix.accounts[ix.payer].addr),
payer: withPrefix(ix.accounts[Array.isArray(ix.payer) ? ix.payer[0] : ix.payer].addr),
authorizers: buildAuthorizers(),

@@ -58,0 +62,0 @@ payloadSigs: buildInsideSigners(),

@@ -0,1 +1,2 @@

import {Buffer} from "@onflow/rlp"
import {interaction, pipe} from "../interaction/interaction.js"

@@ -27,3 +28,3 @@ import * as ixModule from "../interaction/interaction.js"

if (Array.isArray(args)) args = pipe(interaction(), args)
return sendFn(await resolveFn(args), {config, response, ix: ixModule}, opts)
return sendFn(await resolveFn(args), {config, response, ix: ixModule, Buffer}, opts)
}

@@ -0,1 +1,3 @@

import {logger, LOGGER_LEVELS} from "./logger"
const buildWarningMessage = ({name, transitionsPath}) => {

@@ -37,1 +39,28 @@ console.warn(

}
const getByValue = (map, searchValue) => {
for (let [key, value] of map.entries()) {
if (value === searchValue) return key;
}
}
// Allows access to old and new field names while showing deprecation warning for old
export const applyRenamings = (originalObject, deprecationsMap) => {
return new Proxy(originalObject, {
get: (obj, property) => {
if (getByValue(deprecationsMap, property)) {
const originalProperty = getByValue(deprecationsMap, property)
return Reflect.get(obj, originalProperty)
}
if (deprecationsMap.has(property)) {
logger(
"FCL/SDK Deprecation Notice",
`"${property}" will be deprecated in a future version.
Please use "${deprecationsMap.get(property)}" instead.`,
LOGGER_LEVELS.warn
)
}
return Reflect.get(obj, property)
}
})
}

@@ -1,1 +0,1 @@

export const VERSION = process.env.CURRENT_VERSION || "TESTVERSION"
export const VERSION = MICROBUNDLE_CURRENT_VERSION || "TESTVERSION"

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc