@frak-labs/nexus-sdk 0.0.17 → 0.0.19
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 +6 -6
- package/dist/{chunk-ES3EBWJ6.cjs → chunk-2SDBW6QC.cjs} +19 -19
- package/dist/{chunk-VXVUPIW7.js → chunk-54MUKMZK.js} +2 -2
- package/dist/{chunk-B75G6TB3.js → chunk-7K4L7VQC.js} +46 -12
- package/dist/{chunk-BP7RT2HB.js → chunk-ACCWBBZ7.js} +4 -4
- package/dist/{chunk-6GPWXPN4.cjs → chunk-LAO7FUQ2.cjs} +8 -8
- package/dist/{chunk-H7YKYMTC.cjs → chunk-YDZBXUC4.cjs} +47 -13
- package/dist/core/actions/index.cjs +3 -3
- package/dist/core/actions/index.js +2 -2
- package/dist/core/index.cjs +3 -3
- package/dist/core/index.d.cts +19 -8
- package/dist/core/index.d.ts +19 -8
- package/dist/core/index.js +2 -2
- package/dist/react/index.cjs +34 -39
- package/dist/react/index.js +25 -30
- package/package.json +1 -1
package/dist/bundle/bundle.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";var NexusSDK=(()=>{var zr=Object.create;var Se=Object.defineProperty;var Lr=Object.getOwnPropertyDescriptor;var $r=Object.getOwnPropertyNames;var Ur=Object.getPrototypeOf,Dr=Object.prototype.hasOwnProperty;var Bt=(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 kt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),_r=(e,t)=>{for(var r in t)Se(e,r,{get:t[r],enumerable:!0})},Ht=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of $r(t))!Dr.call(e,i)&&i!==r&&Se(e,i,{get:()=>t[i],enumerable:!(n=Lr(t,i))||n.enumerable});return e};var Fe=(e,t,r)=>(r=e!=null?zr(Ur(e)):{},Ht(t||!e||!e.__esModule?Se(r,"default",{value:e,enumerable:!0}):r,e)),Nr=e=>Ht(Se({},"__esModule",{value:!0}),e);var Qe=kt((de,Ze)=>{"use strict";(function(e,t){if(typeof de=="object"&&typeof Ze=="object")Ze.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var r=t();for(var n in r)(typeof de=="object"?de:e)[n]=r[n]}})(de,()=>(()=>{"use strict";var e={48:function(r,n,i){var p=this&&this.__awaiter||function(a,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(T){T(u)})).then(m,E)}z((c=c.apply(a,b||[])).next())})},l=this&&this.__generator||function(a,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(a,m)}catch(T){u=[6,T],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 v=i(304),f=i(134),F=new v.CompressorImpl,y=new f.DecompressorImpl,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h={};n.compressToBase64=function(a){return p(this,void 0,void 0,function(){var b;return l(this,function(o){switch(o.label){case 0:return a===null?[2,""]:[4,F.compress(a,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(a){return p(this,void 0,void 0,function(){return l(this,function(b){switch(b.label){case 0:return a===null?[2,""]:a===""?[2,null]:[4,y.decompress(a.length,32,function(o){return function(c,I){if(!h[c]){h[c]={};for(var A=0;A<c.length;A++)h[c][c.charAt(A)]=A}return h[c][I]}(d,a.charAt(o))})];case 1:return[2,b.sent()]}})})},n.compressToUTF16=function(a){return p(this,void 0,void 0,function(){return l(this,function(b){switch(b.label){case 0:return a===null?[2,""]:[4,F.compress(a,15,function(o){return String.fromCharCode(o+32)})];case 1:return[2,b.sent()+" "]}})})},n.decompressFromUTF16=function(a){return p(this,void 0,void 0,function(){return l(this,function(b){switch(b.label){case 0:return a===null?[2,""]:a===""?[2,null]:[4,y.decompress(a.length,16384,function(o){return a.charCodeAt(o)-32})];case 1:return[2,b.sent()]}})})}},304:function(r,n,i){var p=this&&this.__awaiter||function(y,d,h,a){return new(h||(h=Promise))(function(b,o){function c(m){try{A(a.next(m))}catch(E){o(E)}}function I(m){try{A(a.throw(m))}catch(E){o(E)}}function A(m){var E;m.done?b(m.value):(E=m.value,E instanceof h?E:new h(function(z){z(E)})).then(c,I)}A((a=a.apply(y,d||[])).next())})},l=this&&this.__generator||function(y,d){var h,a,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(h)throw new TypeError("Generator is already executing.");for(;o&&(o=0,E[0]&&(c=0)),c;)try{if(h=1,a&&(b=2&E[0]?a.return:E[0]?a.throw||((b=a.return)&&b.call(a),0):a.next)&&!(b=b.call(a,E[1])).done)return b;switch(a=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++,a=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(y,c)}catch(z){E=[6,z],a=0}finally{h=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 v=i(658),f=[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],F=function(){function y(){}return y.writeValueToData=function(d,h,a,b,o){if(a%4!=0||d.dataPosition+a>b-1)for(var c=0;c<a;c++)d.dataVal=d.dataVal<<1|1&h,d.dataPosition==b-1?(d.dataPosition=0,d.data.push(o(d.dataVal)),d.dataVal=0):d.dataPosition++,h>>=1;else d.dataVal<<=a,d.dataVal|=function(I,A){for(var m=0,E=0;E<A;++E)m<<=4,m|=f[15&I],I>>=4;return m}(h,a/4),d.dataPosition+=a},y.writeWToDataVal=function(d,h,a){d.dictionaryToCreate.has(d.w)?(d.w.charCodeAt(0)<256?(y.writeValueToData(d,0,d.numBits,h,a),y.writeValueToData(d,d.w.charCodeAt(0),8,h,a)):(y.writeValueToData(d,1,d.numBits,h,a),y.writeValueToData(d,d.w.charCodeAt(0),16,h,a)),d.enlargeIn--,d.enlargeIn==0&&(d.enlargeIn=Math.pow(2,d.numBits),d.numBits++),d.dictionaryToCreate.delete(d.w)):y.writeValueToData(d,d.dictionary.get(d.w),d.numBits,h,a),d.enlargeIn--,d.enlargeIn==0&&(d.enlargeIn=Math.pow(2,d.numBits),d.numBits++)},y.loopIteration=function(d,h,a,b,o){var c=d.charAt(h);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,a,b),o.dictionary.set(I,o.dictSize++),o.w=String(c))},y.prototype.compress=function(d,h,a){var b=this;return new Promise(function(o){return p(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?(y.loopIteration(d,I,h,a,c),I%1e4!=0?[3,3]:[4,(0,v.wait)()]):[3,4];case 2:A.sent(),A.label=3;case 3:return I+=1,[3,1];case 4:return c.w!==""&&y.writeWToDataVal(c,h,a),y.writeValueToData(c,2,c.numBits,h,a),c.dataVal<<=h-c.dataPosition,c.data.push(a(c.dataVal)),o(c.data.join("")),[2]}})})})},y}();n.CompressorImpl=F},134:function(r,n,i){var p=this&&this.__awaiter||function(F,y,d,h){return new(d||(d=Promise))(function(a,b){function o(A){try{I(h.next(A))}catch(m){b(m)}}function c(A){try{I(h.throw(A))}catch(m){b(m)}}function I(A){var m;A.done?a(A.value):(m=A.value,m instanceof d?m:new d(function(E){E(m)})).then(o,c)}I((h=h.apply(F,y||[])).next())})},l=this&&this.__generator||function(F,y){var d,h,a,b,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[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,h&&(a=2&m[0]?h.return:m[0]?h.throw||((a=h.return)&&a.call(h),0):h.next)&&!(a=a.call(h,m[1])).done)return a;switch(h=0,a&&(m=[2&m[0],a.value]),m[0]){case 0:case 1:a=m;break;case 4:return o.label++,{value:m[1],done:!1};case 5:o.label++,h=m[1],m=[0];continue;case 7:m=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||m[0]!==6&&m[0]!==2)){o=0;continue}if(m[0]===3&&(!a||m[1]>a[0]&&m[1]<a[3])){o.label=m[1];break}if(m[0]===6&&o.label<a[1]){o.label=a[1],a=m;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(m);break}a[2]&&o.ops.pop(),o.trys.pop();continue}m=y.call(F,o)}catch(E){m=[6,E],h=0}finally{d=a=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 v=i(658),f=function(){function F(){}return F.prototype.decompress=function(y,d,h){var a=this;return new Promise(function(b){return p(a,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:h(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=h(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=h(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=h(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,v.wait)()];case 2:A.sent(),A.label=3;case 3:if(o.dataIndex>y)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=h(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=h(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=h(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]}})})})},F}();n.DecompressorImpl=f},658:function(r,n){var i=this&&this.__awaiter||function(l,v,f,F){return new(f||(f=Promise))(function(y,d){function h(o){try{b(F.next(o))}catch(c){d(c)}}function a(o){try{b(F.throw(o))}catch(c){d(c)}}function b(o){var c;o.done?y(o.value):(c=o.value,c instanceof f?c:new f(function(I){I(c)})).then(h,a)}b((F=F.apply(l,v||[])).next())})},p=this&&this.__generator||function(l,v){var f,F,y,d,h={label:0,sent:function(){if(1&y[0])throw y[1];return y[1]},trys:[],ops:[]};return d={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function a(b){return function(o){return function(c){if(f)throw new TypeError("Generator is already executing.");for(;d&&(d=0,c[0]&&(h=0)),h;)try{if(f=1,F&&(y=2&c[0]?F.return:c[0]?F.throw||((y=F.return)&&y.call(F),0):F.next)&&!(y=y.call(F,c[1])).done)return y;switch(F=0,y&&(c=[2&c[0],y.value]),c[0]){case 0:case 1:y=c;break;case 4:return h.label++,{value:c[1],done:!1};case 5:h.label++,F=c[1],c=[0];continue;case 7:c=h.ops.pop(),h.trys.pop();continue;default:if(!((y=(y=h.trys).length>0&&y[y.length-1])||c[0]!==6&&c[0]!==2)){h=0;continue}if(c[0]===3&&(!y||c[1]>y[0]&&c[1]<y[3])){h.label=c[1];break}if(c[0]===6&&h.label<y[1]){h.label=y[1],y=c;break}if(y&&h.label<y[2]){h.label=y[2],h.ops.push(c);break}y[2]&&h.ops.pop(),h.trys.pop();continue}c=v.call(l,h)}catch(I){c=[6,I],F=0}finally{f=y=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 i(this,void 0,void 0,function(){return p(this,function(l){return[2,new Promise(function(v){setTimeout(v,0)})]})})}}},t={};return function r(n){var i=t[n];if(i!==void 0)return i.exports;var p=t[n]={exports:{}};return e[n].call(p.exports,p,p.exports,r),p.exports}(48)})())});var et=kt((zo,Ce)=>{"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",i=!r.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;i?r=global:n&&(r=self);var p=!r.JS_SHA256_NO_COMMON_JS&&typeof Ce=="object"&&Ce.exports,l=typeof define=="function"&&define.amd,v=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",f="0123456789abcdef".split(""),F=[-2147483648,8388608,32768,128],y=[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],h=["hex","array","digest","arrayBuffer"],a=[];(r.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(s){return Object.prototype.toString.call(s)==="[object Array]"}),v&&(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(T){return new m(u,!0).update(T)[s]()}},o=function(s){var u=b("hex",s);i&&(u=c(u,s)),u.create=function(){return new m(s)},u.update=function(S){return u.create().update(S)};for(var T=0;T<h.length;++T){var w=h[T];u[w]=b(w,s)}return u},c=function(s,u){var T=Bt("crypto"),w=Bt("buffer").Buffer,S=u?"sha224":"sha256",g;w.from&&!r.JS_SHA256_NO_BUFFER_FROM?g=w.from:g=function(x){return new w(x)};var C=function(x){if(typeof x=="string")return T.createHash(S).update(x,"utf8").digest("hex");if(x==null)throw new Error(e);return x.constructor===ArrayBuffer&&(x=new Uint8Array(x)),Array.isArray(x)||ArrayBuffer.isView(x)||x.constructor===w?T.createHash(S).update(g(x)).digest("hex"):s(x)};return C},I=function(s,u){return function(T,w){return new E(T,u,!0).update(w)[s]()}},A=function(s){var u=I("hex",s);u.create=function(S){return new E(S,s)},u.update=function(S,g){return u.create(S).update(g)};for(var T=0;T<h.length;++T){var w=h[T];u[w]=I(w,s)}return u};function m(s,u){u?(a[0]=a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0,this.blocks=a):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,T=typeof s;if(T!=="string"){if(T==="object"){if(s===null)throw new Error(e);if(v&&s.constructor===ArrayBuffer)s=new Uint8Array(s);else if(!Array.isArray(s)&&(!v||!ArrayBuffer.isView(s)))throw new Error(e)}else throw new Error(e);u=!0}for(var w,S=0,g,C=s.length,x=this.blocks;S<C;){if(this.hashed&&(this.hashed=!1,x[0]=this.block,this.block=x[16]=x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=0),u)for(g=this.start;S<C&&g<64;++S)x[g>>>2]|=s[S]<<y[g++&3];else for(g=this.start;S<C&&g<64;++S)w=s.charCodeAt(S),w<128?x[g>>>2]|=w<<y[g++&3]:w<2048?(x[g>>>2]|=(192|w>>>6)<<y[g++&3],x[g>>>2]|=(128|w&63)<<y[g++&3]):w<55296||w>=57344?(x[g>>>2]|=(224|w>>>12)<<y[g++&3],x[g>>>2]|=(128|w>>>6&63)<<y[g++&3],x[g>>>2]|=(128|w&63)<<y[g++&3]):(w=65536+((w&1023)<<10|s.charCodeAt(++S)&1023),x[g>>>2]|=(240|w>>>18)<<y[g++&3],x[g>>>2]|=(128|w>>>12&63)<<y[g++&3],x[g>>>2]|=(128|w>>>6&63)<<y[g++&3],x[g>>>2]|=(128|w&63)<<y[g++&3]);this.lastByteIndex=g,this.bytes+=g-this.start,g>=64?(this.block=x[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]|=F[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,T=this.h2,w=this.h3,S=this.h4,g=this.h5,C=this.h6,x=this.h7,P=this.blocks,B,N,O,G,R,X,Y,le,Xe,Ye,Te;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(Te=u&T,B=0;B<64;B+=4)this.first?(this.is224?(le=300032,R=P[0]-1413257819,x=R-150054599<<0,w=R+24177077<<0):(le=704751109,R=P[0]-210244248,x=R-1521486534<<0,w=R+143694565<<0),this.first=!1):(N=(s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10),O=(S>>>6|S<<26)^(S>>>11|S<<21)^(S>>>25|S<<7),le=s&u,G=le^s&T^Te,Y=S&g^~S&C,R=x+O+Y+d[B]+P[B],X=N+G,x=w+R<<0,w=R+X<<0),N=(w>>>2|w<<30)^(w>>>13|w<<19)^(w>>>22|w<<10),O=(x>>>6|x<<26)^(x>>>11|x<<21)^(x>>>25|x<<7),Xe=w&s,G=Xe^w&u^le,Y=x&S^~x&g,R=C+O+Y+d[B+1]+P[B+1],X=N+G,C=T+R<<0,T=R+X<<0,N=(T>>>2|T<<30)^(T>>>13|T<<19)^(T>>>22|T<<10),O=(C>>>6|C<<26)^(C>>>11|C<<21)^(C>>>25|C<<7),Ye=T&w,G=Ye^T&s^Xe,Y=C&x^~C&S,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),Te=u&T,G=Te^u&w^Ye,Y=g&C^~g&x,R=S+O+Y+d[B+3]+P[B+3],X=N+G,S=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+T<<0,this.h3=this.h3+w<<0,this.h4=this.h4+S<<0,this.h5=this.h5+g<<0,this.h6=this.h6+C<<0,this.h7=this.h7+x<<0},m.prototype.hex=function(){this.finalize();var s=this.h0,u=this.h1,T=this.h2,w=this.h3,S=this.h4,g=this.h5,C=this.h6,x=this.h7,P=f[s>>>28&15]+f[s>>>24&15]+f[s>>>20&15]+f[s>>>16&15]+f[s>>>12&15]+f[s>>>8&15]+f[s>>>4&15]+f[s&15]+f[u>>>28&15]+f[u>>>24&15]+f[u>>>20&15]+f[u>>>16&15]+f[u>>>12&15]+f[u>>>8&15]+f[u>>>4&15]+f[u&15]+f[T>>>28&15]+f[T>>>24&15]+f[T>>>20&15]+f[T>>>16&15]+f[T>>>12&15]+f[T>>>8&15]+f[T>>>4&15]+f[T&15]+f[w>>>28&15]+f[w>>>24&15]+f[w>>>20&15]+f[w>>>16&15]+f[w>>>12&15]+f[w>>>8&15]+f[w>>>4&15]+f[w&15]+f[S>>>28&15]+f[S>>>24&15]+f[S>>>20&15]+f[S>>>16&15]+f[S>>>12&15]+f[S>>>8&15]+f[S>>>4&15]+f[S&15]+f[g>>>28&15]+f[g>>>24&15]+f[g>>>20&15]+f[g>>>16&15]+f[g>>>12&15]+f[g>>>8&15]+f[g>>>4&15]+f[g&15]+f[C>>>28&15]+f[C>>>24&15]+f[C>>>20&15]+f[C>>>16&15]+f[C>>>12&15]+f[C>>>8&15]+f[C>>>4&15]+f[C&15];return this.is224||(P+=f[x>>>28&15]+f[x>>>24&15]+f[x>>>20&15]+f[x>>>16&15]+f[x>>>12&15]+f[x>>>8&15]+f[x>>>4&15]+f[x&15]),P},m.prototype.toString=m.prototype.hex,m.prototype.digest=function(){this.finalize();var s=this.h0,u=this.h1,T=this.h2,w=this.h3,S=this.h4,g=this.h5,C=this.h6,x=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,T>>>24&255,T>>>16&255,T>>>8&255,T&255,w>>>24&255,w>>>16&255,w>>>8&255,w&255,S>>>24&255,S>>>16&255,S>>>8&255,S&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(x>>>24&255,x>>>16&255,x>>>8&255,x&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,T){var w,S=typeof s;if(S==="string"){var g=[],C=s.length,x=0,P;for(w=0;w<C;++w)P=s.charCodeAt(w),P<128?g[x++]=P:P<2048?(g[x++]=192|P>>>6,g[x++]=128|P&63):P<55296||P>=57344?(g[x++]=224|P>>>12,g[x++]=128|P>>>6&63,g[x++]=128|P&63):(P=65536+((P&1023)<<10|s.charCodeAt(++w)&1023),g[x++]=240|P>>>18,g[x++]=128|P>>>12&63,g[x++]=128|P>>>6&63,g[x++]=128|P&63);s=g}else if(S==="object"){if(s===null)throw new Error(e);if(v&&s.constructor===ArrayBuffer)s=new Uint8Array(s);else if(!Array.isArray(s)&&(!v||!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,T),this.update(N),this.oKeyPad=B,this.inner=!0,this.sharedMemory=T}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),p?Ce.exports=z:(r.sha256=z.sha256,r.sha224=z.sha224,l&&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=M(()=>{"use strict"});function $(e){return Q(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var he=M(()=>{"use strict";me()});var st,jt=M(()=>{"use strict";st="2.21.29"});function Vt(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e?Vt(e.cause,t):t?null:e}var ct,H,se=M(()=>{"use strict";jt();ct={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${st}`},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,i=r.cause instanceof e&&r.cause.docsPath||r.docsPath,p=ct.getDocsUrl?.({...r,docsPath:i}),l=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...p?[`Docs: ${p}`]:[],...n?[`Details: ${n}`]:[],...ct.version?[`Version: ${ct.version}`]:[]].join(`
|
|
2
|
-
`);super(l,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=i,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=t,this.version=
|
|
3
|
-
`),{name:"AbiEncodingArrayLengthMismatchError"})}},
|
|
4
|
-
`),{name:"AbiEncodingLengthMismatchError"})}},
|
|
5
|
-
`),{docsPath:r,name:"InvalidAbiEncodingType"})}},
|
|
6
|
-
`),{name:"InvalidArrayError"})}}});var xe,ye,pt=M(()=>{"use strict";se();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}):qt(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 qt(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 i=0;i<r;i++){let p=t==="right";n[p?i:r-i-1]=e[p?i:e.length-i-1]}return n}var be=M(()=>{"use strict";pt()});var Le,$e,ut=M(()=>{"use strict";se();Le=class extends H{constructor({max:t,min:r,signed:n,size:i,value:p}){super(`Number "${p}" is not in safe ${i?`${i*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${t?`(${r} to ${t})`:`(above ${r})`}`,{name:"IntegerOutOfRangeError"})}},$e=class extends H{constructor({givenSize:t,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}});function ce(e,{size:t}){if($(e)>t)throw new $e({givenSize:$(e),maxSize:t})}var ft=M(()=>{"use strict";ut();he()});function D(e,t={}){return typeof e=="number"||typeof e=="bigint"?K(e,t):typeof e=="string"?De(e,t):typeof e=="boolean"?Ue(e,t):lt(e,t)}function Ue(e,t={}){let r=`0x${Number(e)}`;return typeof t.size=="number"?(ce(r,{size:t.size}),U(r,{size:t.size})):r}function lt(e,t={}){let r="";for(let i=0;i<e.length;i++)r+=Wr[e[i]];let n=`0x${r}`;return typeof t.size=="number"?(ce(n,{size:t.size}),U(n,{dir:"right",size:t.size})):n}function K(e,t={}){let{signed:r,size:n}=t,i=BigInt(e),p;n?r?p=(1n<<BigInt(n)*8n-1n)-1n:p=2n**(BigInt(n)*8n)-1n:typeof e=="number"&&(p=BigInt(Number.MAX_SAFE_INTEGER));let l=typeof p=="bigint"&&r?-p-1n:0;if(p&&i>p||i<l){let f=typeof e=="bigint"?"n":"";throw new Le({max:p?`${p}${f}`:void 0,min:`${l}${f}`,signed:r,size:n,value:`${e}${f}`})}let v=`0x${(r&&i<0?(1n<<BigInt(n*8))+BigInt(i):i).toString(16)}`;return n?U(v,{size:n}):v}function De(e,t={}){let r=qr.encode(e);return lt(r,t)}var Wr,qr,ge=M(()=>{"use strict";ut();be();ft();Wr=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));qr=new TextEncoder});function Jt(e,t={}){return typeof e=="number"||typeof e=="bigint"?Gr(e,t):typeof e=="boolean"?Jr(e,t):Q(e)?Gt(e,t):dt(e,t)}function Jr(e,t={}){let r=new Uint8Array(1);return r[0]=Number(e),typeof t.size=="number"?(ce(r,{size:t.size}),U(r,{size:t.size})):r}function Kt(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 Gt(e,t={}){let r=e;t.size&&(ce(r,{size:t.size}),r=U(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);let i=n.length/2,p=new Uint8Array(i);for(let l=0,v=0;l<i;l++){let f=Kt(n.charCodeAt(v++)),F=Kt(n.charCodeAt(v++));if(f===void 0||F===void 0)throw new H(`Invalid byte sequence ("${n[v-2]}${n[v-1]}" in "${n}").`);p[l]=f*16+F}return p}function Gr(e,t){let r=K(e,t);return Gt(r)}function dt(e,t={}){let r=Kr.encode(e);return typeof t.size=="number"?(ce(r,{size:t.size}),U(r,{dir:"right",size:t.size})):r}var Kr,J,mt=M(()=>{"use strict";se();me();be();ft();ge();Kr=new TextEncoder;J={zero:48,nine:57,A:65,F:70,a:97,f:102}});function ht(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function Xr(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function we(e,...t){if(!Xr(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 xt(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 Xt(e,t){we(e);let r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var yt=M(()=>{"use strict"});function Yr(e,t=!1){return t?{h:Number(e&_e),l:Number(e>>Yt&_e)}:{h:Number(e>>Yt&_e)|0,l:Number(e&_e)|0}}function Zt(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;i<e.length;i++){let{h:p,l}=Yr(e[i],t);[r[i],n[i]]=[p,l]}return[r,n]}var _e,Yt,Qt,er,tr,rr,or=M(()=>{"use strict";_e=BigInt(4294967295),Yt=BigInt(32);Qt=(e,t,r)=>e<<r|t>>>32-r,er=(e,t,r)=>t<<r|e>>>32-r,tr=(e,t,r)=>t<<r-32|e>>>64-r,rr=(e,t,r)=>e<<r-32|t>>>64-r});function gt(e){for(let t=0;t<e.length;t++)e[t]=Zr(e[t])}function Qr(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Oe(e){return typeof e=="string"&&(e=Qr(e)),we(e),e}function ir(e){let t=n=>e().update(Oe(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function ar(e){let t=(n,i)=>e(i).update(Oe(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}var nr,bt,Zr,Ne,ii,sr=M(()=>{"use strict";yt();nr=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),bt=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,Zr=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;Ne=class{clone(){return this._cloneInto()}},ii={}.toString});function so(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 v=(l+8)%10,f=(l+2)%10,F=r[f],y=r[f+1],d=cr(F,y,1)^r[v],h=pr(F,y,1)^r[v+1];for(let a=0;a<50;a+=10)e[l+a]^=d,e[l+a+1]^=h}let i=e[2],p=e[3];for(let l=0;l<24;l++){let v=fr[l],f=cr(i,p,v),F=pr(i,p,v),y=ur[l];i=e[y],p=e[y+1],e[y]=f,e[y+1]=F}for(let l=0;l<50;l+=10){for(let v=0;v<10;v++)r[v]=e[l+v];for(let v=0;v<10;v++)e[l+v]^=~r[(v+2)%10]&r[(v+4)%10]}e[0]^=io[n],e[1]^=ao[n]}r.fill(0)}var ur,fr,lr,eo,Ie,to,ro,oo,no,io,ao,cr,pr,je,ee,ui,fi,li,di,mi,dr,hi,xi,mr,yi,bi,hr=M(()=>{"use strict";yt();or();sr();ur=[],fr=[],lr=[],eo=BigInt(0),Ie=BigInt(1),to=BigInt(2),ro=BigInt(7),oo=BigInt(256),no=BigInt(113);for(let e=0,t=Ie,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],ur.push(2*(5*n+r)),fr.push((e+1)*(e+2)/2%64);let i=eo;for(let p=0;p<7;p++)t=(t<<Ie^(t>>ro)*no)%oo,t&to&&(i^=Ie<<(Ie<<BigInt(p))-Ie);lr.push(i)}[io,ao]=Zt(lr,!0),cr=(e,t,r)=>r>32?tr(e,t,r):Qt(e,t,r),pr=(e,t,r)=>r>32?rr(e,t,r):er(e,t,r);je=class e extends Ne{constructor(t,r,n,i=!1,p=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=p,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,ht(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=nr(this.state)}keccak(){bt||gt(this.state32),so(this.state32,this.rounds),bt||gt(this.state32),this.posOut=0,this.pos=0}update(t){xt(this);let{blockLen:r,state:n}=this;t=Oe(t);let i=t.length;for(let p=0;p<i;){let l=Math.min(r-this.pos,i-p);for(let v=0;v<l;v++)n[this.pos++]^=t[p++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:n,blockLen:i}=this;t[n]^=r,r&128&&n===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){xt(this,!1),we(t),this.finish();let r=this.state,{blockLen:n}=this;for(let i=0,p=t.length;i<p;){this.posOut>=n&&this.keccak();let l=Math.min(n-this.posOut,p-i);t.set(r.subarray(this.posOut,this.posOut+l),i),this.posOut+=l,i+=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 ht(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Xt(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:i,rounds:p,enableXOF:l}=this;return t||(t=new e(r,n,i,l,p)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=p,t.suffix=n,t.outputLen=i,t.enableXOF=l,t.destroyed=this.destroyed,t}},ee=(e,t,r)=>ir(()=>new je(t,e,r)),ui=ee(6,144,224/8),fi=ee(6,136,256/8),li=ee(6,104,384/8),di=ee(6,72,512/8),mi=ee(1,144,224/8),dr=ee(1,136,256/8),hi=ee(1,104,384/8),xi=ee(1,72,512/8),mr=(e,t,r)=>ar((n={})=>new je(t,e,n.dkLen===void 0?r:n.dkLen,!0)),yi=mr(31,168,128/8),bi=mr(31,136,256/8)});function ve(e,t){let r=t||"hex",n=dr(Q(e,{strict:!1})?Jt(e):e);return r==="bytes"?n:D(n)}var wt=M(()=>{"use strict";hr();me();mt();ge()});var pe,It=M(()=>{"use strict";se();pe=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 fe,vt=M(()=>{"use strict";fe=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 xr(e,t){if(Et.has(`${e}.${t}`))return Et.get(`${e}.${t}`);let r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=ve(dt(r),"bytes"),i=(t?r.substring(`${t}0x`.length):r).split("");for(let l=0;l<40;l+=2)n[l>>1]>>4>=8&&i[l]&&(i[l]=i[l].toUpperCase()),(n[l>>1]&15)>=8&&i[l+1]&&(i[l+1]=i[l+1].toUpperCase());let p=`0x${i.join("")}`;return Et.set(`${e}.${t}`,p),p}var Et,yr=M(()=>{"use strict";mt();wt();vt();Et=new fe(8192)});function Ee(e,t){let{strict:r=!0}=t??{},n=`${e}.${r}`;if(Tt.has(n))return Tt.get(n);let i=co.test(e)?e.toLowerCase()===e?!0:r?xr(e)===e:!0:!1;return Tt.set(n,i),i}var co,Tt,St=M(()=>{"use strict";vt();yr();co=/^0x[a-fA-F0-9]{40}$/,Tt=new fe(8192)});function te(e){return typeof e[0]=="string"?V(e):br(e)}function br(e){let t=0;for(let i of e)t+=i.length;let r=new Uint8Array(t),n=0;for(let i of e)r.set(i,n),n+=i.length;return r}function V(e){return`0x${e.reduce((t,r)=>t+r.replace("0x",""),"")}`}var Ft=M(()=>{"use strict"});function gr(e,t,r,{strict:n}={}){return Q(e,{strict:!1})?uo(e,t,r,{strict:n}):po(e,t,r,{strict:n})}function wr(e,t){if(typeof t=="number"&&t>0&&t>$(e)-1)throw new xe({offset:t,position:"start",size:$(e)})}function Ir(e,t,r){if(typeof t=="number"&&typeof r=="number"&&$(e)!==r-t)throw new xe({offset:r,position:"end",size:$(e)})}function po(e,t,r,{strict:n}={}){wr(e,t);let i=e.slice(t,r);return n&&Ir(i,t,r),i}function uo(e,t,r,{strict:n}={}){wr(e,t);let i=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return n&&Ir(i,t,r),i}var vr=M(()=>{"use strict";pt();me();he()});function At(e,t){if(e.length!==t.length)throw new ke({expectedLength:e.length,givenLength:t.length});let r=fo({params:e,values:t}),n=Pt(r);return n.length===0?"0x":n}function fo({params:e,values:t}){let r=[];for(let n=0;n<e.length;n++)r.push(Ct({param:e[n],value:t[n]}));return r}function Ct({param:e,value:t}){let r=wo(e.type);if(r){let[n,i]=r;return mo(t,{length:n,param:{...e,type:i}})}if(e.type==="tuple")return go(t,{param:e});if(e.type==="address")return lo(t);if(e.type==="bool")return xo(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){let n=e.type.startsWith("int");return yo(t,{signed:n})}if(e.type.startsWith("bytes"))return ho(t,{param:e});if(e.type==="string")return bo(t);throw new He(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Pt(e){let t=0;for(let p=0;p<e.length;p++){let{dynamic:l,encoded:v}=e[p];l?t+=32:t+=$(v)}let r=[],n=[],i=0;for(let p=0;p<e.length;p++){let{dynamic:l,encoded:v}=e[p];l?(r.push(K(t+i,{size:32})),n.push(v),i+=$(v)):r.push(v)}return te([...r,...n])}function lo(e){if(!Ee(e))throw new pe({address:e});return{dynamic:!1,encoded:q(e.toLowerCase())}}function mo(e,{length:t,param:r}){let n=t===null;if(!Array.isArray(e))throw new ze(e);if(!n&&e.length!==t)throw new Me({expectedLength:t,givenLength:e.length,type:`${r.type}[${t}]`});let i=!1,p=[];for(let l=0;l<e.length;l++){let v=Ct({param:r,value:e[l]});v.dynamic&&(i=!0),p.push(v)}if(n||i){let l=Pt(p);if(n){let v=K(p.length,{size:32});return{dynamic:!0,encoded:p.length>0?te([v,l]):v}}if(i)return{dynamic:!0,encoded:l}}return{dynamic:!1,encoded:te(p.map(({encoded:l})=>l))}}function ho(e,{param:t}){let[,r]=t.type.split("bytes"),n=$(e);if(!r){let i=e;return n%32!==0&&(i=q(i,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:te([q(K(n,{size:32})),i])}}if(n!==Number.parseInt(r))throw new Be({expectedSize:Number.parseInt(r),value:e});return{dynamic:!1,encoded:q(e,{dir:"right"})}}function xo(e){if(typeof e!="boolean")throw new H(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:q(Ue(e))}}function yo(e,{signed:t}){return{dynamic:!1,encoded:K(e,{size:32,signed:t})}}function bo(e){let t=De(e),r=Math.ceil($(t)/32),n=[];for(let i=0;i<r;i++)n.push(q(gr(t,i*32,(i+1)*32),{dir:"right"}));return{dynamic:!0,encoded:te([q(K($(t),{size:32})),...n])}}function go(e,{param:t}){let r=!1,n=[];for(let i=0;i<t.components.length;i++){let p=t.components[i],l=Array.isArray(e)?i:p.name,v=Ct({param:p,value:e[l]});n.push(v),v.dynamic&&(r=!0)}return{dynamic:r,encoded:r?Pt(n):te(n.map(({encoded:i})=>i))}}function wo(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}var Er=M(()=>{"use strict";Wt();It();se();St();Ft();be();he();vr();ge()});function Rt(e,t){if(!Ee(e,{strict:!1}))throw new pe({address:e});if(!Ee(t,{strict:!1}))throw new pe({address:t});return e.toLowerCase()===t.toLowerCase()}var Tr=M(()=>{"use strict";It();St()});var Po={};_r(Po,{Deferred:()=>W,FrakContextManager:()=>Z,FrakRpcError:()=>k,PressInteractionEncoder:()=>Rr,PurchaseInteractionEncoder:()=>Mr,ReferralInteractionEncoder:()=>Je,RpcErrorCodes:()=>L,WebShopInteractionEncoder:()=>Br,compressJson:()=>ne,createIFrameNexusClient:()=>it,createIframe:()=>ot,decompressDataAndCheckHash:()=>ie,decompressJson:()=>ae,displayModal:()=>re,hashAndCompressData:()=>oe,interactionTypes:()=>j,openSso:()=>Ar,processReferral:()=>Ge,productTypes:()=>_,productTypesMask:()=>Ot,referralInteraction:()=>Hr,sendInteraction:()=>qe,sendTransaction:()=>Pr,siweAuthenticate:()=>Cr,walletStatus:()=>Ke,watchWalletStatus:()=>Re});var k=class extends Error{constructor(r,n,i){super(n);this.code=r;this.data=i}};var Ae=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 zt=Fe(Qe(),1),tt=Fe(et(),1);async function oe(e){let t=(0,tt.sha256)(JSON.stringify(e)),r={...e,validationHash:t},n=await ne(r),i=(0,tt.sha256)(n);return{compressed:n,compressedHash:i}}async function ne(e){return(0,zt.compressToBase64)(JSON.stringify(e))}var Lt=Fe(Qe(),1),rt=Fe(et(),1);async function ie(e){if(!(e?.compressed&&e?.compressedHash))throw new k(L.corruptedResponse,"Missing compressed data");let t=await ae(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,rt.sha256)(e.compressed)!==e.compressedHash)throw new k(L.corruptedResponse,"Invalid compressed hash");let{validationHash:n,...i}=t;if((0,rt.sha256)(JSON.stringify(i))!==t.validationHash)throw new k(L.corruptedResponse,"Invalid data validation hash");return t}async function ae(e){let t=await(0,Lt.decompressFromBase64)(e);try{return JSON.parse(t)}catch(r){return console.error("Invalid compressed data",{e:r,decompressed:t}),null}}var ue="nexus-wallet-backup";function $t(){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 Pe={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 ot({walletBaseUrl:e}){let t=document.querySelector("#nexus-wallet");if(t)return Promise.resolve(t);let r=document.createElement("iframe");return r.id=Pe.id,r.name=Pe.name,r.allow=Pe.allow,r.style.zIndex=Pe.style.zIndex.toString(),nt({iframe:r,isVisible:!1}),document.body.appendChild(r),new Promise(n=>{r?.addEventListener("load",()=>n(r)),r.src=`${e}/listener`})}function nt({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 Ut({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(ue,n.data.backup):localStorage.removeItem(ue);break;case"remove-backup":localStorage.removeItem(ue);break;case"show":case"hide":nt({iframe:e,isVisible:n.iframeLifecycle==="show"});break}},isConnected:t.promise}}function Dt({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 i=t.contentWindow,p=async f=>{if(!f.origin||new URL(f.origin).origin.toLowerCase()!==new URL(e).origin.toLowerCase())return;if("iframeLifecycle"in f.data){await n.handleEvent(f.data);return}if("clientLifecycle"in f.data){console.error("Client lifecycle event received on the client side, dismissing it");return}let F=f.data.id,y=r.getRpcResolver(F);y&&await y(f.data)};return window.addEventListener("message",p),{sendEvent:f=>{i.postMessage(f,{targetOrigin:e})},cleanup:()=>{window.removeEventListener("message",p)}}}function it({config:e,iframe:t}){let r=$t(),n=Ut({iframe:t}),i=Dt({nexusWalletUrl:e.walletUrl,iframe:t,channelManager:r,iframeLifecycleManager:n}),p=async F=>{if(!await n.isConnected)throw new k(L.clientNotConnected,"The iframe provider isn't connected yet");let d=new W,h=r.createChannel(async b=>{let o=await ie(b.data);o.error?d.reject(new k(o.error.code,o.error.message,o.error?.data)):d.resolve(o.result),r.removeChannel(h)}),a=await oe(F);return i.sendEvent({id:h,topic:F.method,data:a}),d.promise},l=async(F,y)=>{if(!await n.isConnected)throw new k(L.clientNotConnected,"The iframe provider isn't connected yet");let h=r.createChannel(async b=>{let o=await ie(b.data);if(o.result)y(o.result);else throw new Ae("No valid result in the response")}),a=await oe(F);i.sendEvent({id:h,topic:F.method,data:a})},v=async()=>{r.destroy(),i.cleanup(),t.remove()},f=Or({config:e,messageHandler:i,lifecycleManager:n});return{config:e,waitForConnection:n.isConnected,waitForSetup:f,request:p,listenerRequest:l,destroy:v}}async function Or({config:e,messageHandler:t,lifecycleManager:r}){await r.isConnected;let n=async()=>{let p=e.metadata.css;p&&t.sendEvent({clientLifecycle:"modal-css",data:{cssLink:p}})},i=async()=>{if(typeof window>"u")return;let p=window.localStorage.getItem(ue);p&&t.sendEvent({clientLifecycle:"restore-backup",data:{backup:p}})};await Promise.all([n(),i()])}var at="fCtx";async function _t({url:e}){if(!e)return null;let r=new URL(e).searchParams.get(at);if(!r)return null;let n=await ae(decodeURIComponent(r));return n||null}async function Nt({url:e,context:t}){if(!e)return null;let r=await _t({url:e}),n=r?{...r,...t}:t,i=await ne(n);if(!i)return;let p=new URL(e);return p.searchParams.set(at,encodeURIComponent(i)),p.toString()}function jr(e){let t=new URL(e);return t.searchParams.delete(at),t.toString()}async function Vr({url:e,context:t}){if(!window.location?.href||typeof window>"u"){console.error("No window found, can't update context");return}let r=await Nt({url:e,context:t});r&&window.history.replaceState(null,"",r.toString())}var Z={parse:_t,update:Nt,remove:jr,replaceUrl:Vr};var _={dapp:1,press:2,webshop:3,referral:30,purchase:31},Ot=Object.entries(_).reduce((e,[t,r])=>(e[t]=BigInt(1)<<BigInt(r),e),{});var j={press:{openArticle:"0xc0a24ffb",readArticle:"0xd5bd0fbe"},dapp:{proofVerifiableStorageUpdate:"0x2ab2aeef",callableVerifiableStorageUpdate:"0xa07da986"},webshop:{open:"0xb311798f"},referral:{referred:"0x010cc3b9",createLink:"0xb2c0f17c"},purchase:{started:"0xd87e90c3",completed:"0x8403aeb4"}};function Re(e,t){return e.listenerRequest({method:"frak_listenToWalletStatus"},t)}var Ve=256,We;function Sr(e=11){if(!We||Ve+e>256*2){We="",Ve=0;for(let t=0;t<256;t++)We+=(256+Math.random()*256|0).toString(16).substring(1)}return We.substring(Ve,Ve+++e)}Er();ge();Ft();Tr();wt();be();function Fr({domain:e}){return ve(D(e))}async function qe(e,{productId:t,interaction:r,validation:n}){let i=t??Fr(e.config);return await e.request({method:"frak_sendInteraction",params:[i,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 Ar(e,t){let{metadata:r}=e.config;await e.request({method:"frak_sso",params:[t,r.name,r.css]})}function Mt(){return Sr(96)}async function Cr(e,{siwe:t,metadata:r}){let n=t?.statement??`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`,i={...t,statement:n,nonce:t?.nonce??Mt(),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:i}}})).siweAuthenticate}async function Pr(e,{tx:t,metadata:r}){return(await re(e,{metadata:r,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}async function Ke(e,t){let r=new W,n=!1;return await Re(e,i=>{t?.(i),n||(r.resolve(i),n=!0)}),r.promise}function Io({articleId:e}){let t=V([j.press.openArticle,U(e,{size:32})]);return{handlerTypeDenominator:D(_.press),interactionData:t}}function vo({articleId:e}){let t=V([j.press.readArticle,U(e,{size:32})]);return{handlerTypeDenominator:D(_.press),interactionData:t}}var Rr={openArticle:Io,readArticle:vo};function Eo(){let e=V([j.referral.createLink,"0x"]);return{handlerTypeDenominator:D(_.referral),interactionData:e}}function To({referrer:e}){let t=V([j.referral.referred,U(e,{size:32})]);return{handlerTypeDenominator:D(_.referral),interactionData:t}}var Je={createLink:Eo,referred:To};function So({purchaseId:e}){let t=V([j.purchase.started,U(e,{size:32})]);return{handlerTypeDenominator:D(_.purchase),interactionData:t}}function Fo({purchaseId:e,proof:t}){let r=At([{type:"uint256"},{type:"bytes32[]"}],[BigInt(e),t]),n=V([j.purchase.completed,r]);return{handlerTypeDenominator:D(_.purchase),interactionData:n}}var Mr={startPurchase:So,completedPurchase:Fo};function Ao(){let e=V([j.webshop.open,"0x"]);return{handlerTypeDenominator:D(_.webshop),interactionData:e}}var Br={open:Ao};async function Ge(e,{walletStatus:t,frakContext:r,modalConfig:n,productId:i}){try{let p=t?.wallet;if(!r?.r)return p&&await Z.replaceUrl({url:window.location?.href,context:{r:p}}),"no-referrer";if(p||(p=await kr(e,{modalConfig:n,walletStatus:t})),p&&Rt(r.r,p))return"self-referral";t?.interactionSession||(p=await kr(e,{modalConfig:n,walletStatus:t})),p&&await Z.replaceUrl({url:window.location?.href,context:{r:p}});let l=Je.referred({referrer:r.r});return await qe(e,{productId:i,interaction:l}),"success"}catch(p){return Co(p)}}async function kr(e,{modalConfig:t,walletStatus:r}){return r?.interactionSession?r.wallet??void 0:t?(await re(e,t))?.login?.wallet??void 0:void 0}function Co(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 Hr(e,{productId:t,modalConfig:r}={}){let n=await Z.parse({url:window.location.href}),i=await Ke(e);try{return await Ge(e,{walletStatus:i,frakContext:n,modalConfig:r,productId:t})}catch(p){return p}}return Nr(Po);})();
|
|
1
|
+
"use strict";var NexusSDK=(()=>{var _r=Object.create;var Ae=Object.defineProperty;var Dr=Object.getOwnPropertyDescriptor;var Nr=Object.getOwnPropertyNames;var Or=Object.getPrototypeOf,jr=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),Vr=(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 i of Nr(t))!jr.call(e,i)&&i!==r&&Ae(e,i,{get:()=>t[i],enumerable:!(n=Dr(t,i))||n.enumerable});return e};var Ce=(e,t,r)=>(r=e!=null?_r(Or(e)):{},Lt(t||!e||!e.__esModule?Ae(r,"default",{value:e,enumerable:!0}):r,e)),Wr=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,i){var p=this&&this.__awaiter||function(a,b,o,c){return new(o||(o=Promise))(function(I,A){function m(s){try{z(c.next(s))}catch(u){A(u)}}function v(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(T){T(u)})).then(m,v)}z((c=c.apply(a,b||[])).next())})},l=this&&this.__generator||function(a,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:v(0),throw:v(1),return:v(2)},typeof Symbol=="function"&&(A[Symbol.iterator]=function(){return this}),A;function v(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(a,m)}catch(T){u=[6,T],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 E=i(304),f=i(134),F=new E.CompressorImpl,y=new f.DecompressorImpl,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h={};n.compressToBase64=function(a){return p(this,void 0,void 0,function(){var b;return l(this,function(o){switch(o.label){case 0:return a===null?[2,""]:[4,F.compress(a,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(a){return p(this,void 0,void 0,function(){return l(this,function(b){switch(b.label){case 0:return a===null?[2,""]:a===""?[2,null]:[4,y.decompress(a.length,32,function(o){return function(c,I){if(!h[c]){h[c]={};for(var A=0;A<c.length;A++)h[c][c.charAt(A)]=A}return h[c][I]}(d,a.charAt(o))})];case 1:return[2,b.sent()]}})})},n.compressToUTF16=function(a){return p(this,void 0,void 0,function(){return l(this,function(b){switch(b.label){case 0:return a===null?[2,""]:[4,F.compress(a,15,function(o){return String.fromCharCode(o+32)})];case 1:return[2,b.sent()+" "]}})})},n.decompressFromUTF16=function(a){return p(this,void 0,void 0,function(){return l(this,function(b){switch(b.label){case 0:return a===null?[2,""]:a===""?[2,null]:[4,y.decompress(a.length,16384,function(o){return a.charCodeAt(o)-32})];case 1:return[2,b.sent()]}})})}},304:function(r,n,i){var p=this&&this.__awaiter||function(y,d,h,a){return new(h||(h=Promise))(function(b,o){function c(m){try{A(a.next(m))}catch(v){o(v)}}function I(m){try{A(a.throw(m))}catch(v){o(v)}}function A(m){var v;m.done?b(m.value):(v=m.value,v instanceof h?v:new h(function(z){z(v)})).then(c,I)}A((a=a.apply(y,d||[])).next())})},l=this&&this.__generator||function(y,d){var h,a,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(v){if(h)throw new TypeError("Generator is already executing.");for(;o&&(o=0,v[0]&&(c=0)),c;)try{if(h=1,a&&(b=2&v[0]?a.return:v[0]?a.throw||((b=a.return)&&b.call(a),0):a.next)&&!(b=b.call(a,v[1])).done)return b;switch(a=0,b&&(v=[2&v[0],b.value]),v[0]){case 0:case 1:b=v;break;case 4:return c.label++,{value:v[1],done:!1};case 5:c.label++,a=v[1],v=[0];continue;case 7:v=c.ops.pop(),c.trys.pop();continue;default:if(!((b=(b=c.trys).length>0&&b[b.length-1])||v[0]!==6&&v[0]!==2)){c=0;continue}if(v[0]===3&&(!b||v[1]>b[0]&&v[1]<b[3])){c.label=v[1];break}if(v[0]===6&&c.label<b[1]){c.label=b[1],b=v;break}if(b&&c.label<b[2]){c.label=b[2],c.ops.push(v);break}b[2]&&c.ops.pop(),c.trys.pop();continue}v=d.call(y,c)}catch(z){v=[6,z],a=0}finally{h=b=0}if(5&v[0])throw v[1];return{value:v[0]?v[1]:void 0,done:!0}}([A,m])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.CompressorImpl=void 0;var E=i(658),f=[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],F=function(){function y(){}return y.writeValueToData=function(d,h,a,b,o){if(a%4!=0||d.dataPosition+a>b-1)for(var c=0;c<a;c++)d.dataVal=d.dataVal<<1|1&h,d.dataPosition==b-1?(d.dataPosition=0,d.data.push(o(d.dataVal)),d.dataVal=0):d.dataPosition++,h>>=1;else d.dataVal<<=a,d.dataVal|=function(I,A){for(var m=0,v=0;v<A;++v)m<<=4,m|=f[15&I],I>>=4;return m}(h,a/4),d.dataPosition+=a},y.writeWToDataVal=function(d,h,a){d.dictionaryToCreate.has(d.w)?(d.w.charCodeAt(0)<256?(y.writeValueToData(d,0,d.numBits,h,a),y.writeValueToData(d,d.w.charCodeAt(0),8,h,a)):(y.writeValueToData(d,1,d.numBits,h,a),y.writeValueToData(d,d.w.charCodeAt(0),16,h,a)),d.enlargeIn--,d.enlargeIn==0&&(d.enlargeIn=Math.pow(2,d.numBits),d.numBits++),d.dictionaryToCreate.delete(d.w)):y.writeValueToData(d,d.dictionary.get(d.w),d.numBits,h,a),d.enlargeIn--,d.enlargeIn==0&&(d.enlargeIn=Math.pow(2,d.numBits),d.numBits++)},y.loopIteration=function(d,h,a,b,o){var c=d.charAt(h);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,a,b),o.dictionary.set(I,o.dictSize++),o.w=String(c))},y.prototype.compress=function(d,h,a){var b=this;return new Promise(function(o){return p(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?(y.loopIteration(d,I,h,a,c),I%1e4!=0?[3,3]:[4,(0,E.wait)()]):[3,4];case 2:A.sent(),A.label=3;case 3:return I+=1,[3,1];case 4:return c.w!==""&&y.writeWToDataVal(c,h,a),y.writeValueToData(c,2,c.numBits,h,a),c.dataVal<<=h-c.dataPosition,c.data.push(a(c.dataVal)),o(c.data.join("")),[2]}})})})},y}();n.CompressorImpl=F},134:function(r,n,i){var p=this&&this.__awaiter||function(F,y,d,h){return new(d||(d=Promise))(function(a,b){function o(A){try{I(h.next(A))}catch(m){b(m)}}function c(A){try{I(h.throw(A))}catch(m){b(m)}}function I(A){var m;A.done?a(A.value):(m=A.value,m instanceof d?m:new d(function(v){v(m)})).then(o,c)}I((h=h.apply(F,y||[])).next())})},l=this&&this.__generator||function(F,y){var d,h,a,b,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[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,h&&(a=2&m[0]?h.return:m[0]?h.throw||((a=h.return)&&a.call(h),0):h.next)&&!(a=a.call(h,m[1])).done)return a;switch(h=0,a&&(m=[2&m[0],a.value]),m[0]){case 0:case 1:a=m;break;case 4:return o.label++,{value:m[1],done:!1};case 5:o.label++,h=m[1],m=[0];continue;case 7:m=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||m[0]!==6&&m[0]!==2)){o=0;continue}if(m[0]===3&&(!a||m[1]>a[0]&&m[1]<a[3])){o.label=m[1];break}if(m[0]===6&&o.label<a[1]){o.label=a[1],a=m;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(m);break}a[2]&&o.ops.pop(),o.trys.pop();continue}m=y.call(F,o)}catch(v){m=[6,v],h=0}finally{d=a=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 E=i(658),f=function(){function F(){}return F.prototype.decompress=function(y,d,h){var a=this;return new Promise(function(b){return p(a,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:h(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=h(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=h(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=h(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,E.wait)()];case 2:A.sent(),A.label=3;case 3:if(o.dataIndex>y)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=h(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=h(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=h(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]}})})})},F}();n.DecompressorImpl=f},658:function(r,n){var i=this&&this.__awaiter||function(l,E,f,F){return new(f||(f=Promise))(function(y,d){function h(o){try{b(F.next(o))}catch(c){d(c)}}function a(o){try{b(F.throw(o))}catch(c){d(c)}}function b(o){var c;o.done?y(o.value):(c=o.value,c instanceof f?c:new f(function(I){I(c)})).then(h,a)}b((F=F.apply(l,E||[])).next())})},p=this&&this.__generator||function(l,E){var f,F,y,d,h={label:0,sent:function(){if(1&y[0])throw y[1];return y[1]},trys:[],ops:[]};return d={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function a(b){return function(o){return function(c){if(f)throw new TypeError("Generator is already executing.");for(;d&&(d=0,c[0]&&(h=0)),h;)try{if(f=1,F&&(y=2&c[0]?F.return:c[0]?F.throw||((y=F.return)&&y.call(F),0):F.next)&&!(y=y.call(F,c[1])).done)return y;switch(F=0,y&&(c=[2&c[0],y.value]),c[0]){case 0:case 1:y=c;break;case 4:return h.label++,{value:c[1],done:!1};case 5:h.label++,F=c[1],c=[0];continue;case 7:c=h.ops.pop(),h.trys.pop();continue;default:if(!((y=(y=h.trys).length>0&&y[y.length-1])||c[0]!==6&&c[0]!==2)){h=0;continue}if(c[0]===3&&(!y||c[1]>y[0]&&c[1]<y[3])){h.label=c[1];break}if(c[0]===6&&h.label<y[1]){h.label=y[1],y=c;break}if(y&&h.label<y[2]){h.label=y[2],h.ops.push(c);break}y[2]&&h.ops.pop(),h.trys.pop();continue}c=E.call(l,h)}catch(I){c=[6,I],F=0}finally{f=y=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 i(this,void 0,void 0,function(){return p(this,function(l){return[2,new Promise(function(E){setTimeout(E,0)})]})})}}},t={};return function r(n){var i=t[n];if(i!==void 0)return i.exports;var p=t[n]={exports:{}};return e[n].call(p.exports,p,p.exports,r),p.exports}(48)})())});var nt=zt((_o,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",i=!r.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;i?r=global:n&&(r=self);var p=!r.JS_SHA256_NO_COMMON_JS&&typeof Re=="object"&&Re.exports,l=typeof define=="function"&&define.amd,E=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",f="0123456789abcdef".split(""),F=[-2147483648,8388608,32768,128],y=[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],h=["hex","array","digest","arrayBuffer"],a=[];(r.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(s){return Object.prototype.toString.call(s)==="[object Array]"}),E&&(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(T){return new m(u,!0).update(T)[s]()}},o=function(s){var u=b("hex",s);i&&(u=c(u,s)),u.create=function(){return new m(s)},u.update=function(S){return u.create().update(S)};for(var T=0;T<h.length;++T){var w=h[T];u[w]=b(w,s)}return u},c=function(s,u){var T=Ht("crypto"),w=Ht("buffer").Buffer,S=u?"sha224":"sha256",g;w.from&&!r.JS_SHA256_NO_BUFFER_FROM?g=w.from:g=function(x){return new w(x)};var C=function(x){if(typeof x=="string")return T.createHash(S).update(x,"utf8").digest("hex");if(x==null)throw new Error(e);return x.constructor===ArrayBuffer&&(x=new Uint8Array(x)),Array.isArray(x)||ArrayBuffer.isView(x)||x.constructor===w?T.createHash(S).update(g(x)).digest("hex"):s(x)};return C},I=function(s,u){return function(T,w){return new v(T,u,!0).update(w)[s]()}},A=function(s){var u=I("hex",s);u.create=function(S){return new v(S,s)},u.update=function(S,g){return u.create(S).update(g)};for(var T=0;T<h.length;++T){var w=h[T];u[w]=I(w,s)}return u};function m(s,u){u?(a[0]=a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0,this.blocks=a):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,T=typeof s;if(T!=="string"){if(T==="object"){if(s===null)throw new Error(e);if(E&&s.constructor===ArrayBuffer)s=new Uint8Array(s);else if(!Array.isArray(s)&&(!E||!ArrayBuffer.isView(s)))throw new Error(e)}else throw new Error(e);u=!0}for(var w,S=0,g,C=s.length,x=this.blocks;S<C;){if(this.hashed&&(this.hashed=!1,x[0]=this.block,this.block=x[16]=x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=0),u)for(g=this.start;S<C&&g<64;++S)x[g>>>2]|=s[S]<<y[g++&3];else for(g=this.start;S<C&&g<64;++S)w=s.charCodeAt(S),w<128?x[g>>>2]|=w<<y[g++&3]:w<2048?(x[g>>>2]|=(192|w>>>6)<<y[g++&3],x[g>>>2]|=(128|w&63)<<y[g++&3]):w<55296||w>=57344?(x[g>>>2]|=(224|w>>>12)<<y[g++&3],x[g>>>2]|=(128|w>>>6&63)<<y[g++&3],x[g>>>2]|=(128|w&63)<<y[g++&3]):(w=65536+((w&1023)<<10|s.charCodeAt(++S)&1023),x[g>>>2]|=(240|w>>>18)<<y[g++&3],x[g>>>2]|=(128|w>>>12&63)<<y[g++&3],x[g>>>2]|=(128|w>>>6&63)<<y[g++&3],x[g>>>2]|=(128|w&63)<<y[g++&3]);this.lastByteIndex=g,this.bytes+=g-this.start,g>=64?(this.block=x[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]|=F[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,T=this.h2,w=this.h3,S=this.h4,g=this.h5,C=this.h6,x=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&T,B=0;B<64;B+=4)this.first?(this.is224?(ue=300032,R=P[0]-1413257819,x=R-150054599<<0,w=R+24177077<<0):(ue=704751109,R=P[0]-210244248,x=R-1521486534<<0,w=R+143694565<<0),this.first=!1):(N=(s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10),O=(S>>>6|S<<26)^(S>>>11|S<<21)^(S>>>25|S<<7),ue=s&u,G=ue^s&T^Fe,Y=S&g^~S&C,R=x+O+Y+d[B]+P[B],X=N+G,x=w+R<<0,w=R+X<<0),N=(w>>>2|w<<30)^(w>>>13|w<<19)^(w>>>22|w<<10),O=(x>>>6|x<<26)^(x>>>11|x<<21)^(x>>>25|x<<7),et=w&s,G=et^w&u^ue,Y=x&S^~x&g,R=C+O+Y+d[B+1]+P[B+1],X=N+G,C=T+R<<0,T=R+X<<0,N=(T>>>2|T<<30)^(T>>>13|T<<19)^(T>>>22|T<<10),O=(C>>>6|C<<26)^(C>>>11|C<<21)^(C>>>25|C<<7),tt=T&w,G=tt^T&s^et,Y=C&x^~C&S,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&T,G=Fe^u&w^tt,Y=g&C^~g&x,R=S+O+Y+d[B+3]+P[B+3],X=N+G,S=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+T<<0,this.h3=this.h3+w<<0,this.h4=this.h4+S<<0,this.h5=this.h5+g<<0,this.h6=this.h6+C<<0,this.h7=this.h7+x<<0},m.prototype.hex=function(){this.finalize();var s=this.h0,u=this.h1,T=this.h2,w=this.h3,S=this.h4,g=this.h5,C=this.h6,x=this.h7,P=f[s>>>28&15]+f[s>>>24&15]+f[s>>>20&15]+f[s>>>16&15]+f[s>>>12&15]+f[s>>>8&15]+f[s>>>4&15]+f[s&15]+f[u>>>28&15]+f[u>>>24&15]+f[u>>>20&15]+f[u>>>16&15]+f[u>>>12&15]+f[u>>>8&15]+f[u>>>4&15]+f[u&15]+f[T>>>28&15]+f[T>>>24&15]+f[T>>>20&15]+f[T>>>16&15]+f[T>>>12&15]+f[T>>>8&15]+f[T>>>4&15]+f[T&15]+f[w>>>28&15]+f[w>>>24&15]+f[w>>>20&15]+f[w>>>16&15]+f[w>>>12&15]+f[w>>>8&15]+f[w>>>4&15]+f[w&15]+f[S>>>28&15]+f[S>>>24&15]+f[S>>>20&15]+f[S>>>16&15]+f[S>>>12&15]+f[S>>>8&15]+f[S>>>4&15]+f[S&15]+f[g>>>28&15]+f[g>>>24&15]+f[g>>>20&15]+f[g>>>16&15]+f[g>>>12&15]+f[g>>>8&15]+f[g>>>4&15]+f[g&15]+f[C>>>28&15]+f[C>>>24&15]+f[C>>>20&15]+f[C>>>16&15]+f[C>>>12&15]+f[C>>>8&15]+f[C>>>4&15]+f[C&15];return this.is224||(P+=f[x>>>28&15]+f[x>>>24&15]+f[x>>>20&15]+f[x>>>16&15]+f[x>>>12&15]+f[x>>>8&15]+f[x>>>4&15]+f[x&15]),P},m.prototype.toString=m.prototype.hex,m.prototype.digest=function(){this.finalize();var s=this.h0,u=this.h1,T=this.h2,w=this.h3,S=this.h4,g=this.h5,C=this.h6,x=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,T>>>24&255,T>>>16&255,T>>>8&255,T&255,w>>>24&255,w>>>16&255,w>>>8&255,w&255,S>>>24&255,S>>>16&255,S>>>8&255,S&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(x>>>24&255,x>>>16&255,x>>>8&255,x&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 v(s,u,T){var w,S=typeof s;if(S==="string"){var g=[],C=s.length,x=0,P;for(w=0;w<C;++w)P=s.charCodeAt(w),P<128?g[x++]=P:P<2048?(g[x++]=192|P>>>6,g[x++]=128|P&63):P<55296||P>=57344?(g[x++]=224|P>>>12,g[x++]=128|P>>>6&63,g[x++]=128|P&63):(P=65536+((P&1023)<<10|s.charCodeAt(++w)&1023),g[x++]=240|P>>>18,g[x++]=128|P>>>12&63,g[x++]=128|P>>>6&63,g[x++]=128|P&63);s=g}else if(S==="object"){if(s===null)throw new Error(e);if(E&&s.constructor===ArrayBuffer)s=new Uint8Array(s);else if(!Array.isArray(s)&&(!E||!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,T),this.update(N),this.oKeyPad=B,this.inner=!0,this.sharedMemory=T}v.prototype=new m,v.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),p?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,Ot=M(()=>{"use strict";ut="2.21.29"});function jt(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e?jt(e.cause,t):t?null:e}var ft,H,ie=M(()=>{"use strict";Ot();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,i=r.cause instanceof e&&r.cause.docsPath||r.docsPath,p=ft.getDocsUrl?.({...r,docsPath:i}),l=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...p?[`Docs: ${p}`]:[],...n?[`Details: ${n}`]:[],...ft.version?[`Version: ${ft.version}`]:[]].join(`
|
|
2
|
+
`);super(l,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=i,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=t,this.version=ut}walk(t){return jt(this,t)}}});var Be,ke,He,ze,Le,Vt=M(()=>{"use strict";he();ie();Be=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"})}},ke=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
|
+
`),{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
|
+
`),{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";ie();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}):Wt(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 Wt(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 i=0;i<r;i++){let p=t==="right";n[p?i:r-i-1]=e[p?i:e.length-i-1]}return n}var be=M(()=>{"use strict";lt()});var $e,Ue,dt=M(()=>{"use strict";ie();$e=class extends H{constructor({max:t,min:r,signed:n,size:i,value:p}){super(`Number "${p}" is not in safe ${i?`${i*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 ae(e,{size:t}){if($(e)>t)throw new Ue({givenSize:$(e),maxSize:t})}var mt=M(()=>{"use strict";dt();he()});function _(e,t={}){return typeof e=="number"||typeof e=="bigint"?K(e,t):typeof e=="string"?De(e,t):typeof e=="boolean"?_e(e,t):ge(e,t)}function _e(e,t={}){let r=`0x${Number(e)}`;return typeof t.size=="number"?(ae(r,{size:t.size}),U(r,{size:t.size})):r}function ge(e,t={}){let r="";for(let i=0;i<e.length;i++)r+=Kr[e[i]];let n=`0x${r}`;return typeof t.size=="number"?(ae(n,{size:t.size}),U(n,{dir:"right",size:t.size})):n}function K(e,t={}){let{signed:r,size:n}=t,i=BigInt(e),p;n?r?p=(1n<<BigInt(n)*8n-1n)-1n:p=2n**(BigInt(n)*8n)-1n:typeof e=="number"&&(p=BigInt(Number.MAX_SAFE_INTEGER));let l=typeof p=="bigint"&&r?-p-1n:0;if(p&&i>p||i<l){let f=typeof e=="bigint"?"n":"";throw new $e({max:p?`${p}${f}`:void 0,min:`${l}${f}`,signed:r,size:n,value:`${e}${f}`})}let E=`0x${(r&&i<0?(1n<<BigInt(n*8))+BigInt(i):i).toString(16)}`;return n?U(E,{size:n}):E}function De(e,t={}){let r=Jr.encode(e);return ge(r,t)}var Kr,Jr,we=M(()=>{"use strict";dt();be();mt();Kr=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));Jr=new TextEncoder});function ht(e,t={}){return typeof e=="number"||typeof e=="bigint"?Jt(e,t):typeof e=="boolean"?Kt(e,t):Z(e)?Ie(e,t):Ne(e,t)}function Kt(e,t={}){let r=new Uint8Array(1);return r[0]=Number(e),typeof t.size=="number"?(ae(r,{size:t.size}),U(r,{size:t.size})):r}function qt(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&&(ae(r,{size:t.size}),r=U(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);let i=n.length/2,p=new Uint8Array(i);for(let l=0,E=0;l<i;l++){let f=qt(n.charCodeAt(E++)),F=qt(n.charCodeAt(E++));if(f===void 0||F===void 0)throw new H(`Invalid byte sequence ("${n[E-2]}${n[E-1]}" in "${n}").`);p[l]=f*16+F}return p}function Jt(e,t){let r=K(e,t);return Ie(r)}function Ne(e,t={}){let r=Gr.encode(e);return typeof t.size=="number"?(ae(r,{size:t.size}),U(r,{dir:"right",size:t.size})):r}var Gr,J,Oe=M(()=>{"use strict";ie();me();be();mt();we();Gr=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 Xr(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Ee(e,...t){if(!Xr(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 Gt(e,t){Ee(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 Yr(e,t=!1){return t?{h:Number(e&je),l:Number(e>>Xt&je)}:{h:Number(e>>Xt&je)|0,l:Number(e&je)|0}}function Yt(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;i<e.length;i++){let{h:p,l}=Yr(e[i],t);[r[i],n[i]]=[p,l]}return[r,n]}var je,Xt,Zt,Qt,er,tr,rr=M(()=>{"use strict";je=BigInt(4294967295),Xt=BigInt(32);Zt=(e,t,r)=>e<<r|t>>>32-r,Qt=(e,t,r)=>t<<r|e>>>32-r,er=(e,t,r)=>t<<r-32|e>>>64-r,tr=(e,t,r)=>e<<r-32|t>>>64-r});function wt(e){for(let t=0;t<e.length;t++)e[t]=Zr(e[t])}function Qr(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=Qr(e)),Ee(e),e}function nr(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 ir(e){let t=(n,i)=>e(i).update(We(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}var or,gt,Zr,Ve,qn,ar=M(()=>{"use strict";bt();or=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),gt=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,Zr=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;Ve=class{clone(){return this._cloneInto()}},qn={}.toString});function so(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 E=(l+8)%10,f=(l+2)%10,F=r[f],y=r[f+1],d=sr(F,y,1)^r[E],h=cr(F,y,1)^r[E+1];for(let a=0;a<50;a+=10)e[l+a]^=d,e[l+a+1]^=h}let i=e[2],p=e[3];for(let l=0;l<24;l++){let E=ur[l],f=sr(i,p,E),F=cr(i,p,E),y=pr[l];i=e[y],p=e[y+1],e[y]=f,e[y+1]=F}for(let l=0;l<50;l+=10){for(let E=0;E<10;E++)r[E]=e[l+E];for(let E=0;E<10;E++)e[l+E]^=~r[(E+2)%10]&r[(E+4)%10]}e[0]^=io[n],e[1]^=ao[n]}r.fill(0)}var pr,ur,fr,eo,ve,to,ro,oo,no,io,ao,sr,cr,qe,Q,Yn,Zn,Qn,ei,ti,lr,ri,oi,dr,ni,ii,mr=M(()=>{"use strict";bt();rr();ar();pr=[],ur=[],fr=[],eo=BigInt(0),ve=BigInt(1),to=BigInt(2),ro=BigInt(7),oo=BigInt(256),no=BigInt(113);for(let e=0,t=ve,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],pr.push(2*(5*n+r)),ur.push((e+1)*(e+2)/2%64);let i=eo;for(let p=0;p<7;p++)t=(t<<ve^(t>>ro)*no)%oo,t&to&&(i^=ve<<(ve<<BigInt(p))-ve);fr.push(i)}[io,ao]=Yt(fr,!0),sr=(e,t,r)=>r>32?er(e,t,r):Zt(e,t,r),cr=(e,t,r)=>r>32?tr(e,t,r):Qt(e,t,r);qe=class e extends Ve{constructor(t,r,n,i=!1,p=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=p,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=or(this.state)}keccak(){gt||wt(this.state32),so(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 i=t.length;for(let p=0;p<i;){let l=Math.min(r-this.pos,i-p);for(let E=0;E<l;E++)n[this.pos++]^=t[p++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:n,blockLen:i}=this;t[n]^=r,r&128&&n===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){yt(this,!1),Ee(t),this.finish();let r=this.state,{blockLen:n}=this;for(let i=0,p=t.length;i<p;){this.posOut>=n&&this.keccak();let l=Math.min(n-this.posOut,p-i);t.set(r.subarray(this.posOut,this.posOut+l),i),this.posOut+=l,i+=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(Gt(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:i,rounds:p,enableXOF:l}=this;return t||(t=new e(r,n,i,l,p)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=p,t.suffix=n,t.outputLen=i,t.enableXOF=l,t.destroyed=this.destroyed,t}},Q=(e,t,r)=>nr(()=>new qe(t,e,r)),Yn=Q(6,144,224/8),Zn=Q(6,136,256/8),Qn=Q(6,104,384/8),ei=Q(6,72,512/8),ti=Q(1,144,224/8),lr=Q(1,136,256/8),ri=Q(1,104,384/8),oi=Q(1,72,512/8),dr=(e,t,r)=>ir((n={})=>new qe(t,e,n.dkLen===void 0?r:n.dkLen,!0)),ni=dr(31,168,128/8),ii=dr(31,136,256/8)});function Te(e,t){let r=t||"hex",n=lr(Z(e,{strict:!1})?ht(e):e);return r==="bytes"?n:_(n)}var It=M(()=>{"use strict";mr();me();Oe();we()});var se,Et=M(()=>{"use strict";ie();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,vt=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 hr(e,t){if(Tt.has(`${e}.${t}`))return Tt.get(`${e}.${t}`);let r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=Te(Ne(r),"bytes"),i=(t?r.substring(`${t}0x`.length):r).split("");for(let l=0;l<40;l+=2)n[l>>1]>>4>=8&&i[l]&&(i[l]=i[l].toUpperCase()),(n[l>>1]&15)>=8&&i[l+1]&&(i[l+1]=i[l+1].toUpperCase());let p=`0x${i.join("")}`;return Tt.set(`${e}.${t}`,p),p}var Tt,xr=M(()=>{"use strict";Oe();It();vt();Tt=new pe(8192)});function Se(e,t){let{strict:r=!0}=t??{},n=`${e}.${r}`;if(St.has(n))return St.get(n);let i=co.test(e)?e.toLowerCase()===e?!0:r?hr(e)===e:!0:!1;return St.set(n,i),i}var co,St,Ft=M(()=>{"use strict";vt();xr();co=/^0x[a-fA-F0-9]{40}$/,St=new pe(8192)});function ee(e){return typeof e[0]=="string"?j(e):yr(e)}function yr(e){let t=0;for(let i of e)t+=i.length;let r=new Uint8Array(t),n=0;for(let i of e)r.set(i,n),n+=i.length;return r}function j(e){return`0x${e.reduce((t,r)=>t+r.replace("0x",""),"")}`}var At=M(()=>{"use strict"});function br(e,t,r,{strict:n}={}){return Z(e,{strict:!1})?uo(e,t,r,{strict:n}):po(e,t,r,{strict:n})}function gr(e,t){if(typeof t=="number"&&t>0&&t>$(e)-1)throw new xe({offset:t,position:"start",size:$(e)})}function wr(e,t,r){if(typeof t=="number"&&typeof r=="number"&&$(e)!==r-t)throw new xe({offset:r,position:"end",size:$(e)})}function po(e,t,r,{strict:n}={}){gr(e,t);let i=e.slice(t,r);return n&&wr(i,t,r),i}function uo(e,t,r,{strict:n}={}){gr(e,t);let i=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return n&&wr(i,t,r),i}var Ir=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=fo({params:e,values:t}),n=Rt(r);return n.length===0?"0x":n}function fo({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=wo(e.type);if(r){let[n,i]=r;return mo(t,{length:n,param:{...e,type:i}})}if(e.type==="tuple")return go(t,{param:e});if(e.type==="address")return lo(t);if(e.type==="bool")return xo(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){let n=e.type.startsWith("int");return yo(t,{signed:n})}if(e.type.startsWith("bytes"))return ho(t,{param:e});if(e.type==="string")return bo(t);throw new ze(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Rt(e){let t=0;for(let p=0;p<e.length;p++){let{dynamic:l,encoded:E}=e[p];l?t+=32:t+=$(E)}let r=[],n=[],i=0;for(let p=0;p<e.length;p++){let{dynamic:l,encoded:E}=e[p];l?(r.push(K(t+i,{size:32})),n.push(E),i+=$(E)):r.push(E)}return ee([...r,...n])}function lo(e){if(!Se(e))throw new se({address:e});return{dynamic:!1,encoded:q(e.toLowerCase())}}function mo(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 i=!1,p=[];for(let l=0;l<e.length;l++){let E=Pt({param:r,value:e[l]});E.dynamic&&(i=!0),p.push(E)}if(n||i){let l=Rt(p);if(n){let E=K(p.length,{size:32});return{dynamic:!0,encoded:p.length>0?ee([E,l]):E}}if(i)return{dynamic:!0,encoded:l}}return{dynamic:!1,encoded:ee(p.map(({encoded:l})=>l))}}function ho(e,{param:t}){let[,r]=t.type.split("bytes"),n=$(e);if(!r){let i=e;return n%32!==0&&(i=q(i,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:ee([q(K(n,{size:32})),i])}}if(n!==Number.parseInt(r))throw new ke({expectedSize:Number.parseInt(r),value:e});return{dynamic:!1,encoded:q(e,{dir:"right"})}}function xo(e){if(typeof e!="boolean")throw new H(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:q(_e(e))}}function yo(e,{signed:t}){return{dynamic:!1,encoded:K(e,{size:32,signed:t})}}function bo(e){let t=De(e),r=Math.ceil($(t)/32),n=[];for(let i=0;i<r;i++)n.push(q(br(t,i*32,(i+1)*32),{dir:"right"}));return{dynamic:!0,encoded:ee([q(K($(t),{size:32})),...n])}}function go(e,{param:t}){let r=!1,n=[];for(let i=0;i<t.components.length;i++){let p=t.components[i],l=Array.isArray(e)?i:p.name,E=Pt({param:p,value:e[l]});n.push(E),E.dynamic&&(r=!0)}return{dynamic:r,encoded:r?Rt(n):ee(n.map(({encoded:i})=>i))}}function wo(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}var Er=M(()=>{"use strict";Vt();Et();ie();Ft();At();be();he();Ir();we()});function Mt(e,t){if(!Se(e,{strict:!1}))throw new se({address:e});if(!Se(t,{strict:!1}))throw new se({address:t});return e.toLowerCase()===t.toLowerCase()}var vr=M(()=>{"use strict";Et();Ft()});var ko={};Vr(ko,{Deferred:()=>W,FrakContextManager:()=>te,FrakRpcError:()=>k,PressInteractionEncoder:()=>Hr,PurchaseInteractionEncoder:()=>zr,ReferralInteractionEncoder:()=>Ze,RpcErrorCodes:()=>L,WebShopInteractionEncoder:()=>Lr,compressJson:()=>le,createIFrameNexusClient:()=>pt,createIframe:()=>st,decompressDataAndCheckHash:()=>ne,decompressJson:()=>de,displayModal:()=>re,hashAndCompressData:()=>oe,interactionTypes:()=>V,openSso:()=>Mr,processReferral:()=>Qe,productTypes:()=>D,productTypesMask:()=>Pr,referralInteraction:()=>Ur,sendInteraction:()=>Xe,sendTransaction:()=>kr,siweAuthenticate:()=>Br,walletStatus:()=>Ye,watchWalletStatus:()=>Ge});var k=class extends Error{constructor(r,n,i){super(n);this.code=r;this.data=i}};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 $t=Ce(ot(),1),it=Ce(nt(),1);async function oe(e){let t=(0,it.sha256)(JSON.stringify(e)),r={...e,validationHash:t},n=await le(r),i=(0,it.sha256)(n);return{compressed:n,compressedHash:i}}async function le(e){return(0,$t.compressToBase64)(JSON.stringify(e))}var Ut=Ce(ot(),1),at=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,at.sha256)(e.compressed)!==e.compressedHash)throw new k(L.corruptedResponse,"Invalid compressed hash");let{validationHash:n,...i}=t;if((0,at.sha256)(JSON.stringify(i))!==t.validationHash)throw new k(L.corruptedResponse,"Invalid data validation hash");return t}async function de(e){let t=await(0,Ut.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 _t(){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}){let t=document.querySelector("#nexus-wallet");if(t)return Promise.resolve(t);let r=document.createElement("iframe");return r.id=Me.id,r.name=Me.name,r.allow=Me.allow,r.style.zIndex=Me.style.zIndex.toString(),ct({iframe:r,isVisible:!1}),document.body.appendChild(r),new Promise(n=>{r?.addEventListener("load",()=>n(r)),r.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 Dt({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 Nt({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 i=t.contentWindow,p=async f=>{if(!(f.origin&&URL.canParse(f.origin))||new URL(f.origin).origin.toLowerCase()!==new URL(e).origin.toLowerCase())return;if("iframeLifecycle"in f.data){await n.handleEvent(f.data);return}if("clientLifecycle"in f.data){console.error("Client lifecycle event received on the client side, dismissing it");return}let F=f.data.id,y=r.getRpcResolver(F);y&&await y(f.data)};return window.addEventListener("message",p),{sendEvent:f=>{i.postMessage(f,{targetOrigin:e})},cleanup:()=>{window.removeEventListener("message",p)}}}function pt({config:e,iframe:t}){let r=_t(),n=Dt({iframe:t}),i=Nt({nexusWalletUrl:e.walletUrl,iframe:t,channelManager:r,iframeLifecycleManager:n}),p=async F=>{if(!await n.isConnected)throw new k(L.clientNotConnected,"The iframe provider isn't connected yet");let d=new W,h=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(h)}),a=await oe(F);return i.sendEvent({id:h,topic:F.method,data:a}),d.promise},l=async(F,y)=>{if(!await n.isConnected)throw new k(L.clientNotConnected,"The iframe provider isn't connected yet");let h=r.createChannel(async b=>{let o=await ne(b.data);if(o.result)y(o.result);else throw new Pe("No valid result in the response")}),a=await oe(F);i.sendEvent({id:h,topic:F.method,data:a})},E=async()=>{r.destroy(),i.cleanup(),t.remove()},f=qr({config:e,messageHandler:i,lifecycleManager:n});return{config:e,waitForConnection:n.isConnected,waitForSetup:f,request:p,listenerRequest:l,destroy:E}}async function qr({config:e,messageHandler:t,lifecycleManager:r}){await r.isConnected;let n=async()=>{let p=e.metadata.css;p&&t.sendEvent({clientLifecycle:"modal-css",data:{cssLink:p}})},i=async()=>{if(typeof window>"u")return;let p=window.localStorage.getItem(ce);p&&t.sendEvent({clientLifecycle:"restore-backup",data:{backup:p}})};await Promise.all([n(),i()])}var Ke=256,Je;function Tr(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)}Er();Oe();we();At();vr();It();be();var Bt="fCtx";function Io(e){return btoa(Array.from(e,t=>String.fromCharCode(t)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Eo(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 Sr(e){if(e?.r)try{let t=Ie(e.r);return Io(t)}catch(t){console.error("Error compressing Frak context",{e:t,context:e})}}function Fr(e){if(!(!e||e.length===0))try{let t=Eo(e);return{r:ge(t,{size:20})}}catch(t){console.error("Error decompressing Frak context",{e:t,context:e})}}function Ar({url:e}){if(!e)return null;let r=new URL(e).searchParams.get(Bt);return r?Fr(r):null}function Cr({url:e,context:t}){if(!e)return null;let r=Ar({url:e}),n=r?{...r,...t}:t;if(!n.r)return;let i=Sr(n);if(!i)return;let p=new URL(e);return p.searchParams.set(Bt,i),p.toString()}function vo(e){let t=new URL(e);return t.searchParams.delete(Bt),t.toString()}function To({url:e,context:t}){if(!window.location?.href||typeof window>"u"){console.error("No window found, can't update context");return}let r=Cr({url:e,context:t});r&&window.history.replaceState(null,"",r.toString())}var te={compress:Sr,decompress:Fr,parse:Ar,update:Cr,remove:vo,replaceUrl:To};var D={dapp:1,press:2,webshop:3,referral:30,purchase:31},Pr=Object.entries(D).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 Rr({domain:e}){return Te(_(e))}async function Xe(e,{productId:t,interaction:r,validation:n}){let i=t??Rr(e.config);return await e.request({method:"frak_sendInteraction",params:[i,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 Mr(e,t){let{metadata:r}=e.config;await e.request({method:"frak_sso",params:[t,r.name,r.css]})}function kt(){return Tr(96)}async function Br(e,{siwe:t,metadata:r}){let n=t?.statement??`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`,i={...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:i}}})).siweAuthenticate}async function kr(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,i=>{t?.(i),n||(r.resolve(i),n=!0)}),r.promise}function So({articleId:e}){let t=j([V.press.openArticle,U(e,{size:32})]);return{handlerTypeDenominator:_(D.press),interactionData:t}}function Fo({articleId:e}){let t=j([V.press.readArticle,U(e,{size:32})]);return{handlerTypeDenominator:_(D.press),interactionData:t}}var Hr={openArticle:So,readArticle:Fo};function Ao(){let e=j([V.referral.createLink,"0x"]);return{handlerTypeDenominator:_(D.referral),interactionData:e}}function Co({referrer:e}){let t=j([V.referral.referred,U(e,{size:32})]);return{handlerTypeDenominator:_(D.referral),interactionData:t}}var Ze={createLink:Ao,referred:Co};function Po({purchaseId:e}){let t=j([V.purchase.started,U(e,{size:32})]);return{handlerTypeDenominator:_(D.purchase),interactionData:t}}function Ro({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 zr={startPurchase:Po,completedPurchase:Ro};function Mo(){let e=j([V.webshop.open,"0x"]);return{handlerTypeDenominator:_(D.webshop),interactionData:e}}var Lr={open:Mo};async function Qe(e,{walletStatus:t,frakContext:r,modalConfig:n,productId:i}){try{let p=t?.wallet;if(!r?.r)return p&&te.replaceUrl({url:window.location?.href,context:{r:p}}),"no-referrer";if(p||(p=await $r(e,{modalConfig:n,walletStatus:t})),p&&Mt(r.r,p))return"self-referral";t?.interactionSession||(p=await $r(e,{modalConfig:n,walletStatus:t})),p&&te.replaceUrl({url:window.location?.href,context:{r:p}});let l=Ze.referred({referrer:r.r});return await Xe(e,{productId:i,interaction:l}),"success"}catch(p){return Bo(p)}}async function $r(e,{modalConfig:t,walletStatus:r}){return r?.interactionSession?r.wallet??void 0:t?(await re(e,t))?.login?.wallet??void 0:void 0}function Bo(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 Ur(e,{productId:t,modalConfig:r}={}){let n=te.parse({url:window.location.href}),i=await Ye(e);try{return await Qe(e,{walletStatus:i,frakContext:n,modalConfig:r,productId:t})}catch(p){return p}}return Wr(ko);})();
|
|
7
7
|
/*! Bundled license information:
|
|
8
8
|
|
|
9
9
|
js-sha256/src/sha256.js:
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkYDZBXUC4cjs = require('./chunk-YDZBXUC4.cjs');
|
|
10
10
|
|
|
11
11
|
// src/core/utils/constants.ts
|
|
12
12
|
var BACKUP_KEY = "nexus-wallet-backup";
|
|
@@ -31,7 +31,7 @@ function createIFrameChannelManager() {
|
|
|
31
31
|
function createIFrameLifecycleManager({
|
|
32
32
|
iframe
|
|
33
33
|
}) {
|
|
34
|
-
const isConnectedDeferred = new (0,
|
|
34
|
+
const isConnectedDeferred = new (0, _chunkYDZBXUC4cjs.Deferred)();
|
|
35
35
|
const handler = async (messageEvent) => {
|
|
36
36
|
switch (messageEvent.iframeLifecycle) {
|
|
37
37
|
// Resolve the isConnected promise
|
|
@@ -53,7 +53,7 @@ function createIFrameLifecycleManager({
|
|
|
53
53
|
// Change iframe visibility
|
|
54
54
|
case "show":
|
|
55
55
|
case "hide":
|
|
56
|
-
|
|
56
|
+
_chunkYDZBXUC4cjs.changeIframeVisibility.call(void 0, {
|
|
57
57
|
iframe,
|
|
58
58
|
isVisible: messageEvent.iframeLifecycle === "show"
|
|
59
59
|
});
|
|
@@ -74,20 +74,20 @@ function createIFrameMessageHandler({
|
|
|
74
74
|
iframeLifecycleManager
|
|
75
75
|
}) {
|
|
76
76
|
if (typeof window === "undefined") {
|
|
77
|
-
throw new (0,
|
|
78
|
-
|
|
77
|
+
throw new (0, _chunkYDZBXUC4cjs.FrakRpcError)(
|
|
78
|
+
_chunkYDZBXUC4cjs.RpcErrorCodes.configError,
|
|
79
79
|
"iframe client should be used in the browser"
|
|
80
80
|
);
|
|
81
81
|
}
|
|
82
82
|
if (!iframe.contentWindow) {
|
|
83
|
-
throw new (0,
|
|
84
|
-
|
|
83
|
+
throw new (0, _chunkYDZBXUC4cjs.FrakRpcError)(
|
|
84
|
+
_chunkYDZBXUC4cjs.RpcErrorCodes.configError,
|
|
85
85
|
"The iframe does not have a product window"
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
88
|
const contentWindow = iframe.contentWindow;
|
|
89
89
|
const msgHandler = async (event) => {
|
|
90
|
-
if (!event.origin) {
|
|
90
|
+
if (!(event.origin && URL.canParse(event.origin))) {
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
93
|
if (new URL(event.origin).origin.toLowerCase() !== new URL(nexusWalletUrl).origin.toLowerCase()) {
|
|
@@ -141,17 +141,17 @@ function createIFrameNexusClient({
|
|
|
141
141
|
const request = async (args) => {
|
|
142
142
|
const isConnected = await lifecycleManager.isConnected;
|
|
143
143
|
if (!isConnected) {
|
|
144
|
-
throw new (0,
|
|
145
|
-
|
|
144
|
+
throw new (0, _chunkYDZBXUC4cjs.FrakRpcError)(
|
|
145
|
+
_chunkYDZBXUC4cjs.RpcErrorCodes.clientNotConnected,
|
|
146
146
|
"The iframe provider isn't connected yet"
|
|
147
147
|
);
|
|
148
148
|
}
|
|
149
|
-
const result = new (0,
|
|
149
|
+
const result = new (0, _chunkYDZBXUC4cjs.Deferred)();
|
|
150
150
|
const channelId = channelManager.createChannel(async (message) => {
|
|
151
|
-
const decompressed = await
|
|
151
|
+
const decompressed = await _chunkYDZBXUC4cjs.decompressDataAndCheckHash.call(void 0, message.data);
|
|
152
152
|
if (decompressed.error) {
|
|
153
153
|
result.reject(
|
|
154
|
-
new (0,
|
|
154
|
+
new (0, _chunkYDZBXUC4cjs.FrakRpcError)(
|
|
155
155
|
decompressed.error.code,
|
|
156
156
|
decompressed.error.message,
|
|
157
157
|
_optionalChain([decompressed, 'access', _ => _.error, 'optionalAccess', _2 => _2.data])
|
|
@@ -162,7 +162,7 @@ function createIFrameNexusClient({
|
|
|
162
162
|
}
|
|
163
163
|
channelManager.removeChannel(channelId);
|
|
164
164
|
});
|
|
165
|
-
const compressedMessage = await
|
|
165
|
+
const compressedMessage = await _chunkYDZBXUC4cjs.hashAndCompressData.call(void 0, args);
|
|
166
166
|
messageHandler.sendEvent({
|
|
167
167
|
id: channelId,
|
|
168
168
|
topic: args.method,
|
|
@@ -173,20 +173,20 @@ function createIFrameNexusClient({
|
|
|
173
173
|
const listenerRequest = async (args, callback) => {
|
|
174
174
|
const isConnected = await lifecycleManager.isConnected;
|
|
175
175
|
if (!isConnected) {
|
|
176
|
-
throw new (0,
|
|
177
|
-
|
|
176
|
+
throw new (0, _chunkYDZBXUC4cjs.FrakRpcError)(
|
|
177
|
+
_chunkYDZBXUC4cjs.RpcErrorCodes.clientNotConnected,
|
|
178
178
|
"The iframe provider isn't connected yet"
|
|
179
179
|
);
|
|
180
180
|
}
|
|
181
181
|
const channelId = channelManager.createChannel(async (message) => {
|
|
182
|
-
const decompressed = await
|
|
182
|
+
const decompressed = await _chunkYDZBXUC4cjs.decompressDataAndCheckHash.call(void 0, message.data);
|
|
183
183
|
if (decompressed.result) {
|
|
184
184
|
callback(decompressed.result);
|
|
185
185
|
} else {
|
|
186
|
-
throw new (0,
|
|
186
|
+
throw new (0, _chunkYDZBXUC4cjs.InternalError)("No valid result in the response");
|
|
187
187
|
}
|
|
188
188
|
});
|
|
189
|
-
const compressedMessage = await
|
|
189
|
+
const compressedMessage = await _chunkYDZBXUC4cjs.hashAndCompressData.call(void 0, args);
|
|
190
190
|
messageHandler.sendEvent({
|
|
191
191
|
id: channelId,
|
|
192
192
|
topic: args.method,
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
changeIframeVisibility,
|
|
7
7
|
decompressDataAndCheckHash,
|
|
8
8
|
hashAndCompressData
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7K4L7VQC.js";
|
|
10
10
|
|
|
11
11
|
// src/core/utils/constants.ts
|
|
12
12
|
var BACKUP_KEY = "nexus-wallet-backup";
|
|
@@ -87,7 +87,7 @@ function createIFrameMessageHandler({
|
|
|
87
87
|
}
|
|
88
88
|
const contentWindow = iframe.contentWindow;
|
|
89
89
|
const msgHandler = async (event) => {
|
|
90
|
-
if (!event.origin) {
|
|
90
|
+
if (!(event.origin && URL.canParse(event.origin))) {
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
93
|
if (new URL(event.origin).origin.toLowerCase() !== new URL(nexusWalletUrl).origin.toLowerCase()) {
|
|
@@ -187,27 +187,59 @@ function changeIframeVisibility({
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
// src/core/utils/FrakContext.ts
|
|
190
|
+
import { bytesToHex, hexToBytes } from "viem";
|
|
190
191
|
var contextKey = "fCtx";
|
|
191
|
-
|
|
192
|
+
function base64url_encode(buffer) {
|
|
193
|
+
return btoa(Array.from(buffer, (b) => String.fromCharCode(b)).join("")).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
194
|
+
}
|
|
195
|
+
function base64url_decode(value) {
|
|
196
|
+
const m = value.length % 4;
|
|
197
|
+
return Uint8Array.from(
|
|
198
|
+
atob(
|
|
199
|
+
value.replace(/-/g, "+").replace(/_/g, "/").padEnd(value.length + (m === 0 ? 0 : 4 - m), "=")
|
|
200
|
+
),
|
|
201
|
+
(c) => c.charCodeAt(0)
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
function compress(context) {
|
|
205
|
+
if (!context?.r) return;
|
|
206
|
+
try {
|
|
207
|
+
const bytes = hexToBytes(context.r);
|
|
208
|
+
return base64url_encode(bytes);
|
|
209
|
+
} catch (e) {
|
|
210
|
+
console.error("Error compressing Frak context", { e, context });
|
|
211
|
+
}
|
|
212
|
+
return void 0;
|
|
213
|
+
}
|
|
214
|
+
function decompress(context) {
|
|
215
|
+
if (!context || context.length === 0) return;
|
|
216
|
+
try {
|
|
217
|
+
const bytes = base64url_decode(context);
|
|
218
|
+
return { r: bytesToHex(bytes, { size: 20 }) };
|
|
219
|
+
} catch (e) {
|
|
220
|
+
console.error("Error decompressing Frak context", { e, context });
|
|
221
|
+
}
|
|
222
|
+
return void 0;
|
|
223
|
+
}
|
|
224
|
+
function parse({ url }) {
|
|
192
225
|
if (!url) return null;
|
|
193
226
|
const urlObj = new URL(url);
|
|
194
|
-
const
|
|
195
|
-
if (!
|
|
196
|
-
|
|
197
|
-
if (!parsedContext) return null;
|
|
198
|
-
return parsedContext;
|
|
227
|
+
const frakContext = urlObj.searchParams.get(contextKey);
|
|
228
|
+
if (!frakContext) return null;
|
|
229
|
+
return decompress(frakContext);
|
|
199
230
|
}
|
|
200
|
-
|
|
231
|
+
function update({
|
|
201
232
|
url,
|
|
202
233
|
context
|
|
203
234
|
}) {
|
|
204
235
|
if (!url) return null;
|
|
205
|
-
const currentContext =
|
|
236
|
+
const currentContext = parse({ url });
|
|
206
237
|
const mergedContext = currentContext ? { ...currentContext, ...context } : context;
|
|
207
|
-
|
|
238
|
+
if (!mergedContext.r) return;
|
|
239
|
+
const compressedContext = compress(mergedContext);
|
|
208
240
|
if (!compressedContext) return;
|
|
209
241
|
const urlObj = new URL(url);
|
|
210
|
-
urlObj.searchParams.set(contextKey,
|
|
242
|
+
urlObj.searchParams.set(contextKey, compressedContext);
|
|
211
243
|
return urlObj.toString();
|
|
212
244
|
}
|
|
213
245
|
function remove(url) {
|
|
@@ -215,7 +247,7 @@ function remove(url) {
|
|
|
215
247
|
urlObj.searchParams.delete(contextKey);
|
|
216
248
|
return urlObj.toString();
|
|
217
249
|
}
|
|
218
|
-
|
|
250
|
+
function replaceUrl({
|
|
219
251
|
url,
|
|
220
252
|
context
|
|
221
253
|
}) {
|
|
@@ -223,7 +255,7 @@ async function replaceUrl({
|
|
|
223
255
|
console.error("No window found, can't update context");
|
|
224
256
|
return;
|
|
225
257
|
}
|
|
226
|
-
const newUrl =
|
|
258
|
+
const newUrl = update({
|
|
227
259
|
url,
|
|
228
260
|
context
|
|
229
261
|
});
|
|
@@ -231,6 +263,8 @@ async function replaceUrl({
|
|
|
231
263
|
window.history.replaceState(null, "", newUrl.toString());
|
|
232
264
|
}
|
|
233
265
|
var FrakContextManager = {
|
|
266
|
+
compress,
|
|
267
|
+
decompress,
|
|
234
268
|
parse,
|
|
235
269
|
update,
|
|
236
270
|
remove,
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
FrakContextManager,
|
|
4
4
|
FrakRpcError,
|
|
5
5
|
RpcErrorCodes
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7K4L7VQC.js";
|
|
7
7
|
import {
|
|
8
8
|
ReferralInteractionEncoder
|
|
9
9
|
} from "./chunk-TIKEZMSD.js";
|
|
@@ -112,7 +112,7 @@ async function processReferral(client, {
|
|
|
112
112
|
let currentWallet = walletStatus2?.wallet;
|
|
113
113
|
if (!frakContext?.r) {
|
|
114
114
|
if (currentWallet) {
|
|
115
|
-
|
|
115
|
+
FrakContextManager.replaceUrl({
|
|
116
116
|
url: window.location?.href,
|
|
117
117
|
context: { r: currentWallet }
|
|
118
118
|
});
|
|
@@ -135,7 +135,7 @@ async function processReferral(client, {
|
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
if (currentWallet) {
|
|
138
|
-
|
|
138
|
+
FrakContextManager.replaceUrl({
|
|
139
139
|
url: window.location?.href,
|
|
140
140
|
context: { r: currentWallet }
|
|
141
141
|
});
|
|
@@ -181,7 +181,7 @@ async function referralInteraction(client, {
|
|
|
181
181
|
productId,
|
|
182
182
|
modalConfig
|
|
183
183
|
} = {}) {
|
|
184
|
-
const frakContext =
|
|
184
|
+
const frakContext = FrakContextManager.parse({
|
|
185
185
|
url: window.location.href
|
|
186
186
|
});
|
|
187
187
|
const currentWalletStatus = await walletStatus(client);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkYDZBXUC4cjs = require('./chunk-YDZBXUC4.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunkA3XYA7S7cjs = require('./chunk-A3XYA7S7.cjs');
|
|
@@ -88,7 +88,7 @@ async function sendTransaction(client, { tx, metadata }) {
|
|
|
88
88
|
|
|
89
89
|
// src/core/actions/wrapper/walletStatus.ts
|
|
90
90
|
async function walletStatus(client, callback) {
|
|
91
|
-
const firstResult = new (0,
|
|
91
|
+
const firstResult = new (0, _chunkYDZBXUC4cjs.Deferred)();
|
|
92
92
|
let hasResolved = false;
|
|
93
93
|
await watchWalletStatus(client, (status) => {
|
|
94
94
|
_optionalChain([callback, 'optionalCall', _5 => _5(status)]);
|
|
@@ -112,7 +112,7 @@ async function processReferral(client, {
|
|
|
112
112
|
let currentWallet = _optionalChain([walletStatus2, 'optionalAccess', _6 => _6.wallet]);
|
|
113
113
|
if (!_optionalChain([frakContext, 'optionalAccess', _7 => _7.r])) {
|
|
114
114
|
if (currentWallet) {
|
|
115
|
-
|
|
115
|
+
_chunkYDZBXUC4cjs.FrakContextManager.replaceUrl({
|
|
116
116
|
url: _optionalChain([window, 'access', _8 => _8.location, 'optionalAccess', _9 => _9.href]),
|
|
117
117
|
context: { r: currentWallet }
|
|
118
118
|
});
|
|
@@ -135,7 +135,7 @@ async function processReferral(client, {
|
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
if (currentWallet) {
|
|
138
|
-
|
|
138
|
+
_chunkYDZBXUC4cjs.FrakContextManager.replaceUrl({
|
|
139
139
|
url: _optionalChain([window, 'access', _11 => _11.location, 'optionalAccess', _12 => _12.href]),
|
|
140
140
|
context: { r: currentWallet }
|
|
141
141
|
});
|
|
@@ -163,11 +163,11 @@ async function ensureWalletConnected(client, {
|
|
|
163
163
|
return _nullishCoalesce(walletStatus2.wallet, () => ( void 0));
|
|
164
164
|
}
|
|
165
165
|
function mapErrorToState(error) {
|
|
166
|
-
if (error instanceof
|
|
166
|
+
if (error instanceof _chunkYDZBXUC4cjs.FrakRpcError) {
|
|
167
167
|
switch (error.code) {
|
|
168
|
-
case
|
|
168
|
+
case _chunkYDZBXUC4cjs.RpcErrorCodes.walletNotConnected:
|
|
169
169
|
return "no-wallet";
|
|
170
|
-
case
|
|
170
|
+
case _chunkYDZBXUC4cjs.RpcErrorCodes.serverErrorForInteractionDelegation:
|
|
171
171
|
return "no-session";
|
|
172
172
|
default:
|
|
173
173
|
return "error";
|
|
@@ -181,7 +181,7 @@ async function referralInteraction(client, {
|
|
|
181
181
|
productId,
|
|
182
182
|
modalConfig
|
|
183
183
|
} = {}) {
|
|
184
|
-
const frakContext =
|
|
184
|
+
const frakContext = _chunkYDZBXUC4cjs.FrakContextManager.parse({
|
|
185
185
|
url: window.location.href
|
|
186
186
|
});
|
|
187
187
|
const currentWalletStatus = await walletStatus(client);
|
|
@@ -187,27 +187,59 @@ function changeIframeVisibility({
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
// src/core/utils/FrakContext.ts
|
|
190
|
+
var _viem = require('viem');
|
|
190
191
|
var contextKey = "fCtx";
|
|
191
|
-
|
|
192
|
+
function base64url_encode(buffer) {
|
|
193
|
+
return btoa(Array.from(buffer, (b) => String.fromCharCode(b)).join("")).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
194
|
+
}
|
|
195
|
+
function base64url_decode(value) {
|
|
196
|
+
const m = value.length % 4;
|
|
197
|
+
return Uint8Array.from(
|
|
198
|
+
atob(
|
|
199
|
+
value.replace(/-/g, "+").replace(/_/g, "/").padEnd(value.length + (m === 0 ? 0 : 4 - m), "=")
|
|
200
|
+
),
|
|
201
|
+
(c) => c.charCodeAt(0)
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
function compress(context) {
|
|
205
|
+
if (!_optionalChain([context, 'optionalAccess', _11 => _11.r])) return;
|
|
206
|
+
try {
|
|
207
|
+
const bytes = _viem.hexToBytes.call(void 0, context.r);
|
|
208
|
+
return base64url_encode(bytes);
|
|
209
|
+
} catch (e) {
|
|
210
|
+
console.error("Error compressing Frak context", { e, context });
|
|
211
|
+
}
|
|
212
|
+
return void 0;
|
|
213
|
+
}
|
|
214
|
+
function decompress(context) {
|
|
215
|
+
if (!context || context.length === 0) return;
|
|
216
|
+
try {
|
|
217
|
+
const bytes = base64url_decode(context);
|
|
218
|
+
return { r: _viem.bytesToHex.call(void 0, bytes, { size: 20 }) };
|
|
219
|
+
} catch (e) {
|
|
220
|
+
console.error("Error decompressing Frak context", { e, context });
|
|
221
|
+
}
|
|
222
|
+
return void 0;
|
|
223
|
+
}
|
|
224
|
+
function parse({ url }) {
|
|
192
225
|
if (!url) return null;
|
|
193
226
|
const urlObj = new URL(url);
|
|
194
|
-
const
|
|
195
|
-
if (!
|
|
196
|
-
|
|
197
|
-
if (!parsedContext) return null;
|
|
198
|
-
return parsedContext;
|
|
227
|
+
const frakContext = urlObj.searchParams.get(contextKey);
|
|
228
|
+
if (!frakContext) return null;
|
|
229
|
+
return decompress(frakContext);
|
|
199
230
|
}
|
|
200
|
-
|
|
231
|
+
function update({
|
|
201
232
|
url,
|
|
202
233
|
context
|
|
203
234
|
}) {
|
|
204
235
|
if (!url) return null;
|
|
205
|
-
const currentContext =
|
|
236
|
+
const currentContext = parse({ url });
|
|
206
237
|
const mergedContext = currentContext ? { ...currentContext, ...context } : context;
|
|
207
|
-
|
|
238
|
+
if (!mergedContext.r) return;
|
|
239
|
+
const compressedContext = compress(mergedContext);
|
|
208
240
|
if (!compressedContext) return;
|
|
209
241
|
const urlObj = new URL(url);
|
|
210
|
-
urlObj.searchParams.set(contextKey,
|
|
242
|
+
urlObj.searchParams.set(contextKey, compressedContext);
|
|
211
243
|
return urlObj.toString();
|
|
212
244
|
}
|
|
213
245
|
function remove(url) {
|
|
@@ -215,15 +247,15 @@ function remove(url) {
|
|
|
215
247
|
urlObj.searchParams.delete(contextKey);
|
|
216
248
|
return urlObj.toString();
|
|
217
249
|
}
|
|
218
|
-
|
|
250
|
+
function replaceUrl({
|
|
219
251
|
url,
|
|
220
252
|
context
|
|
221
253
|
}) {
|
|
222
|
-
if (!_optionalChain([window, 'access',
|
|
254
|
+
if (!_optionalChain([window, 'access', _12 => _12.location, 'optionalAccess', _13 => _13.href]) || typeof window === "undefined") {
|
|
223
255
|
console.error("No window found, can't update context");
|
|
224
256
|
return;
|
|
225
257
|
}
|
|
226
|
-
const newUrl =
|
|
258
|
+
const newUrl = update({
|
|
227
259
|
url,
|
|
228
260
|
context
|
|
229
261
|
});
|
|
@@ -231,6 +263,8 @@ async function replaceUrl({
|
|
|
231
263
|
window.history.replaceState(null, "", newUrl.toString());
|
|
232
264
|
}
|
|
233
265
|
var FrakContextManager = {
|
|
266
|
+
compress,
|
|
267
|
+
decompress,
|
|
234
268
|
parse,
|
|
235
269
|
update,
|
|
236
270
|
remove,
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
12
|
-
require('../../chunk-
|
|
11
|
+
var _chunkLAO7FUQ2cjs = require('../../chunk-LAO7FUQ2.cjs');
|
|
12
|
+
require('../../chunk-YDZBXUC4.cjs');
|
|
13
13
|
require('../../chunk-A3XYA7S7.cjs');
|
|
14
14
|
require('../../chunk-UFJ7W6CQ.cjs');
|
|
15
15
|
|
|
@@ -22,4 +22,4 @@ require('../../chunk-UFJ7W6CQ.cjs');
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
exports.displayModal =
|
|
25
|
+
exports.displayModal = _chunkLAO7FUQ2cjs.displayModal; exports.openSso = _chunkLAO7FUQ2cjs.openSso; exports.processReferral = _chunkLAO7FUQ2cjs.processReferral; exports.referralInteraction = _chunkLAO7FUQ2cjs.referralInteraction; exports.sendInteraction = _chunkLAO7FUQ2cjs.sendInteraction; exports.sendTransaction = _chunkLAO7FUQ2cjs.sendTransaction; exports.siweAuthenticate = _chunkLAO7FUQ2cjs.siweAuthenticate; exports.walletStatus = _chunkLAO7FUQ2cjs.walletStatus; exports.watchWalletStatus = _chunkLAO7FUQ2cjs.watchWalletStatus;
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
siweAuthenticate,
|
|
9
9
|
walletStatus,
|
|
10
10
|
watchWalletStatus
|
|
11
|
-
} from "../../chunk-
|
|
12
|
-
import "../../chunk-
|
|
11
|
+
} from "../../chunk-ACCWBBZ7.js";
|
|
12
|
+
import "../../chunk-7K4L7VQC.js";
|
|
13
13
|
import "../../chunk-TIKEZMSD.js";
|
|
14
14
|
import "../../chunk-HY6YATLS.js";
|
|
15
15
|
export {
|
package/dist/core/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk2SDBW6QCcjs = require('../chunk-2SDBW6QC.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ var _chunkES3EBWJ6cjs = require('../chunk-ES3EBWJ6.cjs');
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkYDZBXUC4cjs = require('../chunk-YDZBXUC4.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
@@ -31,4 +31,4 @@ var _chunkUFJ7W6CQcjs = require('../chunk-UFJ7W6CQ.cjs');
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
exports.Deferred =
|
|
34
|
+
exports.Deferred = _chunkYDZBXUC4cjs.Deferred; exports.FrakContextManager = _chunkYDZBXUC4cjs.FrakContextManager; exports.FrakRpcError = _chunkYDZBXUC4cjs.FrakRpcError; exports.RpcErrorCodes = _chunkYDZBXUC4cjs.RpcErrorCodes; exports.compressJson = _chunkYDZBXUC4cjs.compressJson; exports.createIFrameNexusClient = _chunk2SDBW6QCcjs.createIFrameNexusClient; exports.createIframe = _chunkYDZBXUC4cjs.createIframe; exports.decompressDataAndCheckHash = _chunkYDZBXUC4cjs.decompressDataAndCheckHash; exports.decompressJson = _chunkYDZBXUC4cjs.decompressJson; exports.hashAndCompressData = _chunkYDZBXUC4cjs.hashAndCompressData; exports.interactionTypes = _chunkUFJ7W6CQcjs.interactionTypes; exports.productTypes = _chunkUFJ7W6CQcjs.productTypes; exports.productTypesMask = _chunkUFJ7W6CQcjs.productTypesMask;
|
package/dist/core/index.d.cts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { N as NexusWalletSdkConfig, a as NexusClient } from '../client-DaEox5q4.cjs';
|
|
2
2
|
export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc, s as ExtractedReturnTypeFromRpc, n as FinalActionType, F as FinalModalStepType, q as IFrameEvent, r as IFrameLifecycleEvent, p as IFrameRpcEvent, I as IFrameRpcSchema, o as IFrameTransport, L as LoginModalStepType, b as ModalRpcMetadata, c as ModalRpcStepsInput, d as ModalRpcStepsResultType, e as ModalStepMetadata, M as ModalStepTypes, m as OpenInteractionSessionModalStepType, l as OpenInteractionSessionReturnType, O as OpenSsoParamsType, R as RpcResponse, j as SendTransactionModalStepType, k as SendTransactionReturnType, i as SendTransactionTxType, f as SiweAuthenticateModalStepType, h as SiweAuthenticateReturnType, g as SiweAuthenticationParams, S as SsoMetadata, W as WalletStatusReturnType } from '../client-DaEox5q4.cjs';
|
|
3
|
-
import { Address } from '
|
|
3
|
+
import { Address } from 'viem';
|
|
4
4
|
import { F as FrakContext } from '../FrakContext-LbQht1ep.cjs';
|
|
5
5
|
export { P as PreparedInteraction, S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-BngPoHA0.cjs';
|
|
6
6
|
export { F as FrakRpcError, R as RpcErrorCodes } from '../error-Dflr3G5x.cjs';
|
|
7
|
-
import 'viem';
|
|
8
7
|
import 'viem/chains';
|
|
9
8
|
import 'viem/siwe';
|
|
10
9
|
|
|
@@ -66,21 +65,31 @@ declare function decompressDataAndCheckHash<T>(compressedData: CompressedData):
|
|
|
66
65
|
declare function decompressJson<T>(data: string): Promise<T | null>;
|
|
67
66
|
|
|
68
67
|
/**
|
|
69
|
-
*
|
|
68
|
+
* Compress the current Frak context
|
|
69
|
+
* @param context
|
|
70
|
+
*/
|
|
71
|
+
declare function compress(context?: Partial<FrakContext>): string | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Decompress the given Frak context
|
|
74
|
+
* @param context
|
|
75
|
+
*/
|
|
76
|
+
declare function decompress(context?: string): FrakContext | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Parse the current Frak context in the given url
|
|
70
79
|
* @param url
|
|
71
80
|
*/
|
|
72
81
|
declare function parse({ url }: {
|
|
73
82
|
url: string;
|
|
74
|
-
}):
|
|
83
|
+
}): Readonly<{
|
|
75
84
|
r: Address;
|
|
76
|
-
}> | null
|
|
85
|
+
}> | null | undefined;
|
|
77
86
|
/**
|
|
78
|
-
* Populate the current url with the given
|
|
87
|
+
* Populate the current url with the given Frak context
|
|
79
88
|
*/
|
|
80
89
|
declare function update({ url, context, }: {
|
|
81
90
|
url?: string;
|
|
82
91
|
context: Partial<FrakContext>;
|
|
83
|
-
}):
|
|
92
|
+
}): string | null | undefined;
|
|
84
93
|
/**
|
|
85
94
|
* Remove Nexus context from current url
|
|
86
95
|
*/
|
|
@@ -93,11 +102,13 @@ declare function remove(url: string): string;
|
|
|
93
102
|
declare function replaceUrl({ url, context, }: {
|
|
94
103
|
url?: string;
|
|
95
104
|
context: Partial<FrakContext>;
|
|
96
|
-
}):
|
|
105
|
+
}): void;
|
|
97
106
|
/**
|
|
98
107
|
* Export our frak context "class"
|
|
99
108
|
*/
|
|
100
109
|
declare const FrakContextManager: {
|
|
110
|
+
compress: typeof compress;
|
|
111
|
+
decompress: typeof decompress;
|
|
101
112
|
parse: typeof parse;
|
|
102
113
|
update: typeof update;
|
|
103
114
|
remove: typeof remove;
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { N as NexusWalletSdkConfig, a as NexusClient } from '../client-ALy_TEwJ.js';
|
|
2
2
|
export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc, s as ExtractedReturnTypeFromRpc, n as FinalActionType, F as FinalModalStepType, q as IFrameEvent, r as IFrameLifecycleEvent, p as IFrameRpcEvent, I as IFrameRpcSchema, o as IFrameTransport, L as LoginModalStepType, b as ModalRpcMetadata, c as ModalRpcStepsInput, d as ModalRpcStepsResultType, e as ModalStepMetadata, M as ModalStepTypes, m as OpenInteractionSessionModalStepType, l as OpenInteractionSessionReturnType, O as OpenSsoParamsType, R as RpcResponse, j as SendTransactionModalStepType, k as SendTransactionReturnType, i as SendTransactionTxType, f as SiweAuthenticateModalStepType, h as SiweAuthenticateReturnType, g as SiweAuthenticationParams, S as SsoMetadata, W as WalletStatusReturnType } from '../client-ALy_TEwJ.js';
|
|
3
|
-
import { Address } from '
|
|
3
|
+
import { Address } from 'viem';
|
|
4
4
|
import { F as FrakContext } from '../FrakContext-LbQht1ep.js';
|
|
5
5
|
export { P as PreparedInteraction, S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-BngPoHA0.js';
|
|
6
6
|
export { F as FrakRpcError, R as RpcErrorCodes } from '../error-Dflr3G5x.js';
|
|
7
|
-
import 'viem';
|
|
8
7
|
import 'viem/chains';
|
|
9
8
|
import 'viem/siwe';
|
|
10
9
|
|
|
@@ -66,21 +65,31 @@ declare function decompressDataAndCheckHash<T>(compressedData: CompressedData):
|
|
|
66
65
|
declare function decompressJson<T>(data: string): Promise<T | null>;
|
|
67
66
|
|
|
68
67
|
/**
|
|
69
|
-
*
|
|
68
|
+
* Compress the current Frak context
|
|
69
|
+
* @param context
|
|
70
|
+
*/
|
|
71
|
+
declare function compress(context?: Partial<FrakContext>): string | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Decompress the given Frak context
|
|
74
|
+
* @param context
|
|
75
|
+
*/
|
|
76
|
+
declare function decompress(context?: string): FrakContext | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Parse the current Frak context in the given url
|
|
70
79
|
* @param url
|
|
71
80
|
*/
|
|
72
81
|
declare function parse({ url }: {
|
|
73
82
|
url: string;
|
|
74
|
-
}):
|
|
83
|
+
}): Readonly<{
|
|
75
84
|
r: Address;
|
|
76
|
-
}> | null
|
|
85
|
+
}> | null | undefined;
|
|
77
86
|
/**
|
|
78
|
-
* Populate the current url with the given
|
|
87
|
+
* Populate the current url with the given Frak context
|
|
79
88
|
*/
|
|
80
89
|
declare function update({ url, context, }: {
|
|
81
90
|
url?: string;
|
|
82
91
|
context: Partial<FrakContext>;
|
|
83
|
-
}):
|
|
92
|
+
}): string | null | undefined;
|
|
84
93
|
/**
|
|
85
94
|
* Remove Nexus context from current url
|
|
86
95
|
*/
|
|
@@ -93,11 +102,13 @@ declare function remove(url: string): string;
|
|
|
93
102
|
declare function replaceUrl({ url, context, }: {
|
|
94
103
|
url?: string;
|
|
95
104
|
context: Partial<FrakContext>;
|
|
96
|
-
}):
|
|
105
|
+
}): void;
|
|
97
106
|
/**
|
|
98
107
|
* Export our frak context "class"
|
|
99
108
|
*/
|
|
100
109
|
declare const FrakContextManager: {
|
|
110
|
+
compress: typeof compress;
|
|
111
|
+
decompress: typeof decompress;
|
|
101
112
|
parse: typeof parse;
|
|
102
113
|
update: typeof update;
|
|
103
114
|
remove: typeof remove;
|
package/dist/core/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createIFrameNexusClient
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-54MUKMZK.js";
|
|
4
4
|
import {
|
|
5
5
|
Deferred,
|
|
6
6
|
FrakContextManager,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
decompressDataAndCheckHash,
|
|
12
12
|
decompressJson,
|
|
13
13
|
hashAndCompressData
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-7K4L7VQC.js";
|
|
15
15
|
import {
|
|
16
16
|
interactionTypes,
|
|
17
17
|
productTypes,
|
package/dist/react/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk2SDBW6QCcjs = require('../chunk-2SDBW6QC.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -9,14 +9,14 @@ var _chunkES3EBWJ6cjs = require('../chunk-ES3EBWJ6.cjs');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkLAO7FUQ2cjs = require('../chunk-LAO7FUQ2.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkYDZBXUC4cjs = require('../chunk-YDZBXUC4.cjs');
|
|
20
20
|
require('../chunk-A3XYA7S7.cjs');
|
|
21
21
|
require('../chunk-UFJ7W6CQ.cjs');
|
|
22
22
|
|
|
@@ -50,8 +50,8 @@ function NexusConfigProvider(parameters) {
|
|
|
50
50
|
function useNexusConfig() {
|
|
51
51
|
const config = _react.useContext.call(void 0, NexusConfigContext);
|
|
52
52
|
if (!config) {
|
|
53
|
-
throw new (0,
|
|
54
|
-
|
|
53
|
+
throw new (0, _chunkYDZBXUC4cjs.FrakRpcError)(
|
|
54
|
+
_chunkYDZBXUC4cjs.RpcErrorCodes.configError,
|
|
55
55
|
"Nexus config not found"
|
|
56
56
|
);
|
|
57
57
|
}
|
|
@@ -84,9 +84,9 @@ function useWalletStatus() {
|
|
|
84
84
|
queryKey: ["nexus-sdk", "wallet-status-listener"],
|
|
85
85
|
queryFn: async () => {
|
|
86
86
|
if (!client) {
|
|
87
|
-
throw new (0,
|
|
87
|
+
throw new (0, _chunkYDZBXUC4cjs.ClientNotFound)();
|
|
88
88
|
}
|
|
89
|
-
return
|
|
89
|
+
return _chunkLAO7FUQ2cjs.walletStatus.call(void 0, client, newStatusUpdated);
|
|
90
90
|
},
|
|
91
91
|
enabled: !!client
|
|
92
92
|
});
|
|
@@ -103,9 +103,9 @@ function useSendTransactionAction({
|
|
|
103
103
|
mutationKey: ["nexus-sdk", "send-transaction"],
|
|
104
104
|
mutationFn: async (params) => {
|
|
105
105
|
if (!client) {
|
|
106
|
-
throw new (0,
|
|
106
|
+
throw new (0, _chunkYDZBXUC4cjs.ClientNotFound)();
|
|
107
107
|
}
|
|
108
|
-
return
|
|
108
|
+
return _chunkLAO7FUQ2cjs.sendTransaction.call(void 0, client, params);
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
111
|
}
|
|
@@ -125,9 +125,9 @@ function useSiweAuthenticate({
|
|
|
125
125
|
],
|
|
126
126
|
mutationFn: async (params) => {
|
|
127
127
|
if (!client) {
|
|
128
|
-
throw new (0,
|
|
128
|
+
throw new (0, _chunkYDZBXUC4cjs.ClientNotFound)();
|
|
129
129
|
}
|
|
130
|
-
return
|
|
130
|
+
return _chunkLAO7FUQ2cjs.siweAuthenticate.call(void 0, client, params);
|
|
131
131
|
}
|
|
132
132
|
});
|
|
133
133
|
}
|
|
@@ -178,28 +178,23 @@ function useWindowLocation() {
|
|
|
178
178
|
// src/react/hook/utils/useFrakContext.ts
|
|
179
179
|
function useFrakContext() {
|
|
180
180
|
const { location } = useWindowLocation();
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
enabled: !!_optionalChain([location, 'optionalAccess', _9 => _9.href])
|
|
188
|
-
});
|
|
189
|
-
const { mutate: updateContext, mutateAsync: updateContextAsync } = _reactquery.useMutation.call(void 0, {
|
|
190
|
-
mutationKey: ["nexus-sdk", "update-context"],
|
|
191
|
-
mutationFn: async (newContext) => {
|
|
181
|
+
const frakContext = _react.useMemo.call(void 0, () => {
|
|
182
|
+
if (!_optionalChain([location, 'optionalAccess', _7 => _7.href])) return null;
|
|
183
|
+
return _chunkYDZBXUC4cjs.FrakContextManager.parse({ url: location.href });
|
|
184
|
+
}, [_optionalChain([location, 'optionalAccess', _8 => _8.href])]);
|
|
185
|
+
const updateContext = _react.useCallback.call(void 0,
|
|
186
|
+
(newContext) => {
|
|
192
187
|
console.log("Updating context", { newContext });
|
|
193
|
-
|
|
194
|
-
url: _optionalChain([location, 'optionalAccess',
|
|
188
|
+
_chunkYDZBXUC4cjs.FrakContextManager.replaceUrl({
|
|
189
|
+
url: _optionalChain([location, 'optionalAccess', _9 => _9.href]),
|
|
195
190
|
context: newContext
|
|
196
191
|
});
|
|
197
|
-
}
|
|
198
|
-
|
|
192
|
+
},
|
|
193
|
+
[_optionalChain([location, 'optionalAccess', _10 => _10.href])]
|
|
194
|
+
);
|
|
199
195
|
return {
|
|
200
196
|
frakContext,
|
|
201
|
-
updateContext
|
|
202
|
-
updateContextAsync
|
|
197
|
+
updateContext
|
|
203
198
|
};
|
|
204
199
|
}
|
|
205
200
|
|
|
@@ -227,9 +222,9 @@ function useReferralInteraction({
|
|
|
227
222
|
],
|
|
228
223
|
queryFn: () => {
|
|
229
224
|
if (!client) {
|
|
230
|
-
throw new (0,
|
|
225
|
+
throw new (0, _chunkYDZBXUC4cjs.ClientNotFound)();
|
|
231
226
|
}
|
|
232
|
-
return
|
|
227
|
+
return _chunkLAO7FUQ2cjs.processReferral.call(void 0, client, {
|
|
233
228
|
walletStatus: walletStatus2,
|
|
234
229
|
frakContext,
|
|
235
230
|
modalConfig,
|
|
@@ -256,9 +251,9 @@ function useSendInteraction({
|
|
|
256
251
|
mutationKey: ["nexus-sdk", "send-interaction"],
|
|
257
252
|
mutationFn: async (params) => {
|
|
258
253
|
if (!client) {
|
|
259
|
-
throw new (0,
|
|
254
|
+
throw new (0, _chunkYDZBXUC4cjs.ClientNotFound)();
|
|
260
255
|
}
|
|
261
|
-
return
|
|
256
|
+
return _chunkLAO7FUQ2cjs.sendInteraction.call(void 0, client, params);
|
|
262
257
|
}
|
|
263
258
|
});
|
|
264
259
|
}
|
|
@@ -274,9 +269,9 @@ function useDisplayModal({
|
|
|
274
269
|
mutationKey: ["nexus-sdk", "display-modal"],
|
|
275
270
|
mutationFn: async (args) => {
|
|
276
271
|
if (!client) {
|
|
277
|
-
throw new (0,
|
|
272
|
+
throw new (0, _chunkYDZBXUC4cjs.ClientNotFound)();
|
|
278
273
|
}
|
|
279
|
-
return
|
|
274
|
+
return _chunkLAO7FUQ2cjs.displayModal.call(void 0, client, args);
|
|
280
275
|
}
|
|
281
276
|
});
|
|
282
277
|
}
|
|
@@ -290,9 +285,9 @@ function useOpenSso({ mutations } = {}) {
|
|
|
290
285
|
mutationKey: ["nexus-sdk", "open-sso"],
|
|
291
286
|
mutationFn: async (params) => {
|
|
292
287
|
if (!client) {
|
|
293
|
-
throw new (0,
|
|
288
|
+
throw new (0, _chunkYDZBXUC4cjs.ClientNotFound)();
|
|
294
289
|
}
|
|
295
|
-
return
|
|
290
|
+
return _chunkLAO7FUQ2cjs.openSso.call(void 0, client, params);
|
|
296
291
|
}
|
|
297
292
|
});
|
|
298
293
|
}
|
|
@@ -308,15 +303,15 @@ function NexusIFrameClientProvider({
|
|
|
308
303
|
const config = useNexusConfig();
|
|
309
304
|
const [client, setClient] = _react.useState.call(void 0, void 0);
|
|
310
305
|
const iFrame = _react.createElement.call(void 0, "iframe", {
|
|
311
|
-
...
|
|
306
|
+
..._chunkYDZBXUC4cjs.baseIframeProps,
|
|
312
307
|
src: `${config.walletUrl}/listener`,
|
|
313
|
-
style: _nullishCoalesce(style, () => (
|
|
308
|
+
style: _nullishCoalesce(style, () => ( _chunkYDZBXUC4cjs.baseIframeProps.style)),
|
|
314
309
|
ref: (iframe) => {
|
|
315
310
|
if (!iframe || client) {
|
|
316
311
|
return;
|
|
317
312
|
}
|
|
318
313
|
setClient(
|
|
319
|
-
|
|
314
|
+
_chunk2SDBW6QCcjs.createIFrameNexusClient.call(void 0, {
|
|
320
315
|
iframe,
|
|
321
316
|
config
|
|
322
317
|
})
|
package/dist/react/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createIFrameNexusClient
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-54MUKMZK.js";
|
|
4
4
|
import {
|
|
5
5
|
displayModal,
|
|
6
6
|
openSso,
|
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
sendTransaction,
|
|
10
10
|
siweAuthenticate,
|
|
11
11
|
walletStatus
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-ACCWBBZ7.js";
|
|
13
13
|
import {
|
|
14
14
|
ClientNotFound,
|
|
15
15
|
FrakContextManager,
|
|
16
16
|
FrakRpcError,
|
|
17
17
|
RpcErrorCodes,
|
|
18
18
|
baseIframeProps
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-7K4L7VQC.js";
|
|
20
20
|
import "../chunk-TIKEZMSD.js";
|
|
21
21
|
import "../chunk-HY6YATLS.js";
|
|
22
22
|
|
|
@@ -133,11 +133,11 @@ function useSiweAuthenticate({
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
// src/react/hook/helper/useReferralInteraction.ts
|
|
136
|
-
import { useQuery as
|
|
137
|
-
import { useMemo as
|
|
136
|
+
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
137
|
+
import { useMemo as useMemo3 } from "react";
|
|
138
138
|
|
|
139
139
|
// src/react/hook/utils/useFrakContext.ts
|
|
140
|
-
import {
|
|
140
|
+
import { useCallback as useCallback2, useMemo as useMemo2 } from "react";
|
|
141
141
|
|
|
142
142
|
// src/react/hook/utils/useWindowLocation.ts
|
|
143
143
|
import { useEffect as useEffect2, useMemo, useState as useState2 } from "react";
|
|
@@ -178,28 +178,23 @@ function useWindowLocation() {
|
|
|
178
178
|
// src/react/hook/utils/useFrakContext.ts
|
|
179
179
|
function useFrakContext() {
|
|
180
180
|
const { location } = useWindowLocation();
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
enabled: !!location?.href
|
|
188
|
-
});
|
|
189
|
-
const { mutate: updateContext, mutateAsync: updateContextAsync } = useMutation3({
|
|
190
|
-
mutationKey: ["nexus-sdk", "update-context"],
|
|
191
|
-
mutationFn: async (newContext) => {
|
|
181
|
+
const frakContext = useMemo2(() => {
|
|
182
|
+
if (!location?.href) return null;
|
|
183
|
+
return FrakContextManager.parse({ url: location.href });
|
|
184
|
+
}, [location?.href]);
|
|
185
|
+
const updateContext = useCallback2(
|
|
186
|
+
(newContext) => {
|
|
192
187
|
console.log("Updating context", { newContext });
|
|
193
|
-
|
|
188
|
+
FrakContextManager.replaceUrl({
|
|
194
189
|
url: location?.href,
|
|
195
190
|
context: newContext
|
|
196
191
|
});
|
|
197
|
-
}
|
|
198
|
-
|
|
192
|
+
},
|
|
193
|
+
[location?.href]
|
|
194
|
+
);
|
|
199
195
|
return {
|
|
200
196
|
frakContext,
|
|
201
|
-
updateContext
|
|
202
|
-
updateContextAsync
|
|
197
|
+
updateContext
|
|
203
198
|
};
|
|
204
199
|
}
|
|
205
200
|
|
|
@@ -215,7 +210,7 @@ function useReferralInteraction({
|
|
|
215
210
|
data: referralState,
|
|
216
211
|
error,
|
|
217
212
|
status
|
|
218
|
-
} =
|
|
213
|
+
} = useQuery2({
|
|
219
214
|
gcTime: 0,
|
|
220
215
|
staleTime: 0,
|
|
221
216
|
queryKey: [
|
|
@@ -238,7 +233,7 @@ function useReferralInteraction({
|
|
|
238
233
|
},
|
|
239
234
|
enabled: !!walletStatus2
|
|
240
235
|
});
|
|
241
|
-
return
|
|
236
|
+
return useMemo3(() => {
|
|
242
237
|
if (status === "pending") return "processing";
|
|
243
238
|
if (status === "error") return error;
|
|
244
239
|
return referralState || "idle";
|
|
@@ -246,12 +241,12 @@ function useReferralInteraction({
|
|
|
246
241
|
}
|
|
247
242
|
|
|
248
243
|
// src/react/hook/useSendInteraction.ts
|
|
249
|
-
import { useMutation as
|
|
244
|
+
import { useMutation as useMutation3 } from "@tanstack/react-query";
|
|
250
245
|
function useSendInteraction({
|
|
251
246
|
mutations
|
|
252
247
|
} = {}) {
|
|
253
248
|
const client = useNexusClient();
|
|
254
|
-
return
|
|
249
|
+
return useMutation3({
|
|
255
250
|
...mutations,
|
|
256
251
|
mutationKey: ["nexus-sdk", "send-interaction"],
|
|
257
252
|
mutationFn: async (params) => {
|
|
@@ -264,12 +259,12 @@ function useSendInteraction({
|
|
|
264
259
|
}
|
|
265
260
|
|
|
266
261
|
// src/react/hook/useDisplayModal.ts
|
|
267
|
-
import { useMutation as
|
|
262
|
+
import { useMutation as useMutation4 } from "@tanstack/react-query";
|
|
268
263
|
function useDisplayModal({
|
|
269
264
|
mutations
|
|
270
265
|
} = {}) {
|
|
271
266
|
const client = useNexusClient();
|
|
272
|
-
return
|
|
267
|
+
return useMutation4({
|
|
273
268
|
...mutations,
|
|
274
269
|
mutationKey: ["nexus-sdk", "display-modal"],
|
|
275
270
|
mutationFn: async (args) => {
|
|
@@ -282,10 +277,10 @@ function useDisplayModal({
|
|
|
282
277
|
}
|
|
283
278
|
|
|
284
279
|
// src/react/hook/useOpenSso.ts
|
|
285
|
-
import { useMutation as
|
|
280
|
+
import { useMutation as useMutation5 } from "@tanstack/react-query";
|
|
286
281
|
function useOpenSso({ mutations } = {}) {
|
|
287
282
|
const client = useNexusClient();
|
|
288
|
-
return
|
|
283
|
+
return useMutation5({
|
|
289
284
|
...mutations,
|
|
290
285
|
mutationKey: ["nexus-sdk", "open-sso"],
|
|
291
286
|
mutationFn: async (params) => {
|
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.19",
|
|
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",
|