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
165
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.2 to 0.0.57-alpha.3

LICENSE

7

CHANGELOG.md

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

## Unreleased
## 0.0.57-alpha.3 -- 2022-02-02
- 2022-02-03 -- [@gregsantos](https://github.com/gregsantos): Rename `preSendCheck` to `voucherIntercept` and expose.
- 2022-01-31 -- [@chasefleming](https://github.com/chasefleming): Fix SDK circular dependency in `src/block.js` file.
## 0.0.57-alpha.1 -- 2022-01-21

@@ -2,0 +9,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"),W=M("SCRIPT"),V=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:W,isTransaction:V,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)}},We=function(n){try{var r=function(){if(V(n)||W(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(Ve(t)||Je(t),"Cadence needs to be a function or a string.");var o=function(){if(Ve(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)}},Ve=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(V(n)||W(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(V(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(V(e))return function(n,r){try{var t=(o=Ln(e),i=on(Vn(e)),Promise.resolve(Promise.all(o.map(Wn(e,i)))).then(function(){var n=Rn(e),r=un(u({},Vn(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(Wn(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 Wn(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 Vn(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){return e},Qn=function(e,n){return void 0===n&&(n=Zn),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)}}},Xn=le([We,Qn("cadence",function(e,n){return n(e.message.cadence)}),nn,Qn("arguments",function(e,n){return n(e.message.arguments,e.message)}),Hn,Qn("accounts",function(e,n,r){return n.apply(void 0,r(e))}),function(n){try{var r=function(){if(V(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(V(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,Qn("signatures",function(e,n,r){return n.apply(void 0,r(e))}),$n,Jn,function(e){try{var n=de(e,"ix.pre-send-check"),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("resolved",function(e,n){return n(e)})]);function er(){var e=[].slice.call(arguments);if(e.length>1){var n=e,r=n[0],t=n[1];return er(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 nr=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 er(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||Xn)).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)}},rr=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 tr(e){return me("ix.validators",function(n){return Array.isArray(n)?n.push(e):[e]})}function or(e){return le([function(n){return n.block.height=e,n},tr(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 le([function(n){return n.block.id=e,E(n)},tr(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 ur(e){return le([function(n){return n.message.refBlock=e,E(n)}])}var cr=[],sr=function(e){return e},ar=["tempId"];function lr(e){return["SIGNATURE",e.addr,e.keyId].join(".")}function fr(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:lr(r)}}});return r}}var dr={proposer:!1,authorizer:!1,payer:!1},pr={__proto__:null,mockSend:function(n){return void 0===n&&(n=sr),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:fr,authzResolve:function(e){return void 0===e&&(e={}),function(n){return u({},n,{tempId:e.tempId||"WITH_RESOLVE",resolve:fr(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,ar))})}},authzResolveMany:function(e){return void 0===e&&(e={}),function(n){return u({},n,{tempId:e.tempId||"AUTHZ_RESOLVE_MANY",resolve:function(){return[e.proposer&&fr(e.proposer)({role:u({},dr,{proposer:!0})})].concat(e.authorizations.map(fr).map(function(e){return e({role:u({},dr,{authorizer:!0})})}),[e.payer&&fr(e.payer)({role:u({},dr,{payer:!0})})]).filter(Boolean)}})}},sig:lr,idof:function(e){return e.addr+"-"+e.keyId},run:function(e){return void 0===e&&(e=[]),ge([ur("123")].concat(e)).then(Xn)}};Object.defineProperty(exports,"cadence",{enumerable:!0,get:function(){return i.template}}),Object.defineProperty(exports,"cdc",{enumerable:!0,get:function(){return i.template}}),exports.TestUtils=pr,exports.VERSION="0.0.57-alpha.2",exports.account=function(e,n){return nr([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=or,exports.atBlockId=ir,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?nr([Re(),ir(u)],r).then(Ye):c?nr([Re(),or(c)],r).then(Ye):nr([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 rr(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=er,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=W,exports.isTransaction=V,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;"),nr([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=ur,exports.resolve=Xn,exports.resolveAccounts=Hn,exports.resolveArguments=nn,exports.resolveCadence=We,exports.resolveFinalNormalization=$n,exports.resolveProposerSequenceNumber=function(n){var r=n.node;return function(n){try{return V(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 V(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.script=function(){return le([G,pe("ix.cadence",i.template.apply(void 0,[].slice.call(arguments)))])},exports.send=nr,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||cr,E(e)}])},exports.update=me,exports.validator=tr,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=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.3",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;
//# 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 a,subscriber as o}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),S=e=>n=>(n.tag=e,A(n)),v=(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 a=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}'),o=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({},a,{tempId:s},n,{role:d({},a.role,"object"==typeof n.role?n.role:{},{[o]:!0})}),"authorizer"===o?r.authorizations.push(s):r[o]=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=S("UNKNOWN"),G=S("SCRIPT"),_=S("TRANSACTION"),B=S("GET_TRANSACTION_STATUS"),L=S("GET_TRANSACTION"),x=S("GET_ACCOUNT"),R=S("GET_EVENTS"),K=S("GET_LATEST_BLOCK"),D=S("GET_BLOCK_BY_ID"),F=S("GET_BLOCK_BY_HEIGHT"),U=S("PING"),z=S("GET_BLOCK"),P=S("GET_BLOCK_HEADER"),j=S("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"),ae=e=>"OK"===e.status,oe=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),oe(e))throw new Error(`Interaction Error: ${e.reason}`);if(!n.length)return e;const[t,...r]=n,a=await t;if(T(a))return ce(a(e),r);if(w(a)||!a)return ce(e,r);if(E(a))return ce(a,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:v,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:ae,isBad:oe,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 a(he,ye,{key:e,value:n}),_e()}function Ee(e,n){return a(he,ke,{key:e,fallback:n},{expectReply:!0,timeout:10})}async function Ae(e=[],n){if(!e.length)return n;const[t,...r]=e,a=await Ee(t);return null==a?Ae(r,n):a}function Ne(){return a(he,"GET_ALL_CONFIG",null,{expectReply:!0,timeout:10})}function Se(e,n=be){return a(he,"UPDATE_CONFIG",{key:e,fn:n}),_e()}function ve(e){return a(he,"DELETE_CONFIG",{key:e}),_e()}function Oe(e){return a(he,"WHERE_CONFIG",{pattern:e},{expectReply:!0,timeout:10})}function Ce(e){return o(he,()=>n(we,he),e)}function Ge(){return a(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:Se,delete:ve,where:Oe,subscribe:Ce,overload:Le}}n(we,he),_e.put=Te,_e.get=Ee,_e.all=Ne,_e.first=Ae,_e.update=Se,_e.delete=ve,_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 a=await Ne();try{_e(e);var o=await n(await Ne());await Ge(),await _e(a),t(o)}catch(e){await Ge(),await _e(a),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({})),a=e.id&&Pe(n,e.id);return a?await a(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 a;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"),a=await ie(f(),[Re()]),a=await r(a,{config:_e,response:xe,ix:fe},{node:t}),(a=await $e(a)).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=>an(dn(pn(e))),en=e=>an(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 an=e=>tn+e,on=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,on(e.proposalKey.address),e.proposalKey.keyId,e.proposalKey.sequenceNum,on(e.payer),e.authorizers.map(on)]),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}],Sn=[{name:"envelopeSigs",check:wn}],vn=[{name:"address",check:In},{name:"keyId",check:kn},{name:"sig",check:In}],On=(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 Gn(a,t,r);if(!o(e[a]))throw _n(a,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))}),Sn.forEach(n=>On(e,n)),e.envelopeSigs.forEach((e,n)=>{vn.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,on(s(e.proposalKey.address)),e.proposalKey.keyId,e.proposalKey.sequenceNum,on(s(e.payer)),e.authorizers.map(e=>on(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,a=3){e(a,"Account Resolve Recursion Limit Exceeded",{ix:n,accounts:t});let o=[];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,a-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?o=Array.from(new Set([...o,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?o: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 a=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,a)))}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:a}=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=a}}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}const $n=e=>e,qn=(e,n=$n)=>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),Mn=ie([We,qn("cadence",(e,n)=>n(e.message.cadence)),Qe,qn("arguments",(e,n)=>n(e.message.arguments,e.message)),Fn,qn("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"),a=await _e.first(["sdk.transport","sdk.send"]);e(a,"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 a(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,qn("signatures",(e,n,t)=>n(...t(e))),Hn,jn,async function(e){const n=le(e,"ix.pre-send-check");return T(n)&&await n(xn(e)),e},qn("resolved",(e,n)=>n(e))]);function Yn(...e){if(e.length>1){const[n,t]=e;return Yn((e,{Ok:r,Bad:a})=>n?r(e):a(e,t))}const[n]=e;return e=>n(e,{Ok:A,Bad:N})}const Wn=async(e=[],n={})=>{const t=await _e.first(["sdk.transport","sdk.send"],n.send),r=await _e.first(["sdk.resolve"],n.resolve||Mn);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 Jn(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 Vn 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 Zn=(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 a=t.includes(c(n)),o=r.includes(c(n));if(!a&&!o)throw new Vn(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 a?Xe(i):en(i)};function Qn(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;"),Wn([Re(e)],n).then($e)}function Xn(e,n){return Wn([Ke(e)],n).then($e)}function et({sealed:n=!1,id:t,height:r}={},a={}){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?Wn([Re(),ot(t)],a).then($e):r?Wn([Re(),at(r)],a).then($e):Wn([Re(n)],a).then($e)}function nt(e=[]){return ie(e.map(e=>v(e,{role:"authorizer"})))}function tt(e,n,t,r){return{addr:e,signingFunction:n,keyId:t,sequenceNum:r}}function rt(e){return pe("ix.validators",n=>Array.isArray(n)?n.push(e):[e])}function at(e){return ie([n=>(n.block.height=e,n),rt(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 ot(e){return ie([n=>(n.block.id=e,A(n)),rt((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 st(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 ct(e,n,t){return ie([R,r=>(r.events.eventType=e,r.events.start=n,r.events.end=t,A(r))])}function it(e,n=[]){return ie([R,t=>(t.events.eventType=e,t.events.blockIds=n,A(t))])}function ut(e=null){return ie([P,n=>(n.block.isSealed=e,A(n))])}function lt(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 dt(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 pt(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 mt(e=null){return ie([j,n=>(n.collection.id=e,n)])}function ft(e){return ie([B,n=>(n.transaction.id=e,A(n))])}function gt(e){return ie([L,n=>(n.transaction.id=e,A(n))])}function ht(e){return n=>(n.message.computeLimit=e,n)}function yt(e=[]){return ie(e.map(O))}function kt(e,n){return{value:e,xform:n}}async function It(e){return v(e,{role:"proposer"})}async function bt(e){return v(e,{role:"payer"})}function wt(){return U}function Tt(e){return ie([n=>(n.message.refBlock=e,A(n))])}function Et(...e){return ie([G,de("ix.cadence",l(...e))])}const At=[];function Nt(...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||At,A(e))])}const St=({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 a=await r(await ge([Ke(t.accounts[t.proposer].addr)]),{config:_e,response:xe,ix:fe},{node:n}),o=await $e(a);return t.accounts[t.proposer].sequenceNum=o.keys[t.accounts[t.proposer].keyId].sequenceNumber,A(t)},vt=e=>e,Ot=["tempId"];function Ct(e){return["SIGNATURE",e.addr,e.keyId].join(".")}function Gt(e={}){return function(n){const t=d({},n,e,{signingFunction:e.signingFunction||n.signingFunction||function(e){return{addr:t.addr,keyId:t.keyId,signature:Ct(t)}}});return t}}const _t={proposer:!1,authorizer:!1,payer:!1};var Bt={__proto__:null,mockSend:function(n=vt){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:Gt,authzResolve:function(e={}){return function(n){const{tempId:t}=e;return d({},n,{tempId:t||"WITH_RESOLVE",resolve:Gt(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,Ot))})}},authzResolveMany:function(e={}){return function(n){return d({},n,{tempId:e.tempId||"AUTHZ_RESOLVE_MANY",resolve:()=>[e.proposer&&Gt(e.proposer)({role:d({},_t,{proposer:!0})}),...e.authorizations.map(Gt).map(e=>e({role:d({},_t,{authorizer:!0})})),e.payer&&Gt(e.payer)({role:d({},_t,{payer:!0})})].filter(Boolean)})}},sig:Ct,idof:e=>`${e.addr}-${e.keyId}`,run:(e=[])=>ge([Tt("123"),...e]).then(Mn)};const Lt="0.0.57-alpha.2",xt=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"})},Rt=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{Bt as TestUtils,Lt as VERSION,Xn as account,kt as arg,yt as args,at as atBlockHeight,ot as atBlockId,tt as authorization,nt as authorizations,et as block,ge as build,_e as config,xn as createSignableVoucher,Jn as decode,me as destroy,Zn as encodeMessageFromSignable,le as get,Ke as getAccount,Re as getBlock,pt as getBlockByHeight,dt as getBlockById,ut as getBlockHeader,mt as getCollection,st as getEvents,ct as getEventsAtBlockHeightRange,it as getEventsAtBlockIds,lt as getLatestBlock,gt as getTransaction,ft as getTransactionStatus,f as interaction,Yn as invariant,oe 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,ae as isOk,ee as isPing,q as isScript,M as isTransaction,$ as isUnknown,Qn as latestBlock,ht as limit,Rt as param,xt as params,bt as payer,wt as ping,ie as pipe,It as proposer,de as put,Tt as ref,Mn as resolve,Fn as resolveAccounts,Qe as resolveArguments,We as resolveCadence,Hn as resolveFinalNormalization,St as resolveProposerSequenceNumber,qe as resolveRefBlockId,Un as resolveSignatures,jn as resolveValidators,Et as script,Wn as send,Nt as transaction,pe as update,rt as validator,Rn as voucherToTxId,se as why};
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.3",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};
//# 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){return e},ir=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(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)}}},ur=he([Xe,ir("cadence",function(e,n){return n(e.message.cadence)}),an,ir("arguments",function(e,n){return n(e.message.arguments,e.message)}),$n,ir("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,ir("signatures",function(e,n,r){return n.apply(void 0,r(e))}),tr,rr,function(e){try{var n=ge(e,"ix.pre-send-check"),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("resolved",function(e,n){return n(e)})]);function cr(){var e=[].slice.call(arguments);if(e.length>1){var n=e,r=n[0],t=n[1];return cr(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 ar=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 cr(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||ur)).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)}},sr=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)}},lr=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)),fr=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 lr(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 dr(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;"),ar([ze(e)],n).then(Ze)}function mr(e,n){return ar([He(e)],n).then(Ze)}function pr(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?ar([ze(),kr(u)],r).then(Ze):c?ar([ze(),yr(c)],r).then(Ze):ar([ze(i)],r).then(Ze)}function hr(e){return void 0===e&&(e=[]),he(e.map(function(e){return j(e,{role:"authorizer"})}))}function vr(e,n,r,t){return{addr:e,signingFunction:n,keyId:r,sequenceNum:t}}function gr(e){return ke("ix.validators",function(n){return Array.isArray(n)?n.push(e):[e]})}function yr(e){return he([function(n){return n.block.height=e,n},gr(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 he([function(n){return n.block.id=e,C(n)},gr(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 br(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 Ir(e,n,r){return he([z,function(t){return t.events.eventType=e,t.events.start=n,t.events.end=r,C(t)}])}function Pr(e,n){return void 0===n&&(n=[]),he([z,function(r){return r.events.eventType=e,r.events.blockIds=n,C(r)}])}function Tr(e){return void 0===e&&(e=null),he([J,function(n){return n.block.isSealed=e,C(n)}])}function Er(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 Sr(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 Ar(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 wr(e){return void 0===e&&(e=null),he([V,function(n){return n.collection.id=e,n}])}function Nr(e){return he([D,function(n){return n.transaction.id=e,C(n)}])}function Or(e){return he([F,function(n){return n.transaction.id=e,C(n)}])}function _r(e){return function(n){return n.message.computeLimit=e,n}}function Cr(e){return void 0===e&&(e=[]),he(e.map(L))}function Gr(e,n){return{value:e,xform:n}}var Br=function(e){try{return Promise.resolve(j(e,{role:"proposer"}))}catch(e){return Promise.reject(e)}},jr=function(e){try{return Promise.resolve(j(e,{role:"payer"}))}catch(e){return Promise.reject(e)}};function Lr(){return Y}function xr(e){return he([function(n){return n.message.refBlock=e,C(n)}])}function Rr(){return he([R,ye("ix.cadence",l.apply(void 0,[].slice.call(arguments)))])}var Kr=[];function Dr(){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||Kr,C(e)}])}var Fr=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)}}},Ur=function(e){return e},zr=["tempId"];function Hr(e){return["SIGNATURE",e.addr,e.keyId].join(".")}function Mr(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:Hr(r)}}});return r}}var qr={proposer:!1,authorizer:!1,payer:!1},Yr={__proto__:null,mockSend:function(n){return void 0===n&&(n=Ur),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:Mr,authzResolve:function(e){return void 0===e&&(e={}),function(n){return f({},n,{tempId:e.tempId||"WITH_RESOLVE",resolve:Mr(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,zr))})}},authzResolveMany:function(e){return void 0===e&&(e={}),function(n){return f({},n,{tempId:e.tempId||"AUTHZ_RESOLVE_MANY",resolve:function(){return[e.proposer&&Mr(e.proposer)({role:f({},qr,{proposer:!0})})].concat(e.authorizations.map(Mr).map(function(e){return e({role:f({},qr,{authorizer:!0})})}),[e.payer&&Mr(e.payer)({role:f({},qr,{payer:!0})})]).filter(Boolean)}})}},sig:Hr,idof:function(e){return e.addr+"-"+e.keyId},run:function(e){return void 0===e&&(e=[]),Pe([xr("123")].concat(e)).then(ur)}},Wr="0.0.57-alpha.2",Jr=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},Vr=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{Yr as TestUtils,Wr as VERSION,mr as account,Gr as arg,Cr as args,yr as atBlockHeight,kr as atBlockId,vr as authorization,hr as authorizations,pr as block,Pe as build,Ke as config,Mn as createSignableVoucher,sr as decode,be as destroy,fr as encodeMessageFromSignable,ge as get,He as getAccount,ze as getBlock,Ar as getBlockByHeight,Sr as getBlockById,Tr as getBlockHeader,wr as getCollection,br as getEvents,Ir as getEventsAtBlockHeightRange,Pr as getEventsAtBlockIds,Er as getLatestBlock,Or as getTransaction,Nr as getTransactionStatus,I as interaction,cr 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,dr as latestBlock,_r as limit,Vr as param,Jr as params,jr as payer,Lr as ping,he as pipe,Br as proposer,ye as put,xr as ref,ur as resolve,$n as resolveAccounts,an as resolveArguments,Xe as resolveCadence,tr as resolveFinalNormalization,Fr as resolveProposerSequenceNumber,Qe as resolveRefBlockId,Xn as resolveSignatures,rr as resolveValidators,Rr as script,ar as send,Dr as transaction,ke as update,gr as validator,qn as voucherToTxId,me as why};
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.3",$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};
//# 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){return e},Tr=function(e,n){return void 0===n&&(n=Ar),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)}}},Er=Ge([In,Tr("cadence",function(e,n){return n(e.message.cadence)}),Bn,Tr("arguments",function(e,n){return n(e.message.arguments,e.message)}),gr,Tr("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,Tr("signatures",function(e,n,r){return n.apply(void 0,r(e))}),Sr,wr,function(e){try{var n=_e(e,"ix.pre-send-check"),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("resolved",function(e,n){return n(e)})]);function Or(){var e=[].slice.call(arguments);if(e.length>1){var n=e,r=n[0],t=n[1];return Or(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 Nr=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 Or(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||Er)).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)}},Br=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 xr(e){return Re("ix.validators",function(n){return Array.isArray(n)?n.push(e):[e]})}function jr(e){return Ge([function(n){return n.block.height=e,n},xr(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 Ge([function(n){return n.block.id=e,W(n)},xr(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 Cr(e){return Ge([function(n){return n.message.refBlock=e,W(n)}])}var _r=[],Lr=function(e){return e},Rr=["tempId"];function Kr(e){return["SIGNATURE",e.addr,e.keyId].join(".")}function Fr(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:Kr(r)}}});return r}}var zr={proposer:!1,authorizer:!1,payer:!1},Dr={__proto__:null,mockSend:function(e){return void 0===e&&(e=Lr),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:Fr,authzResolve:function(e){return void 0===e&&(e={}),function(n){return c({},n,{tempId:e.tempId||"WITH_RESOLVE",resolve:Fr(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,Rr))})}},authzResolveMany:function(e){return void 0===e&&(e={}),function(n){return c({},n,{tempId:e.tempId||"AUTHZ_RESOLVE_MANY",resolve:function(){return[e.proposer&&Fr(e.proposer)({role:c({},zr,{proposer:!0})})].concat(e.authorizations.map(Fr).map(function(e){return e({role:c({},zr,{authorizer:!0})})}),[e.payer&&Fr(e.payer)({role:c({},zr,{payer:!0})})]).filter(Boolean)}})}},sig:Kr,idof:function(e){return e.addr+"-"+e.keyId},run:function(e){return void 0===e&&(e=[]),ze([Cr("123")].concat(e)).then(Er)}};Object.defineProperty(e,"cadence",{enumerable:!0,get:function(){return u.template}}),Object.defineProperty(e,"cdc",{enumerable:!0,get:function(){return u.template}}),e.TestUtils=Dr,e.VERSION="0.0.57-alpha.2",e.account=function(e,n){return Nr([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=jr,e.atBlockId=Gr,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?Nr([dn(),Gr(u)],r).then(Pn):c?Nr([dn(),jr(c)],r).then(Pn):Nr([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 Br(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=Or,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;"),Nr([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=Cr,e.resolve=Er,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.script=function(){return Ge([ne,Le("ix.cadence",u.template.apply(void 0,[].slice.call(arguments)))])},e.send=Nr,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||_r,W(e)}])},e.update=Re,e.validator=xr,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-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.3",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});
//# sourceMappingURL=sdk.umd.js.map
{
"name": "@onflow/sdk",
"version": "0.0.57-alpha.2",
"version": "0.0.57-alpha.3",
"description": "Flow SDK",

@@ -33,3 +33,4 @@ "license": "Apache-2.0",

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

@@ -46,3 +47,4 @@ "start": "microbundle watch"

"sha3": "^2.1.4"
}
},
"gitHead": "8b7f364ecbed509eeaf890d7af1cf42d680b9843"
}

@@ -359,3 +359,3 @@ ---

As an extension, it is possible to insert a pre-check process before sending a transaction. To do this, use `sdk.preSendCheck(...)`. This argument is an arbitrary async function that receives a voucher object containing information about the transaction before it is sent. Within this, you can call `sdk.voucherToTxId(voucher)` to get the txId. Furthermore, you can call any API to record this txId before sending the transaction. If an error is thrown in this, the transaction sending process will be aborted.
As an extension, it is possible to intercept the voucher before sending a transaction. To do this, use `sdk.voucherIntercept(...)`. This argument is an arbitrary async function that receives a voucher object containing information about the transaction before it is sent. Within this, you can call `sdk.voucherToTxId(voucher)` to get the txId. Furthermore, you can call any API to record this txId before sending the transaction. If an error is thrown in this, the transaction sending process will be aborted.

@@ -372,3 +372,3 @@ ```javascript

sdk.authorizations([sdk.authorization("01", signingFunction, 0)]),
sdk.preSendCheck(async voucher => {
sdk.voucherIntercept(async voucher => {
const txId = sdk.voucherToTxId(voucher)

@@ -462,3 +462,3 @@

sdk.authorizations([sdk.authorization("01", signingFunction, 0)]),
sdk.preSendCheck(async voucher => {}), // Optional
sdk.voucherIntercept(async voucher => {}), // Optional
]), [

@@ -472,3 +472,3 @@ sdk.resolve([

sdk.resolveSignatures,
sdk.resolvePreSendCheck, // Optional
sdk.resolveVoucherIntercept, // Optional
]),

@@ -517,3 +517,3 @@ ]), { node: "http://localhost:8080" })

- [`sdk.ping`](./src/build/build-ping.js)
- [`sdk.preSendCheck`](./src/build/build-pre-send-check.js)
- [`sdk.voucherIntercept`](./src/build/build-voucher-intercept.js)
- [`sdk.proposer`](./src/build/build-proposer.js)

@@ -530,3 +530,3 @@ - [`sdk.ref`](./src/build/build-ref.js)

- [`sdk.resolveFinalNormalization`](./src/resolve/resolve-final-normalization.js)
- [`sdk.resolvePreSendCheck`](./src/resolve/resolve-pre-send-check.js)
- [`sdk.resolveVoucherIntercept`](./src/resolve/resolve-voucher-intercept.js)
- [`sdk.resolveProposerSequenceNumber`](./src/resolve/resolve-proposer-sequence-number.js)

@@ -533,0 +533,0 @@ - [`sdk.resolveRefBlockId`](./src/resolve/resolve-ref-block-id.js)

import {send} from "../send/send.js"
import {getBlock} from "../build/build-get-block"
import {atBlockHeight} from "../build/build-at-block-height.js"
import {atBlockId} from "../build/build-at-block-id.js"
import {decodeResponse as decode} from "../decode/decode.js"
import {invariant} from "@onflow/util-invariant"
import {atBlockHeight, atBlockId} from "../sdk"

@@ -7,0 +8,0 @@ export function block({sealed = false, id, height} = {}, opts = {}) {

@@ -18,31 +18,33 @@ import {pipe, isTransaction} from "../interaction/interaction.js"

import {resolveFinalNormalization} from "./resolve-final-normalization.js"
import {resolvePreSendCheck} from "./resolve-pre-send-check.js"
import {resolveVoucherIntercept} from "./resolve-voucher-intercept.js"
const noop = v => v
const debug = (key, fn = noop) => async ix => {
const take = (obj, keys = []) => {
if (typeof keys === "string") keys = keys.split(" ")
keys.reduce((acc, key) => ({...acc, [key]: obj[key]}), {})
}
const debug =
(key, fn = noop) =>
async ix => {
const take = (obj, keys = []) => {
if (typeof keys === "string") keys = keys.split(" ")
keys.reduce((acc, key) => ({...acc, [key]: obj[key]}), {})
}
const accts = ix =>
[
"\nAccounts:",
{
proposer: ix.proposer,
authorizations: ix.authorizations,
payer: ix.payer,
},
"\n\nDetails:",
ix.accounts,
].filter(Boolean)
const accts = ix =>
[
"\nAccounts:",
{
proposer: ix.proposer,
authorizations: ix.authorizations,
payer: ix.payer,
},
"\n\nDetails:",
ix.accounts,
].filter(Boolean)
const log = (...msg) => {
console.log(`debug[${key}] ---\n`, ...msg, "\n\n\n---")
const log = (...msg) => {
console.log(`debug[${key}] ---\n`, ...msg, "\n\n\n---")
}
if (await config.get(`debug.${key}`)) await fn(ix, log, accts)
return ix
}
if (await config.get(`debug.${key}`)) await fn(ix, log, accts)
return ix
}
export const resolve = pipe([

@@ -61,3 +63,3 @@ resolveCadence,

resolveValidators,
resolvePreSendCheck,
resolveVoucherIntercept,
debug("resolved", (ix, log) => log(ix)),

@@ -69,12 +71,16 @@ ])

const node = await config().get("accessNode.api")
const sendFn = await config.first(
["sdk.transport", "sdk.send"]
)
const sendFn = await config.first(["sdk.transport", "sdk.send"])
invariant(
sendFn,
sendFn,
`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"}`
)
ix.message.refBlock = (await sendFn(build([getBlock()]), {config, response, ix: ixModule}, {node}).then(decode)).id
ix.message.refBlock = (
await sendFn(
build([getBlock()]),
{config, response, ix: ixModule},
{node}
).then(decode)
).id
}

@@ -90,8 +96,6 @@ return ix

const node = await config().get("accessNode.api")
const sendFn = await config.first(
["sdk.transport", "sdk.send"]
)
const sendFn = await config.first(["sdk.transport", "sdk.send"])
invariant(
sendFn,
sendFn,
`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"}`

@@ -98,0 +102,0 @@ )

@@ -70,3 +70,3 @@ import {deprecate} from "./utils"

export {invariant} from "./build/build-invariant.js"
// export {preSendCheck} from "./build/build-pre-send-check.js"
export {voucherIntercept} from "./build/build-voucher-intercept.js"

@@ -82,3 +82,3 @@ // Resolvers

export {resolveRefBlockId} from "./resolve/resolve-ref-block-id.js"
// export {resolvePreSendCheck} from "./resolve/resolve-pre-send-check.js"
export {resolveVoucherIntercept} from "./resolve/resolve-voucher-intercept.js"

@@ -85,0 +85,0 @@ // Config

import assert from "assert"
import fs from "fs"
import path from "path"
import {

@@ -14,4 +12,2 @@ build,

authorization,
params,
param,
VERSION,

@@ -21,6 +17,3 @@ } from "./sdk.js"

test("fcl.VERSION needs to match version in package.json", () => {
const pkg = JSON.parse(
fs.readFileSync(path.resolve(process.cwd(), "package.json"), "utf-8")
)
expect(pkg.version).toBe(VERSION)
expect(VERSION).toBe("TESTVERSION")
})

@@ -27,0 +20,0 @@

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

export const VERSION = "0.0.57-alpha.2"
export const VERSION = process.env.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