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

@onflow/fcl

Package Overview
Dependencies
Maintainers
5
Versions
312
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@onflow/fcl - npm Package Compare versions

Comparing version 0.0.24 to 0.0.26

src/send/index.js

2

dist/fcl.js

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

var e,n=(e=require("queue-microtask"))&&"object"==typeof e&&"default"in e?e.default:e,r=require("@onflow/sdk"),t=require("@onflow/resolver-encode"),o=require("@onflow/send");const u=function(){function e(){}return e.prototype.then=function(n,r){const t=new e,o=this.s;if(o){const e=1&o?n:r;if(e){try{i(t,1,e(this.v))}catch(e){i(t,2,e)}return t}return this}return this.o=function(e){try{const o=e.v;1&e.s?i(t,1,n?n(o):o):r?i(t,1,r(o)):i(t,2,o)}catch(e){i(t,2,e)}},t},e}();function i(e,n,r){if(!e.s){if(r instanceof u){if(!r.s)return void(r.o=i.bind(null,e,n));1&n&&(n=r.s),r=r.v}if(r&&r.then)return void r.then(i.bind(null,e,n),i.bind(null,e,2));e.s=n,e.v=r;const t=e.o;t&&t(e)}}function s(e){return e instanceof u&&1&e.s}function c(e,n,r){for(var t;;){var o=e();if(s(o)&&(o=o.v),!o)return c;if(o.then){t=0;break}var c=r();if(c&&c.then){if(!s(c)){t=1;break}c=c.s}if(n){var f=n();if(f&&f.then&&!s(f)){t=2;break}}}var a=new u,l=i.bind(null,a,2);return(0===t?o.then(d):1===t?c.then(v):f.then(h)).then(void 0,l),a;function v(t){c=t;do{if(n&&(f=n())&&f.then&&!s(f))return void f.then(h).then(void 0,l);if(!(o=e())||s(o)&&!o.v)return void i(a,1,c);if(o.then)return void o.then(d).then(void 0,l);s(c=r())&&(c=c.v)}while(!c||!c.then);c.then(v).then(void 0,l)}function d(e){e?(c=r())&&c.then?c.then(v).then(void 0,l):v(c):i(a,1,c)}function h(){(o=e())?o.then?o.then(d).then(void 0,l):d(o):i(a,1,c)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var f={},a=0,l=function(e,n,r,t){return void 0===t&&(t={}),new Promise(function(o,u){var i=t.expectReply||!1,s=null!=t.timeout?t.timeout:5e3;i&&s&&setTimeout(function(){return u(new Error("Timeout: "+s+"ms passed without a response."))},s);var c={to:e,from:t.from,tag:n,data:r,timeout:s,reply:o,reject:u};try{f[e].mailbox.deliver(c),i||o(!0)}catch(e){console.error("FCL.Actor -- Could Not Deliver Message",c,e)}})},v=function(e,r){if(void 0===r&&(r=null),null==r&&(r=++a),null!=f[r])return r;var t,o;f[r]={addr:r,mailbox:(o=[],{deliver:function(e){try{return o.push(e),t&&(t(o.shift()),t=void 0),Promise.resolve()}catch(e){return Promise.reject(e)}},receive:function(){return new Promise(function(e){var n=o.shift();if(n)return e(n);t=e})}}),subs:new Set,kvs:{}};var u={self:function(){return r},receive:function(){return f[r].mailbox.receive()},send:function(e,n,t,o){return void 0===o&&(o={}),o.from=r,l(e,n,t,o)},broadcast:function(e,n,t){void 0===t&&(t={}),t.from=r;for(var o=0,u=f[r].subs;o<u.length;o+=1)l(u[o],e,n,t)},subscribe:function(e){return null!=e&&f[r].subs.add(e)},unsubscribe:function(e){return null!=e&&f[r].subs.delete(e)},put:function(e,n){null!=e&&(f[r].kvs[e]=n)},get:function(e,n){var t=f[r].kvs[e];return null==t?n:t},delete:function(e){delete f[r].kvs[e]},update:function(e,n){null!=e&&(f[r].kvs[e]=n(f[r].kvs[e]))},keys:function(){return Object.keys(f[r].kvs)}};return n(function(){try{return Promise.resolve(e(u)).then(function(){!function(e){delete f[e]}(r)})}catch(e){return Promise.reject(e)}}),r},d="config",h="PUT_CONFIG",y="GET_CONFIG",m="CONFIG/UPDATED";v(function(e){try{var n=function(n){return n.reduce(function(n,r){var t;return Object.assign({},n,((t={})[r]=e.get(r),t))},{})},r=c(function(){return 1},void 0,function(){return Promise.resolve(e.receive()).then(function(r){var t=r.data;try{switch(r.tag){case h:return void(null!=t.key&&(e.put(t.key,t.value),e.broadcast(m,n(e.keys()))));case y:return void(null!=t.key&&r.reply(e.get(t.key,t.fallback)));case"UPDATE_CONFIG":return void(null!=t.key&&(e.update(t.key,t.fn),e.broadcast(m,n(e.keys()))));case"DELETE_CONFIG":return void(null!=t.key&&(e.delete(t.key),e.broadcast(m,n(e.keys()))));case"WHERE_CONFIG":return void(null!=t.pattern&&r.reply(n(e.keys().filter(function(e){return t.pattern.test(e)}))));case"SUBSCRIBE":return e.subscribe(r.from),void e.send(r.from,m,n(e.keys()));case"UNSUBSCRIBE":return void e.unsubscribe(r.from);default:return}}catch(e){return void console.error("Config Error",r,e)}})});return Promise.resolve(r&&r.then?r.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},d);var b=function(e){return e},p=function(){return{put:function(e,n){l(d,h,{key:e,value:n})},get:function(e,n){return l(d,y,{key:e,fallback:n},{expectReply:!0,timeout:10})},update:function(e,n){void 0===n&&(n=b),l(d,"UPDATE_CONFIG",{key:e,fn:n})},delete:function(e){l(d,"DELETE_CONFIG",{key:e})},where:function(e){return l(d,"WHERE_CONFIG",{pattern:e},{expectReply:!0,timeout:10})},subscribe:function(e){var n=v(function(n){try{var r=!1;return n.send(d,"SUBSCRIBE"),Promise.resolve(c(function(){return!r&&1},void 0,function(){return Promise.resolve(n.receive()).then(function(t){if("@EXIT"===t.tag)return n.send(d,"UNSUBSCRIBE"),void(r=!0);e(t.data)})}))}catch(e){return Promise.reject(e)}});return function(){return l(n,"@EXIT")}}}};p().put("accessNode.api","http://localhost:8080"),exports.authenticate=function(){return Promise.resolve()},exports.unauthenticate=function(){return Promise.resolve()},exports.currentUser=function(){return{subscribe:function(e){return function(){}},authorization:function(){return Promise.resolve()},payerAuthorization:function(){return Promise.resolve()},param:function(){return Promise.resolve()}}},exports.user=function(e){return{subscribe:function(e){return function(){}},authorization:function(){return Promise.resolve()},payerAuthorization:function(){return Promise.resolve()},param:function(){return Promise.resolve()}}},exports.transaction=function(e){return{subscribe:function(e){return function(){}}}},exports.event=function(e,n){return{subscribe:function(e){return function(){}}}},exports.decode=function(e){return Promise.resolve()},exports.send=function(e,n){return void 0===e&&(e=[]),void 0===n&&(n={}),n.node=n.node||NODE,Array.isArray(e)&&(e=r.build(e)),r.pipe(e,[r.resolve([r.resolveParams,t.encode,r.resolveSignatures]),function(e){return o.send(e,n)}])},exports.config=p;
var e,r=(e=require("queue-microtask"))&&"object"==typeof e&&"default"in e?e.default:e,n=require("@onflow/sdk"),t=require("@onflow/send");const o=function(){function e(){}return e.prototype.then=function(r,n){const t=new e,o=this.s;if(o){const e=1&o?r:n;if(e){try{i(t,1,e(this.v))}catch(e){i(t,2,e)}return t}return this}return this.o=function(e){try{const o=e.v;1&e.s?i(t,1,r?r(o):o):n?i(t,1,n(o)):i(t,2,o)}catch(e){i(t,2,e)}},t},e}();function i(e,r,n){if(!e.s){if(n instanceof o){if(!n.s)return void(n.o=i.bind(null,e,r));1&r&&(r=n.s),n=n.v}if(n&&n.then)return void n.then(i.bind(null,e,r),i.bind(null,e,2));e.s=r,e.v=n;const t=e.o;t&&t(e)}}function u(e){return e instanceof o&&1&e.s}function c(e,r,n){for(var t;;){var c=e();if(u(c)&&(c=c.v),!c)return s;if(c.then){t=0;break}var s=n();if(s&&s.then){if(!u(s)){t=1;break}s=s.s}if(r){var a=r();if(a&&a.then&&!u(a)){t=2;break}}}var f=new o,l=i.bind(null,f,2);return(0===t?c.then(d):1===t?s.then(v):a.then(h)).then(void 0,l),f;function v(t){s=t;do{if(r&&(a=r())&&a.then&&!u(a))return void a.then(h).then(void 0,l);if(!(c=e())||u(c)&&!c.v)return void i(f,1,s);if(c.then)return void c.then(d).then(void 0,l);u(s=n())&&(s=s.v)}while(!s||!s.then);s.then(v).then(void 0,l)}function d(e){e?(s=n())&&s.then?s.then(v).then(void 0,l):v(s):i(f,1,s)}function h(){(c=e())?c.then?c.then(d).then(void 0,l):d(c):i(f,1,s)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var s={},a=0,f=function(e,r,n,t){return void 0===t&&(t={}),new Promise(function(o,i){var u=t.expectReply||!1,c=null!=t.timeout?t.timeout:5e3;u&&c&&setTimeout(function(){return i(new Error("Timeout: "+c+"ms passed without a response."))},c);var a={to:e,from:t.from,tag:r,data:n,timeout:c,reply:o,reject:i};try{s[e].mailbox.deliver(a),u||o(!0)}catch(e){console.error("FCL.Actor -- Could Not Deliver Message",a,e)}})},l=function(e,n){if(void 0===n&&(n=null),null==n&&(n=++a),null!=s[n])return n;var t,o;s[n]={addr:n,mailbox:(o=[],{deliver:function(e){try{return o.push(e),t&&(t(o.shift()),t=void 0),Promise.resolve()}catch(e){return Promise.reject(e)}},receive:function(){return new Promise(function(e){var r=o.shift();if(r)return e(r);t=e})}}),subs:new Set,kvs:{}};var i={self:function(){return n},receive:function(){return s[n].mailbox.receive()},send:function(e,r,t,o){return void 0===o&&(o={}),o.from=n,f(e,r,t,o)},broadcast:function(e,r,t){void 0===t&&(t={}),t.from=n;for(var o=0,i=s[n].subs;o<i.length;o+=1)f(i[o],e,r,t)},subscribe:function(e){return null!=e&&s[n].subs.add(e)},unsubscribe:function(e){return null!=e&&s[n].subs.delete(e)},put:function(e,r){null!=e&&(s[n].kvs[e]=r)},get:function(e,r){var t=s[n].kvs[e];return null==t?r:t},delete:function(e){delete s[n].kvs[e]},update:function(e,r){null!=e&&(s[n].kvs[e]=r(s[n].kvs[e]))},keys:function(){return Object.keys(s[n].kvs)}};return r(function(){try{return Promise.resolve(e(i)).then(function(){!function(e){delete s[e]}(n)})}catch(e){return Promise.reject(e)}}),n},v="config",d="PUT_CONFIG",h="GET_CONFIG",m="CONFIG/UPDATED";l(function(e){try{var r=function(r){return r.reduce(function(r,n){var t;return Object.assign({},r,((t={})[n]=e.get(n),t))},{})},n=c(function(){return 1},void 0,function(){return Promise.resolve(e.receive()).then(function(n){var t=n.data;try{switch(n.tag){case d:return void(null!=t.key&&(e.put(t.key,t.value),e.broadcast(m,r(e.keys()))));case h:return void(null!=t.key&&n.reply(e.get(t.key,t.fallback)));case"UPDATE_CONFIG":return void(null!=t.key&&(e.update(t.key,t.fn),e.broadcast(m,r(e.keys()))));case"DELETE_CONFIG":return void(null!=t.key&&(e.delete(t.key),e.broadcast(m,r(e.keys()))));case"WHERE_CONFIG":return void(null!=t.pattern&&n.reply(r(e.keys().filter(function(e){return t.pattern.test(e)}))));case"SUBSCRIBE":return e.subscribe(n.from),void e.send(n.from,m,r(e.keys()));case"UNSUBSCRIBE":return void e.unsubscribe(n.from);default:return}}catch(e){return void console.error("Config Error",n,e)}})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},v);var y=function(e){return e},b=function(){return{put:function(e,r){f(v,d,{key:e,value:r})},get:function(e,r){return f(v,h,{key:e,fallback:r},{expectReply:!0,timeout:10})},update:function(e,r){void 0===r&&(r=y),f(v,"UPDATE_CONFIG",{key:e,fn:r})},delete:function(e){f(v,"DELETE_CONFIG",{key:e})},where:function(e){return f(v,"WHERE_CONFIG",{pattern:e},{expectReply:!0,timeout:10})},subscribe:function(e){var r=l(function(r){try{var n=!1;return r.send(v,"SUBSCRIBE"),Promise.resolve(c(function(){return!n&&1},void 0,function(){return Promise.resolve(r.receive()).then(function(t){if("@EXIT"===t.tag)return r.send(v,"UNSUBSCRIBE"),void(n=!0);e(t.data)})}))}catch(e){return Promise.reject(e)}});return function(){return f(r,"@EXIT")}}}};b().put("accessNode.api","http://localhost:8080");var P=function(e){return"https://avatars.onflow.org/avatar/"+e+".svg"},p=function(e,r){return r.reduce(function(r,n){var t;return Object.assign({},r,((t={})[n]=e.get(n),t))},{})},k={SUBSCRIBE:function(e,r){e.subscribe(r.from),e.send(r.from,"USER/UPDATED",p(e,e.keys()))},UNSUBSCRIBE:function(e,r){e.unsubscribe(r.from)},SNAPSHOT:function(e,r){try{return r.reply(p(e,e.keys())),Promise.resolve()}catch(e){return Promise.reject(e)}}},E=function(e){try{return Promise.resolve(function(e){try{return Promise.resolve((void 0===r&&(r=10),new Promise(function(e){return setTimeout(e,r)}))).then(function(){return{acct:e,name:"bob the builder",avatar:P(),bio:"Can he fix it, yes he can.",hooks:{}}})}catch(e){return Promise.reject(e)}var r}(e.self())).then(function(r){!function(e,r){for(var n=0,t=Object.keys(r);n<t.length;n+=1){var o=t[n];e.put(o,r[o])}}(e,r);var n=c(function(){return 1},void 0,function(){return Promise.resolve(e.receive()).then(function(r){var n=function(n,t){try{var o=function(n,t){try{var o=Promise.resolve(k[r.tag](e,r)).then(function(){})}catch(e){return t(e)}return o&&o.then?o.then(void 0,t):o}(0,function(e){console.error("User Error",r,e)})}catch(e){return}return o&&o.then?o.then(t.bind(null,!1),t.bind(null,!0)):void 0}(0,function(e,r){});if(n&&n.then)return n.then(function(){})})});return n&&n.then?n.then(function(){}):void 0})}catch(e){return Promise.reject(e)}},S=function(e){return l(E,e)};exports.authenticate=function(){return Promise.resolve()},exports.unauthenticate=function(){return Promise.resolve()},exports.currentUser=function(){return{subscribe:function(e){return function(){}},authorization:function(){return Promise.resolve()},payerAuthorization:function(){return Promise.resolve()},param:function(){return Promise.resolve()}}},exports.transaction=function(e){return{subscribe:function(e){return function(){}}}},exports.event=function(e,r){return{subscribe:function(e){return function(){}}}},exports.decode=function(e){return Promise.resolve()},exports.config=b,exports.send=function(e,r){void 0===e&&(e=[]),void 0===r&&(r={});try{function o(o){return r.node=o,Array.isArray(e)&&(e=n.build(e)),Promise.resolve(n.pipe(e,[n.resolve([n.resolveParams,n.resolvePayload,n.resolveAuthorizations])])).then(function(e){return t.send(e,r)})}var i=r.node;return Promise.resolve(i?o(i):Promise.resolve(b().get("accessNode.api")).then(o))}catch(e){return Promise.reject(e)}},exports.user=function(e){return{authorization:function(){try{return S(e),Promise.resolve({acct:e,signFn:function(){try{throw new Error("fcl.user("+e+").payerAuthorization WIP error -- known missing functionality")}catch(e){return Promise.reject(e)}}})}catch(e){return Promise.reject(e)}},payerAuthorization:function(){try{return S(e),Promise.resolve({acct:e,signFn:function(){try{throw new Error("fcl.user("+e+").payerAuthorization WIP error -- known missing functionality")}catch(e){return Promise.reject(e)}}})}catch(e){return Promise.reject(e)}},snapshot:function(){try{return S(e),Promise.resolve(f(e,"SNAPSHOT",null,{expectReply:!0,timeout:0}))}catch(e){return Promise.reject(e)}},param:function(r){return{value:e,xform:{asParam:function(e){return e},asInjection:function(e){return e}}}},subscribe:function(r){S(e);var n=l(function(n){try{var t=!1;return n.send(e,"SUBSCRIBE"),Promise.resolve(c(function(){return!t&&1},void 0,function(){return Promise.resolve(n.receive()).then(function(o){if("@EXIT"===o.tag)return n.send(e,"UNSUBSCRIBE"),void(t=!0);r(o.data)})}))}catch(e){return Promise.reject(e)}});return function(){return f(n,"@EXIT")}}}};
//# sourceMappingURL=fcl.js.map

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

import e from"queue-microtask";import{build as n,pipe as r,resolve as t,resolveParams as o,resolveSignatures as u}from"@onflow/sdk";import{encode as i}from"@onflow/resolver-encode";import{send as c}from"@onflow/send";const s=function(){function e(){}return e.prototype.then=function(n,r){const t=new e,o=this.s;if(o){const e=1&o?n:r;if(e){try{f(t,1,e(this.v))}catch(e){f(t,2,e)}return t}return this}return this.o=function(e){try{const o=e.v;1&e.s?f(t,1,n?n(o):o):r?f(t,1,r(o)):f(t,2,o)}catch(e){f(t,2,e)}},t},e}();function f(e,n,r){if(!e.s){if(r instanceof s){if(!r.s)return void(r.o=f.bind(null,e,n));1&n&&(n=r.s),r=r.v}if(r&&r.then)return void r.then(f.bind(null,e,n),f.bind(null,e,2));e.s=n,e.v=r;const t=e.o;t&&t(e)}}function a(e){return e instanceof s&&1&e.s}function l(e,n,r){for(var t;;){var o=e();if(a(o)&&(o=o.v),!o)return u;if(o.then){t=0;break}var u=r();if(u&&u.then){if(!a(u)){t=1;break}u=u.s}if(n){var i=n();if(i&&i.then&&!a(i)){t=2;break}}}var c=new s,l=f.bind(null,c,2);return(0===t?o.then(d):1===t?u.then(v):i.then(m)).then(void 0,l),c;function v(t){u=t;do{if(n&&(i=n())&&i.then&&!a(i))return void i.then(m).then(void 0,l);if(!(o=e())||a(o)&&!o.v)return void f(c,1,u);if(o.then)return void o.then(d).then(void 0,l);a(u=r())&&(u=u.v)}while(!u||!u.then);u.then(v).then(void 0,l)}function d(e){e?(u=r())&&u.then?u.then(v).then(void 0,l):v(u):f(c,1,u)}function m(){(o=e())?o.then?o.then(d).then(void 0,l):d(o):f(c,1,u)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var v={},d=0,m=function(e,n,r,t){return void 0===t&&(t={}),new Promise(function(o,u){var i=t.expectReply||!1,c=null!=t.timeout?t.timeout:5e3;i&&c&&setTimeout(function(){return u(new Error("Timeout: "+c+"ms passed without a response."))},c);var s={to:e,from:t.from,tag:n,data:r,timeout:c,reply:o,reject:u};try{v[e].mailbox.deliver(s),i||o(!0)}catch(e){console.error("FCL.Actor -- Could Not Deliver Message",s,e)}})},h=function(n,r){if(void 0===r&&(r=null),null==r&&(r=++d),null!=v[r])return r;var t,o;v[r]={addr:r,mailbox:(o=[],{deliver:function(e){try{return o.push(e),t&&(t(o.shift()),t=void 0),Promise.resolve()}catch(e){return Promise.reject(e)}},receive:function(){return new Promise(function(e){var n=o.shift();if(n)return e(n);t=e})}}),subs:new Set,kvs:{}};var u={self:function(){return r},receive:function(){return v[r].mailbox.receive()},send:function(e,n,t,o){return void 0===o&&(o={}),o.from=r,m(e,n,t,o)},broadcast:function(e,n,t){void 0===t&&(t={}),t.from=r;for(var o=0,u=v[r].subs;o<u.length;o+=1)m(u[o],e,n,t)},subscribe:function(e){return null!=e&&v[r].subs.add(e)},unsubscribe:function(e){return null!=e&&v[r].subs.delete(e)},put:function(e,n){null!=e&&(v[r].kvs[e]=n)},get:function(e,n){var t=v[r].kvs[e];return null==t?n:t},delete:function(e){delete v[r].kvs[e]},update:function(e,n){null!=e&&(v[r].kvs[e]=n(v[r].kvs[e]))},keys:function(){return Object.keys(v[r].kvs)}};return e(function(){try{return Promise.resolve(n(u)).then(function(){!function(e){delete v[e]}(r)})}catch(e){return Promise.reject(e)}}),r},y="config",b="PUT_CONFIG",p="GET_CONFIG",k="CONFIG/UPDATED";h(function(e){try{var n=function(n){return n.reduce(function(n,r){var t;return Object.assign({},n,((t={})[r]=e.get(r),t))},{})},r=l(function(){return 1},void 0,function(){return Promise.resolve(e.receive()).then(function(r){var t=r.data;try{switch(r.tag){case b:return void(null!=t.key&&(e.put(t.key,t.value),e.broadcast(k,n(e.keys()))));case p:return void(null!=t.key&&r.reply(e.get(t.key,t.fallback)));case"UPDATE_CONFIG":return void(null!=t.key&&(e.update(t.key,t.fn),e.broadcast(k,n(e.keys()))));case"DELETE_CONFIG":return void(null!=t.key&&(e.delete(t.key),e.broadcast(k,n(e.keys()))));case"WHERE_CONFIG":return void(null!=t.pattern&&r.reply(n(e.keys().filter(function(e){return t.pattern.test(e)}))));case"SUBSCRIBE":return e.subscribe(r.from),void e.send(r.from,k,n(e.keys()));case"UNSUBSCRIBE":return void e.unsubscribe(r.from);default:return}}catch(e){return void console.error("Config Error",r,e)}})});return Promise.resolve(r&&r.then?r.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},y);var P=function(e){return e},E=function(){return{put:function(e,n){m(y,b,{key:e,value:n})},get:function(e,n){return m(y,p,{key:e,fallback:n},{expectReply:!0,timeout:10})},update:function(e,n){void 0===n&&(n=P),m(y,"UPDATE_CONFIG",{key:e,fn:n})},delete:function(e){m(y,"DELETE_CONFIG",{key:e})},where:function(e){return m(y,"WHERE_CONFIG",{pattern:e},{expectReply:!0,timeout:10})},subscribe:function(e){var n=h(function(n){try{var r=!1;return n.send(y,"SUBSCRIBE"),Promise.resolve(l(function(){return!r&&1},void 0,function(){return Promise.resolve(n.receive()).then(function(t){if("@EXIT"===t.tag)return n.send(y,"UNSUBSCRIBE"),void(r=!0);e(t.data)})}))}catch(e){return Promise.reject(e)}});return function(){return m(n,"@EXIT")}}}};E().put("accessNode.api","http://localhost:8080");var S=function(){return Promise.resolve()},I=function(){return Promise.resolve()},C=function(){return{subscribe:function(e){return function(){}},authorization:function(){return Promise.resolve()},payerAuthorization:function(){return Promise.resolve()},param:function(){return Promise.resolve()}}},N=function(e){return{subscribe:function(e){return function(){}},authorization:function(){return Promise.resolve()},payerAuthorization:function(){return Promise.resolve()},param:function(){return Promise.resolve()}}},w=function(e){return{subscribe:function(e){return function(){}}}},g=function(e,n){return{subscribe:function(e){return function(){}}}},O=function(e){return Promise.resolve()},T=function(e,s){return void 0===e&&(e=[]),void 0===s&&(s={}),s.node=s.node||NODE,Array.isArray(e)&&(e=n(e)),r(e,[t([o,i,u]),function(e){return c(e,s)}])};export{S as authenticate,I as unauthenticate,C as currentUser,N as user,w as transaction,g as event,O as decode,T as send,E as config};
import e from"queue-microtask";import{build as r,pipe as n,resolve as t,resolveParams as o,resolvePayload as i,resolveAuthorizations as u}from"@onflow/sdk";import{send as c}from"@onflow/send";const s=function(){function e(){}return e.prototype.then=function(r,n){const t=new e,o=this.s;if(o){const e=1&o?r:n;if(e){try{f(t,1,e(this.v))}catch(e){f(t,2,e)}return t}return this}return this.o=function(e){try{const o=e.v;1&e.s?f(t,1,r?r(o):o):n?f(t,1,n(o)):f(t,2,o)}catch(e){f(t,2,e)}},t},e}();function f(e,r,n){if(!e.s){if(n instanceof s){if(!n.s)return void(n.o=f.bind(null,e,r));1&r&&(r=n.s),n=n.v}if(n&&n.then)return void n.then(f.bind(null,e,r),f.bind(null,e,2));e.s=r,e.v=n;const t=e.o;t&&t(e)}}function a(e){return e instanceof s&&1&e.s}function l(e,r,n){for(var t;;){var o=e();if(a(o)&&(o=o.v),!o)return i;if(o.then){t=0;break}var i=n();if(i&&i.then){if(!a(i)){t=1;break}i=i.s}if(r){var u=r();if(u&&u.then&&!a(u)){t=2;break}}}var c=new s,l=f.bind(null,c,2);return(0===t?o.then(h):1===t?i.then(v):u.then(d)).then(void 0,l),c;function v(t){i=t;do{if(r&&(u=r())&&u.then&&!a(u))return void u.then(d).then(void 0,l);if(!(o=e())||a(o)&&!o.v)return void f(c,1,i);if(o.then)return void o.then(h).then(void 0,l);a(i=n())&&(i=i.v)}while(!i||!i.then);i.then(v).then(void 0,l)}function h(e){e?(i=n())&&i.then?i.then(v).then(void 0,l):v(i):f(c,1,i)}function d(){(o=e())?o.then?o.then(h).then(void 0,l):h(o):f(c,1,i)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var v={},h=0,d=function(e,r,n,t){return void 0===t&&(t={}),new Promise(function(o,i){var u=t.expectReply||!1,c=null!=t.timeout?t.timeout:5e3;u&&c&&setTimeout(function(){return i(new Error("Timeout: "+c+"ms passed without a response."))},c);var s={to:e,from:t.from,tag:r,data:n,timeout:c,reply:o,reject:i};try{v[e].mailbox.deliver(s),u||o(!0)}catch(e){console.error("FCL.Actor -- Could Not Deliver Message",s,e)}})},m=function(r,n){if(void 0===n&&(n=null),null==n&&(n=++h),null!=v[n])return n;var t,o;v[n]={addr:n,mailbox:(o=[],{deliver:function(e){try{return o.push(e),t&&(t(o.shift()),t=void 0),Promise.resolve()}catch(e){return Promise.reject(e)}},receive:function(){return new Promise(function(e){var r=o.shift();if(r)return e(r);t=e})}}),subs:new Set,kvs:{}};var i={self:function(){return n},receive:function(){return v[n].mailbox.receive()},send:function(e,r,t,o){return void 0===o&&(o={}),o.from=n,d(e,r,t,o)},broadcast:function(e,r,t){void 0===t&&(t={}),t.from=n;for(var o=0,i=v[n].subs;o<i.length;o+=1)d(i[o],e,r,t)},subscribe:function(e){return null!=e&&v[n].subs.add(e)},unsubscribe:function(e){return null!=e&&v[n].subs.delete(e)},put:function(e,r){null!=e&&(v[n].kvs[e]=r)},get:function(e,r){var t=v[n].kvs[e];return null==t?r:t},delete:function(e){delete v[n].kvs[e]},update:function(e,r){null!=e&&(v[n].kvs[e]=r(v[n].kvs[e]))},keys:function(){return Object.keys(v[n].kvs)}};return e(function(){try{return Promise.resolve(r(i)).then(function(){!function(e){delete v[e]}(n)})}catch(e){return Promise.reject(e)}}),n},y="config",b="PUT_CONFIG",P="GET_CONFIG",p="CONFIG/UPDATED";m(function(e){try{var r=function(r){return r.reduce(function(r,n){var t;return Object.assign({},r,((t={})[n]=e.get(n),t))},{})},n=l(function(){return 1},void 0,function(){return Promise.resolve(e.receive()).then(function(n){var t=n.data;try{switch(n.tag){case b:return void(null!=t.key&&(e.put(t.key,t.value),e.broadcast(p,r(e.keys()))));case P:return void(null!=t.key&&n.reply(e.get(t.key,t.fallback)));case"UPDATE_CONFIG":return void(null!=t.key&&(e.update(t.key,t.fn),e.broadcast(p,r(e.keys()))));case"DELETE_CONFIG":return void(null!=t.key&&(e.delete(t.key),e.broadcast(p,r(e.keys()))));case"WHERE_CONFIG":return void(null!=t.pattern&&n.reply(r(e.keys().filter(function(e){return t.pattern.test(e)}))));case"SUBSCRIBE":return e.subscribe(n.from),void e.send(n.from,p,r(e.keys()));case"UNSUBSCRIBE":return void e.unsubscribe(n.from);default:return}}catch(e){return void console.error("Config Error",n,e)}})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},y);var k=function(e){return e},E=function(){return{put:function(e,r){d(y,b,{key:e,value:r})},get:function(e,r){return d(y,P,{key:e,fallback:r},{expectReply:!0,timeout:10})},update:function(e,r){void 0===r&&(r=k),d(y,"UPDATE_CONFIG",{key:e,fn:r})},delete:function(e){d(y,"DELETE_CONFIG",{key:e})},where:function(e){return d(y,"WHERE_CONFIG",{pattern:e},{expectReply:!0,timeout:10})},subscribe:function(e){var r=m(function(r){try{var n=!1;return r.send(y,"SUBSCRIBE"),Promise.resolve(l(function(){return!n&&1},void 0,function(){return Promise.resolve(r.receive()).then(function(t){if("@EXIT"===t.tag)return r.send(y,"UNSUBSCRIBE"),void(n=!0);e(t.data)})}))}catch(e){return Promise.reject(e)}});return function(){return d(r,"@EXIT")}}}};E().put("accessNode.api","http://localhost:8080");var S=function(e,s){void 0===e&&(e=[]),void 0===s&&(s={});try{function f(f){return s.node=f,Array.isArray(e)&&(e=r(e)),Promise.resolve(n(e,[t([o,i,u])])).then(function(e){return c(e,s)})}var a=s.node;return Promise.resolve(a?f(a):Promise.resolve(E().get("accessNode.api")).then(f))}catch(e){return Promise.reject(e)}},I=function(e){return"https://avatars.onflow.org/avatar/"+e+".svg"},g=function(e,r){return r.reduce(function(r,n){var t;return Object.assign({},r,((t={})[n]=e.get(n),t))},{})},C={SUBSCRIBE:function(e,r){e.subscribe(r.from),e.send(r.from,"USER/UPDATED",g(e,e.keys()))},UNSUBSCRIBE:function(e,r){e.unsubscribe(r.from)},SNAPSHOT:function(e,r){try{return r.reply(g(e,e.keys())),Promise.resolve()}catch(e){return Promise.reject(e)}}},j=function(e){try{return Promise.resolve(function(e){try{return Promise.resolve((void 0===r&&(r=10),new Promise(function(e){return setTimeout(e,r)}))).then(function(){return{acct:e,name:"bob the builder",avatar:I(),bio:"Can he fix it, yes he can.",hooks:{}}})}catch(e){return Promise.reject(e)}var r}(e.self())).then(function(r){!function(e,r){for(var n=0,t=Object.keys(r);n<t.length;n+=1){var o=t[n];e.put(o,r[o])}}(e,r);var n=l(function(){return 1},void 0,function(){return Promise.resolve(e.receive()).then(function(r){var n=function(n,t){try{var o=function(n,t){try{var o=Promise.resolve(C[r.tag](e,r)).then(function(){})}catch(e){return t(e)}return o&&o.then?o.then(void 0,t):o}(0,function(e){console.error("User Error",r,e)})}catch(e){return}return o&&o.then?o.then(t.bind(null,!1),t.bind(null,!0)):void 0}(0,function(e,r){});if(n&&n.then)return n.then(function(){})})});return n&&n.then?n.then(function(){}):void 0})}catch(e){return Promise.reject(e)}},w=function(e){return m(j,e)},U=function(e){return{authorization:function(){try{return w(e),Promise.resolve({acct:e,signFn:function(){try{throw new Error("fcl.user("+e+").payerAuthorization WIP error -- known missing functionality")}catch(e){return Promise.reject(e)}}})}catch(e){return Promise.reject(e)}},payerAuthorization:function(){try{return w(e),Promise.resolve({acct:e,signFn:function(){try{throw new Error("fcl.user("+e+").payerAuthorization WIP error -- known missing functionality")}catch(e){return Promise.reject(e)}}})}catch(e){return Promise.reject(e)}},snapshot:function(){try{return w(e),Promise.resolve(d(e,"SNAPSHOT",null,{expectReply:!0,timeout:0}))}catch(e){return Promise.reject(e)}},param:function(r){return{value:e,xform:{asParam:function(e){return e},asInjection:function(e){return e}}}},subscribe:function(r){w(e);var n=m(function(n){try{var t=!1;return n.send(e,"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(e,"UNSUBSCRIBE"),void(t=!0);r(o.data)})}))}catch(e){return Promise.reject(e)}});return function(){return d(n,"@EXIT")}}}},N=function(){return Promise.resolve()},T=function(){return Promise.resolve()},B=function(){return{subscribe:function(e){return function(){}},authorization:function(){return Promise.resolve()},payerAuthorization:function(){return Promise.resolve()},param:function(){return Promise.resolve()}}},O=function(e){return{subscribe:function(e){return function(){}}}},R=function(e,r){return{subscribe:function(e){return function(){}}}},A=function(e){return Promise.resolve()};export{N as authenticate,T as unauthenticate,B as currentUser,O as transaction,R as event,A as decode,E as config,S as send,U as user};
//# sourceMappingURL=fcl.module.js.map

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("queue-microtask"),require("@onflow/sdk"),require("@onflow/resolver-encode"),require("@onflow/send")):"function"==typeof define&&define.amd?define(["exports","queue-microtask","@onflow/sdk","@onflow/resolver-encode","@onflow/send"],n):n(e.fcl={},e.queueMicrotask,e.sdk,e.resolverEncode,e.send)}(this,function(e,n,r,t,o){n=n&&n.hasOwnProperty("default")?n.default:n;const u=function(){function e(){}return e.prototype.then=function(n,r){const t=new e,o=this.s;if(o){const e=1&o?n:r;if(e){try{i(t,1,e(this.v))}catch(e){i(t,2,e)}return t}return this}return this.o=function(e){try{const o=e.v;1&e.s?i(t,1,n?n(o):o):r?i(t,1,r(o)):i(t,2,o)}catch(e){i(t,2,e)}},t},e}();function i(e,n,r){if(!e.s){if(r instanceof u){if(!r.s)return void(r.o=i.bind(null,e,n));1&n&&(n=r.s),r=r.v}if(r&&r.then)return void r.then(i.bind(null,e,n),i.bind(null,e,2));e.s=n,e.v=r;const t=e.o;t&&t(e)}}function c(e){return e instanceof u&&1&e.s}function s(e,n,r){for(var t;;){var o=e();if(c(o)&&(o=o.v),!o)return s;if(o.then){t=0;break}var s=r();if(s&&s.then){if(!c(s)){t=1;break}s=s.s}if(n){var f=n();if(f&&f.then&&!c(f)){t=2;break}}}var a=new u,l=i.bind(null,a,2);return(0===t?o.then(v):1===t?s.then(d):f.then(h)).then(void 0,l),a;function d(t){s=t;do{if(n&&(f=n())&&f.then&&!c(f))return void f.then(h).then(void 0,l);if(!(o=e())||c(o)&&!o.v)return void i(a,1,s);if(o.then)return void o.then(v).then(void 0,l);c(s=r())&&(s=s.v)}while(!s||!s.then);s.then(d).then(void 0,l)}function v(e){e?(s=r())&&s.then?s.then(d).then(void 0,l):d(s):i(a,1,s)}function h(){(o=e())?o.then?o.then(v).then(void 0,l):v(o):i(a,1,s)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var f={},a=0,l=function(e,n,r,t){return void 0===t&&(t={}),new Promise(function(o,u){var i=t.expectReply||!1,c=null!=t.timeout?t.timeout:5e3;i&&c&&setTimeout(function(){return u(new Error("Timeout: "+c+"ms passed without a response."))},c);var s={to:e,from:t.from,tag:n,data:r,timeout:c,reply:o,reject:u};try{f[e].mailbox.deliver(s),i||o(!0)}catch(e){console.error("FCL.Actor -- Could Not Deliver Message",s,e)}})},d=function(e,r){if(void 0===r&&(r=null),null==r&&(r=++a),null!=f[r])return r;var t,o;f[r]={addr:r,mailbox:(o=[],{deliver:function(e){try{return o.push(e),t&&(t(o.shift()),t=void 0),Promise.resolve()}catch(e){return Promise.reject(e)}},receive:function(){return new Promise(function(e){var n=o.shift();if(n)return e(n);t=e})}}),subs:new Set,kvs:{}};var u={self:function(){return r},receive:function(){return f[r].mailbox.receive()},send:function(e,n,t,o){return void 0===o&&(o={}),o.from=r,l(e,n,t,o)},broadcast:function(e,n,t){void 0===t&&(t={}),t.from=r;for(var o=0,u=f[r].subs;o<u.length;o+=1)l(u[o],e,n,t)},subscribe:function(e){return null!=e&&f[r].subs.add(e)},unsubscribe:function(e){return null!=e&&f[r].subs.delete(e)},put:function(e,n){null!=e&&(f[r].kvs[e]=n)},get:function(e,n){var t=f[r].kvs[e];return null==t?n:t},delete:function(e){delete f[r].kvs[e]},update:function(e,n){null!=e&&(f[r].kvs[e]=n(f[r].kvs[e]))},keys:function(){return Object.keys(f[r].kvs)}};return n(function(){try{return Promise.resolve(e(u)).then(function(){!function(e){delete f[e]}(r)})}catch(e){return Promise.reject(e)}}),r},v="config",h="PUT_CONFIG",y="GET_CONFIG",m="CONFIG/UPDATED";d(function(e){try{var n=function(n){return n.reduce(function(n,r){var t;return Object.assign({},n,((t={})[r]=e.get(r),t))},{})},r=s(function(){return 1},void 0,function(){return Promise.resolve(e.receive()).then(function(r){var t=r.data;try{switch(r.tag){case h:return void(null!=t.key&&(e.put(t.key,t.value),e.broadcast(m,n(e.keys()))));case y:return void(null!=t.key&&r.reply(e.get(t.key,t.fallback)));case"UPDATE_CONFIG":return void(null!=t.key&&(e.update(t.key,t.fn),e.broadcast(m,n(e.keys()))));case"DELETE_CONFIG":return void(null!=t.key&&(e.delete(t.key),e.broadcast(m,n(e.keys()))));case"WHERE_CONFIG":return void(null!=t.pattern&&r.reply(n(e.keys().filter(function(e){return t.pattern.test(e)}))));case"SUBSCRIBE":return e.subscribe(r.from),void e.send(r.from,m,n(e.keys()));case"UNSUBSCRIBE":return void e.unsubscribe(r.from);default:return}}catch(e){return void console.error("Config Error",r,e)}})});return Promise.resolve(r&&r.then?r.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},v);var b=function(e){return e},p=function(){return{put:function(e,n){l(v,h,{key:e,value:n})},get:function(e,n){return l(v,y,{key:e,fallback:n},{expectReply:!0,timeout:10})},update:function(e,n){void 0===n&&(n=b),l(v,"UPDATE_CONFIG",{key:e,fn:n})},delete:function(e){l(v,"DELETE_CONFIG",{key:e})},where:function(e){return l(v,"WHERE_CONFIG",{pattern:e},{expectReply:!0,timeout:10})},subscribe:function(e){var n=d(function(n){try{var r=!1;return n.send(v,"SUBSCRIBE"),Promise.resolve(s(function(){return!r&&1},void 0,function(){return Promise.resolve(n.receive()).then(function(t){if("@EXIT"===t.tag)return n.send(v,"UNSUBSCRIBE"),void(r=!0);e(t.data)})}))}catch(e){return Promise.reject(e)}});return function(){return l(n,"@EXIT")}}}};p().put("accessNode.api","http://localhost:8080"),e.authenticate=function(){return Promise.resolve()},e.unauthenticate=function(){return Promise.resolve()},e.currentUser=function(){return{subscribe:function(e){return function(){}},authorization:function(){return Promise.resolve()},payerAuthorization:function(){return Promise.resolve()},param:function(){return Promise.resolve()}}},e.user=function(e){return{subscribe:function(e){return function(){}},authorization:function(){return Promise.resolve()},payerAuthorization:function(){return Promise.resolve()},param:function(){return Promise.resolve()}}},e.transaction=function(e){return{subscribe:function(e){return function(){}}}},e.event=function(e,n){return{subscribe:function(e){return function(){}}}},e.decode=function(e){return Promise.resolve()},e.send=function(e,n){return void 0===e&&(e=[]),void 0===n&&(n={}),n.node=n.node||NODE,Array.isArray(e)&&(e=r.build(e)),r.pipe(e,[r.resolve([r.resolveParams,t.encode,r.resolveSignatures]),function(e){return o.send(e,n)}])},e.config=p});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("queue-microtask"),require("@onflow/sdk"),require("@onflow/send")):"function"==typeof define&&define.amd?define(["exports","queue-microtask","@onflow/sdk","@onflow/send"],n):n(e.fcl={},e.queueMicrotask,e.sdk,e.send)}(this,function(e,n,r,t){n=n&&n.hasOwnProperty("default")?n.default:n;const o=function(){function e(){}return e.prototype.then=function(n,r){const t=new e,o=this.s;if(o){const e=1&o?n:r;if(e){try{i(t,1,e(this.v))}catch(e){i(t,2,e)}return t}return this}return this.o=function(e){try{const o=e.v;1&e.s?i(t,1,n?n(o):o):r?i(t,1,r(o)):i(t,2,o)}catch(e){i(t,2,e)}},t},e}();function i(e,n,r){if(!e.s){if(r instanceof o){if(!r.s)return void(r.o=i.bind(null,e,n));1&n&&(n=r.s),r=r.v}if(r&&r.then)return void r.then(i.bind(null,e,n),i.bind(null,e,2));e.s=n,e.v=r;const t=e.o;t&&t(e)}}function u(e){return e instanceof o&&1&e.s}function c(e,n,r){for(var t;;){var c=e();if(u(c)&&(c=c.v),!c)return s;if(c.then){t=0;break}var s=r();if(s&&s.then){if(!u(s)){t=1;break}s=s.s}if(n){var f=n();if(f&&f.then&&!u(f)){t=2;break}}}var a=new o,l=i.bind(null,a,2);return(0===t?c.then(d):1===t?s.then(v):f.then(h)).then(void 0,l),a;function v(t){s=t;do{if(n&&(f=n())&&f.then&&!u(f))return void f.then(h).then(void 0,l);if(!(c=e())||u(c)&&!c.v)return void i(a,1,s);if(c.then)return void c.then(d).then(void 0,l);u(s=r())&&(s=s.v)}while(!s||!s.then);s.then(v).then(void 0,l)}function d(e){e?(s=r())&&s.then?s.then(v).then(void 0,l):v(s):i(a,1,s)}function h(){(c=e())?c.then?c.then(d).then(void 0,l):d(c):i(a,1,s)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var s={},f=0,a=function(e,n,r,t){return void 0===t&&(t={}),new Promise(function(o,i){var u=t.expectReply||!1,c=null!=t.timeout?t.timeout:5e3;u&&c&&setTimeout(function(){return i(new Error("Timeout: "+c+"ms passed without a response."))},c);var f={to:e,from:t.from,tag:n,data:r,timeout:c,reply:o,reject:i};try{s[e].mailbox.deliver(f),u||o(!0)}catch(e){console.error("FCL.Actor -- Could Not Deliver Message",f,e)}})},l=function(e,r){if(void 0===r&&(r=null),null==r&&(r=++f),null!=s[r])return r;var t,o;s[r]={addr:r,mailbox:(o=[],{deliver:function(e){try{return o.push(e),t&&(t(o.shift()),t=void 0),Promise.resolve()}catch(e){return Promise.reject(e)}},receive:function(){return new Promise(function(e){var n=o.shift();if(n)return e(n);t=e})}}),subs:new Set,kvs:{}};var i={self:function(){return r},receive:function(){return s[r].mailbox.receive()},send:function(e,n,t,o){return void 0===o&&(o={}),o.from=r,a(e,n,t,o)},broadcast:function(e,n,t){void 0===t&&(t={}),t.from=r;for(var o=0,i=s[r].subs;o<i.length;o+=1)a(i[o],e,n,t)},subscribe:function(e){return null!=e&&s[r].subs.add(e)},unsubscribe:function(e){return null!=e&&s[r].subs.delete(e)},put:function(e,n){null!=e&&(s[r].kvs[e]=n)},get:function(e,n){var t=s[r].kvs[e];return null==t?n:t},delete:function(e){delete s[r].kvs[e]},update:function(e,n){null!=e&&(s[r].kvs[e]=n(s[r].kvs[e]))},keys:function(){return Object.keys(s[r].kvs)}};return n(function(){try{return Promise.resolve(e(i)).then(function(){!function(e){delete s[e]}(r)})}catch(e){return Promise.reject(e)}}),r},v="config",d="PUT_CONFIG",h="GET_CONFIG",m="CONFIG/UPDATED";l(function(e){try{var n=function(n){return n.reduce(function(n,r){var t;return Object.assign({},n,((t={})[r]=e.get(r),t))},{})},r=c(function(){return 1},void 0,function(){return Promise.resolve(e.receive()).then(function(r){var t=r.data;try{switch(r.tag){case d:return void(null!=t.key&&(e.put(t.key,t.value),e.broadcast(m,n(e.keys()))));case h:return void(null!=t.key&&r.reply(e.get(t.key,t.fallback)));case"UPDATE_CONFIG":return void(null!=t.key&&(e.update(t.key,t.fn),e.broadcast(m,n(e.keys()))));case"DELETE_CONFIG":return void(null!=t.key&&(e.delete(t.key),e.broadcast(m,n(e.keys()))));case"WHERE_CONFIG":return void(null!=t.pattern&&r.reply(n(e.keys().filter(function(e){return t.pattern.test(e)}))));case"SUBSCRIBE":return e.subscribe(r.from),void e.send(r.from,m,n(e.keys()));case"UNSUBSCRIBE":return void e.unsubscribe(r.from);default:return}}catch(e){return void console.error("Config Error",r,e)}})});return Promise.resolve(r&&r.then?r.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},v);var y=function(e){return e},b=function(){return{put:function(e,n){a(v,d,{key:e,value:n})},get:function(e,n){return a(v,h,{key:e,fallback:n},{expectReply:!0,timeout:10})},update:function(e,n){void 0===n&&(n=y),a(v,"UPDATE_CONFIG",{key:e,fn:n})},delete:function(e){a(v,"DELETE_CONFIG",{key:e})},where:function(e){return a(v,"WHERE_CONFIG",{pattern:e},{expectReply:!0,timeout:10})},subscribe:function(e){var n=l(function(n){try{var r=!1;return n.send(v,"SUBSCRIBE"),Promise.resolve(c(function(){return!r&&1},void 0,function(){return Promise.resolve(n.receive()).then(function(t){if("@EXIT"===t.tag)return n.send(v,"UNSUBSCRIBE"),void(r=!0);e(t.data)})}))}catch(e){return Promise.reject(e)}});return function(){return a(n,"@EXIT")}}}};b().put("accessNode.api","http://localhost:8080");var P=function(e){return"https://avatars.onflow.org/avatar/"+e+".svg"},p=function(e,n){return n.reduce(function(n,r){var t;return Object.assign({},n,((t={})[r]=e.get(r),t))},{})},k={SUBSCRIBE:function(e,n){e.subscribe(n.from),e.send(n.from,"USER/UPDATED",p(e,e.keys()))},UNSUBSCRIBE:function(e,n){e.unsubscribe(n.from)},SNAPSHOT:function(e,n){try{return n.reply(p(e,e.keys())),Promise.resolve()}catch(e){return Promise.reject(e)}}},E=function(e){try{return Promise.resolve(function(e){try{return Promise.resolve((void 0===n&&(n=10),new Promise(function(e){return setTimeout(e,n)}))).then(function(){return{acct:e,name:"bob the builder",avatar:P(),bio:"Can he fix it, yes he can.",hooks:{}}})}catch(e){return Promise.reject(e)}var n}(e.self())).then(function(n){!function(e,n){for(var r=0,t=Object.keys(n);r<t.length;r+=1){var o=t[r];e.put(o,n[o])}}(e,n);var r=c(function(){return 1},void 0,function(){return Promise.resolve(e.receive()).then(function(n){var r=function(r,t){try{var o=function(r,t){try{var o=Promise.resolve(k[n.tag](e,n)).then(function(){})}catch(e){return t(e)}return o&&o.then?o.then(void 0,t):o}(0,function(e){console.error("User Error",n,e)})}catch(e){return}return o&&o.then?o.then(t.bind(null,!1),t.bind(null,!0)):void 0}(0,function(e,n){});if(r&&r.then)return r.then(function(){})})});return r&&r.then?r.then(function(){}):void 0})}catch(e){return Promise.reject(e)}},S=function(e){return l(E,e)};e.authenticate=function(){return Promise.resolve()},e.unauthenticate=function(){return Promise.resolve()},e.currentUser=function(){return{subscribe:function(e){return function(){}},authorization:function(){return Promise.resolve()},payerAuthorization:function(){return Promise.resolve()},param:function(){return Promise.resolve()}}},e.transaction=function(e){return{subscribe:function(e){return function(){}}}},e.event=function(e,n){return{subscribe:function(e){return function(){}}}},e.decode=function(e){return Promise.resolve()},e.config=b,e.send=function(e,n){void 0===e&&(e=[]),void 0===n&&(n={});try{function o(o){return n.node=o,Array.isArray(e)&&(e=r.build(e)),Promise.resolve(r.pipe(e,[r.resolve([r.resolveParams,r.resolvePayload,r.resolveAuthorizations])])).then(function(e){return t.send(e,n)})}var i=n.node;return Promise.resolve(i?o(i):Promise.resolve(b().get("accessNode.api")).then(o))}catch(e){return Promise.reject(e)}},e.user=function(e){return{authorization:function(){try{return S(e),Promise.resolve({acct:e,signFn:function(){try{throw new Error("fcl.user("+e+").payerAuthorization WIP error -- known missing functionality")}catch(e){return Promise.reject(e)}}})}catch(e){return Promise.reject(e)}},payerAuthorization:function(){try{return S(e),Promise.resolve({acct:e,signFn:function(){try{throw new Error("fcl.user("+e+").payerAuthorization WIP error -- known missing functionality")}catch(e){return Promise.reject(e)}}})}catch(e){return Promise.reject(e)}},snapshot:function(){try{return S(e),Promise.resolve(a(e,"SNAPSHOT",null,{expectReply:!0,timeout:0}))}catch(e){return Promise.reject(e)}},param:function(n){return{value:e,xform:{asParam:function(e){return e},asInjection:function(e){return e}}}},subscribe:function(n){S(e);var r=l(function(r){try{var t=!1;return r.send(e,"SUBSCRIBE"),Promise.resolve(c(function(){return!t&&1},void 0,function(){return Promise.resolve(r.receive()).then(function(o){if("@EXIT"===o.tag)return r.send(e,"UNSUBSCRIBE"),void(t=!0);n(o.data)})}))}catch(e){return Promise.reject(e)}});return function(){return a(r,"@EXIT")}}}}});
//# sourceMappingURL=fcl.umd.js.map
{
"name": "@onflow/fcl",
"version": "0.0.24",
"version": "0.0.26",
"description": "Flow Client Library",

@@ -38,6 +38,6 @@ "license": "Apache-2.0",

"@onflow/resolver-encode": "0.0.4",
"@onflow/sdk": "0.0.9",
"@onflow/send": "0.0.3",
"@onflow/sdk": "0.0.11",
"@onflow/send": "0.0.4",
"queue-microtask": "^1.1.2"
}
}

@@ -82,2 +82,3 @@ # FCL

- [ ] `fcl.currentUser/0`
- [ ] `fcl.currentUser/0.snapshot/0`
- [ ] `fcl.currentUser/0.subsribe/1`

@@ -87,2 +88,13 @@ - [ ] `fcl.currentUser/0.authorization/n`

### `fcl.currentUser/0.snapshot/0`
Asynchronously returns a snapshot of the current internal state of the currentUser.
```javascript
import * as fcl from "@onflow/fcl"
await fcl.currentUser().snapshot() // {acct, name, …}
```
### `fcl.currentUser/0.subscribe/1`

@@ -127,3 +139,3 @@

sdk.params([
fcl.user(to).param,
fcl.user(to).param(),
sdk.param(amount, t.UFix64),

@@ -146,2 +158,3 @@ ]),

- [ ] `fcl.user/1`
- [ ] `fcl.user/1.snapshot/0`
- [ ] `fcl.user/1.subscribe/1`

@@ -151,2 +164,12 @@ - [ ] `fcl.user/1.authorization/n`

### `fcl.currentUser/0.snapshot/0`
Asynchronously returns a snapshot of the current internal state of the supplied user.
```javascript
import * as fcl from "@onflow/fcl"
await fcl.user(flowAcctNumber).snapshot() // {acct, name, …}
```
### `fcl.user/1.subscribe/1`

@@ -191,3 +214,3 @@

sdk.params([
fcl.currentUser().param,
fcl.currentUser().param(),
sdk.param(amount, t.UFix64),

@@ -263,4 +286,4 @@ ]),

fcl.config("accessNode.api", "https://my.access.node")
fcl.config("accessNode.key", process.env.FLOW_ACCESS_NODE_API_KEY)
fcl.config().put("accessNode.api", "https://my.access.node")
fcl.config().put("accessNode.key", process.env.FLOW_ACCESS_NODE_API_KEY)

@@ -276,3 +299,3 @@ const runTransaction = async (to, amount) =>

sdk.params([
fcl.user(to).param,
fcl.user(to).param(),
sdk.param(amount, t.UFix64),

@@ -279,0 +302,0 @@ ]),

@@ -151,2 +151,13 @@ import {spawn, send, kill} from "./"

})
test("actors with same name only spawn once", async () => {
const fn = jest.fn()
const c1 = spawn(fn, "foo")
const c2 = spawn(fn, "foo")
await idle()
expect(c1).toBe(c2)
expect(fn).toHaveBeenCalledTimes(1)
})
})
import "./default-config"
import * as sdk from "@onflow/sdk"
import {encode} from "@onflow/resolver-encode"
import {send as baseSend} from "@onflow/send"
export {config} from "./config"
export {send} from "./send"
export {user} from "./user"

@@ -22,14 +21,2 @@ export const authenticate = async () => {}

export const user = flowAcctNumber => {
return {
subscribe: callback => {
return function unsubscribe() {}
},
authorization: async () => {},
payerAuthorization: async () => {},
param: async () => {},
}
}
export const transaction = txId => {

@@ -52,12 +39,1 @@ return {

export const decode = async _respones => {}
export const send = (args = [], opts = {}) => {
opts.node = opts.node || NODE
if (Array.isArray(args)) args = sdk.build(args)
return sdk.pipe(args, [
sdk.resolve([sdk.resolveParams, encode, sdk.resolveSignatures]),
ix => baseSend(ix, opts),
])
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc