@onflow/sdk
Advanced tools
Comparing version 0.0.34 to 0.0.35
@@ -5,2 +5,10 @@ ### Unreleased | ||
### 0.0.35 -- 2020-09-29 | ||
- 2020-09-29 -- Proxy @onflow/sdk-resolve-validators at the top level | ||
- 2020-09-29 -- Proxy @onflow/sdk-resolve-signatures at the top level | ||
- 2020-09-29 -- Proxy @onflow/sdk-resolve-accounts at the top level | ||
- 2020-09-29 -- Proxy @onflow/sdk-resolve-arguments at the top level | ||
- 2020-09-29 -- VSN `@onflow/send` 0.0.21 -> 0.0.22 | ||
### 0.0.34 - 2020-09-29 | ||
@@ -7,0 +15,0 @@ |
@@ -1,2 +0,2 @@ | ||
var e=require("@onflow/interaction"),r=require("@onflow/send"),n=require("@onflow/decode"),t=require("@qvvg/templar"),o=require("@onflow/sdk-resolve-arguments"),i=require("@onflow/sdk-resolve-cadence"),u=require("@onflow/encode");function s(r){return void 0===r&&(r=[]),e.pipe(e.interaction(),r)}var a=e.pipe;function c(){return(c=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}function p(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}function l(r){return e.pipe([e.makeGetAccount,function(n){return n.accountAddr=r,e.Ok(n)}])}function f(r){return void 0===r&&(r=!1),e.pipe([e.makeGetLatestBlock,function(n){return n.block.isSealed=r,e.Ok(n)}])}var d={asArgument:function(e){return e},asInjection:function(e){return e}},m={asArgument:function(e){return e},asInjection:function(e){return e}},v=[],y="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function g(e,r,n){if(!e.s){if(n instanceof h){if(!n.s)return void(n.o=g.bind(null,e,r));1&r&&(r=n.s),n=n.v}if(n&&n.then)return void n.then(g.bind(null,e,r),g.bind(null,e,2));e.s=r,e.v=n;var t=e.o;t&&t(e)}}var h=function(){function e(){}return e.prototype.then=function(r,n){var t=new e,o=this.s;if(o){var i=1&o?r:n;if(i){try{g(t,1,i(this.v))}catch(e){g(t,2,e)}return t}return this}return this.o=function(e){try{var o=e.v;1&e.s?g(t,1,r?r(o):o):n?g(t,1,n(o)):g(t,2,o)}catch(e){g(t,2,e)}},t},e}();function k(e){return e instanceof h&&1&e.s}var b=function(e){return"function"==typeof e},P=function(e){return"number"==typeof e},O=function(e){return"string"==typeof e},x=function(e,r){if(!e){var n,t=new Error("INVARIANT "+r);throw t.stack=t.stack.split("\n").filter(function(e){return!/at invariant/.test(e)}).join("\n"),(n=console).error.apply(n,["\n\n---\n\n",t,"\n\n"].concat([].slice.call(arguments,2),["\n\n---\n\n"])),t}},I=function(e){return!(e.role.proposer&&!(O(e.addr)&&P(e.keyId)&&P(e.sequenceNum)&&b(e.signingFunction))||e.role.payer&&!(O(e.addr)&&P(e.keyId)&&b(e.signingFunction))||e.role.authorizer&&!(O(e.addr)&&P(e.keyId)&&b(e.signingFunction)))},w=function(e){return void 0===e&&(e=[]),e.filter(Boolean)[0]||null},j=function(e){return void 0===e&&(e=[]),e.find(function(e){return e.role.proposer})||{}},S=e.pipe([function(r){try{var n=function(){return e.Ok(r)};if(!e.isTransaction(r))return Promise.resolve(e.Ok(r));var t=function(e,r,n){if("function"==typeof e[y]){var t,o,i,u=e[y]();if(function e(n){try{for(;!(t=u.next()).done;)if((n=r(t.value))&&n.then){if(!k(n))return void n.then(e,i||(i=g.bind(null,o=new h,2)));n=n.v}o?g(o,1,n):o=n}catch(e){g(o||(o=new h),2,e)}}(),u.return){var s=function(e){try{t.done||u.return()}catch(e){}return e};if(o&&o.then)return o.then(s,function(e){throw s(e)});s()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var a=[],c=0;c<e.length;c++)a.push(e[c]);return function(e,r,n){var t,o,i=-1;return function n(u){try{for(;++i<e.length;)if((u=r(i))&&u.then){if(!k(u))return void u.then(n,o||(o=g.bind(null,t=new h,2)));u=u.v}t?g(t,1,u):t=u}catch(e){g(t||(t=new h),2,e)}}(),t}(a,function(e){return r(a[e])})}(Object.entries(r.accounts),function(e){var n=e[0],t=e[1];function o(){x(I(r.accounts[n]),"Account unable to fulfill role",r.accounts[n])}var i=function(){if(b(t.resolve))return Promise.resolve(t.resolve(t)).then(function(e){r.accounts[n]=e})}();return i&&i.then?i.then(o):o()});return Promise.resolve(t&&t.then?t.then(n):n())}catch(e){return Promise.reject(e)}},function(r){try{if(!e.isTransaction(r))return Promise.resolve(e.Ok(r));for(var n=function(){var e,n,i,u=o[t],s=u.addr+"|"+u.keyId;r.accounts[s]=null!=r.accounts[s]?(e=r.accounts[s],n=c({tempId:s},u),{kind:w([e.kind,n.kind]),tempId:w([e.tempId,n.tempId]),addr:w([e.addr,n.addr]),keyId:(i=[e.keyId,n.keyId],void 0===i&&(i=[]),"number"==typeof i.filter(P)[0]?i.filter(P)[0]:null),sequenceNum:"number"==typeof j([e,n]).sequenceNum?j([e,n]).sequenceNum:e.sequenceNum,signature:w([e.signature,n.signature]),signingFunction:w([e.signingFunction,n.signingFunction]),resolve:w([e.resolve,n.resolve]),role:{proposer:e.role.proposer||n.role.proposer,authorizer:e.role.authorizer||n.role.authorizer,payer:e.role.payer||n.role.payer,param:e.role.param||n.role.param}}):c({tempId:s},u),r.proposer===u.tempId&&(r.proposer=s),r.payer===u.tempId&&(r.payer=s),r.authorizations=r.authorizations.map(function(e){return e===u.tempId?s:e}),delete r.accounts[u.tempId]},t=0,o=Object.values(r.accounts);t<o.length;t++)n();for(var i=0,u=Object.values(r.accounts);i<u.length;i++){var s=u[i];x(I(s),"Account unable to fulfill roles",s)}return Promise.resolve(e.Ok(r))}catch(e){return Promise.reject(e)}}]);function A(e){return{script:e.message.cadence,refBlock:e.message.refBlock||null,gasLimit:e.message.computeLimit,arguments:e.message.arguments.map(function(r){return e.arguments[r].asArgument}),proposalKey:{address:e.accounts[e.proposer].addr,keyId:e.accounts[e.proposer].keyId,sequenceNum:e.accounts[e.proposer].sequenceNum},payer:e.accounts[e.payer].addr,authorizers:e.authorizations.map(function(r){return e.accounts[r].addr})}}var B=function(e,r,n){void 0===r&&(r=[]);try{return Promise.all(r.map(function(r){try{return Promise.resolve(e.accounts[r].signingFunction({message:n,addr:e.accounts[r].addr,keyId:e.accounts[r].keyId,roles:e.accounts[r].role,interaction:e})).then(function(n){if(n.cid=r,e.accounts[r].addr!==n.addr)throw new Error(r+" — mismatching address in composite signature");if(e.accounts[r].keyId!==n.keyId)throw new Error(r+" — mismatching keyId in composite signature");return n.sig=n.signature,n.address=n.addr,n})}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}};function q(e,r){for(var n,t=function(e,r){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,r){if(e){if("string"==typeof e)return p(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,void 0):void 0}}(e))){n&&(e=n);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}(r);!(n=t()).done;){var o=n.value;e.accounts[o.cid].signature=o.signature}return r}Object.defineProperty(exports,"isBad",{enumerable:!0,get:function(){return e.isBad}}),Object.defineProperty(exports,"isOk",{enumerable:!0,get:function(){return e.isOk}}),Object.defineProperty(exports,"pipe",{enumerable:!0,get:function(){return e.pipe}}),Object.defineProperty(exports,"why",{enumerable:!0,get:function(){return e.why}}),Object.defineProperty(exports,"send",{enumerable:!0,get:function(){return r.send}}),Object.defineProperty(exports,"decode",{enumerable:!0,get:function(){return n.decode}}),Object.defineProperty(exports,"decodeResponse",{enumerable:!0,get:function(){return n.decodeResponse}}),Object.defineProperty(exports,"cadence",{enumerable:!0,get:function(){return t.templar}}),Object.defineProperty(exports,"cdc",{enumerable:!0,get:function(){return t.templar}}),Object.defineProperty(exports,"resolveArguments",{enumerable:!0,get:function(){return o.resolveArguments}}),exports.arg=function(e,r){return void 0===r&&(r=m),{value:e,xform:r}},exports.args=function(r){return void 0===r&&(r=[]),e.pipe(r.map(function(r){return e.makeArgument("function"==typeof r?{resolve:r}:r)}))},exports.authorization=function(e,r,n,t){return{addr:e,signingFunction:r,keyId:n,sequenceNum:t}},exports.authorizations=function(r){return void 0===r&&(r=[]),e.pipe(r.map(function(r){return e.makeAuthorizer(c({},"function"==typeof r?{resolve:r}:r,{role:{authorizer:!0}}))}))},exports.build=s,exports.getAccount=l,exports.getBlockByHeight=function(r){return e.pipe([e.makeGetBlockByHeight,function(n){return n.block.height=r,e.Ok(n)}])},exports.getBlockById=function(r){return e.pipe([e.makeGetBlockById,function(n){return n.block.id=r,e.Ok(n)}])},exports.getEvents=function(r,n,t){return e.pipe([e.makeGetEvents,function(n){return n.events.eventType=r,e.Ok(n)},function(r){return r.events.start=n,e.Ok(r)},function(r){return r.events.end=t,e.Ok(r)}])},exports.getLatestBlock=f,exports.getTransactionStatus=function(r){return e.pipe([e.makeGetTransactionStatus,function(n){return n.transactionId=r,e.Ok(n)}])},exports.invariant=function r(){var n=[].slice.call(arguments);if(n.length>1){var t=n,o=t[0],i=t[1];return r(function(e,r){var n=r.Bad;return o?(0,r.Ok)(e):n(e,i)})}var u=n[0];return function(r){return u(r,{Ok:e.Ok,Bad:e.Bad})}},exports.limit=function(r){return e.pipe([function(n){return n.message.computeLimit=r,e.Ok(n)}])},exports.param=function(e,r,n){return void 0===r&&(r=d),void 0===n&&(n=null),{key:n,value:e,xform:r}},exports.params=function(r){return void 0===r&&(r=[]),e.pipe(r.map(function(r){return e.makeParam("function"==typeof r?{resolve:r}:r)}))},exports.payer=function(r){return e.makePayer(c({},"function"==typeof r?{resolve:r}:r,{role:{payer:!0}}))},exports.ping=function(){return e.pipe([e.makePing])},exports.proposer=function(r){try{return Promise.resolve(e.makeProposer("function"==typeof r?{resolve:r,role:{proposer:!0}}:c({},r,{role:{proposer:!0}})))}catch(e){return Promise.reject(e)}},exports.ref=function(r){return e.pipe([function(n){return n.message.refBlock=r,e.Ok(n)}])},exports.resolve=a,exports.resolveAccounts=S,exports.resolveParams=function(e){return console.error("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The resolver sdk.resolveParams is being replaced with the package @onflow/sdk-resolve-cadence\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0002-deprecate-resolve-params-resolver\n\n ============================\n ","font-weight:bold;font-family:monospace;"),i.resolveCadence(e)},exports.resolveProposerSequenceNumber=function(t){var o=t.node;return function(t){try{return e.isTransaction(t)?t.accounts[t.proposer].sequenceNum?Promise.resolve(e.Ok(t)):Promise.resolve(s([l(t.accounts[t.proposer].addr)])).then(function(i){return Promise.resolve(r.send(i,{node:o})).then(function(r){return Promise.resolve(n.decodeResponse(r)).then(function(r){return t.accounts[t.proposer].sequenceNum=r.keys[t.accounts[t.proposer].keyId].sequenceNumber,e.Ok(t)})})}):Promise.resolve(e.Ok(t))}catch(e){return Promise.reject(e)}}},exports.resolveRefBlockId=function(t){var o=t.node;return function(t){try{return e.isTransaction(t)?t.message.refBlock?Promise.resolve(e.Ok(t)):Promise.resolve(s([f()])).then(function(i){return Promise.resolve(r.send(i,{node:o})).then(function(r){return Promise.resolve(n.decodeResponse(r)).then(function(r){return t.message.refBlock=r.id,e.Ok(t)})})}):Promise.resolve(e.Ok(t))}catch(e){return Promise.reject(e)}}},exports.resolveSignatures=function(r){try{if(!e.isTransaction(r))return Promise.resolve(r);var n=function(e){var r=new Set(e.authorizations);r.add(e.proposer),r.delete(e.payer),r=Array.from(r);var n=new Set([e.payer]);return{insideSigners:r,outsideSigners:n=Array.from(n)}}(r),t=n.outsideSigners;return Promise.resolve(B(r,n.insideSigners,u.encodeTransactionPayload(A(r)))).then(function(e){var n=q(r,e);return Promise.resolve(B(r,t,u.encodeTransactionEnvelope(c({},A(r),{payloadSigs:n})))).then(function(e){return q(r,e),r})})}catch(e){return Promise.reject(e)}},exports.resolveValidators=function(r){try{var n=e.get(r,"ix.validators",[]);return Promise.resolve(e.pipe(r,n.map(function(r){return function(n){return r(n,{Ok:e.Ok,Bad:e.Bad})}})))}catch(e){return Promise.reject(e)}},exports.script=function(){return e.pipe([e.makeScript,e.put("ix.cadence",t.templar.apply(void 0,[].slice.call(arguments)))])},exports.transaction=function(){return e.pipe([e.makeTransaction,e.put("ix.cadence",t.templar.apply(void 0,[].slice.call(arguments))),function(r){return r.message.computeLimit=r.message.computeLimit||10,r.message.refBlock=r.message.refBlock||null,r.authorizations=r.authorizations||v,e.Ok(r)}])},exports.validator=function(r){return e.update("ix.validators",function(e){return Array.isArray(e)?e.push(r):[r]})}; | ||
var e=require("@onflow/interaction"),r=require("@onflow/send"),n=require("@onflow/decode"),t=require("@qvvg/templar"),o=require("@onflow/sdk-resolve-arguments"),i=require("@onflow/sdk-resolve-accounts"),u=require("@onflow/sdk-resolve-signatures"),s=require("@onflow/sdk-resolve-validators"),c=require("@onflow/sdk-resolve-cadence");function a(r){return void 0===r&&(r=[]),e.pipe(e.interaction(),r)}var p=e.pipe;function l(){return(l=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}function f(r){return e.pipe([e.makeGetAccount,function(n){return n.accountAddr=r,e.Ok(n)}])}function d(r){return void 0===r&&(r=!1),e.pipe([e.makeGetLatestBlock,function(n){return n.block.isSealed=r,e.Ok(n)}])}var m={asArgument:function(e){return e},asInjection:function(e){return e}},v={asArgument:function(e){return e},asInjection:function(e){return e}},k=[];Object.defineProperty(exports,"isBad",{enumerable:!0,get:function(){return e.isBad}}),Object.defineProperty(exports,"isOk",{enumerable:!0,get:function(){return e.isOk}}),Object.defineProperty(exports,"pipe",{enumerable:!0,get:function(){return e.pipe}}),Object.defineProperty(exports,"why",{enumerable:!0,get:function(){return e.why}}),Object.defineProperty(exports,"send",{enumerable:!0,get:function(){return r.send}}),Object.defineProperty(exports,"decode",{enumerable:!0,get:function(){return n.decode}}),Object.defineProperty(exports,"decodeResponse",{enumerable:!0,get:function(){return n.decodeResponse}}),Object.defineProperty(exports,"cadence",{enumerable:!0,get:function(){return t.templar}}),Object.defineProperty(exports,"cdc",{enumerable:!0,get:function(){return t.templar}}),Object.defineProperty(exports,"resolveArguments",{enumerable:!0,get:function(){return o.resolveArguments}}),Object.defineProperty(exports,"resolveAccounts",{enumerable:!0,get:function(){return i.resolveAccounts}}),Object.defineProperty(exports,"resolveSignatures",{enumerable:!0,get:function(){return u.resolveSignatures}}),Object.defineProperty(exports,"resolveValidators",{enumerable:!0,get:function(){return s.resolveValidators}}),exports.arg=function(e,r){return void 0===r&&(r=v),{value:e,xform:r}},exports.args=function(r){return void 0===r&&(r=[]),e.pipe(r.map(function(r){return e.makeArgument("function"==typeof r?{resolve:r}:r)}))},exports.authorization=function(e,r,n,t){return{addr:e,signingFunction:r,keyId:n,sequenceNum:t}},exports.authorizations=function(r){return void 0===r&&(r=[]),e.pipe(r.map(function(r){return e.makeAuthorizer(l({},"function"==typeof r?{resolve:r}:r,{role:{authorizer:!0}}))}))},exports.build=a,exports.getAccount=f,exports.getBlockByHeight=function(r){return e.pipe([e.makeGetBlockByHeight,function(n){return n.block.height=r,e.Ok(n)}])},exports.getBlockById=function(r){return e.pipe([e.makeGetBlockById,function(n){return n.block.id=r,e.Ok(n)}])},exports.getEvents=function(r,n,t){return e.pipe([e.makeGetEvents,function(n){return n.events.eventType=r,e.Ok(n)},function(r){return r.events.start=n,e.Ok(r)},function(r){return r.events.end=t,e.Ok(r)}])},exports.getLatestBlock=d,exports.getTransactionStatus=function(r){return e.pipe([e.makeGetTransactionStatus,function(n){return n.transactionId=r,e.Ok(n)}])},exports.invariant=function r(){var n=[].slice.call(arguments);if(n.length>1){var t=n,o=t[0],i=t[1];return r(function(e,r){var n=r.Bad;return o?(0,r.Ok)(e):n(e,i)})}var u=n[0];return function(r){return u(r,{Ok:e.Ok,Bad:e.Bad})}},exports.limit=function(r){return e.pipe([function(n){return n.message.computeLimit=r,e.Ok(n)}])},exports.param=function(e,r,n){return void 0===r&&(r=m),void 0===n&&(n=null),{key:n,value:e,xform:r}},exports.params=function(r){return void 0===r&&(r=[]),e.pipe(r.map(function(r){return e.makeParam("function"==typeof r?{resolve:r}:r)}))},exports.payer=function(r){return e.makePayer(l({},"function"==typeof r?{resolve:r}:r,{role:{payer:!0}}))},exports.ping=function(){return e.pipe([e.makePing])},exports.proposer=function(r){try{return Promise.resolve(e.makeProposer("function"==typeof r?{resolve:r,role:{proposer:!0}}:l({},r,{role:{proposer:!0}})))}catch(e){return Promise.reject(e)}},exports.ref=function(r){return e.pipe([function(n){return n.message.refBlock=r,e.Ok(n)}])},exports.resolve=p,exports.resolveParams=function(e){return console.error("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The resolver sdk.resolveParams is being replaced with the package @onflow/sdk-resolve-cadence\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0002-deprecate-resolve-params-resolver\n\n ============================\n ","font-weight:bold;font-family:monospace;"),c.resolveCadence(e)},exports.resolveProposerSequenceNumber=function(t){var o=t.node;return function(t){try{return e.isTransaction(t)?t.accounts[t.proposer].sequenceNum?Promise.resolve(e.Ok(t)):Promise.resolve(a([f(t.accounts[t.proposer].addr)])).then(function(i){return Promise.resolve(r.send(i,{node:o})).then(function(r){return Promise.resolve(n.decodeResponse(r)).then(function(r){return t.accounts[t.proposer].sequenceNum=r.keys[t.accounts[t.proposer].keyId].sequenceNumber,e.Ok(t)})})}):Promise.resolve(e.Ok(t))}catch(e){return Promise.reject(e)}}},exports.resolveRefBlockId=function(t){var o=t.node;return function(t){try{return e.isTransaction(t)?t.message.refBlock?Promise.resolve(e.Ok(t)):Promise.resolve(a([d()])).then(function(i){return Promise.resolve(r.send(i,{node:o})).then(function(r){return Promise.resolve(n.decodeResponse(r)).then(function(r){return t.message.refBlock=r.id,e.Ok(t)})})}):Promise.resolve(e.Ok(t))}catch(e){return Promise.reject(e)}}},exports.script=function(){return e.pipe([e.makeScript,e.put("ix.cadence",t.templar.apply(void 0,[].slice.call(arguments)))])},exports.transaction=function(){return e.pipe([e.makeTransaction,e.put("ix.cadence",t.templar.apply(void 0,[].slice.call(arguments))),function(r){return r.message.computeLimit=r.message.computeLimit||10,r.message.refBlock=r.message.refBlock||null,r.authorizations=r.authorizations||k,e.Ok(r)}])},exports.validator=function(r){return e.update("ix.validators",function(e){return Array.isArray(e)?e.push(r):[r]})}; | ||
//# sourceMappingURL=sdk.js.map |
@@ -1,2 +0,2 @@ | ||
import{pipe as e,interaction as n,makeAuthorizer as r,makeGetAccount as o,Ok as t,makeGetEvents as s,makeGetLatestBlock as a,makeGetBlockById as c,makeGetBlockByHeight as i,makeGetTransactionStatus as u,makeParam as d,makeArgument as l,makeProposer as p,makePayer as f,makePing as m,makeScript as g,put as y,makeTransaction as k,update as v,Bad as w,isTransaction as h,get as I}from"@onflow/interaction";export{isBad,isOk,pipe,why}from"@onflow/interaction";import{send as b}from"@onflow/send";export{send}from"@onflow/send";import{decodeResponse as N}from"@onflow/decode";export{decode,decodeResponse}from"@onflow/decode";import{templar as A}from"@qvvg/templar";export{templar as cadence,templar as cdc}from"@qvvg/templar";export{resolveArguments}from"@onflow/sdk-resolve-arguments";import{resolveCadence as q}from"@onflow/sdk-resolve-cadence";import{encodeTransactionPayload as x,encodeTransactionEnvelope as z}from"@onflow/encode";function B(r=[]){return e(n(),r)}const O=e;function S(){return(S=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}function j(n=[]){return e(n.map(e=>r(S({},"function"==typeof e?{resolve:e}:e,{role:{authorizer:!0}}))))}function F(e,n,r,o){return{addr:e,signingFunction:n,keyId:r,sequenceNum:o}}function L(n){return e([o,e=>(e.accountAddr=n,t(e))])}function T(n,r,o){return e([s,e=>(e.events.eventType=n,t(e)),e=>(e.events.start=r,t(e)),e=>(e.events.end=o,t(e))])}function E(n=!1){return e([a,e=>(e.block.isSealed=n,t(e))])}function P(n){return e([c,e=>(e.block.id=n,t(e))])}function R(n){return e([i,e=>(e.block.height=n,t(e))])}function D(n){return e([u,e=>(e.transactionId=n,t(e))])}function K(n){return e([e=>(e.message.computeLimit=n,t(e))])}function $(n=[]){return e(n.map(e=>d("function"==typeof e?{resolve:e}:e)))}const C={asArgument:e=>e,asInjection:e=>e};function V(e,n=C,r=null){return{key:r,value:e,xform:n}}function Y(n=[]){return e(n.map(e=>l("function"==typeof e?{resolve:e}:e)))}const G={asArgument:e=>e,asInjection:e=>e};function H(e,n=G){return{value:e,xform:n}}async function J(e){return p("function"==typeof e?{resolve:e,role:{proposer:!0}}:S({},e,{role:{proposer:!0}}))}function M(e){return f(S({},"function"==typeof e?{resolve:e}:e,{role:{payer:!0}}))}function Q(){return e([m])}function U(n){return e([e=>(e.message.refBlock=n,t(e))])}function W(...n){return e([g,y("ix.cadence",A(...n))])}const X=[];function Z(...n){return e([k,y("ix.cadence",A(...n)),e=>(e.message.computeLimit=e.message.computeLimit||10,e.message.refBlock=e.message.refBlock||null,e.authorizations=e.authorizations||X,t(e))])}function _(e){return v("ix.validators",n=>Array.isArray(n)?n.push(e):[e])}function ee(...e){if(e.length>1){const[n,r]=e;return ee((e,{Ok:o,Bad:t})=>n?o(e):t(e,r))}const[n]=e;return e=>n(e,{Ok:t,Bad:w})}const ne=e=>"function"==typeof e,re=e=>"number"==typeof e,oe=e=>"string"==typeof e,te=(e,n,...r)=>{if(!e){const e=new Error("INVARIANT "+n);throw e.stack=e.stack.split("\n").filter(e=>!/at invariant/.test(e)).join("\n"),console.error("\n\n---\n\n",e,"\n\n",...r,"\n\n---\n\n"),e}},se=e=>!(e.role.proposer&&!(oe(e.addr)&&re(e.keyId)&&re(e.sequenceNum)&&ne(e.signingFunction))||e.role.payer&&!(oe(e.addr)&&re(e.keyId)&&ne(e.signingFunction))||e.role.authorizer&&!(oe(e.addr)&&re(e.keyId)&&ne(e.signingFunction))),ae=(e=[])=>e.filter(Boolean)[0]||null,ce=(e=[])=>"number"==typeof e.filter(re)[0]?e.filter(re)[0]:null,ie=(e=[])=>e.find(e=>e.role.proposer)||{},ue=e([async e=>{if(!h(e))return t(e);for(let[n,r]of Object.entries(e.accounts))ne(r.resolve)&&(e.accounts[n]=await r.resolve(r)),te(se(e.accounts[n]),"Account unable to fulfill role",e.accounts[n]);return t(e)},async e=>{if(!h(e))return t(e);for(let o of Object.values(e.accounts)){const t=`${o.addr}|${o.keyId}`;e.accounts[t]=null!=e.accounts[t]?(n=e.accounts[t],r=S({tempId:t},o),{kind:ae([n.kind,r.kind]),tempId:ae([n.tempId,r.tempId]),addr:ae([n.addr,r.addr]),keyId:ce([n.keyId,r.keyId]),sequenceNum:"number"==typeof ie([n,r]).sequenceNum?ie([n,r]).sequenceNum:n.sequenceNum,signature:ae([n.signature,r.signature]),signingFunction:ae([n.signingFunction,r.signingFunction]),resolve:ae([n.resolve,r.resolve]),role:{proposer:n.role.proposer||r.role.proposer,authorizer:n.role.authorizer||r.role.authorizer,payer:n.role.payer||r.role.payer,param:n.role.param||r.role.param}}):S({tempId:t},o),e.proposer===o.tempId&&(e.proposer=t),e.payer===o.tempId&&(e.payer=t),e.authorizations=e.authorizations.map(e=>e===o.tempId?t:e),delete e.accounts[o.tempId]}var n,r;for(let n of Object.values(e.accounts))te(se(n),"Account unable to fulfill roles",n);return t(e)}]);function de(e){return console.error("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The resolver sdk.resolveParams is being replaced with the package @onflow/sdk-resolve-cadence\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0002-deprecate-resolve-params-resolver\n\n ============================\n ","font-weight:bold;font-family:monospace;"),q(e)}function le(e){return{script:e.message.cadence,refBlock:e.message.refBlock||null,gasLimit:e.message.computeLimit,arguments:e.message.arguments.map(n=>e.arguments[n].asArgument),proposalKey:{address:e.accounts[e.proposer].addr,keyId:e.accounts[e.proposer].keyId,sequenceNum:e.accounts[e.proposer].sequenceNum},payer:e.accounts[e.payer].addr,authorizers:e.authorizations.map(n=>e.accounts[n].addr)}}async function pe(e,n=[],r){return Promise.all(n.map(async n=>{const o=await e.accounts[n].signingFunction({message:r,addr:e.accounts[n].addr,keyId:e.accounts[n].keyId,roles:e.accounts[n].role,interaction:e});if(o.cid=n,e.accounts[n].addr!==o.addr)throw new Error(n+" — mismatching address in composite signature");if(e.accounts[n].keyId!==o.keyId)throw new Error(n+" — mismatching keyId in composite signature");return o.sig=o.signature,o.address=o.addr,o}))}function fe(e,n){for(let{cid:r,signature:o}of n)e.accounts[r].signature=o;return n}async function me(e){if(!h(e))return e;const{insideSigners:n,outsideSigners:r}=function(e){let n=new Set(e.authorizations);n.add(e.proposer),n.delete(e.payer),n=Array.from(n);let r=new Set([e.payer]);return r=Array.from(r),{insideSigners:n,outsideSigners:r}}(e),o=fe(e,await pe(e,n,x(le(e))));return fe(e,await pe(e,r,z(S({},le(e),{payloadSigs:o})))),e}async function ge(n){const r=I(n,"ix.validators",[]);return e(n,r.map(e=>n=>e(n,{Ok:t,Bad:w})))}const ye=({node:e})=>async n=>{if(!h(n))return t(n);if(n.accounts[n.proposer].sequenceNum)return t(n);const r=await b(await B([L(n.accounts[n.proposer].addr)]),{node:e}),o=await N(r);return n.accounts[n.proposer].sequenceNum=o.keys[n.accounts[n.proposer].keyId].sequenceNumber,t(n)},ke=({node:e})=>async n=>{if(!h(n))return t(n);if(n.message.refBlock)return t(n);const r=await b(await B([E()]),{node:e}),o=await N(r);return n.message.refBlock=o.id,t(n)};export{H as arg,Y as args,F as authorization,j as authorizations,B as build,L as getAccount,R as getBlockByHeight,P as getBlockById,T as getEvents,E as getLatestBlock,D as getTransactionStatus,ee as invariant,K as limit,V as param,$ as params,M as payer,Q as ping,J as proposer,U as ref,O as resolve,ue as resolveAccounts,de as resolveParams,ye as resolveProposerSequenceNumber,ke as resolveRefBlockId,me as resolveSignatures,ge as resolveValidators,W as script,Z as transaction,_ as validator}; | ||
import{pipe as e,interaction as o,makeAuthorizer as n,makeGetAccount as r,Ok as t,makeGetEvents as s,makeGetLatestBlock as c,makeGetBlockById as a,makeGetBlockByHeight as i,makeGetTransactionStatus as u,makeParam as f,makeArgument as l,makeProposer as p,makePayer as m,makePing as d,makeScript as v,put as g,makeTransaction as k,update as w,Bad as y,isTransaction as h}from"@onflow/interaction";export{isBad,isOk,pipe,why}from"@onflow/interaction";import{send as x}from"@onflow/send";export{send}from"@onflow/send";import{decodeResponse as b}from"@onflow/decode";export{decode,decodeResponse}from"@onflow/decode";import{templar as A}from"@qvvg/templar";export{templar as cadence,templar as cdc}from"@qvvg/templar";export{resolveArguments}from"@onflow/sdk-resolve-arguments";export{resolveAccounts}from"@onflow/sdk-resolve-accounts";export{resolveSignatures}from"@onflow/sdk-resolve-signatures";export{resolveValidators}from"@onflow/sdk-resolve-validators";import{resolveCadence as B}from"@onflow/sdk-resolve-cadence";function I(n=[]){return e(o(),n)}const N=e;function O(){return(O=Object.assign||function(e){for(var o=1;o<arguments.length;o++){var n=arguments[o];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function q(o=[]){return e(o.map(e=>n(O({},"function"==typeof e?{resolve:e}:e,{role:{authorizer:!0}}))))}function j(e,o,n,r){return{addr:e,signingFunction:o,keyId:n,sequenceNum:r}}function S(o){return e([r,e=>(e.accountAddr=o,t(e))])}function L(o,n,r){return e([s,e=>(e.events.eventType=o,t(e)),e=>(e.events.start=n,t(e)),e=>(e.events.end=r,t(e))])}function T(o=!1){return e([c,e=>(e.block.isSealed=o,t(e))])}function z(o){return e([a,e=>(e.block.id=o,t(e))])}function D(o){return e([i,e=>(e.block.height=o,t(e))])}function F(o){return e([u,e=>(e.transactionId=o,t(e))])}function P(o){return e([e=>(e.message.computeLimit=o,t(e))])}function R(o=[]){return e(o.map(e=>f("function"==typeof e?{resolve:e}:e)))}const C={asArgument:e=>e,asInjection:e=>e};function K(e,o=C,n=null){return{key:n,value:e,xform:o}}function V(o=[]){return e(o.map(e=>l("function"==typeof e?{resolve:e}:e)))}const Y={asArgument:e=>e,asInjection:e=>e};function E(e,o=Y){return{value:e,xform:o}}async function G(e){return p("function"==typeof e?{resolve:e,role:{proposer:!0}}:O({},e,{role:{proposer:!0}}))}function H(e){return m(O({},"function"==typeof e?{resolve:e}:e,{role:{payer:!0}}))}function J(){return e([d])}function M(o){return e([e=>(e.message.refBlock=o,t(e))])}function Q(...o){return e([v,g("ix.cadence",A(...o))])}const U=[];function W(...o){return e([k,g("ix.cadence",A(...o)),e=>(e.message.computeLimit=e.message.computeLimit||10,e.message.refBlock=e.message.refBlock||null,e.authorizations=e.authorizations||U,t(e))])}function X(e){return w("ix.validators",o=>Array.isArray(o)?o.push(e):[e])}function Z(...e){if(e.length>1){const[o,n]=e;return Z((e,{Ok:r,Bad:t})=>o?r(e):t(e,n))}const[o]=e;return e=>o(e,{Ok:t,Bad:y})}function $(e){return console.error("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The resolver sdk.resolveParams is being replaced with the package @onflow/sdk-resolve-cadence\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0002-deprecate-resolve-params-resolver\n\n ============================\n ","font-weight:bold;font-family:monospace;"),B(e)}const _=({node:e})=>async o=>{if(!h(o))return t(o);if(o.accounts[o.proposer].sequenceNum)return t(o);const n=await x(await I([S(o.accounts[o.proposer].addr)]),{node:e}),r=await b(n);return o.accounts[o.proposer].sequenceNum=r.keys[o.accounts[o.proposer].keyId].sequenceNumber,t(o)},ee=({node:e})=>async o=>{if(!h(o))return t(o);if(o.message.refBlock)return t(o);const n=await x(await I([T()]),{node:e}),r=await b(n);return o.message.refBlock=r.id,t(o)};export{E as arg,V as args,j as authorization,q as authorizations,I as build,S as getAccount,D as getBlockByHeight,z as getBlockById,L as getEvents,T as getLatestBlock,F as getTransactionStatus,Z as invariant,P as limit,K as param,R as params,H as payer,J as ping,G as proposer,M as ref,N as resolve,$ as resolveParams,_ as resolveProposerSequenceNumber,ee as resolveRefBlockId,Q as script,W as transaction,X as validator}; | ||
//# sourceMappingURL=sdk.modern.js.map |
@@ -1,2 +0,2 @@ | ||
import{pipe as r,interaction as e,makeAuthorizer as n,makeGetAccount as t,Ok as o,makeGetEvents as i,makeGetLatestBlock as u,makeGetBlockById as c,makeGetBlockByHeight as a,makeGetTransactionStatus as s,makeParam as f,makeArgument as l,makeProposer as d,makePayer as m,makePing as p,makeScript as v,put as y,makeTransaction as h,update as g,Bad as k,isTransaction as b,get as w}from"@onflow/interaction";export{isBad,isOk,pipe,why}from"@onflow/interaction";import{send as I}from"@onflow/send";export{send}from"@onflow/send";import{decodeResponse as P}from"@onflow/decode";export{decode,decodeResponse}from"@onflow/decode";import{templar as j}from"@qvvg/templar";export{templar as cadence,templar as cdc}from"@qvvg/templar";export{resolveArguments}from"@onflow/sdk-resolve-arguments";import{resolveCadence as S}from"@onflow/sdk-resolve-cadence";import{encodeTransactionPayload as A,encodeTransactionEnvelope as N}from"@onflow/encode";function x(n){return void 0===n&&(n=[]),r(e(),n)}var O=r;function q(){return(q=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r}).apply(this,arguments)}function z(r,e){(null==e||e>r.length)&&(e=r.length);for(var n=0,t=new Array(e);n<e;n++)t[n]=r[n];return t}function B(e){return void 0===e&&(e=[]),r(e.map(function(r){return n(q({},"function"==typeof r?{resolve:r}:r,{role:{authorizer:!0}}))}))}function F(r,e,n,t){return{addr:r,signingFunction:e,keyId:n,sequenceNum:t}}function T(e){return r([t,function(r){return r.accountAddr=e,o(r)}])}function L(e,n,t){return r([i,function(r){return r.events.eventType=e,o(r)},function(r){return r.events.start=n,o(r)},function(r){return r.events.end=t,o(r)}])}function E(e){return void 0===e&&(e=!1),r([u,function(r){return r.block.isSealed=e,o(r)}])}function R(e){return r([c,function(r){return r.block.id=e,o(r)}])}function C(e){return r([a,function(r){return r.block.height=e,o(r)}])}function D(e){return r([s,function(r){return r.transactionId=e,o(r)}])}function K(e){return r([function(r){return r.message.computeLimit=e,o(r)}])}function M(e){return void 0===e&&(e=[]),r(e.map(function(r){return f("function"==typeof r?{resolve:r}:r)}))}var U={asArgument:function(r){return r},asInjection:function(r){return r}};function V(r,e,n){return void 0===e&&(e=U),void 0===n&&(n=null),{key:n,value:r,xform:e}}function Y(e){return void 0===e&&(e=[]),r(e.map(function(r){return l("function"==typeof r?{resolve:r}:r)}))}var $={asArgument:function(r){return r},asInjection:function(r){return r}};function G(r,e){return void 0===e&&(e=$),{value:r,xform:e}}var H=function(r){try{return J(r)?Promise.resolve(d({resolve:r,role:{proposer:!0}})):Promise.resolve(d(q({},r,{role:{proposer:!0}})))}catch(r){return Promise.reject(r)}},J=function(r){return"function"==typeof r};function Q(r){return m(q({},"function"==typeof r?{resolve:r}:r,{role:{payer:!0}}))}function W(){return r([p])}function X(e){return r([function(r){return r.message.refBlock=e,o(r)}])}function Z(){return r([v,y("ix.cadence",j.apply(void 0,[].slice.call(arguments)))])}var _=[];function rr(){return r([h,y("ix.cadence",j.apply(void 0,[].slice.call(arguments))),function(r){return r.message.computeLimit=r.message.computeLimit||10,r.message.refBlock=r.message.refBlock||null,r.authorizations=r.authorizations||_,o(r)}])}function er(r){return g("ix.validators",function(e){return Array.isArray(e)?e.push(r):[r]})}function nr(){var r=[].slice.call(arguments);if(r.length>1){var e=r,n=e[0],t=e[1];return nr(function(r,e){var o=e.Bad;return n?(0,e.Ok)(r):o(r,t)})}var i=r[0];return function(r){return i(r,{Ok:o,Bad:k})}}var tr="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function or(r,e,n){if(!r.s){if(n instanceof ir){if(!n.s)return void(n.o=or.bind(null,r,e));1&e&&(e=n.s),n=n.v}if(n&&n.then)return void n.then(or.bind(null,r,e),or.bind(null,r,2));r.s=e,r.v=n;var t=r.o;t&&t(r)}}var ir=function(){function r(){}return r.prototype.then=function(e,n){var t=new r,o=this.s;if(o){var i=1&o?e:n;if(i){try{or(t,1,i(this.v))}catch(r){or(t,2,r)}return t}return this}return this.o=function(r){try{var o=r.v;1&r.s?or(t,1,e?e(o):o):n?or(t,1,n(o)):or(t,2,o)}catch(r){or(t,2,r)}},t},r}();function ur(r){return r instanceof ir&&1&r.s}var cr=function(r){return"function"==typeof r},ar=function(r){return"number"==typeof r},sr=function(r){return"string"==typeof r},fr=function(r,e){if(!r){var n,t=new Error("INVARIANT "+e);throw t.stack=t.stack.split("\n").filter(function(r){return!/at invariant/.test(r)}).join("\n"),(n=console).error.apply(n,["\n\n---\n\n",t,"\n\n"].concat([].slice.call(arguments,2),["\n\n---\n\n"])),t}},lr=function(r){return!(r.role.proposer&&!(sr(r.addr)&&ar(r.keyId)&&ar(r.sequenceNum)&&cr(r.signingFunction))||r.role.payer&&!(sr(r.addr)&&ar(r.keyId)&&cr(r.signingFunction))||r.role.authorizer&&!(sr(r.addr)&&ar(r.keyId)&&cr(r.signingFunction)))},dr=function(r){return void 0===r&&(r=[]),r.filter(Boolean)[0]||null},mr=function(r){return void 0===r&&(r=[]),r.find(function(r){return r.role.proposer})||{}},pr=r([function(r){try{var e=function(){return o(r)};if(!b(r))return Promise.resolve(o(r));var n=function(r,e,n){if("function"==typeof r[tr]){var t,o,i,u=r[tr]();if(function r(n){try{for(;!(t=u.next()).done;)if((n=e(t.value))&&n.then){if(!ur(n))return void n.then(r,i||(i=or.bind(null,o=new ir,2)));n=n.v}o?or(o,1,n):o=n}catch(r){or(o||(o=new ir),2,r)}}(),u.return){var c=function(r){try{t.done||u.return()}catch(r){}return r};if(o&&o.then)return o.then(c,function(r){throw c(r)});c()}return o}if(!("length"in r))throw new TypeError("Object is not iterable");for(var a=[],s=0;s<r.length;s++)a.push(r[s]);return function(r,e,n){var t,o,i=-1;return function n(u){try{for(;++i<r.length;)if((u=e(i))&&u.then){if(!ur(u))return void u.then(n,o||(o=or.bind(null,t=new ir,2)));u=u.v}t?or(t,1,u):t=u}catch(r){or(t||(t=new ir),2,r)}}(),t}(a,function(r){return e(a[r])})}(Object.entries(r.accounts),function(e){var n=e[0],t=e[1];function o(){fr(lr(r.accounts[n]),"Account unable to fulfill role",r.accounts[n])}var i=function(){if(cr(t.resolve))return Promise.resolve(t.resolve(t)).then(function(e){r.accounts[n]=e})}();return i&&i.then?i.then(o):o()});return Promise.resolve(n&&n.then?n.then(e):e())}catch(r){return Promise.reject(r)}},function(r){try{if(!b(r))return Promise.resolve(o(r));for(var e=function(){var e,o,i,u=t[n],c=u.addr+"|"+u.keyId;r.accounts[c]=null!=r.accounts[c]?(e=r.accounts[c],o=q({tempId:c},u),{kind:dr([e.kind,o.kind]),tempId:dr([e.tempId,o.tempId]),addr:dr([e.addr,o.addr]),keyId:(i=[e.keyId,o.keyId],void 0===i&&(i=[]),"number"==typeof i.filter(ar)[0]?i.filter(ar)[0]:null),sequenceNum:"number"==typeof mr([e,o]).sequenceNum?mr([e,o]).sequenceNum:e.sequenceNum,signature:dr([e.signature,o.signature]),signingFunction:dr([e.signingFunction,o.signingFunction]),resolve:dr([e.resolve,o.resolve]),role:{proposer:e.role.proposer||o.role.proposer,authorizer:e.role.authorizer||o.role.authorizer,payer:e.role.payer||o.role.payer,param:e.role.param||o.role.param}}):q({tempId:c},u),r.proposer===u.tempId&&(r.proposer=c),r.payer===u.tempId&&(r.payer=c),r.authorizations=r.authorizations.map(function(r){return r===u.tempId?c:r}),delete r.accounts[u.tempId]},n=0,t=Object.values(r.accounts);n<t.length;n++)e();for(var i=0,u=Object.values(r.accounts);i<u.length;i++){var c=u[i];fr(lr(c),"Account unable to fulfill roles",c)}return Promise.resolve(o(r))}catch(r){return Promise.reject(r)}}]);function vr(r){return console.error("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The resolver sdk.resolveParams is being replaced with the package @onflow/sdk-resolve-cadence\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0002-deprecate-resolve-params-resolver\n\n ============================\n ","font-weight:bold;font-family:monospace;"),S(r)}function yr(r){return{script:r.message.cadence,refBlock:r.message.refBlock||null,gasLimit:r.message.computeLimit,arguments:r.message.arguments.map(function(e){return r.arguments[e].asArgument}),proposalKey:{address:r.accounts[r.proposer].addr,keyId:r.accounts[r.proposer].keyId,sequenceNum:r.accounts[r.proposer].sequenceNum},payer:r.accounts[r.payer].addr,authorizers:r.authorizations.map(function(e){return r.accounts[e].addr})}}var hr=function(r){try{if(!b(r))return Promise.resolve(r);var e=function(r){var e=new Set(r.authorizations);e.add(r.proposer),e.delete(r.payer),e=Array.from(e);var n=new Set([r.payer]);return{insideSigners:e,outsideSigners:n=Array.from(n)}}(r),n=e.outsideSigners;return Promise.resolve(gr(r,e.insideSigners,A(yr(r)))).then(function(e){var t=kr(r,e);return Promise.resolve(gr(r,n,N(q({},yr(r),{payloadSigs:t})))).then(function(e){return kr(r,e),r})})}catch(r){return Promise.reject(r)}},gr=function(r,e,n){void 0===e&&(e=[]);try{return Promise.all(e.map(function(e){try{return Promise.resolve(r.accounts[e].signingFunction({message:n,addr:r.accounts[e].addr,keyId:r.accounts[e].keyId,roles:r.accounts[e].role,interaction:r})).then(function(n){if(n.cid=e,r.accounts[e].addr!==n.addr)throw new Error(e+" — mismatching address in composite signature");if(r.accounts[e].keyId!==n.keyId)throw new Error(e+" — mismatching keyId in composite signature");return n.sig=n.signature,n.address=n.addr,n})}catch(r){return Promise.reject(r)}}))}catch(r){return Promise.reject(r)}};function kr(r,e){for(var n,t=function(r,e){var n;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(n=function(r,e){if(r){if("string"==typeof r)return z(r,void 0);var n=Object.prototype.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?z(r,void 0):void 0}}(r))){n&&(r=n);var t=0;return function(){return t>=r.length?{done:!0}:{done:!1,value:r[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=r[Symbol.iterator]()).next.bind(n)}(e);!(n=t()).done;){var o=n.value;r.accounts[o.cid].signature=o.signature}return e}var br=function(e){try{var n=w(e,"ix.validators",[]);return Promise.resolve(r(e,n.map(function(r){return function(e){return r(e,{Ok:o,Bad:k})}})))}catch(r){return Promise.reject(r)}},wr=function(r){var e=r.node;return function(r){try{return b(r)?r.accounts[r.proposer].sequenceNum?Promise.resolve(o(r)):Promise.resolve(x([T(r.accounts[r.proposer].addr)])).then(function(n){return Promise.resolve(I(n,{node:e})).then(function(e){return Promise.resolve(P(e)).then(function(e){return r.accounts[r.proposer].sequenceNum=e.keys[r.accounts[r.proposer].keyId].sequenceNumber,o(r)})})}):Promise.resolve(o(r))}catch(r){return Promise.reject(r)}}},Ir=function(r){var e=r.node;return function(r){try{return b(r)?r.message.refBlock?Promise.resolve(o(r)):Promise.resolve(x([E()])).then(function(n){return Promise.resolve(I(n,{node:e})).then(function(e){return Promise.resolve(P(e)).then(function(e){return r.message.refBlock=e.id,o(r)})})}):Promise.resolve(o(r))}catch(r){return Promise.reject(r)}}};export{G as arg,Y as args,F as authorization,B as authorizations,x as build,T as getAccount,C as getBlockByHeight,R as getBlockById,L as getEvents,E as getLatestBlock,D as getTransactionStatus,nr as invariant,K as limit,V as param,M as params,Q as payer,W as ping,H as proposer,X as ref,O as resolve,pr as resolveAccounts,vr as resolveParams,wr as resolveProposerSequenceNumber,Ir as resolveRefBlockId,hr as resolveSignatures,br as resolveValidators,Z as script,rr as transaction,er as validator}; | ||
import{pipe as e,interaction as r,makeAuthorizer as n,makeGetAccount as o,Ok as t,makeGetEvents as u,makeGetLatestBlock as i,makeGetBlockById as c,makeGetBlockByHeight as s,makeGetTransactionStatus as a,makeParam as f,makeArgument as l,makeProposer as m,makePayer as v,makePing as d,makeScript as p,put as g,makeTransaction as h,update as k,Bad as y,isTransaction as w}from"@onflow/interaction";export{isBad,isOk,pipe,why}from"@onflow/interaction";import{send as P}from"@onflow/send";export{send}from"@onflow/send";import{decodeResponse as x}from"@onflow/decode";export{decode,decodeResponse}from"@onflow/decode";import{templar as b}from"@qvvg/templar";export{templar as cadence,templar as cdc}from"@qvvg/templar";export{resolveArguments}from"@onflow/sdk-resolve-arguments";export{resolveAccounts}from"@onflow/sdk-resolve-accounts";export{resolveSignatures}from"@onflow/sdk-resolve-signatures";export{resolveValidators}from"@onflow/sdk-resolve-validators";import{resolveCadence as j}from"@onflow/sdk-resolve-cadence";function A(n){return void 0===n&&(n=[]),e(r(),n)}var B=e;function I(){return(I=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function N(r){return void 0===r&&(r=[]),e(r.map(function(e){return n(I({},"function"==typeof e?{resolve:e}:e,{role:{authorizer:!0}}))}))}function O(e,r,n,o){return{addr:e,signingFunction:r,keyId:n,sequenceNum:o}}function q(r){return e([o,function(e){return e.accountAddr=r,t(e)}])}function S(r,n,o){return e([u,function(e){return e.events.eventType=r,t(e)},function(e){return e.events.start=n,t(e)},function(e){return e.events.end=o,t(e)}])}function L(r){return void 0===r&&(r=!1),e([i,function(e){return e.block.isSealed=r,t(e)}])}function T(r){return e([c,function(e){return e.block.id=r,t(e)}])}function z(r){return e([s,function(e){return e.block.height=r,t(e)}])}function D(r){return e([a,function(e){return e.transactionId=r,t(e)}])}function F(r){return e([function(e){return e.message.computeLimit=r,t(e)}])}function R(r){return void 0===r&&(r=[]),e(r.map(function(e){return f("function"==typeof e?{resolve:e}:e)}))}var C={asArgument:function(e){return e},asInjection:function(e){return e}};function K(e,r,n){return void 0===r&&(r=C),void 0===n&&(n=null),{key:n,value:e,xform:r}}function V(r){return void 0===r&&(r=[]),e(r.map(function(e){return l("function"==typeof e?{resolve:e}:e)}))}var Y={asArgument:function(e){return e},asInjection:function(e){return e}};function E(e,r){return void 0===r&&(r=Y),{value:e,xform:r}}var G=function(e){try{return H(e)?Promise.resolve(m({resolve:e,role:{proposer:!0}})):Promise.resolve(m(I({},e,{role:{proposer:!0}})))}catch(e){return Promise.reject(e)}},H=function(e){return"function"==typeof e};function J(e){return v(I({},"function"==typeof e?{resolve:e}:e,{role:{payer:!0}}))}function M(){return e([d])}function Q(r){return e([function(e){return e.message.refBlock=r,t(e)}])}function U(){return e([p,g("ix.cadence",b.apply(void 0,[].slice.call(arguments)))])}var W=[];function X(){return e([h,g("ix.cadence",b.apply(void 0,[].slice.call(arguments))),function(e){return e.message.computeLimit=e.message.computeLimit||10,e.message.refBlock=e.message.refBlock||null,e.authorizations=e.authorizations||W,t(e)}])}function Z(e){return k("ix.validators",function(r){return Array.isArray(r)?r.push(e):[e]})}function $(){var e=[].slice.call(arguments);if(e.length>1){var r=e,n=r[0],o=r[1];return $(function(e,r){var t=r.Bad;return n?(0,r.Ok)(e):t(e,o)})}var u=e[0];return function(e){return u(e,{Ok:t,Bad:y})}}function _(e){return console.error("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The resolver sdk.resolveParams is being replaced with the package @onflow/sdk-resolve-cadence\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0002-deprecate-resolve-params-resolver\n\n ============================\n ","font-weight:bold;font-family:monospace;"),j(e)}var ee=function(e){var r=e.node;return function(e){try{return w(e)?e.accounts[e.proposer].sequenceNum?Promise.resolve(t(e)):Promise.resolve(A([q(e.accounts[e.proposer].addr)])).then(function(n){return Promise.resolve(P(n,{node:r})).then(function(r){return Promise.resolve(x(r)).then(function(r){return e.accounts[e.proposer].sequenceNum=r.keys[e.accounts[e.proposer].keyId].sequenceNumber,t(e)})})}):Promise.resolve(t(e))}catch(e){return Promise.reject(e)}}},re=function(e){var r=e.node;return function(e){try{return w(e)?e.message.refBlock?Promise.resolve(t(e)):Promise.resolve(A([L()])).then(function(n){return Promise.resolve(P(n,{node:r})).then(function(r){return Promise.resolve(x(r)).then(function(r){return e.message.refBlock=r.id,t(e)})})}):Promise.resolve(t(e))}catch(e){return Promise.reject(e)}}};export{E as arg,V as args,O as authorization,N as authorizations,A as build,q as getAccount,z as getBlockByHeight,T as getBlockById,S as getEvents,L as getLatestBlock,D as getTransactionStatus,$ as invariant,F as limit,K as param,R as params,J as payer,M as ping,G as proposer,Q as ref,B as resolve,_ as resolveParams,ee as resolveProposerSequenceNumber,re as resolveRefBlockId,U as script,X as transaction,Z as validator}; | ||
//# sourceMappingURL=sdk.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@onflow/interaction"),require("@onflow/send"),require("@onflow/decode"),require("@qvvg/templar"),require("@onflow/sdk-resolve-arguments"),require("@onflow/sdk-resolve-cadence"),require("@onflow/encode")):"function"==typeof define&&define.amd?define(["exports","@onflow/interaction","@onflow/send","@onflow/decode","@qvvg/templar","@onflow/sdk-resolve-arguments","@onflow/sdk-resolve-cadence","@onflow/encode"],n):n((e=e||self).sdk={},e.interaction,e.send,e.decode,e.templar,e.sdkResolveArguments,e.sdkResolveCadence,e.encode)}(this,function(e,n,r,t,o,i,u,c){function a(e){return void 0===e&&(e=[]),n.pipe(n.interaction(),e)}var s=n.pipe;function l(){return(l=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e}).apply(this,arguments)}function f(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=new Array(n);r<n;r++)t[r]=e[r];return t}function d(e){return n.pipe([n.makeGetAccount,function(r){return r.accountAddr=e,n.Ok(r)}])}function p(e){return void 0===e&&(e=!1),n.pipe([n.makeGetLatestBlock,function(r){return r.block.isSealed=e,n.Ok(r)}])}var m={asArgument:function(e){return e},asInjection:function(e){return e}},v={asArgument:function(e){return e},asInjection:function(e){return e}},y=[],g="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function h(e,n,r){if(!e.s){if(r instanceof k){if(!r.s)return void(r.o=h.bind(null,e,n));1&n&&(n=r.s),r=r.v}if(r&&r.then)return void r.then(h.bind(null,e,n),h.bind(null,e,2));e.s=n,e.v=r;var t=e.o;t&&t(e)}}var k=function(){function e(){}return e.prototype.then=function(n,r){var t=new e,o=this.s;if(o){var i=1&o?n:r;if(i){try{h(t,1,i(this.v))}catch(e){h(t,2,e)}return t}return this}return this.o=function(e){try{var o=e.v;1&e.s?h(t,1,n?n(o):o):r?h(t,1,r(o)):h(t,2,o)}catch(e){h(t,2,e)}},t},e}();function b(e){return e instanceof k&&1&e.s}var P=function(e){return"function"==typeof e},O=function(e){return"number"==typeof e},w=function(e){return"string"==typeof e},I=function(e,n){if(!e){var r,t=new Error("INVARIANT "+n);throw t.stack=t.stack.split("\n").filter(function(e){return!/at invariant/.test(e)}).join("\n"),(r=console).error.apply(r,["\n\n---\n\n",t,"\n\n"].concat([].slice.call(arguments,2),["\n\n---\n\n"])),t}},j=function(e){return!(e.role.proposer&&!(w(e.addr)&&O(e.keyId)&&O(e.sequenceNum)&&P(e.signingFunction))||e.role.payer&&!(w(e.addr)&&O(e.keyId)&&P(e.signingFunction))||e.role.authorizer&&!(w(e.addr)&&O(e.keyId)&&P(e.signingFunction)))},A=function(e){return void 0===e&&(e=[]),e.filter(Boolean)[0]||null},S=function(e){return void 0===e&&(e=[]),e.find(function(e){return e.role.proposer})||{}},B=n.pipe([function(e){try{var r=function(){return n.Ok(e)};if(!n.isTransaction(e))return Promise.resolve(n.Ok(e));var t=function(e,n,r){if("function"==typeof e[g]){var t,o,i,u=e[g]();if(function e(r){try{for(;!(t=u.next()).done;)if((r=n(t.value))&&r.then){if(!b(r))return void r.then(e,i||(i=h.bind(null,o=new k,2)));r=r.v}o?h(o,1,r):o=r}catch(e){h(o||(o=new k),2,e)}}(),u.return){var c=function(e){try{t.done||u.return()}catch(e){}return e};if(o&&o.then)return o.then(c,function(e){throw c(e)});c()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var a=[],s=0;s<e.length;s++)a.push(e[s]);return function(e,n,r){var t,o,i=-1;return function r(u){try{for(;++i<e.length;)if((u=n(i))&&u.then){if(!b(u))return void u.then(r,o||(o=h.bind(null,t=new k,2)));u=u.v}t?h(t,1,u):t=u}catch(e){h(t||(t=new k),2,e)}}(),t}(a,function(e){return n(a[e])})}(Object.entries(e.accounts),function(n){var r=n[0],t=n[1];function o(){I(j(e.accounts[r]),"Account unable to fulfill role",e.accounts[r])}var i=function(){if(P(t.resolve))return Promise.resolve(t.resolve(t)).then(function(n){e.accounts[r]=n})}();return i&&i.then?i.then(o):o()});return Promise.resolve(t&&t.then?t.then(r):r())}catch(e){return Promise.reject(e)}},function(e){try{if(!n.isTransaction(e))return Promise.resolve(n.Ok(e));for(var r=function(){var n,r,i,u=o[t],c=u.addr+"|"+u.keyId;e.accounts[c]=null!=e.accounts[c]?(n=e.accounts[c],r=l({tempId:c},u),{kind:A([n.kind,r.kind]),tempId:A([n.tempId,r.tempId]),addr:A([n.addr,r.addr]),keyId:(i=[n.keyId,r.keyId],void 0===i&&(i=[]),"number"==typeof i.filter(O)[0]?i.filter(O)[0]:null),sequenceNum:"number"==typeof S([n,r]).sequenceNum?S([n,r]).sequenceNum:n.sequenceNum,signature:A([n.signature,r.signature]),signingFunction:A([n.signingFunction,r.signingFunction]),resolve:A([n.resolve,r.resolve]),role:{proposer:n.role.proposer||r.role.proposer,authorizer:n.role.authorizer||r.role.authorizer,payer:n.role.payer||r.role.payer,param:n.role.param||r.role.param}}):l({tempId:c},u),e.proposer===u.tempId&&(e.proposer=c),e.payer===u.tempId&&(e.payer=c),e.authorizations=e.authorizations.map(function(e){return e===u.tempId?c:e}),delete e.accounts[u.tempId]},t=0,o=Object.values(e.accounts);t<o.length;t++)r();for(var i=0,u=Object.values(e.accounts);i<u.length;i++){var c=u[i];I(j(c),"Account unable to fulfill roles",c)}return Promise.resolve(n.Ok(e))}catch(e){return Promise.reject(e)}}]);function q(e){return{script:e.message.cadence,refBlock:e.message.refBlock||null,gasLimit:e.message.computeLimit,arguments:e.message.arguments.map(function(n){return e.arguments[n].asArgument}),proposalKey:{address:e.accounts[e.proposer].addr,keyId:e.accounts[e.proposer].keyId,sequenceNum:e.accounts[e.proposer].sequenceNum},payer:e.accounts[e.payer].addr,authorizers:e.authorizations.map(function(n){return e.accounts[n].addr})}}var N=function(e,n,r){void 0===n&&(n=[]);try{return Promise.all(n.map(function(n){try{return Promise.resolve(e.accounts[n].signingFunction({message:r,addr:e.accounts[n].addr,keyId:e.accounts[n].keyId,roles:e.accounts[n].role,interaction:e})).then(function(r){if(r.cid=n,e.accounts[n].addr!==r.addr)throw new Error(n+" — mismatching address in composite signature");if(e.accounts[n].keyId!==r.keyId)throw new Error(n+" — mismatching keyId in composite signature");return r.sig=r.signature,r.address=r.addr,r})}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}};function T(e,n){for(var r,t=function(e,n){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,n){if(e){if("string"==typeof e)return f(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,void 0):void 0}}(e))){r&&(e=r);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}(n);!(r=t()).done;){var o=r.value;e.accounts[o.cid].signature=o.signature}return n}Object.defineProperty(e,"isBad",{enumerable:!0,get:function(){return n.isBad}}),Object.defineProperty(e,"isOk",{enumerable:!0,get:function(){return n.isOk}}),Object.defineProperty(e,"pipe",{enumerable:!0,get:function(){return n.pipe}}),Object.defineProperty(e,"why",{enumerable:!0,get:function(){return n.why}}),Object.defineProperty(e,"send",{enumerable:!0,get:function(){return r.send}}),Object.defineProperty(e,"decode",{enumerable:!0,get:function(){return t.decode}}),Object.defineProperty(e,"decodeResponse",{enumerable:!0,get:function(){return t.decodeResponse}}),Object.defineProperty(e,"cadence",{enumerable:!0,get:function(){return o.templar}}),Object.defineProperty(e,"cdc",{enumerable:!0,get:function(){return o.templar}}),Object.defineProperty(e,"resolveArguments",{enumerable:!0,get:function(){return i.resolveArguments}}),e.arg=function(e,n){return void 0===n&&(n=v),{value:e,xform:n}},e.args=function(e){return void 0===e&&(e=[]),n.pipe(e.map(function(e){return n.makeArgument("function"==typeof e?{resolve:e}:e)}))},e.authorization=function(e,n,r,t){return{addr:e,signingFunction:n,keyId:r,sequenceNum:t}},e.authorizations=function(e){return void 0===e&&(e=[]),n.pipe(e.map(function(e){return n.makeAuthorizer(l({},"function"==typeof e?{resolve:e}:e,{role:{authorizer:!0}}))}))},e.build=a,e.getAccount=d,e.getBlockByHeight=function(e){return n.pipe([n.makeGetBlockByHeight,function(r){return r.block.height=e,n.Ok(r)}])},e.getBlockById=function(e){return n.pipe([n.makeGetBlockById,function(r){return r.block.id=e,n.Ok(r)}])},e.getEvents=function(e,r,t){return n.pipe([n.makeGetEvents,function(r){return r.events.eventType=e,n.Ok(r)},function(e){return e.events.start=r,n.Ok(e)},function(e){return e.events.end=t,n.Ok(e)}])},e.getLatestBlock=p,e.getTransactionStatus=function(e){return n.pipe([n.makeGetTransactionStatus,function(r){return r.transactionId=e,n.Ok(r)}])},e.invariant=function e(){var r=[].slice.call(arguments);if(r.length>1){var t=r,o=t[0],i=t[1];return e(function(e,n){var r=n.Bad;return o?(0,n.Ok)(e):r(e,i)})}var u=r[0];return function(e){return u(e,{Ok:n.Ok,Bad:n.Bad})}},e.limit=function(e){return n.pipe([function(r){return r.message.computeLimit=e,n.Ok(r)}])},e.param=function(e,n,r){return void 0===n&&(n=m),void 0===r&&(r=null),{key:r,value:e,xform:n}},e.params=function(e){return void 0===e&&(e=[]),n.pipe(e.map(function(e){return n.makeParam("function"==typeof e?{resolve:e}:e)}))},e.payer=function(e){return n.makePayer(l({},"function"==typeof e?{resolve:e}:e,{role:{payer:!0}}))},e.ping=function(){return n.pipe([n.makePing])},e.proposer=function(e){try{return Promise.resolve(n.makeProposer("function"==typeof e?{resolve:e,role:{proposer:!0}}:l({},e,{role:{proposer:!0}})))}catch(e){return Promise.reject(e)}},e.ref=function(e){return n.pipe([function(r){return r.message.refBlock=e,n.Ok(r)}])},e.resolve=s,e.resolveAccounts=B,e.resolveParams=function(e){return console.error("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The resolver sdk.resolveParams is being replaced with the package @onflow/sdk-resolve-cadence\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0002-deprecate-resolve-params-resolver\n\n ============================\n ","font-weight:bold;font-family:monospace;"),u.resolveCadence(e)},e.resolveProposerSequenceNumber=function(e){var o=e.node;return function(e){try{return n.isTransaction(e)?e.accounts[e.proposer].sequenceNum?Promise.resolve(n.Ok(e)):Promise.resolve(a([d(e.accounts[e.proposer].addr)])).then(function(i){return Promise.resolve(r.send(i,{node:o})).then(function(r){return Promise.resolve(t.decodeResponse(r)).then(function(r){return e.accounts[e.proposer].sequenceNum=r.keys[e.accounts[e.proposer].keyId].sequenceNumber,n.Ok(e)})})}):Promise.resolve(n.Ok(e))}catch(e){return Promise.reject(e)}}},e.resolveRefBlockId=function(e){var o=e.node;return function(e){try{return n.isTransaction(e)?e.message.refBlock?Promise.resolve(n.Ok(e)):Promise.resolve(a([p()])).then(function(i){return Promise.resolve(r.send(i,{node:o})).then(function(r){return Promise.resolve(t.decodeResponse(r)).then(function(r){return e.message.refBlock=r.id,n.Ok(e)})})}):Promise.resolve(n.Ok(e))}catch(e){return Promise.reject(e)}}},e.resolveSignatures=function(e){try{if(!n.isTransaction(e))return Promise.resolve(e);var r=function(e){var n=new Set(e.authorizations);n.add(e.proposer),n.delete(e.payer),n=Array.from(n);var r=new Set([e.payer]);return{insideSigners:n,outsideSigners:r=Array.from(r)}}(e),t=r.outsideSigners;return Promise.resolve(N(e,r.insideSigners,c.encodeTransactionPayload(q(e)))).then(function(n){var r=T(e,n);return Promise.resolve(N(e,t,c.encodeTransactionEnvelope(l({},q(e),{payloadSigs:r})))).then(function(n){return T(e,n),e})})}catch(e){return Promise.reject(e)}},e.resolveValidators=function(e){try{var r=n.get(e,"ix.validators",[]);return Promise.resolve(n.pipe(e,r.map(function(e){return function(r){return e(r,{Ok:n.Ok,Bad:n.Bad})}})))}catch(e){return Promise.reject(e)}},e.script=function(){return n.pipe([n.makeScript,n.put("ix.cadence",o.templar.apply(void 0,[].slice.call(arguments)))])},e.transaction=function(){return n.pipe([n.makeTransaction,n.put("ix.cadence",o.templar.apply(void 0,[].slice.call(arguments))),function(e){return e.message.computeLimit=e.message.computeLimit||10,e.message.refBlock=e.message.refBlock||null,e.authorizations=e.authorizations||y,n.Ok(e)}])},e.validator=function(e){return n.update("ix.validators",function(n){return Array.isArray(n)?n.push(e):[e]})}}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@onflow/interaction"),require("@onflow/send"),require("@onflow/decode"),require("@qvvg/templar"),require("@onflow/sdk-resolve-arguments"),require("@onflow/sdk-resolve-accounts"),require("@onflow/sdk-resolve-signatures"),require("@onflow/sdk-resolve-validators"),require("@onflow/sdk-resolve-cadence")):"function"==typeof define&&define.amd?define(["exports","@onflow/interaction","@onflow/send","@onflow/decode","@qvvg/templar","@onflow/sdk-resolve-arguments","@onflow/sdk-resolve-accounts","@onflow/sdk-resolve-signatures","@onflow/sdk-resolve-validators","@onflow/sdk-resolve-cadence"],n):n((e=e||self).sdk={},e.interaction,e.send,e.decode,e.templar,e.sdkResolveArguments,e.sdkResolveAccounts,e.sdkResolveSignatures,e.sdkResolveValidators,e.sdkResolveCadence)}(this,function(e,n,r,t,o,i,u,s,c,a){function l(e){return void 0===e&&(e=[]),n.pipe(n.interaction(),e)}var f=n.pipe;function d(){return(d=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e}).apply(this,arguments)}function p(e){return n.pipe([n.makeGetAccount,function(r){return r.accountAddr=e,n.Ok(r)}])}function m(e){return void 0===e&&(e=!1),n.pipe([n.makeGetLatestBlock,function(r){return r.block.isSealed=e,n.Ok(r)}])}var v={asArgument:function(e){return e},asInjection:function(e){return e}},k={asArgument:function(e){return e},asInjection:function(e){return e}},g=[];Object.defineProperty(e,"isBad",{enumerable:!0,get:function(){return n.isBad}}),Object.defineProperty(e,"isOk",{enumerable:!0,get:function(){return n.isOk}}),Object.defineProperty(e,"pipe",{enumerable:!0,get:function(){return n.pipe}}),Object.defineProperty(e,"why",{enumerable:!0,get:function(){return n.why}}),Object.defineProperty(e,"send",{enumerable:!0,get:function(){return r.send}}),Object.defineProperty(e,"decode",{enumerable:!0,get:function(){return t.decode}}),Object.defineProperty(e,"decodeResponse",{enumerable:!0,get:function(){return t.decodeResponse}}),Object.defineProperty(e,"cadence",{enumerable:!0,get:function(){return o.templar}}),Object.defineProperty(e,"cdc",{enumerable:!0,get:function(){return o.templar}}),Object.defineProperty(e,"resolveArguments",{enumerable:!0,get:function(){return i.resolveArguments}}),Object.defineProperty(e,"resolveAccounts",{enumerable:!0,get:function(){return u.resolveAccounts}}),Object.defineProperty(e,"resolveSignatures",{enumerable:!0,get:function(){return s.resolveSignatures}}),Object.defineProperty(e,"resolveValidators",{enumerable:!0,get:function(){return c.resolveValidators}}),e.arg=function(e,n){return void 0===n&&(n=k),{value:e,xform:n}},e.args=function(e){return void 0===e&&(e=[]),n.pipe(e.map(function(e){return n.makeArgument("function"==typeof e?{resolve:e}:e)}))},e.authorization=function(e,n,r,t){return{addr:e,signingFunction:n,keyId:r,sequenceNum:t}},e.authorizations=function(e){return void 0===e&&(e=[]),n.pipe(e.map(function(e){return n.makeAuthorizer(d({},"function"==typeof e?{resolve:e}:e,{role:{authorizer:!0}}))}))},e.build=l,e.getAccount=p,e.getBlockByHeight=function(e){return n.pipe([n.makeGetBlockByHeight,function(r){return r.block.height=e,n.Ok(r)}])},e.getBlockById=function(e){return n.pipe([n.makeGetBlockById,function(r){return r.block.id=e,n.Ok(r)}])},e.getEvents=function(e,r,t){return n.pipe([n.makeGetEvents,function(r){return r.events.eventType=e,n.Ok(r)},function(e){return e.events.start=r,n.Ok(e)},function(e){return e.events.end=t,n.Ok(e)}])},e.getLatestBlock=m,e.getTransactionStatus=function(e){return n.pipe([n.makeGetTransactionStatus,function(r){return r.transactionId=e,n.Ok(r)}])},e.invariant=function e(){var r=[].slice.call(arguments);if(r.length>1){var t=r,o=t[0],i=t[1];return e(function(e,n){var r=n.Bad;return o?(0,n.Ok)(e):r(e,i)})}var u=r[0];return function(e){return u(e,{Ok:n.Ok,Bad:n.Bad})}},e.limit=function(e){return n.pipe([function(r){return r.message.computeLimit=e,n.Ok(r)}])},e.param=function(e,n,r){return void 0===n&&(n=v),void 0===r&&(r=null),{key:r,value:e,xform:n}},e.params=function(e){return void 0===e&&(e=[]),n.pipe(e.map(function(e){return n.makeParam("function"==typeof e?{resolve:e}:e)}))},e.payer=function(e){return n.makePayer(d({},"function"==typeof e?{resolve:e}:e,{role:{payer:!0}}))},e.ping=function(){return n.pipe([n.makePing])},e.proposer=function(e){try{return Promise.resolve(n.makeProposer("function"==typeof e?{resolve:e,role:{proposer:!0}}:d({},e,{role:{proposer:!0}})))}catch(e){return Promise.reject(e)}},e.ref=function(e){return n.pipe([function(r){return r.message.refBlock=e,n.Ok(r)}])},e.resolve=f,e.resolveParams=function(e){return console.error("\n %cFCL/SDK Deprecation Notice\n ============================\n\n The resolver sdk.resolveParams is being replaced with the package @onflow/sdk-resolve-cadence\n You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0002-deprecate-resolve-params-resolver\n\n ============================\n ","font-weight:bold;font-family:monospace;"),a.resolveCadence(e)},e.resolveProposerSequenceNumber=function(e){var o=e.node;return function(e){try{return n.isTransaction(e)?e.accounts[e.proposer].sequenceNum?Promise.resolve(n.Ok(e)):Promise.resolve(l([p(e.accounts[e.proposer].addr)])).then(function(i){return Promise.resolve(r.send(i,{node:o})).then(function(r){return Promise.resolve(t.decodeResponse(r)).then(function(r){return e.accounts[e.proposer].sequenceNum=r.keys[e.accounts[e.proposer].keyId].sequenceNumber,n.Ok(e)})})}):Promise.resolve(n.Ok(e))}catch(e){return Promise.reject(e)}}},e.resolveRefBlockId=function(e){var o=e.node;return function(e){try{return n.isTransaction(e)?e.message.refBlock?Promise.resolve(n.Ok(e)):Promise.resolve(l([m()])).then(function(i){return Promise.resolve(r.send(i,{node:o})).then(function(r){return Promise.resolve(t.decodeResponse(r)).then(function(r){return e.message.refBlock=r.id,n.Ok(e)})})}):Promise.resolve(n.Ok(e))}catch(e){return Promise.reject(e)}}},e.script=function(){return n.pipe([n.makeScript,n.put("ix.cadence",o.templar.apply(void 0,[].slice.call(arguments)))])},e.transaction=function(){return n.pipe([n.makeTransaction,n.put("ix.cadence",o.templar.apply(void 0,[].slice.call(arguments))),function(e){return e.message.computeLimit=e.message.computeLimit||10,e.message.refBlock=e.message.refBlock||null,e.authorizations=e.authorizations||g,n.Ok(e)}])},e.validator=function(e){return n.update("ix.validators",function(n){return Array.isArray(n)?n.push(e):[e]})}}); | ||
//# sourceMappingURL=sdk.umd.js.map |
{ | ||
"name": "@onflow/sdk", | ||
"version": "0.0.34", | ||
"version": "0.0.35", | ||
"description": "Flow SDK", | ||
@@ -38,9 +38,11 @@ "license": "Apache-2.0", | ||
"@onflow/decode": "0.0.7", | ||
"@onflow/encode": "0.0.4", | ||
"@onflow/interaction": "0.0.10", | ||
"@onflow/sdk-resolve-accounts": "0.0.0", | ||
"@onflow/sdk-resolve-arguments": "0.0.1", | ||
"@onflow/sdk-resolve-cadence": "0.0.1", | ||
"@onflow/send": "0.0.21", | ||
"@onflow/sdk-resolve-signatures": "0.0.0", | ||
"@onflow/sdk-resolve-validators": "0.0.0", | ||
"@onflow/send": "0.0.22", | ||
"@qvvg/templar": "0.0.1" | ||
} | ||
} |
@@ -33,8 +33,9 @@ // Base | ||
// resolvers | ||
export {resolveAccounts} from "./resolve/resolve-accounts" | ||
export {resolveArguments} from "./resolve/resolve-arguments" | ||
export {resolveArguments} from "@onflow/sdk-resolve-arguments" | ||
export {resolveAccounts} from "@onflow/sdk-resolve-accounts" | ||
export {resolveSignatures} from "@onflow/sdk-resolve-signatures" | ||
export {resolveValidators} from "@onflow/sdk-resolve-validators" | ||
export {resolveParams} from "./resolve/resolve-params" | ||
export {resolveSignatures} from "./resolve/resolve-signatures" | ||
export {resolveValidators} from "./resolve/resolve-validators" | ||
export {resolveProposerSequenceNumber} from "./resolve/resolve-proposer-sequence-number" | ||
export {resolveRefBlockId} from "./resolve/resolve-ref-block-id" |
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
119654
9
38
482
+ Added@onflow/sdk-resolve-accounts@0.0.0(transitive)
+ Added@onflow/sdk-resolve-signatures@0.0.0(transitive)
+ Added@onflow/sdk-resolve-validators@0.0.0(transitive)
+ Added@onflow/send@0.0.22(transitive)
- Removed@onflow/encode@0.0.4
- Removed@onflow/send@0.0.21(transitive)
Updated@onflow/send@0.0.22