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

@onflow/sdk

Package Overview
Dependencies
Maintainers
14
Versions
166
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@onflow/sdk - npm Package Compare versions

Comparing version 1.0.0-alpha.0 to 1.0.0-alpha.1

23

CHANGELOG.md

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

## Unreleased
# @onflow/sdk
## 1.0.0-alpha.1
### Patch Changes
- [#1155](https://github.com/onflow/fcl-js/pull/1155) [`700433d5`](https://github.com/onflow/fcl-js/commit/700433d50d4156183b09b13781f7f74f23882586) Thanks [@caosbad](https://github.com/caosbad)! - Export encodeTransactionPayload, encodeTransactionEnvelope, and encodeTxIdFromVoucher from sdk.
* [#1153](https://github.com/onflow/fcl-js/pull/1153) [`6ff970df`](https://github.com/onflow/fcl-js/commit/6ff970dfc04281c86043e1cf8f5bceb633dc4186) Thanks [@lmcmz](https://github.com/lmcmz)! - Add sansPrefix for address before RLP encoding
- [#1129](https://github.com/onflow/fcl-js/pull/1129) [`7287ff14`](https://github.com/onflow/fcl-js/commit/7287ff14d20e19270ff345cd8b274ad5c8509eb7) Thanks [@JeffreyDoyle](https://github.com/JeffreyDoyle)! - Add blockId to GetTransactionStatus response
* [#1115](https://github.com/onflow/fcl-js/pull/1115) [`f7a985b3`](https://github.com/onflow/fcl-js/commit/f7a985b3cb64ed80c7354f97177ae7ef006530fe) Thanks [@JeffreyDoyle](https://github.com/JeffreyDoyle)! - **BREAKING** Remove deprecated block builders, interaction types and send methods.
* Updated dependencies [[`7287ff14`](https://github.com/onflow/fcl-js/commit/7287ff14d20e19270ff345cd8b274ad5c8509eb7), [`9c191c15`](https://github.com/onflow/fcl-js/commit/9c191c1520ee772b4343265a42ad0e995a92dd9a), [`de47af64`](https://github.com/onflow/fcl-js/commit/de47af647a5bdad154a2d83e2ea2260ab54f0c60), [`b2c95e77`](https://github.com/onflow/fcl-js/commit/b2c95e776a3bbfd769778e0bae767fdd69ba6143), [`828a7b2b`](https://github.com/onflow/fcl-js/commit/828a7b2b4babb6485218e67e49f3a8ba9d4488fd), [`f7a985b3`](https://github.com/onflow/fcl-js/commit/f7a985b3cb64ed80c7354f97177ae7ef006530fe)]:
- @onflow/transport-http@1.0.0-alpha.1
- @onflow/config@1.0.0-alpha.1
- @onflow/util-actor@1.0.0-alpha.1
## 1.0.0-alpha.0

@@ -174,3 +191,3 @@

```javascript
import {config} from "@onflow/sdk"
import {config} from "@onflow/config"

@@ -257,3 +274,3 @@ expect(await config.all()).toEqual({})

```javascript
import {config} from "@onflow/sdk"
import {config} from "@onflow/config"

@@ -260,0 +277,0 @@ config({

2

dist/sdk.js

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

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

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

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

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

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

@@ -42,5 +42,6 @@ "license": "Apache-2.0",

"dependencies": {
"@onflow/config": "^1.0.0-alpha.1",
"@onflow/rlp": "^1.0.0-alpha.0",
"@onflow/transport-http": "^1.0.0-alpha.0",
"@onflow/util-actor": "^1.0.0-alpha.0",
"@onflow/transport-http": "^1.0.0-alpha.1",
"@onflow/util-actor": "^1.0.0-alpha.1",
"@onflow/util-address": "^1.0.0-alpha.0",

@@ -47,0 +48,0 @@ "@onflow/util-invariant": "^1.0.0-alpha.0",

@@ -22,3 +22,3 @@ import * as root from "./sdk"

isOk isBad why pipe
getAccount getEvents getLatestBlock getTransactionStatus
getAccount getEvents getTransactionStatus
authorizations authorization

@@ -48,3 +48,3 @@ params param

put get update
makeGetAccount makeGetEvents makeGetLatestBlock
makeGetAccount makeGetEvents
makeGetTransactionStatus makePing

@@ -51,0 +51,0 @@ makeScript makeTransaction

import {decodeResponse} from "./decode.js"
import {config} from "../config"
import {config} from "@onflow/config"

@@ -4,0 +4,0 @@ export async function decode(response) {

@@ -45,7 +45,7 @@ import { SHA3 } from "sha3"

tx.computeLimit,
addressBuffer(tx.proposalKey.address),
addressBuffer(sansPrefix(tx.proposalKey.address)),
tx.proposalKey.keyId,
tx.proposalKey.sequenceNum,
addressBuffer(tx.payer),
tx.authorizers.map(addressBuffer),
addressBuffer(sansPrefix(tx.payer)),
tx.authorizers.map(authorizer => addressBuffer(sansPrefix(authorizer))),
]

@@ -52,0 +52,0 @@ }

@@ -10,7 +10,4 @@ import {invariant} from "@onflow/util-invariant"

export const GET_EVENTS /* */ = "GET_EVENTS"
export const GET_LATEST_BLOCK /* */ = "GET_LATEST_BLOCK"
export const PING /* */ = "PING"
export const GET_TRANSACTION /* */ = "GET_TRANSACTION"
export const GET_BLOCK_BY_ID /* */ = "GET_BLOCK_BY_ID"
export const GET_BLOCK_BY_HEIGHT /* */ = "GET_BLOCK_BY_HEIGHT"
export const GET_BLOCK /* */ = "GET_BLOCK"

@@ -221,5 +218,2 @@ export const GET_BLOCK_HEADER /* */ = "GET_BLOCK_HEADER"

export const makeGetEvents /* */ = makeIx(GET_EVENTS)
export const makeGetLatestBlock /* */ = makeIx(GET_LATEST_BLOCK)
export const makeGetBlockById /* */ = makeIx(GET_BLOCK_BY_ID)
export const makeGetBlockByHeight /* */ = makeIx(GET_BLOCK_BY_HEIGHT)
export const makePing /* */ = makeIx(PING)

@@ -239,5 +233,2 @@ export const makeGetBlock /* */ = makeIx(GET_BLOCK)

export const isGetEvents /* */ = is(GET_EVENTS)
export const isGetLatestBlock /* */ = is(GET_LATEST_BLOCK)
export const isGetBlockById /* */ = is(GET_BLOCK_BY_ID)
export const isGetBlockByHeight /* */ = is(GET_BLOCK_BY_HEIGHT)
export const isPing /* */ = is(PING)

@@ -305,2 +296,2 @@ export const isGetBlock /* */ = is(GET_BLOCK)

return Ok(ix)
}
}
import {isTransaction, isScript, get} from "../interaction/interaction.js"
import {invariant} from "@onflow/util-invariant"
import {config} from "../config"
import {config} from "@onflow/config"

@@ -5,0 +5,0 @@ const isFn = v => typeof v === "function"

import {interaction, pipe, put, makeScript} from "../interaction/interaction.js"
import {resolveCadence} from "./resolve-cadence.js"
import {config} from "../sdk.js"
import {config} from "@onflow/config"

@@ -5,0 +5,0 @@ const log = msg => ix => (console.log(msg, ix), ix)

import {isTransaction, Ok} from "../interaction/interaction.js"
import * as ixModule from "../interaction/interaction.js"
import {response as responseModule} from "../response/response.js"
import {config} from "../config"
import {config} from "@onflow/config"
import {decodeResponse} from "../decode/decode.js"

@@ -6,0 +6,0 @@ import {getAccount} from "../build/build-get-account.js"

import {isTransaction, Ok, interaction, pipe} from "../interaction/interaction.js"
import * as ixModule from "../interaction/interaction.js"
import {response} from "../response/response.js"
import {config} from "../config"
import {config} from "@onflow/config"
import {decodeResponse} from "../decode/decode.js"

@@ -6,0 +6,0 @@ import {getBlock} from "../build/build-get-block.js"

import {pipe, isTransaction} from "../interaction/interaction.js"
import {config} from "../config"
import {config} from "@onflow/config"
import {invariant} from "@onflow/util-invariant"

@@ -4,0 +4,0 @@ import {Buffer} from "@onflow/rlp"

@@ -38,3 +38,3 @@ # Response

- **tag** _(all)_ `int` -- a marker that represents the type of the response. See @onflow/interaction for information on the possible tag values.
- **transaction** _GetTransactionStatus_ -- The response from a GetTransactionStatus requrest.
- **transaction** _GetTransaction_ -- The response from a GetTransaction request.
- **script** `string` -- The Cadence code used to execute this transaction

@@ -59,3 +59,4 @@ - **args** `Array<string>` -- The arguments passed in to the transaction

- **signature** `string`-- The signature
- **transactionStatus** _GetTransactionStatus_ -- The response from a GetTransactionStatus requrest.
- **transactionStatus** _GetTransactionStatus_ -- The response from a GetTransactionStatus request.
- **blockId** `string` -- The ID of the Block the transaction is included in.
- **status** `int` -- The status of the transaction

@@ -118,9 +119,9 @@ - **statusCode** `int` -- The status code of the transaction

- **collectionId** `string` -- ID of the collection
- **signatures** `string` -- Signatures in the collection
- **DEPRECATED: signatures** `string` -- Signatures in the collection
- **blockSeals**
- **blockId** `string` -- ID of the block
- **executionReceiptId** `string` -- ID of the execution receipt
- **executionReceiptSignatures** `Array<string>` -- Execution receipt signatures
- **resultApprovalSignatures** `Array<string>` -- Result approval signatures
- **signatures** `Array<string>` -- Signatures included in this block
- **DEPRECATED: executionReceiptSignatures** `Array<string>` -- Execution receipt signatures
- **DEPRECATED: resultApprovalSignatures** `Array<string>` -- Result approval signatures
- **DEPRECATED: signatures** `Array<string>` -- Signatures included in this block
- **collection** _GetCollection_ -- The collection returned from a GetCollection request

@@ -127,0 +128,0 @@ - **id** `string` -- ID of the collection

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

export {decode} from "./decode/sdk-decode.js"
export {
encodeTransactionPayload,
encodeTransactionEnvelope,
encodeTxIdFromVoucher,
} from "./encode/encode"
// Utils

@@ -27,5 +31,2 @@ export {

isGetEvents,
isGetLatestBlock,
isGetBlockById,
isGetBlockByHeight,
isPing,

@@ -42,3 +43,2 @@ isGetBlock,

// Helpers
export {latestBlock} from "./latest-block/latest-block.js"
export {account} from "./account/account.js"

@@ -57,5 +57,2 @@ export {block} from "./block/block.js"

export {getBlockHeader} from "./build/build-get-block-header.js"
export {getLatestBlock} from "./build/build-get-latest-block.js"
export {getBlockById} from "./build/build-get-block-by-id.js"
export {getBlockByHeight} from "./build/build-get-block-by-height"
export {getCollection} from "./build/build-get-collection"

@@ -87,4 +84,3 @@ export {getTransactionStatus} from "./build/build-get-transaction-status.js"

// Config
export {config} from "./config"
export {config} from "@onflow/config"

@@ -91,0 +87,0 @@ // Deprecated

@@ -7,3 +7,3 @@ import {Buffer} from "@onflow/rlp"

import {response} from "../response/response.js"
import {config} from "../config"
import {config} from "@onflow/config"
import {resolve as defaultResolve} from "../resolve/resolve.js"

@@ -10,0 +10,0 @@

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