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

@onflow/fcl

Package Overview
Dependencies
Maintainers
7
Versions
312
Alerts
File Explorer

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.55-debug.1 to 0.0.55-debug.2

2

dist/fcl.js

@@ -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},p=function(e){return t.spawn(h,m(e))};function v(e){function r(r){return t.subscriber(m(e),p,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,p)},subscribe:r,onceFinalized:n(d),onceExecuted:n(f),onceSealed:n(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 P(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 P(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)?P(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)}v.isUnknown=function(e){return e.status>=0},v.isPending=function(e){return e.status>=1},v.isFinalized=d,v.isExecuted=f,v.isSealed=l,v.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 x(e){return null==e?null:e.replace(/^0x/,"")}var w="FCL_IFRAME_CHALLENGE";function O(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}var I="FCL_IFRAME_AUTHZ";function T(e){if(!document.getElementById(I)){var r=O(e),t=document.createElement("iframe");return t.src=r.href,t.id=I,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,function(){document.getElementById(I)&&document.getElementById(I).remove()}]}}var A,R={"HTTP/GET":"GET","HTTP/POST":"POST"},k="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",N=k.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(O(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(O(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(e){throw t(),console.error(e),e})},function(){return t(),n}))}catch(e){return Promise.reject(e)}},"IFRAME/RPC":function(e,r){try{return Promise.resolve(new Promise(function(t,n){var o=function(){for(var e="",r=32;r--;)e+=k[Math.random()*N|0];return e}();T(e)[0].contentWindow.postMessage({jsonrpc:"2.0",id:o,method:"fcl:sign",params:[r,e.params]},"*"),window.addListener("message",function(e){var r=e.data;try{if("object"!=typeof r)return Promise.resolve();if("2.0"!==r.jsonrpc)return Promise.resolve();if(r.id!==o)return Promise.resolve();var i=r.result;return"APPROVED"===i.status?t(i.compositeSignature):n("DECLINED"===i.status?{status:i.status,reason:i.reason}:{status:"DECLINED",reason:"Status was neither APPROVED nor DECLINED"}),Promise.resolve()}catch(e){return Promise.reject(e)}})}))}catch(e){return Promise.reject(e)}}},U=function(e,r){return null==r?"'"+e+"'":"'"+e+"' ("+r+")"},C=function(e,r){return"Missing "+U(e,r)+" in Composite Signature."},L=function(e,r){return U(e,r)+" in Composit Signature did not match the requested "+e+"."};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 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(B[e.method](e,r))}catch(e){return Promise.reject(e)}}(u,e)).then(function(e){return 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.sig)throw new Error(C("sig","Signature"));if(e.addr!==r.addr)throw new Error(L("addr","Address"));if(e.keyId!==r.keyId)throw new Error(L("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)}}(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(Y()).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 H(e){return e instanceof _&&1&e.s}var M=function(){try{return Promise.resolve(new Promise(function(r){try{return X(),Promise.resolve(Y()).then(function(n){return n.loggedIn?r(n):Promise.resolve(e.config().get("challenge.handshake")).then(function(e){var n=function(e){var r=e.handshake,t=e.l6n;if(!document.getElementById(w)){var n=new URL(r);n.searchParams.append("l6n",t);var o=document.createElement("iframe");return o.src=n.href,o.id=w,o.allow="usb",o.style.position="fixed",o.style.top="0px",o.style.right="0px",o.style.left="0px",o.style.bottom="0px",o.style.height="100vh",o.style.width="100vw",o.style.display="block",o.style.background="rgba(0,0,0,0.25)",o.frameBorder="0",o.style.boxSizing="border-box",o.style.border="1px solid white",document.body.append(o),function(){document.getElementById(w)&&document.getElementById(w).remove()}}}({handshake:e,l6n:window.location.origin});window.addEventListener("message",function(e){var o=e.data;try{if(console.log("MESSAGE",o),o.type!==G)return Promise.resolve();n();var i="did:fcl:"+o.addr,u=o.addr,s=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(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 n,o,c={addr:u,cid:i,loggedIn:!0,services:(n=s,o=e,void 0===n&&(n=[]),void 0===o&&(o=[]),[].concat(n,o))};return t.send(F,q,c),Promise.resolve(Y()).then(function(e){r(e)})})}catch(e){return Promise.reject(e)}})})})}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}},F="CURRENT_USER",V="CURRENT_USER/UPDATED",q="SET_CURRENT_USER",G="FCL::CHALLENGE::RESPONSE",J='{\n "VERSION": "0.2.0",\n "addr":null,\n "cid":null,\n "loggedIn":null,\n "services":[]\n}',K=function(e){try{return localStorage.setItem(F,JSON.stringify(e)),Promise.resolve(e)}catch(e){return Promise.reject(e)}},W=((A={})[t.INIT]=function(e){try{var r=e.merge;return Promise.resolve(function(){try{var e=JSON.parse(J),r=JSON.parse(localStorage.getItem(F));return null!=r&&e.VERSION!==r.VERSION?(localStorage.removeItem(F),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[t.SUBSCRIBE]=function(e,r){e.subscribe(r.from),e.send(r.from,V,e.all())},A[t.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(J)),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 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)}},A),X=function(){return t.spawn(W,F)};function Z(){X(),t.send(F,"DEL_CURRENT_USER")}function $(e){return function(){try{return X(),Promise.resolve(M()).then(function(){return t.send(F,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})})}catch(e){return Promise.reject(e)}}}function Q(e){X();var r=t.spawn(function(r){try{var n;return r.send(F,t.SUBSCRIBE),Promise.resolve(function(e,r,t){for(var n;;){var o=e();if(H(o)&&(o=o.v),!o)return i;if(o.then){n=0;break}var i=t();if(i&&i.then){if(!H(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())||H(o)&&!o.v)return void D(u,1,i);if(o.then)return void o.then(a).then(void 0,s);H(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(F,t.UNSUBSCRIBE),void(n=1);e(o.data)})}))}catch(e){return Promise.reject(e)}});return function(){return t.send(r,"@EXIT")}}function Y(){return X(),t.send(F,"SNAPSHOT",null,{expectReply:!0,timeout:0})}var ee=function(){return{authenticate:M,unauthenticate:Z,authorization:z,param:$,subscribe:Q,snapshot:Y}};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.51",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=x,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=v,exports.unauthenticate=function(){return ee().unauthenticate()},exports.withPrefix=function(e){return null==e?null:"0x"+x(e)};
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},m=((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),h=function(e){if("object"==typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return e},v=function(e){return t.spawn(m,h(e))};function p(e){function r(r){return t.subscriber(h(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 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 P(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 P(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)?P(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 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}var O="FCL_IFRAME_AUTHZ";function I(e){if(!document.getElementById(O)){var r=x(e),t=document.createElement("iframe");return t.src=r.href,t.id=O,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,function(){document.getElementById(O)&&document.getElementById(O).remove()}]}}var A,R={"HTTP/GET":"GET","HTTP/POST":"POST"},T="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",k=T.length,N={"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(e){throw t(),console.error(e),e})},function(){return t(),n}))}catch(e){return Promise.reject(e)}},"IFRAME/RPC":function(e,r){try{return Promise.resolve(new Promise(function(t,n){var o=function(){for(var e="",r=32;r--;)e+=T[Math.random()*k|0];return e}();I(e)[0].contentWindow.postMessage({jsonrpc:"2.0",id:o,method:"fcl:sign",params:[r,e.params]},"*"),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),t(u.compositeSignature)):"DECLINED"===u.status?(window.removeEventListener("message",e),n({status:u.status,reason:u.reason})):(window.removeEventListener("message",e),n({status:"DECLINED",reason:"Status was neither APPROVED nor DECLINED"})),Promise.resolve()}catch(e){return Promise.reject(e)}})}))}catch(e){return Promise.reject(e)}}},C=function(e,r){return null==r?"'"+e+"'":"'"+e+"' ("+r+")"},B=function(e,r){return"Missing "+C(e,r)+" in Composite Signature."},U=function(e,r){return C(e,r)+" in Composit Signature did not match the requested "+e+"."};function L(e,r,t){if(!e.s){if(t instanceof z){if(!t.s)return void(t.o=L.bind(null,e,r));1&r&&(r=t.s),t=t.v}if(t&&t.then)return void t.then(L.bind(null,e,r),L.bind(null,e,2));e.s=r,e.v=t;var n=e.o;n&&n(e)}}var D=function(e){try{return W(),Promise.resolve(F()).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(N[e.method](e,r))}catch(e){return Promise.reject(e)}}(u,e)).then(function(e){return function(e,r){try{if(null==e.addr)throw new Error(B("addr","Address"));if(null==e.keyId)throw new Error(B("keyId"));if(null==e.sig)throw new Error(B("sig","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)}}(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 W(),Promise.resolve(Q()).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)}},z=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{L(n,1,i(this.v))}catch(e){L(n,2,e)}return n}return this}return this.o=function(e){try{var o=e.v;1&e.s?L(n,1,r?r(o):o):t?L(n,1,t(o)):L(n,2,o)}catch(e){L(n,2,e)}},n},e}();function _(e){return e instanceof z&&1&e.s}var F=function(){try{return Promise.resolve(new Promise(function(r){try{return W(),Promise.resolve(Q()).then(function(n){var o=function e(n){var o=n.data;try{if(console.log("MESSAGE",o),o.type!==V)return Promise.resolve();window.removeEventListener("message",e),unrender();var i="did:fcl:"+o.addr,u=o.addr,s=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(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 n,o,c={addr:u,cid:i,loggedIn:!0,services:(n=s,o=e,void 0===n&&(n=[]),void 0===o&&(o=[]),[].concat(n,o))};return t.send(H,G,c),Promise.resolve(Q()).then(function(e){r(e)})})}catch(e){return Promise.reject(e)}};return n.loggedIn?r(n):Promise.resolve(e.config().get("challenge.handshake")).then(function(e){!function(e){var r=e.handshake,t=e.l6n;if(!document.getElementById("FCL_IFRAME_CHALLENGE")){var n=new URL(r);n.searchParams.append("l6n",t);var o=document.createElement("iframe");o.src=n.href,o.id="FCL_IFRAME_CHALLENGE",o.allow="usb",o.style.position="fixed",o.style.top="0px",o.style.right="0px",o.style.left="0px",o.style.bottom="0px",o.style.height="100vh",o.style.width="100vw",o.style.display="block",o.style.background="rgba(0,0,0,0.25)",o.frameBorder="0",o.style.boxSizing="border-box",o.style.border="1px solid white",document.body.append(o)}}({handshake:e,l6n:window.location.origin}),window.addEventListener("message",o)})})}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}},H="CURRENT_USER",M="CURRENT_USER/UPDATED",G="SET_CURRENT_USER",V="FCL::CHALLENGE::RESPONSE",q='{\n "VERSION": "0.2.0",\n "addr":null,\n "cid":null,\n "loggedIn":null,\n "services":[]\n}',J=function(e){try{return localStorage.setItem(H,JSON.stringify(e)),Promise.resolve(e)}catch(e){return Promise.reject(e)}},K=((A={})[t.INIT]=function(e){try{var r=e.merge;return Promise.resolve(function(){try{var e=JSON.parse(q),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[t.SUBSCRIBE]=function(e,r){e.subscribe(r.from),e.send(r.from,M,e.all())},A[t.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),J(e.all()),e.broadcast(M,e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},A.DEL_CURRENT_USER=function(e,r){try{return e.merge(JSON.parse(q)),J(e.all()),e.broadcast(M,e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},A.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)}},A),W=function(){return t.spawn(K,H)};function X(){W(),t.send(H,"DEL_CURRENT_USER")}function Z(e){return function(){try{return W(),Promise.resolve(F()).then(function(){return t.send(H,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})})}catch(e){return Promise.reject(e)}}}function $(e){W();var r=t.spawn(function(r){try{var n;return r.send(H,t.SUBSCRIBE),Promise.resolve(function(e,r,t){for(var n;;){var o=e();if(_(o)&&(o=o.v),!o)return i;if(o.then){n=0;break}var i=t();if(i&&i.then){if(!_(i)){n=1;break}i=i.s}}var u=new z,s=L.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):L(u,1,i)})).then(void 0,s),u;function c(r){i=r;do{if(!(o=e())||_(o)&&!o.v)return void L(u,1,i);if(o.then)return void o.then(a).then(void 0,s);_(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):L(u,1,i)}}(function(){return!n&&1},0,function(){return Promise.resolve(r.receive()).then(function(o){if("@EXIT"===o.tag)return r.send(H,t.UNSUBSCRIBE),void(n=1);e(o.data)})}))}catch(e){return Promise.reject(e)}});return function(){return t.send(r,"@EXIT")}}function Q(){return W(),t.send(H,"SNAPSHOT",null,{expectReply:!0,timeout:0})}var Y=function(){return{authenticate:F,unauthenticate:X,authorization:D,param:Z,subscribe:$,snapshot:Q}};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.51",exports.authenticate=function(){return Y().authenticate()},exports.currentUser=Y,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 Y().unauthenticate()},exports.withPrefix=function(e){return null==e?null:"0x"+w(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 l,decodeResponse as u,getTransactionStatus as d,getLatestBlock as f,getEvents as y,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{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 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 P=async c=>t(c,[n({node:await e().get("accessNode.api")}),a,r,s,o,i]),k=async(t=[],n={})=>(n.node=n.node||await e().get("accessNode.api"),Array.isArray(t)&&(t=c(t)),l(await P(t),n)),A=async(e=[])=>(Array.isArray(e)&&(e=await c(e)),JSON.stringify(await P(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)},v=async e=>{const t=await k([d(e)]);return N(t)},x=e=>e.status>=4,O=e=>e.status>=3,C=e=>e.status>=2,L={[g]:async e=>{const t=await v(e.self());x(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 v(e.self());var n,a;x(t)||setTimeout(()=>e.sendSelf("POLL"),2500),n=e.all(),a=t,JSON.stringify(n)!==JSON.stringify(a)&&e.broadcast(S,t),e.merge(t)}},U=e=>{if("object"==typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return e},D=e=>m(L,U(e));function _(e){function t(t){return h(U(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(O),onceSealed:n(x)}}_.isUnknown=e=>e.status>=0,_.isPending=e=>e.status>=1,_.isFinalized=C,_.isExecuted=O,_.isSealed=x,_.isExpired=e=>5===e.status;const z=async()=>N(await k([f()])),B=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 B(e));else{let n=await z();e.put("hwm",n);const a=await k([y(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 B(e))}},[E]:async(e,t)=>{e.hasSubs()||e.put("tick",await B(e)),e.subscribe(t.from)},[b]:(e,t)=>{e.unsubscribe(t.from),e.hasSubs()||(clearTimeout(e.get("tick")),e.delete("tick"),e.delete("hwm"))}},F=e=>m(j,e);function H(e){return{subscribe:t=>h(e,F,t)}}function M(e){return null==e?null:e.replace(/^0x/,"")}function G(e){return null==e?null:"0x"+M(e)}const J="FCL_IFRAME_CHALLENGE";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 $(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}const K="FCL_IFRAME_AUTHZ";function W(e){if(document.getElementById(K))return;var t=q(e);const n=document.createElement("iframe");return n.src=t.href,n.id=K,n.allow="usb",n.style.position="fixed",n.style.top="0px",n.style.right="0px",n.style.left="0px",n.style.bottom="0px",n.style.height="100vh",n.style.width="100vw",n.style.display="block",n.style.background="rgba(0,0,0,0.25)",n.frameBorder="0",n.style.boxSizing="border-box",n.style.border="1px solid white",document.body.append(n),[n,()=>{document.getElementById(K)&&document.getElementById(K).remove()}]}const X={"HTTP/GET":"GET","HTTP/POST":"POST"},Z=e=>new Promise(async(t,n)=>{const a=await fetch(q(e),{method:X[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(Z(a.authorizationUpdates))},500)});var Q="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",Y=Q.length;const ee={"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 Z(r.authorizationUpdates)}catch(e){throw n(),console.error(e),e}finally{return n(),a}},"IFRAME/RPC":async function(e,t){return new Promise((n,a)=>{const r=function(){for(var e="",t=32;t--;)e+=Q[Math.random()*Y|0];return e}(),[s,o]=W(e);s.contentWindow.postMessage({jsonrpc:"2.0",id:r,method:"fcl:sign",params:[t,e.params]},"*"),window.addListener("message",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?n(t.compositeSignature):a("DECLINED"===t.status?{status:t.status,reason:t.reason}:{status:"DECLINED",reason:"Status was neither APPROVED nor DECLINED"})})})}},te=(e,t)=>null==t?`'${e}'`:`'${e}' (${t})`,ne=(e,t)=>`Missing ${te(e,t)} in Composite Signature.`,ae=(e,t)=>`${te(e,t)} in Composit Signature did not match the requested ${e}.`,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})}},le=()=>m(ce,re);async function ue(){return new Promise(async t=>{le();const n=await he();if(n.loggedIn)return t(n);const a=function({handshake:e,l6n:t}){if(document.getElementById(J))return;var n=new URL(e);n.searchParams.append("l6n",t);const a=document.createElement("iframe");return a.src=n.href,a.id=J,a.allow="usb",a.style.position="fixed",a.style.top="0px",a.style.right="0px",a.style.left="0px",a.style.bottom="0px",a.style.height="100vh",a.style.width="100vw",a.style.display="block",a.style.background="rgba(0,0,0,0.25)",a.frameBorder="0",a.style.boxSizing="border-box",a.style.border="1px solid white",document.body.append(a),()=>{document.getElementById(J)&&document.getElementById(J).remove()}}({handshake:await e().get("challenge.handshake"),l6n:window.location.origin});window.addEventListener("message",async({data:e})=>{if(console.log("MESSAGE",e),"FCL::CHALLENGE::RESPONSE"!==e.type)return;a();const n={addr:e.addr,cid:"did:fcl:"+e.addr,loggedIn:!0,services:$(e.services||[],await V(e.hks,e.code))};I(re,"SET_CURRENT_USER",n),t(await he())})})}function de(){le(),I(re,"DEL_CURRENT_USER")}async function fe(e){le();const t=function(e=[],t){return e.find(e=>e.type===t)}((await ue()).services,"authz");let n;return e.role.proposer&&(n=(await async function(){le();const{addr:e}=await he();if(null==e)throw new Error("No Flow Address for Current User");const{account:t}=await k([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=>{const n=await async function(e,t){return ee[e.method](e,t)}(t,e);return function(e,t){try{if(null==e.addr)throw new Error(ne("addr","Address"));if(null==e.keyId)throw new Error(ne("keyId"));if(null==e.sig)throw new Error(ne("sig","Signature"));if(e.addr!==t.addr)throw new Error(ae("addr","Address"));if(e.keyId!==t.keyId)throw new Error(ae("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,t),n},resolve:null,roles:e.roles}}function ye(e){return async function(){return le(),await ue(),I(re,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})}}function pe(e){le();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()=>I(t,"@EXIT")}function he(){return le(),I(re,"SNAPSHOT",null,{expectReply:!0,timeout:0})}const me=()=>({authenticate:ue,unauthenticate:de,authorization:fe,param:ye,subscribe:pe,snapshot:he}),we=()=>me().authenticate(),ge=()=>me().unauthenticate(),Ee="0.0.51";export{Ee as VERSION,we as authenticate,me as currentUser,N as decode,H as events,P as resolve,M as sansPrefix,k as send,A as serialize,_ as tx,ge as unauthenticate,G as withPrefix};
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 y,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{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 v}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 R=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 R(t),n)),k=async(e=[])=>(Array.isArray(e)&&(e=await c(e)),JSON.stringify(await R(e))),A=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)},N=async e=>{const t=await P([d(e)]);return A(t)},x=e=>e.status>=4,L=e=>e.status>=3,O=e=>e.status>=2,C={[g]:async e=>{const t=await N(e.self());x(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 N(e.self());var n,a;x(t)||setTimeout(()=>e.sendSelf("POLL"),2500),n=e.all(),a=t,JSON.stringify(n)!==JSON.stringify(a)&&e.broadcast(S,t),e.merge(t)}},U=e=>{if("object"==typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return e},D=e=>h(C,U(e));function _(e){function t(t){return m(U(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(O),onceExecuted:n(L),onceSealed:n(x)}}_.isUnknown=e=>e.status>=0,_.isPending=e=>e.status>=1,_.isFinalized=O,_.isExecuted=L,_.isSealed=x,_.isExpired=e=>5===e.status;const z=async()=>A(await P([f()])),B=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 B(e));else{let n=await z();e.put("hwm",n);const a=await P([y(e.self(),t.height,n.height-1)]),r=await A(a);for(let t of r)e.broadcast("UPDATED",t.data);e.put("tick",await B(e))}},[E]:async(e,t)=>{e.hasSubs()||e.put("tick",await B(e)),e.subscribe(t.from)},[b]:(e,t)=>{e.unsubscribe(t.from),e.hasSubs()||(clearTimeout(e.get("tick")),e.delete("tick"),e.delete("hwm"))}},F=e=>h(j,e);function H(e){return{subscribe:t=>m(e,F,t)}}function M(e){return null==e?null:e.replace(/^0x/,"")}function G(e){return null==e?null:"0x"+M(e)}const J="FCL_IFRAME_CHALLENGE";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 $(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}const K="FCL_IFRAME_AUTHZ";function W(e){if(document.getElementById(K))return;var t=q(e);const n=document.createElement("iframe");return n.src=t.href,n.id=K,n.allow="usb",n.style.position="fixed",n.style.top="0px",n.style.right="0px",n.style.left="0px",n.style.bottom="0px",n.style.height="100vh",n.style.width="100vw",n.style.display="block",n.style.background="rgba(0,0,0,0.25)",n.frameBorder="0",n.style.boxSizing="border-box",n.style.border="1px solid white",document.body.append(n),[n,()=>{document.getElementById(K)&&document.getElementById(K).remove()}]}const X={"HTTP/GET":"GET","HTTP/POST":"POST"},Z=e=>new Promise(async(t,n)=>{const a=await fetch(q(e),{method:X[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(Z(a.authorizationUpdates))},500)});var Q="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",Y=Q.length;const ee={"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 Z(r.authorizationUpdates)}catch(e){throw n(),console.error(e),e}finally{return n(),a}},"IFRAME/RPC":async function(e,t){return new Promise((n,a)=>{const r=function(){for(var e="",t=32;t--;)e+=Q[Math.random()*Y|0];return e}(),[s,o]=W(e);s.contentWindow.postMessage({jsonrpc:"2.0",id:r,method:"fcl:sign",params:[t,e.params]},"*"),window.addEventListener("message",async function e({data:t}){if("object"!=typeof t)return;if("2.0"!==t.jsonrpc)return;if(t.id!==r)return;const s=t.result;"APPROVED"===s.status?(window.removeEventListener("message",e),n(s.compositeSignature)):"DECLINED"===s.status?(window.removeEventListener("message",e),a({status:s.status,reason:s.reason})):(window.removeEventListener("message",e),a({status:"DECLINED",reason:"Status was neither APPROVED nor DECLINED"}))})})}},te=(e,t)=>null==t?`'${e}'`:`'${e}' (${t})`,ne=(e,t)=>`Missing ${te(e,t)} in Composite Signature.`,ae=(e,t)=>`${te(e,t)} in Composit Signature did not match the requested ${e}.`,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=()=>h(ce,re);async function le(){return new Promise(async t=>{ue();const n=await me();if(n.loggedIn)return t(n);const a=function({handshake:e,l6n:t}){if(document.getElementById(J))return;var n=new URL(e);n.searchParams.append("l6n",t);const a=document.createElement("iframe");return a.src=n.href,a.id=J,a.allow="usb",a.style.position="fixed",a.style.top="0px",a.style.right="0px",a.style.left="0px",a.style.bottom="0px",a.style.height="100vh",a.style.width="100vw",a.style.display="block",a.style.background="rgba(0,0,0,0.25)",a.frameBorder="0",a.style.boxSizing="border-box",a.style.border="1px solid white",document.body.append(a),()=>{document.getElementById(J)&&document.getElementById(J).remove()}}({handshake:await e().get("challenge.handshake"),l6n:window.location.origin});window.addEventListener("message",async function e({data:n}){if(console.log("MESSAGE",n),"FCL::CHALLENGE::RESPONSE"!==n.type)return;window.removeEventListener("message",e),a();const r={addr:n.addr,cid:"did:fcl:"+n.addr,loggedIn:!0,services:$(n.services||[],await V(n.hks,n.code))};v(re,"SET_CURRENT_USER",r),t(await me())})})}function de(){ue(),v(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=>{const n=await async function(e,t){return ee[e.method](e,t)}(t,e);return function(e,t){try{if(null==e.addr)throw new Error(ne("addr","Address"));if(null==e.keyId)throw new Error(ne("keyId"));if(null==e.sig)throw new Error(ne("sig","Signature"));if(e.addr!==t.addr)throw new Error(ae("addr","Address"));if(e.keyId!==t.keyId)throw new Error(ae("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,t),n},resolve:null,roles:e.roles}}function ye(e){return async function(){return ue(),await le(),v(re,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})}}function pe(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()=>v(t,"@EXIT")}function me(){return ue(),v(re,"SNAPSHOT",null,{expectReply:!0,timeout:0})}const he=()=>({authenticate:le,unauthenticate:de,authorization:fe,param:ye,subscribe:pe,snapshot:me}),we=()=>he().authenticate(),ge=()=>he().unauthenticate(),Ee="0.0.51";export{Ee as VERSION,we as authenticate,he as currentUser,A as decode,H as events,R as resolve,M as sansPrefix,P as send,k as serialize,_ as tx,ge as unauthenticate,G 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 d,getLatestBlock as h,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 y,UPDATED as P,UNSUBSCRIBE as p,SNAPSHOT as g,subscriber as b,spawn as E,snapshoter as S,send as w}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 I,T,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)}},x=function(e){return e.status>=4},C=function(e){return e.status>=3},L=function(e){return e.status>=2},U=((I={})[v]=function(e){try{return Promise.resolve(N(e.self())).then(function(r){x(r)||setTimeout(function(){return e.sendSelf("POLL")},2500),e.merge(r)})}catch(e){return Promise.reject(e)}},I[y]=function(e,r){e.subscribe(r.from),e.send(r.from,P,e.all())},I[p]=function(e,r){e.unsubscribe(r.from)},I[g]=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(N(e.self())).then(function(r){var t,n;x(r)||setTimeout(function(){return e.sendSelf("POLL")},2500),t=e.all(),n=r,JSON.stringify(t)!==JSON.stringify(n)&&e.broadcast(P,r),e.merge(r)})}catch(e){return Promise.reject(e)}},I),D=function(e){if("object"==typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return e},_=function(e){return E(U,D(e))};function z(e){function r(r){return b(D(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 S(e,_)},subscribe:r,onceFinalized:t(L),onceExecuted:t(C),onceSealed:t(x)}}function B(){return(B=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 F(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=L,z.isExecuted=C,z.isSealed=x,z.isExpired=function(e){return 5===e.status};var H=function(){try{return Promise.resolve(k([h()])).then(O)}catch(e){return Promise.reject(e)}},G=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)}},J=((T={}).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(H()).then(function(r){t.call(e,"hwm",r);var n=e.put;return Promise.resolve(G(e)).then(function(r){n.call(e,"tick",r)})})}return Promise.resolve(H()).then(function(t){return e.put("hwm",t),Promise.resolve(k([d(e.self(),r.height,t.height-1)])).then(function(r){return Promise.resolve(O(r)).then(function(r){for(var t,n=F(r);!(t=n()).done;)e.broadcast("UPDATED",t.value.data);var o=e.put;return Promise.resolve(G(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)}},T[y]=function(e,r){try{var t=function(){e.subscribe(r.from)},n=function(){if(!e.hasSubs()){var r=e.put;return Promise.resolve(G(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)}},T[p]=function(e,r){e.unsubscribe(r.from),e.hasSubs()||(clearTimeout(e.get("tick")),e.delete("tick"),e.delete("hwm"))},T),V=function(e){return E(J,e)};function q(e){return{subscribe:function(r){return b(e,V,r)}}}function K(e){return null==e?null:e.replace(/^0x/,"")}function W(e){return null==e?null:"0x"+K(e)}var X="FCL_IFRAME_CHALLENGE";function Z(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}var $="FCL_IFRAME_AUTHZ";function Q(e){if(!document.getElementById($)){var r=Z(e),t=document.createElement("iframe");return t.src=r.href,t.id=$,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,function(){document.getElementById($)&&document.getElementById($).remove()}]}}var Y,ee={"HTTP/GET":"GET","HTTP/POST":"POST"},re="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",te=re.length,ne={"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(Z(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(Z(r),{method:ee[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(e){throw t(),console.error(e),e})},function(){return t(),n}))}catch(e){return Promise.reject(e)}},"IFRAME/RPC":function(e,r){try{return Promise.resolve(new Promise(function(t,n){var o=function(){for(var e="",r=32;r--;)e+=re[Math.random()*te|0];return e}();Q(e)[0].contentWindow.postMessage({jsonrpc:"2.0",id:o,method:"fcl:sign",params:[r,e.params]},"*"),window.addListener("message",function(e){var r=e.data;try{if("object"!=typeof r)return Promise.resolve();if("2.0"!==r.jsonrpc)return Promise.resolve();if(r.id!==o)return Promise.resolve();var i=r.result;return"APPROVED"===i.status?t(i.compositeSignature):n("DECLINED"===i.status?{status:i.status,reason:i.reason}:{status:"DECLINED",reason:"Status was neither APPROVED nor DECLINED"}),Promise.resolve()}catch(e){return Promise.reject(e)}})}))}catch(e){return Promise.reject(e)}}},oe=function(e,r){return null==r?"'"+e+"'":"'"+e+"' ("+r+")"},ie=function(e,r){return"Missing "+oe(e,r)+" in Composite Signature."},ue=function(e,r){return oe(e,r)+" in Composit Signature did not match the requested "+e+"."};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 B({},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(ne[e.method](e,r))}catch(e){return Promise.reject(e)}}(i,e)).then(function(e){return function(e,r){try{if(null==e.addr)throw new Error(ie("addr","Address"));if(null==e.keyId)throw new Error(ie("keyId"));if(null==e.sig)throw new Error(ie("sig","Signature"));if(e.addr!==r.addr)throw new Error(ue("addr","Address"));if(e.keyId!==r.keyId)throw new Error(ue("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)}}(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(we()).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(we()).then(function(t){return t.loggedIn?r(t):Promise.resolve(e().get("challenge.handshake")).then(function(e){var t=function(e){var r=e.handshake,t=e.l6n;if(!document.getElementById(X)){var n=new URL(r);n.searchParams.append("l6n",t);var o=document.createElement("iframe");return o.src=n.href,o.id=X,o.allow="usb",o.style.position="fixed",o.style.top="0px",o.style.right="0px",o.style.left="0px",o.style.bottom="0px",o.style.height="100vh",o.style.width="100vw",o.style.display="block",o.style.background="rgba(0,0,0,0.25)",o.frameBorder="0",o.style.boxSizing="border-box",o.style.border="1px solid white",document.body.append(o),function(){document.getElementById(X)&&document.getElementById(X).remove()}}}({handshake:e,l6n:window.location.origin});window.addEventListener("message",function(e){var n=e.data;try{if(console.log("MESSAGE",n),n.type!==ve)return Promise.resolve();t();var o="did:fcl:"+n.addr,i=n.addr,u=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=F(e.authorizations);!(t=n()).done;)r.push(B({type:"authz",keyId:e.keyId},t.value));return null!=e.provider&&r.push(B({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,s={addr:i,cid:o,loggedIn:!0,services:(t=u,n=e,void 0===t&&(t=[]),void 0===n&&(n=[]),[].concat(t,n))};return w(de,me,s),Promise.resolve(we()).then(function(e){r(e)})})}catch(e){return Promise.reject(e)}})})})}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}},de="CURRENT_USER",he="CURRENT_USER/UPDATED",me="SET_CURRENT_USER",ve="FCL::CHALLENGE::RESPONSE",ye='{\n "VERSION": "0.2.0",\n "addr":null,\n "cid":null,\n "loggedIn":null,\n "services":[]\n}',Pe=function(e){try{return localStorage.setItem(de,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(ye),r=JSON.parse(localStorage.getItem(de));return null!=r&&e.VERSION!==r.VERSION?(localStorage.removeItem(de),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[y]=function(e,r){e.subscribe(r.from),e.send(r.from,he,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),Pe(e.all()),e.broadcast(he,e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},Y.DEL_CURRENT_USER=function(e,r){try{return e.merge(JSON.parse(ye)),Pe(e.all()),e.broadcast(he,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 E(pe,de)};function be(){ge(),w(de,"DEL_CURRENT_USER")}function Ee(e){return function(){try{return ge(),Promise.resolve(fe()).then(function(){return w(de,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})})}catch(e){return Promise.reject(e)}}}function Se(e){ge();var r=E(function(r){try{var t;return r.send(de,y),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(de,p),void(t=1);e(n.data)})}))}catch(e){return Promise.reject(e)}});return function(){return w(r,"@EXIT")}}function we(){return ge(),w(de,"SNAPSHOT",null,{expectReply:!0,timeout:0})}var je=function(){return{authenticate:fe,unauthenticate:be,authorization:ce,param:Ee,subscribe:Se,snapshot:we}},Ie=function(){return je().authenticate()},Te=function(){return je().unauthenticate()},Ae="0.0.51";export{Ae as VERSION,Ie as authenticate,je as currentUser,O as decode,q as events,A as resolve,K as sansPrefix,k as send,R as serialize,z as tx,Te as unauthenticate,W as withPrefix};
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 d,getLatestBlock as h,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 y,UPDATED as P,UNSUBSCRIBE as p,SNAPSHOT as g,subscriber as E,spawn as b,snapshoter as w,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 A,T,I=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(I(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(I(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},x=function(e){return e.status>=3},C=function(e){return e.status>=2},U=((A={})[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)}},A[y]=function(e,r){e.subscribe(r.from),e.send(r.from,P,e.all())},A[p]=function(e,r){e.unsubscribe(r.from)},A[g]=function(e,r){try{return r.reply(e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},A.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(P,r),e.merge(r)})}catch(e){return Promise.reject(e)}},A),D=function(e){if("object"==typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return e},_=function(e){return b(U,D(e))};function z(e){function r(r){return E(D(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 w(e,_)},subscribe:r,onceFinalized:t(C),onceExecuted:t(x),onceSealed:t(L)}}function B(){return(B=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 F(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 M(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 F(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)?F(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=C,z.isExecuted=x,z.isSealed=L,z.isExpired=function(e){return 5===e.status};var H=function(){try{return Promise.resolve(k([h()])).then(O)}catch(e){return Promise.reject(e)}},G=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)}},J=((T={}).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(H()).then(function(r){t.call(e,"hwm",r);var n=e.put;return Promise.resolve(G(e)).then(function(r){n.call(e,"tick",r)})})}return Promise.resolve(H()).then(function(t){return e.put("hwm",t),Promise.resolve(k([d(e.self(),r.height,t.height-1)])).then(function(r){return Promise.resolve(O(r)).then(function(r){for(var t,n=M(r);!(t=n()).done;)e.broadcast("UPDATED",t.value.data);var o=e.put;return Promise.resolve(G(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)}},T[y]=function(e,r){try{var t=function(){e.subscribe(r.from)},n=function(){if(!e.hasSubs()){var r=e.put;return Promise.resolve(G(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)}},T[p]=function(e,r){e.unsubscribe(r.from),e.hasSubs()||(clearTimeout(e.get("tick")),e.delete("tick"),e.delete("hwm"))},T),V=function(e){return b(J,e)};function q(e){return{subscribe:function(r){return E(e,V,r)}}}function K(e){return null==e?null:e.replace(/^0x/,"")}function W(e){return null==e?null:"0x"+K(e)}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}var Z="FCL_IFRAME_AUTHZ";function $(e){if(!document.getElementById(Z)){var r=X(e),t=document.createElement("iframe");return t.src=r.href,t.id=Z,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,function(){document.getElementById(Z)&&document.getElementById(Z).remove()}]}}var Q,Y={"HTTP/GET":"GET","HTTP/POST":"POST"},ee="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",re=ee.length,te={"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=$(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:Y[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(e){throw t(),console.error(e),e})},function(){return t(),n}))}catch(e){return Promise.reject(e)}},"IFRAME/RPC":function(e,r){try{return Promise.resolve(new Promise(function(t,n){var o=function(){for(var e="",r=32;r--;)e+=ee[Math.random()*re|0];return e}();$(e)[0].contentWindow.postMessage({jsonrpc:"2.0",id:o,method:"fcl:sign",params:[r,e.params]},"*"),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),t(u.compositeSignature)):"DECLINED"===u.status?(window.removeEventListener("message",e),n({status:u.status,reason:u.reason})):(window.removeEventListener("message",e),n({status:"DECLINED",reason:"Status was neither APPROVED nor DECLINED"})),Promise.resolve()}catch(e){return Promise.reject(e)}})}))}catch(e){return Promise.reject(e)}}},ne=function(e,r){return null==r?"'"+e+"'":"'"+e+"' ("+r+")"},oe=function(e,r){return"Missing "+ne(e,r)+" in Composite Signature."},ie=function(e,r){return ne(e,r)+" in Composit Signature did not match the requested "+e+"."};function ue(e,r,t){if(!e.s){if(t instanceof ce){if(!t.s)return void(t.o=ue.bind(null,e,r));1&r&&(r=t.s),t=t.v}if(t&&t.then)return void t.then(ue.bind(null,e,r),ue.bind(null,e,2));e.s=r,e.v=t;var n=e.o;n&&n(e)}}var se=function(e){try{return pe(),Promise.resolve(le()).then(function(r){function t(){return B({},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(te[e.method](e,r))}catch(e){return Promise.reject(e)}}(i,e)).then(function(e){return function(e,r){try{if(null==e.addr)throw new Error(oe("addr","Address"));if(null==e.keyId)throw new Error(oe("keyId"));if(null==e.sig)throw new Error(oe("sig","Signature"));if(e.addr!==r.addr)throw new Error(ie("addr","Address"));if(e.keyId!==r.keyId)throw new Error(ie("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)}}(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 pe(),Promise.resolve(we()).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)}},ce=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{ue(n,1,i(this.v))}catch(e){ue(n,2,e)}return n}return this}return this.o=function(e){try{var o=e.v;1&e.s?ue(n,1,r?r(o):o):t?ue(n,1,t(o)):ue(n,2,o)}catch(e){ue(n,2,e)}},n},e}();function ae(e){return e instanceof ce&&1&e.s}var le=function(){try{return Promise.resolve(new Promise(function(r){try{return pe(),Promise.resolve(we()).then(function(t){var n=function e(t){var n=t.data;try{if(console.log("MESSAGE",n),n.type!==me)return Promise.resolve();window.removeEventListener("message",e),unrender();var o="did:fcl:"+n.addr,i=n.addr,u=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=M(e.authorizations);!(t=n()).done;)r.push(B({type:"authz",keyId:e.keyId},t.value));return null!=e.provider&&r.push(B({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,s={addr:i,cid:o,loggedIn:!0,services:(t=u,n=e,void 0===t&&(t=[]),void 0===n&&(n=[]),[].concat(t,n))};return S(fe,he,s),Promise.resolve(we()).then(function(e){r(e)})})}catch(e){return Promise.reject(e)}};return t.loggedIn?r(t):Promise.resolve(e().get("challenge.handshake")).then(function(e){!function(e){var r=e.handshake,t=e.l6n;if(!document.getElementById("FCL_IFRAME_CHALLENGE")){var n=new URL(r);n.searchParams.append("l6n",t);var o=document.createElement("iframe");o.src=n.href,o.id="FCL_IFRAME_CHALLENGE",o.allow="usb",o.style.position="fixed",o.style.top="0px",o.style.right="0px",o.style.left="0px",o.style.bottom="0px",o.style.height="100vh",o.style.width="100vw",o.style.display="block",o.style.background="rgba(0,0,0,0.25)",o.frameBorder="0",o.style.boxSizing="border-box",o.style.border="1px solid white",document.body.append(o)}}({handshake:e,l6n:window.location.origin}),window.addEventListener("message",n)})})}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}},fe="CURRENT_USER",de="CURRENT_USER/UPDATED",he="SET_CURRENT_USER",me="FCL::CHALLENGE::RESPONSE",ve='{\n "VERSION": "0.2.0",\n "addr":null,\n "cid":null,\n "loggedIn":null,\n "services":[]\n}',ye=function(e){try{return localStorage.setItem(fe,JSON.stringify(e)),Promise.resolve(e)}catch(e){return Promise.reject(e)}},Pe=((Q={})[v]=function(e){try{var r=e.merge;return Promise.resolve(function(){try{var e=JSON.parse(ve),r=JSON.parse(localStorage.getItem(fe));return null!=r&&e.VERSION!==r.VERSION?(localStorage.removeItem(fe),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)}},Q[y]=function(e,r){e.subscribe(r.from),e.send(r.from,de,e.all())},Q[p]=function(e,r){e.unsubscribe(r.from)},Q.SNAPSHOT=function(e,r){try{return r.reply(e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},Q[he]=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)}},Q.DEL_CURRENT_USER=function(e,r){try{return e.merge(JSON.parse(ve)),ye(e.all()),e.broadcast(de,e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},Q.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)}},Q),pe=function(){return b(Pe,fe)};function ge(){pe(),S(fe,"DEL_CURRENT_USER")}function Ee(e){return function(){try{return pe(),Promise.resolve(le()).then(function(){return S(fe,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})})}catch(e){return Promise.reject(e)}}}function be(e){pe();var r=b(function(r){try{var t;return r.send(fe,y),Promise.resolve(function(e,r,t){for(var n;;){var o=e();if(ae(o)&&(o=o.v),!o)return i;if(o.then){n=0;break}var i=t();if(i&&i.then){if(!ae(i)){n=1;break}i=i.s}}var u=new ce,s=ue.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):ue(u,1,i)})).then(void 0,s),u;function c(r){i=r;do{if(!(o=e())||ae(o)&&!o.v)return void ue(u,1,i);if(o.then)return void o.then(a).then(void 0,s);ae(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):ue(u,1,i)}}(function(){return!t&&1},0,function(){return Promise.resolve(r.receive()).then(function(n){if("@EXIT"===n.tag)return r.send(fe,p),void(t=1);e(n.data)})}))}catch(e){return Promise.reject(e)}});return function(){return S(r,"@EXIT")}}function we(){return pe(),S(fe,"SNAPSHOT",null,{expectReply:!0,timeout:0})}var Se=function(){return{authenticate:le,unauthenticate:ge,authorization:se,param:Ee,subscribe:be,snapshot:we}},je=function(){return Se().authenticate()},Ae=function(){return Se().unauthenticate()},Te="0.0.51";export{Te as VERSION,je as authenticate,Se as currentUser,O as decode,q as events,I as resolve,K as sansPrefix,k as send,R as serialize,z as tx,Ae as unauthenticate,W 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,c=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)}},s=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(c(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)}},l=function(e){try{return Promise.resolve(s([t.getTransactionStatus(e)])).then(a)}catch(e){return Promise.reject(e)}},f=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(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},y=function(e){return n.spawn(h,v(e))};function p(e){function r(r){return n.subscriber(v(e),y,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,y)},subscribe:r,onceFinalized:t(m),onceExecuted:t(d),onceSealed:t(f)}}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 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=f,p.isExpired=function(e){return 5===e.status};var E=function(){try{return Promise.resolve(s([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(s([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/,"")}var I="FCL_IFRAME_CHALLENGE";function A(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}var T="FCL_IFRAME_AUTHZ";function R(e){if(!document.getElementById(T)){var r=A(e),t=document.createElement("iframe");return t.src=r.href,t.id=T,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,function(){document.getElementById(T)&&document.getElementById(T).remove()}]}}var k,N={"HTTP/GET":"GET","HTTP/POST":"POST"},B="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",U=B.length,C={"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(A(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(A(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(e){throw t(),console.error(e),e})},function(){return t(),n}))}catch(e){return Promise.reject(e)}},"IFRAME/RPC":function(e,r){try{return Promise.resolve(new Promise(function(t,n){var o=function(){for(var e="",r=32;r--;)e+=B[Math.random()*U|0];return e}();R(e)[0].contentWindow.postMessage({jsonrpc:"2.0",id:o,method:"fcl:sign",params:[r,e.params]},"*"),window.addListener("message",function(e){var r=e.data;try{if("object"!=typeof r)return Promise.resolve();if("2.0"!==r.jsonrpc)return Promise.resolve();if(r.id!==o)return Promise.resolve();var i=r.result;return"APPROVED"===i.status?t(i.compositeSignature):n("DECLINED"===i.status?{status:i.status,reason:i.reason}:{status:"DECLINED",reason:"Status was neither APPROVED nor DECLINED"}),Promise.resolve()}catch(e){return Promise.reject(e)}})}))}catch(e){return Promise.reject(e)}}},x=function(e,r){return null==r?"'"+e+"'":"'"+e+"' ("+r+")"},L=function(e,r){return"Missing "+x(e,r)+" in Composite Signature."},D=function(e,r){return x(e,r)+" in Composit Signature did not match the requested "+e+"."};function z(e,r,t){if(!e.s){if(t instanceof H){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 Z(),Promise.resolve(F()).then(function(r){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(C[e.method](e,r))}catch(e){return Promise.reject(e)}}(u,e)).then(function(e){return function(e,r){try{if(null==e.addr)throw new Error(L("addr","Address"));if(null==e.keyId)throw new Error(L("keyId"));if(null==e.sig)throw new Error(L("sig","Signature"));if(e.addr!==r.addr)throw new Error(D("addr","Address"));if(e.keyId!==r.keyId)throw new Error(D("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)}}(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 Z(),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(s([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)}},H=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 H&&1&e.s}var F=function(){try{return Promise.resolve(new Promise(function(e){try{return Z(),Promise.resolve(ee()).then(function(t){return t.loggedIn?e(t):Promise.resolve(r.config().get("challenge.handshake")).then(function(r){var t=function(e){var r=e.handshake,t=e.l6n;if(!document.getElementById(I)){var n=new URL(r);n.searchParams.append("l6n",t);var o=document.createElement("iframe");return o.src=n.href,o.id=I,o.allow="usb",o.style.position="fixed",o.style.top="0px",o.style.right="0px",o.style.left="0px",o.style.bottom="0px",o.style.height="100vh",o.style.width="100vw",o.style.display="block",o.style.background="rgba(0,0,0,0.25)",o.frameBorder="0",o.style.boxSizing="border-box",o.style.border="1px solid white",document.body.append(o),function(){document.getElementById(I)&&document.getElementById(I).remove()}}}({handshake:r,l6n:window.location.origin});window.addEventListener("message",function(r){var o=r.data;try{if(console.log("MESSAGE",o),o.type!==J)return Promise.resolve();t();var i="did:fcl:"+o.addr,u=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(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(r){var t,o,s={addr:u,cid:i,loggedIn:!0,services:(t=c,o=r,void 0===t&&(t=[]),void 0===o&&(o=[]),[].concat(t,o))};return n.send(V,G,s),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)}},V="CURRENT_USER",q="CURRENT_USER/UPDATED",G="SET_CURRENT_USER",J="FCL::CHALLENGE::RESPONSE",K='{\n "VERSION": "0.2.0",\n "addr":null,\n "cid":null,\n "loggedIn":null,\n "services":[]\n}',W=function(e){try{return localStorage.setItem(V,JSON.stringify(e)),Promise.resolve(e)}catch(e){return Promise.reject(e)}},X=((k={})[n.INIT]=function(e){try{var r=e.merge;return Promise.resolve(function(){try{var e=JSON.parse(K),r=JSON.parse(localStorage.getItem(V));return null!=r&&e.VERSION!==r.VERSION?(localStorage.removeItem(V),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)}},k[n.SUBSCRIBE]=function(e,r){e.subscribe(r.from),e.send(r.from,q,e.all())},k[n.UNSUBSCRIBE]=function(e,r){e.unsubscribe(r.from)},k.SNAPSHOT=function(e,r){try{return r.reply(e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},k[G]=function(e,r,t){try{return e.merge(t),W(e.all()),e.broadcast(q,e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},k.DEL_CURRENT_USER=function(e,r){try{return e.merge(JSON.parse(K)),W(e.all()),e.broadcast(q,e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},k.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)}},k),Z=function(){return n.spawn(X,V)};function $(){Z(),n.send(V,"DEL_CURRENT_USER")}function Q(e){return function(){try{return Z(),Promise.resolve(F()).then(function(){return n.send(V,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})})}catch(e){return Promise.reject(e)}}}function Y(e){Z();var r=n.spawn(function(r){try{var t;return r.send(V,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 H,c=z.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):z(u,1,i)})).then(void 0,c),u;function s(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,c);M(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):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(V,n.UNSUBSCRIBE),void(t=1);e(o.data)})}))}catch(e){return Promise.reject(e)}});return function(){return n.send(r,"@EXIT")}}function ee(){return Z(),n.send(V,"SNAPSHOT",null,{expectReply:!0,timeout:0})}var re=function(){return{authenticate:F,unauthenticate:$,authorization:_,param:Q,subscribe:Y,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.51",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=c,e.sansPrefix=O,e.send=s,e.serialize=function(e){void 0===e&&(e=[]);try{var r=function(){return Promise.resolve(c(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/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)}},l=function(e){try{return Promise.resolve(c([t.getTransactionStatus(e)])).then(a)}catch(e){return Promise.reject(e)}},f=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(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},y=function(e){return n.spawn(h,v(e))};function p(e){function r(r){return n.subscriber(v(e),y,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,y)},subscribe:r,onceFinalized:t(m),onceExecuted:t(d),onceSealed:t(f)}}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 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=f,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,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}var A="FCL_IFRAME_AUTHZ";function R(e){if(!document.getElementById(A)){var r=I(e),t=document.createElement("iframe");return t.src=r.href,t.id=A,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,function(){document.getElementById(A)&&document.getElementById(A).remove()}]}}var T,k={"HTTP/GET":"GET","HTTP/POST":"POST"},N="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",C=N.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(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=R(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: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(e){throw t(),console.error(e),e})},function(){return t(),n}))}catch(e){return Promise.reject(e)}},"IFRAME/RPC":function(e,r){try{return Promise.resolve(new Promise(function(t,n){var o=function(){for(var e="",r=32;r--;)e+=N[Math.random()*C|0];return e}();R(e)[0].contentWindow.postMessage({jsonrpc:"2.0",id:o,method:"fcl:sign",params:[r,e.params]},"*"),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),t(u.compositeSignature)):"DECLINED"===u.status?(window.removeEventListener("message",e),n({status:u.status,reason:u.reason})):(window.removeEventListener("message",e),n({status:"DECLINED",reason:"Status was neither APPROVED nor DECLINED"})),Promise.resolve()}catch(e){return Promise.reject(e)}})}))}catch(e){return Promise.reject(e)}}},U=function(e,r){return null==r?"'"+e+"'":"'"+e+"' ("+r+")"},L=function(e,r){return"Missing "+U(e,r)+" in Composite Signature."},x=function(e,r){return U(e,r)+" in Composit Signature did not match the requested "+e+"."};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(H()).then(function(r){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))}catch(e){return Promise.reject(e)}}(u,e)).then(function(e){return function(e,r){try{if(null==e.addr)throw new Error(L("addr","Address"));if(null==e.keyId)throw new Error(L("keyId"));if(null==e.sig)throw new Error(L("sig","Signature"));if(e.addr!==r.addr)throw new Error(x("addr","Address"));if(e.keyId!==r.keyId)throw new Error(x("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)}}(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 X(),Promise.resolve(Y()).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)}},_=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 H=function(){try{return Promise.resolve(new Promise(function(e){try{return X(),Promise.resolve(Y()).then(function(t){var o=function r(t){var o=t.data;try{if(console.log("MESSAGE",o),o.type!==q)return Promise.resolve();window.removeEventListener("message",r),unrender();var i="did:fcl:"+o.addr,u=o.addr,s=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(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(r){var t,o,c={addr:u,cid:i,loggedIn:!0,services:(t=s,o=r,void 0===t&&(t=[]),void 0===o&&(o=[]),[].concat(t,o))};return n.send(M,V,c),Promise.resolve(Y()).then(function(r){e(r)})})}catch(e){return Promise.reject(e)}};return t.loggedIn?e(t):Promise.resolve(r.config().get("challenge.handshake")).then(function(e){!function(e){var r=e.handshake,t=e.l6n;if(!document.getElementById("FCL_IFRAME_CHALLENGE")){var n=new URL(r);n.searchParams.append("l6n",t);var o=document.createElement("iframe");o.src=n.href,o.id="FCL_IFRAME_CHALLENGE",o.allow="usb",o.style.position="fixed",o.style.top="0px",o.style.right="0px",o.style.left="0px",o.style.bottom="0px",o.style.height="100vh",o.style.width="100vw",o.style.display="block",o.style.background="rgba(0,0,0,0.25)",o.frameBorder="0",o.style.boxSizing="border-box",o.style.border="1px solid white",document.body.append(o)}}({handshake:e,l6n:window.location.origin}),window.addEventListener("message",o)})})}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}},M="CURRENT_USER",G="CURRENT_USER/UPDATED",V="SET_CURRENT_USER",q="FCL::CHALLENGE::RESPONSE",J='{\n "VERSION": "0.2.0",\n "addr":null,\n "cid":null,\n "loggedIn":null,\n "services":[]\n}',K=function(e){try{return localStorage.setItem(M,JSON.stringify(e)),Promise.resolve(e)}catch(e){return Promise.reject(e)}},W=((T={})[n.INIT]=function(e){try{var r=e.merge;return Promise.resolve(function(){try{var e=JSON.parse(J),r=JSON.parse(localStorage.getItem(M));return null!=r&&e.VERSION!==r.VERSION?(localStorage.removeItem(M),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[n.SUBSCRIBE]=function(e,r){e.subscribe(r.from),e.send(r.from,G,e.all())},T[n.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),K(e.all()),e.broadcast(G,e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},T.DEL_CURRENT_USER=function(e,r){try{return e.merge(JSON.parse(J)),K(e.all()),e.broadcast(G,e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},T.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)}},T),X=function(){return n.spawn(W,M)};function Z(){X(),n.send(M,"DEL_CURRENT_USER")}function $(e){return function(){try{return X(),Promise.resolve(H()).then(function(){return n.send(M,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})})}catch(e){return Promise.reject(e)}}}function Q(e){X();var r=n.spawn(function(r){try{var t;return r.send(M,n.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!t&&1},0,function(){return Promise.resolve(r.receive()).then(function(o){if("@EXIT"===o.tag)return r.send(M,n.UNSUBSCRIBE),void(t=1);e(o.data)})}))}catch(e){return Promise.reject(e)}});return function(){return n.send(r,"@EXIT")}}function Y(){return X(),n.send(M,"SNAPSHOT",null,{expectReply:!0,timeout:0})}var ee=function(){return{authenticate:H,unauthenticate:Z,authorization:z,param:$,subscribe:Q,snapshot:Y}};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.51",e.authenticate=function(){return ee().authenticate()},e.currentUser=ee,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 ee().unauthenticate()},e.withPrefix=function(e){return null==e?null:"0x"+O(e)}});
//# sourceMappingURL=fcl.umd.js.map
{
"name": "@onflow/fcl",
"version": "0.0.55-debug.1",
"version": "0.0.55-debug.2",
"description": "Flow Client Library",

@@ -5,0 +5,0 @@ "license": "Apache-2.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc