@frak-labs/nexus-sdk 0.0.22 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle/bundle.js +4 -4
- package/dist/{chunk-Q3SIIAX2.js → chunk-4Q2OHGWX.js} +132 -23
- package/dist/{chunk-4CWA7EWX.cjs → chunk-BHZDDGW6.cjs} +139 -30
- package/dist/core/actions/index.cjs +4 -2
- package/dist/core/actions/index.d.cts +43 -4
- package/dist/core/actions/index.d.ts +43 -4
- package/dist/core/actions/index.js +5 -3
- package/dist/react/index.cjs +12 -12
- package/dist/react/index.js +7 -7
- package/package.json +1 -1
package/dist/bundle/bundle.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";var NexusSDK=(()=>{var Or=Object.create;var Ae=Object.defineProperty;var jr=Object.getOwnPropertyDescriptor;var Vr=Object.getOwnPropertyNames;var Wr=Object.getPrototypeOf,qr=Object.prototype.hasOwnProperty;var Ht=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var M=(e,t)=>()=>(e&&(t=e(e=0)),t);var zt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Kr=(e,t)=>{for(var r in t)Ae(e,r,{get:t[r],enumerable:!0})},Lt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Vr(t))!qr.call(e,a)&&a!==r&&Ae(e,a,{get:()=>t[a],enumerable:!(n=jr(t,a))||n.enumerable});return e};var Ce=(e,t,r)=>(r=e!=null?Or(Wr(e)):{},Lt(t||!e||!e.__esModule?Ae(r,"default",{value:e,enumerable:!0}):r,e)),Jr=e=>Lt(Ae({},"__esModule",{value:!0}),e);var ot=zt((fe,rt)=>{"use strict";(function(e,t){if(typeof fe=="object"&&typeof rt=="object")rt.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var r=t();for(var n in r)(typeof fe=="object"?fe:e)[n]=r[n]}})(fe,()=>(()=>{"use strict";var e={48:function(r,n,a){var f=this&&this.__awaiter||function(i,b,o,c){return new(o||(o=Promise))(function(I,A){function m(s){try{z(c.next(s))}catch(u){A(u)}}function E(s){try{z(c.throw(s))}catch(u){A(u)}}function z(s){var u;s.done?I(s.value):(u=s.value,u instanceof o?u:new o(function(v){v(u)})).then(m,E)}z((c=c.apply(i,b||[])).next())})},l=this&&this.__generator||function(i,b){var o,c,I,A,m={label:0,sent:function(){if(1&I[0])throw I[1];return I[1]},trys:[],ops:[]};return A={next:E(0),throw:E(1),return:E(2)},typeof Symbol=="function"&&(A[Symbol.iterator]=function(){return this}),A;function E(z){return function(s){return function(u){if(o)throw new TypeError("Generator is already executing.");for(;A&&(A=0,u[0]&&(m=0)),m;)try{if(o=1,c&&(I=2&u[0]?c.return:u[0]?c.throw||((I=c.return)&&I.call(c),0):c.next)&&!(I=I.call(c,u[1])).done)return I;switch(c=0,I&&(u=[2&u[0],I.value]),u[0]){case 0:case 1:I=u;break;case 4:return m.label++,{value:u[1],done:!1};case 5:m.label++,c=u[1],u=[0];continue;case 7:u=m.ops.pop(),m.trys.pop();continue;default:if(!((I=(I=m.trys).length>0&&I[I.length-1])||u[0]!==6&&u[0]!==2)){m=0;continue}if(u[0]===3&&(!I||u[1]>I[0]&&u[1]<I[3])){m.label=u[1];break}if(u[0]===6&&m.label<I[1]){m.label=I[1],I=u;break}if(I&&m.label<I[2]){m.label=I[2],m.ops.push(u);break}I[2]&&m.ops.pop(),m.trys.pop();continue}u=b.call(i,m)}catch(v){u=[6,v],c=0}finally{o=I=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([z,s])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.decompressFromUTF16=n.compressToUTF16=n.decompressFromBase64=n.compressToBase64=void 0;var S=a(304),p=a(134),T=new S.CompressorImpl,h=new p.DecompressorImpl,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",x={};n.compressToBase64=function(i){return f(this,void 0,void 0,function(){var b;return l(this,function(o){switch(o.label){case 0:return i===null?[2,""]:[4,T.compress(i,6,function(c){return d.charAt(c)})];case 1:switch((b=o.sent()).length%4){default:case 0:return[2,b];case 1:return[2,b+"==="];case 2:return[2,b+"=="];case 3:return[2,b+"="]}return[2]}})})},n.decompressFromBase64=function(i){return f(this,void 0,void 0,function(){return l(this,function(b){switch(b.label){case 0:return i===null?[2,""]:i===""?[2,null]:[4,h.decompress(i.length,32,function(o){return function(c,I){if(!x[c]){x[c]={};for(var A=0;A<c.length;A++)x[c][c.charAt(A)]=A}return x[c][I]}(d,i.charAt(o))})];case 1:return[2,b.sent()]}})})},n.compressToUTF16=function(i){return f(this,void 0,void 0,function(){return l(this,function(b){switch(b.label){case 0:return i===null?[2,""]:[4,T.compress(i,15,function(o){return String.fromCharCode(o+32)})];case 1:return[2,b.sent()+" "]}})})},n.decompressFromUTF16=function(i){return f(this,void 0,void 0,function(){return l(this,function(b){switch(b.label){case 0:return i===null?[2,""]:i===""?[2,null]:[4,h.decompress(i.length,16384,function(o){return i.charCodeAt(o)-32})];case 1:return[2,b.sent()]}})})}},304:function(r,n,a){var f=this&&this.__awaiter||function(h,d,x,i){return new(x||(x=Promise))(function(b,o){function c(m){try{A(i.next(m))}catch(E){o(E)}}function I(m){try{A(i.throw(m))}catch(E){o(E)}}function A(m){var E;m.done?b(m.value):(E=m.value,E instanceof x?E:new x(function(z){z(E)})).then(c,I)}A((i=i.apply(h,d||[])).next())})},l=this&&this.__generator||function(h,d){var x,i,b,o,c={label:0,sent:function(){if(1&b[0])throw b[1];return b[1]},trys:[],ops:[]};return o={next:I(0),throw:I(1),return:I(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function I(A){return function(m){return function(E){if(x)throw new TypeError("Generator is already executing.");for(;o&&(o=0,E[0]&&(c=0)),c;)try{if(x=1,i&&(b=2&E[0]?i.return:E[0]?i.throw||((b=i.return)&&b.call(i),0):i.next)&&!(b=b.call(i,E[1])).done)return b;switch(i=0,b&&(E=[2&E[0],b.value]),E[0]){case 0:case 1:b=E;break;case 4:return c.label++,{value:E[1],done:!1};case 5:c.label++,i=E[1],E=[0];continue;case 7:E=c.ops.pop(),c.trys.pop();continue;default:if(!((b=(b=c.trys).length>0&&b[b.length-1])||E[0]!==6&&E[0]!==2)){c=0;continue}if(E[0]===3&&(!b||E[1]>b[0]&&E[1]<b[3])){c.label=E[1];break}if(E[0]===6&&c.label<b[1]){c.label=b[1],b=E;break}if(b&&c.label<b[2]){c.label=b[2],c.ops.push(E);break}b[2]&&c.ops.pop(),c.trys.pop();continue}E=d.call(h,c)}catch(z){E=[6,z],i=0}finally{x=b=0}if(5&E[0])throw E[1];return{value:E[0]?E[1]:void 0,done:!0}}([A,m])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.CompressorImpl=void 0;var S=a(658),p=[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],T=function(){function h(){}return h.writeValueToData=function(d,x,i,b,o){if(i%4!=0||d.dataPosition+i>b-1)for(var c=0;c<i;c++)d.dataVal=d.dataVal<<1|1&x,d.dataPosition==b-1?(d.dataPosition=0,d.data.push(o(d.dataVal)),d.dataVal=0):d.dataPosition++,x>>=1;else d.dataVal<<=i,d.dataVal|=function(I,A){for(var m=0,E=0;E<A;++E)m<<=4,m|=p[15&I],I>>=4;return m}(x,i/4),d.dataPosition+=i},h.writeWToDataVal=function(d,x,i){d.dictionaryToCreate.has(d.w)?(d.w.charCodeAt(0)<256?(h.writeValueToData(d,0,d.numBits,x,i),h.writeValueToData(d,d.w.charCodeAt(0),8,x,i)):(h.writeValueToData(d,1,d.numBits,x,i),h.writeValueToData(d,d.w.charCodeAt(0),16,x,i)),d.enlargeIn--,d.enlargeIn==0&&(d.enlargeIn=Math.pow(2,d.numBits),d.numBits++),d.dictionaryToCreate.delete(d.w)):h.writeValueToData(d,d.dictionary.get(d.w),d.numBits,x,i),d.enlargeIn--,d.enlargeIn==0&&(d.enlargeIn=Math.pow(2,d.numBits),d.numBits++)},h.loopIteration=function(d,x,i,b,o){var c=d.charAt(x);o.dictionary.has(c)||(o.dictionary.set(c,o.dictSize++),o.dictionaryToCreate.set(c,!0));var I=o.w+c;o.dictionary.has(I)?o.w=I:(this.writeWToDataVal(o,i,b),o.dictionary.set(I,o.dictSize++),o.w=String(c))},h.prototype.compress=function(d,x,i){var b=this;return new Promise(function(o){return f(b,void 0,void 0,function(){var c,I;return l(this,function(A){switch(A.label){case 0:if(d==null)return o(""),[2];c={data:[],dataPosition:0,dataVal:0,dictionary:new Map,dictionaryToCreate:new Map,dictSize:3,enlargeIn:2,numBits:2,w:""},I=0,A.label=1;case 1:return I<d.length?(h.loopIteration(d,I,x,i,c),I%1e4!=0?[3,3]:[4,(0,S.wait)()]):[3,4];case 2:A.sent(),A.label=3;case 3:return I+=1,[3,1];case 4:return c.w!==""&&h.writeWToDataVal(c,x,i),h.writeValueToData(c,2,c.numBits,x,i),c.dataVal<<=x-c.dataPosition,c.data.push(i(c.dataVal)),o(c.data.join("")),[2]}})})})},h}();n.CompressorImpl=T},134:function(r,n,a){var f=this&&this.__awaiter||function(T,h,d,x){return new(d||(d=Promise))(function(i,b){function o(A){try{I(x.next(A))}catch(m){b(m)}}function c(A){try{I(x.throw(A))}catch(m){b(m)}}function I(A){var m;A.done?i(A.value):(m=A.value,m instanceof d?m:new d(function(E){E(m)})).then(o,c)}I((x=x.apply(T,h||[])).next())})},l=this&&this.__generator||function(T,h){var d,x,i,b,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return b={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(b[Symbol.iterator]=function(){return this}),b;function c(I){return function(A){return function(m){if(d)throw new TypeError("Generator is already executing.");for(;b&&(b=0,m[0]&&(o=0)),o;)try{if(d=1,x&&(i=2&m[0]?x.return:m[0]?x.throw||((i=x.return)&&i.call(x),0):x.next)&&!(i=i.call(x,m[1])).done)return i;switch(x=0,i&&(m=[2&m[0],i.value]),m[0]){case 0:case 1:i=m;break;case 4:return o.label++,{value:m[1],done:!1};case 5:o.label++,x=m[1],m=[0];continue;case 7:m=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||m[0]!==6&&m[0]!==2)){o=0;continue}if(m[0]===3&&(!i||m[1]>i[0]&&m[1]<i[3])){o.label=m[1];break}if(m[0]===6&&o.label<i[1]){o.label=i[1],i=m;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(m);break}i[2]&&o.ops.pop(),o.trys.pop();continue}m=h.call(T,o)}catch(E){m=[6,E],x=0}finally{d=i=0}if(5&m[0])throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}([I,A])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.DecompressorImpl=void 0;var S=a(658),p=function(){function T(){}return T.prototype.decompress=function(h,d,x){var i=this;return new Promise(function(b){return f(i,void 0,void 0,function(){var o,c,I;return l(this,function(A){switch(A.label){case 0:for(o={bits:0,c:null,dataIndex:1,dataPosition:d,dataVal:x(0),dictionary:new Map,dictSize:4,enlargeIn:4,entry:"",maxPower:Math.pow(2,2),numBits:3,power:1,resb:null,result:[],w:null},c=0;c<3;c+=1)o.dictionary.set(c,c);for(;o.power!=o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition==0&&(o.dataPosition=d,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;switch(o.bits){case 0:for(o.bits=0,o.maxPower=Math.pow(2,8),o.power=1;o.power!=o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition==0&&(o.dataPosition=d,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;o.c=String.fromCharCode(o.bits);break;case 1:for(o.bits=0,o.maxPower=Math.pow(2,16),o.power=1;o.power!==o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition===0&&(o.dataPosition=d,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;o.c=String.fromCharCode(o.bits);break;case 2:return b(""),[2]}o.dictionary[3]=o.c,o.w=o.c,o.result.push(o.c),I=1,A.label=1;case 1:return I%2e4!=0?[3,3]:[4,(0,S.wait)()];case 2:A.sent(),A.label=3;case 3:if(o.dataIndex>h)return b(""),[2];for(o.bits=0,o.maxPower=Math.pow(2,o.numBits),o.power=1;o.power!=o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition==0&&(o.dataPosition=d,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;switch(o.c=o.bits){case 0:for(o.bits=0,o.maxPower=Math.pow(2,8),o.power=1;o.power!==o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition==0&&(o.dataPosition=d,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;o.dictionary[o.dictSize++]=String.fromCharCode(o.bits),o.c=o.dictSize-1,o.enlargeIn--;break;case 1:for(o.bits=0,o.maxPower=Math.pow(2,16),o.power=1;o.power!==o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition==0&&(o.dataPosition=d,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;o.dictionary[o.dictSize++]=String.fromCharCode(o.bits),o.c=o.dictSize-1,o.enlargeIn--;break;case 2:return b(o.result.join("")),[2]}if(o.enlargeIn==0&&(o.enlargeIn=Math.pow(2,o.numBits),o.numBits++),o.dictionary[o.c])o.entry=o.dictionary[o.c];else{if(o.c!==o.dictSize)return b(null),[2];o.entry=o.w+o.w.charAt(0)}return o.result.push(o.entry),o.dictionary[o.dictSize++]=o.w+o.entry.charAt(0),o.enlargeIn--,o.w=o.entry,o.enlargeIn==0&&(o.enlargeIn=Math.pow(2,o.numBits),o.numBits++),I++,[3,1];case 4:return[2]}})})})},T}();n.DecompressorImpl=p},658:function(r,n){var a=this&&this.__awaiter||function(l,S,p,T){return new(p||(p=Promise))(function(h,d){function x(o){try{b(T.next(o))}catch(c){d(c)}}function i(o){try{b(T.throw(o))}catch(c){d(c)}}function b(o){var c;o.done?h(o.value):(c=o.value,c instanceof p?c:new p(function(I){I(c)})).then(x,i)}b((T=T.apply(l,S||[])).next())})},f=this&&this.__generator||function(l,S){var p,T,h,d,x={label:0,sent:function(){if(1&h[0])throw h[1];return h[1]},trys:[],ops:[]};return d={next:i(0),throw:i(1),return:i(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function i(b){return function(o){return function(c){if(p)throw new TypeError("Generator is already executing.");for(;d&&(d=0,c[0]&&(x=0)),x;)try{if(p=1,T&&(h=2&c[0]?T.return:c[0]?T.throw||((h=T.return)&&h.call(T),0):T.next)&&!(h=h.call(T,c[1])).done)return h;switch(T=0,h&&(c=[2&c[0],h.value]),c[0]){case 0:case 1:h=c;break;case 4:return x.label++,{value:c[1],done:!1};case 5:x.label++,T=c[1],c=[0];continue;case 7:c=x.ops.pop(),x.trys.pop();continue;default:if(!((h=(h=x.trys).length>0&&h[h.length-1])||c[0]!==6&&c[0]!==2)){x=0;continue}if(c[0]===3&&(!h||c[1]>h[0]&&c[1]<h[3])){x.label=c[1];break}if(c[0]===6&&x.label<h[1]){x.label=h[1],h=c;break}if(h&&x.label<h[2]){x.label=h[2],x.ops.push(c);break}h[2]&&x.ops.pop(),x.trys.pop();continue}c=S.call(l,x)}catch(I){c=[6,I],T=0}finally{p=h=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([b,o])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.wait=void 0,n.wait=function(){return a(this,void 0,void 0,function(){return f(this,function(l){return[2,new Promise(function(S){setTimeout(S,0)})]})})}}},t={};return function r(n){var a=t[n];if(a!==void 0)return a.exports;var f=t[n]={exports:{}};return e[n].call(f.exports,f,f.exports,r),f.exports}(48)})())});var nt=zt((qo,Re)=>{"use strict";(function(){"use strict";var e="input is invalid type",t=typeof window=="object",r=t?window:{};r.JS_SHA256_NO_WINDOW&&(t=!1);var n=!t&&typeof self=="object",a=!r.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;a?r=global:n&&(r=self);var f=!r.JS_SHA256_NO_COMMON_JS&&typeof Re=="object"&&Re.exports,l=typeof define=="function"&&define.amd,S=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",p="0123456789abcdef".split(""),T=[-2147483648,8388608,32768,128],h=[24,16,8,0],d=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],x=["hex","array","digest","arrayBuffer"],i=[];(r.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(s){return Object.prototype.toString.call(s)==="[object Array]"}),S&&(r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(s){return typeof s=="object"&&s.buffer&&s.buffer.constructor===ArrayBuffer});var b=function(s,u){return function(v){return new m(u,!0).update(v)[s]()}},o=function(s){var u=b("hex",s);a&&(u=c(u,s)),u.create=function(){return new m(s)},u.update=function(F){return u.create().update(F)};for(var v=0;v<x.length;++v){var w=x[v];u[w]=b(w,s)}return u},c=function(s,u){var v=Ht("crypto"),w=Ht("buffer").Buffer,F=u?"sha224":"sha256",g;w.from&&!r.JS_SHA256_NO_BUFFER_FROM?g=w.from:g=function(y){return new w(y)};var C=function(y){if(typeof y=="string")return v.createHash(F).update(y,"utf8").digest("hex");if(y==null)throw new Error(e);return y.constructor===ArrayBuffer&&(y=new Uint8Array(y)),Array.isArray(y)||ArrayBuffer.isView(y)||y.constructor===w?v.createHash(F).update(g(y)).digest("hex"):s(y)};return C},I=function(s,u){return function(v,w){return new E(v,u,!0).update(w)[s]()}},A=function(s){var u=I("hex",s);u.create=function(F){return new E(F,s)},u.update=function(F,g){return u.create(F).update(g)};for(var v=0;v<x.length;++v){var w=x[v];u[w]=I(w,s)}return u};function m(s,u){u?(i[0]=i[16]=i[1]=i[2]=i[3]=i[4]=i[5]=i[6]=i[7]=i[8]=i[9]=i[10]=i[11]=i[12]=i[13]=i[14]=i[15]=0,this.blocks=i):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],s?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=s}m.prototype.update=function(s){if(!this.finalized){var u,v=typeof s;if(v!=="string"){if(v==="object"){if(s===null)throw new Error(e);if(S&&s.constructor===ArrayBuffer)s=new Uint8Array(s);else if(!Array.isArray(s)&&(!S||!ArrayBuffer.isView(s)))throw new Error(e)}else throw new Error(e);u=!0}for(var w,F=0,g,C=s.length,y=this.blocks;F<C;){if(this.hashed&&(this.hashed=!1,y[0]=this.block,this.block=y[16]=y[1]=y[2]=y[3]=y[4]=y[5]=y[6]=y[7]=y[8]=y[9]=y[10]=y[11]=y[12]=y[13]=y[14]=y[15]=0),u)for(g=this.start;F<C&&g<64;++F)y[g>>>2]|=s[F]<<h[g++&3];else for(g=this.start;F<C&&g<64;++F)w=s.charCodeAt(F),w<128?y[g>>>2]|=w<<h[g++&3]:w<2048?(y[g>>>2]|=(192|w>>>6)<<h[g++&3],y[g>>>2]|=(128|w&63)<<h[g++&3]):w<55296||w>=57344?(y[g>>>2]|=(224|w>>>12)<<h[g++&3],y[g>>>2]|=(128|w>>>6&63)<<h[g++&3],y[g>>>2]|=(128|w&63)<<h[g++&3]):(w=65536+((w&1023)<<10|s.charCodeAt(++F)&1023),y[g>>>2]|=(240|w>>>18)<<h[g++&3],y[g>>>2]|=(128|w>>>12&63)<<h[g++&3],y[g>>>2]|=(128|w>>>6&63)<<h[g++&3],y[g>>>2]|=(128|w&63)<<h[g++&3]);this.lastByteIndex=g,this.bytes+=g-this.start,g>=64?(this.block=y[16],this.start=g-64,this.hash(),this.hashed=!0):this.start=g}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},m.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var s=this.blocks,u=this.lastByteIndex;s[16]=this.block,s[u>>>2]|=T[u&3],this.block=s[16],u>=56&&(this.hashed||this.hash(),s[0]=this.block,s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),s[14]=this.hBytes<<3|this.bytes>>>29,s[15]=this.bytes<<3,this.hash()}},m.prototype.hash=function(){var s=this.h0,u=this.h1,v=this.h2,w=this.h3,F=this.h4,g=this.h5,C=this.h6,y=this.h7,P=this.blocks,B,N,O,G,R,X,Y,ue,et,tt,Fe;for(B=16;B<64;++B)R=P[B-15],N=(R>>>7|R<<25)^(R>>>18|R<<14)^R>>>3,R=P[B-2],O=(R>>>17|R<<15)^(R>>>19|R<<13)^R>>>10,P[B]=P[B-16]+N+P[B-7]+O<<0;for(Fe=u&v,B=0;B<64;B+=4)this.first?(this.is224?(ue=300032,R=P[0]-1413257819,y=R-150054599<<0,w=R+24177077<<0):(ue=704751109,R=P[0]-210244248,y=R-1521486534<<0,w=R+143694565<<0),this.first=!1):(N=(s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10),O=(F>>>6|F<<26)^(F>>>11|F<<21)^(F>>>25|F<<7),ue=s&u,G=ue^s&v^Fe,Y=F&g^~F&C,R=y+O+Y+d[B]+P[B],X=N+G,y=w+R<<0,w=R+X<<0),N=(w>>>2|w<<30)^(w>>>13|w<<19)^(w>>>22|w<<10),O=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),et=w&s,G=et^w&u^ue,Y=y&F^~y&g,R=C+O+Y+d[B+1]+P[B+1],X=N+G,C=v+R<<0,v=R+X<<0,N=(v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10),O=(C>>>6|C<<26)^(C>>>11|C<<21)^(C>>>25|C<<7),tt=v&w,G=tt^v&s^et,Y=C&y^~C&F,R=g+O+Y+d[B+2]+P[B+2],X=N+G,g=u+R<<0,u=R+X<<0,N=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),O=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),Fe=u&v,G=Fe^u&w^tt,Y=g&C^~g&y,R=F+O+Y+d[B+3]+P[B+3],X=N+G,F=s+R<<0,s=R+X<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+s<<0,this.h1=this.h1+u<<0,this.h2=this.h2+v<<0,this.h3=this.h3+w<<0,this.h4=this.h4+F<<0,this.h5=this.h5+g<<0,this.h6=this.h6+C<<0,this.h7=this.h7+y<<0},m.prototype.hex=function(){this.finalize();var s=this.h0,u=this.h1,v=this.h2,w=this.h3,F=this.h4,g=this.h5,C=this.h6,y=this.h7,P=p[s>>>28&15]+p[s>>>24&15]+p[s>>>20&15]+p[s>>>16&15]+p[s>>>12&15]+p[s>>>8&15]+p[s>>>4&15]+p[s&15]+p[u>>>28&15]+p[u>>>24&15]+p[u>>>20&15]+p[u>>>16&15]+p[u>>>12&15]+p[u>>>8&15]+p[u>>>4&15]+p[u&15]+p[v>>>28&15]+p[v>>>24&15]+p[v>>>20&15]+p[v>>>16&15]+p[v>>>12&15]+p[v>>>8&15]+p[v>>>4&15]+p[v&15]+p[w>>>28&15]+p[w>>>24&15]+p[w>>>20&15]+p[w>>>16&15]+p[w>>>12&15]+p[w>>>8&15]+p[w>>>4&15]+p[w&15]+p[F>>>28&15]+p[F>>>24&15]+p[F>>>20&15]+p[F>>>16&15]+p[F>>>12&15]+p[F>>>8&15]+p[F>>>4&15]+p[F&15]+p[g>>>28&15]+p[g>>>24&15]+p[g>>>20&15]+p[g>>>16&15]+p[g>>>12&15]+p[g>>>8&15]+p[g>>>4&15]+p[g&15]+p[C>>>28&15]+p[C>>>24&15]+p[C>>>20&15]+p[C>>>16&15]+p[C>>>12&15]+p[C>>>8&15]+p[C>>>4&15]+p[C&15];return this.is224||(P+=p[y>>>28&15]+p[y>>>24&15]+p[y>>>20&15]+p[y>>>16&15]+p[y>>>12&15]+p[y>>>8&15]+p[y>>>4&15]+p[y&15]),P},m.prototype.toString=m.prototype.hex,m.prototype.digest=function(){this.finalize();var s=this.h0,u=this.h1,v=this.h2,w=this.h3,F=this.h4,g=this.h5,C=this.h6,y=this.h7,P=[s>>>24&255,s>>>16&255,s>>>8&255,s&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,v>>>24&255,v>>>16&255,v>>>8&255,v&255,w>>>24&255,w>>>16&255,w>>>8&255,w&255,F>>>24&255,F>>>16&255,F>>>8&255,F&255,g>>>24&255,g>>>16&255,g>>>8&255,g&255,C>>>24&255,C>>>16&255,C>>>8&255,C&255];return this.is224||P.push(y>>>24&255,y>>>16&255,y>>>8&255,y&255),P},m.prototype.array=m.prototype.digest,m.prototype.arrayBuffer=function(){this.finalize();var s=new ArrayBuffer(this.is224?28:32),u=new DataView(s);return u.setUint32(0,this.h0),u.setUint32(4,this.h1),u.setUint32(8,this.h2),u.setUint32(12,this.h3),u.setUint32(16,this.h4),u.setUint32(20,this.h5),u.setUint32(24,this.h6),this.is224||u.setUint32(28,this.h7),s};function E(s,u,v){var w,F=typeof s;if(F==="string"){var g=[],C=s.length,y=0,P;for(w=0;w<C;++w)P=s.charCodeAt(w),P<128?g[y++]=P:P<2048?(g[y++]=192|P>>>6,g[y++]=128|P&63):P<55296||P>=57344?(g[y++]=224|P>>>12,g[y++]=128|P>>>6&63,g[y++]=128|P&63):(P=65536+((P&1023)<<10|s.charCodeAt(++w)&1023),g[y++]=240|P>>>18,g[y++]=128|P>>>12&63,g[y++]=128|P>>>6&63,g[y++]=128|P&63);s=g}else if(F==="object"){if(s===null)throw new Error(e);if(S&&s.constructor===ArrayBuffer)s=new Uint8Array(s);else if(!Array.isArray(s)&&(!S||!ArrayBuffer.isView(s)))throw new Error(e)}else throw new Error(e);s.length>64&&(s=new m(u,!0).update(s).array());var B=[],N=[];for(w=0;w<64;++w){var O=s[w]||0;B[w]=92^O,N[w]=54^O}m.call(this,u,v),this.update(N),this.oKeyPad=B,this.inner=!0,this.sharedMemory=v}E.prototype=new m,E.prototype.finalize=function(){if(m.prototype.finalize.call(this),this.inner){this.inner=!1;var s=this.array();m.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(s),m.prototype.finalize.call(this)}};var z=o();z.sha256=z,z.sha224=o(!0),z.sha256.hmac=A(),z.sha224.hmac=A(!0),f?Re.exports=z:(r.sha256=z.sha256,r.sha224=z.sha224,l&&define(function(){return z}))})()});function Z(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}var me=M(()=>{"use strict"});function $(e){return Z(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var he=M(()=>{"use strict";me()});var ut,Wt=M(()=>{"use strict";ut="2.21.35"});function qt(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e?qt(e.cause,t):t?null:e}var ft,H,ae=M(()=>{"use strict";Wt();ft={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${ut}`},H=class e extends Error{constructor(t,r={}){let n=r.cause instanceof e?r.cause.details:r.cause?.message?r.cause.message:r.details,a=r.cause instanceof e&&r.cause.docsPath||r.docsPath,f=ft.getDocsUrl?.({...r,docsPath:a}),l=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...f?[`Docs: ${f}`]:[],...n?[`Details: ${n}`]:[],...ft.version?[`Version: ${ft.version}`]:[]].join(`
|
|
2
|
-
`);super(
|
|
3
|
-
`),{name:"AbiEncodingArrayLengthMismatchError"})}},
|
|
1
|
+
"use strict";var NexusSDK=(()=>{var Wr=Object.create;var Ae=Object.defineProperty;var qr=Object.getOwnPropertyDescriptor;var Kr=Object.getOwnPropertyNames;var Jr=Object.getPrototypeOf,Gr=Object.prototype.hasOwnProperty;var Ht=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var R=(e,t)=>()=>(e&&(t=e(e=0)),t);var zt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Xr=(e,t)=>{for(var r in t)Ae(e,r,{get:t[r],enumerable:!0})},Lt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Kr(t))!Gr.call(e,a)&&a!==r&&Ae(e,a,{get:()=>t[a],enumerable:!(n=qr(t,a))||n.enumerable});return e};var Ce=(e,t,r)=>(r=e!=null?Wr(Jr(e)):{},Lt(t||!e||!e.__esModule?Ae(r,"default",{value:e,enumerable:!0}):r,e)),Yr=e=>Lt(Ae({},"__esModule",{value:!0}),e);var ot=zt((le,rt)=>{"use strict";(function(e,t){if(typeof le=="object"&&typeof rt=="object")rt.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var r=t();for(var n in r)(typeof le=="object"?le:e)[n]=r[n]}})(le,()=>(()=>{"use strict";var e={48:function(r,n,a){var l=this&&this.__awaiter||function(i,g,o,c){return new(o||(o=Promise))(function(I,A){function m(s){try{z(c.next(s))}catch(u){A(u)}}function T(s){try{z(c.throw(s))}catch(u){A(u)}}function z(s){var u;s.done?I(s.value):(u=s.value,u instanceof o?u:new o(function(E){E(u)})).then(m,T)}z((c=c.apply(i,g||[])).next())})},f=this&&this.__generator||function(i,g){var o,c,I,A,m={label:0,sent:function(){if(1&I[0])throw I[1];return I[1]},trys:[],ops:[]};return A={next:T(0),throw:T(1),return:T(2)},typeof Symbol=="function"&&(A[Symbol.iterator]=function(){return this}),A;function T(z){return function(s){return function(u){if(o)throw new TypeError("Generator is already executing.");for(;A&&(A=0,u[0]&&(m=0)),m;)try{if(o=1,c&&(I=2&u[0]?c.return:u[0]?c.throw||((I=c.return)&&I.call(c),0):c.next)&&!(I=I.call(c,u[1])).done)return I;switch(c=0,I&&(u=[2&u[0],I.value]),u[0]){case 0:case 1:I=u;break;case 4:return m.label++,{value:u[1],done:!1};case 5:m.label++,c=u[1],u=[0];continue;case 7:u=m.ops.pop(),m.trys.pop();continue;default:if(!((I=(I=m.trys).length>0&&I[I.length-1])||u[0]!==6&&u[0]!==2)){m=0;continue}if(u[0]===3&&(!I||u[1]>I[0]&&u[1]<I[3])){m.label=u[1];break}if(u[0]===6&&m.label<I[1]){m.label=I[1],I=u;break}if(I&&m.label<I[2]){m.label=I[2],m.ops.push(u);break}I[2]&&m.ops.pop(),m.trys.pop();continue}u=g.call(i,m)}catch(E){u=[6,E],c=0}finally{o=I=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([z,s])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.decompressFromUTF16=n.compressToUTF16=n.decompressFromBase64=n.compressToBase64=void 0;var S=a(304),p=a(134),v=new S.CompressorImpl,h=new p.DecompressorImpl,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",x={};n.compressToBase64=function(i){return l(this,void 0,void 0,function(){var g;return f(this,function(o){switch(o.label){case 0:return i===null?[2,""]:[4,v.compress(i,6,function(c){return d.charAt(c)})];case 1:switch((g=o.sent()).length%4){default:case 0:return[2,g];case 1:return[2,g+"==="];case 2:return[2,g+"=="];case 3:return[2,g+"="]}return[2]}})})},n.decompressFromBase64=function(i){return l(this,void 0,void 0,function(){return f(this,function(g){switch(g.label){case 0:return i===null?[2,""]:i===""?[2,null]:[4,h.decompress(i.length,32,function(o){return function(c,I){if(!x[c]){x[c]={};for(var A=0;A<c.length;A++)x[c][c.charAt(A)]=A}return x[c][I]}(d,i.charAt(o))})];case 1:return[2,g.sent()]}})})},n.compressToUTF16=function(i){return l(this,void 0,void 0,function(){return f(this,function(g){switch(g.label){case 0:return i===null?[2,""]:[4,v.compress(i,15,function(o){return String.fromCharCode(o+32)})];case 1:return[2,g.sent()+" "]}})})},n.decompressFromUTF16=function(i){return l(this,void 0,void 0,function(){return f(this,function(g){switch(g.label){case 0:return i===null?[2,""]:i===""?[2,null]:[4,h.decompress(i.length,16384,function(o){return i.charCodeAt(o)-32})];case 1:return[2,g.sent()]}})})}},304:function(r,n,a){var l=this&&this.__awaiter||function(h,d,x,i){return new(x||(x=Promise))(function(g,o){function c(m){try{A(i.next(m))}catch(T){o(T)}}function I(m){try{A(i.throw(m))}catch(T){o(T)}}function A(m){var T;m.done?g(m.value):(T=m.value,T instanceof x?T:new x(function(z){z(T)})).then(c,I)}A((i=i.apply(h,d||[])).next())})},f=this&&this.__generator||function(h,d){var x,i,g,o,c={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return o={next:I(0),throw:I(1),return:I(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function I(A){return function(m){return function(T){if(x)throw new TypeError("Generator is already executing.");for(;o&&(o=0,T[0]&&(c=0)),c;)try{if(x=1,i&&(g=2&T[0]?i.return:T[0]?i.throw||((g=i.return)&&g.call(i),0):i.next)&&!(g=g.call(i,T[1])).done)return g;switch(i=0,g&&(T=[2&T[0],g.value]),T[0]){case 0:case 1:g=T;break;case 4:return c.label++,{value:T[1],done:!1};case 5:c.label++,i=T[1],T=[0];continue;case 7:T=c.ops.pop(),c.trys.pop();continue;default:if(!((g=(g=c.trys).length>0&&g[g.length-1])||T[0]!==6&&T[0]!==2)){c=0;continue}if(T[0]===3&&(!g||T[1]>g[0]&&T[1]<g[3])){c.label=T[1];break}if(T[0]===6&&c.label<g[1]){c.label=g[1],g=T;break}if(g&&c.label<g[2]){c.label=g[2],c.ops.push(T);break}g[2]&&c.ops.pop(),c.trys.pop();continue}T=d.call(h,c)}catch(z){T=[6,z],i=0}finally{x=g=0}if(5&T[0])throw T[1];return{value:T[0]?T[1]:void 0,done:!0}}([A,m])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.CompressorImpl=void 0;var S=a(658),p=[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],v=function(){function h(){}return h.writeValueToData=function(d,x,i,g,o){if(i%4!=0||d.dataPosition+i>g-1)for(var c=0;c<i;c++)d.dataVal=d.dataVal<<1|1&x,d.dataPosition==g-1?(d.dataPosition=0,d.data.push(o(d.dataVal)),d.dataVal=0):d.dataPosition++,x>>=1;else d.dataVal<<=i,d.dataVal|=function(I,A){for(var m=0,T=0;T<A;++T)m<<=4,m|=p[15&I],I>>=4;return m}(x,i/4),d.dataPosition+=i},h.writeWToDataVal=function(d,x,i){d.dictionaryToCreate.has(d.w)?(d.w.charCodeAt(0)<256?(h.writeValueToData(d,0,d.numBits,x,i),h.writeValueToData(d,d.w.charCodeAt(0),8,x,i)):(h.writeValueToData(d,1,d.numBits,x,i),h.writeValueToData(d,d.w.charCodeAt(0),16,x,i)),d.enlargeIn--,d.enlargeIn==0&&(d.enlargeIn=Math.pow(2,d.numBits),d.numBits++),d.dictionaryToCreate.delete(d.w)):h.writeValueToData(d,d.dictionary.get(d.w),d.numBits,x,i),d.enlargeIn--,d.enlargeIn==0&&(d.enlargeIn=Math.pow(2,d.numBits),d.numBits++)},h.loopIteration=function(d,x,i,g,o){var c=d.charAt(x);o.dictionary.has(c)||(o.dictionary.set(c,o.dictSize++),o.dictionaryToCreate.set(c,!0));var I=o.w+c;o.dictionary.has(I)?o.w=I:(this.writeWToDataVal(o,i,g),o.dictionary.set(I,o.dictSize++),o.w=String(c))},h.prototype.compress=function(d,x,i){var g=this;return new Promise(function(o){return l(g,void 0,void 0,function(){var c,I;return f(this,function(A){switch(A.label){case 0:if(d==null)return o(""),[2];c={data:[],dataPosition:0,dataVal:0,dictionary:new Map,dictionaryToCreate:new Map,dictSize:3,enlargeIn:2,numBits:2,w:""},I=0,A.label=1;case 1:return I<d.length?(h.loopIteration(d,I,x,i,c),I%1e4!=0?[3,3]:[4,(0,S.wait)()]):[3,4];case 2:A.sent(),A.label=3;case 3:return I+=1,[3,1];case 4:return c.w!==""&&h.writeWToDataVal(c,x,i),h.writeValueToData(c,2,c.numBits,x,i),c.dataVal<<=x-c.dataPosition,c.data.push(i(c.dataVal)),o(c.data.join("")),[2]}})})})},h}();n.CompressorImpl=v},134:function(r,n,a){var l=this&&this.__awaiter||function(v,h,d,x){return new(d||(d=Promise))(function(i,g){function o(A){try{I(x.next(A))}catch(m){g(m)}}function c(A){try{I(x.throw(A))}catch(m){g(m)}}function I(A){var m;A.done?i(A.value):(m=A.value,m instanceof d?m:new d(function(T){T(m)})).then(o,c)}I((x=x.apply(v,h||[])).next())})},f=this&&this.__generator||function(v,h){var d,x,i,g,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return g={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function c(I){return function(A){return function(m){if(d)throw new TypeError("Generator is already executing.");for(;g&&(g=0,m[0]&&(o=0)),o;)try{if(d=1,x&&(i=2&m[0]?x.return:m[0]?x.throw||((i=x.return)&&i.call(x),0):x.next)&&!(i=i.call(x,m[1])).done)return i;switch(x=0,i&&(m=[2&m[0],i.value]),m[0]){case 0:case 1:i=m;break;case 4:return o.label++,{value:m[1],done:!1};case 5:o.label++,x=m[1],m=[0];continue;case 7:m=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||m[0]!==6&&m[0]!==2)){o=0;continue}if(m[0]===3&&(!i||m[1]>i[0]&&m[1]<i[3])){o.label=m[1];break}if(m[0]===6&&o.label<i[1]){o.label=i[1],i=m;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(m);break}i[2]&&o.ops.pop(),o.trys.pop();continue}m=h.call(v,o)}catch(T){m=[6,T],x=0}finally{d=i=0}if(5&m[0])throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}([I,A])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.DecompressorImpl=void 0;var S=a(658),p=function(){function v(){}return v.prototype.decompress=function(h,d,x){var i=this;return new Promise(function(g){return l(i,void 0,void 0,function(){var o,c,I;return f(this,function(A){switch(A.label){case 0:for(o={bits:0,c:null,dataIndex:1,dataPosition:d,dataVal:x(0),dictionary:new Map,dictSize:4,enlargeIn:4,entry:"",maxPower:Math.pow(2,2),numBits:3,power:1,resb:null,result:[],w:null},c=0;c<3;c+=1)o.dictionary.set(c,c);for(;o.power!=o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition==0&&(o.dataPosition=d,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;switch(o.bits){case 0:for(o.bits=0,o.maxPower=Math.pow(2,8),o.power=1;o.power!=o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition==0&&(o.dataPosition=d,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;o.c=String.fromCharCode(o.bits);break;case 1:for(o.bits=0,o.maxPower=Math.pow(2,16),o.power=1;o.power!==o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition===0&&(o.dataPosition=d,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;o.c=String.fromCharCode(o.bits);break;case 2:return g(""),[2]}o.dictionary[3]=o.c,o.w=o.c,o.result.push(o.c),I=1,A.label=1;case 1:return I%2e4!=0?[3,3]:[4,(0,S.wait)()];case 2:A.sent(),A.label=3;case 3:if(o.dataIndex>h)return g(""),[2];for(o.bits=0,o.maxPower=Math.pow(2,o.numBits),o.power=1;o.power!=o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition==0&&(o.dataPosition=d,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;switch(o.c=o.bits){case 0:for(o.bits=0,o.maxPower=Math.pow(2,8),o.power=1;o.power!==o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition==0&&(o.dataPosition=d,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;o.dictionary[o.dictSize++]=String.fromCharCode(o.bits),o.c=o.dictSize-1,o.enlargeIn--;break;case 1:for(o.bits=0,o.maxPower=Math.pow(2,16),o.power=1;o.power!==o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition==0&&(o.dataPosition=d,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;o.dictionary[o.dictSize++]=String.fromCharCode(o.bits),o.c=o.dictSize-1,o.enlargeIn--;break;case 2:return g(o.result.join("")),[2]}if(o.enlargeIn==0&&(o.enlargeIn=Math.pow(2,o.numBits),o.numBits++),o.dictionary[o.c])o.entry=o.dictionary[o.c];else{if(o.c!==o.dictSize)return g(null),[2];o.entry=o.w+o.w.charAt(0)}return o.result.push(o.entry),o.dictionary[o.dictSize++]=o.w+o.entry.charAt(0),o.enlargeIn--,o.w=o.entry,o.enlargeIn==0&&(o.enlargeIn=Math.pow(2,o.numBits),o.numBits++),I++,[3,1];case 4:return[2]}})})})},v}();n.DecompressorImpl=p},658:function(r,n){var a=this&&this.__awaiter||function(f,S,p,v){return new(p||(p=Promise))(function(h,d){function x(o){try{g(v.next(o))}catch(c){d(c)}}function i(o){try{g(v.throw(o))}catch(c){d(c)}}function g(o){var c;o.done?h(o.value):(c=o.value,c instanceof p?c:new p(function(I){I(c)})).then(x,i)}g((v=v.apply(f,S||[])).next())})},l=this&&this.__generator||function(f,S){var p,v,h,d,x={label:0,sent:function(){if(1&h[0])throw h[1];return h[1]},trys:[],ops:[]};return d={next:i(0),throw:i(1),return:i(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function i(g){return function(o){return function(c){if(p)throw new TypeError("Generator is already executing.");for(;d&&(d=0,c[0]&&(x=0)),x;)try{if(p=1,v&&(h=2&c[0]?v.return:c[0]?v.throw||((h=v.return)&&h.call(v),0):v.next)&&!(h=h.call(v,c[1])).done)return h;switch(v=0,h&&(c=[2&c[0],h.value]),c[0]){case 0:case 1:h=c;break;case 4:return x.label++,{value:c[1],done:!1};case 5:x.label++,v=c[1],c=[0];continue;case 7:c=x.ops.pop(),x.trys.pop();continue;default:if(!((h=(h=x.trys).length>0&&h[h.length-1])||c[0]!==6&&c[0]!==2)){x=0;continue}if(c[0]===3&&(!h||c[1]>h[0]&&c[1]<h[3])){x.label=c[1];break}if(c[0]===6&&x.label<h[1]){x.label=h[1],h=c;break}if(h&&x.label<h[2]){x.label=h[2],x.ops.push(c);break}h[2]&&x.ops.pop(),x.trys.pop();continue}c=S.call(f,x)}catch(I){c=[6,I],v=0}finally{p=h=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([g,o])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.wait=void 0,n.wait=function(){return a(this,void 0,void 0,function(){return l(this,function(f){return[2,new Promise(function(S){setTimeout(S,0)})]})})}}},t={};return function r(n){var a=t[n];if(a!==void 0)return a.exports;var l=t[n]={exports:{}};return e[n].call(l.exports,l,l.exports,r),l.exports}(48)})())});var nt=zt((Go,Me)=>{"use strict";(function(){"use strict";var e="input is invalid type",t=typeof window=="object",r=t?window:{};r.JS_SHA256_NO_WINDOW&&(t=!1);var n=!t&&typeof self=="object",a=!r.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;a?r=global:n&&(r=self);var l=!r.JS_SHA256_NO_COMMON_JS&&typeof Me=="object"&&Me.exports,f=typeof define=="function"&&define.amd,S=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",p="0123456789abcdef".split(""),v=[-2147483648,8388608,32768,128],h=[24,16,8,0],d=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],x=["hex","array","digest","arrayBuffer"],i=[];(r.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(s){return Object.prototype.toString.call(s)==="[object Array]"}),S&&(r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(s){return typeof s=="object"&&s.buffer&&s.buffer.constructor===ArrayBuffer});var g=function(s,u){return function(E){return new m(u,!0).update(E)[s]()}},o=function(s){var u=g("hex",s);a&&(u=c(u,s)),u.create=function(){return new m(s)},u.update=function(F){return u.create().update(F)};for(var E=0;E<x.length;++E){var w=x[E];u[w]=g(w,s)}return u},c=function(s,u){var E=Ht("crypto"),w=Ht("buffer").Buffer,F=u?"sha224":"sha256",b;w.from&&!r.JS_SHA256_NO_BUFFER_FROM?b=w.from:b=function(y){return new w(y)};var C=function(y){if(typeof y=="string")return E.createHash(F).update(y,"utf8").digest("hex");if(y==null)throw new Error(e);return y.constructor===ArrayBuffer&&(y=new Uint8Array(y)),Array.isArray(y)||ArrayBuffer.isView(y)||y.constructor===w?E.createHash(F).update(b(y)).digest("hex"):s(y)};return C},I=function(s,u){return function(E,w){return new T(E,u,!0).update(w)[s]()}},A=function(s){var u=I("hex",s);u.create=function(F){return new T(F,s)},u.update=function(F,b){return u.create(F).update(b)};for(var E=0;E<x.length;++E){var w=x[E];u[w]=I(w,s)}return u};function m(s,u){u?(i[0]=i[16]=i[1]=i[2]=i[3]=i[4]=i[5]=i[6]=i[7]=i[8]=i[9]=i[10]=i[11]=i[12]=i[13]=i[14]=i[15]=0,this.blocks=i):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],s?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=s}m.prototype.update=function(s){if(!this.finalized){var u,E=typeof s;if(E!=="string"){if(E==="object"){if(s===null)throw new Error(e);if(S&&s.constructor===ArrayBuffer)s=new Uint8Array(s);else if(!Array.isArray(s)&&(!S||!ArrayBuffer.isView(s)))throw new Error(e)}else throw new Error(e);u=!0}for(var w,F=0,b,C=s.length,y=this.blocks;F<C;){if(this.hashed&&(this.hashed=!1,y[0]=this.block,this.block=y[16]=y[1]=y[2]=y[3]=y[4]=y[5]=y[6]=y[7]=y[8]=y[9]=y[10]=y[11]=y[12]=y[13]=y[14]=y[15]=0),u)for(b=this.start;F<C&&b<64;++F)y[b>>>2]|=s[F]<<h[b++&3];else for(b=this.start;F<C&&b<64;++F)w=s.charCodeAt(F),w<128?y[b>>>2]|=w<<h[b++&3]:w<2048?(y[b>>>2]|=(192|w>>>6)<<h[b++&3],y[b>>>2]|=(128|w&63)<<h[b++&3]):w<55296||w>=57344?(y[b>>>2]|=(224|w>>>12)<<h[b++&3],y[b>>>2]|=(128|w>>>6&63)<<h[b++&3],y[b>>>2]|=(128|w&63)<<h[b++&3]):(w=65536+((w&1023)<<10|s.charCodeAt(++F)&1023),y[b>>>2]|=(240|w>>>18)<<h[b++&3],y[b>>>2]|=(128|w>>>12&63)<<h[b++&3],y[b>>>2]|=(128|w>>>6&63)<<h[b++&3],y[b>>>2]|=(128|w&63)<<h[b++&3]);this.lastByteIndex=b,this.bytes+=b-this.start,b>=64?(this.block=y[16],this.start=b-64,this.hash(),this.hashed=!0):this.start=b}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},m.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var s=this.blocks,u=this.lastByteIndex;s[16]=this.block,s[u>>>2]|=v[u&3],this.block=s[16],u>=56&&(this.hashed||this.hash(),s[0]=this.block,s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),s[14]=this.hBytes<<3|this.bytes>>>29,s[15]=this.bytes<<3,this.hash()}},m.prototype.hash=function(){var s=this.h0,u=this.h1,E=this.h2,w=this.h3,F=this.h4,b=this.h5,C=this.h6,y=this.h7,P=this.blocks,k,N,O,X,M,Y,Z,ue,et,tt,Fe;for(k=16;k<64;++k)M=P[k-15],N=(M>>>7|M<<25)^(M>>>18|M<<14)^M>>>3,M=P[k-2],O=(M>>>17|M<<15)^(M>>>19|M<<13)^M>>>10,P[k]=P[k-16]+N+P[k-7]+O<<0;for(Fe=u&E,k=0;k<64;k+=4)this.first?(this.is224?(ue=300032,M=P[0]-1413257819,y=M-150054599<<0,w=M+24177077<<0):(ue=704751109,M=P[0]-210244248,y=M-1521486534<<0,w=M+143694565<<0),this.first=!1):(N=(s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10),O=(F>>>6|F<<26)^(F>>>11|F<<21)^(F>>>25|F<<7),ue=s&u,X=ue^s&E^Fe,Z=F&b^~F&C,M=y+O+Z+d[k]+P[k],Y=N+X,y=w+M<<0,w=M+Y<<0),N=(w>>>2|w<<30)^(w>>>13|w<<19)^(w>>>22|w<<10),O=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),et=w&s,X=et^w&u^ue,Z=y&F^~y&b,M=C+O+Z+d[k+1]+P[k+1],Y=N+X,C=E+M<<0,E=M+Y<<0,N=(E>>>2|E<<30)^(E>>>13|E<<19)^(E>>>22|E<<10),O=(C>>>6|C<<26)^(C>>>11|C<<21)^(C>>>25|C<<7),tt=E&w,X=tt^E&s^et,Z=C&y^~C&F,M=b+O+Z+d[k+2]+P[k+2],Y=N+X,b=u+M<<0,u=M+Y<<0,N=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),O=(b>>>6|b<<26)^(b>>>11|b<<21)^(b>>>25|b<<7),Fe=u&E,X=Fe^u&w^tt,Z=b&C^~b&y,M=F+O+Z+d[k+3]+P[k+3],Y=N+X,F=s+M<<0,s=M+Y<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+s<<0,this.h1=this.h1+u<<0,this.h2=this.h2+E<<0,this.h3=this.h3+w<<0,this.h4=this.h4+F<<0,this.h5=this.h5+b<<0,this.h6=this.h6+C<<0,this.h7=this.h7+y<<0},m.prototype.hex=function(){this.finalize();var s=this.h0,u=this.h1,E=this.h2,w=this.h3,F=this.h4,b=this.h5,C=this.h6,y=this.h7,P=p[s>>>28&15]+p[s>>>24&15]+p[s>>>20&15]+p[s>>>16&15]+p[s>>>12&15]+p[s>>>8&15]+p[s>>>4&15]+p[s&15]+p[u>>>28&15]+p[u>>>24&15]+p[u>>>20&15]+p[u>>>16&15]+p[u>>>12&15]+p[u>>>8&15]+p[u>>>4&15]+p[u&15]+p[E>>>28&15]+p[E>>>24&15]+p[E>>>20&15]+p[E>>>16&15]+p[E>>>12&15]+p[E>>>8&15]+p[E>>>4&15]+p[E&15]+p[w>>>28&15]+p[w>>>24&15]+p[w>>>20&15]+p[w>>>16&15]+p[w>>>12&15]+p[w>>>8&15]+p[w>>>4&15]+p[w&15]+p[F>>>28&15]+p[F>>>24&15]+p[F>>>20&15]+p[F>>>16&15]+p[F>>>12&15]+p[F>>>8&15]+p[F>>>4&15]+p[F&15]+p[b>>>28&15]+p[b>>>24&15]+p[b>>>20&15]+p[b>>>16&15]+p[b>>>12&15]+p[b>>>8&15]+p[b>>>4&15]+p[b&15]+p[C>>>28&15]+p[C>>>24&15]+p[C>>>20&15]+p[C>>>16&15]+p[C>>>12&15]+p[C>>>8&15]+p[C>>>4&15]+p[C&15];return this.is224||(P+=p[y>>>28&15]+p[y>>>24&15]+p[y>>>20&15]+p[y>>>16&15]+p[y>>>12&15]+p[y>>>8&15]+p[y>>>4&15]+p[y&15]),P},m.prototype.toString=m.prototype.hex,m.prototype.digest=function(){this.finalize();var s=this.h0,u=this.h1,E=this.h2,w=this.h3,F=this.h4,b=this.h5,C=this.h6,y=this.h7,P=[s>>>24&255,s>>>16&255,s>>>8&255,s&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,E>>>24&255,E>>>16&255,E>>>8&255,E&255,w>>>24&255,w>>>16&255,w>>>8&255,w&255,F>>>24&255,F>>>16&255,F>>>8&255,F&255,b>>>24&255,b>>>16&255,b>>>8&255,b&255,C>>>24&255,C>>>16&255,C>>>8&255,C&255];return this.is224||P.push(y>>>24&255,y>>>16&255,y>>>8&255,y&255),P},m.prototype.array=m.prototype.digest,m.prototype.arrayBuffer=function(){this.finalize();var s=new ArrayBuffer(this.is224?28:32),u=new DataView(s);return u.setUint32(0,this.h0),u.setUint32(4,this.h1),u.setUint32(8,this.h2),u.setUint32(12,this.h3),u.setUint32(16,this.h4),u.setUint32(20,this.h5),u.setUint32(24,this.h6),this.is224||u.setUint32(28,this.h7),s};function T(s,u,E){var w,F=typeof s;if(F==="string"){var b=[],C=s.length,y=0,P;for(w=0;w<C;++w)P=s.charCodeAt(w),P<128?b[y++]=P:P<2048?(b[y++]=192|P>>>6,b[y++]=128|P&63):P<55296||P>=57344?(b[y++]=224|P>>>12,b[y++]=128|P>>>6&63,b[y++]=128|P&63):(P=65536+((P&1023)<<10|s.charCodeAt(++w)&1023),b[y++]=240|P>>>18,b[y++]=128|P>>>12&63,b[y++]=128|P>>>6&63,b[y++]=128|P&63);s=b}else if(F==="object"){if(s===null)throw new Error(e);if(S&&s.constructor===ArrayBuffer)s=new Uint8Array(s);else if(!Array.isArray(s)&&(!S||!ArrayBuffer.isView(s)))throw new Error(e)}else throw new Error(e);s.length>64&&(s=new m(u,!0).update(s).array());var k=[],N=[];for(w=0;w<64;++w){var O=s[w]||0;k[w]=92^O,N[w]=54^O}m.call(this,u,E),this.update(N),this.oKeyPad=k,this.inner=!0,this.sharedMemory=E}T.prototype=new m,T.prototype.finalize=function(){if(m.prototype.finalize.call(this),this.inner){this.inner=!1;var s=this.array();m.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(s),m.prototype.finalize.call(this)}};var z=o();z.sha256=z,z.sha224=o(!0),z.sha256.hmac=A(),z.sha224.hmac=A(!0),l?Me.exports=z:(r.sha256=z.sha256,r.sha224=z.sha224,f&&define(function(){return z}))})()});function Q(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}var me=R(()=>{"use strict"});function $(e){return Q(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var he=R(()=>{"use strict";me()});var ut,Wt=R(()=>{"use strict";ut="2.21.35"});function qt(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e?qt(e.cause,t):t?null:e}var lt,H,ae=R(()=>{"use strict";Wt();lt={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${ut}`},H=class e extends Error{constructor(t,r={}){let n=r.cause instanceof e?r.cause.details:r.cause?.message?r.cause.message:r.details,a=r.cause instanceof e&&r.cause.docsPath||r.docsPath,l=lt.getDocsUrl?.({...r,docsPath:a}),f=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...l?[`Docs: ${l}`]:[],...n?[`Details: ${n}`]:[],...lt.version?[`Version: ${lt.version}`]:[]].join(`
|
|
2
|
+
`);super(f,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=a,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=t,this.version=ut}walk(t){return qt(this,t)}}});var ke,Be,He,ze,Le,Kt=R(()=>{"use strict";he();ae();ke=class extends H{constructor({expectedLength:t,givenLength:r,type:n}){super([`ABI encoding array length mismatch for type ${n}.`,`Expected length: ${t}`,`Given length: ${r}`].join(`
|
|
3
|
+
`),{name:"AbiEncodingArrayLengthMismatchError"})}},Be=class extends H{constructor({expectedSize:t,value:r}){super(`Size of bytes "${r}" (bytes${$(r)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}},He=class extends H{constructor({expectedLength:t,givenLength:r}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${r}`].join(`
|
|
4
4
|
`),{name:"AbiEncodingLengthMismatchError"})}},ze=class extends H{constructor(t,{docsPath:r}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
|
|
5
5
|
`),{docsPath:r,name:"InvalidAbiEncodingType"})}},Le=class extends H{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
|
|
6
|
-
`),{name:"InvalidArrayError"})}}});var xe,ye,lt=M(()=>{"use strict";ae();xe=class extends H{constructor({offset:t,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}},ye=class extends H{constructor({size:t,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}});function U(e,{dir:t,size:r=32}={}){return typeof e=="string"?q(e,{dir:t,size:r}):Jt(e,{dir:t,size:r})}function q(e,{dir:t,size:r=32}={}){if(r===null)return e;let n=e.replace("0x","");if(n.length>r*2)throw new ye({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[t==="right"?"padEnd":"padStart"](r*2,"0")}`}function Jt(e,{dir:t,size:r=32}={}){if(r===null)return e;if(e.length>r)throw new ye({size:e.length,targetSize:r,type:"bytes"});let n=new Uint8Array(r);for(let a=0;a<r;a++){let f=t==="right";n[f?a:r-a-1]=e[f?a:e.length-a-1]}return n}var be=M(()=>{"use strict";lt()});var $e,Ue,dt=M(()=>{"use strict";ae();$e=class extends H{constructor({max:t,min:r,signed:n,size:a,value:f}){super(`Number "${f}" is not in safe ${a?`${a*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${t?`(${r} to ${t})`:`(above ${r})`}`,{name:"IntegerOutOfRangeError"})}},Ue=class extends H{constructor({givenSize:t,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}});function ie(e,{size:t}){if($(e)>t)throw new Ue({givenSize:$(e),maxSize:t})}var mt=M(()=>{"use strict";dt();he()});function D(e,t={}){return typeof e=="number"||typeof e=="bigint"?K(e,t):typeof e=="string"?_e(e,t):typeof e=="boolean"?De(e,t):ge(e,t)}function De(e,t={}){let r=`0x${Number(e)}`;return typeof t.size=="number"?(ie(r,{size:t.size}),U(r,{size:t.size})):r}function ge(e,t={}){let r="";for(let a=0;a<e.length;a++)r+=Zr[e[a]];let n=`0x${r}`;return typeof t.size=="number"?(ie(n,{size:t.size}),U(n,{dir:"right",size:t.size})):n}function K(e,t={}){let{signed:r,size:n}=t,a=BigInt(e),f;n?r?f=(1n<<BigInt(n)*8n-1n)-1n:f=2n**(BigInt(n)*8n)-1n:typeof e=="number"&&(f=BigInt(Number.MAX_SAFE_INTEGER));let l=typeof f=="bigint"&&r?-f-1n:0;if(f&&a>f||a<l){let p=typeof e=="bigint"?"n":"";throw new $e({max:f?`${f}${p}`:void 0,min:`${l}${p}`,signed:r,size:n,value:`${e}${p}`})}let S=`0x${(r&&a<0?(1n<<BigInt(n*8))+BigInt(a):a).toString(16)}`;return n?U(S,{size:n}):S}function _e(e,t={}){let r=Qr.encode(e);return ge(r,t)}var Zr,Qr,we=M(()=>{"use strict";dt();be();mt();Zr=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));Qr=new TextEncoder});function ht(e,t={}){return typeof e=="number"||typeof e=="bigint"?Yt(e,t):typeof e=="boolean"?Xt(e,t):Z(e)?Ie(e,t):Ne(e,t)}function Xt(e,t={}){let r=new Uint8Array(1);return r[0]=Number(e),typeof t.size=="number"?(ie(r,{size:t.size}),U(r,{size:t.size})):r}function Gt(e){if(e>=J.zero&&e<=J.nine)return e-J.zero;if(e>=J.A&&e<=J.F)return e-(J.A-10);if(e>=J.a&&e<=J.f)return e-(J.a-10)}function Ie(e,t={}){let r=e;t.size&&(ie(r,{size:t.size}),r=U(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);let a=n.length/2,f=new Uint8Array(a);for(let l=0,S=0;l<a;l++){let p=Gt(n.charCodeAt(S++)),T=Gt(n.charCodeAt(S++));if(p===void 0||T===void 0)throw new H(`Invalid byte sequence ("${n[S-2]}${n[S-1]}" in "${n}").`);f[l]=p*16+T}return f}function Yt(e,t){let r=K(e,t);return Ie(r)}function Ne(e,t={}){let r=eo.encode(e);return typeof t.size=="number"?(ie(r,{size:t.size}),U(r,{dir:"right",size:t.size})):r}var eo,J,Oe=M(()=>{"use strict";ae();me();be();mt();we();eo=new TextEncoder;J={zero:48,nine:57,A:65,F:70,a:97,f:102}});function xt(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function to(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Se(e,...t){if(!to(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function yt(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Zt(e,t){Se(e);let r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var bt=M(()=>{"use strict"});function ro(e,t=!1){return t?{h:Number(e&je),l:Number(e>>Qt&je)}:{h:Number(e>>Qt&je)|0,l:Number(e&je)|0}}function er(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let a=0;a<e.length;a++){let{h:f,l}=ro(e[a],t);[r[a],n[a]]=[f,l]}return[r,n]}var je,Qt,tr,rr,or,nr,ar=M(()=>{"use strict";je=BigInt(4294967295),Qt=BigInt(32);tr=(e,t,r)=>e<<r|t>>>32-r,rr=(e,t,r)=>t<<r|e>>>32-r,or=(e,t,r)=>t<<r-32|e>>>64-r,nr=(e,t,r)=>e<<r-32|t>>>64-r});function wt(e){for(let t=0;t<e.length;t++)e[t]=oo(e[t])}function no(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function We(e){return typeof e=="string"&&(e=no(e)),Se(e),e}function sr(e){let t=n=>e().update(We(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function cr(e){let t=(n,a)=>e(a).update(We(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}var ir,gt,oo,Ve,ta,pr=M(()=>{"use strict";bt();ir=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),gt=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,oo=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;Ve=class{clone(){return this._cloneInto()}},ta={}.toString});function lo(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let l=0;l<10;l++)r[l]=e[l]^e[l+10]^e[l+20]^e[l+30]^e[l+40];for(let l=0;l<10;l+=2){let S=(l+8)%10,p=(l+2)%10,T=r[p],h=r[p+1],d=ur(T,h,1)^r[S],x=fr(T,h,1)^r[S+1];for(let i=0;i<50;i+=10)e[l+i]^=d,e[l+i+1]^=x}let a=e[2],f=e[3];for(let l=0;l<24;l++){let S=dr[l],p=ur(a,f,S),T=fr(a,f,S),h=lr[l];a=e[h],f=e[h+1],e[h]=p,e[h+1]=T}for(let l=0;l<50;l+=10){for(let S=0;S<10;S++)r[S]=e[l+S];for(let S=0;S<10;S++)e[l+S]^=~r[(S+2)%10]&r[(S+4)%10]}e[0]^=uo[n],e[1]^=fo[n]}r.fill(0)}var lr,dr,mr,ao,Ee,io,so,co,po,uo,fo,ur,fr,qe,Q,ia,sa,ca,pa,ua,hr,fa,la,xr,da,ma,yr=M(()=>{"use strict";bt();ar();pr();lr=[],dr=[],mr=[],ao=BigInt(0),Ee=BigInt(1),io=BigInt(2),so=BigInt(7),co=BigInt(256),po=BigInt(113);for(let e=0,t=Ee,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],lr.push(2*(5*n+r)),dr.push((e+1)*(e+2)/2%64);let a=ao;for(let f=0;f<7;f++)t=(t<<Ee^(t>>so)*po)%co,t&io&&(a^=Ee<<(Ee<<BigInt(f))-Ee);mr.push(a)}[uo,fo]=er(mr,!0),ur=(e,t,r)=>r>32?or(e,t,r):tr(e,t,r),fr=(e,t,r)=>r>32?nr(e,t,r):rr(e,t,r);qe=class e extends Ve{constructor(t,r,n,a=!1,f=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=a,this.rounds=f,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,xt(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=ir(this.state)}keccak(){gt||wt(this.state32),lo(this.state32,this.rounds),gt||wt(this.state32),this.posOut=0,this.pos=0}update(t){yt(this);let{blockLen:r,state:n}=this;t=We(t);let a=t.length;for(let f=0;f<a;){let l=Math.min(r-this.pos,a-f);for(let S=0;S<l;S++)n[this.pos++]^=t[f++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:n,blockLen:a}=this;t[n]^=r,r&128&&n===a-1&&this.keccak(),t[a-1]^=128,this.keccak()}writeInto(t){yt(this,!1),Se(t),this.finish();let r=this.state,{blockLen:n}=this;for(let a=0,f=t.length;a<f;){this.posOut>=n&&this.keccak();let l=Math.min(n-this.posOut,f-a);t.set(r.subarray(this.posOut,this.posOut+l),a),this.posOut+=l,a+=l}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return xt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Zt(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:r,suffix:n,outputLen:a,rounds:f,enableXOF:l}=this;return t||(t=new e(r,n,a,l,f)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=f,t.suffix=n,t.outputLen=a,t.enableXOF=l,t.destroyed=this.destroyed,t}},Q=(e,t,r)=>sr(()=>new qe(t,e,r)),ia=Q(6,144,224/8),sa=Q(6,136,256/8),ca=Q(6,104,384/8),pa=Q(6,72,512/8),ua=Q(1,144,224/8),hr=Q(1,136,256/8),fa=Q(1,104,384/8),la=Q(1,72,512/8),xr=(e,t,r)=>cr((n={})=>new qe(t,e,n.dkLen===void 0?r:n.dkLen,!0)),da=xr(31,168,128/8),ma=xr(31,136,256/8)});function ve(e,t){let r=t||"hex",n=hr(Z(e,{strict:!1})?ht(e):e);return r==="bytes"?n:D(n)}var It=M(()=>{"use strict";yr();me();Oe();we()});var se,St=M(()=>{"use strict";ae();se=class extends H{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}});var pe,Et=M(()=>{"use strict";pe=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){let r=super.get(t);return super.has(t)&&r!==void 0&&(this.delete(t),super.set(t,r)),r}set(t,r){if(super.set(t,r),this.maxSize&&this.size>this.maxSize){let n=this.keys().next().value;n&&this.delete(n)}return this}}});function br(e,t){if(vt.has(`${e}.${t}`))return vt.get(`${e}.${t}`);let r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=ve(Ne(r),"bytes"),a=(t?r.substring(`${t}0x`.length):r).split("");for(let l=0;l<40;l+=2)n[l>>1]>>4>=8&&a[l]&&(a[l]=a[l].toUpperCase()),(n[l>>1]&15)>=8&&a[l+1]&&(a[l+1]=a[l+1].toUpperCase());let f=`0x${a.join("")}`;return vt.set(`${e}.${t}`,f),f}var vt,gr=M(()=>{"use strict";Oe();It();Et();vt=new pe(8192)});function Te(e,t){let{strict:r=!0}=t??{},n=`${e}.${r}`;if(Tt.has(n))return Tt.get(n);let a=mo.test(e)?e.toLowerCase()===e?!0:r?br(e)===e:!0:!1;return Tt.set(n,a),a}var mo,Tt,Ft=M(()=>{"use strict";Et();gr();mo=/^0x[a-fA-F0-9]{40}$/,Tt=new pe(8192)});function ee(e){return typeof e[0]=="string"?j(e):wr(e)}function wr(e){let t=0;for(let a of e)t+=a.length;let r=new Uint8Array(t),n=0;for(let a of e)r.set(a,n),n+=a.length;return r}function j(e){return`0x${e.reduce((t,r)=>t+r.replace("0x",""),"")}`}var At=M(()=>{"use strict"});function Ir(e,t,r,{strict:n}={}){return Z(e,{strict:!1})?xo(e,t,r,{strict:n}):ho(e,t,r,{strict:n})}function Sr(e,t){if(typeof t=="number"&&t>0&&t>$(e)-1)throw new xe({offset:t,position:"start",size:$(e)})}function Er(e,t,r){if(typeof t=="number"&&typeof r=="number"&&$(e)!==r-t)throw new xe({offset:r,position:"end",size:$(e)})}function ho(e,t,r,{strict:n}={}){Sr(e,t);let a=e.slice(t,r);return n&&Er(a,t,r),a}function xo(e,t,r,{strict:n}={}){Sr(e,t);let a=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return n&&Er(a,t,r),a}var vr=M(()=>{"use strict";lt();me();he()});function Ct(e,t){if(e.length!==t.length)throw new He({expectedLength:e.length,givenLength:t.length});let r=yo({params:e,values:t}),n=Rt(r);return n.length===0?"0x":n}function yo({params:e,values:t}){let r=[];for(let n=0;n<e.length;n++)r.push(Pt({param:e[n],value:t[n]}));return r}function Pt({param:e,value:t}){let r=To(e.type);if(r){let[n,a]=r;return go(t,{length:n,param:{...e,type:a}})}if(e.type==="tuple")return vo(t,{param:e});if(e.type==="address")return bo(t);if(e.type==="bool")return Io(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){let n=e.type.startsWith("int");return So(t,{signed:n})}if(e.type.startsWith("bytes"))return wo(t,{param:e});if(e.type==="string")return Eo(t);throw new ze(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Rt(e){let t=0;for(let f=0;f<e.length;f++){let{dynamic:l,encoded:S}=e[f];l?t+=32:t+=$(S)}let r=[],n=[],a=0;for(let f=0;f<e.length;f++){let{dynamic:l,encoded:S}=e[f];l?(r.push(K(t+a,{size:32})),n.push(S),a+=$(S)):r.push(S)}return ee([...r,...n])}function bo(e){if(!Te(e))throw new se({address:e});return{dynamic:!1,encoded:q(e.toLowerCase())}}function go(e,{length:t,param:r}){let n=t===null;if(!Array.isArray(e))throw new Le(e);if(!n&&e.length!==t)throw new Be({expectedLength:t,givenLength:e.length,type:`${r.type}[${t}]`});let a=!1,f=[];for(let l=0;l<e.length;l++){let S=Pt({param:r,value:e[l]});S.dynamic&&(a=!0),f.push(S)}if(n||a){let l=Rt(f);if(n){let S=K(f.length,{size:32});return{dynamic:!0,encoded:f.length>0?ee([S,l]):S}}if(a)return{dynamic:!0,encoded:l}}return{dynamic:!1,encoded:ee(f.map(({encoded:l})=>l))}}function wo(e,{param:t}){let[,r]=t.type.split("bytes"),n=$(e);if(!r){let a=e;return n%32!==0&&(a=q(a,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:ee([q(K(n,{size:32})),a])}}if(n!==Number.parseInt(r))throw new ke({expectedSize:Number.parseInt(r),value:e});return{dynamic:!1,encoded:q(e,{dir:"right"})}}function Io(e){if(typeof e!="boolean")throw new H(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:q(De(e))}}function So(e,{signed:t}){return{dynamic:!1,encoded:K(e,{size:32,signed:t})}}function Eo(e){let t=_e(e),r=Math.ceil($(t)/32),n=[];for(let a=0;a<r;a++)n.push(q(Ir(t,a*32,(a+1)*32),{dir:"right"}));return{dynamic:!0,encoded:ee([q(K($(t),{size:32})),...n])}}function vo(e,{param:t}){let r=!1,n=[];for(let a=0;a<t.components.length;a++){let f=t.components[a],l=Array.isArray(e)?a:f.name,S=Pt({param:f,value:e[l]});n.push(S),S.dynamic&&(r=!0)}return{dynamic:r,encoded:r?Rt(n):ee(n.map(({encoded:a})=>a))}}function To(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}var Tr=M(()=>{"use strict";Kt();St();ae();Ft();At();be();he();vr();we()});function Mt(e,t){if(!Te(e,{strict:!1}))throw new se({address:e});if(!Te(t,{strict:!1}))throw new se({address:t});return e.toLowerCase()===t.toLowerCase()}var Fr=M(()=>{"use strict";St();Ft()});var Do={};Kr(Do,{Deferred:()=>W,FrakContextManager:()=>te,FrakRpcError:()=>k,PressInteractionEncoder:()=>Ur,PurchaseInteractionEncoder:()=>Dr,ReferralInteractionEncoder:()=>Ze,RpcErrorCodes:()=>L,WebShopInteractionEncoder:()=>_r,compressJson:()=>le,createIFrameNexusClient:()=>pt,createIframe:()=>st,decompressDataAndCheckHash:()=>ne,decompressJson:()=>de,displayModal:()=>re,hashAndCompressData:()=>oe,interactionTypes:()=>V,openSso:()=>zr,processReferral:()=>Qe,productTypes:()=>_,productTypesMask:()=>kr,referralInteraction:()=>Nr,sendInteraction:()=>Xe,sendTransaction:()=>$r,siweAuthenticate:()=>Lr,walletStatus:()=>Ye,watchWalletStatus:()=>Ge});var k=class extends Error{constructor(r,n,a){super(n);this.code=r;this.data=a}};var Pe=class extends k{constructor(t){super(L.internalError,t)}};var L={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603,serverError:-32e3,clientNotConnected:-32001,configError:-32002,corruptedResponse:-32003,clientAborted:-32004,walletNotConnected:-32005,serverErrorForInteractionDelegation:-32006};var W=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((t,r)=>{this._resolve=t,this._reject=r})}get promise(){return this._promise}resolve=t=>{this._resolve?.(t)};reject=t=>{this._reject?.(t)}};var Gr=(e="#nexus-share-button > button")=>document.querySelector(e),Xr=(e,t)=>{if(e){t?.removeAttribute("disabled");return}t?.setAttribute("disabled","")},$t=e=>t=>{let r=Gr(t?.metadata?.buttonShare);Xr(e,r)},Ut=$t(!0),Dt=$t(!1);var _t=Ce(ot(),1),at=Ce(nt(),1);async function oe(e){let t=(0,at.sha256)(JSON.stringify(e)),r={...e,validationHash:t},n=await le(r),a=(0,at.sha256)(n);return{compressed:n,compressedHash:a}}async function le(e){return(0,_t.compressToBase64)(JSON.stringify(e))}var Nt=Ce(ot(),1),it=Ce(nt(),1);async function ne(e){if(!(e?.compressed&&e?.compressedHash))throw new k(L.corruptedResponse,"Missing compressed data");let t=await de(e.compressed);if(!t)throw new k(L.corruptedResponse,"Invalid compressed data");if(!t?.validationHash)throw new k(L.corruptedResponse,"Missing validation hash");if((0,it.sha256)(e.compressed)!==e.compressedHash)throw new k(L.corruptedResponse,"Invalid compressed hash");let{validationHash:n,...a}=t;if((0,it.sha256)(JSON.stringify(a))!==t.validationHash)throw new k(L.corruptedResponse,"Invalid data validation hash");return t}async function de(e){let t=await(0,Nt.decompressFromBase64)(e);try{return JSON.parse(t)}catch(r){return console.error("Invalid compressed data",{e:r,decompressed:t}),null}}var ce="nexus-wallet-backup";function Ot(){let e=new Map;return{createChannel:t=>{let r=Math.random().toString(36).substring(7);return e.set(r,t),r},getRpcResolver:t=>e.get(t),removeChannel:t=>e.delete(t),destroy:()=>e.clear()}}var Me={id:"nexus-wallet",name:"nexus-wallet",allow:"publickey-credentials-get *; clipboard-write; web-share *",style:{width:"0",height:"0",border:"0",position:"absolute",zIndex:1e3,top:"-1000px",left:"-1000px"}};function st({walletBaseUrl:e,config:t}){Dt(t);let r=document.querySelector("#nexus-wallet");if(r)return Promise.resolve(r);let n=document.createElement("iframe");return n.id=Me.id,n.name=Me.name,n.allow=Me.allow,n.style.zIndex=Me.style.zIndex.toString(),ct({iframe:n,isVisible:!1}),document.body.appendChild(n),new Promise(a=>{n?.addEventListener("load",()=>a(n)),n.src=`${e}/listener`})}function ct({iframe:e,isVisible:t}){if(!t){e.style.width="0",e.style.height="0",e.style.border="0",e.style.position="fixed",e.style.top="-1000px",e.style.left="-1000px";return}e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.pointerEvents="auto"}function jt({iframe:e}){let t=new W;return{handleEvent:async n=>{switch(n.iframeLifecycle){case"connected":t.resolve(!0);break;case"do-backup":n.data.backup?localStorage.setItem(ce,n.data.backup):localStorage.removeItem(ce);break;case"remove-backup":localStorage.removeItem(ce);break;case"show":case"hide":ct({iframe:e,isVisible:n.iframeLifecycle==="show"});break}},isConnected:t.promise}}function Vt({nexusWalletUrl:e,iframe:t,channelManager:r,iframeLifecycleManager:n}){if(typeof window>"u")throw new k(L.configError,"iframe client should be used in the browser");if(!t.contentWindow)throw new k(L.configError,"The iframe does not have a product window");let a=t.contentWindow,f=async p=>{if(!(p.origin&&URL.canParse(p.origin))||new URL(p.origin).origin.toLowerCase()!==new URL(e).origin.toLowerCase())return;if("iframeLifecycle"in p.data){await n.handleEvent(p.data);return}if("clientLifecycle"in p.data){console.error("Client lifecycle event received on the client side, dismissing it");return}let T=p.data.id,h=r.getRpcResolver(T);h&&await h(p.data)};return window.addEventListener("message",f),{sendEvent:p=>{a.postMessage(p,{targetOrigin:e})},cleanup:()=>{window.removeEventListener("message",f)}}}function pt({config:e,iframe:t}){let r=Ot(),n=jt({iframe:t}),a=Vt({nexusWalletUrl:e.walletUrl,iframe:t,channelManager:r,iframeLifecycleManager:n}),f=async T=>{if(!await n.isConnected)throw new k(L.clientNotConnected,"The iframe provider isn't connected yet");let d=new W,x=r.createChannel(async b=>{let o=await ne(b.data);o.error?d.reject(new k(o.error.code,o.error.message,o.error?.data)):d.resolve(o.result),r.removeChannel(x)}),i=await oe(T);return a.sendEvent({id:x,topic:T.method,data:i}),d.promise},l=async(T,h)=>{if(!await n.isConnected)throw new k(L.clientNotConnected,"The iframe provider isn't connected yet");let x=r.createChannel(async b=>{let o=await ne(b.data);if(o.result)h(o.result);else throw new Pe("No valid result in the response")}),i=await oe(T);a.sendEvent({id:x,topic:T.method,data:i})},S=async()=>{r.destroy(),a.cleanup(),t.remove()},p=Yr({config:e,messageHandler:a,lifecycleManager:n});return{config:e,waitForConnection:n.isConnected,waitForSetup:p,request:f,listenerRequest:l,destroy:S}}async function Yr({config:e,messageHandler:t,lifecycleManager:r}){await r.isConnected,Ut(e);let n=async()=>{let f=e.metadata.css;f&&t.sendEvent({clientLifecycle:"modal-css",data:{cssLink:f}})},a=async()=>{if(typeof window>"u")return;let f=window.localStorage.getItem(ce);f&&t.sendEvent({clientLifecycle:"restore-backup",data:{backup:f}})};await Promise.all([n(),a()])}var Ke=256,Je;function Ar(e=11){if(!Je||Ke+e>256*2){Je="",Ke=0;for(let t=0;t<256;t++)Je+=(256+Math.random()*256|0).toString(16).substring(1)}return Je.substring(Ke,Ke+++e)}Tr();Oe();we();At();Fr();It();be();var Bt="fCtx";function Fo(e){return btoa(Array.from(e,t=>String.fromCharCode(t)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Ao(e){let t=e.length%4;return Uint8Array.from(atob(e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(t===0?0:4-t),"=")),r=>r.charCodeAt(0))}function Cr(e){if(e?.r)try{let t=Ie(e.r);return Fo(t)}catch(t){console.error("Error compressing Frak context",{e:t,context:e})}}function Pr(e){if(!(!e||e.length===0))try{let t=Ao(e);return{r:ge(t,{size:20})}}catch(t){console.error("Error decompressing Frak context",{e:t,context:e})}}function Rr({url:e}){if(!e)return null;let r=new URL(e).searchParams.get(Bt);return r?Pr(r):null}function Mr({url:e,context:t}){if(!e)return null;let r=Rr({url:e}),n=r?{...r,...t}:t;if(!n.r)return null;let a=Cr(n);if(!a)return null;let f=new URL(e);return f.searchParams.set(Bt,a),f.toString()}function Br(e){let t=new URL(e);return t.searchParams.delete(Bt),t.toString()}function Co({url:e,context:t}){if(!window.location?.href||typeof window>"u"){console.error("No window found, can't update context");return}let r=e??window.location.href,n;t!==null?n=Mr({url:r,context:t}):n=Br(r),n&&window.history.replaceState(null,"",n.toString())}var te={compress:Cr,decompress:Pr,parse:Rr,update:Mr,remove:Br,replaceUrl:Co};var _={dapp:1,press:2,webshop:3,referral:30,purchase:31},kr=Object.entries(_).reduce((e,[t,r])=>(e[t]=BigInt(1)<<BigInt(r),e),{});var V={press:{openArticle:"0xc0a24ffb",readArticle:"0xd5bd0fbe"},dapp:{proofVerifiableStorageUpdate:"0x2ab2aeef",callableVerifiableStorageUpdate:"0xa07da986"},webshop:{open:"0xb311798f"},referral:{referred:"0x010cc3b9",createLink:"0xb2c0f17c"},purchase:{started:"0xd87e90c3",completed:"0x8403aeb4"}};function Ge(e,t){return e.listenerRequest({method:"frak_listenToWalletStatus"},t)}function Hr({domain:e}){return ve(D(e))}async function Xe(e,{productId:t,interaction:r,validation:n}){let a=t??Hr(e.config);return await e.request({method:"frak_sendInteraction",params:[a,r,n]})}async function re(e,{steps:t,metadata:r}){return await e.request({method:"frak_displayModal",params:[t,e.config.metadata.name,r]})}async function zr(e,t){let{metadata:r}=e.config;await e.request({method:"frak_sso",params:[t,r.name,r.css]})}function kt(){return Ar(96)}async function Lr(e,{siwe:t,metadata:r}){let n=t?.statement??`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`,a={...t,statement:n,nonce:t?.nonce??kt(),uri:t?.uri??`https://${e.config.domain}`,version:t?.version??"1",domain:e.config.domain};return(await re(e,{metadata:r,steps:{login:{},siweAuthenticate:{siwe:a}}})).siweAuthenticate}async function $r(e,{tx:t,metadata:r}){return(await re(e,{metadata:r,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}async function Ye(e,t){let r=new W,n=!1;return await Ge(e,a=>{t?.(a),n||(r.resolve(a),n=!0)}),r.promise}function Po({articleId:e}){let t=j([V.press.openArticle,U(e,{size:32})]);return{handlerTypeDenominator:D(_.press),interactionData:t}}function Ro({articleId:e}){let t=j([V.press.readArticle,U(e,{size:32})]);return{handlerTypeDenominator:D(_.press),interactionData:t}}var Ur={openArticle:Po,readArticle:Ro};function Mo(){let e=j([V.referral.createLink,"0x"]);return{handlerTypeDenominator:D(_.referral),interactionData:e}}function Bo({referrer:e}){let t=j([V.referral.referred,U(e,{size:32})]);return{handlerTypeDenominator:D(_.referral),interactionData:t}}var Ze={createLink:Mo,referred:Bo};function ko({purchaseId:e}){let t=j([V.purchase.started,U(e,{size:32})]);return{handlerTypeDenominator:D(_.purchase),interactionData:t}}function Ho({purchaseId:e,proof:t}){let r=Ct([{type:"uint256"},{type:"bytes32[]"}],[BigInt(e),t]),n=j([V.purchase.completed,r]);return{handlerTypeDenominator:D(_.purchase),interactionData:n}}var Dr={startPurchase:ko,completedPurchase:Ho};function zo(){let e=j([V.webshop.open,"0x"]);return{handlerTypeDenominator:D(_.webshop),interactionData:e}}var _r={open:zo};async function Qe(e,{walletStatus:t,frakContext:r,modalConfig:n,productId:a,options:f}){let l=!1;async function S(){if(!l)return l=!0,$o(e,{modalConfig:n,walletStatus:t})}async function p(T){let h=Ze.referred({referrer:T});await Xe(e,{productId:a,interaction:h})}try{let{status:T,currentWallet:h}=await Lo({initialWalletStatus:t,getFreshWalletStatus:S,pushReferralInteraction:p,frakContext:r});return te.replaceUrl({url:window.location?.href,context:f?.alwaysAppendUrl?{r:h}:null}),T}catch(T){return console.log("Error processing referral",{error:T}),te.replaceUrl({url:window.location?.href,context:f?.alwaysAppendUrl?{r:t?.wallet}:null}),Uo(T)}}async function Lo({initialWalletStatus:e,getFreshWalletStatus:t,pushReferralInteraction:r,frakContext:n}){let a=e?.wallet;return n?.r?(a||(a=await t()),a&&Mt(n.r,a)?{status:"self-referral",currentWallet:a}:(e?.interactionSession||(a=await t()),await r(n.r),{status:"success",currentWallet:a})):{status:"no-referrer",currentWallet:a}}async function $o(e,{modalConfig:t,walletStatus:r}){return r?.interactionSession?r.wallet??void 0:t?(await re(e,t))?.login?.wallet??void 0:void 0}function Uo(e){if(e instanceof k)switch(e.code){case L.walletNotConnected:return"no-wallet";case L.serverErrorForInteractionDelegation:return"no-session";default:return"error"}return"error"}async function Nr(e,{productId:t,modalConfig:r,options:n}={}){let a=te.parse({url:window.location.href}),f=await Ye(e);try{return await Qe(e,{walletStatus:f,frakContext:a,modalConfig:r,productId:t,options:n})}catch(l){return l}}return Jr(Do);})();
|
|
6
|
+
`),{name:"InvalidArrayError"})}}});var xe,ye,ft=R(()=>{"use strict";ae();xe=class extends H{constructor({offset:t,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}},ye=class extends H{constructor({size:t,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}});function U(e,{dir:t,size:r=32}={}){return typeof e=="string"?q(e,{dir:t,size:r}):Jt(e,{dir:t,size:r})}function q(e,{dir:t,size:r=32}={}){if(r===null)return e;let n=e.replace("0x","");if(n.length>r*2)throw new ye({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[t==="right"?"padEnd":"padStart"](r*2,"0")}`}function Jt(e,{dir:t,size:r=32}={}){if(r===null)return e;if(e.length>r)throw new ye({size:e.length,targetSize:r,type:"bytes"});let n=new Uint8Array(r);for(let a=0;a<r;a++){let l=t==="right";n[l?a:r-a-1]=e[l?a:e.length-a-1]}return n}var ge=R(()=>{"use strict";ft()});var $e,Ue,dt=R(()=>{"use strict";ae();$e=class extends H{constructor({max:t,min:r,signed:n,size:a,value:l}){super(`Number "${l}" is not in safe ${a?`${a*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${t?`(${r} to ${t})`:`(above ${r})`}`,{name:"IntegerOutOfRangeError"})}},Ue=class extends H{constructor({givenSize:t,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}});function ie(e,{size:t}){if($(e)>t)throw new Ue({givenSize:$(e),maxSize:t})}var mt=R(()=>{"use strict";dt();he()});function D(e,t={}){return typeof e=="number"||typeof e=="bigint"?K(e,t):typeof e=="string"?_e(e,t):typeof e=="boolean"?De(e,t):be(e,t)}function De(e,t={}){let r=`0x${Number(e)}`;return typeof t.size=="number"?(ie(r,{size:t.size}),U(r,{size:t.size})):r}function be(e,t={}){let r="";for(let a=0;a<e.length;a++)r+=to[e[a]];let n=`0x${r}`;return typeof t.size=="number"?(ie(n,{size:t.size}),U(n,{dir:"right",size:t.size})):n}function K(e,t={}){let{signed:r,size:n}=t,a=BigInt(e),l;n?r?l=(1n<<BigInt(n)*8n-1n)-1n:l=2n**(BigInt(n)*8n)-1n:typeof e=="number"&&(l=BigInt(Number.MAX_SAFE_INTEGER));let f=typeof l=="bigint"&&r?-l-1n:0;if(l&&a>l||a<f){let p=typeof e=="bigint"?"n":"";throw new $e({max:l?`${l}${p}`:void 0,min:`${f}${p}`,signed:r,size:n,value:`${e}${p}`})}let S=`0x${(r&&a<0?(1n<<BigInt(n*8))+BigInt(a):a).toString(16)}`;return n?U(S,{size:n}):S}function _e(e,t={}){let r=ro.encode(e);return be(r,t)}var to,ro,we=R(()=>{"use strict";dt();ge();mt();to=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));ro=new TextEncoder});function ht(e,t={}){return typeof e=="number"||typeof e=="bigint"?Yt(e,t):typeof e=="boolean"?Xt(e,t):Q(e)?Se(e,t):Ne(e,t)}function Xt(e,t={}){let r=new Uint8Array(1);return r[0]=Number(e),typeof t.size=="number"?(ie(r,{size:t.size}),U(r,{size:t.size})):r}function Gt(e){if(e>=G.zero&&e<=G.nine)return e-G.zero;if(e>=G.A&&e<=G.F)return e-(G.A-10);if(e>=G.a&&e<=G.f)return e-(G.a-10)}function Se(e,t={}){let r=e;t.size&&(ie(r,{size:t.size}),r=U(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);let a=n.length/2,l=new Uint8Array(a);for(let f=0,S=0;f<a;f++){let p=Gt(n.charCodeAt(S++)),v=Gt(n.charCodeAt(S++));if(p===void 0||v===void 0)throw new H(`Invalid byte sequence ("${n[S-2]}${n[S-1]}" in "${n}").`);l[f]=p*16+v}return l}function Yt(e,t){let r=K(e,t);return Se(r)}function Ne(e,t={}){let r=oo.encode(e);return typeof t.size=="number"?(ie(r,{size:t.size}),U(r,{dir:"right",size:t.size})):r}var oo,G,Oe=R(()=>{"use strict";ae();me();ge();mt();we();oo=new TextEncoder;G={zero:48,nine:57,A:65,F:70,a:97,f:102}});function xt(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function no(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Ie(e,...t){if(!no(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function yt(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Zt(e,t){Ie(e);let r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var gt=R(()=>{"use strict"});function ao(e,t=!1){return t?{h:Number(e&je),l:Number(e>>Qt&je)}:{h:Number(e>>Qt&je)|0,l:Number(e&je)|0}}function er(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let a=0;a<e.length;a++){let{h:l,l:f}=ao(e[a],t);[r[a],n[a]]=[l,f]}return[r,n]}var je,Qt,tr,rr,or,nr,ar=R(()=>{"use strict";je=BigInt(4294967295),Qt=BigInt(32);tr=(e,t,r)=>e<<r|t>>>32-r,rr=(e,t,r)=>t<<r|e>>>32-r,or=(e,t,r)=>t<<r-32|e>>>64-r,nr=(e,t,r)=>e<<r-32|t>>>64-r});function wt(e){for(let t=0;t<e.length;t++)e[t]=io(e[t])}function so(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function We(e){return typeof e=="string"&&(e=so(e)),Ie(e),e}function sr(e){let t=n=>e().update(We(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function cr(e){let t=(n,a)=>e(a).update(We(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}var ir,bt,io,Ve,na,pr=R(()=>{"use strict";gt();ir=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),bt=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,io=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;Ve=class{clone(){return this._cloneInto()}},na={}.toString});function xo(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let f=0;f<10;f++)r[f]=e[f]^e[f+10]^e[f+20]^e[f+30]^e[f+40];for(let f=0;f<10;f+=2){let S=(f+8)%10,p=(f+2)%10,v=r[p],h=r[p+1],d=ur(v,h,1)^r[S],x=lr(v,h,1)^r[S+1];for(let i=0;i<50;i+=10)e[f+i]^=d,e[f+i+1]^=x}let a=e[2],l=e[3];for(let f=0;f<24;f++){let S=dr[f],p=ur(a,l,S),v=lr(a,l,S),h=fr[f];a=e[h],l=e[h+1],e[h]=p,e[h+1]=v}for(let f=0;f<50;f+=10){for(let S=0;S<10;S++)r[S]=e[f+S];for(let S=0;S<10;S++)e[f+S]^=~r[(S+2)%10]&r[(S+4)%10]}e[0]^=mo[n],e[1]^=ho[n]}r.fill(0)}var fr,dr,mr,co,Te,po,uo,lo,fo,mo,ho,ur,lr,qe,ee,pa,ua,la,fa,da,hr,ma,ha,xr,xa,ya,yr=R(()=>{"use strict";gt();ar();pr();fr=[],dr=[],mr=[],co=BigInt(0),Te=BigInt(1),po=BigInt(2),uo=BigInt(7),lo=BigInt(256),fo=BigInt(113);for(let e=0,t=Te,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],fr.push(2*(5*n+r)),dr.push((e+1)*(e+2)/2%64);let a=co;for(let l=0;l<7;l++)t=(t<<Te^(t>>uo)*fo)%lo,t&po&&(a^=Te<<(Te<<BigInt(l))-Te);mr.push(a)}[mo,ho]=er(mr,!0),ur=(e,t,r)=>r>32?or(e,t,r):tr(e,t,r),lr=(e,t,r)=>r>32?nr(e,t,r):rr(e,t,r);qe=class e extends Ve{constructor(t,r,n,a=!1,l=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=a,this.rounds=l,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,xt(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=ir(this.state)}keccak(){bt||wt(this.state32),xo(this.state32,this.rounds),bt||wt(this.state32),this.posOut=0,this.pos=0}update(t){yt(this);let{blockLen:r,state:n}=this;t=We(t);let a=t.length;for(let l=0;l<a;){let f=Math.min(r-this.pos,a-l);for(let S=0;S<f;S++)n[this.pos++]^=t[l++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:n,blockLen:a}=this;t[n]^=r,r&128&&n===a-1&&this.keccak(),t[a-1]^=128,this.keccak()}writeInto(t){yt(this,!1),Ie(t),this.finish();let r=this.state,{blockLen:n}=this;for(let a=0,l=t.length;a<l;){this.posOut>=n&&this.keccak();let f=Math.min(n-this.posOut,l-a);t.set(r.subarray(this.posOut,this.posOut+f),a),this.posOut+=f,a+=f}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return xt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Zt(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:r,suffix:n,outputLen:a,rounds:l,enableXOF:f}=this;return t||(t=new e(r,n,a,f,l)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=l,t.suffix=n,t.outputLen=a,t.enableXOF=f,t.destroyed=this.destroyed,t}},ee=(e,t,r)=>sr(()=>new qe(t,e,r)),pa=ee(6,144,224/8),ua=ee(6,136,256/8),la=ee(6,104,384/8),fa=ee(6,72,512/8),da=ee(1,144,224/8),hr=ee(1,136,256/8),ma=ee(1,104,384/8),ha=ee(1,72,512/8),xr=(e,t,r)=>cr((n={})=>new qe(t,e,n.dkLen===void 0?r:n.dkLen,!0)),xa=xr(31,168,128/8),ya=xr(31,136,256/8)});function Ee(e,t){let r=t||"hex",n=hr(Q(e,{strict:!1})?ht(e):e);return r==="bytes"?n:D(n)}var St=R(()=>{"use strict";yr();me();Oe();we()});var se,It=R(()=>{"use strict";ae();se=class extends H{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}});var pe,Tt=R(()=>{"use strict";pe=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){let r=super.get(t);return super.has(t)&&r!==void 0&&(this.delete(t),super.set(t,r)),r}set(t,r){if(super.set(t,r),this.maxSize&&this.size>this.maxSize){let n=this.keys().next().value;n&&this.delete(n)}return this}}});function gr(e,t){if(Et.has(`${e}.${t}`))return Et.get(`${e}.${t}`);let r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=Ee(Ne(r),"bytes"),a=(t?r.substring(`${t}0x`.length):r).split("");for(let f=0;f<40;f+=2)n[f>>1]>>4>=8&&a[f]&&(a[f]=a[f].toUpperCase()),(n[f>>1]&15)>=8&&a[f+1]&&(a[f+1]=a[f+1].toUpperCase());let l=`0x${a.join("")}`;return Et.set(`${e}.${t}`,l),l}var Et,br=R(()=>{"use strict";Oe();St();Tt();Et=new pe(8192)});function ve(e,t){let{strict:r=!0}=t??{},n=`${e}.${r}`;if(vt.has(n))return vt.get(n);let a=yo.test(e)?e.toLowerCase()===e?!0:r?gr(e)===e:!0:!1;return vt.set(n,a),a}var yo,vt,Ft=R(()=>{"use strict";Tt();br();yo=/^0x[a-fA-F0-9]{40}$/,vt=new pe(8192)});function te(e){return typeof e[0]=="string"?j(e):wr(e)}function wr(e){let t=0;for(let a of e)t+=a.length;let r=new Uint8Array(t),n=0;for(let a of e)r.set(a,n),n+=a.length;return r}function j(e){return`0x${e.reduce((t,r)=>t+r.replace("0x",""),"")}`}var At=R(()=>{"use strict"});function Sr(e,t,r,{strict:n}={}){return Q(e,{strict:!1})?bo(e,t,r,{strict:n}):go(e,t,r,{strict:n})}function Ir(e,t){if(typeof t=="number"&&t>0&&t>$(e)-1)throw new xe({offset:t,position:"start",size:$(e)})}function Tr(e,t,r){if(typeof t=="number"&&typeof r=="number"&&$(e)!==r-t)throw new xe({offset:r,position:"end",size:$(e)})}function go(e,t,r,{strict:n}={}){Ir(e,t);let a=e.slice(t,r);return n&&Tr(a,t,r),a}function bo(e,t,r,{strict:n}={}){Ir(e,t);let a=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return n&&Tr(a,t,r),a}var Er=R(()=>{"use strict";ft();me();he()});function Ct(e,t){if(e.length!==t.length)throw new He({expectedLength:e.length,givenLength:t.length});let r=wo({params:e,values:t}),n=Mt(r);return n.length===0?"0x":n}function wo({params:e,values:t}){let r=[];for(let n=0;n<e.length;n++)r.push(Pt({param:e[n],value:t[n]}));return r}function Pt({param:e,value:t}){let r=Co(e.type);if(r){let[n,a]=r;return Io(t,{length:n,param:{...e,type:a}})}if(e.type==="tuple")return Ao(t,{param:e});if(e.type==="address")return So(t);if(e.type==="bool")return Eo(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){let n=e.type.startsWith("int");return vo(t,{signed:n})}if(e.type.startsWith("bytes"))return To(t,{param:e});if(e.type==="string")return Fo(t);throw new ze(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Mt(e){let t=0;for(let l=0;l<e.length;l++){let{dynamic:f,encoded:S}=e[l];f?t+=32:t+=$(S)}let r=[],n=[],a=0;for(let l=0;l<e.length;l++){let{dynamic:f,encoded:S}=e[l];f?(r.push(K(t+a,{size:32})),n.push(S),a+=$(S)):r.push(S)}return te([...r,...n])}function So(e){if(!ve(e))throw new se({address:e});return{dynamic:!1,encoded:q(e.toLowerCase())}}function Io(e,{length:t,param:r}){let n=t===null;if(!Array.isArray(e))throw new Le(e);if(!n&&e.length!==t)throw new ke({expectedLength:t,givenLength:e.length,type:`${r.type}[${t}]`});let a=!1,l=[];for(let f=0;f<e.length;f++){let S=Pt({param:r,value:e[f]});S.dynamic&&(a=!0),l.push(S)}if(n||a){let f=Mt(l);if(n){let S=K(l.length,{size:32});return{dynamic:!0,encoded:l.length>0?te([S,f]):S}}if(a)return{dynamic:!0,encoded:f}}return{dynamic:!1,encoded:te(l.map(({encoded:f})=>f))}}function To(e,{param:t}){let[,r]=t.type.split("bytes"),n=$(e);if(!r){let a=e;return n%32!==0&&(a=q(a,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:te([q(K(n,{size:32})),a])}}if(n!==Number.parseInt(r))throw new Be({expectedSize:Number.parseInt(r),value:e});return{dynamic:!1,encoded:q(e,{dir:"right"})}}function Eo(e){if(typeof e!="boolean")throw new H(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:q(De(e))}}function vo(e,{signed:t}){return{dynamic:!1,encoded:K(e,{size:32,signed:t})}}function Fo(e){let t=_e(e),r=Math.ceil($(t)/32),n=[];for(let a=0;a<r;a++)n.push(q(Sr(t,a*32,(a+1)*32),{dir:"right"}));return{dynamic:!0,encoded:te([q(K($(t),{size:32})),...n])}}function Ao(e,{param:t}){let r=!1,n=[];for(let a=0;a<t.components.length;a++){let l=t.components[a],f=Array.isArray(e)?a:l.name,S=Pt({param:l,value:e[f]});n.push(S),S.dynamic&&(r=!0)}return{dynamic:r,encoded:r?Mt(n):te(n.map(({encoded:a})=>a))}}function Co(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}var vr=R(()=>{"use strict";Kt();It();ae();Ft();At();ge();he();Er();we()});function Rt(e,t){if(!ve(e,{strict:!1}))throw new se({address:e});if(!ve(t,{strict:!1}))throw new se({address:t});return e.toLowerCase()===t.toLowerCase()}var Fr=R(()=>{"use strict";It();Ft()});var Oo={};Xr(Oo,{Deferred:()=>W,FrakContextManager:()=>re,FrakRpcError:()=>B,PressInteractionEncoder:()=>Nr,PurchaseInteractionEncoder:()=>Or,ReferralInteractionEncoder:()=>Ze,RpcErrorCodes:()=>L,WebShopInteractionEncoder:()=>jr,compressJson:()=>fe,createIFrameNexusClient:()=>pt,createIframe:()=>st,decompressDataAndCheckHash:()=>ne,decompressJson:()=>de,displayModal:()=>J,hashAndCompressData:()=>oe,interactionTypes:()=>V,modalBuilder:()=>_r,openSso:()=>Lr,processReferral:()=>Qe,productTypes:()=>_,productTypesMask:()=>Br,referralInteraction:()=>Vr,sendInteraction:()=>Xe,sendTransaction:()=>Dr,siweAuthenticate:()=>Ur,trackPurchaseStatus:()=>$r,watchWalletStatus:()=>Ge});var B=class extends Error{constructor(r,n,a){super(n);this.code=r;this.data=a}};var Pe=class extends B{constructor(t){super(L.internalError,t)}};var L={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603,serverError:-32e3,clientNotConnected:-32001,configError:-32002,corruptedResponse:-32003,clientAborted:-32004,walletNotConnected:-32005,serverErrorForInteractionDelegation:-32006};var W=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((t,r)=>{this._resolve=t,this._reject=r})}get promise(){return this._promise}resolve=t=>{this._resolve?.(t)};reject=t=>{this._reject?.(t)}};var Zr=(e="#nexus-share-button > button")=>document.querySelector(e),Qr=(e,t)=>{if(e){t?.removeAttribute("disabled");return}t?.setAttribute("disabled","")},$t=e=>t=>{let r=Zr(t?.metadata?.buttonShare);Qr(e,r)},Ut=$t(!0),Dt=$t(!1);var _t=Ce(ot(),1),at=Ce(nt(),1);async function oe(e){let t=(0,at.sha256)(JSON.stringify(e)),r={...e,validationHash:t},n=await fe(r),a=(0,at.sha256)(n);return{compressed:n,compressedHash:a}}async function fe(e){return(0,_t.compressToBase64)(JSON.stringify(e))}var Nt=Ce(ot(),1),it=Ce(nt(),1);async function ne(e){if(!(e?.compressed&&e?.compressedHash))throw new B(L.corruptedResponse,"Missing compressed data");let t=await de(e.compressed);if(!t)throw new B(L.corruptedResponse,"Invalid compressed data");if(!t?.validationHash)throw new B(L.corruptedResponse,"Missing validation hash");if((0,it.sha256)(e.compressed)!==e.compressedHash)throw new B(L.corruptedResponse,"Invalid compressed hash");let{validationHash:n,...a}=t;if((0,it.sha256)(JSON.stringify(a))!==t.validationHash)throw new B(L.corruptedResponse,"Invalid data validation hash");return t}async function de(e){let t=await(0,Nt.decompressFromBase64)(e);try{return JSON.parse(t)}catch(r){return console.error("Invalid compressed data",{e:r,decompressed:t}),null}}var ce="nexus-wallet-backup";function Ot(){let e=new Map;return{createChannel:t=>{let r=Math.random().toString(36).substring(7);return e.set(r,t),r},getRpcResolver:t=>e.get(t),removeChannel:t=>e.delete(t),destroy:()=>e.clear()}}var Re={id:"nexus-wallet",name:"nexus-wallet",allow:"publickey-credentials-get *; clipboard-write; web-share *",style:{width:"0",height:"0",border:"0",position:"absolute",zIndex:1e3,top:"-1000px",left:"-1000px"}};function st({walletBaseUrl:e,config:t}){Dt(t);let r=document.querySelector("#nexus-wallet");if(r)return Promise.resolve(r);let n=document.createElement("iframe");return n.id=Re.id,n.name=Re.name,n.allow=Re.allow,n.style.zIndex=Re.style.zIndex.toString(),ct({iframe:n,isVisible:!1}),document.body.appendChild(n),new Promise(a=>{n?.addEventListener("load",()=>a(n)),n.src=`${e}/listener`})}function ct({iframe:e,isVisible:t}){if(!t){e.style.width="0",e.style.height="0",e.style.border="0",e.style.position="fixed",e.style.top="-1000px",e.style.left="-1000px";return}e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.pointerEvents="auto"}function jt({iframe:e}){let t=new W;return{handleEvent:async n=>{switch(n.iframeLifecycle){case"connected":t.resolve(!0);break;case"do-backup":n.data.backup?localStorage.setItem(ce,n.data.backup):localStorage.removeItem(ce);break;case"remove-backup":localStorage.removeItem(ce);break;case"show":case"hide":ct({iframe:e,isVisible:n.iframeLifecycle==="show"});break}},isConnected:t.promise}}function Vt({nexusWalletUrl:e,iframe:t,channelManager:r,iframeLifecycleManager:n}){if(typeof window>"u")throw new B(L.configError,"iframe client should be used in the browser");if(!t.contentWindow)throw new B(L.configError,"The iframe does not have a product window");let a=t.contentWindow,l=async p=>{if(!(p.origin&&URL.canParse(p.origin))||new URL(p.origin).origin.toLowerCase()!==new URL(e).origin.toLowerCase())return;if("iframeLifecycle"in p.data){await n.handleEvent(p.data);return}if("clientLifecycle"in p.data){console.error("Client lifecycle event received on the client side, dismissing it");return}let v=p.data.id,h=r.getRpcResolver(v);h&&await h(p.data)};return window.addEventListener("message",l),{sendEvent:p=>{a.postMessage(p,{targetOrigin:e})},cleanup:()=>{window.removeEventListener("message",l)}}}function pt({config:e,iframe:t}){let r=Ot(),n=jt({iframe:t}),a=Vt({nexusWalletUrl:e.walletUrl,iframe:t,channelManager:r,iframeLifecycleManager:n}),l=async v=>{if(!await n.isConnected)throw new B(L.clientNotConnected,"The iframe provider isn't connected yet");let d=new W,x=r.createChannel(async g=>{let o=await ne(g.data);o.error?d.reject(new B(o.error.code,o.error.message,o.error?.data)):d.resolve(o.result),r.removeChannel(x)}),i=await oe(v);return a.sendEvent({id:x,topic:v.method,data:i}),d.promise},f=async(v,h)=>{if(!await n.isConnected)throw new B(L.clientNotConnected,"The iframe provider isn't connected yet");let x=r.createChannel(async g=>{let o=await ne(g.data);if(o.result)h(o.result);else throw new Pe("No valid result in the response")}),i=await oe(v);a.sendEvent({id:x,topic:v.method,data:i})},S=async()=>{r.destroy(),a.cleanup(),t.remove()},p=eo({config:e,messageHandler:a,lifecycleManager:n});return{config:e,waitForConnection:n.isConnected,waitForSetup:p,request:l,listenerRequest:f,destroy:S}}async function eo({config:e,messageHandler:t,lifecycleManager:r}){await r.isConnected,Ut(e);let n=async()=>{let l=e.metadata.css;l&&t.sendEvent({clientLifecycle:"modal-css",data:{cssLink:l}})},a=async()=>{if(typeof window>"u")return;let l=window.localStorage.getItem(ce);l&&t.sendEvent({clientLifecycle:"restore-backup",data:{backup:l}})};await Promise.all([n(),a()])}var Ke=256,Je;function Ar(e=11){if(!Je||Ke+e>256*2){Je="",Ke=0;for(let t=0;t<256;t++)Je+=(256+Math.random()*256|0).toString(16).substring(1)}return Je.substring(Ke,Ke+++e)}vr();Oe();we();At();Fr();St();ge();var kt="fCtx";function Po(e){return btoa(Array.from(e,t=>String.fromCharCode(t)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Mo(e){let t=e.length%4;return Uint8Array.from(atob(e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(t===0?0:4-t),"=")),r=>r.charCodeAt(0))}function Cr(e){if(e?.r)try{let t=Se(e.r);return Po(t)}catch(t){console.error("Error compressing Frak context",{e:t,context:e})}}function Pr(e){if(!(!e||e.length===0))try{let t=Mo(e);return{r:be(t,{size:20})}}catch(t){console.error("Error decompressing Frak context",{e:t,context:e})}}function Mr({url:e}){if(!e)return null;let r=new URL(e).searchParams.get(kt);return r?Pr(r):null}function Rr({url:e,context:t}){if(!e)return null;let r=Mr({url:e}),n=r?{...r,...t}:t;if(!n.r)return null;let a=Cr(n);if(!a)return null;let l=new URL(e);return l.searchParams.set(kt,a),l.toString()}function kr(e){let t=new URL(e);return t.searchParams.delete(kt),t.toString()}function Ro({url:e,context:t}){if(!window.location?.href||typeof window>"u"){console.error("No window found, can't update context");return}let r=e??window.location.href,n;t!==null?n=Rr({url:r,context:t}):n=kr(r),n&&window.history.replaceState(null,"",n.toString())}var re={compress:Cr,decompress:Pr,parse:Mr,update:Rr,remove:kr,replaceUrl:Ro};var _={dapp:1,press:2,webshop:3,referral:30,purchase:31},Br=Object.entries(_).reduce((e,[t,r])=>(e[t]=BigInt(1)<<BigInt(r),e),{});var V={press:{openArticle:"0xc0a24ffb",readArticle:"0xd5bd0fbe"},dapp:{proofVerifiableStorageUpdate:"0x2ab2aeef",callableVerifiableStorageUpdate:"0xa07da986"},webshop:{open:"0xb311798f"},referral:{referred:"0x010cc3b9",createLink:"0xb2c0f17c"},purchase:{started:"0xd87e90c3",completed:"0x8403aeb4"}};function Ge(e,t){if(!t)return e.request({method:"frak_listenToWalletStatus"}).then(a=>(Hr(a.interactionToken),a));let r=new W,n=!1;return e.listenerRequest({method:"frak_listenToWalletStatus"},a=>{t(a),Hr(a.interactionToken),n||(r.resolve(a),n=!0)}).then(()=>r.promise)}function Hr(e){typeof window>"u"||(e?window.sessionStorage.setItem("frak-wallet-interaction-token",e):window.sessionStorage.removeItem("frak.interaction-token"))}function zr({domain:e}){return Ee(D(e))}async function Xe(e,{productId:t,interaction:r,validation:n}){let a=t??zr(e.config);return await e.request({method:"frak_sendInteraction",params:[a,r,n]})}async function J(e,{steps:t,metadata:r}){return await e.request({method:"frak_displayModal",params:[t,e.config.metadata.name,r]})}async function Lr(e,t){let{metadata:r}=e.config;await e.request({method:"frak_sso",params:[t,r.name,r.css]})}async function $r(e){if(typeof window>"u"){console.warn("[Frak] No window found, can't track purchase");return}let t=window.sessionStorage.getItem("frak-wallet-interaction-token");if(!t){console.warn("[Frak] No frak session found, skipping purchase check");return}await fetch("https://backend.frak.id/interactions/listenForPurchase",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","x-wallet-sdk-auth":t},body:JSON.stringify(e)})}function Bt(){return Ar(96)}async function Ur(e,{siwe:t,metadata:r}){let n=t?.statement??`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`,a={...t,statement:n,nonce:t?.nonce??Bt(),uri:t?.uri??`https://${e.config.domain}`,version:t?.version??"1",domain:e.config.domain};return(await J(e,{metadata:r,steps:{login:{},siweAuthenticate:{siwe:a}}})).siweAuthenticate}async function Dr(e,{tx:t,metadata:r}){return(await J(e,{metadata:r,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function _r(e,{metadata:t,login:r,openSession:n}){return Ye(e,{steps:{login:r??{},openSession:n??{}},metadata:t})}function Ye(e,t){function r(f){return Ye(e,{...t,steps:{...t.steps,sendTransaction:f}})}function n(f){return Ye(e,{...t,steps:{...t.steps,final:{...f,action:{key:"reward"}}}})}function a(f,S){return Ye(e,{...t,steps:{...t.steps,final:{...S,action:{key:"sharing",options:f}}}})}async function l(){return await J(e,t)}return{params:t,sendTx:r,reward:n,sharing:a,display:l}}function ko({articleId:e}){let t=j([V.press.openArticle,U(e,{size:32})]);return{handlerTypeDenominator:D(_.press),interactionData:t}}function Bo({articleId:e}){let t=j([V.press.readArticle,U(e,{size:32})]);return{handlerTypeDenominator:D(_.press),interactionData:t}}var Nr={openArticle:ko,readArticle:Bo};function Ho(){let e=j([V.referral.createLink,"0x"]);return{handlerTypeDenominator:D(_.referral),interactionData:e}}function zo({referrer:e}){let t=j([V.referral.referred,U(e,{size:32})]);return{handlerTypeDenominator:D(_.referral),interactionData:t}}var Ze={createLink:Ho,referred:zo};function Lo({purchaseId:e}){let t=j([V.purchase.started,U(e,{size:32})]);return{handlerTypeDenominator:D(_.purchase),interactionData:t}}function $o({purchaseId:e,proof:t}){let r=Ct([{type:"uint256"},{type:"bytes32[]"}],[BigInt(e),t]),n=j([V.purchase.completed,r]);return{handlerTypeDenominator:D(_.purchase),interactionData:n}}var Or={startPurchase:Lo,completedPurchase:$o};function Uo(){let e=j([V.webshop.open,"0x"]);return{handlerTypeDenominator:D(_.webshop),interactionData:e}}var jr={open:Uo};async function Qe(e,{walletStatus:t,frakContext:r,modalConfig:n,productId:a,options:l}){let f=!1;async function S(){if(!f)return f=!0,_o(e,{modalConfig:n,walletStatus:t})}async function p(v){let h=Ze.referred({referrer:v});await Xe(e,{productId:a,interaction:h})}try{let{status:v,currentWallet:h}=await Do({initialWalletStatus:t,getFreshWalletStatus:S,pushReferralInteraction:p,frakContext:r});return re.replaceUrl({url:window.location?.href,context:l?.alwaysAppendUrl?{r:h}:null}),v}catch(v){return console.log("Error processing referral",{error:v}),re.replaceUrl({url:window.location?.href,context:l?.alwaysAppendUrl?{r:t?.wallet}:null}),No(v)}}async function Do({initialWalletStatus:e,getFreshWalletStatus:t,pushReferralInteraction:r,frakContext:n}){let a=e?.wallet;return n?.r?(a||(a=await t()),a&&Rt(n.r,a)?{status:"self-referral",currentWallet:a}:(e?.interactionSession||(a=await t()),await r(n.r),{status:"success",currentWallet:a})):{status:"no-referrer",currentWallet:a}}async function _o(e,{modalConfig:t,walletStatus:r}){return r?.interactionSession?r.wallet??void 0:t?(await J(e,t))?.login?.wallet??void 0:void 0}function No(e){if(e instanceof B)switch(e.code){case L.walletNotConnected:return"no-wallet";case L.serverErrorForInteractionDelegation:return"no-session";default:return"error"}return"error"}async function Vr(e,{productId:t,modalConfig:r,options:n}={}){let a=re.parse({url:window.location.href}),l=await Ge(e);try{return await Qe(e,{walletStatus:l,frakContext:a,modalConfig:r,productId:t,options:n})}catch(f){return f}}return Yr(Oo);})();
|
|
7
7
|
/*! Bundled license information:
|
|
8
8
|
|
|
9
9
|
js-sha256/src/sha256.js:
|
|
@@ -10,12 +10,40 @@ import {
|
|
|
10
10
|
|
|
11
11
|
// src/core/actions/watchWalletStatus.ts
|
|
12
12
|
function watchWalletStatus(client, callback) {
|
|
13
|
+
if (!callback) {
|
|
14
|
+
return client.request({ method: "frak_listenToWalletStatus" }).then((result) => {
|
|
15
|
+
savePotentialToken(result.interactionToken);
|
|
16
|
+
return result;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
const firstResult = new Deferred();
|
|
20
|
+
let hasResolved = false;
|
|
13
21
|
return client.listenerRequest(
|
|
14
22
|
{
|
|
15
23
|
method: "frak_listenToWalletStatus"
|
|
16
24
|
},
|
|
17
|
-
|
|
18
|
-
|
|
25
|
+
(status) => {
|
|
26
|
+
callback(status);
|
|
27
|
+
savePotentialToken(status.interactionToken);
|
|
28
|
+
if (!hasResolved) {
|
|
29
|
+
firstResult.resolve(status);
|
|
30
|
+
hasResolved = true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
).then(() => firstResult.promise);
|
|
34
|
+
}
|
|
35
|
+
function savePotentialToken(interactionToken) {
|
|
36
|
+
if (typeof window === "undefined") {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (interactionToken) {
|
|
40
|
+
window.sessionStorage.setItem(
|
|
41
|
+
"frak-wallet-interaction-token",
|
|
42
|
+
interactionToken
|
|
43
|
+
);
|
|
44
|
+
} else {
|
|
45
|
+
window.sessionStorage.removeItem("frak.interaction-token");
|
|
46
|
+
}
|
|
19
47
|
}
|
|
20
48
|
|
|
21
49
|
// src/core/utils/computeProductId.ts
|
|
@@ -50,6 +78,30 @@ async function openSso(client, args) {
|
|
|
50
78
|
});
|
|
51
79
|
}
|
|
52
80
|
|
|
81
|
+
// src/core/actions/trackPurchaseStatus.ts
|
|
82
|
+
async function trackPurchaseStatus(args) {
|
|
83
|
+
if (typeof window === "undefined") {
|
|
84
|
+
console.warn("[Frak] No window found, can't track purchase");
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const interactionToken = window.sessionStorage.getItem(
|
|
88
|
+
"frak-wallet-interaction-token"
|
|
89
|
+
);
|
|
90
|
+
if (!interactionToken) {
|
|
91
|
+
console.warn("[Frak] No frak session found, skipping purchase check");
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
await fetch("https://backend.frak.id/interactions/listenForPurchase", {
|
|
95
|
+
method: "POST",
|
|
96
|
+
headers: {
|
|
97
|
+
Accept: "application/json",
|
|
98
|
+
"Content-Type": "application/json",
|
|
99
|
+
"x-wallet-sdk-auth": interactionToken
|
|
100
|
+
},
|
|
101
|
+
body: JSON.stringify(args)
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
53
105
|
// src/core/actions/wrapper/siweAuthenticate.ts
|
|
54
106
|
import { generateSiweNonce } from "viem/siwe";
|
|
55
107
|
async function siweAuthenticate(client, { siwe, metadata }) {
|
|
@@ -86,24 +138,80 @@ async function sendTransaction(client, { tx, metadata }) {
|
|
|
86
138
|
return result.sendTransaction;
|
|
87
139
|
}
|
|
88
140
|
|
|
89
|
-
// src/core/actions/wrapper/
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
141
|
+
// src/core/actions/wrapper/modalBuilder.ts
|
|
142
|
+
function modalBuilder(client, {
|
|
143
|
+
metadata,
|
|
144
|
+
login,
|
|
145
|
+
openSession
|
|
146
|
+
}) {
|
|
147
|
+
const baseParams = {
|
|
148
|
+
steps: {
|
|
149
|
+
login: login ?? {},
|
|
150
|
+
openSession: openSession ?? {}
|
|
151
|
+
},
|
|
152
|
+
metadata
|
|
153
|
+
};
|
|
154
|
+
return modalStepsBuilder(client, baseParams);
|
|
155
|
+
}
|
|
156
|
+
function modalStepsBuilder(client, params) {
|
|
157
|
+
function sendTx(options) {
|
|
158
|
+
return modalStepsBuilder(client, {
|
|
159
|
+
...params,
|
|
160
|
+
steps: {
|
|
161
|
+
...params.steps,
|
|
162
|
+
sendTransaction: options
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
function reward(options) {
|
|
167
|
+
return modalStepsBuilder(
|
|
168
|
+
client,
|
|
169
|
+
{
|
|
170
|
+
...params,
|
|
171
|
+
steps: {
|
|
172
|
+
...params.steps,
|
|
173
|
+
final: {
|
|
174
|
+
...options,
|
|
175
|
+
action: { key: "reward" }
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
function sharing(sharingOptions, options) {
|
|
182
|
+
return modalStepsBuilder(
|
|
183
|
+
client,
|
|
184
|
+
{
|
|
185
|
+
...params,
|
|
186
|
+
steps: {
|
|
187
|
+
...params.steps,
|
|
188
|
+
final: {
|
|
189
|
+
...options,
|
|
190
|
+
action: { key: "sharing", options: sharingOptions }
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
async function display() {
|
|
197
|
+
return await displayModal(client, params);
|
|
198
|
+
}
|
|
199
|
+
return {
|
|
200
|
+
// Access current modal params
|
|
201
|
+
params,
|
|
202
|
+
// Function to add new steps
|
|
203
|
+
sendTx,
|
|
204
|
+
reward,
|
|
205
|
+
sharing,
|
|
206
|
+
// Display the modal
|
|
207
|
+
display
|
|
208
|
+
};
|
|
101
209
|
}
|
|
102
210
|
|
|
103
211
|
// src/core/actions/referral/processReferral.ts
|
|
104
212
|
import { isAddressEqual } from "viem";
|
|
105
213
|
async function processReferral(client, {
|
|
106
|
-
walletStatus
|
|
214
|
+
walletStatus,
|
|
107
215
|
frakContext,
|
|
108
216
|
modalConfig,
|
|
109
217
|
productId,
|
|
@@ -117,7 +225,7 @@ async function processReferral(client, {
|
|
|
117
225
|
walletRequest = true;
|
|
118
226
|
return ensureWalletConnected(client, {
|
|
119
227
|
modalConfig,
|
|
120
|
-
walletStatus
|
|
228
|
+
walletStatus
|
|
121
229
|
});
|
|
122
230
|
}
|
|
123
231
|
async function pushReferralInteraction(referrer) {
|
|
@@ -128,7 +236,7 @@ async function processReferral(client, {
|
|
|
128
236
|
}
|
|
129
237
|
try {
|
|
130
238
|
const { status, currentWallet } = await processReferralLogic({
|
|
131
|
-
initialWalletStatus:
|
|
239
|
+
initialWalletStatus: walletStatus,
|
|
132
240
|
getFreshWalletStatus,
|
|
133
241
|
pushReferralInteraction,
|
|
134
242
|
frakContext
|
|
@@ -142,7 +250,7 @@ async function processReferral(client, {
|
|
|
142
250
|
console.log("Error processing referral", { error });
|
|
143
251
|
FrakContextManager.replaceUrl({
|
|
144
252
|
url: window.location?.href,
|
|
145
|
-
context: options?.alwaysAppendUrl ? { r:
|
|
253
|
+
context: options?.alwaysAppendUrl ? { r: walletStatus?.wallet } : null
|
|
146
254
|
});
|
|
147
255
|
return mapErrorToState(error);
|
|
148
256
|
}
|
|
@@ -171,16 +279,16 @@ async function processReferralLogic({
|
|
|
171
279
|
}
|
|
172
280
|
async function ensureWalletConnected(client, {
|
|
173
281
|
modalConfig,
|
|
174
|
-
walletStatus
|
|
282
|
+
walletStatus
|
|
175
283
|
}) {
|
|
176
|
-
if (!
|
|
284
|
+
if (!walletStatus?.interactionSession) {
|
|
177
285
|
if (!modalConfig) {
|
|
178
286
|
return void 0;
|
|
179
287
|
}
|
|
180
288
|
const result = await displayModal(client, modalConfig);
|
|
181
289
|
return result?.login?.wallet ?? void 0;
|
|
182
290
|
}
|
|
183
|
-
return
|
|
291
|
+
return walletStatus.wallet ?? void 0;
|
|
184
292
|
}
|
|
185
293
|
function mapErrorToState(error) {
|
|
186
294
|
if (error instanceof FrakRpcError) {
|
|
@@ -205,7 +313,7 @@ async function referralInteraction(client, {
|
|
|
205
313
|
const frakContext = FrakContextManager.parse({
|
|
206
314
|
url: window.location.href
|
|
207
315
|
});
|
|
208
|
-
const currentWalletStatus = await
|
|
316
|
+
const currentWalletStatus = await watchWalletStatus(client);
|
|
209
317
|
try {
|
|
210
318
|
return await processReferral(client, {
|
|
211
319
|
walletStatus: currentWalletStatus,
|
|
@@ -224,9 +332,10 @@ export {
|
|
|
224
332
|
sendInteraction,
|
|
225
333
|
displayModal,
|
|
226
334
|
openSso,
|
|
335
|
+
trackPurchaseStatus,
|
|
227
336
|
siweAuthenticate,
|
|
228
337
|
sendTransaction,
|
|
229
|
-
|
|
338
|
+
modalBuilder,
|
|
230
339
|
processReferral,
|
|
231
340
|
referralInteraction
|
|
232
341
|
};
|
|
@@ -10,12 +10,40 @@ var _chunk4OJ2NPAScjs = require('./chunk-4OJ2NPAS.cjs');
|
|
|
10
10
|
|
|
11
11
|
// src/core/actions/watchWalletStatus.ts
|
|
12
12
|
function watchWalletStatus(client, callback) {
|
|
13
|
+
if (!callback) {
|
|
14
|
+
return client.request({ method: "frak_listenToWalletStatus" }).then((result) => {
|
|
15
|
+
savePotentialToken(result.interactionToken);
|
|
16
|
+
return result;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
const firstResult = new (0, _chunkF3F4BCGVcjs.Deferred)();
|
|
20
|
+
let hasResolved = false;
|
|
13
21
|
return client.listenerRequest(
|
|
14
22
|
{
|
|
15
23
|
method: "frak_listenToWalletStatus"
|
|
16
24
|
},
|
|
17
|
-
|
|
18
|
-
|
|
25
|
+
(status) => {
|
|
26
|
+
callback(status);
|
|
27
|
+
savePotentialToken(status.interactionToken);
|
|
28
|
+
if (!hasResolved) {
|
|
29
|
+
firstResult.resolve(status);
|
|
30
|
+
hasResolved = true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
).then(() => firstResult.promise);
|
|
34
|
+
}
|
|
35
|
+
function savePotentialToken(interactionToken) {
|
|
36
|
+
if (typeof window === "undefined") {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (interactionToken) {
|
|
40
|
+
window.sessionStorage.setItem(
|
|
41
|
+
"frak-wallet-interaction-token",
|
|
42
|
+
interactionToken
|
|
43
|
+
);
|
|
44
|
+
} else {
|
|
45
|
+
window.sessionStorage.removeItem("frak.interaction-token");
|
|
46
|
+
}
|
|
19
47
|
}
|
|
20
48
|
|
|
21
49
|
// src/core/utils/computeProductId.ts
|
|
@@ -50,6 +78,30 @@ async function openSso(client, args) {
|
|
|
50
78
|
});
|
|
51
79
|
}
|
|
52
80
|
|
|
81
|
+
// src/core/actions/trackPurchaseStatus.ts
|
|
82
|
+
async function trackPurchaseStatus(args) {
|
|
83
|
+
if (typeof window === "undefined") {
|
|
84
|
+
console.warn("[Frak] No window found, can't track purchase");
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const interactionToken = window.sessionStorage.getItem(
|
|
88
|
+
"frak-wallet-interaction-token"
|
|
89
|
+
);
|
|
90
|
+
if (!interactionToken) {
|
|
91
|
+
console.warn("[Frak] No frak session found, skipping purchase check");
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
await fetch("https://backend.frak.id/interactions/listenForPurchase", {
|
|
95
|
+
method: "POST",
|
|
96
|
+
headers: {
|
|
97
|
+
Accept: "application/json",
|
|
98
|
+
"Content-Type": "application/json",
|
|
99
|
+
"x-wallet-sdk-auth": interactionToken
|
|
100
|
+
},
|
|
101
|
+
body: JSON.stringify(args)
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
53
105
|
// src/core/actions/wrapper/siweAuthenticate.ts
|
|
54
106
|
var _siwe = require('viem/siwe');
|
|
55
107
|
async function siweAuthenticate(client, { siwe, metadata }) {
|
|
@@ -86,24 +138,80 @@ async function sendTransaction(client, { tx, metadata }) {
|
|
|
86
138
|
return result.sendTransaction;
|
|
87
139
|
}
|
|
88
140
|
|
|
89
|
-
// src/core/actions/wrapper/
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
141
|
+
// src/core/actions/wrapper/modalBuilder.ts
|
|
142
|
+
function modalBuilder(client, {
|
|
143
|
+
metadata,
|
|
144
|
+
login,
|
|
145
|
+
openSession
|
|
146
|
+
}) {
|
|
147
|
+
const baseParams = {
|
|
148
|
+
steps: {
|
|
149
|
+
login: _nullishCoalesce(login, () => ( {})),
|
|
150
|
+
openSession: _nullishCoalesce(openSession, () => ( {}))
|
|
151
|
+
},
|
|
152
|
+
metadata
|
|
153
|
+
};
|
|
154
|
+
return modalStepsBuilder(client, baseParams);
|
|
155
|
+
}
|
|
156
|
+
function modalStepsBuilder(client, params) {
|
|
157
|
+
function sendTx(options) {
|
|
158
|
+
return modalStepsBuilder(client, {
|
|
159
|
+
...params,
|
|
160
|
+
steps: {
|
|
161
|
+
...params.steps,
|
|
162
|
+
sendTransaction: options
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
function reward(options) {
|
|
167
|
+
return modalStepsBuilder(
|
|
168
|
+
client,
|
|
169
|
+
{
|
|
170
|
+
...params,
|
|
171
|
+
steps: {
|
|
172
|
+
...params.steps,
|
|
173
|
+
final: {
|
|
174
|
+
...options,
|
|
175
|
+
action: { key: "reward" }
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
function sharing(sharingOptions, options) {
|
|
182
|
+
return modalStepsBuilder(
|
|
183
|
+
client,
|
|
184
|
+
{
|
|
185
|
+
...params,
|
|
186
|
+
steps: {
|
|
187
|
+
...params.steps,
|
|
188
|
+
final: {
|
|
189
|
+
...options,
|
|
190
|
+
action: { key: "sharing", options: sharingOptions }
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
async function display() {
|
|
197
|
+
return await displayModal(client, params);
|
|
198
|
+
}
|
|
199
|
+
return {
|
|
200
|
+
// Access current modal params
|
|
201
|
+
params,
|
|
202
|
+
// Function to add new steps
|
|
203
|
+
sendTx,
|
|
204
|
+
reward,
|
|
205
|
+
sharing,
|
|
206
|
+
// Display the modal
|
|
207
|
+
display
|
|
208
|
+
};
|
|
101
209
|
}
|
|
102
210
|
|
|
103
211
|
// src/core/actions/referral/processReferral.ts
|
|
104
212
|
|
|
105
213
|
async function processReferral(client, {
|
|
106
|
-
walletStatus
|
|
214
|
+
walletStatus,
|
|
107
215
|
frakContext,
|
|
108
216
|
modalConfig,
|
|
109
217
|
productId,
|
|
@@ -117,7 +225,7 @@ async function processReferral(client, {
|
|
|
117
225
|
walletRequest = true;
|
|
118
226
|
return ensureWalletConnected(client, {
|
|
119
227
|
modalConfig,
|
|
120
|
-
walletStatus
|
|
228
|
+
walletStatus
|
|
121
229
|
});
|
|
122
230
|
}
|
|
123
231
|
async function pushReferralInteraction(referrer) {
|
|
@@ -128,21 +236,21 @@ async function processReferral(client, {
|
|
|
128
236
|
}
|
|
129
237
|
try {
|
|
130
238
|
const { status, currentWallet } = await processReferralLogic({
|
|
131
|
-
initialWalletStatus:
|
|
239
|
+
initialWalletStatus: walletStatus,
|
|
132
240
|
getFreshWalletStatus,
|
|
133
241
|
pushReferralInteraction,
|
|
134
242
|
frakContext
|
|
135
243
|
});
|
|
136
244
|
_chunkF3F4BCGVcjs.FrakContextManager.replaceUrl({
|
|
137
|
-
url: _optionalChain([window, 'access',
|
|
138
|
-
context: _optionalChain([options, 'optionalAccess',
|
|
245
|
+
url: _optionalChain([window, 'access', _5 => _5.location, 'optionalAccess', _6 => _6.href]),
|
|
246
|
+
context: _optionalChain([options, 'optionalAccess', _7 => _7.alwaysAppendUrl]) ? { r: currentWallet } : null
|
|
139
247
|
});
|
|
140
248
|
return status;
|
|
141
249
|
} catch (error) {
|
|
142
250
|
console.log("Error processing referral", { error });
|
|
143
251
|
_chunkF3F4BCGVcjs.FrakContextManager.replaceUrl({
|
|
144
|
-
url: _optionalChain([window, 'access',
|
|
145
|
-
context: _optionalChain([options, 'optionalAccess',
|
|
252
|
+
url: _optionalChain([window, 'access', _8 => _8.location, 'optionalAccess', _9 => _9.href]),
|
|
253
|
+
context: _optionalChain([options, 'optionalAccess', _10 => _10.alwaysAppendUrl]) ? { r: _optionalChain([walletStatus, 'optionalAccess', _11 => _11.wallet]) } : null
|
|
146
254
|
});
|
|
147
255
|
return mapErrorToState(error);
|
|
148
256
|
}
|
|
@@ -153,8 +261,8 @@ async function processReferralLogic({
|
|
|
153
261
|
pushReferralInteraction,
|
|
154
262
|
frakContext
|
|
155
263
|
}) {
|
|
156
|
-
let currentWallet = _optionalChain([initialWalletStatus, 'optionalAccess',
|
|
157
|
-
if (!_optionalChain([frakContext, 'optionalAccess',
|
|
264
|
+
let currentWallet = _optionalChain([initialWalletStatus, 'optionalAccess', _12 => _12.wallet]);
|
|
265
|
+
if (!_optionalChain([frakContext, 'optionalAccess', _13 => _13.r])) {
|
|
158
266
|
return { status: "no-referrer", currentWallet };
|
|
159
267
|
}
|
|
160
268
|
if (!currentWallet) {
|
|
@@ -163,7 +271,7 @@ async function processReferralLogic({
|
|
|
163
271
|
if (currentWallet && _viem.isAddressEqual.call(void 0, frakContext.r, currentWallet)) {
|
|
164
272
|
return { status: "self-referral", currentWallet };
|
|
165
273
|
}
|
|
166
|
-
if (!_optionalChain([initialWalletStatus, 'optionalAccess',
|
|
274
|
+
if (!_optionalChain([initialWalletStatus, 'optionalAccess', _14 => _14.interactionSession])) {
|
|
167
275
|
currentWallet = await getFreshWalletStatus();
|
|
168
276
|
}
|
|
169
277
|
await pushReferralInteraction(frakContext.r);
|
|
@@ -171,16 +279,16 @@ async function processReferralLogic({
|
|
|
171
279
|
}
|
|
172
280
|
async function ensureWalletConnected(client, {
|
|
173
281
|
modalConfig,
|
|
174
|
-
walletStatus
|
|
282
|
+
walletStatus
|
|
175
283
|
}) {
|
|
176
|
-
if (!_optionalChain([
|
|
284
|
+
if (!_optionalChain([walletStatus, 'optionalAccess', _15 => _15.interactionSession])) {
|
|
177
285
|
if (!modalConfig) {
|
|
178
286
|
return void 0;
|
|
179
287
|
}
|
|
180
288
|
const result = await displayModal(client, modalConfig);
|
|
181
|
-
return _nullishCoalesce(_optionalChain([result, 'optionalAccess',
|
|
289
|
+
return _nullishCoalesce(_optionalChain([result, 'optionalAccess', _16 => _16.login, 'optionalAccess', _17 => _17.wallet]), () => ( void 0));
|
|
182
290
|
}
|
|
183
|
-
return _nullishCoalesce(
|
|
291
|
+
return _nullishCoalesce(walletStatus.wallet, () => ( void 0));
|
|
184
292
|
}
|
|
185
293
|
function mapErrorToState(error) {
|
|
186
294
|
if (error instanceof _chunkF3F4BCGVcjs.FrakRpcError) {
|
|
@@ -205,7 +313,7 @@ async function referralInteraction(client, {
|
|
|
205
313
|
const frakContext = _chunkF3F4BCGVcjs.FrakContextManager.parse({
|
|
206
314
|
url: window.location.href
|
|
207
315
|
});
|
|
208
|
-
const currentWalletStatus = await
|
|
316
|
+
const currentWalletStatus = await watchWalletStatus(client);
|
|
209
317
|
try {
|
|
210
318
|
return await processReferral(client, {
|
|
211
319
|
walletStatus: currentWalletStatus,
|
|
@@ -229,4 +337,5 @@ async function referralInteraction(client, {
|
|
|
229
337
|
|
|
230
338
|
|
|
231
339
|
|
|
232
|
-
|
|
340
|
+
|
|
341
|
+
exports.watchWalletStatus = watchWalletStatus; exports.sendInteraction = sendInteraction; exports.displayModal = displayModal; exports.openSso = openSso; exports.trackPurchaseStatus = trackPurchaseStatus; exports.siweAuthenticate = siweAuthenticate; exports.sendTransaction = sendTransaction; exports.modalBuilder = modalBuilder; exports.processReferral = processReferral; exports.referralInteraction = referralInteraction;
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
var _chunkBHZDDGW6cjs = require('../../chunk-BHZDDGW6.cjs');
|
|
12
13
|
require('../../chunk-F3F4BCGV.cjs');
|
|
13
14
|
require('../../chunk-4OJ2NPAS.cjs');
|
|
14
15
|
require('../../chunk-QSXZKZJA.cjs');
|
|
@@ -22,4 +23,5 @@ require('../../chunk-QSXZKZJA.cjs');
|
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
|
|
27
|
+
exports.displayModal = _chunkBHZDDGW6cjs.displayModal; exports.modalBuilder = _chunkBHZDDGW6cjs.modalBuilder; exports.openSso = _chunkBHZDDGW6cjs.openSso; exports.processReferral = _chunkBHZDDGW6cjs.processReferral; exports.referralInteraction = _chunkBHZDDGW6cjs.referralInteraction; exports.sendInteraction = _chunkBHZDDGW6cjs.sendInteraction; exports.sendTransaction = _chunkBHZDDGW6cjs.sendTransaction; exports.siweAuthenticate = _chunkBHZDDGW6cjs.siweAuthenticate; exports.trackPurchaseStatus = _chunkBHZDDGW6cjs.trackPurchaseStatus; exports.watchWalletStatus = _chunkBHZDDGW6cjs.watchWalletStatus;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as NexusClient, W as WalletStatusReturnType, M as ModalStepTypes, D as DisplayModalParamsType, d as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../../FrakContext-DBdWC7ls.cjs';
|
|
1
|
+
import { a as NexusClient, W as WalletStatusReturnType, M as ModalStepTypes, D as DisplayModalParamsType, d as ModalRpcStepsResultType, O as OpenSsoParamsType, j as SendTransactionModalStepType, n as FinalModalStepType, o as FinalActionType, L as LoginModalStepType, m as OpenInteractionSessionModalStepType, b as ModalRpcMetadata } from '../../FrakContext-DBdWC7ls.cjs';
|
|
2
2
|
import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../../interaction-BngPoHA0.cjs';
|
|
3
3
|
import { P as ProcessReferralOptions } from '../../processReferral-BWSIamn2.cjs';
|
|
4
4
|
export { S as SendTransactionParams, a as SiweAuthenticateModalParams, p as processReferral, b as sendTransaction, s as siweAuthenticate } from '../../processReferral-BWSIamn2.cjs';
|
|
@@ -11,7 +11,7 @@ import 'viem/siwe';
|
|
|
11
11
|
* @param client
|
|
12
12
|
* @param callback
|
|
13
13
|
*/
|
|
14
|
-
declare function watchWalletStatus(client: NexusClient, callback
|
|
14
|
+
declare function watchWalletStatus(client: NexusClient, callback?: (status: WalletStatusReturnType) => void): Promise<WalletStatusReturnType>;
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Function used to send an interaction
|
|
@@ -36,7 +36,46 @@ declare function displayModal<T extends ModalStepTypes[] = ModalStepTypes[]>(cli
|
|
|
36
36
|
*/
|
|
37
37
|
declare function openSso(client: NexusClient, args: OpenSsoParamsType): Promise<void>;
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Function used to track the status of a purchase
|
|
41
|
+
*/
|
|
42
|
+
declare function trackPurchaseStatus(args: {
|
|
43
|
+
customerId: string | number;
|
|
44
|
+
orderId: string | number;
|
|
45
|
+
token: string;
|
|
46
|
+
}): Promise<void>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Represent the type of the modal step builder
|
|
50
|
+
*/
|
|
51
|
+
type ModalStepBuilder<Steps extends ModalStepTypes[] = ModalStepTypes[]> = {
|
|
52
|
+
params: DisplayModalParamsType<Steps>;
|
|
53
|
+
sendTx: (options: SendTransactionModalStepType["params"]) => ModalStepBuilder<[...Steps, SendTransactionModalStepType]>;
|
|
54
|
+
reward: (options?: Omit<FinalModalStepType["params"], "action">) => ModalStepBuilder<[...Steps, FinalModalStepType]>;
|
|
55
|
+
sharing: (sharingOptions?: Extract<FinalActionType, {
|
|
56
|
+
key: "sharing";
|
|
57
|
+
}>["options"], options?: Omit<FinalModalStepType["params"], "action">) => ModalStepBuilder<[...Steps, FinalModalStepType]>;
|
|
58
|
+
display: () => Promise<ModalRpcStepsResultType<Steps>>;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Represent the output type of the modal builder
|
|
62
|
+
*/
|
|
63
|
+
type ModalBuilder = ModalStepBuilder<[
|
|
64
|
+
LoginModalStepType,
|
|
65
|
+
OpenInteractionSessionModalStepType
|
|
66
|
+
]>;
|
|
67
|
+
/**
|
|
68
|
+
* Simple modal builder params builder
|
|
69
|
+
* @param client
|
|
70
|
+
* @param metadata
|
|
71
|
+
* @param login
|
|
72
|
+
* @param openSession
|
|
73
|
+
*/
|
|
74
|
+
declare function modalBuilder(client: NexusClient, { metadata, login, openSession, }: {
|
|
75
|
+
metadata: ModalRpcMetadata;
|
|
76
|
+
login?: LoginModalStepType["params"];
|
|
77
|
+
openSession?: OpenInteractionSessionModalStepType["params"];
|
|
78
|
+
}): ModalBuilder;
|
|
40
79
|
|
|
41
80
|
declare function referralInteraction(client: NexusClient, { productId, modalConfig, options, }?: {
|
|
42
81
|
productId?: Hex;
|
|
@@ -44,4 +83,4 @@ declare function referralInteraction(client: NexusClient, { productId, modalConf
|
|
|
44
83
|
options?: ProcessReferralOptions;
|
|
45
84
|
}): Promise<unknown>;
|
|
46
85
|
|
|
47
|
-
export { displayModal, openSso, referralInteraction, sendInteraction,
|
|
86
|
+
export { type ModalBuilder, type ModalStepBuilder, displayModal, modalBuilder, openSso, referralInteraction, sendInteraction, trackPurchaseStatus, watchWalletStatus };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as NexusClient, W as WalletStatusReturnType, M as ModalStepTypes, D as DisplayModalParamsType, d as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../../FrakContext-CDVlUN75.js';
|
|
1
|
+
import { a as NexusClient, W as WalletStatusReturnType, M as ModalStepTypes, D as DisplayModalParamsType, d as ModalRpcStepsResultType, O as OpenSsoParamsType, j as SendTransactionModalStepType, n as FinalModalStepType, o as FinalActionType, L as LoginModalStepType, m as OpenInteractionSessionModalStepType, b as ModalRpcMetadata } from '../../FrakContext-CDVlUN75.js';
|
|
2
2
|
import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../../interaction-BngPoHA0.js';
|
|
3
3
|
import { P as ProcessReferralOptions } from '../../processReferral-CFyGAENf.js';
|
|
4
4
|
export { S as SendTransactionParams, a as SiweAuthenticateModalParams, p as processReferral, b as sendTransaction, s as siweAuthenticate } from '../../processReferral-CFyGAENf.js';
|
|
@@ -11,7 +11,7 @@ import 'viem/siwe';
|
|
|
11
11
|
* @param client
|
|
12
12
|
* @param callback
|
|
13
13
|
*/
|
|
14
|
-
declare function watchWalletStatus(client: NexusClient, callback
|
|
14
|
+
declare function watchWalletStatus(client: NexusClient, callback?: (status: WalletStatusReturnType) => void): Promise<WalletStatusReturnType>;
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Function used to send an interaction
|
|
@@ -36,7 +36,46 @@ declare function displayModal<T extends ModalStepTypes[] = ModalStepTypes[]>(cli
|
|
|
36
36
|
*/
|
|
37
37
|
declare function openSso(client: NexusClient, args: OpenSsoParamsType): Promise<void>;
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Function used to track the status of a purchase
|
|
41
|
+
*/
|
|
42
|
+
declare function trackPurchaseStatus(args: {
|
|
43
|
+
customerId: string | number;
|
|
44
|
+
orderId: string | number;
|
|
45
|
+
token: string;
|
|
46
|
+
}): Promise<void>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Represent the type of the modal step builder
|
|
50
|
+
*/
|
|
51
|
+
type ModalStepBuilder<Steps extends ModalStepTypes[] = ModalStepTypes[]> = {
|
|
52
|
+
params: DisplayModalParamsType<Steps>;
|
|
53
|
+
sendTx: (options: SendTransactionModalStepType["params"]) => ModalStepBuilder<[...Steps, SendTransactionModalStepType]>;
|
|
54
|
+
reward: (options?: Omit<FinalModalStepType["params"], "action">) => ModalStepBuilder<[...Steps, FinalModalStepType]>;
|
|
55
|
+
sharing: (sharingOptions?: Extract<FinalActionType, {
|
|
56
|
+
key: "sharing";
|
|
57
|
+
}>["options"], options?: Omit<FinalModalStepType["params"], "action">) => ModalStepBuilder<[...Steps, FinalModalStepType]>;
|
|
58
|
+
display: () => Promise<ModalRpcStepsResultType<Steps>>;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Represent the output type of the modal builder
|
|
62
|
+
*/
|
|
63
|
+
type ModalBuilder = ModalStepBuilder<[
|
|
64
|
+
LoginModalStepType,
|
|
65
|
+
OpenInteractionSessionModalStepType
|
|
66
|
+
]>;
|
|
67
|
+
/**
|
|
68
|
+
* Simple modal builder params builder
|
|
69
|
+
* @param client
|
|
70
|
+
* @param metadata
|
|
71
|
+
* @param login
|
|
72
|
+
* @param openSession
|
|
73
|
+
*/
|
|
74
|
+
declare function modalBuilder(client: NexusClient, { metadata, login, openSession, }: {
|
|
75
|
+
metadata: ModalRpcMetadata;
|
|
76
|
+
login?: LoginModalStepType["params"];
|
|
77
|
+
openSession?: OpenInteractionSessionModalStepType["params"];
|
|
78
|
+
}): ModalBuilder;
|
|
40
79
|
|
|
41
80
|
declare function referralInteraction(client: NexusClient, { productId, modalConfig, options, }?: {
|
|
42
81
|
productId?: Hex;
|
|
@@ -44,4 +83,4 @@ declare function referralInteraction(client: NexusClient, { productId, modalConf
|
|
|
44
83
|
options?: ProcessReferralOptions;
|
|
45
84
|
}): Promise<unknown>;
|
|
46
85
|
|
|
47
|
-
export { displayModal, openSso, referralInteraction, sendInteraction,
|
|
86
|
+
export { type ModalBuilder, type ModalStepBuilder, displayModal, modalBuilder, openSso, referralInteraction, sendInteraction, trackPurchaseStatus, watchWalletStatus };
|
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
displayModal,
|
|
3
|
+
modalBuilder,
|
|
3
4
|
openSso,
|
|
4
5
|
processReferral,
|
|
5
6
|
referralInteraction,
|
|
6
7
|
sendInteraction,
|
|
7
8
|
sendTransaction,
|
|
8
9
|
siweAuthenticate,
|
|
9
|
-
|
|
10
|
+
trackPurchaseStatus,
|
|
10
11
|
watchWalletStatus
|
|
11
|
-
} from "../../chunk-
|
|
12
|
+
} from "../../chunk-4Q2OHGWX.js";
|
|
12
13
|
import "../../chunk-ZQSA2VQ4.js";
|
|
13
14
|
import "../../chunk-P4QEVLVV.js";
|
|
14
15
|
import "../../chunk-H3T2GAEC.js";
|
|
15
16
|
export {
|
|
16
17
|
displayModal,
|
|
18
|
+
modalBuilder,
|
|
17
19
|
openSso,
|
|
18
20
|
processReferral,
|
|
19
21
|
referralInteraction,
|
|
20
22
|
sendInteraction,
|
|
21
23
|
sendTransaction,
|
|
22
24
|
siweAuthenticate,
|
|
23
|
-
|
|
25
|
+
trackPurchaseStatus,
|
|
24
26
|
watchWalletStatus
|
|
25
27
|
};
|
package/dist/react/index.cjs
CHANGED
|
@@ -9,7 +9,7 @@ var _chunkQYOOKB34cjs = require('../chunk-QYOOKB34.cjs');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkBHZDDGW6cjs = require('../chunk-BHZDDGW6.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -87,7 +87,7 @@ function useWalletStatus() {
|
|
|
87
87
|
if (!client) {
|
|
88
88
|
throw new (0, _chunkF3F4BCGVcjs.ClientNotFound)();
|
|
89
89
|
}
|
|
90
|
-
return
|
|
90
|
+
return _chunkBHZDDGW6cjs.watchWalletStatus.call(void 0, client, newStatusUpdated);
|
|
91
91
|
},
|
|
92
92
|
enabled: !!client
|
|
93
93
|
});
|
|
@@ -106,7 +106,7 @@ function useSendTransactionAction({
|
|
|
106
106
|
if (!client) {
|
|
107
107
|
throw new (0, _chunkF3F4BCGVcjs.ClientNotFound)();
|
|
108
108
|
}
|
|
109
|
-
return
|
|
109
|
+
return _chunkBHZDDGW6cjs.sendTransaction.call(void 0, client, params);
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
112
|
}
|
|
@@ -128,7 +128,7 @@ function useSiweAuthenticate({
|
|
|
128
128
|
if (!client) {
|
|
129
129
|
throw new (0, _chunkF3F4BCGVcjs.ClientNotFound)();
|
|
130
130
|
}
|
|
131
|
-
return
|
|
131
|
+
return _chunkBHZDDGW6cjs.siweAuthenticate.call(void 0, client, params);
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
134
|
}
|
|
@@ -207,7 +207,7 @@ function useReferralInteraction({
|
|
|
207
207
|
} = {}) {
|
|
208
208
|
const client = useNexusClient();
|
|
209
209
|
const { frakContext } = useFrakContext();
|
|
210
|
-
const { data:
|
|
210
|
+
const { data: walletStatus } = useWalletStatus();
|
|
211
211
|
const {
|
|
212
212
|
data: referralState,
|
|
213
213
|
error,
|
|
@@ -219,22 +219,22 @@ function useReferralInteraction({
|
|
|
219
219
|
"nexus-sdk",
|
|
220
220
|
"auto-referral-interaction",
|
|
221
221
|
_nullishCoalesce(_optionalChain([frakContext, 'optionalAccess', _11 => _11.r]), () => ( "no-referrer")),
|
|
222
|
-
_nullishCoalesce(_optionalChain([
|
|
222
|
+
_nullishCoalesce(_optionalChain([walletStatus, 'optionalAccess', _12 => _12.key]), () => ( "no-wallet-status")),
|
|
223
223
|
_nullishCoalesce(productId, () => ( "no-product-id"))
|
|
224
224
|
],
|
|
225
225
|
queryFn: () => {
|
|
226
226
|
if (!client) {
|
|
227
227
|
throw new (0, _chunkF3F4BCGVcjs.ClientNotFound)();
|
|
228
228
|
}
|
|
229
|
-
return
|
|
230
|
-
walletStatus
|
|
229
|
+
return _chunkBHZDDGW6cjs.processReferral.call(void 0, client, {
|
|
230
|
+
walletStatus,
|
|
231
231
|
frakContext,
|
|
232
232
|
modalConfig,
|
|
233
233
|
productId,
|
|
234
234
|
options
|
|
235
235
|
});
|
|
236
236
|
},
|
|
237
|
-
enabled: !!
|
|
237
|
+
enabled: !!walletStatus
|
|
238
238
|
});
|
|
239
239
|
return _react.useMemo.call(void 0, () => {
|
|
240
240
|
if (status === "pending") return "processing";
|
|
@@ -256,7 +256,7 @@ function useSendInteraction({
|
|
|
256
256
|
if (!client) {
|
|
257
257
|
throw new (0, _chunkF3F4BCGVcjs.ClientNotFound)();
|
|
258
258
|
}
|
|
259
|
-
return
|
|
259
|
+
return _chunkBHZDDGW6cjs.sendInteraction.call(void 0, client, params);
|
|
260
260
|
}
|
|
261
261
|
});
|
|
262
262
|
}
|
|
@@ -274,7 +274,7 @@ function useDisplayModal({
|
|
|
274
274
|
if (!client) {
|
|
275
275
|
throw new (0, _chunkF3F4BCGVcjs.ClientNotFound)();
|
|
276
276
|
}
|
|
277
|
-
return
|
|
277
|
+
return _chunkBHZDDGW6cjs.displayModal.call(void 0, client, args);
|
|
278
278
|
}
|
|
279
279
|
});
|
|
280
280
|
}
|
|
@@ -290,7 +290,7 @@ function useOpenSso({ mutations } = {}) {
|
|
|
290
290
|
if (!client) {
|
|
291
291
|
throw new (0, _chunkF3F4BCGVcjs.ClientNotFound)();
|
|
292
292
|
}
|
|
293
|
-
return
|
|
293
|
+
return _chunkBHZDDGW6cjs.openSso.call(void 0, client, params);
|
|
294
294
|
}
|
|
295
295
|
});
|
|
296
296
|
}
|
package/dist/react/index.js
CHANGED
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
sendInteraction,
|
|
9
9
|
sendTransaction,
|
|
10
10
|
siweAuthenticate,
|
|
11
|
-
|
|
12
|
-
} from "../chunk-
|
|
11
|
+
watchWalletStatus
|
|
12
|
+
} from "../chunk-4Q2OHGWX.js";
|
|
13
13
|
import {
|
|
14
14
|
ClientNotFound,
|
|
15
15
|
FrakContextManager,
|
|
@@ -87,7 +87,7 @@ function useWalletStatus() {
|
|
|
87
87
|
if (!client) {
|
|
88
88
|
throw new ClientNotFound();
|
|
89
89
|
}
|
|
90
|
-
return
|
|
90
|
+
return watchWalletStatus(client, newStatusUpdated);
|
|
91
91
|
},
|
|
92
92
|
enabled: !!client
|
|
93
93
|
});
|
|
@@ -207,7 +207,7 @@ function useReferralInteraction({
|
|
|
207
207
|
} = {}) {
|
|
208
208
|
const client = useNexusClient();
|
|
209
209
|
const { frakContext } = useFrakContext();
|
|
210
|
-
const { data:
|
|
210
|
+
const { data: walletStatus } = useWalletStatus();
|
|
211
211
|
const {
|
|
212
212
|
data: referralState,
|
|
213
213
|
error,
|
|
@@ -219,7 +219,7 @@ function useReferralInteraction({
|
|
|
219
219
|
"nexus-sdk",
|
|
220
220
|
"auto-referral-interaction",
|
|
221
221
|
frakContext?.r ?? "no-referrer",
|
|
222
|
-
|
|
222
|
+
walletStatus?.key ?? "no-wallet-status",
|
|
223
223
|
productId ?? "no-product-id"
|
|
224
224
|
],
|
|
225
225
|
queryFn: () => {
|
|
@@ -227,14 +227,14 @@ function useReferralInteraction({
|
|
|
227
227
|
throw new ClientNotFound();
|
|
228
228
|
}
|
|
229
229
|
return processReferral(client, {
|
|
230
|
-
walletStatus
|
|
230
|
+
walletStatus,
|
|
231
231
|
frakContext,
|
|
232
232
|
modalConfig,
|
|
233
233
|
productId,
|
|
234
234
|
options
|
|
235
235
|
});
|
|
236
236
|
},
|
|
237
|
-
enabled: !!
|
|
237
|
+
enabled: !!walletStatus
|
|
238
238
|
});
|
|
239
239
|
return useMemo3(() => {
|
|
240
240
|
if (status === "pending") return "processing";
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"url": "https://twitter.com/QNivelais"
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
|
-
"version": "0.0.
|
|
14
|
+
"version": "0.0.23",
|
|
15
15
|
"description": "Frak Wallet client SDK, helping any person to interact with the Frak wallet, and require the unlock of a premium article within the Frak ecosystem.",
|
|
16
16
|
"repository": {
|
|
17
17
|
"url": "https://github.com/frak-id/wallet",
|