@onflow/fcl
Advanced tools
Comparing version 0.0.45 to 0.0.46
@@ -5,2 +5,6 @@ ### Unreleased | ||
### 0.0.46 -- 2020-07-27 | ||
- 2020-07-27 -- VSN `@onflow/sdk` 0.0.28 -> 0.0.30 | ||
### 0.0.45 -- 2020-07-22 | ||
@@ -7,0 +11,0 @@ |
@@ -1,2 +0,2 @@ | ||
var e=require("@onflow/config"),t=require("@onflow/sdk"),n=require("@onflow/util-actor"),r=require("@onflow/types");e.config().put("accessNode.api","http://localhost:8080").put("challenge.handshake","http://localhost:8700/authenticate");var o=function(e){try{return Promise.resolve(t.resolve(e,[t.resolveParams,t.resolveArguments,t.resolveAccounts,t.resolveSignatures,t.resolveValidators]))}catch(e){return Promise.reject(e)}},i=function(n,r){void 0===n&&(n=[]),void 0===r&&(r={});try{var i=function(e){return r.node=e,Array.isArray(n)&&(n=t.build(n)),Promise.resolve(o(n)).then(function(e){return t.send(e,r)})},u=r.node;return Promise.resolve(u?i(u):Promise.resolve(e.config().get("accessNode.api")).then(i))}catch(e){return Promise.reject(e)}},u=function(n){try{return Promise.resolve(e.config().where(/^decoder\./)).then(function(e){var r=Object.fromEntries(Object.entries(e).map(function(e){var t=e[0],n=e[1];return[t="/"+t.replace(/^decoder\./,"")+"$/",n]}));return t.decodeResponse(n,r)})}catch(e){return Promise.reject(e)}};const c=function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{s(r,1,e(this.v))}catch(e){s(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?s(r,1,t?t(o):o):n?s(r,1,n(o)):s(r,2,o)}catch(e){s(r,2,e)}},r},e}();function s(e,t,n){if(!e.s){if(n instanceof c){if(!n.s)return void(n.o=s.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(s.bind(null,e,t),s.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}function a(e){return e instanceof c&&1&e.s}function l(e,t,n){for(var r;;){var o=e();if(a(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!a(i)){r=1;break}i=i.s}if(t){var u=t();if(u&&u.then&&!a(u)){r=2;break}}}var l=new c,f=s.bind(null,l,2);return(0===r?o.then(m):1===r?i.then(d):u.then(p)).then(void 0,f),l;function d(r){i=r;do{if(t&&(u=t())&&u.then&&!a(u))return void u.then(p).then(void 0,f);if(!(o=e())||a(o)&&!o.v)return void s(l,1,i);if(o.then)return void o.then(m).then(void 0,f);a(i=n())&&(i=i.v)}while(!i||!i.then);i.then(d).then(void 0,f)}function m(e){e?(i=n())&&i.then?i.then(d).then(void 0,f):d(i):s(l,1,i)}function p(){(o=e())?o.then?o.then(m).then(void 0,f):m(o):s(l,1,i)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var f,d=function(e){try{return Promise.resolve(i([t.getTransactionStatus(e)])).then(u)}catch(e){return Promise.reject(e)}},m=function(e){return 4===e.status},p=function(e){return 3===e.status||m(e)},h=function(e){return 2===e.status||p(e)},v=function(e){return 1===e.status||h(e)},y=((f={})[n.INIT]=function(e){try{return Promise.resolve(d(e.self())).then(function(t){m(t)||setTimeout(function(){return n.send(e.self(),"POLL")},1e3),e.merge(t)})}catch(e){return Promise.reject(e)}},f[n.SUBSCRIBE]=function(e,t){e.subscribe(t.from),e.send(t.from,"TRANSACTION/UPDATED",e.all())},f[n.UNSUBSCRIBE]=function(e,t){e.unsubscribe(t.from)},f.SNAPSHOT=function(e,t){try{return t.replay(e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},f.POLL=function(e){try{return Promise.resolve(d(e.self())).then(function(t){m(t)||setTimeout(function(){return n.send(e.self(),"POLL")},1e3),e.merge(t),e.broadcast("TRANSACTION/UPDATED",e.all())})}catch(e){return Promise.reject(e)}},f),P=function(e){if("object"==typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return n.spawn(y,e)};function b(e){function t(t){var r=P(e),o=n.spawn(function(e){try{var o=!1;return e.send(r,n.SUBSCRIBE),Promise.resolve(l(function(){return!o&&1},void 0,function(){return Promise.resolve(e.receive()).then(function(i){if("@EXIT"===i.tag)return e.send(r,n.UNSUBSCRIBE),void(o=!0);t(i.data)})}))}catch(e){return Promise.reject(e)}});return function(){return n.send(o,"@EXIT")}}function r(e){return function(){return new Promise(function(n){var r=t(function(t){e(t)&&(n(t),r())})})}}return{snapshot:function(){var t=P(e);return n.send(t,"SNAPSHOT",null,{expectReply:!0,timeout:10})},subscribe:t,oncePending:r(v),onceFinalized:r(h),onceExecuted:r(p),onceSealed:r(m)}}function g(){return(g=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}b.isUnknown=function(e){return 0===e.status||v(e)},b.isPending=v,b.isFinalized=h,b.isExecuted=p,b.isSealed=m;var S,j="FCL_IFRAME_CHALLENGE",x="FCL_IFRAME_AUTHZ",E=function(e){void 0===e&&(e={});var t=e.addr,n=e.pid;return null==t||null==n?null:t+"/"+n},O={"HTTP/POST":"POST","HTTP/GET":"GET"},w=function(e,t){try{for(var n=new URL(e.endpoint),r=0,o=Object.entries(e.params||{});r<o.length;r++){var i=o[r];n.searchParams.append(i[0],i[1])}return t=t?JSON.stringify(t):void 0,Promise.resolve(fetch(n,{method:O[e.method],headers:{"Content-Type":"application/json"},body:t}).then(function(e){return e.json()}))}catch(e){return Promise.reject(e)}},T=function(){try{return z(),Promise.resolve(G()).then(function(e){var n=e.addr;if(null==n)throw new Error("No Flow Address for Current User");return Promise.resolve(i([t.getAccount(n)])).then(function(e){return e.account})})}catch(e){return Promise.reject(e)}},I=function(e){try{return z(),Promise.resolve(R()).then(function(){return Promise.resolve(G()).then(function(t){function n(){return g({},e,{addr:t.addr,keyId:t.keyId,sequenceNum:r,signature:e.signature||null,signingFunction:function(e){try{return Promise.resolve(G()).then(function(t){return Promise.resolve(T()).then(function(n){return Promise.resolve(w(t.authorizations[0],e)).then(function(e){var t=function(){};return e.local&&e.local.length>0&&(t=function(e){if(!document.getElementById(x)){for(var t=new URL(e.endpoint),n=0,r=Object.entries(e.params||{});n<r.length;n++){var o=r[n];t.searchParams.append(o[0],o[1])}var i=document.createElement("iframe");return i.src=t.href,i.id=x,i.style.height=e.height||"500px",i.style.maxHeight="90vh",i.style.width=e.width||"400px",i.style.maxWidth="90vw",i.style.display="block",i.style.background=e.background||"#fff",i.style.position="fixed",i.style.top="5vh",i.style.right="calc(50vw)",i.style.transform="translateX(50%)",i.style.boxShadow="0 4px 8px -4px black",i.frameBorder="0",document.body.append(i),function(){document.getElementById(x)&&document.getElementById(x).remove()}}}(e.local[0])),Promise.resolve(function e(t){return new Promise(function(n,r){try{return Promise.resolve(w(t)).then(function(t){"APPROVED"===t.status?n(t.compositeSignature):"DECLINED"===t.status?r({status:t.status,reason:t.reason}):setTimeout(function(){n(e(t.authorizationUpdates))},500)})}catch(e){return Promise.reject(e)}})}(e.authorizationUpdates)).then(function(e){return t(),e})})})})}catch(e){return Promise.reject(e)}},resolve:null,roles:e.roles})}var r,o=function(){if(e.role.proposer)return Promise.resolve(T()).then(function(e){var n=e.keys.find(function(e){return e.index===t.keyId});r=n.sequenceNumber})}();return o&&o.then?o.then(n):n()})})}catch(e){return Promise.reject(e)}},R=function(){try{return Promise.resolve(new Promise(function(t){try{return z(),Promise.resolve(G()).then(function(r){return r.loggedIn?t(r):Promise.resolve(e.config().get("challenge.handshake")).then(function(r){return Promise.resolve(e.config().get("challenge.scope")).then(function(e){var o=function(e){var t=e.handshake,n=e.scope,r=e.nonce,o=e.l6n;if(!document.getElementById(j)){var i=new URL(t);i.searchParams.append("l6n",o),i.searchParams.append("nonce",r),n&&i.searchParams.append("scope",n.split(" ").join("+"));var u=document.createElement("iframe");return u.src=i.href,u.id=j,u.style.height="500px",u.style.maxHeight="90vh",u.style.width="400px",u.style.maxWidth="90vw",u.style.display="block",u.style.background="#fff",u.style.position="fixed",u.style.top="5vh",u.style.right="calc(50vw)",u.style.transform="translateX(50%)",u.style.boxShadow="0 4px 8px -4px black",u.frameBorder="0",document.body.append(u),function(){document.getElementById(j)&&document.getElementById(j).remove()}}}({handshake:r,scope:e,nonce:"asdf",l6n:window.location.origin});window.addEventListener("message",function(e){var r=e.data;try{if(r.type!==k)return Promise.resolve();o();var i=new URL(r.hks);return i.searchParams.append("code",r.code),Promise.resolve(fetch(i,{method:"GET",headers:{"Content-Type":"application/json"}}).then(function(e){return e.json()})).then(function(e){return n.send(U,N,g({},e,{cid:E(e.provider),loggedIn:!0,verified:!0})),Promise.resolve(G()).then(function(e){t(e)})})}catch(e){return Promise.reject(e)}})})})})}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}},U="CURRENT_USER",A="CURRENT_USER/UPDATED",N="SET_CURRENT_USER",k="FCL::CHALLENGE::RESPONSE",B='{\n "cid":null,\n "loggedIn":null,\n "verified":null,\n "identity":{\n "name":null,\n "addr":null,\n "avatar":null,\n "cover":null,\n "color":null,\n "bio":null\n },\n "scoped":{},\n "provider":{\n "addr":null,\n "pid":null,\n "name":null,\n "icon":null\n },\n "authorizations":[]\n}',C=new Set(["verified","identity","scoped","provider"]),L=function(e){return"undefined"!=typeof Proxy&&(e=new Proxy(e,{get:function(e,t){return C.has(t)&&function(e){console.warn(('\n %cFCL Deprecation Notice\n ========================\n\n Access to field "'+e+'" on "CurrentUser" is deprecated and will cease to work in future releases of FCL.\n Find out more here: https://github.com/onflow/flow-js-sdk/blob/master/packages/fcl/WARNINGS.md#0001-current-user-data\n\n =======================\n ').replace(/\n\s+/g,"\n").trim(),"font-weight:bold;font-family:monospace;")}(t),e[t]}})),e},_=((S={})[n.INIT]=function(e){e.merge(JSON.parse(B))},S[n.SUBSCRIBE]=function(e,t){e.subscribe(t.from),e.send(t.from,A,L(e.all()))},S[n.UNSUBSCRIBE]=function(e,t){e.unsubscribe(t.from)},S.SNAPSHOT=function(e,t){try{return t.reply(L(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},S[N]=function(e,t,n){try{return e.merge(n),e.broadcast(A,L(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},S.DEL_CURRENT_USER=function(e,t){try{return e.merge(JSON.parse(B)),e.broadcast(A,L(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},S.GET_AS_PARAM=function(e,t,n){var o=n.key;try{return t.reply({key:o,value:e.get("addr",null),xform:r.Identity}),Promise.resolve()}catch(e){return Promise.reject(e)}},S),z=function(){return n.spawn(_,U)};function D(){z(),n.send(U,"DEL_CURRENT_USER")}function F(e){return function(){try{return z(),Promise.resolve(R()).then(function(){return n.send(U,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})})}catch(e){return Promise.reject(e)}}}function H(e){z();var t=n.spawn(function(t){try{var r=!1;return t.send(U,n.SUBSCRIBE),Promise.resolve(l(function(){return!r&&1},void 0,function(){return Promise.resolve(t.receive()).then(function(o){if("@EXIT"===o.tag)return t.send(U,n.UNSUBSCRIBE),void(r=!0);e(o.data)})}))}catch(e){return Promise.reject(e)}});return function(){return n.send(t,"@EXIT")}}function G(){return z(),n.send(U,"SNAPSHOT",null,{expectReply:!0,timeout:0})}var q=function(){return{authenticate:R,unauthenticate:D,authorization:I,param:F,subscribe:H,snapshot:G}};Object.defineProperty(exports,"config",{enumerable:!0,get:function(){return e.config}}),Object.defineProperty(exports,"arg",{enumerable:!0,get:function(){return t.arg}}),Object.defineProperty(exports,"args",{enumerable:!0,get:function(){return t.args}}),Object.defineProperty(exports,"authorization",{enumerable:!0,get:function(){return t.authorization}}),Object.defineProperty(exports,"authorizations",{enumerable:!0,get:function(){return t.authorizations}}),Object.defineProperty(exports,"build",{enumerable:!0,get:function(){return t.build}}),Object.defineProperty(exports,"cadence",{enumerable:!0,get:function(){return t.cadence}}),Object.defineProperty(exports,"cdc",{enumerable:!0,get:function(){return t.cdc}}),Object.defineProperty(exports,"getAccount",{enumerable:!0,get:function(){return t.getAccount}}),Object.defineProperty(exports,"getEvents",{enumerable:!0,get:function(){return t.getEvents}}),Object.defineProperty(exports,"getLatestBlock",{enumerable:!0,get:function(){return t.getLatestBlock}}),Object.defineProperty(exports,"getTransactionStatus",{enumerable:!0,get:function(){return t.getTransactionStatus}}),Object.defineProperty(exports,"isBad",{enumerable:!0,get:function(){return t.isBad}}),Object.defineProperty(exports,"isOk",{enumerable:!0,get:function(){return t.isOk}}),Object.defineProperty(exports,"limit",{enumerable:!0,get:function(){return t.limit}}),Object.defineProperty(exports,"param",{enumerable:!0,get:function(){return t.param}}),Object.defineProperty(exports,"params",{enumerable:!0,get:function(){return t.params}}),Object.defineProperty(exports,"payer",{enumerable:!0,get:function(){return t.payer}}),Object.defineProperty(exports,"ping",{enumerable:!0,get:function(){return t.ping}}),Object.defineProperty(exports,"pipe",{enumerable:!0,get:function(){return t.pipe}}),Object.defineProperty(exports,"proposer",{enumerable:!0,get:function(){return t.proposer}}),Object.defineProperty(exports,"ref",{enumerable:!0,get:function(){return t.ref}}),Object.defineProperty(exports,"script",{enumerable:!0,get:function(){return t.script}}),Object.defineProperty(exports,"transaction",{enumerable:!0,get:function(){return t.transaction}}),Object.defineProperty(exports,"why",{enumerable:!0,get:function(){return t.why}}),exports.authenticate=function(){return q().authenticate()},exports.currentUser=q,exports.decode=u,exports.resolve=o,exports.send=i,exports.serialize=function(e){void 0===e&&(e=[]);try{var n=function(){return Promise.resolve(o(e)).then(JSON.stringify)},r=function(){if(Array.isArray(e))return Promise.resolve(t.build(e)).then(function(t){e=t})}();return Promise.resolve(r&&r.then?r.then(n):n())}catch(e){return Promise.reject(e)}},exports.tx=b,exports.unauthenticate=function(){return q().unauthenticate()}; | ||
var e=require("@onflow/config"),n=require("@onflow/sdk"),t=require("@onflow/util-actor"),r=require("@onflow/types");e.config().put("accessNode.api","http://localhost:8080").put("challenge.handshake","http://localhost:8700/authenticate");var o=function(e){try{return Promise.resolve(n.resolve(e,[n.resolveParams,n.resolveArguments,n.resolveAccounts,n.resolveSignatures,n.resolveValidators]))}catch(e){return Promise.reject(e)}},i=function(t,r){void 0===t&&(t=[]),void 0===r&&(r={});try{var i=function(e){return r.node=e,Array.isArray(t)&&(t=n.build(t)),Promise.resolve(o(t)).then(function(e){return n.send(e,r)})},u=r.node;return Promise.resolve(u?i(u):Promise.resolve(e.config().get("accessNode.api")).then(i))}catch(e){return Promise.reject(e)}},u=function(t){try{return Promise.resolve(e.config().where(/^decoder\./)).then(function(e){var r=Object.fromEntries(Object.entries(e).map(function(e){var n=e[0],t=e[1];return[n="/"+n.replace(/^decoder\./,"")+"$/",t]}));return n.decodeResponse(t,r)})}catch(e){return Promise.reject(e)}};const c=function(){function e(){}return e.prototype.then=function(n,t){const r=new e,o=this.s;if(o){const e=1&o?n:t;if(e){try{s(r,1,e(this.v))}catch(e){s(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?s(r,1,n?n(o):o):t?s(r,1,t(o)):s(r,2,o)}catch(e){s(r,2,e)}},r},e}();function s(e,n,t){if(!e.s){if(t instanceof c){if(!t.s)return void(t.o=s.bind(null,e,n));1&n&&(n=t.s),t=t.v}if(t&&t.then)return void t.then(s.bind(null,e,n),s.bind(null,e,2));e.s=n,e.v=t;const r=e.o;r&&r(e)}}function a(e){return e instanceof c&&1&e.s}function l(e,n,t){for(var r;;){var o=e();if(a(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=t();if(i&&i.then){if(!a(i)){r=1;break}i=i.s}if(n){var u=n();if(u&&u.then&&!a(u)){r=2;break}}}var l=new c,f=s.bind(null,l,2);return(0===r?o.then(m):1===r?i.then(d):u.then(p)).then(void 0,f),l;function d(r){i=r;do{if(n&&(u=n())&&u.then&&!a(u))return void u.then(p).then(void 0,f);if(!(o=e())||a(o)&&!o.v)return void s(l,1,i);if(o.then)return void o.then(m).then(void 0,f);a(i=t())&&(i=i.v)}while(!i||!i.then);i.then(d).then(void 0,f)}function m(e){e?(i=t())&&i.then?i.then(d).then(void 0,f):d(i):s(l,1,i)}function p(){(o=e())?o.then?o.then(m).then(void 0,f):m(o):s(l,1,i)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var f,d=function(e){try{return Promise.resolve(i([n.getTransactionStatus(e)])).then(u)}catch(e){return Promise.reject(e)}},m=function(e){return 4===e.status},p=function(e){return 3===e.status||m(e)},h=function(e){return 2===e.status||p(e)},v=function(e){return 1===e.status||h(e)},y=((f={})[t.INIT]=function(e){try{return Promise.resolve(d(e.self())).then(function(n){m(n)||setTimeout(function(){return t.send(e.self(),"POLL")},1e3),e.merge(n)})}catch(e){return Promise.reject(e)}},f[t.SUBSCRIBE]=function(e,n){e.subscribe(n.from),e.send(n.from,"TRANSACTION/UPDATED",e.all())},f[t.UNSUBSCRIBE]=function(e,n){e.unsubscribe(n.from)},f.SNAPSHOT=function(e,n){try{return n.replay(e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},f.POLL=function(e){try{return Promise.resolve(d(e.self())).then(function(n){m(n)||setTimeout(function(){return t.send(e.self(),"POLL")},1e3),e.merge(n),e.broadcast("TRANSACTION/UPDATED",e.all())})}catch(e){return Promise.reject(e)}},f),P=function(e){if("object"==typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return t.spawn(y,e)};function b(e){function n(n){var r=P(e),o=t.spawn(function(e){try{var o=!1;return e.send(r,t.SUBSCRIBE),Promise.resolve(l(function(){return!o&&1},void 0,function(){return Promise.resolve(e.receive()).then(function(i){if("@EXIT"===i.tag)return e.send(r,t.UNSUBSCRIBE),void(o=!0);n(i.data)})}))}catch(e){return Promise.reject(e)}});return function(){return t.send(o,"@EXIT")}}function r(e){return function(){return new Promise(function(t){var r=n(function(n){e(n)&&(t(n),r())})})}}return{snapshot:function(){var n=P(e);return t.send(n,"SNAPSHOT",null,{expectReply:!0,timeout:10})},subscribe:n,oncePending:r(v),onceFinalized:r(h),onceExecuted:r(p),onceSealed:r(m)}}function g(){return(g=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}b.isUnknown=function(e){return 0===e.status||v(e)},b.isPending=v,b.isFinalized=h,b.isExecuted=p,b.isSealed=m;var S,j="FCL_IFRAME_CHALLENGE",x="FCL_IFRAME_AUTHZ",E=function(e){void 0===e&&(e={});var n=e.addr,t=e.pid;return null==n||null==t?null:n+"/"+t},O={"HTTP/POST":"POST","HTTP/GET":"GET"},w=function(e,n){try{for(var t=new URL(e.endpoint),r=0,o=Object.entries(e.params||{});r<o.length;r++){var i=o[r];t.searchParams.append(i[0],i[1])}return n=n?JSON.stringify(n):void 0,Promise.resolve(fetch(t,{method:O[e.method],headers:{"Content-Type":"application/json"},body:n}).then(function(e){return e.json()}))}catch(e){return Promise.reject(e)}},T=function(){try{return z(),Promise.resolve(G()).then(function(e){var t=e.addr;if(null==t)throw new Error("No Flow Address for Current User");return Promise.resolve(i([n.getAccount(t)])).then(function(e){return e.account})})}catch(e){return Promise.reject(e)}},I=function(e){try{return z(),Promise.resolve(R()).then(function(){return Promise.resolve(G()).then(function(n){function t(){return g({},e,{addr:n.addr,keyId:n.keyId,sequenceNum:r,signature:e.signature||null,signingFunction:function(e){try{return Promise.resolve(G()).then(function(n){return Promise.resolve(T()).then(function(t){return Promise.resolve(w(n.authorizations[0],e)).then(function(e){var n=function(){};e.local&&e.local.length>0&&(n=function(e){if(!document.getElementById(x)){for(var n=new URL(e.endpoint),t=0,r=Object.entries(e.params||{});t<r.length;t++){var o=r[t];n.searchParams.append(o[0],o[1])}var i=document.createElement("iframe");return i.src=n.href,i.id=x,i.style.height=e.height||"500px",i.style.maxHeight="90vh",i.style.width=e.width||"400px",i.style.maxWidth="90vw",i.style.display="block",i.style.background=e.background||"#fff",i.style.position="fixed",i.style.top="5vh",i.style.right="calc(50vw)",i.style.transform="translateX(50%)",i.style.boxShadow="0 4px 8px -4px black",i.frameBorder="0",document.body.append(i),function(){document.getElementById(x)&&document.getElementById(x).remove()}}}(e.local[0]));var t=null;return function(e,n){try{var t=e()}catch(e){return n()}return t&&t.then?t.then(n,n):n()}(function(){return function(e,n){try{var t=e()}catch(e){return n(e)}return t&&t.then?t.then(void 0,n):t}(function(){return Promise.resolve(function e(n){return new Promise(function(t,r){try{return Promise.resolve(w(n)).then(function(n){"APPROVED"===n.status?t(n.compositeSignature):"DECLINED"===n.status?r({status:n.status,reason:n.reason}):setTimeout(function(){t(e(n.authorizationUpdates))},500)})}catch(e){return Promise.reject(e)}})}(e.authorizationUpdates)).then(function(e){t=e})},function(e){throw console.error(e),e})},function(){return n(),t})})})})}catch(e){return Promise.reject(e)}},resolve:null,roles:e.roles})}var r,o=function(){if(e.role.proposer)return Promise.resolve(T()).then(function(e){var t=e.keys.find(function(e){return e.index===n.keyId});r=t.sequenceNumber})}();return o&&o.then?o.then(t):t()})})}catch(e){return Promise.reject(e)}},R=function(){try{return Promise.resolve(new Promise(function(n){try{return z(),Promise.resolve(G()).then(function(r){return r.loggedIn?n(r):Promise.resolve(e.config().get("challenge.handshake")).then(function(r){return Promise.resolve(e.config().get("challenge.scope")).then(function(e){var o=function(e){var n=e.handshake,t=e.scope,r=e.nonce,o=e.l6n;if(!document.getElementById(j)){var i=new URL(n);i.searchParams.append("l6n",o),i.searchParams.append("nonce",r),t&&i.searchParams.append("scope",t.split(" ").join("+"));var u=document.createElement("iframe");return u.src=i.href,u.id=j,u.style.height="500px",u.style.maxHeight="90vh",u.style.width="400px",u.style.maxWidth="90vw",u.style.display="block",u.style.background="#fff",u.style.position="fixed",u.style.top="5vh",u.style.right="calc(50vw)",u.style.transform="translateX(50%)",u.style.boxShadow="0 4px 8px -4px black",u.frameBorder="0",document.body.append(u),function(){document.getElementById(j)&&document.getElementById(j).remove()}}}({handshake:r,scope:e,nonce:"asdf",l6n:window.location.origin});window.addEventListener("message",function(e){var r=e.data;try{if(r.type!==k)return Promise.resolve();o();var i=new URL(r.hks);return i.searchParams.append("code",r.code),Promise.resolve(fetch(i,{method:"GET",headers:{"Content-Type":"application/json"}}).then(function(e){return e.json()})).then(function(e){return t.send(U,N,g({},e,{cid:E(e.provider),loggedIn:!0,verified:!0})),Promise.resolve(G()).then(function(e){n(e)})})}catch(e){return Promise.reject(e)}})})})})}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}},U="CURRENT_USER",A="CURRENT_USER/UPDATED",N="SET_CURRENT_USER",k="FCL::CHALLENGE::RESPONSE",B='{\n "cid":null,\n "loggedIn":null,\n "verified":null,\n "identity":{\n "name":null,\n "addr":null,\n "avatar":null,\n "cover":null,\n "color":null,\n "bio":null\n },\n "scoped":{},\n "provider":{\n "addr":null,\n "pid":null,\n "name":null,\n "icon":null\n },\n "authorizations":[]\n}',C=new Set(["verified","identity","scoped","provider"]),L=function(e){return"undefined"!=typeof Proxy&&(e=new Proxy(e,{get:function(e,n){return C.has(n)&&function(e){console.warn(('\n %cFCL Deprecation Notice\n ========================\n\n Access to field "'+e+'" on "CurrentUser" is deprecated and will cease to work in future releases of FCL.\n Find out more here: https://github.com/onflow/flow-js-sdk/blob/master/packages/fcl/WARNINGS.md#0001-current-user-data\n\n =======================\n ').replace(/\n\s+/g,"\n").trim(),"font-weight:bold;font-family:monospace;")}(n),e[n]}})),e},_=((S={})[t.INIT]=function(e){e.merge(JSON.parse(B))},S[t.SUBSCRIBE]=function(e,n){e.subscribe(n.from),e.send(n.from,A,L(e.all()))},S[t.UNSUBSCRIBE]=function(e,n){e.unsubscribe(n.from)},S.SNAPSHOT=function(e,n){try{return n.reply(L(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},S[N]=function(e,n,t){try{return e.merge(t),e.broadcast(A,L(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},S.DEL_CURRENT_USER=function(e,n){try{return e.merge(JSON.parse(B)),e.broadcast(A,L(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},S.GET_AS_PARAM=function(e,n,t){var o=t.key;try{return n.reply({key:o,value:e.get("addr",null),xform:r.Identity}),Promise.resolve()}catch(e){return Promise.reject(e)}},S),z=function(){return t.spawn(_,U)};function D(){z(),t.send(U,"DEL_CURRENT_USER")}function F(e){return function(){try{return z(),Promise.resolve(R()).then(function(){return t.send(U,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})})}catch(e){return Promise.reject(e)}}}function H(e){z();var n=t.spawn(function(n){try{var r=!1;return n.send(U,t.SUBSCRIBE),Promise.resolve(l(function(){return!r&&1},void 0,function(){return Promise.resolve(n.receive()).then(function(o){if("@EXIT"===o.tag)return n.send(U,t.UNSUBSCRIBE),void(r=!0);e(o.data)})}))}catch(e){return Promise.reject(e)}});return function(){return t.send(n,"@EXIT")}}function G(){return z(),t.send(U,"SNAPSHOT",null,{expectReply:!0,timeout:0})}var q=function(){return{authenticate:R,unauthenticate:D,authorization:I,param:F,subscribe:H,snapshot:G}};Object.defineProperty(exports,"config",{enumerable:!0,get:function(){return e.config}}),Object.defineProperty(exports,"arg",{enumerable:!0,get:function(){return n.arg}}),Object.defineProperty(exports,"args",{enumerable:!0,get:function(){return n.args}}),Object.defineProperty(exports,"authorization",{enumerable:!0,get:function(){return n.authorization}}),Object.defineProperty(exports,"authorizations",{enumerable:!0,get:function(){return n.authorizations}}),Object.defineProperty(exports,"build",{enumerable:!0,get:function(){return n.build}}),Object.defineProperty(exports,"cadence",{enumerable:!0,get:function(){return n.cadence}}),Object.defineProperty(exports,"cdc",{enumerable:!0,get:function(){return n.cdc}}),Object.defineProperty(exports,"getAccount",{enumerable:!0,get:function(){return n.getAccount}}),Object.defineProperty(exports,"getEvents",{enumerable:!0,get:function(){return n.getEvents}}),Object.defineProperty(exports,"getLatestBlock",{enumerable:!0,get:function(){return n.getLatestBlock}}),Object.defineProperty(exports,"getTransactionStatus",{enumerable:!0,get:function(){return n.getTransactionStatus}}),Object.defineProperty(exports,"isBad",{enumerable:!0,get:function(){return n.isBad}}),Object.defineProperty(exports,"isOk",{enumerable:!0,get:function(){return n.isOk}}),Object.defineProperty(exports,"limit",{enumerable:!0,get:function(){return n.limit}}),Object.defineProperty(exports,"param",{enumerable:!0,get:function(){return n.param}}),Object.defineProperty(exports,"params",{enumerable:!0,get:function(){return n.params}}),Object.defineProperty(exports,"payer",{enumerable:!0,get:function(){return n.payer}}),Object.defineProperty(exports,"ping",{enumerable:!0,get:function(){return n.ping}}),Object.defineProperty(exports,"pipe",{enumerable:!0,get:function(){return n.pipe}}),Object.defineProperty(exports,"proposer",{enumerable:!0,get:function(){return n.proposer}}),Object.defineProperty(exports,"ref",{enumerable:!0,get:function(){return n.ref}}),Object.defineProperty(exports,"script",{enumerable:!0,get:function(){return n.script}}),Object.defineProperty(exports,"transaction",{enumerable:!0,get:function(){return n.transaction}}),Object.defineProperty(exports,"why",{enumerable:!0,get:function(){return n.why}}),exports.authenticate=function(){return q().authenticate()},exports.currentUser=q,exports.decode=u,exports.resolve=o,exports.send=i,exports.serialize=function(e){void 0===e&&(e=[]);try{var t=function(){return Promise.resolve(o(e)).then(JSON.stringify)},r=function(){if(Array.isArray(e))return Promise.resolve(n.build(e)).then(function(n){e=n})}();return Promise.resolve(r&&r.then?r.then(t):t())}catch(e){return Promise.reject(e)}},exports.tx=b,exports.unauthenticate=function(){return q().unauthenticate()}; | ||
//# sourceMappingURL=fcl.js.map |
@@ -1,2 +0,2 @@ | ||
import{config as e}from"@onflow/config";export{config}from"@onflow/config";import{resolve as n,resolveParams as t,resolveArguments as r,resolveAccounts as o,resolveSignatures as i,resolveValidators as u,build as c,send as s,decodeResponse as a,getTransactionStatus as l,getAccount as f}from"@onflow/sdk";export{arg,args,authorization,authorizations,build,cadence,cdc,getAccount,getEvents,getLatestBlock,getTransactionStatus,isBad,isOk,limit,param,params,payer,ping,pipe,proposer,ref,script,transaction,why}from"@onflow/sdk";import{INIT as d,send as h,SUBSCRIBE as m,UNSUBSCRIBE as v,spawn as p}from"@onflow/util-actor";import{Identity as y}from"@onflow/types";e().put("accessNode.api","http://localhost:8080").put("challenge.handshake","http://localhost:8700/authenticate");var P=function(e){try{return Promise.resolve(n(e,[t,r,o,i,u]))}catch(e){return Promise.reject(e)}},g=function(n,t){void 0===n&&(n=[]),void 0===t&&(t={});try{var r=function(e){return t.node=e,Array.isArray(n)&&(n=c(n)),Promise.resolve(P(n)).then(function(e){return s(e,t)})},o=t.node;return Promise.resolve(o?r(o):Promise.resolve(e().get("accessNode.api")).then(r))}catch(e){return Promise.reject(e)}},b=function(e){void 0===e&&(e=[]);try{var n=function(){return Promise.resolve(P(e)).then(JSON.stringify)},t=function(){if(Array.isArray(e))return Promise.resolve(c(e)).then(function(n){e=n})}();return Promise.resolve(t&&t.then?t.then(n):n())}catch(e){return Promise.reject(e)}},E=function(n){try{return Promise.resolve(e().where(/^decoder\./)).then(function(e){var t=Object.fromEntries(Object.entries(e).map(function(e){var n=e[0],t=e[1];return[n="/"+n.replace(/^decoder\./,"")+"$/",t]}));return a(n,t)})}catch(e){return Promise.reject(e)}};const w=function(){function e(){}return e.prototype.then=function(n,t){const r=new e,o=this.s;if(o){const e=1&o?n:t;if(e){try{S(r,1,e(this.v))}catch(e){S(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?S(r,1,n?n(o):o):t?S(r,1,t(o)):S(r,2,o)}catch(e){S(r,2,e)}},r},e}();function S(e,n,t){if(!e.s){if(t instanceof w){if(!t.s)return void(t.o=S.bind(null,e,n));1&n&&(n=t.s),t=t.v}if(t&&t.then)return void t.then(S.bind(null,e,n),S.bind(null,e,2));e.s=n,e.v=t;const r=e.o;r&&r(e)}}function T(e){return e instanceof w&&1&e.s}function j(e,n,t){for(var r;;){var o=e();if(T(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=t();if(i&&i.then){if(!T(i)){r=1;break}i=i.s}if(n){var u=n();if(u&&u.then&&!T(u)){r=2;break}}}var c=new w,s=S.bind(null,c,2);return(0===r?o.then(l):1===r?i.then(a):u.then(f)).then(void 0,s),c;function a(r){i=r;do{if(n&&(u=n())&&u.then&&!T(u))return void u.then(f).then(void 0,s);if(!(o=e())||T(o)&&!o.v)return void S(c,1,i);if(o.then)return void o.then(l).then(void 0,s);T(i=t())&&(i=i.v)}while(!i||!i.then);i.then(a).then(void 0,s)}function l(e){e?(i=t())&&i.then?i.then(a).then(void 0,s):a(i):S(c,1,i)}function f(){(o=e())?o.then?o.then(l).then(void 0,s):l(o):S(c,1,i)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var x,A=function(e){try{return Promise.resolve(g([l(e)])).then(E)}catch(e){return Promise.reject(e)}},R=function(e){return 4===e.status},k=function(e){return 3===e.status||R(e)},N=function(e){return 2===e.status||k(e)},I=function(e){return 1===e.status||N(e)},O=((x={})[d]=function(e){try{return Promise.resolve(A(e.self())).then(function(n){R(n)||setTimeout(function(){return h(e.self(),"POLL")},1e3),e.merge(n)})}catch(e){return Promise.reject(e)}},x[m]=function(e,n){e.subscribe(n.from),e.send(n.from,"TRANSACTION/UPDATED",e.all())},x[v]=function(e,n){e.unsubscribe(n.from)},x.SNAPSHOT=function(e,n){try{return n.replay(e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},x.POLL=function(e){try{return Promise.resolve(A(e.self())).then(function(n){R(n)||setTimeout(function(){return h(e.self(),"POLL")},1e3),e.merge(n),e.broadcast("TRANSACTION/UPDATED",e.all())})}catch(e){return Promise.reject(e)}},x),L=function(e){if("object"==typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return p(O,e)};function U(e){function n(n){var t=L(e),r=p(function(e){try{var r=!1;return e.send(t,m),Promise.resolve(j(function(){return!r&&1},void 0,function(){return Promise.resolve(e.receive()).then(function(o){if("@EXIT"===o.tag)return e.send(t,v),void(r=!0);n(o.data)})}))}catch(e){return Promise.reject(e)}});return function(){return h(r,"@EXIT")}}function t(e){return function(){return new Promise(function(t){var r=n(function(n){e(n)&&(t(n),r())})})}}return{snapshot:function(){var n=L(e);return h(n,"SNAPSHOT",null,{expectReply:!0,timeout:10})},subscribe:n,oncePending:t(I),onceFinalized:t(N),onceExecuted:t(k),onceSealed:t(R)}}function C(){return(C=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}U.isUnknown=function(e){return 0===e.status||I(e)},U.isPending=I,U.isFinalized=N,U.isExecuted=k,U.isSealed=R;var _,D="FCL_IFRAME_CHALLENGE",F="FCL_IFRAME_AUTHZ",H=function(e){void 0===e&&(e={});var n=e.addr,t=e.pid;return null==n||null==t?null:n+"/"+t},B={"HTTP/POST":"POST","HTTP/GET":"GET"},z=function(e,n){try{for(var t=new URL(e.endpoint),r=0,o=Object.entries(e.params||{});r<o.length;r++){var i=o[r];t.searchParams.append(i[0],i[1])}return n=n?JSON.stringify(n):void 0,Promise.resolve(fetch(t,{method:B[e.method],headers:{"Content-Type":"application/json"},body:n}).then(function(e){return e.json()}))}catch(e){return Promise.reject(e)}},G=function(){try{return Y(),Promise.resolve(re()).then(function(e){var n=e.addr;if(null==n)throw new Error("No Flow Address for Current User");return Promise.resolve(g([f(n)])).then(function(e){return e.account})})}catch(e){return Promise.reject(e)}},X=function(e){try{return Y(),Promise.resolve(J()).then(function(){return Promise.resolve(re()).then(function(n){function t(){return C({},e,{addr:n.addr,keyId:n.keyId,sequenceNum:r,signature:e.signature||null,signingFunction:function(e){try{return Promise.resolve(re()).then(function(n){return Promise.resolve(G()).then(function(t){return Promise.resolve(z(n.authorizations[0],e)).then(function(e){var n=function(){};return e.local&&e.local.length>0&&(n=function(e){if(!document.getElementById(F)){for(var n=new URL(e.endpoint),t=0,r=Object.entries(e.params||{});t<r.length;t++){var o=r[t];n.searchParams.append(o[0],o[1])}var i=document.createElement("iframe");return i.src=n.href,i.id=F,i.style.height=e.height||"500px",i.style.maxHeight="90vh",i.style.width=e.width||"400px",i.style.maxWidth="90vw",i.style.display="block",i.style.background=e.background||"#fff",i.style.position="fixed",i.style.top="5vh",i.style.right="calc(50vw)",i.style.transform="translateX(50%)",i.style.boxShadow="0 4px 8px -4px black",i.frameBorder="0",document.body.append(i),function(){document.getElementById(F)&&document.getElementById(F).remove()}}}(e.local[0])),Promise.resolve(function e(n){return new Promise(function(t,r){try{return Promise.resolve(z(n)).then(function(n){"APPROVED"===n.status?t(n.compositeSignature):"DECLINED"===n.status?r({status:n.status,reason:n.reason}):setTimeout(function(){t(e(n.authorizationUpdates))},500)})}catch(e){return Promise.reject(e)}})}(e.authorizationUpdates)).then(function(e){return n(),e})})})})}catch(e){return Promise.reject(e)}},resolve:null,roles:e.roles})}var r,o=function(){if(e.role.proposer)return Promise.resolve(G()).then(function(e){var t=e.keys.find(function(e){return e.index===n.keyId});r=t.sequenceNumber})}();return o&&o.then?o.then(t):t()})})}catch(e){return Promise.reject(e)}},J=function(){try{return Promise.resolve(new Promise(function(n){try{return Y(),Promise.resolve(re()).then(function(t){return t.loggedIn?n(t):Promise.resolve(e().get("challenge.handshake")).then(function(t){return Promise.resolve(e().get("challenge.scope")).then(function(e){var r=function(e){var n=e.handshake,t=e.scope,r=e.nonce,o=e.l6n;if(!document.getElementById(D)){var i=new URL(n);i.searchParams.append("l6n",o),i.searchParams.append("nonce",r),t&&i.searchParams.append("scope",t.split(" ").join("+"));var u=document.createElement("iframe");return u.src=i.href,u.id=D,u.style.height="500px",u.style.maxHeight="90vh",u.style.width="400px",u.style.maxWidth="90vw",u.style.display="block",u.style.background="#fff",u.style.position="fixed",u.style.top="5vh",u.style.right="calc(50vw)",u.style.transform="translateX(50%)",u.style.boxShadow="0 4px 8px -4px black",u.frameBorder="0",document.body.append(u),function(){document.getElementById(D)&&document.getElementById(D).remove()}}}({handshake:t,scope:e,nonce:"asdf",l6n:window.location.origin});window.addEventListener("message",function(e){var t=e.data;try{if(t.type!==V)return Promise.resolve();r();var o=new URL(t.hks);return o.searchParams.append("code",t.code),Promise.resolve(fetch(o,{method:"GET",headers:{"Content-Type":"application/json"}}).then(function(e){return e.json()})).then(function(e){return h(M,W,C({},e,{cid:H(e.provider),loggedIn:!0,verified:!0})),Promise.resolve(re()).then(function(e){n(e)})})}catch(e){return Promise.reject(e)}})})})})}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}},M="CURRENT_USER",q="CURRENT_USER/UPDATED",W="SET_CURRENT_USER",V="FCL::CHALLENGE::RESPONSE",Z='{\n "cid":null,\n "loggedIn":null,\n "verified":null,\n "identity":{\n "name":null,\n "addr":null,\n "avatar":null,\n "cover":null,\n "color":null,\n "bio":null\n },\n "scoped":{},\n "provider":{\n "addr":null,\n "pid":null,\n "name":null,\n "icon":null\n },\n "authorizations":[]\n}',$=new Set(["verified","identity","scoped","provider"]),K=function(e){return"undefined"!=typeof Proxy&&(e=new Proxy(e,{get:function(e,n){return $.has(n)&&function(e){console.warn(('\n %cFCL Deprecation Notice\n ========================\n\n Access to field "'+e+'" on "CurrentUser" is deprecated and will cease to work in future releases of FCL.\n Find out more here: https://github.com/onflow/flow-js-sdk/blob/master/packages/fcl/WARNINGS.md#0001-current-user-data\n\n =======================\n ').replace(/\n\s+/g,"\n").trim(),"font-weight:bold;font-family:monospace;")}(n),e[n]}})),e},Q=((_={})[d]=function(e){e.merge(JSON.parse(Z))},_[m]=function(e,n){e.subscribe(n.from),e.send(n.from,q,K(e.all()))},_[v]=function(e,n){e.unsubscribe(n.from)},_.SNAPSHOT=function(e,n){try{return n.reply(K(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},_[W]=function(e,n,t){try{return e.merge(t),e.broadcast(q,K(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},_.DEL_CURRENT_USER=function(e,n){try{return e.merge(JSON.parse(Z)),e.broadcast(q,K(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},_.GET_AS_PARAM=function(e,n,t){var r=t.key;try{return n.reply({key:r,value:e.get("addr",null),xform:y}),Promise.resolve()}catch(e){return Promise.reject(e)}},_),Y=function(){return p(Q,M)};function ee(){Y(),h(M,"DEL_CURRENT_USER")}function ne(e){return function(){try{return Y(),Promise.resolve(J()).then(function(){return h(M,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})})}catch(e){return Promise.reject(e)}}}function te(e){Y();var n=p(function(n){try{var t=!1;return n.send(M,m),Promise.resolve(j(function(){return!t&&1},void 0,function(){return Promise.resolve(n.receive()).then(function(r){if("@EXIT"===r.tag)return n.send(M,v),void(t=!0);e(r.data)})}))}catch(e){return Promise.reject(e)}});return function(){return h(n,"@EXIT")}}function re(){return Y(),h(M,"SNAPSHOT",null,{expectReply:!0,timeout:0})}var oe=function(){return{authenticate:J,unauthenticate:ee,authorization:X,param:ne,subscribe:te,snapshot:re}},ie=function(){return oe().authenticate()},ue=function(){return oe().unauthenticate()};export{ie as authenticate,oe as currentUser,E as decode,P as resolve,g as send,b as serialize,U as tx,ue as unauthenticate}; | ||
import{config as e}from"@onflow/config";export{config}from"@onflow/config";import{resolve as n,resolveParams as t,resolveArguments as r,resolveAccounts as o,resolveSignatures as i,resolveValidators as u,build as c,send as s,decodeResponse as a,getTransactionStatus as l,getAccount as f}from"@onflow/sdk";export{arg,args,authorization,authorizations,build,cadence,cdc,getAccount,getEvents,getLatestBlock,getTransactionStatus,isBad,isOk,limit,param,params,payer,ping,pipe,proposer,ref,script,transaction,why}from"@onflow/sdk";import{INIT as d,send as h,SUBSCRIBE as m,UNSUBSCRIBE as v,spawn as p}from"@onflow/util-actor";import{Identity as y}from"@onflow/types";e().put("accessNode.api","http://localhost:8080").put("challenge.handshake","http://localhost:8700/authenticate");var P=function(e){try{return Promise.resolve(n(e,[t,r,o,i,u]))}catch(e){return Promise.reject(e)}},g=function(n,t){void 0===n&&(n=[]),void 0===t&&(t={});try{var r=function(e){return t.node=e,Array.isArray(n)&&(n=c(n)),Promise.resolve(P(n)).then(function(e){return s(e,t)})},o=t.node;return Promise.resolve(o?r(o):Promise.resolve(e().get("accessNode.api")).then(r))}catch(e){return Promise.reject(e)}},b=function(e){void 0===e&&(e=[]);try{var n=function(){return Promise.resolve(P(e)).then(JSON.stringify)},t=function(){if(Array.isArray(e))return Promise.resolve(c(e)).then(function(n){e=n})}();return Promise.resolve(t&&t.then?t.then(n):n())}catch(e){return Promise.reject(e)}},E=function(n){try{return Promise.resolve(e().where(/^decoder\./)).then(function(e){var t=Object.fromEntries(Object.entries(e).map(function(e){var n=e[0],t=e[1];return[n="/"+n.replace(/^decoder\./,"")+"$/",t]}));return a(n,t)})}catch(e){return Promise.reject(e)}};const w=function(){function e(){}return e.prototype.then=function(n,t){const r=new e,o=this.s;if(o){const e=1&o?n:t;if(e){try{S(r,1,e(this.v))}catch(e){S(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?S(r,1,n?n(o):o):t?S(r,1,t(o)):S(r,2,o)}catch(e){S(r,2,e)}},r},e}();function S(e,n,t){if(!e.s){if(t instanceof w){if(!t.s)return void(t.o=S.bind(null,e,n));1&n&&(n=t.s),t=t.v}if(t&&t.then)return void t.then(S.bind(null,e,n),S.bind(null,e,2));e.s=n,e.v=t;const r=e.o;r&&r(e)}}function T(e){return e instanceof w&&1&e.s}function j(e,n,t){for(var r;;){var o=e();if(T(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=t();if(i&&i.then){if(!T(i)){r=1;break}i=i.s}if(n){var u=n();if(u&&u.then&&!T(u)){r=2;break}}}var c=new w,s=S.bind(null,c,2);return(0===r?o.then(l):1===r?i.then(a):u.then(f)).then(void 0,s),c;function a(r){i=r;do{if(n&&(u=n())&&u.then&&!T(u))return void u.then(f).then(void 0,s);if(!(o=e())||T(o)&&!o.v)return void S(c,1,i);if(o.then)return void o.then(l).then(void 0,s);T(i=t())&&(i=i.v)}while(!i||!i.then);i.then(a).then(void 0,s)}function l(e){e?(i=t())&&i.then?i.then(a).then(void 0,s):a(i):S(c,1,i)}function f(){(o=e())?o.then?o.then(l).then(void 0,s):l(o):S(c,1,i)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var x,A=function(e){try{return Promise.resolve(g([l(e)])).then(E)}catch(e){return Promise.reject(e)}},R=function(e){return 4===e.status},k=function(e){return 3===e.status||R(e)},N=function(e){return 2===e.status||k(e)},I=function(e){return 1===e.status||N(e)},O=((x={})[d]=function(e){try{return Promise.resolve(A(e.self())).then(function(n){R(n)||setTimeout(function(){return h(e.self(),"POLL")},1e3),e.merge(n)})}catch(e){return Promise.reject(e)}},x[m]=function(e,n){e.subscribe(n.from),e.send(n.from,"TRANSACTION/UPDATED",e.all())},x[v]=function(e,n){e.unsubscribe(n.from)},x.SNAPSHOT=function(e,n){try{return n.replay(e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},x.POLL=function(e){try{return Promise.resolve(A(e.self())).then(function(n){R(n)||setTimeout(function(){return h(e.self(),"POLL")},1e3),e.merge(n),e.broadcast("TRANSACTION/UPDATED",e.all())})}catch(e){return Promise.reject(e)}},x),L=function(e){if("object"==typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return p(O,e)};function U(e){function n(n){var t=L(e),r=p(function(e){try{var r=!1;return e.send(t,m),Promise.resolve(j(function(){return!r&&1},void 0,function(){return Promise.resolve(e.receive()).then(function(o){if("@EXIT"===o.tag)return e.send(t,v),void(r=!0);n(o.data)})}))}catch(e){return Promise.reject(e)}});return function(){return h(r,"@EXIT")}}function t(e){return function(){return new Promise(function(t){var r=n(function(n){e(n)&&(t(n),r())})})}}return{snapshot:function(){var n=L(e);return h(n,"SNAPSHOT",null,{expectReply:!0,timeout:10})},subscribe:n,oncePending:t(I),onceFinalized:t(N),onceExecuted:t(k),onceSealed:t(R)}}function C(){return(C=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}U.isUnknown=function(e){return 0===e.status||I(e)},U.isPending=I,U.isFinalized=N,U.isExecuted=k,U.isSealed=R;var _,D="FCL_IFRAME_CHALLENGE",F="FCL_IFRAME_AUTHZ",H=function(e){void 0===e&&(e={});var n=e.addr,t=e.pid;return null==n||null==t?null:n+"/"+t},B={"HTTP/POST":"POST","HTTP/GET":"GET"},z=function(e,n){try{for(var t=new URL(e.endpoint),r=0,o=Object.entries(e.params||{});r<o.length;r++){var i=o[r];t.searchParams.append(i[0],i[1])}return n=n?JSON.stringify(n):void 0,Promise.resolve(fetch(t,{method:B[e.method],headers:{"Content-Type":"application/json"},body:n}).then(function(e){return e.json()}))}catch(e){return Promise.reject(e)}},G=function(){try{return Y(),Promise.resolve(re()).then(function(e){var n=e.addr;if(null==n)throw new Error("No Flow Address for Current User");return Promise.resolve(g([f(n)])).then(function(e){return e.account})})}catch(e){return Promise.reject(e)}},X=function(e){try{return Y(),Promise.resolve(J()).then(function(){return Promise.resolve(re()).then(function(n){function t(){return C({},e,{addr:n.addr,keyId:n.keyId,sequenceNum:r,signature:e.signature||null,signingFunction:function(e){try{return Promise.resolve(re()).then(function(n){return Promise.resolve(G()).then(function(t){return Promise.resolve(z(n.authorizations[0],e)).then(function(e){var n=function(){};e.local&&e.local.length>0&&(n=function(e){if(!document.getElementById(F)){for(var n=new URL(e.endpoint),t=0,r=Object.entries(e.params||{});t<r.length;t++){var o=r[t];n.searchParams.append(o[0],o[1])}var i=document.createElement("iframe");return i.src=n.href,i.id=F,i.style.height=e.height||"500px",i.style.maxHeight="90vh",i.style.width=e.width||"400px",i.style.maxWidth="90vw",i.style.display="block",i.style.background=e.background||"#fff",i.style.position="fixed",i.style.top="5vh",i.style.right="calc(50vw)",i.style.transform="translateX(50%)",i.style.boxShadow="0 4px 8px -4px black",i.frameBorder="0",document.body.append(i),function(){document.getElementById(F)&&document.getElementById(F).remove()}}}(e.local[0]));var t=null;return function(e,n){try{var t=e()}catch(e){return n()}return t&&t.then?t.then(n,n):n()}(function(){return function(e,n){try{var t=e()}catch(e){return n(e)}return t&&t.then?t.then(void 0,n):t}(function(){return Promise.resolve(function e(n){return new Promise(function(t,r){try{return Promise.resolve(z(n)).then(function(n){"APPROVED"===n.status?t(n.compositeSignature):"DECLINED"===n.status?r({status:n.status,reason:n.reason}):setTimeout(function(){t(e(n.authorizationUpdates))},500)})}catch(e){return Promise.reject(e)}})}(e.authorizationUpdates)).then(function(e){t=e})},function(e){throw console.error(e),e})},function(){return n(),t})})})})}catch(e){return Promise.reject(e)}},resolve:null,roles:e.roles})}var r,o=function(){if(e.role.proposer)return Promise.resolve(G()).then(function(e){var t=e.keys.find(function(e){return e.index===n.keyId});r=t.sequenceNumber})}();return o&&o.then?o.then(t):t()})})}catch(e){return Promise.reject(e)}},J=function(){try{return Promise.resolve(new Promise(function(n){try{return Y(),Promise.resolve(re()).then(function(t){return t.loggedIn?n(t):Promise.resolve(e().get("challenge.handshake")).then(function(t){return Promise.resolve(e().get("challenge.scope")).then(function(e){var r=function(e){var n=e.handshake,t=e.scope,r=e.nonce,o=e.l6n;if(!document.getElementById(D)){var i=new URL(n);i.searchParams.append("l6n",o),i.searchParams.append("nonce",r),t&&i.searchParams.append("scope",t.split(" ").join("+"));var u=document.createElement("iframe");return u.src=i.href,u.id=D,u.style.height="500px",u.style.maxHeight="90vh",u.style.width="400px",u.style.maxWidth="90vw",u.style.display="block",u.style.background="#fff",u.style.position="fixed",u.style.top="5vh",u.style.right="calc(50vw)",u.style.transform="translateX(50%)",u.style.boxShadow="0 4px 8px -4px black",u.frameBorder="0",document.body.append(u),function(){document.getElementById(D)&&document.getElementById(D).remove()}}}({handshake:t,scope:e,nonce:"asdf",l6n:window.location.origin});window.addEventListener("message",function(e){var t=e.data;try{if(t.type!==V)return Promise.resolve();r();var o=new URL(t.hks);return o.searchParams.append("code",t.code),Promise.resolve(fetch(o,{method:"GET",headers:{"Content-Type":"application/json"}}).then(function(e){return e.json()})).then(function(e){return h(M,W,C({},e,{cid:H(e.provider),loggedIn:!0,verified:!0})),Promise.resolve(re()).then(function(e){n(e)})})}catch(e){return Promise.reject(e)}})})})})}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}},M="CURRENT_USER",q="CURRENT_USER/UPDATED",W="SET_CURRENT_USER",V="FCL::CHALLENGE::RESPONSE",Z='{\n "cid":null,\n "loggedIn":null,\n "verified":null,\n "identity":{\n "name":null,\n "addr":null,\n "avatar":null,\n "cover":null,\n "color":null,\n "bio":null\n },\n "scoped":{},\n "provider":{\n "addr":null,\n "pid":null,\n "name":null,\n "icon":null\n },\n "authorizations":[]\n}',$=new Set(["verified","identity","scoped","provider"]),K=function(e){return"undefined"!=typeof Proxy&&(e=new Proxy(e,{get:function(e,n){return $.has(n)&&function(e){console.warn(('\n %cFCL Deprecation Notice\n ========================\n\n Access to field "'+e+'" on "CurrentUser" is deprecated and will cease to work in future releases of FCL.\n Find out more here: https://github.com/onflow/flow-js-sdk/blob/master/packages/fcl/WARNINGS.md#0001-current-user-data\n\n =======================\n ').replace(/\n\s+/g,"\n").trim(),"font-weight:bold;font-family:monospace;")}(n),e[n]}})),e},Q=((_={})[d]=function(e){e.merge(JSON.parse(Z))},_[m]=function(e,n){e.subscribe(n.from),e.send(n.from,q,K(e.all()))},_[v]=function(e,n){e.unsubscribe(n.from)},_.SNAPSHOT=function(e,n){try{return n.reply(K(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},_[W]=function(e,n,t){try{return e.merge(t),e.broadcast(q,K(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},_.DEL_CURRENT_USER=function(e,n){try{return e.merge(JSON.parse(Z)),e.broadcast(q,K(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},_.GET_AS_PARAM=function(e,n,t){var r=t.key;try{return n.reply({key:r,value:e.get("addr",null),xform:y}),Promise.resolve()}catch(e){return Promise.reject(e)}},_),Y=function(){return p(Q,M)};function ee(){Y(),h(M,"DEL_CURRENT_USER")}function ne(e){return function(){try{return Y(),Promise.resolve(J()).then(function(){return h(M,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})})}catch(e){return Promise.reject(e)}}}function te(e){Y();var n=p(function(n){try{var t=!1;return n.send(M,m),Promise.resolve(j(function(){return!t&&1},void 0,function(){return Promise.resolve(n.receive()).then(function(r){if("@EXIT"===r.tag)return n.send(M,v),void(t=!0);e(r.data)})}))}catch(e){return Promise.reject(e)}});return function(){return h(n,"@EXIT")}}function re(){return Y(),h(M,"SNAPSHOT",null,{expectReply:!0,timeout:0})}var oe=function(){return{authenticate:J,unauthenticate:ee,authorization:X,param:ne,subscribe:te,snapshot:re}},ie=function(){return oe().authenticate()},ue=function(){return oe().unauthenticate()};export{ie as authenticate,oe as currentUser,E as decode,P as resolve,g as send,b as serialize,U as tx,ue as unauthenticate}; | ||
//# sourceMappingURL=fcl.modern.js.map |
@@ -1,2 +0,2 @@ | ||
import{config as e}from"@onflow/config";export{config}from"@onflow/config";import{resolve as n,resolveParams as t,resolveArguments as r,resolveAccounts as o,resolveSignatures as i,resolveValidators as u,build as c,send as s,decodeResponse as a,getTransactionStatus as l,getAccount as f}from"@onflow/sdk";export{arg,args,authorization,authorizations,build,cadence,cdc,getAccount,getEvents,getLatestBlock,getTransactionStatus,isBad,isOk,limit,param,params,payer,ping,pipe,proposer,ref,script,transaction,why}from"@onflow/sdk";import{INIT as d,send as h,SUBSCRIBE as m,UNSUBSCRIBE as v,spawn as p}from"@onflow/util-actor";import{Identity as y}from"@onflow/types";e().put("accessNode.api","http://localhost:8080").put("challenge.handshake","http://localhost:8700/authenticate");var P=function(e){try{return Promise.resolve(n(e,[t,r,o,i,u]))}catch(e){return Promise.reject(e)}},g=function(n,t){void 0===n&&(n=[]),void 0===t&&(t={});try{var r=function(e){return t.node=e,Array.isArray(n)&&(n=c(n)),Promise.resolve(P(n)).then(function(e){return s(e,t)})},o=t.node;return Promise.resolve(o?r(o):Promise.resolve(e().get("accessNode.api")).then(r))}catch(e){return Promise.reject(e)}},b=function(e){void 0===e&&(e=[]);try{var n=function(){return Promise.resolve(P(e)).then(JSON.stringify)},t=function(){if(Array.isArray(e))return Promise.resolve(c(e)).then(function(n){e=n})}();return Promise.resolve(t&&t.then?t.then(n):n())}catch(e){return Promise.reject(e)}},E=function(n){try{return Promise.resolve(e().where(/^decoder\./)).then(function(e){var t=Object.fromEntries(Object.entries(e).map(function(e){var n=e[0],t=e[1];return[n="/"+n.replace(/^decoder\./,"")+"$/",t]}));return a(n,t)})}catch(e){return Promise.reject(e)}};const w=function(){function e(){}return e.prototype.then=function(n,t){const r=new e,o=this.s;if(o){const e=1&o?n:t;if(e){try{S(r,1,e(this.v))}catch(e){S(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?S(r,1,n?n(o):o):t?S(r,1,t(o)):S(r,2,o)}catch(e){S(r,2,e)}},r},e}();function S(e,n,t){if(!e.s){if(t instanceof w){if(!t.s)return void(t.o=S.bind(null,e,n));1&n&&(n=t.s),t=t.v}if(t&&t.then)return void t.then(S.bind(null,e,n),S.bind(null,e,2));e.s=n,e.v=t;const r=e.o;r&&r(e)}}function T(e){return e instanceof w&&1&e.s}function j(e,n,t){for(var r;;){var o=e();if(T(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=t();if(i&&i.then){if(!T(i)){r=1;break}i=i.s}if(n){var u=n();if(u&&u.then&&!T(u)){r=2;break}}}var c=new w,s=S.bind(null,c,2);return(0===r?o.then(l):1===r?i.then(a):u.then(f)).then(void 0,s),c;function a(r){i=r;do{if(n&&(u=n())&&u.then&&!T(u))return void u.then(f).then(void 0,s);if(!(o=e())||T(o)&&!o.v)return void S(c,1,i);if(o.then)return void o.then(l).then(void 0,s);T(i=t())&&(i=i.v)}while(!i||!i.then);i.then(a).then(void 0,s)}function l(e){e?(i=t())&&i.then?i.then(a).then(void 0,s):a(i):S(c,1,i)}function f(){(o=e())?o.then?o.then(l).then(void 0,s):l(o):S(c,1,i)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var x,A=function(e){try{return Promise.resolve(g([l(e)])).then(E)}catch(e){return Promise.reject(e)}},R=function(e){return 4===e.status},k=function(e){return 3===e.status||R(e)},N=function(e){return 2===e.status||k(e)},I=function(e){return 1===e.status||N(e)},O=((x={})[d]=function(e){try{return Promise.resolve(A(e.self())).then(function(n){R(n)||setTimeout(function(){return h(e.self(),"POLL")},1e3),e.merge(n)})}catch(e){return Promise.reject(e)}},x[m]=function(e,n){e.subscribe(n.from),e.send(n.from,"TRANSACTION/UPDATED",e.all())},x[v]=function(e,n){e.unsubscribe(n.from)},x.SNAPSHOT=function(e,n){try{return n.replay(e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},x.POLL=function(e){try{return Promise.resolve(A(e.self())).then(function(n){R(n)||setTimeout(function(){return h(e.self(),"POLL")},1e3),e.merge(n),e.broadcast("TRANSACTION/UPDATED",e.all())})}catch(e){return Promise.reject(e)}},x),L=function(e){if("object"==typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return p(O,e)};function U(e){function n(n){var t=L(e),r=p(function(e){try{var r=!1;return e.send(t,m),Promise.resolve(j(function(){return!r&&1},void 0,function(){return Promise.resolve(e.receive()).then(function(o){if("@EXIT"===o.tag)return e.send(t,v),void(r=!0);n(o.data)})}))}catch(e){return Promise.reject(e)}});return function(){return h(r,"@EXIT")}}function t(e){return function(){return new Promise(function(t){var r=n(function(n){e(n)&&(t(n),r())})})}}return{snapshot:function(){var n=L(e);return h(n,"SNAPSHOT",null,{expectReply:!0,timeout:10})},subscribe:n,oncePending:t(I),onceFinalized:t(N),onceExecuted:t(k),onceSealed:t(R)}}function C(){return(C=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}U.isUnknown=function(e){return 0===e.status||I(e)},U.isPending=I,U.isFinalized=N,U.isExecuted=k,U.isSealed=R;var _,D="FCL_IFRAME_CHALLENGE",F="FCL_IFRAME_AUTHZ",H=function(e){void 0===e&&(e={});var n=e.addr,t=e.pid;return null==n||null==t?null:n+"/"+t},B={"HTTP/POST":"POST","HTTP/GET":"GET"},z=function(e,n){try{for(var t=new URL(e.endpoint),r=0,o=Object.entries(e.params||{});r<o.length;r++){var i=o[r];t.searchParams.append(i[0],i[1])}return n=n?JSON.stringify(n):void 0,Promise.resolve(fetch(t,{method:B[e.method],headers:{"Content-Type":"application/json"},body:n}).then(function(e){return e.json()}))}catch(e){return Promise.reject(e)}},G=function(){try{return Y(),Promise.resolve(re()).then(function(e){var n=e.addr;if(null==n)throw new Error("No Flow Address for Current User");return Promise.resolve(g([f(n)])).then(function(e){return e.account})})}catch(e){return Promise.reject(e)}},X=function(e){try{return Y(),Promise.resolve(J()).then(function(){return Promise.resolve(re()).then(function(n){function t(){return C({},e,{addr:n.addr,keyId:n.keyId,sequenceNum:r,signature:e.signature||null,signingFunction:function(e){try{return Promise.resolve(re()).then(function(n){return Promise.resolve(G()).then(function(t){return Promise.resolve(z(n.authorizations[0],e)).then(function(e){var n=function(){};return e.local&&e.local.length>0&&(n=function(e){if(!document.getElementById(F)){for(var n=new URL(e.endpoint),t=0,r=Object.entries(e.params||{});t<r.length;t++){var o=r[t];n.searchParams.append(o[0],o[1])}var i=document.createElement("iframe");return i.src=n.href,i.id=F,i.style.height=e.height||"500px",i.style.maxHeight="90vh",i.style.width=e.width||"400px",i.style.maxWidth="90vw",i.style.display="block",i.style.background=e.background||"#fff",i.style.position="fixed",i.style.top="5vh",i.style.right="calc(50vw)",i.style.transform="translateX(50%)",i.style.boxShadow="0 4px 8px -4px black",i.frameBorder="0",document.body.append(i),function(){document.getElementById(F)&&document.getElementById(F).remove()}}}(e.local[0])),Promise.resolve(function e(n){return new Promise(function(t,r){try{return Promise.resolve(z(n)).then(function(n){"APPROVED"===n.status?t(n.compositeSignature):"DECLINED"===n.status?r({status:n.status,reason:n.reason}):setTimeout(function(){t(e(n.authorizationUpdates))},500)})}catch(e){return Promise.reject(e)}})}(e.authorizationUpdates)).then(function(e){return n(),e})})})})}catch(e){return Promise.reject(e)}},resolve:null,roles:e.roles})}var r,o=function(){if(e.role.proposer)return Promise.resolve(G()).then(function(e){var t=e.keys.find(function(e){return e.index===n.keyId});r=t.sequenceNumber})}();return o&&o.then?o.then(t):t()})})}catch(e){return Promise.reject(e)}},J=function(){try{return Promise.resolve(new Promise(function(n){try{return Y(),Promise.resolve(re()).then(function(t){return t.loggedIn?n(t):Promise.resolve(e().get("challenge.handshake")).then(function(t){return Promise.resolve(e().get("challenge.scope")).then(function(e){var r=function(e){var n=e.handshake,t=e.scope,r=e.nonce,o=e.l6n;if(!document.getElementById(D)){var i=new URL(n);i.searchParams.append("l6n",o),i.searchParams.append("nonce",r),t&&i.searchParams.append("scope",t.split(" ").join("+"));var u=document.createElement("iframe");return u.src=i.href,u.id=D,u.style.height="500px",u.style.maxHeight="90vh",u.style.width="400px",u.style.maxWidth="90vw",u.style.display="block",u.style.background="#fff",u.style.position="fixed",u.style.top="5vh",u.style.right="calc(50vw)",u.style.transform="translateX(50%)",u.style.boxShadow="0 4px 8px -4px black",u.frameBorder="0",document.body.append(u),function(){document.getElementById(D)&&document.getElementById(D).remove()}}}({handshake:t,scope:e,nonce:"asdf",l6n:window.location.origin});window.addEventListener("message",function(e){var t=e.data;try{if(t.type!==V)return Promise.resolve();r();var o=new URL(t.hks);return o.searchParams.append("code",t.code),Promise.resolve(fetch(o,{method:"GET",headers:{"Content-Type":"application/json"}}).then(function(e){return e.json()})).then(function(e){return h(M,W,C({},e,{cid:H(e.provider),loggedIn:!0,verified:!0})),Promise.resolve(re()).then(function(e){n(e)})})}catch(e){return Promise.reject(e)}})})})})}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}},M="CURRENT_USER",q="CURRENT_USER/UPDATED",W="SET_CURRENT_USER",V="FCL::CHALLENGE::RESPONSE",Z='{\n "cid":null,\n "loggedIn":null,\n "verified":null,\n "identity":{\n "name":null,\n "addr":null,\n "avatar":null,\n "cover":null,\n "color":null,\n "bio":null\n },\n "scoped":{},\n "provider":{\n "addr":null,\n "pid":null,\n "name":null,\n "icon":null\n },\n "authorizations":[]\n}',$=new Set(["verified","identity","scoped","provider"]),K=function(e){return"undefined"!=typeof Proxy&&(e=new Proxy(e,{get:function(e,n){return $.has(n)&&function(e){console.warn(('\n %cFCL Deprecation Notice\n ========================\n\n Access to field "'+e+'" on "CurrentUser" is deprecated and will cease to work in future releases of FCL.\n Find out more here: https://github.com/onflow/flow-js-sdk/blob/master/packages/fcl/WARNINGS.md#0001-current-user-data\n\n =======================\n ').replace(/\n\s+/g,"\n").trim(),"font-weight:bold;font-family:monospace;")}(n),e[n]}})),e},Q=((_={})[d]=function(e){e.merge(JSON.parse(Z))},_[m]=function(e,n){e.subscribe(n.from),e.send(n.from,q,K(e.all()))},_[v]=function(e,n){e.unsubscribe(n.from)},_.SNAPSHOT=function(e,n){try{return n.reply(K(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},_[W]=function(e,n,t){try{return e.merge(t),e.broadcast(q,K(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},_.DEL_CURRENT_USER=function(e,n){try{return e.merge(JSON.parse(Z)),e.broadcast(q,K(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},_.GET_AS_PARAM=function(e,n,t){var r=t.key;try{return n.reply({key:r,value:e.get("addr",null),xform:y}),Promise.resolve()}catch(e){return Promise.reject(e)}},_),Y=function(){return p(Q,M)};function ee(){Y(),h(M,"DEL_CURRENT_USER")}function ne(e){return function(){try{return Y(),Promise.resolve(J()).then(function(){return h(M,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})})}catch(e){return Promise.reject(e)}}}function te(e){Y();var n=p(function(n){try{var t=!1;return n.send(M,m),Promise.resolve(j(function(){return!t&&1},void 0,function(){return Promise.resolve(n.receive()).then(function(r){if("@EXIT"===r.tag)return n.send(M,v),void(t=!0);e(r.data)})}))}catch(e){return Promise.reject(e)}});return function(){return h(n,"@EXIT")}}function re(){return Y(),h(M,"SNAPSHOT",null,{expectReply:!0,timeout:0})}var oe=function(){return{authenticate:J,unauthenticate:ee,authorization:X,param:ne,subscribe:te,snapshot:re}},ie=function(){return oe().authenticate()},ue=function(){return oe().unauthenticate()};export{ie as authenticate,oe as currentUser,E as decode,P as resolve,g as send,b as serialize,U as tx,ue as unauthenticate}; | ||
import{config as e}from"@onflow/config";export{config}from"@onflow/config";import{resolve as n,resolveParams as t,resolveArguments as r,resolveAccounts as o,resolveSignatures as i,resolveValidators as u,build as c,send as s,decodeResponse as a,getTransactionStatus as l,getAccount as f}from"@onflow/sdk";export{arg,args,authorization,authorizations,build,cadence,cdc,getAccount,getEvents,getLatestBlock,getTransactionStatus,isBad,isOk,limit,param,params,payer,ping,pipe,proposer,ref,script,transaction,why}from"@onflow/sdk";import{INIT as d,send as h,SUBSCRIBE as m,UNSUBSCRIBE as v,spawn as p}from"@onflow/util-actor";import{Identity as y}from"@onflow/types";e().put("accessNode.api","http://localhost:8080").put("challenge.handshake","http://localhost:8700/authenticate");var P=function(e){try{return Promise.resolve(n(e,[t,r,o,i,u]))}catch(e){return Promise.reject(e)}},g=function(n,t){void 0===n&&(n=[]),void 0===t&&(t={});try{var r=function(e){return t.node=e,Array.isArray(n)&&(n=c(n)),Promise.resolve(P(n)).then(function(e){return s(e,t)})},o=t.node;return Promise.resolve(o?r(o):Promise.resolve(e().get("accessNode.api")).then(r))}catch(e){return Promise.reject(e)}},b=function(e){void 0===e&&(e=[]);try{var n=function(){return Promise.resolve(P(e)).then(JSON.stringify)},t=function(){if(Array.isArray(e))return Promise.resolve(c(e)).then(function(n){e=n})}();return Promise.resolve(t&&t.then?t.then(n):n())}catch(e){return Promise.reject(e)}},E=function(n){try{return Promise.resolve(e().where(/^decoder\./)).then(function(e){var t=Object.fromEntries(Object.entries(e).map(function(e){var n=e[0],t=e[1];return[n="/"+n.replace(/^decoder\./,"")+"$/",t]}));return a(n,t)})}catch(e){return Promise.reject(e)}};const w=function(){function e(){}return e.prototype.then=function(n,t){const r=new e,o=this.s;if(o){const e=1&o?n:t;if(e){try{S(r,1,e(this.v))}catch(e){S(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?S(r,1,n?n(o):o):t?S(r,1,t(o)):S(r,2,o)}catch(e){S(r,2,e)}},r},e}();function S(e,n,t){if(!e.s){if(t instanceof w){if(!t.s)return void(t.o=S.bind(null,e,n));1&n&&(n=t.s),t=t.v}if(t&&t.then)return void t.then(S.bind(null,e,n),S.bind(null,e,2));e.s=n,e.v=t;const r=e.o;r&&r(e)}}function T(e){return e instanceof w&&1&e.s}function j(e,n,t){for(var r;;){var o=e();if(T(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=t();if(i&&i.then){if(!T(i)){r=1;break}i=i.s}if(n){var u=n();if(u&&u.then&&!T(u)){r=2;break}}}var c=new w,s=S.bind(null,c,2);return(0===r?o.then(l):1===r?i.then(a):u.then(f)).then(void 0,s),c;function a(r){i=r;do{if(n&&(u=n())&&u.then&&!T(u))return void u.then(f).then(void 0,s);if(!(o=e())||T(o)&&!o.v)return void S(c,1,i);if(o.then)return void o.then(l).then(void 0,s);T(i=t())&&(i=i.v)}while(!i||!i.then);i.then(a).then(void 0,s)}function l(e){e?(i=t())&&i.then?i.then(a).then(void 0,s):a(i):S(c,1,i)}function f(){(o=e())?o.then?o.then(l).then(void 0,s):l(o):S(c,1,i)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var x,A=function(e){try{return Promise.resolve(g([l(e)])).then(E)}catch(e){return Promise.reject(e)}},R=function(e){return 4===e.status},k=function(e){return 3===e.status||R(e)},N=function(e){return 2===e.status||k(e)},I=function(e){return 1===e.status||N(e)},O=((x={})[d]=function(e){try{return Promise.resolve(A(e.self())).then(function(n){R(n)||setTimeout(function(){return h(e.self(),"POLL")},1e3),e.merge(n)})}catch(e){return Promise.reject(e)}},x[m]=function(e,n){e.subscribe(n.from),e.send(n.from,"TRANSACTION/UPDATED",e.all())},x[v]=function(e,n){e.unsubscribe(n.from)},x.SNAPSHOT=function(e,n){try{return n.replay(e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},x.POLL=function(e){try{return Promise.resolve(A(e.self())).then(function(n){R(n)||setTimeout(function(){return h(e.self(),"POLL")},1e3),e.merge(n),e.broadcast("TRANSACTION/UPDATED",e.all())})}catch(e){return Promise.reject(e)}},x),L=function(e){if("object"==typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return p(O,e)};function U(e){function n(n){var t=L(e),r=p(function(e){try{var r=!1;return e.send(t,m),Promise.resolve(j(function(){return!r&&1},void 0,function(){return Promise.resolve(e.receive()).then(function(o){if("@EXIT"===o.tag)return e.send(t,v),void(r=!0);n(o.data)})}))}catch(e){return Promise.reject(e)}});return function(){return h(r,"@EXIT")}}function t(e){return function(){return new Promise(function(t){var r=n(function(n){e(n)&&(t(n),r())})})}}return{snapshot:function(){var n=L(e);return h(n,"SNAPSHOT",null,{expectReply:!0,timeout:10})},subscribe:n,oncePending:t(I),onceFinalized:t(N),onceExecuted:t(k),onceSealed:t(R)}}function C(){return(C=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}U.isUnknown=function(e){return 0===e.status||I(e)},U.isPending=I,U.isFinalized=N,U.isExecuted=k,U.isSealed=R;var _,D="FCL_IFRAME_CHALLENGE",F="FCL_IFRAME_AUTHZ",H=function(e){void 0===e&&(e={});var n=e.addr,t=e.pid;return null==n||null==t?null:n+"/"+t},B={"HTTP/POST":"POST","HTTP/GET":"GET"},z=function(e,n){try{for(var t=new URL(e.endpoint),r=0,o=Object.entries(e.params||{});r<o.length;r++){var i=o[r];t.searchParams.append(i[0],i[1])}return n=n?JSON.stringify(n):void 0,Promise.resolve(fetch(t,{method:B[e.method],headers:{"Content-Type":"application/json"},body:n}).then(function(e){return e.json()}))}catch(e){return Promise.reject(e)}},G=function(){try{return Y(),Promise.resolve(re()).then(function(e){var n=e.addr;if(null==n)throw new Error("No Flow Address for Current User");return Promise.resolve(g([f(n)])).then(function(e){return e.account})})}catch(e){return Promise.reject(e)}},X=function(e){try{return Y(),Promise.resolve(J()).then(function(){return Promise.resolve(re()).then(function(n){function t(){return C({},e,{addr:n.addr,keyId:n.keyId,sequenceNum:r,signature:e.signature||null,signingFunction:function(e){try{return Promise.resolve(re()).then(function(n){return Promise.resolve(G()).then(function(t){return Promise.resolve(z(n.authorizations[0],e)).then(function(e){var n=function(){};e.local&&e.local.length>0&&(n=function(e){if(!document.getElementById(F)){for(var n=new URL(e.endpoint),t=0,r=Object.entries(e.params||{});t<r.length;t++){var o=r[t];n.searchParams.append(o[0],o[1])}var i=document.createElement("iframe");return i.src=n.href,i.id=F,i.style.height=e.height||"500px",i.style.maxHeight="90vh",i.style.width=e.width||"400px",i.style.maxWidth="90vw",i.style.display="block",i.style.background=e.background||"#fff",i.style.position="fixed",i.style.top="5vh",i.style.right="calc(50vw)",i.style.transform="translateX(50%)",i.style.boxShadow="0 4px 8px -4px black",i.frameBorder="0",document.body.append(i),function(){document.getElementById(F)&&document.getElementById(F).remove()}}}(e.local[0]));var t=null;return function(e,n){try{var t=e()}catch(e){return n()}return t&&t.then?t.then(n,n):n()}(function(){return function(e,n){try{var t=e()}catch(e){return n(e)}return t&&t.then?t.then(void 0,n):t}(function(){return Promise.resolve(function e(n){return new Promise(function(t,r){try{return Promise.resolve(z(n)).then(function(n){"APPROVED"===n.status?t(n.compositeSignature):"DECLINED"===n.status?r({status:n.status,reason:n.reason}):setTimeout(function(){t(e(n.authorizationUpdates))},500)})}catch(e){return Promise.reject(e)}})}(e.authorizationUpdates)).then(function(e){t=e})},function(e){throw console.error(e),e})},function(){return n(),t})})})})}catch(e){return Promise.reject(e)}},resolve:null,roles:e.roles})}var r,o=function(){if(e.role.proposer)return Promise.resolve(G()).then(function(e){var t=e.keys.find(function(e){return e.index===n.keyId});r=t.sequenceNumber})}();return o&&o.then?o.then(t):t()})})}catch(e){return Promise.reject(e)}},J=function(){try{return Promise.resolve(new Promise(function(n){try{return Y(),Promise.resolve(re()).then(function(t){return t.loggedIn?n(t):Promise.resolve(e().get("challenge.handshake")).then(function(t){return Promise.resolve(e().get("challenge.scope")).then(function(e){var r=function(e){var n=e.handshake,t=e.scope,r=e.nonce,o=e.l6n;if(!document.getElementById(D)){var i=new URL(n);i.searchParams.append("l6n",o),i.searchParams.append("nonce",r),t&&i.searchParams.append("scope",t.split(" ").join("+"));var u=document.createElement("iframe");return u.src=i.href,u.id=D,u.style.height="500px",u.style.maxHeight="90vh",u.style.width="400px",u.style.maxWidth="90vw",u.style.display="block",u.style.background="#fff",u.style.position="fixed",u.style.top="5vh",u.style.right="calc(50vw)",u.style.transform="translateX(50%)",u.style.boxShadow="0 4px 8px -4px black",u.frameBorder="0",document.body.append(u),function(){document.getElementById(D)&&document.getElementById(D).remove()}}}({handshake:t,scope:e,nonce:"asdf",l6n:window.location.origin});window.addEventListener("message",function(e){var t=e.data;try{if(t.type!==V)return Promise.resolve();r();var o=new URL(t.hks);return o.searchParams.append("code",t.code),Promise.resolve(fetch(o,{method:"GET",headers:{"Content-Type":"application/json"}}).then(function(e){return e.json()})).then(function(e){return h(M,W,C({},e,{cid:H(e.provider),loggedIn:!0,verified:!0})),Promise.resolve(re()).then(function(e){n(e)})})}catch(e){return Promise.reject(e)}})})})})}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}},M="CURRENT_USER",q="CURRENT_USER/UPDATED",W="SET_CURRENT_USER",V="FCL::CHALLENGE::RESPONSE",Z='{\n "cid":null,\n "loggedIn":null,\n "verified":null,\n "identity":{\n "name":null,\n "addr":null,\n "avatar":null,\n "cover":null,\n "color":null,\n "bio":null\n },\n "scoped":{},\n "provider":{\n "addr":null,\n "pid":null,\n "name":null,\n "icon":null\n },\n "authorizations":[]\n}',$=new Set(["verified","identity","scoped","provider"]),K=function(e){return"undefined"!=typeof Proxy&&(e=new Proxy(e,{get:function(e,n){return $.has(n)&&function(e){console.warn(('\n %cFCL Deprecation Notice\n ========================\n\n Access to field "'+e+'" on "CurrentUser" is deprecated and will cease to work in future releases of FCL.\n Find out more here: https://github.com/onflow/flow-js-sdk/blob/master/packages/fcl/WARNINGS.md#0001-current-user-data\n\n =======================\n ').replace(/\n\s+/g,"\n").trim(),"font-weight:bold;font-family:monospace;")}(n),e[n]}})),e},Q=((_={})[d]=function(e){e.merge(JSON.parse(Z))},_[m]=function(e,n){e.subscribe(n.from),e.send(n.from,q,K(e.all()))},_[v]=function(e,n){e.unsubscribe(n.from)},_.SNAPSHOT=function(e,n){try{return n.reply(K(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},_[W]=function(e,n,t){try{return e.merge(t),e.broadcast(q,K(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},_.DEL_CURRENT_USER=function(e,n){try{return e.merge(JSON.parse(Z)),e.broadcast(q,K(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},_.GET_AS_PARAM=function(e,n,t){var r=t.key;try{return n.reply({key:r,value:e.get("addr",null),xform:y}),Promise.resolve()}catch(e){return Promise.reject(e)}},_),Y=function(){return p(Q,M)};function ee(){Y(),h(M,"DEL_CURRENT_USER")}function ne(e){return function(){try{return Y(),Promise.resolve(J()).then(function(){return h(M,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})})}catch(e){return Promise.reject(e)}}}function te(e){Y();var n=p(function(n){try{var t=!1;return n.send(M,m),Promise.resolve(j(function(){return!t&&1},void 0,function(){return Promise.resolve(n.receive()).then(function(r){if("@EXIT"===r.tag)return n.send(M,v),void(t=!0);e(r.data)})}))}catch(e){return Promise.reject(e)}});return function(){return h(n,"@EXIT")}}function re(){return Y(),h(M,"SNAPSHOT",null,{expectReply:!0,timeout:0})}var oe=function(){return{authenticate:J,unauthenticate:ee,authorization:X,param:ne,subscribe:te,snapshot:re}},ie=function(){return oe().authenticate()},ue=function(){return oe().unauthenticate()};export{ie as authenticate,oe as currentUser,E as decode,P as resolve,g as send,b as serialize,U as tx,ue as unauthenticate}; | ||
//# sourceMappingURL=fcl.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(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"],n):n((e=e||self).fcl={},e.config,e.sdk,e.utilActor,e.types)}(this,function(e,n,t,r,o){n.config().put("accessNode.api","http://localhost:8080").put("challenge.handshake","http://localhost:8700/authenticate");var i=function(e){try{return Promise.resolve(t.resolve(e,[t.resolveParams,t.resolveArguments,t.resolveAccounts,t.resolveSignatures,t.resolveValidators]))}catch(e){return Promise.reject(e)}},u=function(e,r){void 0===e&&(e=[]),void 0===r&&(r={});try{var o=function(n){return r.node=n,Array.isArray(e)&&(e=t.build(e)),Promise.resolve(i(e)).then(function(e){return t.send(e,r)})},u=r.node;return Promise.resolve(u?o(u):Promise.resolve(n.config().get("accessNode.api")).then(o))}catch(e){return Promise.reject(e)}},c=function(e){try{return Promise.resolve(n.config().where(/^decoder\./)).then(function(n){var r=Object.fromEntries(Object.entries(n).map(function(e){var n=e[0],t=e[1];return[n="/"+n.replace(/^decoder\./,"")+"$/",t]}));return t.decodeResponse(e,r)})}catch(e){return Promise.reject(e)}};const s=function(){function e(){}return e.prototype.then=function(n,t){const r=new e,o=this.s;if(o){const e=1&o?n:t;if(e){try{a(r,1,e(this.v))}catch(e){a(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?a(r,1,n?n(o):o):t?a(r,1,t(o)):a(r,2,o)}catch(e){a(r,2,e)}},r},e}();function a(e,n,t){if(!e.s){if(t instanceof s){if(!t.s)return void(t.o=a.bind(null,e,n));1&n&&(n=t.s),t=t.v}if(t&&t.then)return void t.then(a.bind(null,e,n),a.bind(null,e,2));e.s=n,e.v=t;const r=e.o;r&&r(e)}}function l(e){return e instanceof s&&1&e.s}function f(e,n,t){for(var r;;){var o=e();if(l(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=t();if(i&&i.then){if(!l(i)){r=1;break}i=i.s}if(n){var u=n();if(u&&u.then&&!l(u)){r=2;break}}}var c=new s,f=a.bind(null,c,2);return(0===r?o.then(m):1===r?i.then(d):u.then(h)).then(void 0,f),c;function d(r){i=r;do{if(n&&(u=n())&&u.then&&!l(u))return void u.then(h).then(void 0,f);if(!(o=e())||l(o)&&!o.v)return void a(c,1,i);if(o.then)return void o.then(m).then(void 0,f);l(i=t())&&(i=i.v)}while(!i||!i.then);i.then(d).then(void 0,f)}function m(e){e?(i=t())&&i.then?i.then(d).then(void 0,f):d(i):a(c,1,i)}function h(){(o=e())?o.then?o.then(m).then(void 0,f):m(o):a(c,1,i)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var d,m=function(e){try{return Promise.resolve(u([t.getTransactionStatus(e)])).then(c)}catch(e){return Promise.reject(e)}},h=function(e){return 4===e.status},p=function(e){return 3===e.status||h(e)},y=function(e){return 2===e.status||p(e)},v=function(e){return 1===e.status||y(e)},P=((d={})[r.INIT]=function(e){try{return Promise.resolve(m(e.self())).then(function(n){h(n)||setTimeout(function(){return r.send(e.self(),"POLL")},1e3),e.merge(n)})}catch(e){return Promise.reject(e)}},d[r.SUBSCRIBE]=function(e,n){e.subscribe(n.from),e.send(n.from,"TRANSACTION/UPDATED",e.all())},d[r.UNSUBSCRIBE]=function(e,n){e.unsubscribe(n.from)},d.SNAPSHOT=function(e,n){try{return n.replay(e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},d.POLL=function(e){try{return Promise.resolve(m(e.self())).then(function(n){h(n)||setTimeout(function(){return r.send(e.self(),"POLL")},1e3),e.merge(n),e.broadcast("TRANSACTION/UPDATED",e.all())})}catch(e){return Promise.reject(e)}},d),b=function(e){if("object"==typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return r.spawn(P,e)};function g(e){function n(n){var t=b(e),o=r.spawn(function(e){try{var o=!1;return e.send(t,r.SUBSCRIBE),Promise.resolve(f(function(){return!o&&1},void 0,function(){return Promise.resolve(e.receive()).then(function(i){if("@EXIT"===i.tag)return e.send(t,r.UNSUBSCRIBE),void(o=!0);n(i.data)})}))}catch(e){return Promise.reject(e)}});return function(){return r.send(o,"@EXIT")}}function t(e){return function(){return new Promise(function(t){var r=n(function(n){e(n)&&(t(n),r())})})}}return{snapshot:function(){var n=b(e);return r.send(n,"SNAPSHOT",null,{expectReply:!0,timeout:10})},subscribe:n,oncePending:t(v),onceFinalized:t(y),onceExecuted:t(p),onceSealed:t(h)}}function S(){return(S=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}g.isUnknown=function(e){return 0===e.status||v(e)},g.isPending=v,g.isFinalized=y,g.isExecuted=p,g.isSealed=h;var j,E="FCL_IFRAME_CHALLENGE",w="FCL_IFRAME_AUTHZ",O=function(e){void 0===e&&(e={});var n=e.addr,t=e.pid;return null==n||null==t?null:n+"/"+t},T={"HTTP/POST":"POST","HTTP/GET":"GET"},I=function(e,n){try{for(var t=new URL(e.endpoint),r=0,o=Object.entries(e.params||{});r<o.length;r++){var i=o[r];t.searchParams.append(i[0],i[1])}return n=n?JSON.stringify(n):void 0,Promise.resolve(fetch(t,{method:T[e.method],headers:{"Content-Type":"application/json"},body:n}).then(function(e){return e.json()}))}catch(e){return Promise.reject(e)}},R=function(){try{return D(),Promise.resolve(q()).then(function(e){var n=e.addr;if(null==n)throw new Error("No Flow Address for Current User");return Promise.resolve(u([t.getAccount(n)])).then(function(e){return e.account})})}catch(e){return Promise.reject(e)}},A=function(e){try{return D(),Promise.resolve(U()).then(function(){return Promise.resolve(q()).then(function(n){function t(){return S({},e,{addr:n.addr,keyId:n.keyId,sequenceNum:r,signature:e.signature||null,signingFunction:function(e){try{return Promise.resolve(q()).then(function(n){return Promise.resolve(R()).then(function(t){return Promise.resolve(I(n.authorizations[0],e)).then(function(e){var n=function(){};return e.local&&e.local.length>0&&(n=function(e){if(!document.getElementById(w)){for(var n=new URL(e.endpoint),t=0,r=Object.entries(e.params||{});t<r.length;t++){var o=r[t];n.searchParams.append(o[0],o[1])}var i=document.createElement("iframe");return i.src=n.href,i.id=w,i.style.height=e.height||"500px",i.style.maxHeight="90vh",i.style.width=e.width||"400px",i.style.maxWidth="90vw",i.style.display="block",i.style.background=e.background||"#fff",i.style.position="fixed",i.style.top="5vh",i.style.right="calc(50vw)",i.style.transform="translateX(50%)",i.style.boxShadow="0 4px 8px -4px black",i.frameBorder="0",document.body.append(i),function(){document.getElementById(w)&&document.getElementById(w).remove()}}}(e.local[0])),Promise.resolve(function e(n){return new Promise(function(t,r){try{return Promise.resolve(I(n)).then(function(n){"APPROVED"===n.status?t(n.compositeSignature):"DECLINED"===n.status?r({status:n.status,reason:n.reason}):setTimeout(function(){t(e(n.authorizationUpdates))},500)})}catch(e){return Promise.reject(e)}})}(e.authorizationUpdates)).then(function(e){return n(),e})})})})}catch(e){return Promise.reject(e)}},resolve:null,roles:e.roles})}var r,o=function(){if(e.role.proposer)return Promise.resolve(R()).then(function(e){var t=e.keys.find(function(e){return e.index===n.keyId});r=t.sequenceNumber})}();return o&&o.then?o.then(t):t()})})}catch(e){return Promise.reject(e)}},U=function(){try{return Promise.resolve(new Promise(function(e){try{return D(),Promise.resolve(q()).then(function(t){return t.loggedIn?e(t):Promise.resolve(n.config().get("challenge.handshake")).then(function(t){return Promise.resolve(n.config().get("challenge.scope")).then(function(n){var o=function(e){var n=e.handshake,t=e.scope,r=e.nonce,o=e.l6n;if(!document.getElementById(E)){var i=new URL(n);i.searchParams.append("l6n",o),i.searchParams.append("nonce",r),t&&i.searchParams.append("scope",t.split(" ").join("+"));var u=document.createElement("iframe");return u.src=i.href,u.id=E,u.style.height="500px",u.style.maxHeight="90vh",u.style.width="400px",u.style.maxWidth="90vw",u.style.display="block",u.style.background="#fff",u.style.position="fixed",u.style.top="5vh",u.style.right="calc(50vw)",u.style.transform="translateX(50%)",u.style.boxShadow="0 4px 8px -4px black",u.frameBorder="0",document.body.append(u),function(){document.getElementById(E)&&document.getElementById(E).remove()}}}({handshake:t,scope:n,nonce:"asdf",l6n:window.location.origin});window.addEventListener("message",function(n){var t=n.data;try{if(t.type!==B)return Promise.resolve();o();var i=new URL(t.hks);return i.searchParams.append("code",t.code),Promise.resolve(fetch(i,{method:"GET",headers:{"Content-Type":"application/json"}}).then(function(e){return e.json()})).then(function(n){return r.send(N,x,S({},n,{cid:O(n.provider),loggedIn:!0,verified:!0})),Promise.resolve(q()).then(function(n){e(n)})})}catch(e){return Promise.reject(e)}})})})})}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}},N="CURRENT_USER",k="CURRENT_USER/UPDATED",x="SET_CURRENT_USER",B="FCL::CHALLENGE::RESPONSE",C='{\n "cid":null,\n "loggedIn":null,\n "verified":null,\n "identity":{\n "name":null,\n "addr":null,\n "avatar":null,\n "cover":null,\n "color":null,\n "bio":null\n },\n "scoped":{},\n "provider":{\n "addr":null,\n "pid":null,\n "name":null,\n "icon":null\n },\n "authorizations":[]\n}',L=new Set(["verified","identity","scoped","provider"]),_=function(e){return"undefined"!=typeof Proxy&&(e=new Proxy(e,{get:function(e,n){return L.has(n)&&function(e){console.warn(('\n %cFCL Deprecation Notice\n ========================\n\n Access to field "'+e+'" on "CurrentUser" is deprecated and will cease to work in future releases of FCL.\n Find out more here: https://github.com/onflow/flow-js-sdk/blob/master/packages/fcl/WARNINGS.md#0001-current-user-data\n\n =======================\n ').replace(/\n\s+/g,"\n").trim(),"font-weight:bold;font-family:monospace;")}(n),e[n]}})),e},z=((j={})[r.INIT]=function(e){e.merge(JSON.parse(C))},j[r.SUBSCRIBE]=function(e,n){e.subscribe(n.from),e.send(n.from,k,_(e.all()))},j[r.UNSUBSCRIBE]=function(e,n){e.unsubscribe(n.from)},j.SNAPSHOT=function(e,n){try{return n.reply(_(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},j[x]=function(e,n,t){try{return e.merge(t),e.broadcast(k,_(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},j.DEL_CURRENT_USER=function(e,n){try{return e.merge(JSON.parse(C)),e.broadcast(k,_(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},j.GET_AS_PARAM=function(e,n,t){var r=t.key;try{return n.reply({key:r,value:e.get("addr",null),xform:o.Identity}),Promise.resolve()}catch(e){return Promise.reject(e)}},j),D=function(){return r.spawn(z,N)};function F(){D(),r.send(N,"DEL_CURRENT_USER")}function H(e){return function(){try{return D(),Promise.resolve(U()).then(function(){return r.send(N,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})})}catch(e){return Promise.reject(e)}}}function G(e){D();var n=r.spawn(function(n){try{var t=!1;return n.send(N,r.SUBSCRIBE),Promise.resolve(f(function(){return!t&&1},void 0,function(){return Promise.resolve(n.receive()).then(function(o){if("@EXIT"===o.tag)return n.send(N,r.UNSUBSCRIBE),void(t=!0);e(o.data)})}))}catch(e){return Promise.reject(e)}});return function(){return r.send(n,"@EXIT")}}function q(){return D(),r.send(N,"SNAPSHOT",null,{expectReply:!0,timeout:0})}var X=function(){return{authenticate:U,unauthenticate:F,authorization:A,param:H,subscribe:G,snapshot:q}};Object.defineProperty(e,"config",{enumerable:!0,get:function(){return n.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,"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.authenticate=function(){return X().authenticate()},e.currentUser=X,e.decode=c,e.resolve=i,e.send=u,e.serialize=function(e){void 0===e&&(e=[]);try{var n=function(){return Promise.resolve(i(e)).then(JSON.stringify)},r=function(){if(Array.isArray(e))return Promise.resolve(t.build(e)).then(function(n){e=n})}();return Promise.resolve(r&&r.then?r.then(n):n())}catch(e){return Promise.reject(e)}},e.tx=g,e.unauthenticate=function(){return X().unauthenticate()}}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(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"],n):n((e=e||self).fcl={},e.config,e.sdk,e.utilActor,e.types)}(this,function(e,n,t,r,o){n.config().put("accessNode.api","http://localhost:8080").put("challenge.handshake","http://localhost:8700/authenticate");var i=function(e){try{return Promise.resolve(t.resolve(e,[t.resolveParams,t.resolveArguments,t.resolveAccounts,t.resolveSignatures,t.resolveValidators]))}catch(e){return Promise.reject(e)}},u=function(e,r){void 0===e&&(e=[]),void 0===r&&(r={});try{var o=function(n){return r.node=n,Array.isArray(e)&&(e=t.build(e)),Promise.resolve(i(e)).then(function(e){return t.send(e,r)})},u=r.node;return Promise.resolve(u?o(u):Promise.resolve(n.config().get("accessNode.api")).then(o))}catch(e){return Promise.reject(e)}},c=function(e){try{return Promise.resolve(n.config().where(/^decoder\./)).then(function(n){var r=Object.fromEntries(Object.entries(n).map(function(e){var n=e[0],t=e[1];return[n="/"+n.replace(/^decoder\./,"")+"$/",t]}));return t.decodeResponse(e,r)})}catch(e){return Promise.reject(e)}};const s=function(){function e(){}return e.prototype.then=function(n,t){const r=new e,o=this.s;if(o){const e=1&o?n:t;if(e){try{a(r,1,e(this.v))}catch(e){a(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?a(r,1,n?n(o):o):t?a(r,1,t(o)):a(r,2,o)}catch(e){a(r,2,e)}},r},e}();function a(e,n,t){if(!e.s){if(t instanceof s){if(!t.s)return void(t.o=a.bind(null,e,n));1&n&&(n=t.s),t=t.v}if(t&&t.then)return void t.then(a.bind(null,e,n),a.bind(null,e,2));e.s=n,e.v=t;const r=e.o;r&&r(e)}}function f(e){return e instanceof s&&1&e.s}function l(e,n,t){for(var r;;){var o=e();if(f(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=t();if(i&&i.then){if(!f(i)){r=1;break}i=i.s}if(n){var u=n();if(u&&u.then&&!f(u)){r=2;break}}}var c=new s,l=a.bind(null,c,2);return(0===r?o.then(m):1===r?i.then(d):u.then(h)).then(void 0,l),c;function d(r){i=r;do{if(n&&(u=n())&&u.then&&!f(u))return void u.then(h).then(void 0,l);if(!(o=e())||f(o)&&!o.v)return void a(c,1,i);if(o.then)return void o.then(m).then(void 0,l);f(i=t())&&(i=i.v)}while(!i||!i.then);i.then(d).then(void 0,l)}function m(e){e?(i=t())&&i.then?i.then(d).then(void 0,l):d(i):a(c,1,i)}function h(){(o=e())?o.then?o.then(m).then(void 0,l):m(o):a(c,1,i)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var d,m=function(e){try{return Promise.resolve(u([t.getTransactionStatus(e)])).then(c)}catch(e){return Promise.reject(e)}},h=function(e){return 4===e.status},p=function(e){return 3===e.status||h(e)},y=function(e){return 2===e.status||p(e)},v=function(e){return 1===e.status||y(e)},P=((d={})[r.INIT]=function(e){try{return Promise.resolve(m(e.self())).then(function(n){h(n)||setTimeout(function(){return r.send(e.self(),"POLL")},1e3),e.merge(n)})}catch(e){return Promise.reject(e)}},d[r.SUBSCRIBE]=function(e,n){e.subscribe(n.from),e.send(n.from,"TRANSACTION/UPDATED",e.all())},d[r.UNSUBSCRIBE]=function(e,n){e.unsubscribe(n.from)},d.SNAPSHOT=function(e,n){try{return n.replay(e.all()),Promise.resolve()}catch(e){return Promise.reject(e)}},d.POLL=function(e){try{return Promise.resolve(m(e.self())).then(function(n){h(n)||setTimeout(function(){return r.send(e.self(),"POLL")},1e3),e.merge(n),e.broadcast("TRANSACTION/UPDATED",e.all())})}catch(e){return Promise.reject(e)}},d),b=function(e){if("object"==typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return r.spawn(P,e)};function g(e){function n(n){var t=b(e),o=r.spawn(function(e){try{var o=!1;return e.send(t,r.SUBSCRIBE),Promise.resolve(l(function(){return!o&&1},void 0,function(){return Promise.resolve(e.receive()).then(function(i){if("@EXIT"===i.tag)return e.send(t,r.UNSUBSCRIBE),void(o=!0);n(i.data)})}))}catch(e){return Promise.reject(e)}});return function(){return r.send(o,"@EXIT")}}function t(e){return function(){return new Promise(function(t){var r=n(function(n){e(n)&&(t(n),r())})})}}return{snapshot:function(){var n=b(e);return r.send(n,"SNAPSHOT",null,{expectReply:!0,timeout:10})},subscribe:n,oncePending:t(v),onceFinalized:t(y),onceExecuted:t(p),onceSealed:t(h)}}function S(){return(S=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}g.isUnknown=function(e){return 0===e.status||v(e)},g.isPending=v,g.isFinalized=y,g.isExecuted=p,g.isSealed=h;var j,E="FCL_IFRAME_CHALLENGE",w="FCL_IFRAME_AUTHZ",O=function(e){void 0===e&&(e={});var n=e.addr,t=e.pid;return null==n||null==t?null:n+"/"+t},T={"HTTP/POST":"POST","HTTP/GET":"GET"},I=function(e,n){try{for(var t=new URL(e.endpoint),r=0,o=Object.entries(e.params||{});r<o.length;r++){var i=o[r];t.searchParams.append(i[0],i[1])}return n=n?JSON.stringify(n):void 0,Promise.resolve(fetch(t,{method:T[e.method],headers:{"Content-Type":"application/json"},body:n}).then(function(e){return e.json()}))}catch(e){return Promise.reject(e)}},R=function(){try{return D(),Promise.resolve(q()).then(function(e){var n=e.addr;if(null==n)throw new Error("No Flow Address for Current User");return Promise.resolve(u([t.getAccount(n)])).then(function(e){return e.account})})}catch(e){return Promise.reject(e)}},A=function(e){try{return D(),Promise.resolve(U()).then(function(){return Promise.resolve(q()).then(function(n){function t(){return S({},e,{addr:n.addr,keyId:n.keyId,sequenceNum:r,signature:e.signature||null,signingFunction:function(e){try{return Promise.resolve(q()).then(function(n){return Promise.resolve(R()).then(function(t){return Promise.resolve(I(n.authorizations[0],e)).then(function(e){var n=function(){};e.local&&e.local.length>0&&(n=function(e){if(!document.getElementById(w)){for(var n=new URL(e.endpoint),t=0,r=Object.entries(e.params||{});t<r.length;t++){var o=r[t];n.searchParams.append(o[0],o[1])}var i=document.createElement("iframe");return i.src=n.href,i.id=w,i.style.height=e.height||"500px",i.style.maxHeight="90vh",i.style.width=e.width||"400px",i.style.maxWidth="90vw",i.style.display="block",i.style.background=e.background||"#fff",i.style.position="fixed",i.style.top="5vh",i.style.right="calc(50vw)",i.style.transform="translateX(50%)",i.style.boxShadow="0 4px 8px -4px black",i.frameBorder="0",document.body.append(i),function(){document.getElementById(w)&&document.getElementById(w).remove()}}}(e.local[0]));var t=null;return function(e,n){try{var t=e()}catch(e){return n()}return t&&t.then?t.then(n,n):n()}(function(){return function(e,n){try{var t=e()}catch(e){return n(e)}return t&&t.then?t.then(void 0,n):t}(function(){return Promise.resolve(function e(n){return new Promise(function(t,r){try{return Promise.resolve(I(n)).then(function(n){"APPROVED"===n.status?t(n.compositeSignature):"DECLINED"===n.status?r({status:n.status,reason:n.reason}):setTimeout(function(){t(e(n.authorizationUpdates))},500)})}catch(e){return Promise.reject(e)}})}(e.authorizationUpdates)).then(function(e){t=e})},function(e){throw console.error(e),e})},function(){return n(),t})})})})}catch(e){return Promise.reject(e)}},resolve:null,roles:e.roles})}var r,o=function(){if(e.role.proposer)return Promise.resolve(R()).then(function(e){var t=e.keys.find(function(e){return e.index===n.keyId});r=t.sequenceNumber})}();return o&&o.then?o.then(t):t()})})}catch(e){return Promise.reject(e)}},U=function(){try{return Promise.resolve(new Promise(function(e){try{return D(),Promise.resolve(q()).then(function(t){return t.loggedIn?e(t):Promise.resolve(n.config().get("challenge.handshake")).then(function(t){return Promise.resolve(n.config().get("challenge.scope")).then(function(n){var o=function(e){var n=e.handshake,t=e.scope,r=e.nonce,o=e.l6n;if(!document.getElementById(E)){var i=new URL(n);i.searchParams.append("l6n",o),i.searchParams.append("nonce",r),t&&i.searchParams.append("scope",t.split(" ").join("+"));var u=document.createElement("iframe");return u.src=i.href,u.id=E,u.style.height="500px",u.style.maxHeight="90vh",u.style.width="400px",u.style.maxWidth="90vw",u.style.display="block",u.style.background="#fff",u.style.position="fixed",u.style.top="5vh",u.style.right="calc(50vw)",u.style.transform="translateX(50%)",u.style.boxShadow="0 4px 8px -4px black",u.frameBorder="0",document.body.append(u),function(){document.getElementById(E)&&document.getElementById(E).remove()}}}({handshake:t,scope:n,nonce:"asdf",l6n:window.location.origin});window.addEventListener("message",function(n){var t=n.data;try{if(t.type!==B)return Promise.resolve();o();var i=new URL(t.hks);return i.searchParams.append("code",t.code),Promise.resolve(fetch(i,{method:"GET",headers:{"Content-Type":"application/json"}}).then(function(e){return e.json()})).then(function(n){return r.send(N,x,S({},n,{cid:O(n.provider),loggedIn:!0,verified:!0})),Promise.resolve(q()).then(function(n){e(n)})})}catch(e){return Promise.reject(e)}})})})})}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}},N="CURRENT_USER",k="CURRENT_USER/UPDATED",x="SET_CURRENT_USER",B="FCL::CHALLENGE::RESPONSE",C='{\n "cid":null,\n "loggedIn":null,\n "verified":null,\n "identity":{\n "name":null,\n "addr":null,\n "avatar":null,\n "cover":null,\n "color":null,\n "bio":null\n },\n "scoped":{},\n "provider":{\n "addr":null,\n "pid":null,\n "name":null,\n "icon":null\n },\n "authorizations":[]\n}',L=new Set(["verified","identity","scoped","provider"]),_=function(e){return"undefined"!=typeof Proxy&&(e=new Proxy(e,{get:function(e,n){return L.has(n)&&function(e){console.warn(('\n %cFCL Deprecation Notice\n ========================\n\n Access to field "'+e+'" on "CurrentUser" is deprecated and will cease to work in future releases of FCL.\n Find out more here: https://github.com/onflow/flow-js-sdk/blob/master/packages/fcl/WARNINGS.md#0001-current-user-data\n\n =======================\n ').replace(/\n\s+/g,"\n").trim(),"font-weight:bold;font-family:monospace;")}(n),e[n]}})),e},z=((j={})[r.INIT]=function(e){e.merge(JSON.parse(C))},j[r.SUBSCRIBE]=function(e,n){e.subscribe(n.from),e.send(n.from,k,_(e.all()))},j[r.UNSUBSCRIBE]=function(e,n){e.unsubscribe(n.from)},j.SNAPSHOT=function(e,n){try{return n.reply(_(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},j[x]=function(e,n,t){try{return e.merge(t),e.broadcast(k,_(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},j.DEL_CURRENT_USER=function(e,n){try{return e.merge(JSON.parse(C)),e.broadcast(k,_(e.all())),Promise.resolve()}catch(e){return Promise.reject(e)}},j.GET_AS_PARAM=function(e,n,t){var r=t.key;try{return n.reply({key:r,value:e.get("addr",null),xform:o.Identity}),Promise.resolve()}catch(e){return Promise.reject(e)}},j),D=function(){return r.spawn(z,N)};function F(){D(),r.send(N,"DEL_CURRENT_USER")}function H(e){return function(){try{return D(),Promise.resolve(U()).then(function(){return r.send(N,"GET_AS_PARAM",{key:e},{expectReply:!0,timeout:10})})}catch(e){return Promise.reject(e)}}}function G(e){D();var n=r.spawn(function(n){try{var t=!1;return n.send(N,r.SUBSCRIBE),Promise.resolve(l(function(){return!t&&1},void 0,function(){return Promise.resolve(n.receive()).then(function(o){if("@EXIT"===o.tag)return n.send(N,r.UNSUBSCRIBE),void(t=!0);e(o.data)})}))}catch(e){return Promise.reject(e)}});return function(){return r.send(n,"@EXIT")}}function q(){return D(),r.send(N,"SNAPSHOT",null,{expectReply:!0,timeout:0})}var X=function(){return{authenticate:U,unauthenticate:F,authorization:A,param:H,subscribe:G,snapshot:q}};Object.defineProperty(e,"config",{enumerable:!0,get:function(){return n.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,"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.authenticate=function(){return X().authenticate()},e.currentUser=X,e.decode=c,e.resolve=i,e.send=u,e.serialize=function(e){void 0===e&&(e=[]);try{var n=function(){return Promise.resolve(i(e)).then(JSON.stringify)},r=function(){if(Array.isArray(e))return Promise.resolve(t.build(e)).then(function(n){e=n})}();return Promise.resolve(r&&r.then?r.then(n):n())}catch(e){return Promise.reject(e)}},e.tx=g,e.unauthenticate=function(){return X().unauthenticate()}}); | ||
//# sourceMappingURL=fcl.umd.js.map |
{ | ||
"name": "@onflow/fcl", | ||
"version": "0.0.45", | ||
"version": "0.0.46", | ||
"description": "Flow Client Library", | ||
@@ -37,3 +37,3 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@onflow/sdk": "0.0.28", | ||
"@onflow/sdk": "0.0.30", | ||
"@onflow/types": "0.0.2", | ||
@@ -40,0 +40,0 @@ "@onflow/util-actor": "0.0.1", |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
279897
208
+ Added@onflow/protobuf@0.1.6(transitive)
+ Added@onflow/sdk@0.0.30(transitive)
+ Added@onflow/send@0.0.17(transitive)
- Removed@onflow/protobuf@0.1.5(transitive)
- Removed@onflow/sdk@0.0.28(transitive)
- Removed@onflow/send@0.0.15(transitive)
Updated@onflow/sdk@0.0.30