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

@onflow/fcl

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@onflow/fcl - npm Package Compare versions

Comparing version 0.0.56 to 0.0.57

@@ -5,2 +5,7 @@ ### Unreleased

### 0.0.57 -- 2020-09-29
- 2020-09-29 -- add a z-index value to service frame
- 2020-09-29 -- resolveParams -> resolveCadence
### 0.0.56 -- 2020-09-04

@@ -7,0 +12,0 @@

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

var e=require("@onflow/config"),r=require("@onflow/sdk"),t=require("@onflow/util-actor"),n=require("@onflow/types");e.config().put("accessNode.api","http://localhost:8080").put("challenge.handshake","http://localhost:8700/authenticate");var o,i,u=function(t){try{return Promise.resolve(e.config().get("accessNode.api")).then(function(e){return r.resolve(t,[r.resolveRefBlockId({node:e}),r.resolveParams,r.resolveArguments,r.resolveAccounts,r.resolveSignatures,r.resolveValidators])})}catch(e){return Promise.reject(e)}},s=function(t,n){void 0===t&&(t=[]),void 0===n&&(n={});try{var o=function(e){return n.node=e,Array.isArray(t)&&(t=r.build(t)),Promise.resolve(u(t)).then(function(e){return r.send(e,n)})},i=n.node;return Promise.resolve(i?o(i):Promise.resolve(e.config().get("accessNode.api")).then(o))}catch(e){return Promise.reject(e)}},c=function(t){try{return Promise.resolve(e.config().where(/^decoder\./)).then(function(e){var n=Object.fromEntries(Object.entries(e).map(function(e){var r=e[0],t=e[1];return[r="/"+r.replace(/^decoder\./,"")+"$/",t]}));return r.decodeResponse(t,n)})}catch(e){return Promise.reject(e)}},a=function(e){try{return Promise.resolve(s([r.getTransactionStatus(e)])).then(c)}catch(e){return Promise.reject(e)}},l=function(e){return e.status>=4},f=function(e){return e.status>=3},d=function(e){return e.status>=2},h=((o={})[t.INIT]=function(e){try{return Promise.resolve(a(e.self())).then(function(r){l(r)||setTimeout(function(){return e.sendSelf("POLL")},2500),e.merge(r)})}catch(e){return Promise.reject(e)}},o[t.SUBSCRIBE]=function(e,r){e.subscribe(r.from),e.send(r.from,t.UPDATED,e.all())},o[t.UNSUBSCRIBE]=function(e,r){e.unsubscribe(r.from)},o[t.SNAPSHOT]=function(e,r){try{return r.reply(e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},o.POLL=function(e){try{return Promise.resolve(a(e.self())).then(function(r){var n,o;l(r)||setTimeout(function(){return e.sendSelf("POLL")},2500),n=e.all(),o=r,JSON.stringify(n)!==JSON.stringify(o)&&e.broadcast(t.UPDATED,r),e.merge(r)})}catch(e){return Promise.reject(e)}},o),m=function(e){if("object"==typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return e},v=function(e){return t.spawn(h,m(e))};function p(e){function r(r){return t.subscriber(m(e),v,r)}function n(e){return function(t){void 0===t&&(t={});var n=t.suppress||!1;return new Promise(function(t,o){var i=r(function(r){r.statusCode&&!n?(o(r.errorMessage),i()):e(r)&&(t(r),i())})})}}return{snapshot:function(){return t.snapshoter(e,v)},subscribe:r,onceFinalized:n(d),onceExecuted:n(f),onceSealed:n(l)}}function P(){return(P=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function y(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function g(e){var r=0;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,r){if(e){if("string"==typeof e)return y(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?y(e,void 0):void 0}}(e)))return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}p.isUnknown=function(e){return e.status>=0},p.isPending=function(e){return e.status>=1},p.isFinalized=d,p.isExecuted=f,p.isSealed=l,p.isExpired=function(e){return 5===e.status};var b=function(){try{return Promise.resolve(s([r.getLatestBlock()])).then(c)}catch(e){return Promise.reject(e)}},E=function(r){try{var t=setTimeout;return Promise.resolve(e.config().get("fcl.eventPollRate",1e4)).then(function(e){return t(function(){return r.sendSelf("TICK")},e)})}catch(e){return Promise.reject(e)}},S=((i={}).TICK=function(e){try{if(!e.hasSubs())return Promise.resolve();var t=e.get("hwm"),n=function(){if(null==t){var n=e.put;return Promise.resolve(b()).then(function(r){n.call(e,"hwm",r);var t=e.put;return Promise.resolve(E(e)).then(function(r){t.call(e,"tick",r)})})}return Promise.resolve(b()).then(function(n){return e.put("hwm",n),Promise.resolve(s([r.getEvents(e.self(),t.height,n.height-1)])).then(function(r){return Promise.resolve(c(r)).then(function(r){for(var t,n=g(r);!(t=n()).done;)e.broadcast("UPDATED",t.value.data);var o=e.put;return Promise.resolve(E(e)).then(function(r){o.call(e,"tick",r)})})})})}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},i[t.SUBSCRIBE]=function(e,r){try{var t=function(){e.subscribe(r.from)},n=function(){if(!e.hasSubs()){var r=e.put;return Promise.resolve(E(e)).then(function(t){r.call(e,"tick",t)})}}();return Promise.resolve(n&&n.then?n.then(t):t())}catch(e){return Promise.reject(e)}},i[t.UNSUBSCRIBE]=function(e,r){e.unsubscribe(r.from),e.hasSubs()||(clearTimeout(e.get("tick")),e.delete("tick"),e.delete("hwm"))},i),j=function(e){return t.spawn(S,e)};function w(e){return null==e?null:e.replace(/^0x/,"")}function O(e){if(!document.getElementById("FCL_IFRAME")){var r=document.createElement("iframe");return r.src=e,r.id="FCL_IFRAME",r.allow="usb",r.style.position="fixed",r.style.top="0px",r.style.right="0px",r.style.left="0px",r.style.bottom="0px",r.style.height="100vh",r.style.width="100vw",r.style.display="block",r.style.background="rgba(0,0,0,0.25)",r.frameBorder="0",r.style.boxSizing="border-box",r.style.border="1px solid white",document.body.append(r),[r,function(){document.getElementById("FCL_IFRAME")&&document.getElementById("FCL_IFRAME").remove()}]}}function x(e,r){void 0===r&&(r=!0);var t=new URL(e.endpoint);if(r)for(var n=0,o=Object.entries(e.params||{});n<o.length;n++){var i=o[n];t.searchParams.append(i[0],i[1])}return t}function I(e){return O(x(e).href)}var T,R={"HTTP/GET":"GET","HTTP/POST":"POST"},A=function(e,r){return null==r?"'"+e+"'":"'"+e+"' ("+r+")"},k=function(e,r){return"Missing "+A(e,r)+" in Composite Signature."},N=function(e,r){return A(e,r)+" in Composit Signature did not match the requested "+e+"."},C="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",U=C.length,B={"HTTP/POST":function(e,r){try{var t=function(){},n=null;return Promise.resolve(function(e,r){try{var t=e()}catch(e){return r()}return t&&t.then?t.then(r,r):r()}(function(){return function(e,r){try{var t=e()}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}(function(){return Promise.resolve(fetch(x(e),{method:"POST",headers:{"Content-Type":"application/json"},body:r?JSON.stringify(r):void 0}).then(function(e){return e.json()})).then(function(e){if(e.local&&e.local.length>0){var r=I(e.local[0]);t=r[1]}return Promise.resolve(function e(r){return new Promise(function(t,n){try{return Promise.resolve(fetch(x(r),{method:R[r.method],headers:{"Content-Type":"application/json"}}).then(function(e){return e.json()})).then(function(r){"APPROVED"===r.status?t(r.compositeSignature):"DECLINED"===r.status?n({status:r.status,reason:r.reason}):setTimeout(function(){t(e(r.authorizationUpdates))},500)})}catch(e){return Promise.reject(e)}})}(e.authorizationUpdates)).then(function(e){n=e})})},function(n){throw t(),L(e,r,n),n})},function(){return t(),n}))}catch(e){return Promise.reject(e)}},"IFRAME/RPC":function(e,r){try{return Promise.resolve(new Promise(function(t,n){try{var o=function(){for(var e="",r=32;r--;)e+=C[Math.random()*U|0];return e}(),i=I(e),u=i[0],s=i[1];setTimeout(function(){u.contentWindow.postMessage(JSON.parse(JSON.stringify({jsonrpc:"2.0",id:o,method:"fcl:sign",params:[r,e.params]})),"*")},500),window.addEventListener("message",function e(r){var i=r.data;try{if("object"!=typeof i)return Promise.resolve();if("2.0"!==i.jsonrpc)return Promise.resolve();if(i.id!==o)return Promise.resolve();var u=i.result;return"APPROVED"===u.status?(window.removeEventListener("message",e),s(),t(u.compositeSignature)):"DECLINED"===u.status?(window.removeEventListener("message",e),s(),n({status:u.status,reason:u.reason})):(window.removeEventListener("message",e),s(),n({status:"DECLINED",reason:"Status was neither APPROVED nor DECLINED"})),Promise.resolve()}catch(e){return Promise.reject(e)}})}catch(t){L(e,r,t),n({status:"DECLINED",reason:"Trouble talking to Wallet Provider"})}}))}catch(e){return Promise.reject(e)}}};function L(e,r,t){console.error("["+e.method+"] Trouble talking to Wallet Provider","\n\n",{authz:e,signable:r},t)}function D(e,r,t){if(!e.s){if(t instanceof _){if(!t.s)return void(t.o=D.bind(null,e,r));1&r&&(r=t.s),t=t.v}if(t&&t.then)return void t.then(D.bind(null,e,r),D.bind(null,e,2));e.s=r,e.v=t;var n=e.o;n&&n(e)}}var z=function(e){try{return X(),Promise.resolve(M()).then(function(t){function n(){return P({},e,{addr:u.addr,keyId:u.keyId,sequenceNum:i,signature:e.signature||null,signingFunction:function(e){try{return Promise.resolve(function(e,r){try{return Promise.resolve(B[e.method](e,r)).then(function(r){return null==r.sig&&(r.sig=r.signature),null==r.signature&&(r.signature=r.sig),function(e,r){try{if(null==e.addr)throw new Error(k("addr","Address"));if(null==e.keyId)throw new Error(k("keyId"));if(null==e.signature)throw new Error(k("signature"));if(e.addr!==r.addr)throw new Error(N("addr","Address"));if(e.keyId!==r.keyId)throw new Error(N("keyId"))}catch(t){throw console.error(t,"\n\n",{"Composite Signature":e,"Authz Service":r}),new Error("Composite Signature from Wallet Provider failed Validation/Sanitation.\nReason: "+t.message)}}(r,e),r})}catch(e){return Promise.reject(e)}}(u,e))}catch(e){return Promise.reject(e)}},resolve:null,roles:e.roles})}var o,i,u=(void 0===(o=t.services)&&(o=[]),o.find(function(e){return"authz"===e.type})),c=function(){if(e.role.proposer)return Promise.resolve(function(){try{return X(),Promise.resolve(Z()).then(function(e){var t=e.addr;if(null==t)throw new Error("No Flow Address for Current User");return Promise.resolve(s([r.getAccount(t)])).then(function(e){return e.account})})}catch(e){return Promise.reject(e)}}()).then(function(e){var r=e.keys.find(function(e){return e.index===u.keyId});i=r.sequenceNumber})}();return c&&c.then?c.then(n):n()})}catch(e){return Promise.reject(e)}},_=function(){function e(){}return e.prototype.then=function(r,t){var n=new e,o=this.s;if(o){var i=1&o?r:t;if(i){try{D(n,1,i(this.v))}catch(e){D(n,2,e)}return n}return this}return this.o=function(e){try{var o=e.v;1&e.s?D(n,1,r?r(o):o):t?D(n,1,t(o)):D(n,2,o)}catch(e){D(n,2,e)}},n},e}();function F(e){return e instanceof _&&1&e.s}var M=function(){try{return Promise.resolve(new Promise(function(r){try{return X(),Promise.resolve(Z()).then(function(n){return n.loggedIn?r(n):Promise.resolve(e.config().get("challenge.handshake")).then(function(e){var n,o,i,u=(o=(n={handshake:e,l6n:window.location.origin}).l6n,(i=new URL(n.handshake)).searchParams.append("l6n",o),O(i.href))[1];window.addEventListener("message",function e(n){var o=n.data;try{if(o.type!==q)return Promise.resolve();u(),window.removeEventListener("message",e);var i="did:fcl:"+o.addr,s=o.addr,c=o.services||[];return Promise.resolve(function(e,r){try{if(null==e||null==r)return Promise.resolve([]);var t=new URL(e);return t.searchParams.append("code",r),Promise.resolve(fetch(t,{method:"GET",headers:{"Content-Type":"application/json"}}).then(function(e){return e.json()})).then(function(e){if(Array.isArray(e))return e;var r=[];if(Array.isArray(e.authorizations))for(var t,n=g(e.authorizations);!(t=n()).done;)r.push(P({type:"authz",keyId:e.keyId},t.value));return null!=e.provider&&r.push(P({type:"authn",id:"wallet-provider#authn"},e.provider)),r})}catch(e){return Promise.reject(e)}}(o.hks,o.code)).then(function(e){var n,o,u={addr:s,cid:i,loggedIn:!0,services:(n=c,o=e,void 0===n&&(n=[]),void 0===o&&(o=[]),[].concat(n,o))};return t.send(J,V,u),Promise.resolve(Z()).then(function(e){r(e)})})}catch(e){return Promise.reject(e)}})})})}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}},J="CURRENT_USER",H="CURRENT_USER/UPDATED",V="SET_CURRENT_USER",q="FCL::CHALLENGE::RESPONSE",G='{\n "VERSION": "0.2.0",\n "addr":null,\n "cid":null,\n "loggedIn":null,\n "services":[]\n}',W=function(e){try{return localStorage.setItem(J,JSON.stringify(e)),Promise.resolve(e)}catch(e){return Promise.reject(e)}},K=((T={})[t.INIT]=function(e){try{var r=e.merge;return Promise.resolve(function(){try{var e=JSON.parse(G),r=JSON.parse(localStorage.getItem(J));return null!=r&&e.VERSION!==r.VERSION?(localStorage.removeItem(J),Promise.resolve(e)):Promise.resolve(r||e)}catch(e){return Promise.reject(e)}}()).then(function(t){r.call(e,t)})}catch(e){return Promise.reject(e)}},T[t.SUBSCRIBE]=function(e,r){e.subscribe(r.from),e.send(r.from,H,e.all())},T[t.UNSUBSCRIBE]=function(e,r){e.unsubscribe(r.from)},T.SNAPSHOT=function(e,r){try{return r.reply(e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},T[V]=function(e,r,t){try{return e.merge(t),W(e.all()),e.broadcast(H,e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},T.DEL_CURRENT_USER=function(e,r){try{return e.merge(JSON.parse(G)),W(e.all()),e.broadcast(H,e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},T.GET_AS_PARAM=function(e,r,t){var o=t.key;try{return r.reply({key:o,value:e.get("addr",null),xform:n.Identity}),Promise.resolve()}catch(e){return Promise.reject(e)}},T),X=function(){return t.spawn(K,J)};function $(){X(),t.send(J,"DEL_CURRENT_USER")}function Q(e){return function(){try{return X(),Promise.resolve(M()).then(function(){return t.send(J,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})})}catch(e){return Promise.reject(e)}}}function Y(e){X();var r=t.spawn(function(r){try{var n;return r.send(J,t.SUBSCRIBE),Promise.resolve(function(e,r,t){for(var n;;){var o=e();if(F(o)&&(o=o.v),!o)return i;if(o.then){n=0;break}var i=t();if(i&&i.then){if(!F(i)){n=1;break}i=i.s}}var u=new _,s=D.bind(null,u,2);return(0===n?o.then(a):1===n?i.then(c):(void 0).then(function(){(o=e())?o.then?o.then(a).then(void 0,s):a(o):D(u,1,i)})).then(void 0,s),u;function c(r){i=r;do{if(!(o=e())||F(o)&&!o.v)return void D(u,1,i);if(o.then)return void o.then(a).then(void 0,s);F(i=t())&&(i=i.v)}while(!i||!i.then);i.then(c).then(void 0,s)}function a(e){e?(i=t())&&i.then?i.then(c).then(void 0,s):c(i):D(u,1,i)}}(function(){return!n&&1},0,function(){return Promise.resolve(r.receive()).then(function(o){if("@EXIT"===o.tag)return r.send(J,t.UNSUBSCRIBE),void(n=1);e(o.data)})}))}catch(e){return Promise.reject(e)}});return function(){return t.send(r,"@EXIT")}}function Z(){return X(),t.send(J,"SNAPSHOT",null,{expectReply:!0,timeout:0})}var ee=function(){return{authenticate:M,unauthenticate:$,authorization:z,param:Q,subscribe:Y,snapshot:Z}};Object.defineProperty(exports,"config",{enumerable:!0,get:function(){return e.config}}),Object.defineProperty(exports,"arg",{enumerable:!0,get:function(){return r.arg}}),Object.defineProperty(exports,"args",{enumerable:!0,get:function(){return r.args}}),Object.defineProperty(exports,"authorization",{enumerable:!0,get:function(){return r.authorization}}),Object.defineProperty(exports,"authorizations",{enumerable:!0,get:function(){return r.authorizations}}),Object.defineProperty(exports,"build",{enumerable:!0,get:function(){return r.build}}),Object.defineProperty(exports,"cadence",{enumerable:!0,get:function(){return r.cadence}}),Object.defineProperty(exports,"cdc",{enumerable:!0,get:function(){return r.cdc}}),Object.defineProperty(exports,"getAccount",{enumerable:!0,get:function(){return r.getAccount}}),Object.defineProperty(exports,"getBlockByHeight",{enumerable:!0,get:function(){return r.getBlockByHeight}}),Object.defineProperty(exports,"getBlockById",{enumerable:!0,get:function(){return r.getBlockById}}),Object.defineProperty(exports,"getEvents",{enumerable:!0,get:function(){return r.getEvents}}),Object.defineProperty(exports,"getLatestBlock",{enumerable:!0,get:function(){return r.getLatestBlock}}),Object.defineProperty(exports,"getTransactionStatus",{enumerable:!0,get:function(){return r.getTransactionStatus}}),Object.defineProperty(exports,"isBad",{enumerable:!0,get:function(){return r.isBad}}),Object.defineProperty(exports,"isOk",{enumerable:!0,get:function(){return r.isOk}}),Object.defineProperty(exports,"limit",{enumerable:!0,get:function(){return r.limit}}),Object.defineProperty(exports,"param",{enumerable:!0,get:function(){return r.param}}),Object.defineProperty(exports,"params",{enumerable:!0,get:function(){return r.params}}),Object.defineProperty(exports,"payer",{enumerable:!0,get:function(){return r.payer}}),Object.defineProperty(exports,"ping",{enumerable:!0,get:function(){return r.ping}}),Object.defineProperty(exports,"pipe",{enumerable:!0,get:function(){return r.pipe}}),Object.defineProperty(exports,"proposer",{enumerable:!0,get:function(){return r.proposer}}),Object.defineProperty(exports,"ref",{enumerable:!0,get:function(){return r.ref}}),Object.defineProperty(exports,"script",{enumerable:!0,get:function(){return r.script}}),Object.defineProperty(exports,"transaction",{enumerable:!0,get:function(){return r.transaction}}),Object.defineProperty(exports,"why",{enumerable:!0,get:function(){return r.why}}),exports.VERSION="0.0.56",exports.authenticate=function(){return ee().authenticate()},exports.currentUser=ee,exports.decode=c,exports.events=function(e){return{subscribe:function(r){return t.subscriber(e,j,r)}}},exports.resolve=u,exports.sansPrefix=w,exports.send=s,exports.serialize=function(e){void 0===e&&(e=[]);try{var t=function(){return Promise.resolve(u(e)).then(JSON.stringify)},n=function(){if(Array.isArray(e))return Promise.resolve(r.build(e)).then(function(r){e=r})}();return Promise.resolve(n&&n.then?n.then(t):t())}catch(e){return Promise.reject(e)}},exports.tx=p,exports.unauthenticate=function(){return ee().unauthenticate()},exports.withPrefix=function(e){return null==e?null:"0x"+w(e)};
var e=require("@onflow/config"),r=require("@onflow/sdk"),t=require("@onflow/sdk-resolve-cadence"),n=require("@onflow/util-actor"),o=require("@onflow/types");e.config().put("accessNode.api","http://localhost:8080").put("challenge.handshake","http://localhost:8700/authenticate");var i,u,s=function(n){try{return Promise.resolve(e.config().get("accessNode.api")).then(function(e){return r.resolve(n,[t.resolveCadence,r.resolveRefBlockId({node:e}),r.resolveArguments,r.resolveAccounts,r.resolveSignatures,r.resolveValidators])})}catch(e){return Promise.reject(e)}},c=function(t,n){void 0===t&&(t=[]),void 0===n&&(n={});try{var o=function(e){return n.node=e,Array.isArray(t)&&(t=r.build(t)),Promise.resolve(s(t)).then(function(e){return r.send(e,n)})},i=n.node;return Promise.resolve(i?o(i):Promise.resolve(e.config().get("accessNode.api")).then(o))}catch(e){return Promise.reject(e)}},a=function(t){try{return Promise.resolve(e.config().where(/^decoder\./)).then(function(e){var n=Object.fromEntries(Object.entries(e).map(function(e){var r=e[0],t=e[1];return[r="/"+r.replace(/^decoder\./,"")+"$/",t]}));return r.decodeResponse(t,n)})}catch(e){return Promise.reject(e)}},l=function(e){try{return Promise.resolve(c([r.getTransactionStatus(e)])).then(a)}catch(e){return Promise.reject(e)}},f=function(e){return e.status>=4},d=function(e){return e.status>=3},h=function(e){return e.status>=2},m=((i={})[n.INIT]=function(e){try{return Promise.resolve(l(e.self())).then(function(r){f(r)||setTimeout(function(){return e.sendSelf("POLL")},2500),e.merge(r)})}catch(e){return Promise.reject(e)}},i[n.SUBSCRIBE]=function(e,r){e.subscribe(r.from),e.send(r.from,n.UPDATED,e.all())},i[n.UNSUBSCRIBE]=function(e,r){e.unsubscribe(r.from)},i[n.SNAPSHOT]=function(e,r){try{return r.reply(e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},i.POLL=function(e){try{return Promise.resolve(l(e.self())).then(function(r){var t,o;f(r)||setTimeout(function(){return e.sendSelf("POLL")},2500),t=e.all(),o=r,JSON.stringify(t)!==JSON.stringify(o)&&e.broadcast(n.UPDATED,r),e.merge(r)})}catch(e){return Promise.reject(e)}},i),v=function(e){if("object"==typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return e},p=function(e){return n.spawn(m,v(e))};function P(e){function r(r){return n.subscriber(v(e),p,r)}function t(e){return function(t){void 0===t&&(t={});var n=t.suppress||!1;return new Promise(function(t,o){var i=r(function(r){r.statusCode&&!n?(o(r.errorMessage),i()):e(r)&&(t(r),i())})})}}return{snapshot:function(){return n.snapshoter(e,p)},subscribe:r,onceFinalized:t(h),onceExecuted:t(d),onceSealed:t(f)}}function y(){return(y=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function g(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function b(e){var r=0;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,r){if(e){if("string"==typeof e)return g(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?g(e,void 0):void 0}}(e)))return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}P.isUnknown=function(e){return e.status>=0},P.isPending=function(e){return e.status>=1},P.isFinalized=h,P.isExecuted=d,P.isSealed=f,P.isExpired=function(e){return 5===e.status};var E=function(){try{return Promise.resolve(c([r.getLatestBlock()])).then(a)}catch(e){return Promise.reject(e)}},S=function(r){try{var t=setTimeout;return Promise.resolve(e.config().get("fcl.eventPollRate",1e4)).then(function(e){return t(function(){return r.sendSelf("TICK")},e)})}catch(e){return Promise.reject(e)}},j=((u={}).TICK=function(e){try{if(!e.hasSubs())return Promise.resolve();var t=e.get("hwm"),n=function(){if(null==t){var n=e.put;return Promise.resolve(E()).then(function(r){n.call(e,"hwm",r);var t=e.put;return Promise.resolve(S(e)).then(function(r){t.call(e,"tick",r)})})}return Promise.resolve(E()).then(function(n){return e.put("hwm",n),Promise.resolve(c([r.getEvents(e.self(),t.height,n.height-1)])).then(function(r){return Promise.resolve(a(r)).then(function(r){for(var t,n=b(r);!(t=n()).done;)e.broadcast("UPDATED",t.value.data);var o=e.put;return Promise.resolve(S(e)).then(function(r){o.call(e,"tick",r)})})})})}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},u[n.SUBSCRIBE]=function(e,r){try{var t=function(){e.subscribe(r.from)},n=function(){if(!e.hasSubs()){var r=e.put;return Promise.resolve(S(e)).then(function(t){r.call(e,"tick",t)})}}();return Promise.resolve(n&&n.then?n.then(t):t())}catch(e){return Promise.reject(e)}},u[n.UNSUBSCRIBE]=function(e,r){e.unsubscribe(r.from),e.hasSubs()||(clearTimeout(e.get("tick")),e.delete("tick"),e.delete("hwm"))},u),w=function(e){return n.spawn(j,e)};function O(e){return null==e?null:e.replace(/^0x/,"")}function x(e){if(!document.getElementById("FCL_IFRAME")){var r=document.createElement("iframe");return r.src=e,r.id="FCL_IFRAME",r.allow="usb",r.style.position="fixed",r.style.top="0px",r.style.right="0px",r.style.left="0px",r.style.bottom="0px",r.style.height="100vh",r.style.width="100vw",r.style.display="block",r.style.background="rgba(0,0,0,0.25)",r.style.zIndex=2147483647,r.frameBorder="0",r.style.boxSizing="border-box",document.body.append(r),[r,function(){document.getElementById("FCL_IFRAME")&&document.getElementById("FCL_IFRAME").remove()}]}}function I(e,r){void 0===r&&(r=!0);var t=new URL(e.endpoint);if(r)for(var n=0,o=Object.entries(e.params||{});n<o.length;n++){var i=o[n];t.searchParams.append(i[0],i[1])}return t}function T(e){return x(I(e).href)}var R,A={"HTTP/GET":"GET","HTTP/POST":"POST"},k=function(e,r){return null==r?"'"+e+"'":"'"+e+"' ("+r+")"},N=function(e,r){return"Missing "+k(e,r)+" in Composite Signature."},C=function(e,r){return k(e,r)+" in Composit Signature did not match the requested "+e+"."},U="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",B=U.length,L={"HTTP/POST":function(e,r){try{var t=function(){},n=null;return Promise.resolve(function(e,r){try{var t=e()}catch(e){return r()}return t&&t.then?t.then(r,r):r()}(function(){return function(e,r){try{var t=e()}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}(function(){return Promise.resolve(fetch(I(e),{method:"POST",headers:{"Content-Type":"application/json"},body:r?JSON.stringify(r):void 0}).then(function(e){return e.json()})).then(function(e){if(e.local&&e.local.length>0){var r=T(e.local[0]);t=r[1]}return Promise.resolve(function e(r){return new Promise(function(t,n){try{return Promise.resolve(fetch(I(r),{method:A[r.method],headers:{"Content-Type":"application/json"}}).then(function(e){return e.json()})).then(function(r){"APPROVED"===r.status?t(r.compositeSignature):"DECLINED"===r.status?n({status:r.status,reason:r.reason}):setTimeout(function(){t(e(r.authorizationUpdates))},500)})}catch(e){return Promise.reject(e)}})}(e.authorizationUpdates)).then(function(e){n=e})})},function(n){throw t(),D(e,r,n),n})},function(){return t(),n}))}catch(e){return Promise.reject(e)}},"IFRAME/RPC":function(e,r){try{return Promise.resolve(new Promise(function(t,n){try{var o=function(){for(var e="",r=32;r--;)e+=U[Math.random()*B|0];return e}(),i=T(e),u=i[0],s=i[1];setTimeout(function(){u.contentWindow.postMessage(JSON.parse(JSON.stringify({jsonrpc:"2.0",id:o,method:"fcl:sign",params:[r,e.params]})),"*")},500),window.addEventListener("message",function e(r){var i=r.data;try{if("object"!=typeof i)return Promise.resolve();if("2.0"!==i.jsonrpc)return Promise.resolve();if(i.id!==o)return Promise.resolve();var u=i.result;return"APPROVED"===u.status?(window.removeEventListener("message",e),s(),t(u.compositeSignature)):"DECLINED"===u.status?(window.removeEventListener("message",e),s(),n({status:u.status,reason:u.reason})):(window.removeEventListener("message",e),s(),n({status:"DECLINED",reason:"Status was neither APPROVED nor DECLINED"})),Promise.resolve()}catch(e){return Promise.reject(e)}})}catch(t){D(e,r,t),n({status:"DECLINED",reason:"Trouble talking to Wallet Provider"})}}))}catch(e){return Promise.reject(e)}}};function D(e,r,t){console.error("["+e.method+"] Trouble talking to Wallet Provider","\n\n",{authz:e,signable:r},t)}function z(e,r,t){if(!e.s){if(t instanceof F){if(!t.s)return void(t.o=z.bind(null,e,r));1&r&&(r=t.s),t=t.v}if(t&&t.then)return void t.then(z.bind(null,e,r),z.bind(null,e,2));e.s=r,e.v=t;var n=e.o;n&&n(e)}}var _=function(e){try{return $(),Promise.resolve(J()).then(function(t){function n(){return y({},e,{addr:u.addr,keyId:u.keyId,sequenceNum:i,signature:e.signature||null,signingFunction:function(e){try{return Promise.resolve(function(e,r){try{return Promise.resolve(L[e.method](e,r)).then(function(r){return null==r.sig&&(r.sig=r.signature),null==r.signature&&(r.signature=r.sig),function(e,r){try{if(null==e.addr)throw new Error(N("addr","Address"));if(null==e.keyId)throw new Error(N("keyId"));if(null==e.signature)throw new Error(N("signature"));if(e.addr!==r.addr)throw new Error(C("addr","Address"));if(e.keyId!==r.keyId)throw new Error(C("keyId"))}catch(t){throw console.error(t,"\n\n",{"Composite Signature":e,"Authz Service":r}),new Error("Composite Signature from Wallet Provider failed Validation/Sanitation.\nReason: "+t.message)}}(r,e),r})}catch(e){return Promise.reject(e)}}(u,e))}catch(e){return Promise.reject(e)}},resolve:null,roles:e.roles})}var o,i,u=(void 0===(o=t.services)&&(o=[]),o.find(function(e){return"authz"===e.type})),s=function(){if(e.role.proposer)return Promise.resolve(function(){try{return $(),Promise.resolve(ee()).then(function(e){var t=e.addr;if(null==t)throw new Error("No Flow Address for Current User");return Promise.resolve(c([r.getAccount(t)])).then(function(e){return e.account})})}catch(e){return Promise.reject(e)}}()).then(function(e){var r=e.keys.find(function(e){return e.index===u.keyId});i=r.sequenceNumber})}();return s&&s.then?s.then(n):n()})}catch(e){return Promise.reject(e)}},F=function(){function e(){}return e.prototype.then=function(r,t){var n=new e,o=this.s;if(o){var i=1&o?r:t;if(i){try{z(n,1,i(this.v))}catch(e){z(n,2,e)}return n}return this}return this.o=function(e){try{var o=e.v;1&e.s?z(n,1,r?r(o):o):t?z(n,1,t(o)):z(n,2,o)}catch(e){z(n,2,e)}},n},e}();function M(e){return e instanceof F&&1&e.s}var J=function(){try{return Promise.resolve(new Promise(function(r){try{return $(),Promise.resolve(ee()).then(function(t){return t.loggedIn?r(t):Promise.resolve(e.config().get("challenge.handshake")).then(function(e){var t,o,i,u=(o=(t={handshake:e,l6n:window.location.origin}).l6n,(i=new URL(t.handshake)).searchParams.append("l6n",o),x(i.href))[1];window.addEventListener("message",function e(t){var o=t.data;try{if(o.type!==G)return Promise.resolve();u(),window.removeEventListener("message",e);var i="did:fcl:"+o.addr,s=o.addr,c=o.services||[];return Promise.resolve(function(e,r){try{if(null==e||null==r)return Promise.resolve([]);var t=new URL(e);return t.searchParams.append("code",r),Promise.resolve(fetch(t,{method:"GET",headers:{"Content-Type":"application/json"}}).then(function(e){return e.json()})).then(function(e){if(Array.isArray(e))return e;var r=[];if(Array.isArray(e.authorizations))for(var t,n=b(e.authorizations);!(t=n()).done;)r.push(y({type:"authz",keyId:e.keyId},t.value));return null!=e.provider&&r.push(y({type:"authn",id:"wallet-provider#authn"},e.provider)),r})}catch(e){return Promise.reject(e)}}(o.hks,o.code)).then(function(e){var t,o,u={addr:s,cid:i,loggedIn:!0,services:(t=c,o=e,void 0===t&&(t=[]),void 0===o&&(o=[]),[].concat(t,o))};return n.send(q,V,u),Promise.resolve(ee()).then(function(e){r(e)})})}catch(e){return Promise.reject(e)}})})})}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}},q="CURRENT_USER",H="CURRENT_USER/UPDATED",V="SET_CURRENT_USER",G="FCL::CHALLENGE::RESPONSE",W='{\n "VERSION": "0.2.0",\n "addr":null,\n "cid":null,\n "loggedIn":null,\n "services":[]\n}',K=function(e){try{return localStorage.setItem(q,JSON.stringify(e)),Promise.resolve(e)}catch(e){return Promise.reject(e)}},X=((R={})[n.INIT]=function(e){try{var r=e.merge;return Promise.resolve(function(){try{var e=JSON.parse(W),r=JSON.parse(localStorage.getItem(q));return null!=r&&e.VERSION!==r.VERSION?(localStorage.removeItem(q),Promise.resolve(e)):Promise.resolve(r||e)}catch(e){return Promise.reject(e)}}()).then(function(t){r.call(e,t)})}catch(e){return Promise.reject(e)}},R[n.SUBSCRIBE]=function(e,r){e.subscribe(r.from),e.send(r.from,H,e.all())},R[n.UNSUBSCRIBE]=function(e,r){e.unsubscribe(r.from)},R.SNAPSHOT=function(e,r){try{return r.reply(e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},R[V]=function(e,r,t){try{return e.merge(t),K(e.all()),e.broadcast(H,e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},R.DEL_CURRENT_USER=function(e,r){try{return e.merge(JSON.parse(W)),K(e.all()),e.broadcast(H,e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},R.GET_AS_PARAM=function(e,r,t){var n=t.key;try{return r.reply({key:n,value:e.get("addr",null),xform:o.Identity}),Promise.resolve()}catch(e){return Promise.reject(e)}},R),$=function(){return n.spawn(X,q)};function Q(){$(),n.send(q,"DEL_CURRENT_USER")}function Y(e){return function(){try{return $(),Promise.resolve(J()).then(function(){return n.send(q,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})})}catch(e){return Promise.reject(e)}}}function Z(e){$();var r=n.spawn(function(r){try{var t;return r.send(q,n.SUBSCRIBE),Promise.resolve(function(e,r,t){for(var n;;){var o=e();if(M(o)&&(o=o.v),!o)return i;if(o.then){n=0;break}var i=t();if(i&&i.then){if(!M(i)){n=1;break}i=i.s}}var u=new F,s=z.bind(null,u,2);return(0===n?o.then(a):1===n?i.then(c):(void 0).then(function(){(o=e())?o.then?o.then(a).then(void 0,s):a(o):z(u,1,i)})).then(void 0,s),u;function c(r){i=r;do{if(!(o=e())||M(o)&&!o.v)return void z(u,1,i);if(o.then)return void o.then(a).then(void 0,s);M(i=t())&&(i=i.v)}while(!i||!i.then);i.then(c).then(void 0,s)}function a(e){e?(i=t())&&i.then?i.then(c).then(void 0,s):c(i):z(u,1,i)}}(function(){return!t&&1},0,function(){return Promise.resolve(r.receive()).then(function(o){if("@EXIT"===o.tag)return r.send(q,n.UNSUBSCRIBE),void(t=1);e(o.data)})}))}catch(e){return Promise.reject(e)}});return function(){return n.send(r,"@EXIT")}}function ee(){return $(),n.send(q,"SNAPSHOT",null,{expectReply:!0,timeout:0})}var re=function(){return{authenticate:J,unauthenticate:Q,authorization:_,param:Y,subscribe:Z,snapshot:ee}};Object.defineProperty(exports,"config",{enumerable:!0,get:function(){return e.config}}),Object.defineProperty(exports,"arg",{enumerable:!0,get:function(){return r.arg}}),Object.defineProperty(exports,"args",{enumerable:!0,get:function(){return r.args}}),Object.defineProperty(exports,"authorization",{enumerable:!0,get:function(){return r.authorization}}),Object.defineProperty(exports,"authorizations",{enumerable:!0,get:function(){return r.authorizations}}),Object.defineProperty(exports,"build",{enumerable:!0,get:function(){return r.build}}),Object.defineProperty(exports,"cadence",{enumerable:!0,get:function(){return r.cadence}}),Object.defineProperty(exports,"cdc",{enumerable:!0,get:function(){return r.cdc}}),Object.defineProperty(exports,"getAccount",{enumerable:!0,get:function(){return r.getAccount}}),Object.defineProperty(exports,"getBlockByHeight",{enumerable:!0,get:function(){return r.getBlockByHeight}}),Object.defineProperty(exports,"getBlockById",{enumerable:!0,get:function(){return r.getBlockById}}),Object.defineProperty(exports,"getEvents",{enumerable:!0,get:function(){return r.getEvents}}),Object.defineProperty(exports,"getLatestBlock",{enumerable:!0,get:function(){return r.getLatestBlock}}),Object.defineProperty(exports,"getTransactionStatus",{enumerable:!0,get:function(){return r.getTransactionStatus}}),Object.defineProperty(exports,"isBad",{enumerable:!0,get:function(){return r.isBad}}),Object.defineProperty(exports,"isOk",{enumerable:!0,get:function(){return r.isOk}}),Object.defineProperty(exports,"limit",{enumerable:!0,get:function(){return r.limit}}),Object.defineProperty(exports,"param",{enumerable:!0,get:function(){return r.param}}),Object.defineProperty(exports,"params",{enumerable:!0,get:function(){return r.params}}),Object.defineProperty(exports,"payer",{enumerable:!0,get:function(){return r.payer}}),Object.defineProperty(exports,"ping",{enumerable:!0,get:function(){return r.ping}}),Object.defineProperty(exports,"pipe",{enumerable:!0,get:function(){return r.pipe}}),Object.defineProperty(exports,"proposer",{enumerable:!0,get:function(){return r.proposer}}),Object.defineProperty(exports,"ref",{enumerable:!0,get:function(){return r.ref}}),Object.defineProperty(exports,"script",{enumerable:!0,get:function(){return r.script}}),Object.defineProperty(exports,"transaction",{enumerable:!0,get:function(){return r.transaction}}),Object.defineProperty(exports,"why",{enumerable:!0,get:function(){return r.why}}),exports.VERSION="0.0.56",exports.authenticate=function(){return re().authenticate()},exports.currentUser=re,exports.decode=a,exports.events=function(e){return{subscribe:function(r){return n.subscriber(e,w,r)}}},exports.resolve=s,exports.sansPrefix=O,exports.send=c,exports.serialize=function(e){void 0===e&&(e=[]);try{var t=function(){return Promise.resolve(s(e)).then(JSON.stringify)},n=function(){if(Array.isArray(e))return Promise.resolve(r.build(e)).then(function(r){e=r})}();return Promise.resolve(n&&n.then?n.then(t):t())}catch(e){return Promise.reject(e)}},exports.tx=P,exports.unauthenticate=function(){return re().unauthenticate()},exports.withPrefix=function(e){return null==e?null:"0x"+O(e)};
//# sourceMappingURL=fcl.js.map

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

import{config as e}from"@onflow/config";export{config}from"@onflow/config";import{resolve as t,resolveRefBlockId as n,resolveParams as a,resolveArguments as r,resolveAccounts as s,resolveSignatures as o,resolveValidators as i,build as c,send as u,decodeResponse as l,getTransactionStatus as d,getLatestBlock as f,getEvents as p,getAccount as y}from"@onflow/sdk";export{arg,args,authorization,authorizations,build,cadence,cdc,getAccount,getBlockByHeight,getBlockById,getEvents,getLatestBlock,getTransactionStatus,isBad,isOk,limit,param,params,payer,ping,pipe,proposer,ref,script,transaction,why}from"@onflow/sdk";import{subscriber as h,spawn as m,snapshoter as w,INIT as g,SUBSCRIBE as E,UPDATED as S,UNSUBSCRIBE as b,SNAPSHOT as T,send as R}from"@onflow/util-actor";import{Identity as I}from"@onflow/types";e().put("accessNode.api","http://localhost:8080").put("challenge.handshake","http://localhost:8700/authenticate");const v=async c=>t(c,[n({node:await e().get("accessNode.api")}),a,r,s,o,i]),P=async(t=[],n={})=>(n.node=n.node||await e().get("accessNode.api"),Array.isArray(t)&&(t=c(t)),u(await v(t),n)),k=async(e=[])=>(Array.isArray(e)&&(e=await c(e)),JSON.stringify(await v(e))),N=async t=>{const n=await e().where(/^decoder\./),a=Object.fromEntries(Object.entries(n).map(([e,t])=>[e=`/${e.replace(/^decoder\./,"")}$/`,t]));return l(t,a)},A=async e=>{const t=await P([d(e)]);return N(t)},O=e=>e.status>=4,L=e=>e.status>=3,C=e=>e.status>=2,U={[g]:async e=>{const t=await A(e.self());O(t)||setTimeout(()=>e.sendSelf("POLL"),2500),e.merge(t)},[E]:(e,t)=>{e.subscribe(t.from),e.send(t.from,S,e.all())},[b]:(e,t)=>{e.unsubscribe(t.from)},[T]:async(e,t)=>{t.reply(e.all())},POLL:async e=>{const t=await A(e.self());var n,a;O(t)||setTimeout(()=>e.sendSelf("POLL"),2500),n=e.all(),a=t,JSON.stringify(n)!==JSON.stringify(a)&&e.broadcast(S,t),e.merge(t)}},x=e=>{if("object"==typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return e},D=e=>m(U,x(e));function _(e){function t(t){return h(x(e),D,t)}function n(e){return function(n={}){const a=n.suppress||!1;return new Promise((n,r)=>{const s=t(t=>{t.statusCode&&!a?(r(t.errorMessage),s()):e(t)&&(n(t),s())})})}}return{snapshot:function(){return w(e,D)},subscribe:t,onceFinalized:n(C),onceExecuted:n(L),onceSealed:n(O)}}_.isUnknown=e=>e.status>=0,_.isPending=e=>e.status>=1,_.isFinalized=C,_.isExecuted=L,_.isSealed=O,_.isExpired=e=>5===e.status;const z=async()=>N(await P([f()])),F=async t=>setTimeout(()=>t.sendSelf("TICK"),await e().get("fcl.eventPollRate",1e4)),j={TICK:async e=>{if(!e.hasSubs())return;let t=e.get("hwm");if(null==t)e.put("hwm",await z()),e.put("tick",await F(e));else{let n=await z();e.put("hwm",n);const a=await P([p(e.self(),t.height,n.height-1)]),r=await N(a);for(let t of r)e.broadcast("UPDATED",t.data);e.put("tick",await F(e))}},[E]:async(e,t)=>{e.hasSubs()||e.put("tick",await F(e)),e.subscribe(t.from)},[b]:(e,t)=>{e.unsubscribe(t.from),e.hasSubs()||(clearTimeout(e.get("tick")),e.delete("tick"),e.delete("hwm"))}},M=e=>m(j,e);function B(e){return{subscribe:t=>h(e,M,t)}}function J(e){return null==e?null:e.replace(/^0x/,"")}function H(e){return null==e?null:"0x"+J(e)}function $(e){if(document.getElementById("FCL_IFRAME"))return;const t=document.createElement("iframe");return t.src=e,t.id="FCL_IFRAME",t.allow="usb",t.style.position="fixed",t.style.top="0px",t.style.right="0px",t.style.left="0px",t.style.bottom="0px",t.style.height="100vh",t.style.width="100vw",t.style.display="block",t.style.background="rgba(0,0,0,0.25)",t.frameBorder="0",t.style.boxSizing="border-box",t.style.border="1px solid white",document.body.append(t),[t,()=>{document.getElementById("FCL_IFRAME")&&document.getElementById("FCL_IFRAME").remove()}]}async function V(e,t){if(null==e||null==t)return[];const n=new URL(e);n.searchParams.append("code",t);const a=await fetch(n,{method:"GET",headers:{"Content-Type":"application/json"}}).then(e=>e.json());if(Array.isArray(a))return a;const r=[];if(Array.isArray(a.authorizations))for(let e of a.authorizations)r.push({type:"authz",keyId:a.keyId,...e});return null!=a.provider&&r.push({type:"authn",id:"wallet-provider#authn",...a.provider}),r}function G(e=[],t=[]){return[...e,...t]}function q(e,t=!0){const n=new URL(e.endpoint);if(t)for(let[t,a]of Object.entries(e.params||{}))n.searchParams.append(t,a);return n}function W(e){return $(q(e).href)}const K={"HTTP/GET":"GET","HTTP/POST":"POST"},X=e=>new Promise(async(t,n)=>{const a=await fetch(q(e),{method:K[e.method],headers:{"Content-Type":"application/json"}}).then(e=>e.json());"APPROVED"===a.status?t(a.compositeSignature):"DECLINED"===a.status?n({status:a.status,reason:a.reason}):setTimeout(()=>{t(X(a.authorizationUpdates))},500)}),Q=(e,t)=>null==t?`'${e}'`:`'${e}' (${t})`,Y=(e,t)=>`Missing ${Q(e,t)} in Composite Signature.`,Z=(e,t)=>`${Q(e,t)} in Composit Signature did not match the requested ${e}.`;var ee="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",te=ee.length;const ne={"HTTP/POST":async function(e,t){var n=()=>{},a=null;try{const r=await fetch(q(e),{method:"POST",headers:{"Content-Type":"application/json"},body:t?JSON.stringify(t):void 0}).then(e=>e.json());if(r.local&&r.local.length>0){const[e,t]=W(r.local[0]);n=t}a=await X(r.authorizationUpdates)}catch(a){throw n(),ae(e,t,a),a}finally{return n(),a}},"IFRAME/RPC":async function(e,t){return new Promise((n,a)=>{try{const r=function(){for(var e="",t=32;t--;)e+=ee[Math.random()*te|0];return e}(),[s,o]=W(e);setTimeout(()=>{s.contentWindow.postMessage(JSON.parse(JSON.stringify({jsonrpc:"2.0",id:r,method:"fcl:sign",params:[t,e.params]})),"*")},500);const i=async({data:e})=>{if("object"!=typeof e)return;if("2.0"!==e.jsonrpc)return;if(e.id!==r)return;const t=e.result;"APPROVED"===t.status?(window.removeEventListener("message",i),o(),n(t.compositeSignature)):"DECLINED"===t.status?(window.removeEventListener("message",i),o(),a({status:t.status,reason:t.reason})):(window.removeEventListener("message",i),o(),a({status:"DECLINED",reason:"Status was neither APPROVED nor DECLINED"}))};window.addEventListener("message",i)}catch(n){ae(e,t,n),a({status:"DECLINED",reason:"Trouble talking to Wallet Provider"})}})}};function ae(e,t,n){console.error(`[${e.method}] Trouble talking to Wallet Provider`,"\n\n",{authz:e,signable:t},n)}const re="CURRENT_USER",se="CURRENT_USER/UPDATED",oe='{\n "VERSION": "0.2.0",\n "addr":null,\n "cid":null,\n "loggedIn":null,\n "services":[]\n}',ie=async e=>(localStorage.setItem(re,JSON.stringify(e)),e),ce={[g]:async e=>{e.merge(await(async()=>{const e=JSON.parse(oe),t=JSON.parse(localStorage.getItem(re));return null!=t&&e.VERSION!==t.VERSION?(localStorage.removeItem(re),e):t||e})())},[E]:(e,t)=>{e.subscribe(t.from),e.send(t.from,se,e.all())},[b]:(e,t)=>{e.unsubscribe(t.from)},SNAPSHOT:async(e,t)=>{t.reply(e.all())},SET_CURRENT_USER:async(e,t,n)=>{e.merge(n),ie(e.all()),e.broadcast(se,e.all())},DEL_CURRENT_USER:async(e,t)=>{e.merge(JSON.parse(oe)),ie(e.all()),e.broadcast(se,e.all())},GET_AS_PARAM:async(e,t,{key:n})=>{t.reply({key:n,value:e.get("addr",null),xform:I})}},ue=()=>m(ce,re);async function le(){return new Promise(async t=>{ue();const n=await he();if(n.loggedIn)return t(n);const[a,r]=function({handshake:e,l6n:t}){var n=new URL(e);return n.searchParams.append("l6n",t),$(n.href)}({handshake:await e().get("challenge.handshake"),l6n:window.location.origin}),s=async({data:e})=>{if("FCL::CHALLENGE::RESPONSE"!==e.type)return;r(),window.removeEventListener("message",s);const n={addr:e.addr,cid:"did:fcl:"+e.addr,loggedIn:!0,services:G(e.services||[],await V(e.hks,e.code))};R(re,"SET_CURRENT_USER",n),t(await he())};window.addEventListener("message",s)})}function de(){ue(),R(re,"DEL_CURRENT_USER")}async function fe(e){ue();const t=function(e=[],t){return e.find(e=>e.type===t)}((await le()).services,"authz");let n;return e.role.proposer&&(n=(await async function(){ue();const{addr:e}=await he();if(null==e)throw new Error("No Flow Address for Current User");const{account:t}=await P([y(e)]);return t}()).keys.find(e=>e.index===t.keyId).sequenceNumber),{...e,addr:t.addr,keyId:t.keyId,sequenceNum:n,signature:e.signature||null,signingFunction:async e=>async function(e,t){const n=await ne[e.method](e,t);return null==n.sig&&(n.sig=n.signature),null==n.signature&&(n.signature=n.sig),function(e,t){try{if(null==e.addr)throw new Error(Y("addr","Address"));if(null==e.keyId)throw new Error(Y("keyId"));if(null==e.signature)throw new Error(Y("signature"));if(e.addr!==t.addr)throw new Error(Z("addr","Address"));if(e.keyId!==t.keyId)throw new Error(Z("keyId"))}catch(n){throw console.error(n,"\n\n",{"Composite Signature":e,"Authz Service":t}),new Error("Composite Signature from Wallet Provider failed Validation/Sanitation.\nReason: "+n.message)}}(n,e),n}(t,e),resolve:null,roles:e.roles}}function pe(e){return async function(){return ue(),await le(),R(re,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})}}function ye(e){ue();const t=m(async t=>{for(t.send(re,E);;){const n=await t.receive();if("@EXIT"===n.tag)return void t.send(re,b);e(n.data)}});return()=>R(t,"@EXIT")}function he(){return ue(),R(re,"SNAPSHOT",null,{expectReply:!0,timeout:0})}const me=()=>({authenticate:le,unauthenticate:de,authorization:fe,param:pe,subscribe:ye,snapshot:he}),we=()=>me().authenticate(),ge=()=>me().unauthenticate(),Ee="0.0.56";export{Ee as VERSION,we as authenticate,me as currentUser,N as decode,B as events,v as resolve,J as sansPrefix,P as send,k as serialize,_ as tx,ge as unauthenticate,H as withPrefix};
import{config as e}from"@onflow/config";export{config}from"@onflow/config";import{resolve as t,resolveRefBlockId as n,resolveArguments as a,resolveAccounts as r,resolveSignatures as s,resolveValidators as o,build as i,send as c,decodeResponse as u,getTransactionStatus as l,getLatestBlock as d,getEvents as f,getAccount as p}from"@onflow/sdk";export{arg,args,authorization,authorizations,build,cadence,cdc,getAccount,getBlockByHeight,getBlockById,getEvents,getLatestBlock,getTransactionStatus,isBad,isOk,limit,param,params,payer,ping,pipe,proposer,ref,script,transaction,why}from"@onflow/sdk";import{resolveCadence as y}from"@onflow/sdk-resolve-cadence";import{subscriber as m,spawn as h,snapshoter as w,INIT as g,SUBSCRIBE as E,UPDATED as S,UNSUBSCRIBE as b,SNAPSHOT as T,send as I}from"@onflow/util-actor";import{Identity as R}from"@onflow/types";e().put("accessNode.api","http://localhost:8080").put("challenge.handshake","http://localhost:8700/authenticate");const v=async i=>t(i,[y,n({node:await e().get("accessNode.api")}),a,r,s,o]),P=async(t=[],n={})=>(n.node=n.node||await e().get("accessNode.api"),Array.isArray(t)&&(t=i(t)),c(await v(t),n)),k=async(e=[])=>(Array.isArray(e)&&(e=await i(e)),JSON.stringify(await v(e))),N=async t=>{const n=await e().where(/^decoder\./),a=Object.fromEntries(Object.entries(n).map(([e,t])=>[e=`/${e.replace(/^decoder\./,"")}$/`,t]));return u(t,a)},A=async e=>{const t=await P([l(e)]);return N(t)},O=e=>e.status>=4,L=e=>e.status>=3,C=e=>e.status>=2,U={[g]:async e=>{const t=await A(e.self());O(t)||setTimeout(()=>e.sendSelf("POLL"),2500),e.merge(t)},[E]:(e,t)=>{e.subscribe(t.from),e.send(t.from,S,e.all())},[b]:(e,t)=>{e.unsubscribe(t.from)},[T]:async(e,t)=>{t.reply(e.all())},POLL:async e=>{const t=await A(e.self());var n,a;O(t)||setTimeout(()=>e.sendSelf("POLL"),2500),n=e.all(),a=t,JSON.stringify(n)!==JSON.stringify(a)&&e.broadcast(S,t),e.merge(t)}},x=e=>{if("object"==typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return e},D=e=>h(U,x(e));function _(e){function t(t){return m(x(e),D,t)}function n(e){return function(n={}){const a=n.suppress||!1;return new Promise((n,r)=>{const s=t(t=>{t.statusCode&&!a?(r(t.errorMessage),s()):e(t)&&(n(t),s())})})}}return{snapshot:function(){return w(e,D)},subscribe:t,onceFinalized:n(C),onceExecuted:n(L),onceSealed:n(O)}}_.isUnknown=e=>e.status>=0,_.isPending=e=>e.status>=1,_.isFinalized=C,_.isExecuted=L,_.isSealed=O,_.isExpired=e=>5===e.status;const z=async()=>N(await P([d()])),F=async t=>setTimeout(()=>t.sendSelf("TICK"),await e().get("fcl.eventPollRate",1e4)),j={TICK:async e=>{if(!e.hasSubs())return;let t=e.get("hwm");if(null==t)e.put("hwm",await z()),e.put("tick",await F(e));else{let n=await z();e.put("hwm",n);const a=await P([f(e.self(),t.height,n.height-1)]),r=await N(a);for(let t of r)e.broadcast("UPDATED",t.data);e.put("tick",await F(e))}},[E]:async(e,t)=>{e.hasSubs()||e.put("tick",await F(e)),e.subscribe(t.from)},[b]:(e,t)=>{e.unsubscribe(t.from),e.hasSubs()||(clearTimeout(e.get("tick")),e.delete("tick"),e.delete("hwm"))}},M=e=>h(j,e);function B(e){return{subscribe:t=>m(e,M,t)}}function J(e){return null==e?null:e.replace(/^0x/,"")}function H(e){return null==e?null:"0x"+J(e)}function $(e){if(document.getElementById("FCL_IFRAME"))return;const t=document.createElement("iframe");return t.src=e,t.id="FCL_IFRAME",t.allow="usb",t.style.position="fixed",t.style.top="0px",t.style.right="0px",t.style.left="0px",t.style.bottom="0px",t.style.height="100vh",t.style.width="100vw",t.style.display="block",t.style.background="rgba(0,0,0,0.25)",t.style.zIndex=2147483647,t.frameBorder="0",t.style.boxSizing="border-box",document.body.append(t),[t,()=>{document.getElementById("FCL_IFRAME")&&document.getElementById("FCL_IFRAME").remove()}]}async function V(e,t){if(null==e||null==t)return[];const n=new URL(e);n.searchParams.append("code",t);const a=await fetch(n,{method:"GET",headers:{"Content-Type":"application/json"}}).then(e=>e.json());if(Array.isArray(a))return a;const r=[];if(Array.isArray(a.authorizations))for(let e of a.authorizations)r.push({type:"authz",keyId:a.keyId,...e});return null!=a.provider&&r.push({type:"authn",id:"wallet-provider#authn",...a.provider}),r}function G(e=[],t=[]){return[...e,...t]}function q(e,t=!0){const n=new URL(e.endpoint);if(t)for(let[t,a]of Object.entries(e.params||{}))n.searchParams.append(t,a);return n}function W(e){return $(q(e).href)}const K={"HTTP/GET":"GET","HTTP/POST":"POST"},X=e=>new Promise(async(t,n)=>{const a=await fetch(q(e),{method:K[e.method],headers:{"Content-Type":"application/json"}}).then(e=>e.json());"APPROVED"===a.status?t(a.compositeSignature):"DECLINED"===a.status?n({status:a.status,reason:a.reason}):setTimeout(()=>{t(X(a.authorizationUpdates))},500)}),Q=(e,t)=>null==t?`'${e}'`:`'${e}' (${t})`,Y=(e,t)=>`Missing ${Q(e,t)} in Composite Signature.`,Z=(e,t)=>`${Q(e,t)} in Composit Signature did not match the requested ${e}.`;var ee="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",te=ee.length;const ne={"HTTP/POST":async function(e,t){var n=()=>{},a=null;try{const r=await fetch(q(e),{method:"POST",headers:{"Content-Type":"application/json"},body:t?JSON.stringify(t):void 0}).then(e=>e.json());if(r.local&&r.local.length>0){const[e,t]=W(r.local[0]);n=t}a=await X(r.authorizationUpdates)}catch(a){throw n(),ae(e,t,a),a}finally{return n(),a}},"IFRAME/RPC":async function(e,t){return new Promise((n,a)=>{try{const r=function(){for(var e="",t=32;t--;)e+=ee[Math.random()*te|0];return e}(),[s,o]=W(e);setTimeout(()=>{s.contentWindow.postMessage(JSON.parse(JSON.stringify({jsonrpc:"2.0",id:r,method:"fcl:sign",params:[t,e.params]})),"*")},500);const i=async({data:e})=>{if("object"!=typeof e)return;if("2.0"!==e.jsonrpc)return;if(e.id!==r)return;const t=e.result;"APPROVED"===t.status?(window.removeEventListener("message",i),o(),n(t.compositeSignature)):"DECLINED"===t.status?(window.removeEventListener("message",i),o(),a({status:t.status,reason:t.reason})):(window.removeEventListener("message",i),o(),a({status:"DECLINED",reason:"Status was neither APPROVED nor DECLINED"}))};window.addEventListener("message",i)}catch(n){ae(e,t,n),a({status:"DECLINED",reason:"Trouble talking to Wallet Provider"})}})}};function ae(e,t,n){console.error(`[${e.method}] Trouble talking to Wallet Provider`,"\n\n",{authz:e,signable:t},n)}const re="CURRENT_USER",se="CURRENT_USER/UPDATED",oe='{\n "VERSION": "0.2.0",\n "addr":null,\n "cid":null,\n "loggedIn":null,\n "services":[]\n}',ie=async e=>(localStorage.setItem(re,JSON.stringify(e)),e),ce={[g]:async e=>{e.merge(await(async()=>{const e=JSON.parse(oe),t=JSON.parse(localStorage.getItem(re));return null!=t&&e.VERSION!==t.VERSION?(localStorage.removeItem(re),e):t||e})())},[E]:(e,t)=>{e.subscribe(t.from),e.send(t.from,se,e.all())},[b]:(e,t)=>{e.unsubscribe(t.from)},SNAPSHOT:async(e,t)=>{t.reply(e.all())},SET_CURRENT_USER:async(e,t,n)=>{e.merge(n),ie(e.all()),e.broadcast(se,e.all())},DEL_CURRENT_USER:async(e,t)=>{e.merge(JSON.parse(oe)),ie(e.all()),e.broadcast(se,e.all())},GET_AS_PARAM:async(e,t,{key:n})=>{t.reply({key:n,value:e.get("addr",null),xform:R})}},ue=()=>h(ce,re);async function le(){return new Promise(async t=>{ue();const n=await me();if(n.loggedIn)return t(n);const[a,r]=function({handshake:e,l6n:t}){var n=new URL(e);return n.searchParams.append("l6n",t),$(n.href)}({handshake:await e().get("challenge.handshake"),l6n:window.location.origin}),s=async({data:e})=>{if("FCL::CHALLENGE::RESPONSE"!==e.type)return;r(),window.removeEventListener("message",s);const n={addr:e.addr,cid:"did:fcl:"+e.addr,loggedIn:!0,services:G(e.services||[],await V(e.hks,e.code))};I(re,"SET_CURRENT_USER",n),t(await me())};window.addEventListener("message",s)})}function de(){ue(),I(re,"DEL_CURRENT_USER")}async function fe(e){ue();const t=function(e=[],t){return e.find(e=>e.type===t)}((await le()).services,"authz");let n;return e.role.proposer&&(n=(await async function(){ue();const{addr:e}=await me();if(null==e)throw new Error("No Flow Address for Current User");const{account:t}=await P([p(e)]);return t}()).keys.find(e=>e.index===t.keyId).sequenceNumber),{...e,addr:t.addr,keyId:t.keyId,sequenceNum:n,signature:e.signature||null,signingFunction:async e=>async function(e,t){const n=await ne[e.method](e,t);return null==n.sig&&(n.sig=n.signature),null==n.signature&&(n.signature=n.sig),function(e,t){try{if(null==e.addr)throw new Error(Y("addr","Address"));if(null==e.keyId)throw new Error(Y("keyId"));if(null==e.signature)throw new Error(Y("signature"));if(e.addr!==t.addr)throw new Error(Z("addr","Address"));if(e.keyId!==t.keyId)throw new Error(Z("keyId"))}catch(n){throw console.error(n,"\n\n",{"Composite Signature":e,"Authz Service":t}),new Error("Composite Signature from Wallet Provider failed Validation/Sanitation.\nReason: "+n.message)}}(n,e),n}(t,e),resolve:null,roles:e.roles}}function pe(e){return async function(){return ue(),await le(),I(re,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})}}function ye(e){ue();const t=h(async t=>{for(t.send(re,E);;){const n=await t.receive();if("@EXIT"===n.tag)return void t.send(re,b);e(n.data)}});return()=>I(t,"@EXIT")}function me(){return ue(),I(re,"SNAPSHOT",null,{expectReply:!0,timeout:0})}const he=()=>({authenticate:le,unauthenticate:de,authorization:fe,param:pe,subscribe:ye,snapshot:me}),we=()=>he().authenticate(),ge=()=>he().unauthenticate(),Ee="0.0.56";export{Ee as VERSION,we as authenticate,he as currentUser,N as decode,B as events,v as resolve,J as sansPrefix,P as send,k as serialize,_ as tx,ge as unauthenticate,H as withPrefix};
//# sourceMappingURL=fcl.modern.js.map

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

import{config as e}from"@onflow/config";export{config}from"@onflow/config";import{resolve as r,resolveRefBlockId as t,resolveParams as n,resolveArguments as o,resolveAccounts as i,resolveSignatures as u,resolveValidators as s,build as c,send as a,decodeResponse as l,getTransactionStatus as f,getEvents as h,getLatestBlock as d,getAccount as m}from"@onflow/sdk";export{arg,args,authorization,authorizations,build,cadence,cdc,getAccount,getBlockByHeight,getBlockById,getEvents,getLatestBlock,getTransactionStatus,isBad,isOk,limit,param,params,payer,ping,pipe,proposer,ref,script,transaction,why}from"@onflow/sdk";import{INIT as v,SUBSCRIBE as P,UPDATED as y,UNSUBSCRIBE as p,SNAPSHOT as g,subscriber as E,spawn as w,snapshoter as b,send as S}from"@onflow/util-actor";import{Identity as j}from"@onflow/types";e().put("accessNode.api","http://localhost:8080").put("challenge.handshake","http://localhost:8700/authenticate");var T,I,A=function(c){try{return Promise.resolve(e().get("accessNode.api")).then(function(e){return r(c,[t({node:e}),n,o,i,u,s])})}catch(e){return Promise.reject(e)}},k=function(r,t){void 0===r&&(r=[]),void 0===t&&(t={});try{var n=function(e){return t.node=e,Array.isArray(r)&&(r=c(r)),Promise.resolve(A(r)).then(function(e){return a(e,t)})},o=t.node;return Promise.resolve(o?n(o):Promise.resolve(e().get("accessNode.api")).then(n))}catch(e){return Promise.reject(e)}},R=function(e){void 0===e&&(e=[]);try{var r=function(){return Promise.resolve(A(e)).then(JSON.stringify)},t=function(){if(Array.isArray(e))return Promise.resolve(c(e)).then(function(r){e=r})}();return Promise.resolve(t&&t.then?t.then(r):r())}catch(e){return Promise.reject(e)}},O=function(r){try{return Promise.resolve(e().where(/^decoder\./)).then(function(e){var t=Object.fromEntries(Object.entries(e).map(function(e){var r=e[0],t=e[1];return[r="/"+r.replace(/^decoder\./,"")+"$/",t]}));return l(r,t)})}catch(e){return Promise.reject(e)}},N=function(e){try{return Promise.resolve(k([f(e)])).then(O)}catch(e){return Promise.reject(e)}},L=function(e){return e.status>=4},C=function(e){return e.status>=3},x=function(e){return e.status>=2},D=((T={})[v]=function(e){try{return Promise.resolve(N(e.self())).then(function(r){L(r)||setTimeout(function(){return e.sendSelf("POLL")},2500),e.merge(r)})}catch(e){return Promise.reject(e)}},T[P]=function(e,r){e.subscribe(r.from),e.send(r.from,y,e.all())},T[p]=function(e,r){e.unsubscribe(r.from)},T[g]=function(e,r){try{return r.reply(e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},T.POLL=function(e){try{return Promise.resolve(N(e.self())).then(function(r){var t,n;L(r)||setTimeout(function(){return e.sendSelf("POLL")},2500),t=e.all(),n=r,JSON.stringify(t)!==JSON.stringify(n)&&e.broadcast(y,r),e.merge(r)})}catch(e){return Promise.reject(e)}},T),U=function(e){if("object"==typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return e},_=function(e){return w(D,U(e))};function z(e){function r(r){return E(U(e),_,r)}function t(e){return function(t){void 0===t&&(t={});var n=t.suppress||!1;return new Promise(function(t,o){var i=r(function(r){r.statusCode&&!n?(o(r.errorMessage),i()):e(r)&&(t(r),i())})})}}return{snapshot:function(){return b(e,_)},subscribe:r,onceFinalized:t(x),onceExecuted:t(C),onceSealed:t(L)}}function F(){return(F=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function M(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function B(e){var r=0;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,r){if(e){if("string"==typeof e)return M(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?M(e,void 0):void 0}}(e)))return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}z.isUnknown=function(e){return e.status>=0},z.isPending=function(e){return e.status>=1},z.isFinalized=x,z.isExecuted=C,z.isSealed=L,z.isExpired=function(e){return 5===e.status};var J=function(){try{return Promise.resolve(k([d()])).then(O)}catch(e){return Promise.reject(e)}},H=function(r){try{var t=setTimeout;return Promise.resolve(e().get("fcl.eventPollRate",1e4)).then(function(e){return t(function(){return r.sendSelf("TICK")},e)})}catch(e){return Promise.reject(e)}},V=((I={}).TICK=function(e){try{if(!e.hasSubs())return Promise.resolve();var r=e.get("hwm"),t=function(){if(null==r){var t=e.put;return Promise.resolve(J()).then(function(r){t.call(e,"hwm",r);var n=e.put;return Promise.resolve(H(e)).then(function(r){n.call(e,"tick",r)})})}return Promise.resolve(J()).then(function(t){return e.put("hwm",t),Promise.resolve(k([h(e.self(),r.height,t.height-1)])).then(function(r){return Promise.resolve(O(r)).then(function(r){for(var t,n=B(r);!(t=n()).done;)e.broadcast("UPDATED",t.value.data);var o=e.put;return Promise.resolve(H(e)).then(function(r){o.call(e,"tick",r)})})})})}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},I[P]=function(e,r){try{var t=function(){e.subscribe(r.from)},n=function(){if(!e.hasSubs()){var r=e.put;return Promise.resolve(H(e)).then(function(t){r.call(e,"tick",t)})}}();return Promise.resolve(n&&n.then?n.then(t):t())}catch(e){return Promise.reject(e)}},I[p]=function(e,r){e.unsubscribe(r.from),e.hasSubs()||(clearTimeout(e.get("tick")),e.delete("tick"),e.delete("hwm"))},I),G=function(e){return w(V,e)};function q(e){return{subscribe:function(r){return E(e,G,r)}}}function W(e){return null==e?null:e.replace(/^0x/,"")}function K(e){return null==e?null:"0x"+W(e)}function X(e){if(!document.getElementById("FCL_IFRAME")){var r=document.createElement("iframe");return r.src=e,r.id="FCL_IFRAME",r.allow="usb",r.style.position="fixed",r.style.top="0px",r.style.right="0px",r.style.left="0px",r.style.bottom="0px",r.style.height="100vh",r.style.width="100vw",r.style.display="block",r.style.background="rgba(0,0,0,0.25)",r.frameBorder="0",r.style.boxSizing="border-box",r.style.border="1px solid white",document.body.append(r),[r,function(){document.getElementById("FCL_IFRAME")&&document.getElementById("FCL_IFRAME").remove()}]}}function $(e,r){void 0===r&&(r=!0);var t=new URL(e.endpoint);if(r)for(var n=0,o=Object.entries(e.params||{});n<o.length;n++){var i=o[n];t.searchParams.append(i[0],i[1])}return t}function Q(e){return X($(e).href)}var Y,Z={"HTTP/GET":"GET","HTTP/POST":"POST"},ee=function(e,r){return null==r?"'"+e+"'":"'"+e+"' ("+r+")"},re=function(e,r){return"Missing "+ee(e,r)+" in Composite Signature."},te=function(e,r){return ee(e,r)+" in Composit Signature did not match the requested "+e+"."},ne="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",oe=ne.length,ie={"HTTP/POST":function(e,r){try{var t=function(){},n=null;return Promise.resolve(function(e,r){try{var t=e()}catch(e){return r()}return t&&t.then?t.then(r,r):r()}(function(){return function(e,r){try{var t=e()}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}(function(){return Promise.resolve(fetch($(e),{method:"POST",headers:{"Content-Type":"application/json"},body:r?JSON.stringify(r):void 0}).then(function(e){return e.json()})).then(function(e){if(e.local&&e.local.length>0){var r=Q(e.local[0]);t=r[1]}return Promise.resolve(function e(r){return new Promise(function(t,n){try{return Promise.resolve(fetch($(r),{method:Z[r.method],headers:{"Content-Type":"application/json"}}).then(function(e){return e.json()})).then(function(r){"APPROVED"===r.status?t(r.compositeSignature):"DECLINED"===r.status?n({status:r.status,reason:r.reason}):setTimeout(function(){t(e(r.authorizationUpdates))},500)})}catch(e){return Promise.reject(e)}})}(e.authorizationUpdates)).then(function(e){n=e})})},function(n){throw t(),ue(e,r,n),n})},function(){return t(),n}))}catch(e){return Promise.reject(e)}},"IFRAME/RPC":function(e,r){try{return Promise.resolve(new Promise(function(t,n){try{var o=function(){for(var e="",r=32;r--;)e+=ne[Math.random()*oe|0];return e}(),i=Q(e),u=i[0],s=i[1];setTimeout(function(){u.contentWindow.postMessage(JSON.parse(JSON.stringify({jsonrpc:"2.0",id:o,method:"fcl:sign",params:[r,e.params]})),"*")},500),window.addEventListener("message",function e(r){var i=r.data;try{if("object"!=typeof i)return Promise.resolve();if("2.0"!==i.jsonrpc)return Promise.resolve();if(i.id!==o)return Promise.resolve();var u=i.result;return"APPROVED"===u.status?(window.removeEventListener("message",e),s(),t(u.compositeSignature)):"DECLINED"===u.status?(window.removeEventListener("message",e),s(),n({status:u.status,reason:u.reason})):(window.removeEventListener("message",e),s(),n({status:"DECLINED",reason:"Status was neither APPROVED nor DECLINED"})),Promise.resolve()}catch(e){return Promise.reject(e)}})}catch(t){ue(e,r,t),n({status:"DECLINED",reason:"Trouble talking to Wallet Provider"})}}))}catch(e){return Promise.reject(e)}}};function ue(e,r,t){console.error("["+e.method+"] Trouble talking to Wallet Provider","\n\n",{authz:e,signable:r},t)}function se(e,r,t){if(!e.s){if(t instanceof ae){if(!t.s)return void(t.o=se.bind(null,e,r));1&r&&(r=t.s),t=t.v}if(t&&t.then)return void t.then(se.bind(null,e,r),se.bind(null,e,2));e.s=r,e.v=t;var n=e.o;n&&n(e)}}var ce=function(e){try{return ge(),Promise.resolve(fe()).then(function(r){function t(){return F({},e,{addr:i.addr,keyId:i.keyId,sequenceNum:o,signature:e.signature||null,signingFunction:function(e){try{return Promise.resolve(function(e,r){try{return Promise.resolve(ie[e.method](e,r)).then(function(r){return null==r.sig&&(r.sig=r.signature),null==r.signature&&(r.signature=r.sig),function(e,r){try{if(null==e.addr)throw new Error(re("addr","Address"));if(null==e.keyId)throw new Error(re("keyId"));if(null==e.signature)throw new Error(re("signature"));if(e.addr!==r.addr)throw new Error(te("addr","Address"));if(e.keyId!==r.keyId)throw new Error(te("keyId"))}catch(t){throw console.error(t,"\n\n",{"Composite Signature":e,"Authz Service":r}),new Error("Composite Signature from Wallet Provider failed Validation/Sanitation.\nReason: "+t.message)}}(r,e),r})}catch(e){return Promise.reject(e)}}(i,e))}catch(e){return Promise.reject(e)}},resolve:null,roles:e.roles})}var n,o,i=(void 0===(n=r.services)&&(n=[]),n.find(function(e){return"authz"===e.type})),u=function(){if(e.role.proposer)return Promise.resolve(function(){try{return ge(),Promise.resolve(Se()).then(function(e){var r=e.addr;if(null==r)throw new Error("No Flow Address for Current User");return Promise.resolve(k([m(r)])).then(function(e){return e.account})})}catch(e){return Promise.reject(e)}}()).then(function(e){var r=e.keys.find(function(e){return e.index===i.keyId});o=r.sequenceNumber})}();return u&&u.then?u.then(t):t()})}catch(e){return Promise.reject(e)}},ae=function(){function e(){}return e.prototype.then=function(r,t){var n=new e,o=this.s;if(o){var i=1&o?r:t;if(i){try{se(n,1,i(this.v))}catch(e){se(n,2,e)}return n}return this}return this.o=function(e){try{var o=e.v;1&e.s?se(n,1,r?r(o):o):t?se(n,1,t(o)):se(n,2,o)}catch(e){se(n,2,e)}},n},e}();function le(e){return e instanceof ae&&1&e.s}var fe=function(){try{return Promise.resolve(new Promise(function(r){try{return ge(),Promise.resolve(Se()).then(function(t){return t.loggedIn?r(t):Promise.resolve(e().get("challenge.handshake")).then(function(e){var t,n,o,i=(n=(t={handshake:e,l6n:window.location.origin}).l6n,(o=new URL(t.handshake)).searchParams.append("l6n",n),X(o.href))[1];window.addEventListener("message",function e(t){var n=t.data;try{if(n.type!==ve)return Promise.resolve();i(),window.removeEventListener("message",e);var o="did:fcl:"+n.addr,u=n.addr,s=n.services||[];return Promise.resolve(function(e,r){try{if(null==e||null==r)return Promise.resolve([]);var t=new URL(e);return t.searchParams.append("code",r),Promise.resolve(fetch(t,{method:"GET",headers:{"Content-Type":"application/json"}}).then(function(e){return e.json()})).then(function(e){if(Array.isArray(e))return e;var r=[];if(Array.isArray(e.authorizations))for(var t,n=B(e.authorizations);!(t=n()).done;)r.push(F({type:"authz",keyId:e.keyId},t.value));return null!=e.provider&&r.push(F({type:"authn",id:"wallet-provider#authn"},e.provider)),r})}catch(e){return Promise.reject(e)}}(n.hks,n.code)).then(function(e){var t,n,i={addr:u,cid:o,loggedIn:!0,services:(t=s,n=e,void 0===t&&(t=[]),void 0===n&&(n=[]),[].concat(t,n))};return S(he,me,i),Promise.resolve(Se()).then(function(e){r(e)})})}catch(e){return Promise.reject(e)}})})})}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}},he="CURRENT_USER",de="CURRENT_USER/UPDATED",me="SET_CURRENT_USER",ve="FCL::CHALLENGE::RESPONSE",Pe='{\n "VERSION": "0.2.0",\n "addr":null,\n "cid":null,\n "loggedIn":null,\n "services":[]\n}',ye=function(e){try{return localStorage.setItem(he,JSON.stringify(e)),Promise.resolve(e)}catch(e){return Promise.reject(e)}},pe=((Y={})[v]=function(e){try{var r=e.merge;return Promise.resolve(function(){try{var e=JSON.parse(Pe),r=JSON.parse(localStorage.getItem(he));return null!=r&&e.VERSION!==r.VERSION?(localStorage.removeItem(he),Promise.resolve(e)):Promise.resolve(r||e)}catch(e){return Promise.reject(e)}}()).then(function(t){r.call(e,t)})}catch(e){return Promise.reject(e)}},Y[P]=function(e,r){e.subscribe(r.from),e.send(r.from,de,e.all())},Y[p]=function(e,r){e.unsubscribe(r.from)},Y.SNAPSHOT=function(e,r){try{return r.reply(e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},Y[me]=function(e,r,t){try{return e.merge(t),ye(e.all()),e.broadcast(de,e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},Y.DEL_CURRENT_USER=function(e,r){try{return e.merge(JSON.parse(Pe)),ye(e.all()),e.broadcast(de,e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},Y.GET_AS_PARAM=function(e,r,t){var n=t.key;try{return r.reply({key:n,value:e.get("addr",null),xform:j}),Promise.resolve()}catch(e){return Promise.reject(e)}},Y),ge=function(){return w(pe,he)};function Ee(){ge(),S(he,"DEL_CURRENT_USER")}function we(e){return function(){try{return ge(),Promise.resolve(fe()).then(function(){return S(he,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})})}catch(e){return Promise.reject(e)}}}function be(e){ge();var r=w(function(r){try{var t;return r.send(he,P),Promise.resolve(function(e,r,t){for(var n;;){var o=e();if(le(o)&&(o=o.v),!o)return i;if(o.then){n=0;break}var i=t();if(i&&i.then){if(!le(i)){n=1;break}i=i.s}}var u=new ae,s=se.bind(null,u,2);return(0===n?o.then(a):1===n?i.then(c):(void 0).then(function(){(o=e())?o.then?o.then(a).then(void 0,s):a(o):se(u,1,i)})).then(void 0,s),u;function c(r){i=r;do{if(!(o=e())||le(o)&&!o.v)return void se(u,1,i);if(o.then)return void o.then(a).then(void 0,s);le(i=t())&&(i=i.v)}while(!i||!i.then);i.then(c).then(void 0,s)}function a(e){e?(i=t())&&i.then?i.then(c).then(void 0,s):c(i):se(u,1,i)}}(function(){return!t&&1},0,function(){return Promise.resolve(r.receive()).then(function(n){if("@EXIT"===n.tag)return r.send(he,p),void(t=1);e(n.data)})}))}catch(e){return Promise.reject(e)}});return function(){return S(r,"@EXIT")}}function Se(){return ge(),S(he,"SNAPSHOT",null,{expectReply:!0,timeout:0})}var je=function(){return{authenticate:fe,unauthenticate:Ee,authorization:ce,param:we,subscribe:be,snapshot:Se}},Te=function(){return je().authenticate()},Ie=function(){return je().unauthenticate()},Ae="0.0.56";export{Ae as VERSION,Te as authenticate,je as currentUser,O as decode,q as events,A as resolve,W as sansPrefix,k as send,R as serialize,z as tx,Ie as unauthenticate,K as withPrefix};
import{config as e}from"@onflow/config";export{config}from"@onflow/config";import{resolve as r,resolveRefBlockId as t,resolveArguments as n,resolveAccounts as o,resolveSignatures as i,resolveValidators as u,build as s,send as c,decodeResponse as a,getTransactionStatus as l,getEvents as f,getLatestBlock as h,getAccount as d}from"@onflow/sdk";export{arg,args,authorization,authorizations,build,cadence,cdc,getAccount,getBlockByHeight,getBlockById,getEvents,getLatestBlock,getTransactionStatus,isBad,isOk,limit,param,params,payer,ping,pipe,proposer,ref,script,transaction,why}from"@onflow/sdk";import{resolveCadence as m}from"@onflow/sdk-resolve-cadence";import{INIT as v,SUBSCRIBE as P,UPDATED as y,UNSUBSCRIBE as p,SNAPSHOT as g,subscriber as E,spawn as w,snapshoter as b,send as S}from"@onflow/util-actor";import{Identity as j}from"@onflow/types";e().put("accessNode.api","http://localhost:8080").put("challenge.handshake","http://localhost:8700/authenticate");var T,I,A=function(s){try{return Promise.resolve(e().get("accessNode.api")).then(function(e){return r(s,[m,t({node:e}),n,o,i,u])})}catch(e){return Promise.reject(e)}},k=function(r,t){void 0===r&&(r=[]),void 0===t&&(t={});try{var n=function(e){return t.node=e,Array.isArray(r)&&(r=s(r)),Promise.resolve(A(r)).then(function(e){return c(e,t)})},o=t.node;return Promise.resolve(o?n(o):Promise.resolve(e().get("accessNode.api")).then(n))}catch(e){return Promise.reject(e)}},R=function(e){void 0===e&&(e=[]);try{var r=function(){return Promise.resolve(A(e)).then(JSON.stringify)},t=function(){if(Array.isArray(e))return Promise.resolve(s(e)).then(function(r){e=r})}();return Promise.resolve(t&&t.then?t.then(r):r())}catch(e){return Promise.reject(e)}},O=function(r){try{return Promise.resolve(e().where(/^decoder\./)).then(function(e){var t=Object.fromEntries(Object.entries(e).map(function(e){var r=e[0],t=e[1];return[r="/"+r.replace(/^decoder\./,"")+"$/",t]}));return a(r,t)})}catch(e){return Promise.reject(e)}},N=function(e){try{return Promise.resolve(k([l(e)])).then(O)}catch(e){return Promise.reject(e)}},L=function(e){return e.status>=4},C=function(e){return e.status>=3},x=function(e){return e.status>=2},D=((T={})[v]=function(e){try{return Promise.resolve(N(e.self())).then(function(r){L(r)||setTimeout(function(){return e.sendSelf("POLL")},2500),e.merge(r)})}catch(e){return Promise.reject(e)}},T[P]=function(e,r){e.subscribe(r.from),e.send(r.from,y,e.all())},T[p]=function(e,r){e.unsubscribe(r.from)},T[g]=function(e,r){try{return r.reply(e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},T.POLL=function(e){try{return Promise.resolve(N(e.self())).then(function(r){var t,n;L(r)||setTimeout(function(){return e.sendSelf("POLL")},2500),t=e.all(),n=r,JSON.stringify(t)!==JSON.stringify(n)&&e.broadcast(y,r),e.merge(r)})}catch(e){return Promise.reject(e)}},T),U=function(e){if("object"==typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return e},z=function(e){return w(D,U(e))};function _(e){function r(r){return E(U(e),z,r)}function t(e){return function(t){void 0===t&&(t={});var n=t.suppress||!1;return new Promise(function(t,o){var i=r(function(r){r.statusCode&&!n?(o(r.errorMessage),i()):e(r)&&(t(r),i())})})}}return{snapshot:function(){return b(e,z)},subscribe:r,onceFinalized:t(x),onceExecuted:t(C),onceSealed:t(L)}}function F(){return(F=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function M(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function B(e){var r=0;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,r){if(e){if("string"==typeof e)return M(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?M(e,void 0):void 0}}(e)))return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}_.isUnknown=function(e){return e.status>=0},_.isPending=function(e){return e.status>=1},_.isFinalized=x,_.isExecuted=C,_.isSealed=L,_.isExpired=function(e){return 5===e.status};var J=function(){try{return Promise.resolve(k([h()])).then(O)}catch(e){return Promise.reject(e)}},H=function(r){try{var t=setTimeout;return Promise.resolve(e().get("fcl.eventPollRate",1e4)).then(function(e){return t(function(){return r.sendSelf("TICK")},e)})}catch(e){return Promise.reject(e)}},V=((I={}).TICK=function(e){try{if(!e.hasSubs())return Promise.resolve();var r=e.get("hwm"),t=function(){if(null==r){var t=e.put;return Promise.resolve(J()).then(function(r){t.call(e,"hwm",r);var n=e.put;return Promise.resolve(H(e)).then(function(r){n.call(e,"tick",r)})})}return Promise.resolve(J()).then(function(t){return e.put("hwm",t),Promise.resolve(k([f(e.self(),r.height,t.height-1)])).then(function(r){return Promise.resolve(O(r)).then(function(r){for(var t,n=B(r);!(t=n()).done;)e.broadcast("UPDATED",t.value.data);var o=e.put;return Promise.resolve(H(e)).then(function(r){o.call(e,"tick",r)})})})})}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},I[P]=function(e,r){try{var t=function(){e.subscribe(r.from)},n=function(){if(!e.hasSubs()){var r=e.put;return Promise.resolve(H(e)).then(function(t){r.call(e,"tick",t)})}}();return Promise.resolve(n&&n.then?n.then(t):t())}catch(e){return Promise.reject(e)}},I[p]=function(e,r){e.unsubscribe(r.from),e.hasSubs()||(clearTimeout(e.get("tick")),e.delete("tick"),e.delete("hwm"))},I),G=function(e){return w(V,e)};function q(e){return{subscribe:function(r){return E(e,G,r)}}}function W(e){return null==e?null:e.replace(/^0x/,"")}function K(e){return null==e?null:"0x"+W(e)}function X(e){if(!document.getElementById("FCL_IFRAME")){var r=document.createElement("iframe");return r.src=e,r.id="FCL_IFRAME",r.allow="usb",r.style.position="fixed",r.style.top="0px",r.style.right="0px",r.style.left="0px",r.style.bottom="0px",r.style.height="100vh",r.style.width="100vw",r.style.display="block",r.style.background="rgba(0,0,0,0.25)",r.style.zIndex=2147483647,r.frameBorder="0",r.style.boxSizing="border-box",document.body.append(r),[r,function(){document.getElementById("FCL_IFRAME")&&document.getElementById("FCL_IFRAME").remove()}]}}function $(e,r){void 0===r&&(r=!0);var t=new URL(e.endpoint);if(r)for(var n=0,o=Object.entries(e.params||{});n<o.length;n++){var i=o[n];t.searchParams.append(i[0],i[1])}return t}function Q(e){return X($(e).href)}var Y,Z={"HTTP/GET":"GET","HTTP/POST":"POST"},ee=function(e,r){return null==r?"'"+e+"'":"'"+e+"' ("+r+")"},re=function(e,r){return"Missing "+ee(e,r)+" in Composite Signature."},te=function(e,r){return ee(e,r)+" in Composit Signature did not match the requested "+e+"."},ne="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",oe=ne.length,ie={"HTTP/POST":function(e,r){try{var t=function(){},n=null;return Promise.resolve(function(e,r){try{var t=e()}catch(e){return r()}return t&&t.then?t.then(r,r):r()}(function(){return function(e,r){try{var t=e()}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}(function(){return Promise.resolve(fetch($(e),{method:"POST",headers:{"Content-Type":"application/json"},body:r?JSON.stringify(r):void 0}).then(function(e){return e.json()})).then(function(e){if(e.local&&e.local.length>0){var r=Q(e.local[0]);t=r[1]}return Promise.resolve(function e(r){return new Promise(function(t,n){try{return Promise.resolve(fetch($(r),{method:Z[r.method],headers:{"Content-Type":"application/json"}}).then(function(e){return e.json()})).then(function(r){"APPROVED"===r.status?t(r.compositeSignature):"DECLINED"===r.status?n({status:r.status,reason:r.reason}):setTimeout(function(){t(e(r.authorizationUpdates))},500)})}catch(e){return Promise.reject(e)}})}(e.authorizationUpdates)).then(function(e){n=e})})},function(n){throw t(),ue(e,r,n),n})},function(){return t(),n}))}catch(e){return Promise.reject(e)}},"IFRAME/RPC":function(e,r){try{return Promise.resolve(new Promise(function(t,n){try{var o=function(){for(var e="",r=32;r--;)e+=ne[Math.random()*oe|0];return e}(),i=Q(e),u=i[0],s=i[1];setTimeout(function(){u.contentWindow.postMessage(JSON.parse(JSON.stringify({jsonrpc:"2.0",id:o,method:"fcl:sign",params:[r,e.params]})),"*")},500),window.addEventListener("message",function e(r){var i=r.data;try{if("object"!=typeof i)return Promise.resolve();if("2.0"!==i.jsonrpc)return Promise.resolve();if(i.id!==o)return Promise.resolve();var u=i.result;return"APPROVED"===u.status?(window.removeEventListener("message",e),s(),t(u.compositeSignature)):"DECLINED"===u.status?(window.removeEventListener("message",e),s(),n({status:u.status,reason:u.reason})):(window.removeEventListener("message",e),s(),n({status:"DECLINED",reason:"Status was neither APPROVED nor DECLINED"})),Promise.resolve()}catch(e){return Promise.reject(e)}})}catch(t){ue(e,r,t),n({status:"DECLINED",reason:"Trouble talking to Wallet Provider"})}}))}catch(e){return Promise.reject(e)}}};function ue(e,r,t){console.error("["+e.method+"] Trouble talking to Wallet Provider","\n\n",{authz:e,signable:r},t)}function se(e,r,t){if(!e.s){if(t instanceof ae){if(!t.s)return void(t.o=se.bind(null,e,r));1&r&&(r=t.s),t=t.v}if(t&&t.then)return void t.then(se.bind(null,e,r),se.bind(null,e,2));e.s=r,e.v=t;var n=e.o;n&&n(e)}}var ce=function(e){try{return ge(),Promise.resolve(fe()).then(function(r){function t(){return F({},e,{addr:i.addr,keyId:i.keyId,sequenceNum:o,signature:e.signature||null,signingFunction:function(e){try{return Promise.resolve(function(e,r){try{return Promise.resolve(ie[e.method](e,r)).then(function(r){return null==r.sig&&(r.sig=r.signature),null==r.signature&&(r.signature=r.sig),function(e,r){try{if(null==e.addr)throw new Error(re("addr","Address"));if(null==e.keyId)throw new Error(re("keyId"));if(null==e.signature)throw new Error(re("signature"));if(e.addr!==r.addr)throw new Error(te("addr","Address"));if(e.keyId!==r.keyId)throw new Error(te("keyId"))}catch(t){throw console.error(t,"\n\n",{"Composite Signature":e,"Authz Service":r}),new Error("Composite Signature from Wallet Provider failed Validation/Sanitation.\nReason: "+t.message)}}(r,e),r})}catch(e){return Promise.reject(e)}}(i,e))}catch(e){return Promise.reject(e)}},resolve:null,roles:e.roles})}var n,o,i=(void 0===(n=r.services)&&(n=[]),n.find(function(e){return"authz"===e.type})),u=function(){if(e.role.proposer)return Promise.resolve(function(){try{return ge(),Promise.resolve(Se()).then(function(e){var r=e.addr;if(null==r)throw new Error("No Flow Address for Current User");return Promise.resolve(k([d(r)])).then(function(e){return e.account})})}catch(e){return Promise.reject(e)}}()).then(function(e){var r=e.keys.find(function(e){return e.index===i.keyId});o=r.sequenceNumber})}();return u&&u.then?u.then(t):t()})}catch(e){return Promise.reject(e)}},ae=function(){function e(){}return e.prototype.then=function(r,t){var n=new e,o=this.s;if(o){var i=1&o?r:t;if(i){try{se(n,1,i(this.v))}catch(e){se(n,2,e)}return n}return this}return this.o=function(e){try{var o=e.v;1&e.s?se(n,1,r?r(o):o):t?se(n,1,t(o)):se(n,2,o)}catch(e){se(n,2,e)}},n},e}();function le(e){return e instanceof ae&&1&e.s}var fe=function(){try{return Promise.resolve(new Promise(function(r){try{return ge(),Promise.resolve(Se()).then(function(t){return t.loggedIn?r(t):Promise.resolve(e().get("challenge.handshake")).then(function(e){var t,n,o,i=(n=(t={handshake:e,l6n:window.location.origin}).l6n,(o=new URL(t.handshake)).searchParams.append("l6n",n),X(o.href))[1];window.addEventListener("message",function e(t){var n=t.data;try{if(n.type!==ve)return Promise.resolve();i(),window.removeEventListener("message",e);var o="did:fcl:"+n.addr,u=n.addr,s=n.services||[];return Promise.resolve(function(e,r){try{if(null==e||null==r)return Promise.resolve([]);var t=new URL(e);return t.searchParams.append("code",r),Promise.resolve(fetch(t,{method:"GET",headers:{"Content-Type":"application/json"}}).then(function(e){return e.json()})).then(function(e){if(Array.isArray(e))return e;var r=[];if(Array.isArray(e.authorizations))for(var t,n=B(e.authorizations);!(t=n()).done;)r.push(F({type:"authz",keyId:e.keyId},t.value));return null!=e.provider&&r.push(F({type:"authn",id:"wallet-provider#authn"},e.provider)),r})}catch(e){return Promise.reject(e)}}(n.hks,n.code)).then(function(e){var t,n,i={addr:u,cid:o,loggedIn:!0,services:(t=s,n=e,void 0===t&&(t=[]),void 0===n&&(n=[]),[].concat(t,n))};return S(he,me,i),Promise.resolve(Se()).then(function(e){r(e)})})}catch(e){return Promise.reject(e)}})})})}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}},he="CURRENT_USER",de="CURRENT_USER/UPDATED",me="SET_CURRENT_USER",ve="FCL::CHALLENGE::RESPONSE",Pe='{\n "VERSION": "0.2.0",\n "addr":null,\n "cid":null,\n "loggedIn":null,\n "services":[]\n}',ye=function(e){try{return localStorage.setItem(he,JSON.stringify(e)),Promise.resolve(e)}catch(e){return Promise.reject(e)}},pe=((Y={})[v]=function(e){try{var r=e.merge;return Promise.resolve(function(){try{var e=JSON.parse(Pe),r=JSON.parse(localStorage.getItem(he));return null!=r&&e.VERSION!==r.VERSION?(localStorage.removeItem(he),Promise.resolve(e)):Promise.resolve(r||e)}catch(e){return Promise.reject(e)}}()).then(function(t){r.call(e,t)})}catch(e){return Promise.reject(e)}},Y[P]=function(e,r){e.subscribe(r.from),e.send(r.from,de,e.all())},Y[p]=function(e,r){e.unsubscribe(r.from)},Y.SNAPSHOT=function(e,r){try{return r.reply(e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},Y[me]=function(e,r,t){try{return e.merge(t),ye(e.all()),e.broadcast(de,e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},Y.DEL_CURRENT_USER=function(e,r){try{return e.merge(JSON.parse(Pe)),ye(e.all()),e.broadcast(de,e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},Y.GET_AS_PARAM=function(e,r,t){var n=t.key;try{return r.reply({key:n,value:e.get("addr",null),xform:j}),Promise.resolve()}catch(e){return Promise.reject(e)}},Y),ge=function(){return w(pe,he)};function Ee(){ge(),S(he,"DEL_CURRENT_USER")}function we(e){return function(){try{return ge(),Promise.resolve(fe()).then(function(){return S(he,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})})}catch(e){return Promise.reject(e)}}}function be(e){ge();var r=w(function(r){try{var t;return r.send(he,P),Promise.resolve(function(e,r,t){for(var n;;){var o=e();if(le(o)&&(o=o.v),!o)return i;if(o.then){n=0;break}var i=t();if(i&&i.then){if(!le(i)){n=1;break}i=i.s}}var u=new ae,s=se.bind(null,u,2);return(0===n?o.then(a):1===n?i.then(c):(void 0).then(function(){(o=e())?o.then?o.then(a).then(void 0,s):a(o):se(u,1,i)})).then(void 0,s),u;function c(r){i=r;do{if(!(o=e())||le(o)&&!o.v)return void se(u,1,i);if(o.then)return void o.then(a).then(void 0,s);le(i=t())&&(i=i.v)}while(!i||!i.then);i.then(c).then(void 0,s)}function a(e){e?(i=t())&&i.then?i.then(c).then(void 0,s):c(i):se(u,1,i)}}(function(){return!t&&1},0,function(){return Promise.resolve(r.receive()).then(function(n){if("@EXIT"===n.tag)return r.send(he,p),void(t=1);e(n.data)})}))}catch(e){return Promise.reject(e)}});return function(){return S(r,"@EXIT")}}function Se(){return ge(),S(he,"SNAPSHOT",null,{expectReply:!0,timeout:0})}var je=function(){return{authenticate:fe,unauthenticate:Ee,authorization:ce,param:we,subscribe:be,snapshot:Se}},Te=function(){return je().authenticate()},Ie=function(){return je().unauthenticate()},Ae="0.0.56";export{Ae as VERSION,Te as authenticate,je as currentUser,O as decode,q as events,A as resolve,W as sansPrefix,k as send,R as serialize,_ as tx,Ie as unauthenticate,K as withPrefix};
//# sourceMappingURL=fcl.module.js.map

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

!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@onflow/config"),require("@onflow/sdk"),require("@onflow/util-actor"),require("@onflow/types")):"function"==typeof define&&define.amd?define(["exports","@onflow/config","@onflow/sdk","@onflow/util-actor","@onflow/types"],r):r((e=e||self).fcl={},e.config,e.sdk,e.utilActor,e.types)}(this,function(e,r,t,n,o){r.config().put("accessNode.api","http://localhost:8080").put("challenge.handshake","http://localhost:8700/authenticate");var i,u,s=function(e){try{return Promise.resolve(r.config().get("accessNode.api")).then(function(r){return t.resolve(e,[t.resolveRefBlockId({node:r}),t.resolveParams,t.resolveArguments,t.resolveAccounts,t.resolveSignatures,t.resolveValidators])})}catch(e){return Promise.reject(e)}},c=function(e,n){void 0===e&&(e=[]),void 0===n&&(n={});try{var o=function(r){return n.node=r,Array.isArray(e)&&(e=t.build(e)),Promise.resolve(s(e)).then(function(e){return t.send(e,n)})},i=n.node;return Promise.resolve(i?o(i):Promise.resolve(r.config().get("accessNode.api")).then(o))}catch(e){return Promise.reject(e)}},a=function(e){try{return Promise.resolve(r.config().where(/^decoder\./)).then(function(r){var n=Object.fromEntries(Object.entries(r).map(function(e){var r=e[0],t=e[1];return[r="/"+r.replace(/^decoder\./,"")+"$/",t]}));return t.decodeResponse(e,n)})}catch(e){return Promise.reject(e)}},f=function(e){try{return Promise.resolve(c([t.getTransactionStatus(e)])).then(a)}catch(e){return Promise.reject(e)}},l=function(e){return e.status>=4},d=function(e){return e.status>=3},m=function(e){return e.status>=2},h=((i={})[n.INIT]=function(e){try{return Promise.resolve(f(e.self())).then(function(r){l(r)||setTimeout(function(){return e.sendSelf("POLL")},2500),e.merge(r)})}catch(e){return Promise.reject(e)}},i[n.SUBSCRIBE]=function(e,r){e.subscribe(r.from),e.send(r.from,n.UPDATED,e.all())},i[n.UNSUBSCRIBE]=function(e,r){e.unsubscribe(r.from)},i[n.SNAPSHOT]=function(e,r){try{return r.reply(e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},i.POLL=function(e){try{return Promise.resolve(f(e.self())).then(function(r){var t,o;l(r)||setTimeout(function(){return e.sendSelf("POLL")},2500),t=e.all(),o=r,JSON.stringify(t)!==JSON.stringify(o)&&e.broadcast(n.UPDATED,r),e.merge(r)})}catch(e){return Promise.reject(e)}},i),v=function(e){if("object"==typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return e},P=function(e){return n.spawn(h,v(e))};function p(e){function r(r){return n.subscriber(v(e),P,r)}function t(e){return function(t){void 0===t&&(t={});var n=t.suppress||!1;return new Promise(function(t,o){var i=r(function(r){r.statusCode&&!n?(o(r.errorMessage),i()):e(r)&&(t(r),i())})})}}return{snapshot:function(){return n.snapshoter(e,P)},subscribe:r,onceFinalized:t(m),onceExecuted:t(d),onceSealed:t(l)}}function y(){return(y=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function g(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function b(e){var r=0;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,r){if(e){if("string"==typeof e)return g(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?g(e,void 0):void 0}}(e)))return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}p.isUnknown=function(e){return e.status>=0},p.isPending=function(e){return e.status>=1},p.isFinalized=m,p.isExecuted=d,p.isSealed=l,p.isExpired=function(e){return 5===e.status};var E=function(){try{return Promise.resolve(c([t.getLatestBlock()])).then(a)}catch(e){return Promise.reject(e)}},S=function(e){try{var t=setTimeout;return Promise.resolve(r.config().get("fcl.eventPollRate",1e4)).then(function(r){return t(function(){return e.sendSelf("TICK")},r)})}catch(e){return Promise.reject(e)}},j=((u={}).TICK=function(e){try{if(!e.hasSubs())return Promise.resolve();var r=e.get("hwm"),n=function(){if(null==r){var n=e.put;return Promise.resolve(E()).then(function(r){n.call(e,"hwm",r);var t=e.put;return Promise.resolve(S(e)).then(function(r){t.call(e,"tick",r)})})}return Promise.resolve(E()).then(function(n){return e.put("hwm",n),Promise.resolve(c([t.getEvents(e.self(),r.height,n.height-1)])).then(function(r){return Promise.resolve(a(r)).then(function(r){for(var t,n=b(r);!(t=n()).done;)e.broadcast("UPDATED",t.value.data);var o=e.put;return Promise.resolve(S(e)).then(function(r){o.call(e,"tick",r)})})})})}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},u[n.SUBSCRIBE]=function(e,r){try{var t=function(){e.subscribe(r.from)},n=function(){if(!e.hasSubs()){var r=e.put;return Promise.resolve(S(e)).then(function(t){r.call(e,"tick",t)})}}();return Promise.resolve(n&&n.then?n.then(t):t())}catch(e){return Promise.reject(e)}},u[n.UNSUBSCRIBE]=function(e,r){e.unsubscribe(r.from),e.hasSubs()||(clearTimeout(e.get("tick")),e.delete("tick"),e.delete("hwm"))},u),w=function(e){return n.spawn(j,e)};function O(e){return null==e?null:e.replace(/^0x/,"")}function I(e){if(!document.getElementById("FCL_IFRAME")){var r=document.createElement("iframe");return r.src=e,r.id="FCL_IFRAME",r.allow="usb",r.style.position="fixed",r.style.top="0px",r.style.right="0px",r.style.left="0px",r.style.bottom="0px",r.style.height="100vh",r.style.width="100vw",r.style.display="block",r.style.background="rgba(0,0,0,0.25)",r.frameBorder="0",r.style.boxSizing="border-box",r.style.border="1px solid white",document.body.append(r),[r,function(){document.getElementById("FCL_IFRAME")&&document.getElementById("FCL_IFRAME").remove()}]}}function T(e,r){void 0===r&&(r=!0);var t=new URL(e.endpoint);if(r)for(var n=0,o=Object.entries(e.params||{});n<o.length;n++){var i=o[n];t.searchParams.append(i[0],i[1])}return t}function R(e){return I(T(e).href)}var A,k={"HTTP/GET":"GET","HTTP/POST":"POST"},N=function(e,r){return null==r?"'"+e+"'":"'"+e+"' ("+r+")"},C=function(e,r){return"Missing "+N(e,r)+" in Composite Signature."},U=function(e,r){return N(e,r)+" in Composit Signature did not match the requested "+e+"."},B="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",L=B.length,x={"HTTP/POST":function(e,r){try{var t=function(){},n=null;return Promise.resolve(function(e,r){try{var t=e()}catch(e){return r()}return t&&t.then?t.then(r,r):r()}(function(){return function(e,r){try{var t=e()}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}(function(){return Promise.resolve(fetch(T(e),{method:"POST",headers:{"Content-Type":"application/json"},body:r?JSON.stringify(r):void 0}).then(function(e){return e.json()})).then(function(e){if(e.local&&e.local.length>0){var r=R(e.local[0]);t=r[1]}return Promise.resolve(function e(r){return new Promise(function(t,n){try{return Promise.resolve(fetch(T(r),{method:k[r.method],headers:{"Content-Type":"application/json"}}).then(function(e){return e.json()})).then(function(r){"APPROVED"===r.status?t(r.compositeSignature):"DECLINED"===r.status?n({status:r.status,reason:r.reason}):setTimeout(function(){t(e(r.authorizationUpdates))},500)})}catch(e){return Promise.reject(e)}})}(e.authorizationUpdates)).then(function(e){n=e})})},function(n){throw t(),D(e,r,n),n})},function(){return t(),n}))}catch(e){return Promise.reject(e)}},"IFRAME/RPC":function(e,r){try{return Promise.resolve(new Promise(function(t,n){try{var o=function(){for(var e="",r=32;r--;)e+=B[Math.random()*L|0];return e}(),i=R(e),u=i[0],s=i[1];setTimeout(function(){u.contentWindow.postMessage(JSON.parse(JSON.stringify({jsonrpc:"2.0",id:o,method:"fcl:sign",params:[r,e.params]})),"*")},500),window.addEventListener("message",function e(r){var i=r.data;try{if("object"!=typeof i)return Promise.resolve();if("2.0"!==i.jsonrpc)return Promise.resolve();if(i.id!==o)return Promise.resolve();var u=i.result;return"APPROVED"===u.status?(window.removeEventListener("message",e),s(),t(u.compositeSignature)):"DECLINED"===u.status?(window.removeEventListener("message",e),s(),n({status:u.status,reason:u.reason})):(window.removeEventListener("message",e),s(),n({status:"DECLINED",reason:"Status was neither APPROVED nor DECLINED"})),Promise.resolve()}catch(e){return Promise.reject(e)}})}catch(t){D(e,r,t),n({status:"DECLINED",reason:"Trouble talking to Wallet Provider"})}}))}catch(e){return Promise.reject(e)}}};function D(e,r,t){console.error("["+e.method+"] Trouble talking to Wallet Provider","\n\n",{authz:e,signable:r},t)}function z(e,r,t){if(!e.s){if(t instanceof F){if(!t.s)return void(t.o=z.bind(null,e,r));1&r&&(r=t.s),t=t.v}if(t&&t.then)return void t.then(z.bind(null,e,r),z.bind(null,e,2));e.s=r,e.v=t;var n=e.o;n&&n(e)}}var _=function(e){try{return $(),Promise.resolve(J()).then(function(r){function n(){return y({},e,{addr:u.addr,keyId:u.keyId,sequenceNum:i,signature:e.signature||null,signingFunction:function(e){try{return Promise.resolve(function(e,r){try{return Promise.resolve(x[e.method](e,r)).then(function(r){return null==r.sig&&(r.sig=r.signature),null==r.signature&&(r.signature=r.sig),function(e,r){try{if(null==e.addr)throw new Error(C("addr","Address"));if(null==e.keyId)throw new Error(C("keyId"));if(null==e.signature)throw new Error(C("signature"));if(e.addr!==r.addr)throw new Error(U("addr","Address"));if(e.keyId!==r.keyId)throw new Error(U("keyId"))}catch(t){throw console.error(t,"\n\n",{"Composite Signature":e,"Authz Service":r}),new Error("Composite Signature from Wallet Provider failed Validation/Sanitation.\nReason: "+t.message)}}(r,e),r})}catch(e){return Promise.reject(e)}}(u,e))}catch(e){return Promise.reject(e)}},resolve:null,roles:e.roles})}var o,i,u=(void 0===(o=r.services)&&(o=[]),o.find(function(e){return"authz"===e.type})),s=function(){if(e.role.proposer)return Promise.resolve(function(){try{return $(),Promise.resolve(ee()).then(function(e){var r=e.addr;if(null==r)throw new Error("No Flow Address for Current User");return Promise.resolve(c([t.getAccount(r)])).then(function(e){return e.account})})}catch(e){return Promise.reject(e)}}()).then(function(e){var r=e.keys.find(function(e){return e.index===u.keyId});i=r.sequenceNumber})}();return s&&s.then?s.then(n):n()})}catch(e){return Promise.reject(e)}},F=function(){function e(){}return e.prototype.then=function(r,t){var n=new e,o=this.s;if(o){var i=1&o?r:t;if(i){try{z(n,1,i(this.v))}catch(e){z(n,2,e)}return n}return this}return this.o=function(e){try{var o=e.v;1&e.s?z(n,1,r?r(o):o):t?z(n,1,t(o)):z(n,2,o)}catch(e){z(n,2,e)}},n},e}();function M(e){return e instanceof F&&1&e.s}var J=function(){try{return Promise.resolve(new Promise(function(e){try{return $(),Promise.resolve(ee()).then(function(t){return t.loggedIn?e(t):Promise.resolve(r.config().get("challenge.handshake")).then(function(r){var t,o,i,u=(o=(t={handshake:r,l6n:window.location.origin}).l6n,(i=new URL(t.handshake)).searchParams.append("l6n",o),I(i.href))[1];window.addEventListener("message",function r(t){var o=t.data;try{if(o.type!==G)return Promise.resolve();u(),window.removeEventListener("message",r);var i="did:fcl:"+o.addr,s=o.addr,c=o.services||[];return Promise.resolve(function(e,r){try{if(null==e||null==r)return Promise.resolve([]);var t=new URL(e);return t.searchParams.append("code",r),Promise.resolve(fetch(t,{method:"GET",headers:{"Content-Type":"application/json"}}).then(function(e){return e.json()})).then(function(e){if(Array.isArray(e))return e;var r=[];if(Array.isArray(e.authorizations))for(var t,n=b(e.authorizations);!(t=n()).done;)r.push(y({type:"authz",keyId:e.keyId},t.value));return null!=e.provider&&r.push(y({type:"authn",id:"wallet-provider#authn"},e.provider)),r})}catch(e){return Promise.reject(e)}}(o.hks,o.code)).then(function(r){var t,o,u={addr:s,cid:i,loggedIn:!0,services:(t=c,o=r,void 0===t&&(t=[]),void 0===o&&(o=[]),[].concat(t,o))};return n.send(H,q,u),Promise.resolve(ee()).then(function(r){e(r)})})}catch(e){return Promise.reject(e)}})})})}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}},H="CURRENT_USER",V="CURRENT_USER/UPDATED",q="SET_CURRENT_USER",G="FCL::CHALLENGE::RESPONSE",W='{\n "VERSION": "0.2.0",\n "addr":null,\n "cid":null,\n "loggedIn":null,\n "services":[]\n}',K=function(e){try{return localStorage.setItem(H,JSON.stringify(e)),Promise.resolve(e)}catch(e){return Promise.reject(e)}},X=((A={})[n.INIT]=function(e){try{var r=e.merge;return Promise.resolve(function(){try{var e=JSON.parse(W),r=JSON.parse(localStorage.getItem(H));return null!=r&&e.VERSION!==r.VERSION?(localStorage.removeItem(H),Promise.resolve(e)):Promise.resolve(r||e)}catch(e){return Promise.reject(e)}}()).then(function(t){r.call(e,t)})}catch(e){return Promise.reject(e)}},A[n.SUBSCRIBE]=function(e,r){e.subscribe(r.from),e.send(r.from,V,e.all())},A[n.UNSUBSCRIBE]=function(e,r){e.unsubscribe(r.from)},A.SNAPSHOT=function(e,r){try{return r.reply(e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},A[q]=function(e,r,t){try{return e.merge(t),K(e.all()),e.broadcast(V,e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},A.DEL_CURRENT_USER=function(e,r){try{return e.merge(JSON.parse(W)),K(e.all()),e.broadcast(V,e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},A.GET_AS_PARAM=function(e,r,t){var n=t.key;try{return r.reply({key:n,value:e.get("addr",null),xform:o.Identity}),Promise.resolve()}catch(e){return Promise.reject(e)}},A),$=function(){return n.spawn(X,H)};function Q(){$(),n.send(H,"DEL_CURRENT_USER")}function Y(e){return function(){try{return $(),Promise.resolve(J()).then(function(){return n.send(H,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})})}catch(e){return Promise.reject(e)}}}function Z(e){$();var r=n.spawn(function(r){try{var t;return r.send(H,n.SUBSCRIBE),Promise.resolve(function(e,r,t){for(var n;;){var o=e();if(M(o)&&(o=o.v),!o)return i;if(o.then){n=0;break}var i=t();if(i&&i.then){if(!M(i)){n=1;break}i=i.s}}var u=new F,s=z.bind(null,u,2);return(0===n?o.then(a):1===n?i.then(c):(void 0).then(function(){(o=e())?o.then?o.then(a).then(void 0,s):a(o):z(u,1,i)})).then(void 0,s),u;function c(r){i=r;do{if(!(o=e())||M(o)&&!o.v)return void z(u,1,i);if(o.then)return void o.then(a).then(void 0,s);M(i=t())&&(i=i.v)}while(!i||!i.then);i.then(c).then(void 0,s)}function a(e){e?(i=t())&&i.then?i.then(c).then(void 0,s):c(i):z(u,1,i)}}(function(){return!t&&1},0,function(){return Promise.resolve(r.receive()).then(function(o){if("@EXIT"===o.tag)return r.send(H,n.UNSUBSCRIBE),void(t=1);e(o.data)})}))}catch(e){return Promise.reject(e)}});return function(){return n.send(r,"@EXIT")}}function ee(){return $(),n.send(H,"SNAPSHOT",null,{expectReply:!0,timeout:0})}var re=function(){return{authenticate:J,unauthenticate:Q,authorization:_,param:Y,subscribe:Z,snapshot:ee}};Object.defineProperty(e,"config",{enumerable:!0,get:function(){return r.config}}),Object.defineProperty(e,"arg",{enumerable:!0,get:function(){return t.arg}}),Object.defineProperty(e,"args",{enumerable:!0,get:function(){return t.args}}),Object.defineProperty(e,"authorization",{enumerable:!0,get:function(){return t.authorization}}),Object.defineProperty(e,"authorizations",{enumerable:!0,get:function(){return t.authorizations}}),Object.defineProperty(e,"build",{enumerable:!0,get:function(){return t.build}}),Object.defineProperty(e,"cadence",{enumerable:!0,get:function(){return t.cadence}}),Object.defineProperty(e,"cdc",{enumerable:!0,get:function(){return t.cdc}}),Object.defineProperty(e,"getAccount",{enumerable:!0,get:function(){return t.getAccount}}),Object.defineProperty(e,"getBlockByHeight",{enumerable:!0,get:function(){return t.getBlockByHeight}}),Object.defineProperty(e,"getBlockById",{enumerable:!0,get:function(){return t.getBlockById}}),Object.defineProperty(e,"getEvents",{enumerable:!0,get:function(){return t.getEvents}}),Object.defineProperty(e,"getLatestBlock",{enumerable:!0,get:function(){return t.getLatestBlock}}),Object.defineProperty(e,"getTransactionStatus",{enumerable:!0,get:function(){return t.getTransactionStatus}}),Object.defineProperty(e,"isBad",{enumerable:!0,get:function(){return t.isBad}}),Object.defineProperty(e,"isOk",{enumerable:!0,get:function(){return t.isOk}}),Object.defineProperty(e,"limit",{enumerable:!0,get:function(){return t.limit}}),Object.defineProperty(e,"param",{enumerable:!0,get:function(){return t.param}}),Object.defineProperty(e,"params",{enumerable:!0,get:function(){return t.params}}),Object.defineProperty(e,"payer",{enumerable:!0,get:function(){return t.payer}}),Object.defineProperty(e,"ping",{enumerable:!0,get:function(){return t.ping}}),Object.defineProperty(e,"pipe",{enumerable:!0,get:function(){return t.pipe}}),Object.defineProperty(e,"proposer",{enumerable:!0,get:function(){return t.proposer}}),Object.defineProperty(e,"ref",{enumerable:!0,get:function(){return t.ref}}),Object.defineProperty(e,"script",{enumerable:!0,get:function(){return t.script}}),Object.defineProperty(e,"transaction",{enumerable:!0,get:function(){return t.transaction}}),Object.defineProperty(e,"why",{enumerable:!0,get:function(){return t.why}}),e.VERSION="0.0.56",e.authenticate=function(){return re().authenticate()},e.currentUser=re,e.decode=a,e.events=function(e){return{subscribe:function(r){return n.subscriber(e,w,r)}}},e.resolve=s,e.sansPrefix=O,e.send=c,e.serialize=function(e){void 0===e&&(e=[]);try{var r=function(){return Promise.resolve(s(e)).then(JSON.stringify)},n=function(){if(Array.isArray(e))return Promise.resolve(t.build(e)).then(function(r){e=r})}();return Promise.resolve(n&&n.then?n.then(r):r())}catch(e){return Promise.reject(e)}},e.tx=p,e.unauthenticate=function(){return re().unauthenticate()},e.withPrefix=function(e){return null==e?null:"0x"+O(e)}});
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@onflow/config"),require("@onflow/sdk"),require("@onflow/sdk-resolve-cadence"),require("@onflow/util-actor"),require("@onflow/types")):"function"==typeof define&&define.amd?define(["exports","@onflow/config","@onflow/sdk","@onflow/sdk-resolve-cadence","@onflow/util-actor","@onflow/types"],r):r((e=e||self).fcl={},e.config,e.sdk,e.sdkResolveCadence,e.utilActor,e.types)}(this,function(e,r,t,n,o,i){r.config().put("accessNode.api","http://localhost:8080").put("challenge.handshake","http://localhost:8700/authenticate");var u,c,s=function(e){try{return Promise.resolve(r.config().get("accessNode.api")).then(function(r){return t.resolve(e,[n.resolveCadence,t.resolveRefBlockId({node:r}),t.resolveArguments,t.resolveAccounts,t.resolveSignatures,t.resolveValidators])})}catch(e){return Promise.reject(e)}},a=function(e,n){void 0===e&&(e=[]),void 0===n&&(n={});try{var o=function(r){return n.node=r,Array.isArray(e)&&(e=t.build(e)),Promise.resolve(s(e)).then(function(e){return t.send(e,n)})},i=n.node;return Promise.resolve(i?o(i):Promise.resolve(r.config().get("accessNode.api")).then(o))}catch(e){return Promise.reject(e)}},l=function(e){try{return Promise.resolve(r.config().where(/^decoder\./)).then(function(r){var n=Object.fromEntries(Object.entries(r).map(function(e){var r=e[0],t=e[1];return[r="/"+r.replace(/^decoder\./,"")+"$/",t]}));return t.decodeResponse(e,n)})}catch(e){return Promise.reject(e)}},f=function(e){try{return Promise.resolve(a([t.getTransactionStatus(e)])).then(l)}catch(e){return Promise.reject(e)}},d=function(e){return e.status>=4},m=function(e){return e.status>=3},h=function(e){return e.status>=2},v=((u={})[o.INIT]=function(e){try{return Promise.resolve(f(e.self())).then(function(r){d(r)||setTimeout(function(){return e.sendSelf("POLL")},2500),e.merge(r)})}catch(e){return Promise.reject(e)}},u[o.SUBSCRIBE]=function(e,r){e.subscribe(r.from),e.send(r.from,o.UPDATED,e.all())},u[o.UNSUBSCRIBE]=function(e,r){e.unsubscribe(r.from)},u[o.SNAPSHOT]=function(e,r){try{return r.reply(e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},u.POLL=function(e){try{return Promise.resolve(f(e.self())).then(function(r){var t,n;d(r)||setTimeout(function(){return e.sendSelf("POLL")},2500),t=e.all(),n=r,JSON.stringify(t)!==JSON.stringify(n)&&e.broadcast(o.UPDATED,r),e.merge(r)})}catch(e){return Promise.reject(e)}},u),P=function(e){if("object"==typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return e},p=function(e){return o.spawn(v,P(e))};function y(e){function r(r){return o.subscriber(P(e),p,r)}function t(e){return function(t){void 0===t&&(t={});var n=t.suppress||!1;return new Promise(function(t,o){var i=r(function(r){r.statusCode&&!n?(o(r.errorMessage),i()):e(r)&&(t(r),i())})})}}return{snapshot:function(){return o.snapshoter(e,p)},subscribe:r,onceFinalized:t(h),onceExecuted:t(m),onceSealed:t(d)}}function g(){return(g=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function b(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function E(e){var r=0;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,r){if(e){if("string"==typeof e)return b(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?b(e,void 0):void 0}}(e)))return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}y.isUnknown=function(e){return e.status>=0},y.isPending=function(e){return e.status>=1},y.isFinalized=h,y.isExecuted=m,y.isSealed=d,y.isExpired=function(e){return 5===e.status};var S=function(){try{return Promise.resolve(a([t.getLatestBlock()])).then(l)}catch(e){return Promise.reject(e)}},j=function(e){try{var t=setTimeout;return Promise.resolve(r.config().get("fcl.eventPollRate",1e4)).then(function(r){return t(function(){return e.sendSelf("TICK")},r)})}catch(e){return Promise.reject(e)}},w=((c={}).TICK=function(e){try{if(!e.hasSubs())return Promise.resolve();var r=e.get("hwm"),n=function(){if(null==r){var n=e.put;return Promise.resolve(S()).then(function(r){n.call(e,"hwm",r);var t=e.put;return Promise.resolve(j(e)).then(function(r){t.call(e,"tick",r)})})}return Promise.resolve(S()).then(function(n){return e.put("hwm",n),Promise.resolve(a([t.getEvents(e.self(),r.height,n.height-1)])).then(function(r){return Promise.resolve(l(r)).then(function(r){for(var t,n=E(r);!(t=n()).done;)e.broadcast("UPDATED",t.value.data);var o=e.put;return Promise.resolve(j(e)).then(function(r){o.call(e,"tick",r)})})})})}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},c[o.SUBSCRIBE]=function(e,r){try{var t=function(){e.subscribe(r.from)},n=function(){if(!e.hasSubs()){var r=e.put;return Promise.resolve(j(e)).then(function(t){r.call(e,"tick",t)})}}();return Promise.resolve(n&&n.then?n.then(t):t())}catch(e){return Promise.reject(e)}},c[o.UNSUBSCRIBE]=function(e,r){e.unsubscribe(r.from),e.hasSubs()||(clearTimeout(e.get("tick")),e.delete("tick"),e.delete("hwm"))},c),O=function(e){return o.spawn(w,e)};function I(e){return null==e?null:e.replace(/^0x/,"")}function R(e){if(!document.getElementById("FCL_IFRAME")){var r=document.createElement("iframe");return r.src=e,r.id="FCL_IFRAME",r.allow="usb",r.style.position="fixed",r.style.top="0px",r.style.right="0px",r.style.left="0px",r.style.bottom="0px",r.style.height="100vh",r.style.width="100vw",r.style.display="block",r.style.background="rgba(0,0,0,0.25)",r.style.zIndex=2147483647,r.frameBorder="0",r.style.boxSizing="border-box",document.body.append(r),[r,function(){document.getElementById("FCL_IFRAME")&&document.getElementById("FCL_IFRAME").remove()}]}}function T(e,r){void 0===r&&(r=!0);var t=new URL(e.endpoint);if(r)for(var n=0,o=Object.entries(e.params||{});n<o.length;n++){var i=o[n];t.searchParams.append(i[0],i[1])}return t}function k(e){return R(T(e).href)}var A,N={"HTTP/GET":"GET","HTTP/POST":"POST"},C=function(e,r){return null==r?"'"+e+"'":"'"+e+"' ("+r+")"},U=function(e,r){return"Missing "+C(e,r)+" in Composite Signature."},B=function(e,r){return C(e,r)+" in Composit Signature did not match the requested "+e+"."},L="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",x=L.length,D={"HTTP/POST":function(e,r){try{var t=function(){},n=null;return Promise.resolve(function(e,r){try{var t=e()}catch(e){return r()}return t&&t.then?t.then(r,r):r()}(function(){return function(e,r){try{var t=e()}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}(function(){return Promise.resolve(fetch(T(e),{method:"POST",headers:{"Content-Type":"application/json"},body:r?JSON.stringify(r):void 0}).then(function(e){return e.json()})).then(function(e){if(e.local&&e.local.length>0){var r=k(e.local[0]);t=r[1]}return Promise.resolve(function e(r){return new Promise(function(t,n){try{return Promise.resolve(fetch(T(r),{method:N[r.method],headers:{"Content-Type":"application/json"}}).then(function(e){return e.json()})).then(function(r){"APPROVED"===r.status?t(r.compositeSignature):"DECLINED"===r.status?n({status:r.status,reason:r.reason}):setTimeout(function(){t(e(r.authorizationUpdates))},500)})}catch(e){return Promise.reject(e)}})}(e.authorizationUpdates)).then(function(e){n=e})})},function(n){throw t(),z(e,r,n),n})},function(){return t(),n}))}catch(e){return Promise.reject(e)}},"IFRAME/RPC":function(e,r){try{return Promise.resolve(new Promise(function(t,n){try{var o=function(){for(var e="",r=32;r--;)e+=L[Math.random()*x|0];return e}(),i=k(e),u=i[0],c=i[1];setTimeout(function(){u.contentWindow.postMessage(JSON.parse(JSON.stringify({jsonrpc:"2.0",id:o,method:"fcl:sign",params:[r,e.params]})),"*")},500),window.addEventListener("message",function e(r){var i=r.data;try{if("object"!=typeof i)return Promise.resolve();if("2.0"!==i.jsonrpc)return Promise.resolve();if(i.id!==o)return Promise.resolve();var u=i.result;return"APPROVED"===u.status?(window.removeEventListener("message",e),c(),t(u.compositeSignature)):"DECLINED"===u.status?(window.removeEventListener("message",e),c(),n({status:u.status,reason:u.reason})):(window.removeEventListener("message",e),c(),n({status:"DECLINED",reason:"Status was neither APPROVED nor DECLINED"})),Promise.resolve()}catch(e){return Promise.reject(e)}})}catch(t){z(e,r,t),n({status:"DECLINED",reason:"Trouble talking to Wallet Provider"})}}))}catch(e){return Promise.reject(e)}}};function z(e,r,t){console.error("["+e.method+"] Trouble talking to Wallet Provider","\n\n",{authz:e,signable:r},t)}function _(e,r,t){if(!e.s){if(t instanceof M){if(!t.s)return void(t.o=_.bind(null,e,r));1&r&&(r=t.s),t=t.v}if(t&&t.then)return void t.then(_.bind(null,e,r),_.bind(null,e,2));e.s=r,e.v=t;var n=e.o;n&&n(e)}}var F=function(e){try{return Q(),Promise.resolve(q()).then(function(r){function n(){return g({},e,{addr:u.addr,keyId:u.keyId,sequenceNum:i,signature:e.signature||null,signingFunction:function(e){try{return Promise.resolve(function(e,r){try{return Promise.resolve(D[e.method](e,r)).then(function(r){return null==r.sig&&(r.sig=r.signature),null==r.signature&&(r.signature=r.sig),function(e,r){try{if(null==e.addr)throw new Error(U("addr","Address"));if(null==e.keyId)throw new Error(U("keyId"));if(null==e.signature)throw new Error(U("signature"));if(e.addr!==r.addr)throw new Error(B("addr","Address"));if(e.keyId!==r.keyId)throw new Error(B("keyId"))}catch(t){throw console.error(t,"\n\n",{"Composite Signature":e,"Authz Service":r}),new Error("Composite Signature from Wallet Provider failed Validation/Sanitation.\nReason: "+t.message)}}(r,e),r})}catch(e){return Promise.reject(e)}}(u,e))}catch(e){return Promise.reject(e)}},resolve:null,roles:e.roles})}var o,i,u=(void 0===(o=r.services)&&(o=[]),o.find(function(e){return"authz"===e.type})),c=function(){if(e.role.proposer)return Promise.resolve(function(){try{return Q(),Promise.resolve(re()).then(function(e){var r=e.addr;if(null==r)throw new Error("No Flow Address for Current User");return Promise.resolve(a([t.getAccount(r)])).then(function(e){return e.account})})}catch(e){return Promise.reject(e)}}()).then(function(e){var r=e.keys.find(function(e){return e.index===u.keyId});i=r.sequenceNumber})}();return c&&c.then?c.then(n):n()})}catch(e){return Promise.reject(e)}},M=function(){function e(){}return e.prototype.then=function(r,t){var n=new e,o=this.s;if(o){var i=1&o?r:t;if(i){try{_(n,1,i(this.v))}catch(e){_(n,2,e)}return n}return this}return this.o=function(e){try{var o=e.v;1&e.s?_(n,1,r?r(o):o):t?_(n,1,t(o)):_(n,2,o)}catch(e){_(n,2,e)}},n},e}();function J(e){return e instanceof M&&1&e.s}var q=function(){try{return Promise.resolve(new Promise(function(e){try{return Q(),Promise.resolve(re()).then(function(t){return t.loggedIn?e(t):Promise.resolve(r.config().get("challenge.handshake")).then(function(r){var t,n,i,u=(n=(t={handshake:r,l6n:window.location.origin}).l6n,(i=new URL(t.handshake)).searchParams.append("l6n",n),R(i.href))[1];window.addEventListener("message",function r(t){var n=t.data;try{if(n.type!==W)return Promise.resolve();u(),window.removeEventListener("message",r);var i="did:fcl:"+n.addr,c=n.addr,s=n.services||[];return Promise.resolve(function(e,r){try{if(null==e||null==r)return Promise.resolve([]);var t=new URL(e);return t.searchParams.append("code",r),Promise.resolve(fetch(t,{method:"GET",headers:{"Content-Type":"application/json"}}).then(function(e){return e.json()})).then(function(e){if(Array.isArray(e))return e;var r=[];if(Array.isArray(e.authorizations))for(var t,n=E(e.authorizations);!(t=n()).done;)r.push(g({type:"authz",keyId:e.keyId},t.value));return null!=e.provider&&r.push(g({type:"authn",id:"wallet-provider#authn"},e.provider)),r})}catch(e){return Promise.reject(e)}}(n.hks,n.code)).then(function(r){var t,n,u={addr:c,cid:i,loggedIn:!0,services:(t=s,n=r,void 0===t&&(t=[]),void 0===n&&(n=[]),[].concat(t,n))};return o.send(H,G,u),Promise.resolve(re()).then(function(r){e(r)})})}catch(e){return Promise.reject(e)}})})})}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}},H="CURRENT_USER",V="CURRENT_USER/UPDATED",G="SET_CURRENT_USER",W="FCL::CHALLENGE::RESPONSE",K='{\n "VERSION": "0.2.0",\n "addr":null,\n "cid":null,\n "loggedIn":null,\n "services":[]\n}',X=function(e){try{return localStorage.setItem(H,JSON.stringify(e)),Promise.resolve(e)}catch(e){return Promise.reject(e)}},$=((A={})[o.INIT]=function(e){try{var r=e.merge;return Promise.resolve(function(){try{var e=JSON.parse(K),r=JSON.parse(localStorage.getItem(H));return null!=r&&e.VERSION!==r.VERSION?(localStorage.removeItem(H),Promise.resolve(e)):Promise.resolve(r||e)}catch(e){return Promise.reject(e)}}()).then(function(t){r.call(e,t)})}catch(e){return Promise.reject(e)}},A[o.SUBSCRIBE]=function(e,r){e.subscribe(r.from),e.send(r.from,V,e.all())},A[o.UNSUBSCRIBE]=function(e,r){e.unsubscribe(r.from)},A.SNAPSHOT=function(e,r){try{return r.reply(e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},A[G]=function(e,r,t){try{return e.merge(t),X(e.all()),e.broadcast(V,e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},A.DEL_CURRENT_USER=function(e,r){try{return e.merge(JSON.parse(K)),X(e.all()),e.broadcast(V,e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},A.GET_AS_PARAM=function(e,r,t){var n=t.key;try{return r.reply({key:n,value:e.get("addr",null),xform:i.Identity}),Promise.resolve()}catch(e){return Promise.reject(e)}},A),Q=function(){return o.spawn($,H)};function Y(){Q(),o.send(H,"DEL_CURRENT_USER")}function Z(e){return function(){try{return Q(),Promise.resolve(q()).then(function(){return o.send(H,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})})}catch(e){return Promise.reject(e)}}}function ee(e){Q();var r=o.spawn(function(r){try{var t;return r.send(H,o.SUBSCRIBE),Promise.resolve(function(e,r,t){for(var n;;){var o=e();if(J(o)&&(o=o.v),!o)return i;if(o.then){n=0;break}var i=t();if(i&&i.then){if(!J(i)){n=1;break}i=i.s}}var u=new M,c=_.bind(null,u,2);return(0===n?o.then(a):1===n?i.then(s):(void 0).then(function(){(o=e())?o.then?o.then(a).then(void 0,c):a(o):_(u,1,i)})).then(void 0,c),u;function s(r){i=r;do{if(!(o=e())||J(o)&&!o.v)return void _(u,1,i);if(o.then)return void o.then(a).then(void 0,c);J(i=t())&&(i=i.v)}while(!i||!i.then);i.then(s).then(void 0,c)}function a(e){e?(i=t())&&i.then?i.then(s).then(void 0,c):s(i):_(u,1,i)}}(function(){return!t&&1},0,function(){return Promise.resolve(r.receive()).then(function(n){if("@EXIT"===n.tag)return r.send(H,o.UNSUBSCRIBE),void(t=1);e(n.data)})}))}catch(e){return Promise.reject(e)}});return function(){return o.send(r,"@EXIT")}}function re(){return Q(),o.send(H,"SNAPSHOT",null,{expectReply:!0,timeout:0})}var te=function(){return{authenticate:q,unauthenticate:Y,authorization:F,param:Z,subscribe:ee,snapshot:re}};Object.defineProperty(e,"config",{enumerable:!0,get:function(){return r.config}}),Object.defineProperty(e,"arg",{enumerable:!0,get:function(){return t.arg}}),Object.defineProperty(e,"args",{enumerable:!0,get:function(){return t.args}}),Object.defineProperty(e,"authorization",{enumerable:!0,get:function(){return t.authorization}}),Object.defineProperty(e,"authorizations",{enumerable:!0,get:function(){return t.authorizations}}),Object.defineProperty(e,"build",{enumerable:!0,get:function(){return t.build}}),Object.defineProperty(e,"cadence",{enumerable:!0,get:function(){return t.cadence}}),Object.defineProperty(e,"cdc",{enumerable:!0,get:function(){return t.cdc}}),Object.defineProperty(e,"getAccount",{enumerable:!0,get:function(){return t.getAccount}}),Object.defineProperty(e,"getBlockByHeight",{enumerable:!0,get:function(){return t.getBlockByHeight}}),Object.defineProperty(e,"getBlockById",{enumerable:!0,get:function(){return t.getBlockById}}),Object.defineProperty(e,"getEvents",{enumerable:!0,get:function(){return t.getEvents}}),Object.defineProperty(e,"getLatestBlock",{enumerable:!0,get:function(){return t.getLatestBlock}}),Object.defineProperty(e,"getTransactionStatus",{enumerable:!0,get:function(){return t.getTransactionStatus}}),Object.defineProperty(e,"isBad",{enumerable:!0,get:function(){return t.isBad}}),Object.defineProperty(e,"isOk",{enumerable:!0,get:function(){return t.isOk}}),Object.defineProperty(e,"limit",{enumerable:!0,get:function(){return t.limit}}),Object.defineProperty(e,"param",{enumerable:!0,get:function(){return t.param}}),Object.defineProperty(e,"params",{enumerable:!0,get:function(){return t.params}}),Object.defineProperty(e,"payer",{enumerable:!0,get:function(){return t.payer}}),Object.defineProperty(e,"ping",{enumerable:!0,get:function(){return t.ping}}),Object.defineProperty(e,"pipe",{enumerable:!0,get:function(){return t.pipe}}),Object.defineProperty(e,"proposer",{enumerable:!0,get:function(){return t.proposer}}),Object.defineProperty(e,"ref",{enumerable:!0,get:function(){return t.ref}}),Object.defineProperty(e,"script",{enumerable:!0,get:function(){return t.script}}),Object.defineProperty(e,"transaction",{enumerable:!0,get:function(){return t.transaction}}),Object.defineProperty(e,"why",{enumerable:!0,get:function(){return t.why}}),e.VERSION="0.0.56",e.authenticate=function(){return te().authenticate()},e.currentUser=te,e.decode=l,e.events=function(e){return{subscribe:function(r){return o.subscriber(e,O,r)}}},e.resolve=s,e.sansPrefix=I,e.send=a,e.serialize=function(e){void 0===e&&(e=[]);try{var r=function(){return Promise.resolve(s(e)).then(JSON.stringify)},n=function(){if(Array.isArray(e))return Promise.resolve(t.build(e)).then(function(r){e=r})}();return Promise.resolve(n&&n.then?n.then(r):r())}catch(e){return Promise.reject(e)}},e.tx=y,e.unauthenticate=function(){return te().unauthenticate()},e.withPrefix=function(e){return null==e?null:"0x"+I(e)}});
//# sourceMappingURL=fcl.umd.js.map
{
"name": "@onflow/fcl",
"version": "0.0.56",
"version": "0.0.57",
"description": "Flow Client Library",

@@ -37,8 +37,9 @@ "license": "Apache-2.0",

"dependencies": {
"@onflow/config": "0.0.2",
"@onflow/sdk": "0.0.31",
"@onflow/sdk-resolve-cadence": "0.0.0",
"@onflow/types": "0.0.2",
"@onflow/util-actor": "0.0.2",
"@onflow/config": "0.0.2",
"queue-microtask": "1.1.2"
}
}

@@ -11,3 +11,3 @@ # @onflow/fcl

The things that exists probably won't be chainging much externally, we will be adding new functionality in the near future.
The things that exists probably won't be changing much externally, we will be adding new functionality in the near future.

@@ -14,0 +14,0 @@ # Install

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