polkadot-api 1.9.13 → 1.10.1
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/bin/cli.mjs +1 -1
- package/dist/esm/client.mjs +1 -0
- package/dist/esm/client.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/storage.mjs +7 -8
- package/dist/esm/storage.mjs.map +1 -1
- package/dist/esm/tx/create-tx.mjs +54 -5
- package/dist/esm/tx/create-tx.mjs.map +1 -1
- package/dist/esm/tx/submit-fns.mjs +1 -1
- package/dist/esm/tx/submit-fns.mjs.map +1 -1
- package/dist/esm/typed-codecs/typed-codecs.mjs +52 -0
- package/dist/esm/typed-codecs/typed-codecs.mjs.map +1 -0
- package/dist/index.d.ts +80 -2
- package/dist/index.js +108 -11
- package/dist/index.js.map +1 -1
- package/dist/umd/index.min.js +3 -3
- package/dist/umd/ink.min.js +1 -1
- package/dist/umd/pjs-signer.min.js +1 -1
- package/dist/umd/signer.min.js +1 -1
- package/package.json +16 -16
package/dist/umd/ink.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(we,me){typeof exports=="object"&&typeof module<"u"?me(exports):typeof define=="function"&&define.amd?define(["exports"],me):(we=typeof globalThis<"u"?globalThis:we||self,me(we.papiInk={}))})(this,function(we){"use strict";const me=(e,t)=>e.type==="array"&&e.len===t&&e.value.type==="primitive"&&e.value.value==="u8",ue={type:"void"},Xn=(e,t=()=>null)=>{const n=new Map,r=new Set,s=l=>d=>{let h=n.get(d);if(h)return h;if(r.has(d)){const y={id:d};return n.set(d,y),y}r.add(d);const u=l(d);return h=n.get(d),h?Object.assign(h,u):(h={id:d,...u},n.set(d,h)),r.delete(d),h};let o=!0,c=!0;const i=s(l=>{const d=t(e[l]);if(d)return d;const{def:h,path:u,params:y}=e[l];if(h.tag==="composite"){if(h.value.length===0)return ue;if(h.value.length===1){const p=i(h.value[0].type);return o&&u.at(-1)==="AccountId32"&&me(p,32)?(o=!1,{type:"AccountId32"}):c&&u.at(-1)==="AccountId20"&&me(p,20)?(c=!1,{type:"AccountId20"}):p}return f(h.value)}if(h.tag==="variant"){if(u.length===1&&u[0]==="Option"&&y.length===1&&y[0].name==="T"){const E=i(y[0].type);return E.type==="void"?{type:"primitive",value:"bool"}:{type:"option",value:E}}if(u.length===1&&u[0]==="Result"&&y.length===2&&y[0].name==="T"&&y[1].name==="E")return{type:"result",value:{ok:i(y[0].type),ko:i(y[1].type)}};if(h.value.length===0)return ue;const p={},b={};return h.value.forEach(E=>{const O=E.name;if(b[O]=E.docs,E.fields.length===0){p[O]={...ue,idx:E.index};return}if(E.fields.length===1&&!E.fields[0].name){p[O]={type:"lookupEntry",value:i(E.fields[0].type),idx:E.index};return}p[O]={...f(E.fields),idx:E.index}}),{type:"enum",value:p,innerDocs:b}}if(h.tag==="sequence")return{type:"sequence",value:i(h.value)};if(h.tag==="array"){const{len:p}=h.value,b=i(h.value.type);return!p||b.type==="void"?ue:p>1?{type:"array",value:b,len:h.value.len}:b}if(h.tag==="tuple")return h.value.length===0?ue:h.value.length>1?a(h.value.map(p=>i(p)),h.value.map(p=>e[p].docs)):i(h.value[0]);if(h.tag==="primitive")return{type:"primitive",value:h.value.tag};if(h.tag==="compact"){const p=i(h.value);return p.type==="void"?ue:{type:"compact",isBig:Number(p.value.slice(1))>32,size:p.value}}return{type:h.tag}}),f=l=>{let d=!0;const h={},u={};return l.forEach((y,p)=>{d=d&&!!y.name;const b=y.name||p,E=i(y.type);E.type!=="void"&&(h[b]=E,u[b]=y.docs)}),d?{type:"struct",value:h,innerDocs:u}:a(Object.values(h),Object.values(u))},a=(l,d)=>{if(l.every(h=>h.id===l[0].id)&&d.every(h=>!h.length)){const[h]=l;return h.type==="void"?ue:{type:"array",value:l[0],len:l.length}}return{type:"tuple",value:l,innerDocs:d}};return i},zn=e=>Xn(e);var Fn=Object.defineProperty,Yn=(e,t,n)=>t in e?Fn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ft=(e,t,n)=>(Yn(e,typeof t!="symbol"?t+"":t,n),n),Fe={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function Wn(e){const t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,s=new Uint8Array(r);t&&(s[0]=0|Fe[e[2]]);for(let o=0;o<r;){const c=n+o*2,i=Fe[e[c]],f=Fe[e[c+1]];s[t+o++]=i<<4|f}return s}var yt=class extends Uint8Array{constructor(e){super(e),ft(this,"i",0),ft(this,"v"),this.v=new DataView(e)}},K=e=>t=>e(t instanceof yt?t:new yt(t instanceof Uint8Array?t.buffer:typeof t=="string"?Wn(t).buffer:t)),z=e=>{const t=e.length;let n=0;for(let s=0;s<t;s++)n+=e[s].length;const r=new Uint8Array(n);for(let s=0,o=0;s<t;s++){const c=e[s];r.set(c,o),o+=c.byteLength}return r};function Te(e,t){const n=Object.keys(e),r=n.length,s={};for(let o=0;o<r;o++){const c=n[o];s[c]=t(e[c],c)}return s}var Ye=K,x=(e,t)=>{const n=[e,t];return n.enc=e,n.dec=t,n},We=(e,t)=>n=>e(t(n)),Ge=(e,t)=>n=>t(e(n)),N=([e,t],n,r)=>x(We(e,n),Ge(t,r));function Gn(e,t){return K(n=>{const r=n.v[t](n.i,!0);return n.i+=e,r})}function Jn(e,t){return n=>{const r=new Uint8Array(e);return new DataView(r.buffer)[t](0,n,!0),r}}function ne(e,t,n){return x(Jn(e,n),Gn(e,t))}var U=ne(1,"getUint8","setUint8"),ve=ne(2,"getUint16","setUint16"),re=ne(4,"getUint32","setUint32"),Se=ne(8,"getBigUint64","setBigUint64"),Qn=ne(1,"getInt8","setInt8"),Zn=ne(2,"getInt16","setInt16"),er=ne(4,"getInt32","setInt32"),tr=ne(8,"getBigInt64","setBigInt64"),pt=e=>{const t=new Uint8Array(16),n=new DataView(t.buffer);return n.setBigInt64(0,e,!0),n.setBigInt64(8,e>>64n,!0),t},gt=e=>K(t=>{const{v:n,i:r}=t,s=n.getBigUint64(r,!0),o=n[e](r+8,!0);return t.i+=16,o<<64n|s}),nr=x(pt,gt("getBigUint64")),rr=x(pt,gt("getBigInt64")),bt=e=>{const t=new Uint8Array(32),n=new DataView(t.buffer);return n.setBigInt64(0,e,!0),n.setBigInt64(8,e>>64n,!0),n.setBigInt64(16,e>>128n,!0),n.setBigInt64(24,e>>192n,!0),t},mt=e=>K(t=>{let n=t.v.getBigUint64(t.i,!0);return t.i+=8,n|=t.v.getBigUint64(t.i,!0)<<64n,t.i+=8,n|=t.v.getBigUint64(t.i,!0)<<128n,t.i+=8,n|=t.v[e](t.i,!0)<<192n,t.i+=8,n}),sr=x(bt,mt("getBigUint64")),or=x(bt,mt("getBigInt64")),cr=N(U,e=>e?1:0,Boolean),ir=[U[1],ve[1],re[1]],ar=K(e=>{const t=e[e.i],n=t&3;if(n<3)return ir[n](e)>>>2;const r=(t>>>2)+4;e.i++;let s=0n;const o=r/8|0;let c=0n;for(let f=0;f<o;f++)s=Se[1](e)<<c|s,c+=64n;let i=r%8;return i>3&&(s=BigInt(re[1](e))<<c|s,c+=32n,i-=4),i>1&&(s=BigInt(ve[1](e))<<c|s,c+=16n,i-=2),i&&(s=BigInt(U[1](e))<<c|s),s}),lr=1n<<56n,ur=1<<24,hr=256,dr=4294967295n,fr=64,yr=16384,pr=1<<30,gr=e=>{if(e<0)throw new Error(`Wrong compact input (${e})`);const t=Number(e)<<2;if(e<fr)return U[0](t);if(e<yr)return ve[0](t|1);if(e<pr)return re[0](t|2);let n=[new Uint8Array(1)],r=BigInt(e);for(;r>=lr;)n.push(Se[0](r)),r>>=64n;r>=ur&&(n.push(re[0](Number(r&dr))),r>>=32n);let s=Number(r);s>=hr&&(n.push(ve[0](s)),s>>=16),s&&n.push(U[0](s));const o=z(n);return o[0]=o.length-5<<2|3,o},R=x(gr,ar),br=new TextEncoder,mr=e=>{const t=br.encode(e);return z([R.enc(t.length),t])},vr=new TextDecoder,wr=K(e=>{let t=R.dec(e);const n=new DataView(e.buffer,e.i,t);return e.i+=t,vr.decode(n)}),B=x(mr,wr),Er=()=>{},kr=new Uint8Array(0),v=x(()=>kr,Er),vt=e=>e===void 0?t=>z([R.enc(t.length),t]):t=>t.length===e?t:t.slice(0,e),wt=e=>K(t=>{const n=e===void 0?R.dec(t):e!==1/0?e:t.byteLength-t.i,r=new Uint8Array(t.buffer.slice(t.i,t.i+n));return t.i+=n,r}),S=e=>x(vt(e),wt(e));S.enc=vt,S.dec=wt;var Et=(e,t)=>{const n=Object.keys(e),r=new Map(t?.map((o,c)=>[n[c],o])??n.map((o,c)=>[o,c])),s=o=>r.get(o);return({tag:o,value:c})=>z([U.enc(s(o)),e[o](c)])},kt=(e,t)=>{const n=Object.keys(e),r=new Map(t?.map((s,o)=>[s,n[o]])??n.map((s,o)=>[o,s]));return K(s=>{const o=U.dec(s),c=r.get(o),i=e[c];return{tag:c,value:i(s)}})},X=(e,...t)=>x(Et(Te(e,([n])=>n),...t),kt(Te(e,([,n])=>n),...t));X.enc=Et,X.dec=kt;var xt=e=>K(t=>U[1](t)>0?e(t):void 0),It=e=>t=>{const n=new Uint8Array(1);return t===void 0?n:(n[0]=1,z([n,e(t)]))},j=e=>x(It(e[0]),xt(e[1]));j.enc=It,j.dec=xt;var At=(e,t)=>K(n=>{const r=U[1](n)===0,o=(r?e:t)(n);return{success:r,value:o}}),Bt=(e,t)=>({success:n,value:r})=>z([U[0](n?0:1),(n?e:t)(r)]),De=(e,t)=>x(Bt(e[0],t[0]),At(e[1],t[1]));De.dec=At,De.enc=Bt;var _t=(...e)=>K(t=>e.map(n=>n(t))),Ot=(...e)=>t=>z(e.map((n,r)=>n(t[r]))),F=(...e)=>x(Ot(...e.map(([t])=>t)),_t(...e.map(([,t])=>t)));F.enc=Ot,F.dec=_t;var Ut=e=>{const t=Object.keys(e);return We(F.enc(...Object.values(e)),n=>t.map(r=>n[r]))},Lt=e=>{const t=Object.keys(e);return Ge(F.dec(...Object.values(e)),n=>Object.fromEntries(n.map((r,s)=>[t[s],r])))},w=e=>x(Ut(Te(e,t=>t[0])),Lt(Te(e,t=>t[1])));w.enc=Ut,w.dec=Lt;var Tt=(e,t)=>t>=0?n=>z(n.map(e)):n=>z([R.enc(n.length),z(n.map(e))]),St=(e,t)=>K(n=>{const r=t>=0?t:R.dec(n),s=new Array(r);for(let o=0;o<r;o++)s[o]=e(n);return s}),I=(e,t)=>x(Tt(e[0],t),St(e[1],t));I.enc=Tt,I.dec=St;/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function xr(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Dt(e,t){return Array.isArray(t)?t.length===0?!0:e?t.every(n=>typeof n=="string"):t.every(n=>Number.isSafeInteger(n)):!1}function Je(e,t){if(typeof t!="string")throw new Error(`${e}: string expected`);return!0}function Ct(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function Qe(e){if(!Array.isArray(e))throw new Error("array expected")}function Ht(e,t){if(!Dt(!0,t))throw new Error(`${e}: array of strings expected`)}function Ir(e,t){if(!Dt(!1,t))throw new Error(`${e}: array of numbers expected`)}function Ar(...e){const t=o=>o,n=(o,c)=>i=>o(c(i)),r=e.map(o=>o.encode).reduceRight(n,t),s=e.map(o=>o.decode).reduce(n,t);return{encode:r,decode:s}}function Br(e){const t=typeof e=="string"?e.split(""):e,n=t.length;Ht("alphabet",t);const r=new Map(t.map((s,o)=>[s,o]));return{encode:s=>(Qe(s),s.map(o=>{if(!Number.isSafeInteger(o)||o<0||o>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${o}". Allowed: ${e}`);return t[o]})),decode:s=>(Qe(s),s.map(o=>{Je("alphabet.decode",o);const c=r.get(o);if(c===void 0)throw new Error(`Unknown letter: "${o}". Allowed: ${e}`);return c}))}}function _r(e=""){return Je("join",e),{encode:t=>(Ht("join.decode",t),t.join(e)),decode:t=>(Je("join.decode",t),t.split(e))}}function $t(e,t,n){if(t<2)throw new Error(`convertRadix: invalid from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: invalid to=${n}, base cannot be less than 2`);if(Qe(e),!e.length)return[];let r=0;const s=[],o=Array.from(e,i=>{if(Ct(i),i<0||i>=t)throw new Error(`invalid integer: ${i}`);return i}),c=o.length;for(;;){let i=0,f=!0;for(let a=r;a<c;a++){const l=o[a],d=t*i,h=d+l;if(!Number.isSafeInteger(h)||d/t!==i||h-l!==d)throw new Error("convertRadix: carry overflow");const u=h/n;i=h%n;const y=Math.floor(u);if(o[a]=y,!Number.isSafeInteger(y)||y*n+i!==h)throw new Error("convertRadix: carry overflow");if(f)y?f=!1:r=a;else continue}if(s.push(i),f)break}for(let i=0;i<e.length-1&&e[i]===0;i++)s.push(0);return s.reverse()}function Or(e){Ct(e);const t=2**8;return{encode:n=>{if(!xr(n))throw new Error("radix.encode input should be Uint8Array");return $t(Array.from(n),t,e)},decode:n=>(Ir("radix.decode",n),Uint8Array.from($t(n,e,t)))}}const Vt=(e=>Ar(Or(58),Br(e),_r("")))("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function he(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Ur(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Ce(e,...t){if(!Ur(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Ee(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 Ze(e,t){Ce(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Lr(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function de(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function He(e,t){return e<<32-t|e>>>t}const C=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Mt(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const Y=C?e=>e:e=>Mt(e);function H(e){for(let t=0;t<e.length;t++)e[t]=Mt(e[t])}function Tr(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function W(e){return typeof e=="string"&&(e=Tr(e)),Ce(e),e}class Nt{clone(){return this._cloneInto()}}function Sr(e){const t=r=>e().update(W(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Dr(e){const t=(r,s)=>e(s).update(W(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}function Cr(e){const t=(r,s)=>e(s).update(W(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}const Hr=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]);class Rt extends Nt{constructor(t,n,r={},s,o,c){if(super(),this.blockLen=t,this.outputLen=n,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,he(t),he(n),he(s),n<0||n>s)throw new Error("outputLen bigger than keyLen");if(r.key!==void 0&&(r.key.length<1||r.key.length>s))throw new Error("key length must be undefined or 1.."+s);if(r.salt!==void 0&&r.salt.length!==o)throw new Error("salt must be undefined or "+o);if(r.personalization!==void 0&&r.personalization.length!==c)throw new Error("personalization must be undefined or "+c);this.buffer=new Uint8Array(t),this.buffer32=de(this.buffer)}update(t){Ee(this);const{blockLen:n,buffer:r,buffer32:s}=this;t=W(t);const o=t.length,c=t.byteOffset,i=t.buffer;for(let f=0;f<o;){this.pos===n&&(C||H(s),this.compress(s,0,!1),C||H(s),this.pos=0);const a=Math.min(n-this.pos,o-f),l=c+f;if(a===n&&!(l%4)&&f+a<o){const d=new Uint32Array(i,l,Math.floor((o-f)/4));C||H(d);for(let h=0;f+n<o;h+=s.length,f+=n)this.length+=n,this.compress(d,h,!1);C||H(d);continue}r.set(t.subarray(f,f+a),this.pos),this.pos+=a,this.length+=a,f+=a}return this}digestInto(t){Ee(this),Ze(t,this);const{pos:n,buffer32:r}=this;this.finished=!0,this.buffer.subarray(n).fill(0),C||H(r),this.compress(r,0,!0),C||H(r);const s=de(t);this.get().forEach((o,c)=>s[c]=Y(o))}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){const{buffer:n,length:r,finished:s,destroyed:o,outputLen:c,pos:i}=this;return t||(t=new this.constructor({dkLen:c})),t.set(...this.get()),t.length=r,t.finished=s,t.destroyed=o,t.outputLen=c,t.buffer.set(n),t.pos=i,t}}const $e=BigInt(2**32-1),et=BigInt(32);function Ve(e,t=!1){return t?{h:Number(e&$e),l:Number(e>>et&$e)}:{h:Number(e>>et&$e)|0,l:Number(e&$e)|0}}function jt(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let s=0;s<e.length;s++){const{h:o,l:c}=Ve(e[s],t);[n[s],r[s]]=[o,c]}return[n,r]}const $r=(e,t)=>BigInt(e>>>0)<<et|BigInt(t>>>0),Vr=(e,t,n)=>e>>>n,Mr=(e,t,n)=>e<<32-n|t>>>n,Nr=(e,t,n)=>e>>>n|t<<32-n,Rr=(e,t,n)=>e<<32-n|t>>>n,jr=(e,t,n)=>e<<64-n|t>>>n-32,Pr=(e,t,n)=>e>>>n-32|t<<64-n,Kr=(e,t)=>t,qr=(e,t)=>e,Pt=(e,t,n)=>e<<n|t>>>32-n,Kt=(e,t,n)=>t<<n|e>>>32-n,qt=(e,t,n)=>t<<n-32|e>>>64-n,Xt=(e,t,n)=>e<<n-32|t>>>64-n;function Xr(e,t,n,r){const s=(t>>>0)+(r>>>0);return{h:e+n+(s/2**32|0)|0,l:s|0}}const $={fromBig:Ve,split:jt,toBig:$r,shrSH:Vr,shrSL:Mr,rotrSH:Nr,rotrSL:Rr,rotrBH:jr,rotrBL:Pr,rotr32H:Kr,rotr32L:qr,rotlSH:Pt,rotlSL:Kt,rotlBH:qt,rotlBL:Xt,add:Xr,add3L:(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),add3H:(e,t,n,r)=>t+n+r+(e/2**32|0)|0,add4L:(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),add4H:(e,t,n,r,s)=>t+n+r+s+(e/2**32|0)|0,add5H:(e,t,n,r,s,o)=>t+n+r+s+o+(e/2**32|0)|0,add5L:(e,t,n,r,s)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(s>>>0)},_=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),g=new Uint32Array(32);function se(e,t,n,r,s,o){const c=s[o],i=s[o+1];let f=g[2*e],a=g[2*e+1],l=g[2*t],d=g[2*t+1],h=g[2*n],u=g[2*n+1],y=g[2*r],p=g[2*r+1],b=$.add3L(f,l,c);a=$.add3H(b,a,d,i),f=b|0,{Dh:p,Dl:y}={Dh:p^a,Dl:y^f},{Dh:p,Dl:y}={Dh:$.rotr32H(p,y),Dl:$.rotr32L(p,y)},{h:u,l:h}=$.add(u,h,p,y),{Bh:d,Bl:l}={Bh:d^u,Bl:l^h},{Bh:d,Bl:l}={Bh:$.rotrSH(d,l,24),Bl:$.rotrSL(d,l,24)},g[2*e]=f,g[2*e+1]=a,g[2*t]=l,g[2*t+1]=d,g[2*n]=h,g[2*n+1]=u,g[2*r]=y,g[2*r+1]=p}function oe(e,t,n,r,s,o){const c=s[o],i=s[o+1];let f=g[2*e],a=g[2*e+1],l=g[2*t],d=g[2*t+1],h=g[2*n],u=g[2*n+1],y=g[2*r],p=g[2*r+1],b=$.add3L(f,l,c);a=$.add3H(b,a,d,i),f=b|0,{Dh:p,Dl:y}={Dh:p^a,Dl:y^f},{Dh:p,Dl:y}={Dh:$.rotrSH(p,y,16),Dl:$.rotrSL(p,y,16)},{h:u,l:h}=$.add(u,h,p,y),{Bh:d,Bl:l}={Bh:d^u,Bl:l^h},{Bh:d,Bl:l}={Bh:$.rotrBH(d,l,63),Bl:$.rotrBL(d,l,63)},g[2*e]=f,g[2*e+1]=a,g[2*t]=l,g[2*t+1]=d,g[2*n]=h,g[2*n+1]=u,g[2*r]=y,g[2*r+1]=p}class zr extends Rt{constructor(t={}){super(128,t.dkLen===void 0?64:t.dkLen,t,64,16,16),this.v0l=_[0]|0,this.v0h=_[1]|0,this.v1l=_[2]|0,this.v1h=_[3]|0,this.v2l=_[4]|0,this.v2h=_[5]|0,this.v3l=_[6]|0,this.v3h=_[7]|0,this.v4l=_[8]|0,this.v4h=_[9]|0,this.v5l=_[10]|0,this.v5h=_[11]|0,this.v6l=_[12]|0,this.v6h=_[13]|0,this.v7l=_[14]|0,this.v7h=_[15]|0;const n=t.key?t.key.length:0;if(this.v0l^=this.outputLen|n<<8|65536|1<<24,t.salt){const r=de(W(t.salt));this.v4l^=Y(r[0]),this.v4h^=Y(r[1]),this.v5l^=Y(r[2]),this.v5h^=Y(r[3])}if(t.personalization){const r=de(W(t.personalization));this.v6l^=Y(r[0]),this.v6h^=Y(r[1]),this.v7l^=Y(r[2]),this.v7h^=Y(r[3])}if(t.key){const r=new Uint8Array(this.blockLen);r.set(W(t.key)),this.update(r)}}get(){let{v0l:t,v0h:n,v1l:r,v1h:s,v2l:o,v2h:c,v3l:i,v3h:f,v4l:a,v4h:l,v5l:d,v5h:h,v6l:u,v6h:y,v7l:p,v7h:b}=this;return[t,n,r,s,o,c,i,f,a,l,d,h,u,y,p,b]}set(t,n,r,s,o,c,i,f,a,l,d,h,u,y,p,b){this.v0l=t|0,this.v0h=n|0,this.v1l=r|0,this.v1h=s|0,this.v2l=o|0,this.v2h=c|0,this.v3l=i|0,this.v3h=f|0,this.v4l=a|0,this.v4h=l|0,this.v5l=d|0,this.v5h=h|0,this.v6l=u|0,this.v6h=y|0,this.v7l=p|0,this.v7h=b|0}compress(t,n,r){this.get().forEach((f,a)=>g[a]=f),g.set(_,16);let{h:s,l:o}=$.fromBig(BigInt(this.length));g[24]=_[8]^o,g[25]=_[9]^s,r&&(g[28]=~g[28],g[29]=~g[29]);let c=0;const i=Hr;for(let f=0;f<12;f++)se(0,4,8,12,t,n+2*i[c++]),oe(0,4,8,12,t,n+2*i[c++]),se(1,5,9,13,t,n+2*i[c++]),oe(1,5,9,13,t,n+2*i[c++]),se(2,6,10,14,t,n+2*i[c++]),oe(2,6,10,14,t,n+2*i[c++]),se(3,7,11,15,t,n+2*i[c++]),oe(3,7,11,15,t,n+2*i[c++]),se(0,5,10,15,t,n+2*i[c++]),oe(0,5,10,15,t,n+2*i[c++]),se(1,6,11,12,t,n+2*i[c++]),oe(1,6,11,12,t,n+2*i[c++]),se(2,7,8,13,t,n+2*i[c++]),oe(2,7,8,13,t,n+2*i[c++]),se(3,4,9,14,t,n+2*i[c++]),oe(3,4,9,14,t,n+2*i[c++]);this.v0l^=g[0]^g[16],this.v0h^=g[1]^g[17],this.v1l^=g[2]^g[18],this.v1h^=g[3]^g[19],this.v2l^=g[4]^g[20],this.v2h^=g[5]^g[21],this.v3l^=g[6]^g[22],this.v3h^=g[7]^g[23],this.v4l^=g[8]^g[24],this.v4h^=g[9]^g[25],this.v5l^=g[10]^g[26],this.v5h^=g[11]^g[27],this.v6l^=g[12]^g[28],this.v6h^=g[13]^g[29],this.v7l^=g[14]^g[30],this.v7h^=g[15]^g[31],g.fill(0)}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Me=Dr(e=>new zr(e)),zt=new TextEncoder().encode("SS58PRE"),tt=2,Ft=e=>{try{const t=Vt.decode(e),n=t.subarray(0,t[0]&64?2:1),r=t.subarray(n.length,t.length-tt),s=t.subarray(n.length+r.length),o=Me(Uint8Array.of(...zt,...n,...r),{dkLen:64}).subarray(0,tt);return s[0]===o[0]&&s[1]===o[1]?{isValid:!0,ss58Format:Fr(n),publicKey:r.slice()}:{isValid:!1}}catch{return{isValid:!1}}},Fr=e=>{const t=new DataView(e.buffer,e.byteOffset,e.byteLength);return t.byteLength===1?t.getUint8(0):t.getUint16(0)},Yt=e=>{const t=e<64?Uint8Array.of(e):Uint8Array.of((e&252)>>2|64,e>>8|(e&3)<<6);return n=>{const r=Me(Uint8Array.of(...zt,...t,...n),{dkLen:64}).subarray(0,tt);return Vt.encode(Uint8Array.of(...t,...n,...r))}};function Yr(e,t){return n=>{const r=Ft(n);if(!r.isValid)throw new Error("Invalid checksum");const{publicKey:s}=r;if(s.length!==e)throw new Error("Invalid public key length");return s}}const nt=(e=42,t=32)=>N(S(t),Yr(t),Yt(e)),Wt="0123456789abcdef";function G(e){const t=new Array(e.length+1);t[0]="0x";for(let n=0;n<e.length;){const r=e[n++];t[n]=Wt[r>>4]+Wt[r&15]}return t.join("")}const rt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function ke(e){const t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,s=new Uint8Array(r);t&&(s[0]=0|rt[e[2]]);for(let o=0;o<r;){const c=n+o*2,i=rt[e[c]],f=rt[e[c+1]];s[t+o++]=i<<4|f}return s}function Gt(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,t(r,n)]))}const fe=(...e)=>{const t=e.reduce((r,s)=>r+s.byteLength,0),n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const o=e[r];n.set(o,s),s+=o.byteLength}return n};var Wr=Object.defineProperty,Jt=e=>{throw TypeError(e)},Gr=(e,t,n)=>t in e?Wr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xe=(e,t,n)=>Gr(e,typeof t!="symbol"?t+"":t,n),Qt=(e,t,n)=>t.has(e)||Jt("Cannot "+n),J=(e,t,n)=>(Qt(e,t,"read from private field"),n?n.call(e):t.get(e)),Ie=(e,t,n)=>t.has(e)?Jt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ye=(e,t,n,r)=>(Qt(e,t,"write to private field"),t.set(e,n),n),Q,Ae,Ne,Re,je;const Jr=new TextEncoder,Qr=new TextDecoder,Zr=F(R,S(1/0))[1];class Z{constructor(t,n=!1){if(Ie(this,Q),Ie(this,Ae,null),Ie(this,Ne,null),Ie(this,Re,null),Ie(this,je,null),xe(this,"asText",()=>J(this,je)??ye(this,je,Qr.decode(J(this,Q)))),xe(this,"asHex",()=>J(this,Ne)||ye(this,Ne,G(J(this,Q)))),xe(this,"asOpaqueHex",()=>J(this,Re)||ye(this,Re,G(this.asBytes()))),xe(this,"asBytes",()=>J(this,Q)),xe(this,"asOpaqueBytes",()=>J(this,Ae)||ye(this,Ae,fe(R[0](J(this,Q).length),J(this,Q)))),n){try{const[r,s]=Zr(t);if(r===s.length){ye(this,Q,s),ye(this,Ae,t);return}}catch{}throw new Error("Invalid opaque bytes")}else ye(this,Q,t)}static fromText(t){return new this(Jr.encode(t))}static fromHex(t){return new this(ke(t))}static fromOpaqueHex(t){return new this(ke(t),!0)}static fromBytes(t){return new this(t)}static fromOpaqueBytes(t){return new this(t,!0)}}Q=new WeakMap,Ae=new WeakMap,Ne=new WeakMap,Re=new WeakMap,je=new WeakMap;const[es]=nt();class Zt extends Z{constructor(t){super(t)}static fromArray(t){return new this(new Uint8Array(t))}static fromAccountId32(t){return new this(es(t))}}const en=e=>{const t=S.enc(e);return n=>t(n.asBytes())},tn=e=>{const t=S.dec(e),n=e==null?Z:Zt;return r=>n.fromBytes(t(r))},Be=e=>x(en(e),tn(e));Be.enc=en,Be.dec=tn;const m=N(R,e=>e,Number),nn=N(R,e=>e,BigInt),ts=Ye(e=>{const t=m.dec(e),n=Math.ceil(t/8);return{bytes:S(n).dec(e),bitsLen:t}}),rn=x(e=>{if(e.bitsLen>e.bytes.length*8)throw new Error(`Not enough bytes. (bitsLen:${e.bitsLen}, bytesLen:${e.bytes.length})`);const t=m.enc(e.bitsLen),n=new Uint8Array(e.bytes.length+t.length);return n.set(t,0),n.set(e.bytes,t.length),n},ts),ns=N(U,e=>e.charCodeAt(0),String.fromCharCode),sn=e=>{const t=S.enc(e);return n=>t(ke(n))},on=e=>{const t=S.dec(e);return n=>G(t(n))},ce=e=>x(sn(e),on(e));ce.enc=sn,ce.dec=on;const rs=new TextEncoder,ss=new TextDecoder,os=e=>N(S(e),t=>rs.encode(t),t=>ss.decode(t)),cn=e=>{let t=n=>{const r=e();return t=r,r(n)};return n=>t(n)},an=e=>{let t=n=>{const r=e(),s=r;return t=r,s(n)};return n=>t(n)},ln=e=>x(cn(()=>e().enc),an(()=>e().dec)),st=Object.assign((e,t)=>({type:e,value:t}),{is(e,t){return e.type===t},as(e,t){if(t!==e.type)throw new Error(`Enum.as(enum, ${t}) used with actual type ${e.type}`);return e}}),cs=new Proxy({},{get(e,t){return n=>st(t,n)}}),un=(...e)=>{const t=X.enc(...e);return n=>t({tag:n.type,value:n.value})},hn=(...e)=>{const t=X.dec(...e);return n=>{const{tag:r,value:s}=t(n);return st(r,s)}},pe=(e,...t)=>x(un(Gt(e,([n])=>n),...t),hn(Gt(e,([,n])=>n),...t));pe.enc=un,pe.dec=hn;const dn=[],fn=[],yn=[],is=BigInt(0),_e=BigInt(1),as=BigInt(2),ls=BigInt(7),us=BigInt(256),hs=BigInt(113);for(let e=0,t=_e,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],dn.push(2*(5*r+n)),fn.push((e+1)*(e+2)/2%64);let s=is;for(let o=0;o<7;o++)t=(t<<_e^(t>>ls)*hs)%us,t&as&&(s^=_e<<(_e<<BigInt(o))-_e);yn.push(s)}const[ds,fs]=jt(yn,!0),pn=(e,t,n)=>n>32?qt(e,t,n):Pt(e,t,n),gn=(e,t,n)=>n>32?Xt(e,t,n):Kt(e,t,n);function ys(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let c=0;c<10;c++)n[c]=e[c]^e[c+10]^e[c+20]^e[c+30]^e[c+40];for(let c=0;c<10;c+=2){const i=(c+8)%10,f=(c+2)%10,a=n[f],l=n[f+1],d=pn(a,l,1)^n[i],h=gn(a,l,1)^n[i+1];for(let u=0;u<50;u+=10)e[c+u]^=d,e[c+u+1]^=h}let s=e[2],o=e[3];for(let c=0;c<24;c++){const i=fn[c],f=pn(s,o,i),a=gn(s,o,i),l=dn[c];s=e[l],o=e[l+1],e[l]=f,e[l+1]=a}for(let c=0;c<50;c+=10){for(let i=0;i<10;i++)n[i]=e[c+i];for(let i=0;i<10;i++)e[c+i]^=~n[(i+2)%10]&n[(i+4)%10]}e[0]^=ds[r],e[1]^=fs[r]}n.fill(0)}class ot extends Nt{constructor(t,n,r,s=!1,o=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,he(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=de(this.state)}keccak(){C||H(this.state32),ys(this.state32,this.rounds),C||H(this.state32),this.posOut=0,this.pos=0}update(t){Ee(this);const{blockLen:n,state:r}=this;t=W(t);const s=t.length;for(let o=0;o<s;){const c=Math.min(n-this.pos,s-o);for(let i=0;i<c;i++)r[this.pos++]^=t[o++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:s}=this;t[r]^=n,(n&128)!==0&&r===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){Ee(this,!1),Ce(t),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,o=t.length;s<o;){this.posOut>=r&&this.keccak();const c=Math.min(r-this.posOut,o-s);t.set(n.subarray(this.posOut,this.posOut+c),s),this.posOut+=c,s+=c}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return he(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Ze(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){const{blockLen:n,suffix:r,outputLen:s,rounds:o,enableXOF:c}=this;return t||(t=new ot(n,r,s,c,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=r,t.outputLen=s,t.enableXOF=c,t.destroyed=this.destroyed,t}}const ps=((e,t,n)=>Sr(()=>new ot(t,e,n)))(1,136,256/8),bn=e=>{const t=e.slice(2),n=G(ps(t)).slice(2),r=new Array(40);for(let s=0;s<40;s++){const o=parseInt(n[s],16),c=t[s];r[s]=o>7?c.toUpperCase():c}return`0x${r.join("")}`},gs=S(20)[1],mn=x(e=>{const t=ke(e);if(t.length!==20)throw new Error(`Invalid length found on EthAddress(${e})`);const n=G(t);if(e===n||e===n.toUpperCase())return t;if(bn(n)!==e)throw new Error(`Invalid checksum found on EthAddress(${e})`);return t},Ye(e=>bn(G(gs(e))))),vn=new TextEncoder,wn=new TextDecoder,bs=N(S(4),vn.encode.bind(vn),wn.decode.bind(wn)),ct=w({engine:bs,payload:ce()}),ms=pe({consensus:ct,seal:ct,preRuntime:ct,runtimeUpdated:v},[4,5,6,8]),it=ce(32),vs=w({parentHash:it,number:m,stateRoot:it,extrinsicRoot:it,digests:I(ms)}),ee=I(B),En=j(B),ws=X({bool:v,char:v,str:v,u8:v,u16:v,u32:v,u64:v,u128:v,u256:v,i8:v,i16:v,i32:v,i64:v,i128:v,i256:v}),kn=I(w({name:En,type:m,typeName:En,docs:ee})),Es=w({len:re,type:m}),ks=w({bitStoreType:m,bitOrderType:m}),xs=I(w({name:B,fields:kn,index:U,docs:ee})),Is=X({composite:kn,variant:xs,sequence:m,array:Es,tuple:I(m),primitive:ws,compact:m,bitSequence:ks}),As=w({name:B,type:j(m)}),Bs=I(As),_s=w({id:m,path:ee,params:Bs,def:Is,docs:ee}),Pe=I(_s),Os=X({Blake2128:v,Blake2256:v,Blake2128Concat:v,Twox128:v,Twox256:v,Twox64Concat:v,Identity:v}),Us=I(Os),Ls=w({hashers:Us,key:m,value:m}),Ts=w({name:B,modifier:U,type:X({plain:m,map:Ls}),fallback:ce(),docs:ee}),Ss=j(w({prefix:B,items:I(Ts)})),xn={name:B,storage:Ss,calls:j(m),events:j(m),constants:I(w({name:B,type:m,value:ce(),docs:ee})),errors:j(m),index:U},Ds={...xn,docs:ee},Cs=new Uint8Array,In=e=>x(()=>Cs,()=>e),Hs=w({type:m,version:U,signedExtensions:I(w({identifier:B,type:m,additionalSigned:m}))}),An=w({lookup:Pe,pallets:I(w({...xn,docs:In([])})),extrinsic:Hs,type:m,apis:In([])}),$s=w({name:B,methods:I(w({name:B,inputs:I(w({name:B,type:m})),output:m,docs:ee})),docs:ee}),Vs=w({version:U,address:m,call:m,signature:m,extra:m,signedExtensions:I(w({identifier:B,type:m,additionalSigned:m}))}),Bn=w({lookup:Pe,pallets:I(w(Ds)),extrinsic:Vs,type:m,apis:I($s),outerEnums:w({call:m,event:m,error:m}),custom:I(F(B,w({type:m,value:ce()})))}),_n=()=>{throw new Error("Unsupported metadata version!")},V=x(_n,_n),Oe=w({magicNumber:re,metadata:X({v0:V,v1:V,v2:V,v3:V,v4:V,v5:V,v6:V,v7:V,v8:V,v9:V,v10:V,v11:V,v12:V,v13:V,v14:An,v15:Bn})}),at=S(),Ms=j(at),Ns=F(R,at),Rs=e=>{try{return Oe.dec(e)}catch{}try{return Oe.dec(Ms.dec(e))}catch{}try{return Oe.dec(at.dec(e))}catch{}try{return Oe.dec(Ns.dec(e)[1])}catch{}throw null},js={dkLen:32},lt=e=>Me(e,js),Ps={dkLen:16},ut=e=>Me(e,Ps),On=e=>fe(ut(e),e),te=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);function ie(e,t,n,r,s){return e=e+t+s|0,r=He(r^e,16),n=n+r|0,t=He(t^n,12),{a:e,b:t,c:n,d:r}}function ae(e,t,n,r,s){return e=e+t+s|0,r=He(r^e,8),n=n+r|0,t=He(t^n,7),{a:e,b:t,c:n,d:r}}function Un(e,t,n,r,s,o,c,i,f,a,l,d,h,u,y,p,b,E,O,M){let A=0;for(let be=0;be<r;be++)({a:s,b:f,c:h,d:b}=ie(s,f,h,b,n[t+e[A++]])),{a:s,b:f,c:h,d:b}=ae(s,f,h,b,n[t+e[A++]]),{a:o,b:a,c:u,d:E}=ie(o,a,u,E,n[t+e[A++]]),{a:o,b:a,c:u,d:E}=ae(o,a,u,E,n[t+e[A++]]),{a:c,b:l,c:y,d:O}=ie(c,l,y,O,n[t+e[A++]]),{a:c,b:l,c:y,d:O}=ae(c,l,y,O,n[t+e[A++]]),{a:i,b:d,c:p,d:M}=ie(i,d,p,M,n[t+e[A++]]),{a:i,b:d,c:p,d:M}=ae(i,d,p,M,n[t+e[A++]]),{a:s,b:a,c:y,d:M}=ie(s,a,y,M,n[t+e[A++]]),{a:s,b:a,c:y,d:M}=ae(s,a,y,M,n[t+e[A++]]),{a:o,b:l,c:p,d:b}=ie(o,l,p,b,n[t+e[A++]]),{a:o,b:l,c:p,d:b}=ae(o,l,p,b,n[t+e[A++]]),{a:c,b:d,c:h,d:E}=ie(c,d,h,E,n[t+e[A++]]),{a:c,b:d,c:h,d:E}=ae(c,d,h,E,n[t+e[A++]]),{a:i,b:f,c:u,d:O}=ie(i,f,u,O,n[t+e[A++]]),{a:i,b:f,c:u,d:O}=ae(i,f,u,O,n[t+e[A++]]);return{v0:s,v1:o,v2:c,v3:i,v4:f,v5:a,v6:l,v7:d,v8:h,v9:u,v10:y,v11:p,v12:b,v13:E,v14:O,v15:M}}var q;(function(e){e[e.CHUNK_START=1]="CHUNK_START",e[e.CHUNK_END=2]="CHUNK_END",e[e.PARENT=4]="PARENT",e[e.ROOT=8]="ROOT",e[e.KEYED_HASH=16]="KEYED_HASH",e[e.DERIVE_KEY_CONTEXT=32]="DERIVE_KEY_CONTEXT",e[e.DERIVE_KEY_MATERIAL=64]="DERIVE_KEY_MATERIAL"})(q||(q={}));const Ln=(()=>{const e=Array.from({length:16},(r,s)=>s),t=r=>[2,6,3,10,7,0,4,13,1,11,12,5,9,14,15,8].map(s=>r[s]),n=[];for(let r=0,s=e;r<7;r++,s=t(s))n.push(...s);return Uint8Array.from(n)})();class ht extends Rt{constructor(t={},n=0){if(super(64,t.dkLen===void 0?32:t.dkLen,{},Number.MAX_SAFE_INTEGER,0,0),this.flags=0,this.chunkPos=0,this.chunksDone=0,this.stack=[],this.posOut=0,this.bufferOut32=new Uint32Array(16),this.chunkOut=0,this.enableXOF=!0,this.outputLen=t.dkLen===void 0?32:t.dkLen,he(this.outputLen),t.key!==void 0&&t.context!==void 0)throw new Error("Blake3: only key or context can be specified at same time");if(t.key!==void 0){const r=W(t.key).slice();if(r.length!==32)throw new Error("Blake3: key should be 32 byte");this.IV=de(r),C||H(this.IV),this.flags=n|q.KEYED_HASH}else if(t.context!==void 0){const r=new ht({dkLen:32},q.DERIVE_KEY_CONTEXT).update(t.context).digest();this.IV=de(r),C||H(this.IV),this.flags=n|q.DERIVE_KEY_MATERIAL}else this.IV=te.slice(),this.flags=n;this.state=this.IV.slice(),this.bufferOut=Lr(this.bufferOut32)}get(){return[]}set(){}b2Compress(t,n,r,s=0){const{state:o,pos:c}=this,{h:i,l:f}=Ve(BigInt(t),!0),{v0:a,v1:l,v2:d,v3:h,v4:u,v5:y,v6:p,v7:b,v8:E,v9:O,v10:M,v11:A,v12:be,v13:Xe,v14:ze,v15:wo}=Un(Ln,s,r,7,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],te[0],te[1],te[2],te[3],i,f,c,n);o[0]=a^E,o[1]=l^O,o[2]=d^M,o[3]=h^A,o[4]=u^be,o[5]=y^Xe,o[6]=p^ze,o[7]=b^wo}compress(t,n=0,r=!1){let s=this.flags;if(this.chunkPos||(s|=q.CHUNK_START),(this.chunkPos===15||r)&&(s|=q.CHUNK_END),r||(this.pos=this.blockLen),this.b2Compress(this.chunksDone,s,t,n),this.chunkPos+=1,this.chunkPos===16||r){let o=this.state;this.state=this.IV.slice();for(let c,i=this.chunksDone+1;(r||!(i&1))&&(c=this.stack.pop());i>>=1)this.buffer32.set(c,0),this.buffer32.set(o,8),this.pos=this.blockLen,this.b2Compress(0,this.flags|q.PARENT,this.buffer32,0),o=this.state,this.state=this.IV.slice();this.chunksDone++,this.chunkPos=0,this.stack.push(o)}this.pos=0}_cloneInto(t){t=super._cloneInto(t);const{IV:n,flags:r,state:s,chunkPos:o,posOut:c,chunkOut:i,stack:f,chunksDone:a}=this;return t.state.set(s.slice()),t.stack=f.map(l=>Uint32Array.from(l)),t.IV.set(n),t.flags=r,t.chunkPos=o,t.chunksDone=a,t.posOut=c,t.chunkOut=i,t.enableXOF=this.enableXOF,t.bufferOut32.set(this.bufferOut32),t}destroy(){this.destroyed=!0,this.state.fill(0),this.buffer32.fill(0),this.IV.fill(0),this.bufferOut32.fill(0);for(let t of this.stack)t.fill(0)}b2CompressOut(){const{state:t,pos:n,flags:r,buffer32:s,bufferOut32:o}=this,{h:c,l:i}=Ve(BigInt(this.chunkOut++));C||H(s);const{v0:f,v1:a,v2:l,v3:d,v4:h,v5:u,v6:y,v7:p,v8:b,v9:E,v10:O,v11:M,v12:A,v13:be,v14:Xe,v15:ze}=Un(Ln,0,s,7,t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],te[0],te[1],te[2],te[3],i,c,n,r);o[0]=f^b,o[1]=a^E,o[2]=l^O,o[3]=d^M,o[4]=h^A,o[5]=u^be,o[6]=y^Xe,o[7]=p^ze,o[8]=t[0]^b,o[9]=t[1]^E,o[10]=t[2]^O,o[11]=t[3]^M,o[12]=t[4]^A,o[13]=t[5]^be,o[14]=t[6]^Xe,o[15]=t[7]^ze,C||(H(s),H(o)),this.posOut=0}finish(){if(this.finished)return;this.finished=!0,this.buffer.fill(0,this.pos);let t=this.flags|q.ROOT;this.stack.length?(t|=q.PARENT,C||H(this.buffer32),this.compress(this.buffer32,0,!0),C||H(this.buffer32),this.chunksDone=0,this.pos=this.blockLen):t|=(this.chunkPos?0:q.CHUNK_START)|q.CHUNK_END,this.flags=t,this.b2CompressOut()}writeInto(t){Ee(this,!1),Ce(t),this.finish();const{blockLen:n,bufferOut:r}=this;for(let s=0,o=t.length;s<o;){this.posOut>=n&&this.b2CompressOut();const c=Math.min(n-this.posOut,o-s);t.set(r.subarray(this.posOut,this.posOut+c),s),this.posOut+=c,s+=c}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible after digest call");return this.writeInto(t)}xof(t){return he(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Ze(t,this),this.finished)throw new Error("digest() was already called");return this.enableXOF=!1,this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}}const Ks=Cr(e=>new ht(e)),qs={dkLen:32},Tn=e=>Ks(e,qs),Xs=e=>fe(Tn(e),e),Sn=e=>e,ge=(e,t,n,r)=>new DataView(new Uint16Array([e,t,n,r]).buffer).getBigUint64(0,!0),dt=2n**64n-1n,D=(e,t)=>e<<t&dt|e>>64n-t,k=(e,t)=>e*t&dt,L=(e,t)=>e+t&dt,T=11400714785074694791n,P=14029467366897019727n,Dn=1609587929392839161n,Ue=9650029242287828579n,Cn=2870177450012600261n;function le(e,t=0n){let n=L(L(t,T),P),r=L(t,P),s=t,o=t-T,c=e.length,i=0,f=null;(function(){let u=0,y=u+c;if(c){if(f=new Uint8Array(32),c<32){f.set(e.subarray(0,c),i),i+=c;return}if(u<=y-32){const p=y-32;do{let b;b=ge(e[u+1]<<8|e[u],e[u+3]<<8|e[u+2],e[u+5]<<8|e[u+4],e[u+7]<<8|e[u+6]),n=k(D(L(n,k(b,P)),31n),T),u+=8,b=ge(e[u+1]<<8|e[u],e[u+3]<<8|e[u+2],e[u+5]<<8|e[u+4],e[u+7]<<8|e[u+6]),r=k(D(L(r,k(b,P)),31n),T),u+=8,b=ge(e[u+1]<<8|e[u],e[u+3]<<8|e[u+2],e[u+5]<<8|e[u+4],e[u+7]<<8|e[u+6]),s=k(D(L(s,k(b,P)),31n),T),u+=8,b=ge(e[u+1]<<8|e[u],e[u+3]<<8|e[u+2],e[u+5]<<8|e[u+4],e[u+7]<<8|e[u+6]),o=k(D(L(o,k(b,P)),31n),T),u+=8}while(u<=p)}u<y&&(f.set(e.subarray(u,y),i),i=y-u)}})(),e=f||e;let a,l=0;for(c>=32?(a=D(n,1n),a=L(a,D(r,7n)),a=L(a,D(s,12n)),a=L(a,D(o,18n)),n=k(D(k(n,P),31n),T),a=a^n,a=L(k(a,T),Ue),r=k(D(k(r,P),31n),T),a=a^r,a=L(k(a,T),Ue),s=k(D(k(s,P),31n),T),a=a^s,a=L(k(a,T),Ue),o=k(D(k(o,P),31n),T),a=a^o,a=L(k(a,T),Ue)):a=L(t,Cn),a=L(a,BigInt(c));l<=i-8;){let h=ge(e[l+1]<<8|e[l],e[l+3]<<8|e[l+2],e[l+5]<<8|e[l+4],e[l+7]<<8|e[l+6]);h=k(D(k(h,P),31n),T),a=L(k(D(a^h,27n),T),Ue),l+=8}if(l+4<=i){let h=k(ge(e[l+1]<<8|e[l],e[l+3]<<8|e[l+2],0,0),T);a=L(k(D(a^h,23n),P),Dn),l+=4}for(;l<i;){const h=k(ge(e[l++],0,0,0),Cn);a=k(D(a^h,11n),T)}let d=a>>33n;return a=k(a^d,P),d=a>>29n,a=k(a^d,Dn),d=a>>32n,a^=d,a}const Ke=e=>{const t=new Uint8Array(16),n=new DataView(t.buffer);return n.setBigUint64(0,le(e),!0),n.setBigUint64(8,le(e,1n),!0),t},Hn=e=>{const t=new Uint8Array(32),n=new DataView(t.buffer);return n.setBigUint64(0,le(e),!0),n.setBigUint64(8,le(e,1n),!0),n.setBigUint64(16,le(e,2n),!0),n.setBigUint64(24,le(e,3n),!0),t},$n=e=>fe(Se.enc(le(e)),e),Vn=new TextEncoder,zs=new Map([[Sn,0],[$n,8],[On,16],[ut,-16],[lt,-32],[Ke,-16],[Hn,-32]]),Fs=e=>{const t=Ke(Vn.encode(e));return(n,...r)=>{const s=fe(t,Ke(Vn.encode(n))),o=G(s),c=a=>{if(!a.startsWith(o))throw new Error(`key does not match this storage (${e}.${n})`);if(r.length===0)return[];const l=ke(a.slice(o.length)),d=new Array(r.length);for(let h=0,u=0;h<r.length;h++){const[y,p]=r[h],b=zs.get(p);if(b==null)throw new Error("Unknown hasher");if(b<0){const E=b*-1;d[h]=G(l.slice(u,u+E)),u+=E}else u+=b,d[h]=y.dec(l.slice(u)),u+=y.enc(d[h]).length}return d},i=r.map(([{enc:a},l])=>d=>l(a(d)));return{enc:(...a)=>G(fe(s,...a.map((l,d)=>i[d](l)))),dec:c}}},Ys=Z.fromText("modlpy/utilisuba").asBytes(),Ws=({threshold:e,signatories:t})=>{const n=Mn(t),r=fe(Ys,R.enc(n.length),...n,ve.enc(e));return lt(r)},Mn=e=>e.slice().sort((t,n)=>{for(let r=0;;r++){const s=r>=t.length,o=r>=n.length;if(s&&o)return 0;if(s)return-1;if(o)return 1;if(t[r]!==n[r])return t[r]>n[r]?1:-1}});var Gs=Object.freeze({__proto__:null,AccountId:nt,Bin:Be,Binary:Z,Blake2128:ut,Blake2128Concat:On,Blake2256:lt,Blake3256:Tn,Blake3256Concat:Xs,Bytes:S,Enum:st,FixedSizeBinary:Zt,Hex:ce,Identity:Sn,Option:j,Result:De,ScaleEnum:X,Self:ln,Storage:Fs,Struct:w,Tuple:F,Twox128:Ke,Twox256:Hn,Twox64Concat:$n,Variant:pe,Vector:I,_Enum:cs,_void:v,bitSequence:rn,blockHeader:vs,bool:cr,char:ns,compact:R,compactBn:nn,compactNumber:m,createCodec:x,createDecoder:Ye,decAnyMetadata:Rs,enhanceCodec:N,enhanceDecoder:Ge,enhanceEncoder:We,ethAccount:mn,fixedStr:os,fromBufferToBase58:Yt,getMultisigAccountId:Ws,getSs58AddressInfo:Ft,h64:le,i128:rr,i16:Zn,i256:or,i32:er,i64:tr,i8:Qn,metadata:Oe,selfDecoder:an,selfEncoder:cn,sortMultisigSignatories:Mn,str:B,u128:nr,u16:ve,u256:sr,u32:re,u64:Se,u8:U,v14:An,v14Lookup:Pe,v15:Bn});const Js=(e,t,n)=>(r,s,o,...c)=>{const{id:i}=r;if(s.has(i))return s.get(i);if(o.has(i)){const a=t(()=>s.get(i),r,...c);return s.set(i,a),a}o.add(i);let f=e(r,s,o,...c);return o.delete(i),s.has(i)&&(f=n(f,s.get(i),r,...c)),s.set(i,f),f},Qs=Be(),Nn=Js((e,t,n,r)=>{if(e.type==="primitive")return Gs[e.value];if(e.type==="void")return v;if(e.type==="AccountId32")return r;if(e.type==="AccountId20")return mn;if(e.type==="compact")return e.isBig?nn:m;if(e.type==="bitSequence")return rn;const s=u=>Nn(u,t,n,r),o=(u,y)=>{const p=s(u);return y?I(p,y):I(p)},c=u=>F(...u.map(s)),i=u=>{const y=Object.fromEntries(Object.entries(u).map(([p,b])=>[p,s(b)]));return w(y)};if(e.type==="sequence"&&e.value.type==="primitive"&&e.value.value==="u8")return Qs;if(e.type==="array")return e.value.type==="primitive"&&e.value.value==="u8"?Be(e.len):o(e.value,e.len);if(e.type==="sequence")return o(e.value);if(e.type==="tuple")return c(e.value);if(e.type==="struct")return i(e.value);if(e.type==="option")return j(s(e.value));if(e.type==="result")return De(s(e.value.ok),s(e.value.ko));const f=Object.values(e.value).map(u=>{switch(u.type){case"void":return v;case"lookupEntry":return s(u.value);case"tuple":return c(u.value);case"struct":return i(u.value);case"array":return o(u.value,u.len)}}),a=Object.fromEntries(Object.keys(e.value).map((u,y)=>[u,f[y]])),l=Object.values(e.value).map(u=>u.idx),h=l.every((u,y)=>u===y)?pe(a):pe(a,l);return e.byteLength?eo(h,e.byteLength):h},ln,e=>e),Zs=(e,t=nt())=>{const n=new Map,r=s=>Nn(e(s),n,new Set,t);return s=>r(s)},eo=(e,t)=>{const n=S(t);return x(r=>n.enc(e.enc(r)),r=>e.dec(n.dec(r)))},to=e=>{const{metadata:t}=e,n=Zs(e),r=(l="")=>{const d=e.storage[l];if(!d)throw new Error(`Storage entry ${l||"{root}"} not found`);const h=d.key==null?v:n(d.key);return{key:Rn(h,d.keyPrefix),value:n(d.typeId)}},s=l=>{const d=w(Object.fromEntries(l.args.map(h=>[h.label,n(h.type.type)])));return{call:Rn(d,l.selector),value:n(l.returnType.type)}},o=l=>{const d=t.spec.constructors.find(h=>h.label===l);if(!d)throw new Error(`Constructor ${l} not found`);return s(d)},c=l=>{const d=t.spec.messages.find(h=>h.label===l);if(!d)throw new Error(`Message ${l} not found`);return s(d)},i=l=>w(Object.fromEntries(l.args.map(d=>[d.label,n(d.type.type)])));return{buildConstructor:o,buildMessage:c,buildStorage:r,buildEvents:()=>pe(Object.fromEntries(t.spec.events.map(l=>[l.label,i(l)]))),buildEvent:l=>{const d=t.spec.events,h=(y,p)=>N(y,b=>b.value,b=>({type:p,value:b}));if(l){const y=d.find(p=>p.signature_topic===l);return y?h(i(y),y.label):null}const u=d.filter(y=>y.signature_topic===l);return u.length?no(u.map(y=>h(i(y),y.label))):null}}},Rn=(e,t)=>{const n=Z.fromHex(t).asBytes(),r=F(S(n.length),e);return N(r,s=>[n,s],([,s])=>s)},no=e=>x(t=>{for(const n of e)try{n.enc(t)}catch{}throw new Error("Unable to encode")},t=>{for(const n of e)try{n.dec(t)}catch{}throw new Error("Unable to decode")}),jn=e=>N(X(e),t=>{if(typeof t=="string")return{tag:t,value:void 0};const[n,r]=Object.entries(t)[0];return{tag:n,value:r}},t=>({[t.tag]:t.value})),Le=(e,t)=>N(I(e,t),n=>n??[],n=>n),Pn=j(B),qe=Le(B),ro=jn({bool:v,char:v,str:v,u8:v,u16:v,u32:v,u64:v,u128:v,u256:v,i8:v,i16:v,i32:v,i64:v,i128:v,i256:v}),Kn=Le(w({name:Pn,type:m,typeName:Pn,docs:qe})),so=w({len:re,type:m}),oo=w({bitStoreType:m,bitOrderType:m}),co=Le(w({name:B,fields:Kn,index:U,docs:qe})),io=jn({composite:w({fields:Kn}),variant:w({variants:co}),sequence:w({type:m}),array:so,tuple:I(m),primitive:ro,compact:m,bitSequence:oo}),ao=w({name:B,type:j(m)}),lo=Le(ao),uo=w({id:m,path:qe,params:lo,def:io,docs:qe}),ho=N(uo,e=>({id:e.id,path:e.type.path,params:e.type.params??[],def:e.type.def,docs:[]}),e=>({id:e.id,type:{def:e.def,path:e.path,params:e.params}})),fo=Le(ho),yo=e=>{const t=fo.enc(e.types),n=Pe.dec(t),r=e.spec.environment.accountId.type,s=n.find(i=>i.id===r);s&&(s.path=["AccountId32"]);const o=po(e,n),c=zn(n);return Object.assign(c,{metadata:e,lookup:n,storage:o})};function po(e,t){const n={},r=(s,o=[])=>{function c(f){const a=t.length;return t[a]={id:a,docs:[],def:f,params:[],path:[]},a}if("root"in s){const f=Number(e.version)===4?Z.fromBytes(Z.fromHex(s.root.root_key).asBytes().reverse()).asHex():s.root.root_key,a=r(s.root.layout,o);if(s.root.ty!=null){let l=function(d,h){const u=e.types[d].type,y="composite"in u.def?new Map((u.def.composite.fields??[]).map(b=>[b.name,b.type])):null,p=new Map((u.params??[]).map(b=>[b.name,b.type]));if(p.size===2&&p.has("V")&&y&&y.size===2&&y.has("len")&&y.has("elements")){l(y.get("len"),[...h,"len"]),l(y.get("elements"),h);return}else p.size===3&&p.has("K")&&p.has("V")?n[h.join(".")]={keyPrefix:f,key:p.get("K"),typeId:p.get("V")}:p.size===2&&p.has("V")&&(n[h.join(".")]={keyPrefix:f,key:null,typeId:p.get("V")})};l(s.root.ty,o)}return n[o.join(".")]||(n[o.join(".")]={keyPrefix:f,key:null,typeId:a}),c({tag:"composite",value:[]})}if("leaf"in s)return s.leaf.ty;if("hash"in s)throw new Error("HashLayout not implemented");if("array"in s){const f=r(s.array.layout,o);return f==null?null:c({tag:"array",value:{len:s.array.len,type:f}})}if("struct"in s){const f=s.struct.fields.map(a=>({name:a.name,type:r(a.layout,[...o,a.name]),typeName:void 0,docs:[]})).filter(a=>a.type!=null);return c({tag:"composite",value:f})}const i=Object.values(s.enum.variants).map((f,a)=>({name:f.name,fields:f.fields.map(l=>({name:l.name,type:r(l.layout,[...o,f.name,l.name]),typeName:void 0,docs:[]})).filter(l=>l.type!==null),index:a,docs:[]}));return c({tag:"variant",value:i})};return r(e.storage),n}const go=e=>{const t=yo(e.metadata),n=to(t);return{constructor:qn(n.buildConstructor),message:qn(n.buildMessage),storage:bo(n.buildStorage),event:Number(t.metadata.version)===4?mo(n.buildEvents):vo(t,n.buildEvent)}},qn=e=>t=>{const n=e(t);return{encode:r=>Z.fromBytes(n.call.enc(r||{})),decode:r=>n.value.dec(r.data.asBytes())}},bo=e=>t=>{const n=e(t);return{encode:r=>Z.fromBytes(n.key.enc(r)),decode:r=>n.value.dec(r.asBytes())}},mo=e=>{const t=r=>e().dec(r.data.asBytes());return{decode:t,filter:(r,s=[])=>s.map(c=>"event"in c?c.event:c).filter(c=>c.type==="Contracts"&&c.value.type==="ContractEmitted"&&c.value.value.contract===r).map(c=>{try{return t(c.value.value)}catch(i){throw console.error(`Contract ${r} emitted an incompatible event`,c.value.value),i}})}},vo=(e,t)=>{const n=new Set(e.metadata.spec.events.map(c=>c.signature_topic).filter(c=>c!=null)),r=e.metadata.spec.events.some(c=>c.signature_topic==null),s=(c,i)=>{if(i!=null){if(!n.has(i))throw new Error(`Event with signature topic ${c} not found`);return t(i).dec(c.data.asBytes())}if(!r)throw new Error("Event signature topic required");return t(void 0).dec(c.data.asBytes())};return{decode:s,filter:(c,i=[])=>i.map(a=>"event"in a?a:{event:a,topics:a.topics}).filter(a=>a.event.type==="Contracts"&&a.event.value.type==="ContractEmitted"&&a.event.value.value.contract===c).map(a=>{const l=a.topics.map(h=>h.asHex()),d=l.find(h=>n.has(h));try{return s(a.event.value.value,d)}catch{return console.error(`Contract ${c} emitted an incompatible event`,{event:a.event.value.value.data.asHex(),eventTopics:l,metadataEventTopics:[...n],hasAnonymousEvents:r}),null}}).filter(a=>a!==null)}};we.getInkClient=go});
|
|
1
|
+
(function(Be,we){typeof exports=="object"&&typeof module<"u"?we(exports):typeof define=="function"&&define.amd?define(["exports"],we):(Be=typeof globalThis<"u"?globalThis:Be||self,we(Be.papiInk={}))})(this,function(Be){"use strict";const we=(e,t)=>e.type==="array"&&e.len===t&&e.value.type==="primitive"&&e.value.value==="u8",de={type:"void"},er=(e,t=()=>null)=>{const n=new Map,r=new Set,s=u=>d=>{let h=n.get(d);if(h)return h;if(r.has(d)){const y={id:d};return n.set(d,y),y}r.add(d);const l=u(d);return h=n.get(d),h?Object.assign(h,l):(h={id:d,...l},n.set(d,h)),r.delete(d),h};let o=!0,c=!0;const i=s(u=>{const d=t(e[u]);if(d)return d;const{def:h,path:l,params:y}=e[u];if(h.tag==="composite"){if(h.value.length===0)return de;if(h.value.length===1){const p=i(h.value[0].type);return o&&l.at(-1)==="AccountId32"&&we(p,32)?(o=!1,{type:"AccountId32"}):c&&l.at(-1)==="AccountId20"&&we(p,20)?(c=!1,{type:"AccountId20"}):p}return f(h.value)}if(h.tag==="variant"){if(l.length===1&&l[0]==="Option"&&y.length===1&&y[0].name==="T"){const w=i(y[0].type);return w.type==="void"?{type:"primitive",value:"bool"}:{type:"option",value:w}}if(l.length===1&&l[0]==="Result"&&y.length===2&&y[0].name==="T"&&y[1].name==="E")return{type:"result",value:{ok:i(y[0].type),ko:i(y[1].type)}};if(h.value.length===0)return de;const p={},b={};return h.value.forEach(w=>{const U=w.name;if(b[U]=w.docs,w.fields.length===0){p[U]={...de,idx:w.index};return}if(w.fields.length===1&&!w.fields[0].name){p[U]={type:"lookupEntry",value:i(w.fields[0].type),idx:w.index};return}p[U]={...f(w.fields),idx:w.index}}),{type:"enum",value:p,innerDocs:b}}if(h.tag==="sequence")return{type:"sequence",value:i(h.value)};if(h.tag==="array"){const{len:p}=h.value,b=i(h.value.type);return!p||b.type==="void"?de:p>1?{type:"array",value:b,len:h.value.len}:b}if(h.tag==="tuple")return h.value.length===0?de:h.value.length>1?a(h.value.map(p=>i(p)),h.value.map(p=>e[p].docs)):i(h.value[0]);if(h.tag==="primitive")return{type:"primitive",value:h.value.tag};if(h.tag==="compact"){const p=i(h.value);return p.type==="void"?de:{type:"compact",isBig:Number(p.value.slice(1))>32,size:p.value}}return{type:h.tag}}),f=u=>{let d=!0;const h={},l={};return u.forEach((y,p)=>{d=d&&!!y.name;const b=y.name||p,w=i(y.type);w.type!=="void"&&(h[b]=w,l[b]=y.docs)}),d?{type:"struct",value:h,innerDocs:l}:a(Object.values(h),Object.values(l))},a=(u,d)=>{if(u.every(h=>h.id===u[0].id)&&d.every(h=>!h.length)){const[h]=u;return h.type==="void"?de:{type:"array",value:u[0],len:u.length}}return{type:"tuple",value:u,innerDocs:d}};return i},tr=e=>er(e);var nr=Object.defineProperty,rr=(e,t,n)=>t in e?nr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mt=(e,t,n)=>(rr(e,typeof t!="symbol"?t+"":t,n),n),Ze={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function sr(e){const t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,s=new Uint8Array(r);t&&(s[0]=0|Ze[e[2]]);for(let o=0;o<r;){const c=n+o*2,i=Ze[e[c]],f=Ze[e[c+1]];s[t+o++]=i<<4|f}return s}var vt=class extends Uint8Array{constructor(e){super(e),mt(this,"i",0),mt(this,"v"),this.v=new DataView(e)}},P=e=>t=>e(t instanceof vt?t:new vt(t instanceof Uint8Array?t.buffer:typeof t=="string"?sr(t).buffer:t)),F=e=>{const t=e.length;let n=0;for(let s=0;s<t;s++)n+=e[s].length;const r=new Uint8Array(n);for(let s=0,o=0;s<t;s++){const c=e[s];r.set(c,o),o+=c.byteLength}return r};function Me(e,t){const n=Object.keys(e),r=n.length,s={};for(let o=0;o<r;o++){const c=n[o];s[c]=t(e[c],c)}return s}var et=P,I=(e,t)=>{const n=[e,t];return n.enc=e,n.dec=t,n},tt=(e,t)=>n=>e(t(n)),nt=(e,t)=>n=>t(e(n)),N=([e,t],n,r)=>I(tt(e,n),nt(t,r));function or(e,t){return P(n=>{const r=n.v[t](n.i,!0);return n.i+=e,r})}function cr(e,t){return n=>{const r=new Uint8Array(e);return new DataView(r.buffer)[t](0,n,!0),r}}function ne(e,t,n){return I(cr(e,n),or(e,t))}var T=ne(1,"getUint8","setUint8"),Ee=ne(2,"getUint16","setUint16"),re=ne(4,"getUint32","setUint32"),He=ne(8,"getBigUint64","setBigUint64"),ir=ne(1,"getInt8","setInt8"),ar=ne(2,"getInt16","setInt16"),ur=ne(4,"getInt32","setInt32"),lr=ne(8,"getBigInt64","setBigInt64"),wt=e=>{const t=new Uint8Array(16),n=new DataView(t.buffer);return n.setBigInt64(0,e,!0),n.setBigInt64(8,e>>64n,!0),t},Et=e=>P(t=>{const{v:n,i:r}=t,s=n.getBigUint64(r,!0),o=n[e](r+8,!0);return t.i+=16,o<<64n|s}),hr=I(wt,Et("getBigUint64")),dr=I(wt,Et("getBigInt64")),xt=e=>{const t=new Uint8Array(32),n=new DataView(t.buffer);return n.setBigInt64(0,e,!0),n.setBigInt64(8,e>>64n,!0),n.setBigInt64(16,e>>128n,!0),n.setBigInt64(24,e>>192n,!0),t},It=e=>P(t=>{let n=t.v.getBigUint64(t.i,!0);return t.i+=8,n|=t.v.getBigUint64(t.i,!0)<<64n,t.i+=8,n|=t.v.getBigUint64(t.i,!0)<<128n,t.i+=8,n|=t.v[e](t.i,!0)<<192n,t.i+=8,n}),fr=I(xt,It("getBigUint64")),yr=I(xt,It("getBigInt64")),pr=N(T,e=>e?1:0,Boolean),gr=[T[1],Ee[1],re[1]],br=P(e=>{const t=e[e.i],n=t&3;if(n<3)return gr[n](e)>>>2;const r=(t>>>2)+4;e.i++;let s=0n;const o=r/8|0;let c=0n;for(let f=0;f<o;f++)s=He[1](e)<<c|s,c+=64n;let i=r%8;return i>3&&(s=BigInt(re[1](e))<<c|s,c+=32n,i-=4),i>1&&(s=BigInt(Ee[1](e))<<c|s,c+=16n,i-=2),i&&(s=BigInt(T[1](e))<<c|s),s}),mr=1n<<56n,vr=1<<24,wr=256,Er=4294967295n,xr=64,Ir=16384,Br=1<<30,Ar=e=>{if(e<0)throw new Error(`Wrong compact input (${e})`);const t=Number(e)<<2;if(e<xr)return T[0](t);if(e<Ir)return Ee[0](t|1);if(e<Br)return re[0](t|2);let n=[new Uint8Array(1)],r=BigInt(e);for(;r>=mr;)n.push(He[0](r)),r>>=64n;r>=vr&&(n.push(re[0](Number(r&Er))),r>>=32n);let s=Number(r);s>=wr&&(n.push(Ee[0](s)),s>>=16),s&&n.push(T[0](s));const o=F(n);return o[0]=o.length-5<<2|3,o},R=I(Ar,br),kr=new TextEncoder,_r=e=>{const t=kr.encode(e);return F([R.enc(t.length),t])},Or=new TextDecoder,Ur=P(e=>{let t=R.dec(e);const n=new DataView(e.buffer,e.i,t);return e.i+=t,Or.decode(n)}),_=I(_r,Ur),Tr=()=>{},Lr=new Uint8Array(0),v=I(()=>Lr,Tr),Bt=e=>e===void 0?t=>F([R.enc(t.length),t]):t=>t.length===e?t:t.slice(0,e),At=e=>P(t=>{const n=e===void 0?R.dec(t):e!==1/0?e:t.byteLength-t.i,r=new Uint8Array(t.buffer.slice(t.i,t.i+n));return t.i+=n,r}),D=e=>I(Bt(e),At(e));D.enc=Bt,D.dec=At;var kt=(e,t)=>{const n=Object.keys(e),r=new Map(t?.map((o,c)=>[n[c],o])??n.map((o,c)=>[o,c])),s=o=>r.get(o);return({tag:o,value:c})=>F([T.enc(s(o)),e[o](c)])},_t=(e,t)=>{const n=Object.keys(e),r=new Map(t?.map((s,o)=>[s,n[o]])??n.map((s,o)=>[o,s]));return P(s=>{const o=T.dec(s),c=r.get(o),i=e[c];return{tag:c,value:i(s)}})},q=(e,...t)=>I(kt(Me(e,([n])=>n),...t),_t(Me(e,([,n])=>n),...t));q.enc=kt,q.dec=_t;var Ot=e=>P(t=>T[1](t)>0?e(t):void 0),Ut=e=>t=>{const n=new Uint8Array(1);return t===void 0?n:(n[0]=1,F([n,e(t)]))},K=e=>I(Ut(e[0]),Ot(e[1]));K.enc=Ut,K.dec=Ot;var Tt=(e,t)=>P(n=>{const r=T[1](n)===0,o=(r?e:t)(n);return{success:r,value:o}}),Lt=(e,t)=>({success:n,value:r})=>F([T[0](n?0:1),(n?e:t)(r)]),Ae=(e,t)=>I(Lt(e[0],t[0]),Tt(e[1],t[1]));Ae.dec=Tt,Ae.enc=Lt;var Ct=(...e)=>P(t=>e.map(n=>n(t))),St=(...e)=>t=>F(e.map((n,r)=>n(t[r]))),X=(...e)=>I(St(...e.map(([t])=>t)),Ct(...e.map(([,t])=>t)));X.enc=St,X.dec=Ct;var Dt=e=>{const t=Object.keys(e);return tt(X.enc(...Object.values(e)),n=>t.map(r=>n[r]))},$t=e=>{const t=Object.keys(e);return nt(X.dec(...Object.values(e)),n=>Object.fromEntries(n.map((r,s)=>[t[s],r])))},E=e=>I(Dt(Me(e,t=>t[0])),$t(Me(e,t=>t[1])));E.enc=Dt,E.dec=$t;var Vt=(e,t)=>t>=0?n=>F(n.map(e)):n=>F([R.enc(n.length),F(n.map(e))]),Mt=(e,t)=>P(n=>{const r=t>=0?t:R.dec(n),s=new Array(r);for(let o=0;o<r;o++)s[o]=e(n);return s}),B=(e,t)=>I(Vt(e[0],t),Mt(e[1],t));B.enc=Vt,B.dec=Mt;/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Cr(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Ht(e,t){return Array.isArray(t)?t.length===0?!0:e?t.every(n=>typeof n=="string"):t.every(n=>Number.isSafeInteger(n)):!1}function rt(e,t){if(typeof t!="string")throw new Error(`${e}: string expected`);return!0}function Nt(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function st(e){if(!Array.isArray(e))throw new Error("array expected")}function Rt(e,t){if(!Ht(!0,t))throw new Error(`${e}: array of strings expected`)}function Sr(e,t){if(!Ht(!1,t))throw new Error(`${e}: array of numbers expected`)}function Dr(...e){const t=o=>o,n=(o,c)=>i=>o(c(i)),r=e.map(o=>o.encode).reduceRight(n,t),s=e.map(o=>o.decode).reduce(n,t);return{encode:r,decode:s}}function $r(e){const t=typeof e=="string"?e.split(""):e,n=t.length;Rt("alphabet",t);const r=new Map(t.map((s,o)=>[s,o]));return{encode:s=>(st(s),s.map(o=>{if(!Number.isSafeInteger(o)||o<0||o>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${o}". Allowed: ${e}`);return t[o]})),decode:s=>(st(s),s.map(o=>{rt("alphabet.decode",o);const c=r.get(o);if(c===void 0)throw new Error(`Unknown letter: "${o}". Allowed: ${e}`);return c}))}}function Vr(e=""){return rt("join",e),{encode:t=>(Rt("join.decode",t),t.join(e)),decode:t=>(rt("join.decode",t),t.split(e))}}function jt(e,t,n){if(t<2)throw new Error(`convertRadix: invalid from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: invalid to=${n}, base cannot be less than 2`);if(st(e),!e.length)return[];let r=0;const s=[],o=Array.from(e,i=>{if(Nt(i),i<0||i>=t)throw new Error(`invalid integer: ${i}`);return i}),c=o.length;for(;;){let i=0,f=!0;for(let a=r;a<c;a++){const u=o[a],d=t*i,h=d+u;if(!Number.isSafeInteger(h)||d/t!==i||h-u!==d)throw new Error("convertRadix: carry overflow");const l=h/n;i=h%n;const y=Math.floor(l);if(o[a]=y,!Number.isSafeInteger(y)||y*n+i!==h)throw new Error("convertRadix: carry overflow");if(f)y?f=!1:r=a;else continue}if(s.push(i),f)break}for(let i=0;i<e.length-1&&e[i]===0;i++)s.push(0);return s.reverse()}function Mr(e){Nt(e);const t=2**8;return{encode:n=>{if(!Cr(n))throw new Error("radix.encode input should be Uint8Array");return jt(Array.from(n),t,e)},decode:n=>(Sr("radix.decode",n),Uint8Array.from(jt(n,e,t)))}}const Pt=(e=>Dr(Mr(58),$r(e),Vr("")))("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Hr(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function xe(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function fe(e,...t){if(!Hr(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function ke(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 ot(e,t){fe(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Nr(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function ye(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function se(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Ne(e,t){return e<<32-t|e>>>t}const qt=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Kt(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const W=qt?e=>e:e=>Kt(e);function Rr(e){for(let t=0;t<e.length;t++)e[t]=Kt(e[t]);return e}const V=qt?e=>e:Rr;function jr(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function z(e){return typeof e=="string"&&(e=jr(e)),fe(e),e}class Ft{}function Pr(e){const t=r=>e().update(z(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function qr(e){const t=(r,s)=>e(s).update(z(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}function Kr(e){const t=(r,s)=>e(s).update(z(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}const Fr=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]);function oe(e,t,n,r,s){return e=e+t+s|0,r=Ne(r^e,16),n=n+r|0,t=Ne(t^n,12),{a:e,b:t,c:n,d:r}}function ce(e,t,n,r,s){return e=e+t+s|0,r=Ne(r^e,8),n=n+r|0,t=Ne(t^n,7),{a:e,b:t,c:n,d:r}}const Xr=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Re=BigInt(2**32-1),Xt=BigInt(32);function je(e,t=!1){return t?{h:Number(e&Re),l:Number(e>>Xt&Re)}:{h:Number(e>>Xt&Re)|0,l:Number(e&Re)|0}}function zr(e,t=!1){const n=e.length;let r=new Uint32Array(n),s=new Uint32Array(n);for(let o=0;o<n;o++){const{h:c,l:i}=je(e[o],t);[r[o],s[o]]=[c,i]}return[r,s]}const zt=(e,t,n)=>e>>>n|t<<32-n,Gt=(e,t,n)=>e<<32-n|t>>>n,Gr=(e,t,n)=>e<<64-n|t>>>n-32,Wr=(e,t,n)=>e>>>n-32|t<<64-n,Yr=(e,t)=>t,Jr=(e,t)=>e,Qr=(e,t,n)=>e<<n|t>>>32-n,Zr=(e,t,n)=>t<<n|e>>>32-n,es=(e,t,n)=>t<<n-32|e>>>64-n,ts=(e,t,n)=>e<<n-32|t>>>64-n;function Wt(e,t,n,r){const s=(t>>>0)+(r>>>0);return{h:e+n+(s/2**32|0)|0,l:s|0}}const Yt=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),Jt=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,O=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),g=new Uint32Array(32);function ie(e,t,n,r,s,o){const c=s[o],i=s[o+1];let f=g[2*e],a=g[2*e+1],u=g[2*t],d=g[2*t+1],h=g[2*n],l=g[2*n+1],y=g[2*r],p=g[2*r+1],b=Yt(f,u,c);a=Jt(b,a,d,i),f=b|0,{Dh:p,Dl:y}={Dh:p^a,Dl:y^f},{Dh:p,Dl:y}={Dh:Yr(p,y),Dl:Jr(p)},{h:l,l:h}=Wt(l,h,p,y),{Bh:d,Bl:u}={Bh:d^l,Bl:u^h},{Bh:d,Bl:u}={Bh:zt(d,u,24),Bl:Gt(d,u,24)},g[2*e]=f,g[2*e+1]=a,g[2*t]=u,g[2*t+1]=d,g[2*n]=h,g[2*n+1]=l,g[2*r]=y,g[2*r+1]=p}function ae(e,t,n,r,s,o){const c=s[o],i=s[o+1];let f=g[2*e],a=g[2*e+1],u=g[2*t],d=g[2*t+1],h=g[2*n],l=g[2*n+1],y=g[2*r],p=g[2*r+1],b=Yt(f,u,c);a=Jt(b,a,d,i),f=b|0,{Dh:p,Dl:y}={Dh:p^a,Dl:y^f},{Dh:p,Dl:y}={Dh:zt(p,y,16),Dl:Gt(p,y,16)},{h:l,l:h}=Wt(l,h,p,y),{Bh:d,Bl:u}={Bh:d^l,Bl:u^h},{Bh:d,Bl:u}={Bh:Gr(d,u,63),Bl:Wr(d,u,63)},g[2*e]=f,g[2*e+1]=a,g[2*t]=u,g[2*t+1]=d,g[2*n]=h,g[2*n+1]=l,g[2*r]=y,g[2*r+1]=p}function ns(e,t={},n,r,s){if(xe(n),e<0||e>n)throw new Error("outputLen bigger than keyLen");const{key:o,salt:c,personalization:i}=t;if(o!==void 0&&(o.length<1||o.length>n))throw new Error("key length must be undefined or 1.."+n);if(c!==void 0&&c.length!==r)throw new Error("salt must be undefined or "+r);if(i!==void 0&&i.length!==s)throw new Error("personalization must be undefined or "+s)}class Qt extends Ft{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,xe(t),xe(n),this.blockLen=t,this.outputLen=n,this.buffer=new Uint8Array(t),this.buffer32=ye(this.buffer)}update(t){ke(this),t=z(t),fe(t);const{blockLen:n,buffer:r,buffer32:s}=this,o=t.length,c=t.byteOffset,i=t.buffer;for(let f=0;f<o;){this.pos===n&&(V(s),this.compress(s,0,!1),V(s),this.pos=0);const a=Math.min(n-this.pos,o-f),u=c+f;if(a===n&&!(u%4)&&f+a<o){const d=new Uint32Array(i,u,Math.floor((o-f)/4));V(d);for(let h=0;f+n<o;h+=s.length,f+=n)this.length+=n,this.compress(d,h,!1);V(d);continue}r.set(t.subarray(f,f+a),this.pos),this.pos+=a,this.length+=a,f+=a}return this}digestInto(t){ke(this),ot(t,this);const{pos:n,buffer32:r}=this;this.finished=!0,se(this.buffer.subarray(n)),V(r),this.compress(r,0,!0),V(r);const s=ye(t);this.get().forEach((o,c)=>s[c]=W(o))}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){const{buffer:n,length:r,finished:s,destroyed:o,outputLen:c,pos:i}=this;return t||(t=new this.constructor({dkLen:c})),t.set(...this.get()),t.buffer.set(n),t.destroyed=o,t.finished=s,t.length=r,t.pos=i,t.outputLen=c,t}clone(){return this._cloneInto()}}class rs extends Qt{constructor(t={}){const n=t.dkLen===void 0?64:t.dkLen;super(128,n),this.v0l=O[0]|0,this.v0h=O[1]|0,this.v1l=O[2]|0,this.v1h=O[3]|0,this.v2l=O[4]|0,this.v2h=O[5]|0,this.v3l=O[6]|0,this.v3h=O[7]|0,this.v4l=O[8]|0,this.v4h=O[9]|0,this.v5l=O[10]|0,this.v5h=O[11]|0,this.v6l=O[12]|0,this.v6h=O[13]|0,this.v7l=O[14]|0,this.v7h=O[15]|0,ns(n,t,64,16,16);let{key:r,personalization:s,salt:o}=t,c=0;if(r!==void 0&&(r=z(r),c=r.length),this.v0l^=this.outputLen|c<<8|65536|1<<24,o!==void 0){o=z(o);const i=ye(o);this.v4l^=W(i[0]),this.v4h^=W(i[1]),this.v5l^=W(i[2]),this.v5h^=W(i[3])}if(s!==void 0){s=z(s);const i=ye(s);this.v6l^=W(i[0]),this.v6h^=W(i[1]),this.v7l^=W(i[2]),this.v7h^=W(i[3])}if(r!==void 0){const i=new Uint8Array(this.blockLen);i.set(r),this.update(i)}}get(){let{v0l:t,v0h:n,v1l:r,v1h:s,v2l:o,v2h:c,v3l:i,v3h:f,v4l:a,v4h:u,v5l:d,v5h:h,v6l:l,v6h:y,v7l:p,v7h:b}=this;return[t,n,r,s,o,c,i,f,a,u,d,h,l,y,p,b]}set(t,n,r,s,o,c,i,f,a,u,d,h,l,y,p,b){this.v0l=t|0,this.v0h=n|0,this.v1l=r|0,this.v1h=s|0,this.v2l=o|0,this.v2h=c|0,this.v3l=i|0,this.v3h=f|0,this.v4l=a|0,this.v4h=u|0,this.v5l=d|0,this.v5h=h|0,this.v6l=l|0,this.v6h=y|0,this.v7l=p|0,this.v7h=b|0}compress(t,n,r){this.get().forEach((f,a)=>g[a]=f),g.set(O,16);let{h:s,l:o}=je(BigInt(this.length));g[24]=O[8]^o,g[25]=O[9]^s,r&&(g[28]=~g[28],g[29]=~g[29]);let c=0;const i=Fr;for(let f=0;f<12;f++)ie(0,4,8,12,t,n+2*i[c++]),ae(0,4,8,12,t,n+2*i[c++]),ie(1,5,9,13,t,n+2*i[c++]),ae(1,5,9,13,t,n+2*i[c++]),ie(2,6,10,14,t,n+2*i[c++]),ae(2,6,10,14,t,n+2*i[c++]),ie(3,7,11,15,t,n+2*i[c++]),ae(3,7,11,15,t,n+2*i[c++]),ie(0,5,10,15,t,n+2*i[c++]),ae(0,5,10,15,t,n+2*i[c++]),ie(1,6,11,12,t,n+2*i[c++]),ae(1,6,11,12,t,n+2*i[c++]),ie(2,7,8,13,t,n+2*i[c++]),ae(2,7,8,13,t,n+2*i[c++]),ie(3,4,9,14,t,n+2*i[c++]),ae(3,4,9,14,t,n+2*i[c++]);this.v0l^=g[0]^g[16],this.v0h^=g[1]^g[17],this.v1l^=g[2]^g[18],this.v1h^=g[3]^g[19],this.v2l^=g[4]^g[20],this.v2h^=g[5]^g[21],this.v3l^=g[6]^g[22],this.v3h^=g[7]^g[23],this.v4l^=g[8]^g[24],this.v4h^=g[9]^g[25],this.v5l^=g[10]^g[26],this.v5h^=g[11]^g[27],this.v6l^=g[12]^g[28],this.v6h^=g[13]^g[29],this.v7l^=g[14]^g[30],this.v7h^=g[15]^g[31],se(g)}destroy(){this.destroyed=!0,se(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const ss=qr(e=>new rs(e));function Zt(e,t,n,r,s,o,c,i,f,a,u,d,h,l,y,p,b,w,U,H){let k=0;for(let ve=0;ve<r;ve++)({a:s,b:f,c:h,d:b}=oe(s,f,h,b,n[t+e[k++]])),{a:s,b:f,c:h,d:b}=ce(s,f,h,b,n[t+e[k++]]),{a:o,b:a,c:l,d:w}=oe(o,a,l,w,n[t+e[k++]]),{a:o,b:a,c:l,d:w}=ce(o,a,l,w,n[t+e[k++]]),{a:c,b:u,c:y,d:U}=oe(c,u,y,U,n[t+e[k++]]),{a:c,b:u,c:y,d:U}=ce(c,u,y,U,n[t+e[k++]]),{a:i,b:d,c:p,d:H}=oe(i,d,p,H,n[t+e[k++]]),{a:i,b:d,c:p,d:H}=ce(i,d,p,H,n[t+e[k++]]),{a:s,b:a,c:y,d:H}=oe(s,a,y,H,n[t+e[k++]]),{a:s,b:a,c:y,d:H}=ce(s,a,y,H,n[t+e[k++]]),{a:o,b:u,c:p,d:b}=oe(o,u,p,b,n[t+e[k++]]),{a:o,b:u,c:p,d:b}=ce(o,u,p,b,n[t+e[k++]]),{a:c,b:d,c:h,d:w}=oe(c,d,h,w,n[t+e[k++]]),{a:c,b:d,c:h,d:w}=ce(c,d,h,w,n[t+e[k++]]),{a:i,b:f,c:l,d:U}=oe(i,f,l,U,n[t+e[k++]]),{a:i,b:f,c:l,d:U}=ce(i,f,l,U,n[t+e[k++]]);return{v0:s,v1:o,v2:c,v3:i,v4:f,v5:a,v6:u,v7:d,v8:h,v9:l,v10:y,v11:p,v12:b,v13:w,v14:U,v15:H}}const Pe=ss,en=new TextEncoder().encode("SS58PRE"),ct=2,tn=e=>{try{const t=Pt.decode(e),n=t.subarray(0,t[0]&64?2:1),r=t.subarray(n.length,t.length-ct),s=t.subarray(n.length+r.length),o=Pe(Uint8Array.of(...en,...n,...r),{dkLen:64}).subarray(0,ct);return s[0]===o[0]&&s[1]===o[1]?{isValid:!0,ss58Format:os(n),publicKey:r.slice()}:{isValid:!1}}catch{return{isValid:!1}}},os=e=>{const t=new DataView(e.buffer,e.byteOffset,e.byteLength);return t.byteLength===1?t.getUint8(0):t.getUint16(0)},nn=e=>{const t=e<64?Uint8Array.of(e):Uint8Array.of((e&252)>>2|64,e>>8|(e&3)<<6);return n=>{const r=Pe(Uint8Array.of(...en,...t,...n),{dkLen:64}).subarray(0,ct);return Pt.encode(Uint8Array.of(...t,...n,...r))}};function cs(e,t){return n=>{const r=tn(n);if(!r.isValid)throw new Error("Invalid checksum");const{publicKey:s}=r;if(s.length!==e)throw new Error("Invalid public key length");return s}}const it=(e=42,t=32)=>N(D(t),cs(t),nn(e)),rn="0123456789abcdef";function Y(e){const t=new Array(e.length+1);t[0]="0x";for(let n=0;n<e.length;){const r=e[n++];t[n]=rn[r>>4]+rn[r&15]}return t.join("")}const at={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function _e(e){const t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,s=new Uint8Array(r);t&&(s[0]=0|at[e[2]]);for(let o=0;o<r;){const c=n+o*2,i=at[e[c]],f=at[e[c+1]];s[t+o++]=i<<4|f}return s}function sn(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,t(r,n)]))}const pe=(...e)=>{const t=e.reduce((r,s)=>r+s.byteLength,0),n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const o=e[r];n.set(o,s),s+=o.byteLength}return n};var is=Object.defineProperty,on=e=>{throw TypeError(e)},as=(e,t,n)=>t in e?is(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Oe=(e,t,n)=>as(e,typeof t!="symbol"?t+"":t,n),cn=(e,t,n)=>t.has(e)||on("Cannot "+n),J=(e,t,n)=>(cn(e,t,"read from private field"),n?n.call(e):t.get(e)),Ue=(e,t,n)=>t.has(e)?on("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ge=(e,t,n,r)=>(cn(e,t,"write to private field"),t.set(e,n),n),Q,Te,qe,Ke,Fe;const us=new TextEncoder,ls=new TextDecoder,hs=X(R,D(1/0))[1];class Z{constructor(t,n=!1){if(Ue(this,Q),Ue(this,Te,null),Ue(this,qe,null),Ue(this,Ke,null),Ue(this,Fe,null),Oe(this,"asText",()=>J(this,Fe)??ge(this,Fe,ls.decode(J(this,Q)))),Oe(this,"asHex",()=>J(this,qe)||ge(this,qe,Y(J(this,Q)))),Oe(this,"asOpaqueHex",()=>J(this,Ke)||ge(this,Ke,Y(this.asBytes()))),Oe(this,"asBytes",()=>J(this,Q)),Oe(this,"asOpaqueBytes",()=>J(this,Te)||ge(this,Te,pe(R[0](J(this,Q).length),J(this,Q)))),n){try{const[r,s]=hs(t);if(r===s.length){ge(this,Q,s),ge(this,Te,t);return}}catch{}throw new Error("Invalid opaque bytes")}else ge(this,Q,t)}static fromText(t){return new this(us.encode(t))}static fromHex(t){return new this(_e(t))}static fromOpaqueHex(t){return new this(_e(t),!0)}static fromBytes(t){return new this(t)}static fromOpaqueBytes(t){return new this(t,!0)}}Q=new WeakMap,Te=new WeakMap,qe=new WeakMap,Ke=new WeakMap,Fe=new WeakMap;const[ds]=it();class an extends Z{constructor(t){super(t)}static fromArray(t){return new this(new Uint8Array(t))}static fromAccountId32(t){return new this(ds(t))}}const un=e=>{const t=D.enc(e);return n=>t(n.asBytes())},ln=e=>{const t=D.dec(e),n=e==null?Z:an;return r=>n.fromBytes(t(r))},Le=e=>I(un(e),ln(e));Le.enc=un,Le.dec=ln;const m=N(R,e=>e,Number),hn=N(R,e=>e,BigInt),fs=et(e=>{const t=m.dec(e),n=Math.ceil(t/8);return{bytes:D(n).dec(e),bitsLen:t}}),dn=I(e=>{if(e.bitsLen>e.bytes.length*8)throw new Error(`Not enough bytes. (bitsLen:${e.bitsLen}, bytesLen:${e.bytes.length})`);const t=m.enc(e.bitsLen),n=new Uint8Array(e.bytes.length+t.length);return n.set(t,0),n.set(e.bytes,t.length),n},fs),ys=N(T,e=>e.charCodeAt(0),String.fromCharCode),fn=e=>{const t=D.enc(e);return n=>t(_e(n))},yn=e=>{const t=D.dec(e);return n=>Y(t(n))},ue=e=>I(fn(e),yn(e));ue.enc=fn,ue.dec=yn;const ps=new TextEncoder,gs=new TextDecoder,bs=e=>N(D(e),t=>ps.encode(t),t=>gs.decode(t)),pn=e=>{let t=n=>{const r=e();return t=r,r(n)};return n=>t(n)},gn=e=>{let t=n=>{const r=e(),s=r;return t=r,s(n)};return n=>t(n)},bn=e=>I(pn(()=>e().enc),gn(()=>e().dec)),ut=Object.assign((e,t)=>({type:e,value:t}),{is(e,t){return e.type===t},as(e,t){if(t!==e.type)throw new Error(`Enum.as(enum, ${t}) used with actual type ${e.type}`);return e}}),ms=new Proxy({},{get(e,t){return n=>ut(t,n)}}),A=(e,t)=>{const n=e;return n.inner=t,n},mn=(...e)=>{const t=q.enc(...e);return A(n=>t({tag:n.type,value:n.value}),e[0])},vn=(...e)=>{const t=q.dec(...e);return A(n=>{const{tag:r,value:s}=t(n);return ut(r,s)},e[0])},be=(e,...t)=>A(I(mn(sn(e,([n])=>n),...t),vn(sn(e,([,n])=>n),...t)),e);be.enc=mn,be.dec=vn;const Xe=(e,...t)=>A(q(e,...t),e);Xe.enc=(e,...t)=>A(q.enc(e,...t),e),Xe.dec=(e,...t)=>A(q.dec(e,...t),e);const vs=BigInt(0),Ce=BigInt(1),ws=BigInt(2),Es=BigInt(7),xs=BigInt(256),Is=BigInt(113),wn=[],En=[],xn=[];for(let e=0,t=Ce,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],wn.push(2*(5*r+n)),En.push((e+1)*(e+2)/2%64);let s=vs;for(let o=0;o<7;o++)t=(t<<Ce^(t>>Es)*Is)%xs,t&ws&&(s^=Ce<<(Ce<<BigInt(o))-Ce);xn.push(s)}const In=zr(xn,!0),Bs=In[0],As=In[1],Bn=(e,t,n)=>n>32?es(e,t,n):Qr(e,t,n),An=(e,t,n)=>n>32?ts(e,t,n):Zr(e,t,n);function ks(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let c=0;c<10;c++)n[c]=e[c]^e[c+10]^e[c+20]^e[c+30]^e[c+40];for(let c=0;c<10;c+=2){const i=(c+8)%10,f=(c+2)%10,a=n[f],u=n[f+1],d=Bn(a,u,1)^n[i],h=An(a,u,1)^n[i+1];for(let l=0;l<50;l+=10)e[c+l]^=d,e[c+l+1]^=h}let s=e[2],o=e[3];for(let c=0;c<24;c++){const i=En[c],f=Bn(s,o,i),a=An(s,o,i),u=wn[c];s=e[u],o=e[u+1],e[u]=f,e[u+1]=a}for(let c=0;c<50;c+=10){for(let i=0;i<10;i++)n[i]=e[c+i];for(let i=0;i<10;i++)e[c+i]^=~n[(i+2)%10]&n[(i+4)%10]}e[0]^=Bs[r],e[1]^=As[r]}se(n)}class lt extends Ft{constructor(t,n,r,s=!1,o=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=o,xe(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=ye(this.state)}clone(){return this._cloneInto()}keccak(){V(this.state32),ks(this.state32,this.rounds),V(this.state32),this.posOut=0,this.pos=0}update(t){ke(this),t=z(t),fe(t);const{blockLen:n,state:r}=this,s=t.length;for(let o=0;o<s;){const c=Math.min(n-this.pos,s-o);for(let i=0;i<c;i++)r[this.pos++]^=t[o++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:s}=this;t[r]^=n,(n&128)!==0&&r===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){ke(this,!1),fe(t),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,o=t.length;s<o;){this.posOut>=r&&this.keccak();const c=Math.min(r-this.posOut,o-s);t.set(n.subarray(this.posOut,this.posOut+c),s),this.posOut+=c,s+=c}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return xe(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(ot(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,se(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:s,rounds:o,enableXOF:c}=this;return t||(t=new lt(n,r,s,c,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=r,t.outputLen=s,t.enableXOF=c,t.destroyed=this.destroyed,t}}const _s=(e,t,n)=>Pr(()=>new lt(t,e,n)),Os=_s(1,136,256/8),kn=e=>{const t=e.slice(2),n=Y(Os(t)).slice(2),r=new Array(40);for(let s=0;s<40;s++){const o=parseInt(n[s],16),c=t[s];r[s]=o>7?c.toUpperCase():c}return`0x${r.join("")}`},Us=D(20)[1],_n=I(e=>{const t=_e(e);if(t.length!==20)throw new Error(`Invalid length found on EthAddress(${e})`);const n=Y(t);if(e===n||e===n.toUpperCase())return t;if(kn(n)!==e)throw new Error(`Invalid checksum found on EthAddress(${e})`);return t},et(e=>kn(Y(Us(e))))),S=e=>A(E(e),e);S.enc=e=>A(E.enc(e),e),S.dec=e=>A(E.dec(e),e);const Se=(...e)=>A(X(...e),e);Se.enc=(...e)=>A(X.enc(...e),e),Se.dec=(...e)=>A(X.dec(...e),e);const le=(e,...t)=>A(B(e,...t),e);le.enc=(e,...t)=>A(B.enc(e,...t),e),le.dec=(e,...t)=>A(B.dec(e,...t),e);const ze=(e,t)=>A(Ae(e,t),{ok:e,ko:t});ze.enc=(e,t)=>A(Ae.enc(e,t),{ok:e,ko:t}),ze.dec=(e,t)=>A(Ae.dec(e,t),{ok:e,ko:t});const Ie=e=>A(K(e),e);Ie.enc=e=>A(K.enc(e),e),Ie.dec=e=>A(K.dec(e),e);const On=new TextEncoder,Un=new TextDecoder,Ts=N(D(4),On.encode.bind(On),Un.decode.bind(Un)),ht=S({engine:Ts,payload:ue()}),Ls=be({consensus:ht,seal:ht,preRuntime:ht,runtimeUpdated:v},[4,5,6,8]),dt=ue(32),Cs=S({parentHash:dt,number:m,stateRoot:dt,extrinsicRoot:dt,digests:le(Ls)}),ee=B(_),Tn=K(_),Ss=q({bool:v,char:v,str:v,u8:v,u16:v,u32:v,u64:v,u128:v,u256:v,i8:v,i16:v,i32:v,i64:v,i128:v,i256:v}),Ln=B(E({name:Tn,type:m,typeName:Tn,docs:ee})),Ds=E({len:re,type:m}),$s=E({bitStoreType:m,bitOrderType:m}),Vs=B(E({name:_,fields:Ln,index:T,docs:ee})),Ms=q({composite:Ln,variant:Vs,sequence:m,array:Ds,tuple:B(m),primitive:Ss,compact:m,bitSequence:$s}),Hs=E({name:_,type:K(m)}),Ns=B(Hs),Rs=E({id:m,path:ee,params:Ns,def:Ms,docs:ee}),Ge=B(Rs),js=q({Blake2128:v,Blake2256:v,Blake2128Concat:v,Twox128:v,Twox256:v,Twox64Concat:v,Identity:v}),Ps=B(js),qs=E({hashers:Ps,key:m,value:m}),Ks=E({name:_,modifier:T,type:q({plain:m,map:qs}),fallback:ue(),docs:ee}),Fs=K(E({prefix:_,items:B(Ks)})),Cn={name:_,storage:Fs,calls:K(m),events:K(m),constants:B(E({name:_,type:m,value:ue(),docs:ee})),errors:K(m),index:T},Xs={...Cn,docs:ee},zs=new Uint8Array,Sn=e=>I(()=>zs,()=>e),Gs=E({type:m,version:T,signedExtensions:B(E({identifier:_,type:m,additionalSigned:m}))}),Dn=E({lookup:Ge,pallets:B(E({...Cn,docs:Sn([])})),extrinsic:Gs,type:m,apis:Sn([])}),Ws=E({name:_,methods:B(E({name:_,inputs:B(E({name:_,type:m})),output:m,docs:ee})),docs:ee}),Ys=E({version:T,address:m,call:m,signature:m,extra:m,signedExtensions:B(E({identifier:_,type:m,additionalSigned:m}))}),$n=E({lookup:Ge,pallets:B(E(Xs)),extrinsic:Ys,type:m,apis:B(Ws),outerEnums:E({call:m,event:m,error:m}),custom:B(X(_,E({type:m,value:ue()})))}),Vn=()=>{throw new Error("Unsupported metadata version!")},M=I(Vn,Vn),De=E({magicNumber:re,metadata:q({v0:M,v1:M,v2:M,v3:M,v4:M,v5:M,v6:M,v7:M,v8:M,v9:M,v10:M,v11:M,v12:M,v13:M,v14:Dn,v15:$n})}),ft=D(),Js=K(ft),Qs=X(R,ft),Zs=e=>{try{return De.dec(e)}catch{}try{return De.dec(Js.dec(e))}catch{}try{return De.dec(ft.dec(e))}catch{}try{return De.dec(Qs.dec(e)[1])}catch{}throw null},eo={dkLen:32},yt=e=>Pe(e,eo),to={dkLen:16},pt=e=>Pe(e,to),Mn=e=>pe(pt(e),e),G={CHUNK_START:1,CHUNK_END:2,PARENT:4,ROOT:8,KEYED_HASH:16,DERIVE_KEY_CONTEXT:32,DERIVE_KEY_MATERIAL:64},te=Xr.slice(),Hn=(()=>{const e=Array.from({length:16},(r,s)=>s),t=r=>[2,6,3,10,7,0,4,13,1,11,12,5,9,14,15,8].map(s=>r[s]),n=[];for(let r=0,s=e;r<7;r++,s=t(s))n.push(...s);return Uint8Array.from(n)})();class gt extends Qt{constructor(t={},n=0){super(64,t.dkLen===void 0?32:t.dkLen),this.chunkPos=0,this.chunksDone=0,this.flags=0,this.stack=[],this.posOut=0,this.bufferOut32=new Uint32Array(16),this.chunkOut=0,this.enableXOF=!0;const{key:r,context:s}=t,o=s!==void 0;if(r!==void 0){if(o)throw new Error('Only "key" or "context" can be specified at same time');const c=z(r).slice();fe(c,32),this.IV=ye(c),V(this.IV),this.flags=n|G.KEYED_HASH}else if(o){const c=z(s),i=new gt({dkLen:32},G.DERIVE_KEY_CONTEXT).update(c).digest();this.IV=ye(i),V(this.IV),this.flags=n|G.DERIVE_KEY_MATERIAL}else this.IV=te.slice(),this.flags=n;this.state=this.IV.slice(),this.bufferOut=Nr(this.bufferOut32)}get(){return[]}set(){}b2Compress(t,n,r,s=0){const{state:o,pos:c}=this,{h:i,l:f}=je(BigInt(t),!0),{v0:a,v1:u,v2:d,v3:h,v4:l,v5:y,v6:p,v7:b,v8:w,v9:U,v10:H,v11:k,v12:ve,v13:Je,v14:Qe,v15:So}=Zt(Hn,s,r,7,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],te[0],te[1],te[2],te[3],i,f,c,n);o[0]=a^w,o[1]=u^U,o[2]=d^H,o[3]=h^k,o[4]=l^ve,o[5]=y^Je,o[6]=p^Qe,o[7]=b^So}compress(t,n=0,r=!1){let s=this.flags;if(this.chunkPos||(s|=G.CHUNK_START),(this.chunkPos===15||r)&&(s|=G.CHUNK_END),r||(this.pos=this.blockLen),this.b2Compress(this.chunksDone,s,t,n),this.chunkPos+=1,this.chunkPos===16||r){let o=this.state;this.state=this.IV.slice();for(let c,i=this.chunksDone+1;(r||!(i&1))&&(c=this.stack.pop());i>>=1)this.buffer32.set(c,0),this.buffer32.set(o,8),this.pos=this.blockLen,this.b2Compress(0,this.flags|G.PARENT,this.buffer32,0),o=this.state,this.state=this.IV.slice();this.chunksDone++,this.chunkPos=0,this.stack.push(o)}this.pos=0}_cloneInto(t){t=super._cloneInto(t);const{IV:n,flags:r,state:s,chunkPos:o,posOut:c,chunkOut:i,stack:f,chunksDone:a}=this;return t.state.set(s.slice()),t.stack=f.map(u=>Uint32Array.from(u)),t.IV.set(n),t.flags=r,t.chunkPos=o,t.chunksDone=a,t.posOut=c,t.chunkOut=i,t.enableXOF=this.enableXOF,t.bufferOut32.set(this.bufferOut32),t}destroy(){this.destroyed=!0,se(this.state,this.buffer32,this.IV,this.bufferOut32),se(...this.stack)}b2CompressOut(){const{state:t,pos:n,flags:r,buffer32:s,bufferOut32:o}=this,{h:c,l:i}=je(BigInt(this.chunkOut++));V(s);const{v0:f,v1:a,v2:u,v3:d,v4:h,v5:l,v6:y,v7:p,v8:b,v9:w,v10:U,v11:H,v12:k,v13:ve,v14:Je,v15:Qe}=Zt(Hn,0,s,7,t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],te[0],te[1],te[2],te[3],i,c,n,r);o[0]=f^b,o[1]=a^w,o[2]=u^U,o[3]=d^H,o[4]=h^k,o[5]=l^ve,o[6]=y^Je,o[7]=p^Qe,o[8]=t[0]^b,o[9]=t[1]^w,o[10]=t[2]^U,o[11]=t[3]^H,o[12]=t[4]^k,o[13]=t[5]^ve,o[14]=t[6]^Je,o[15]=t[7]^Qe,V(s),V(o),this.posOut=0}finish(){if(this.finished)return;this.finished=!0,se(this.buffer.subarray(this.pos));let t=this.flags|G.ROOT;this.stack.length?(t|=G.PARENT,V(this.buffer32),this.compress(this.buffer32,0,!0),V(this.buffer32),this.chunksDone=0,this.pos=this.blockLen):t|=(this.chunkPos?0:G.CHUNK_START)|G.CHUNK_END,this.flags=t,this.b2CompressOut()}writeInto(t){ke(this,!1),fe(t),this.finish();const{blockLen:n,bufferOut:r}=this;for(let s=0,o=t.length;s<o;){this.posOut>=n&&this.b2CompressOut();const c=Math.min(n-this.posOut,o-s);t.set(r.subarray(this.posOut,this.posOut+c),s),this.posOut+=c,s+=c}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible after digest call");return this.writeInto(t)}xof(t){return xe(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(ot(t,this),this.finished)throw new Error("digest() was already called");return this.enableXOF=!1,this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}}const no=Kr(e=>new gt(e)),ro={dkLen:32},Nn=e=>no(e,ro),so=e=>pe(Nn(e),e),Rn=e=>e,me=(e,t,n,r)=>new DataView(new Uint16Array([e,t,n,r]).buffer).getBigUint64(0,!0),bt=2n**64n-1n,$=(e,t)=>e<<t&bt|e>>64n-t,x=(e,t)=>e*t&bt,L=(e,t)=>e+t&bt,C=11400714785074694791n,j=14029467366897019727n,jn=1609587929392839161n,$e=9650029242287828579n,Pn=2870177450012600261n;function he(e,t=0n){let n=L(L(t,C),j),r=L(t,j),s=t,o=t-C,c=e.length,i=0,f=null;(function(){let l=0,y=l+c;if(c){if(f=new Uint8Array(32),c<32){f.set(e.subarray(0,c),i),i+=c;return}if(l<=y-32){const p=y-32;do{let b;b=me(e[l+1]<<8|e[l],e[l+3]<<8|e[l+2],e[l+5]<<8|e[l+4],e[l+7]<<8|e[l+6]),n=x($(L(n,x(b,j)),31n),C),l+=8,b=me(e[l+1]<<8|e[l],e[l+3]<<8|e[l+2],e[l+5]<<8|e[l+4],e[l+7]<<8|e[l+6]),r=x($(L(r,x(b,j)),31n),C),l+=8,b=me(e[l+1]<<8|e[l],e[l+3]<<8|e[l+2],e[l+5]<<8|e[l+4],e[l+7]<<8|e[l+6]),s=x($(L(s,x(b,j)),31n),C),l+=8,b=me(e[l+1]<<8|e[l],e[l+3]<<8|e[l+2],e[l+5]<<8|e[l+4],e[l+7]<<8|e[l+6]),o=x($(L(o,x(b,j)),31n),C),l+=8}while(l<=p)}l<y&&(f.set(e.subarray(l,y),i),i=y-l)}})(),e=f||e;let a,u=0;for(c>=32?(a=$(n,1n),a=L(a,$(r,7n)),a=L(a,$(s,12n)),a=L(a,$(o,18n)),n=x($(x(n,j),31n),C),a=a^n,a=L(x(a,C),$e),r=x($(x(r,j),31n),C),a=a^r,a=L(x(a,C),$e),s=x($(x(s,j),31n),C),a=a^s,a=L(x(a,C),$e),o=x($(x(o,j),31n),C),a=a^o,a=L(x(a,C),$e)):a=L(t,Pn),a=L(a,BigInt(c));u<=i-8;){let h=me(e[u+1]<<8|e[u],e[u+3]<<8|e[u+2],e[u+5]<<8|e[u+4],e[u+7]<<8|e[u+6]);h=x($(x(h,j),31n),C),a=L(x($(a^h,27n),C),$e),u+=8}if(u+4<=i){let h=x(me(e[u+1]<<8|e[u],e[u+3]<<8|e[u+2],0,0),C);a=L(x($(a^h,23n),j),jn),u+=4}for(;u<i;){const h=x(me(e[u++],0,0,0),Pn);a=x($(a^h,11n),C)}let d=a>>33n;return a=x(a^d,j),d=a>>29n,a=x(a^d,jn),d=a>>32n,a^=d,a}const We=e=>{const t=new Uint8Array(16),n=new DataView(t.buffer);return n.setBigUint64(0,he(e),!0),n.setBigUint64(8,he(e,1n),!0),t},qn=e=>{const t=new Uint8Array(32),n=new DataView(t.buffer);return n.setBigUint64(0,he(e),!0),n.setBigUint64(8,he(e,1n),!0),n.setBigUint64(16,he(e,2n),!0),n.setBigUint64(24,he(e,3n),!0),t},Kn=e=>pe(He.enc(he(e)),e),Fn=new TextEncoder,oo=new Map([[Rn,0],[Kn,8],[Mn,16],[pt,-16],[yt,-32],[We,-16],[qn,-32]]),co=e=>{const t=We(Fn.encode(e));return(n,...r)=>{const s=pe(t,We(Fn.encode(n))),o=Y(s),c=a=>{if(!a.startsWith(o))throw new Error(`key does not match this storage (${e}.${n})`);if(r.length===0)return[];const u=_e(a.slice(o.length)),d=new Array(r.length);for(let h=0,l=0;h<r.length;h++){const[y,p]=r[h],b=oo.get(p);if(b==null)throw new Error("Unknown hasher");if(b<0){const w=b*-1;d[h]=Y(u.slice(l,l+w)),l+=w}else l+=b,d[h]=y.dec(u.slice(l)),l+=y.enc(d[h]).length}return d},i=r.map(([{enc:a},u])=>d=>u(a(d)));return{enc:(...a)=>Y(pe(s,...a.map((u,d)=>i[d](u)))),dec:c}}},io=Z.fromText("modlpy/utilisuba").asBytes(),ao=({threshold:e,signatories:t})=>{const n=Xn(t),r=pe(io,R.enc(n.length),...n,Ee.enc(e));return yt(r)},Xn=e=>e.slice().sort((t,n)=>{for(let r=0;;r++){const s=r>=t.length,o=r>=n.length;if(s&&o)return 0;if(s)return-1;if(o)return 1;if(t[r]!==n[r])return t[r]>n[r]?1:-1}});var uo=Object.freeze({__proto__:null,AccountId:it,Bin:Le,Binary:Z,Blake2128:pt,Blake2128Concat:Mn,Blake2256:yt,Blake3256:Nn,Blake3256Concat:so,Bytes:D,Enum:ut,FixedSizeBinary:an,Hex:ue,Identity:Rn,Option:Ie,Result:ze,ScaleEnum:Xe,Self:bn,Storage:co,Struct:S,Tuple:Se,Twox128:We,Twox256:qn,Twox64Concat:Kn,Variant:be,Vector:le,_Enum:ms,_void:v,bitSequence:dn,blockHeader:Cs,bool:pr,char:ys,compact:R,compactBn:hn,compactNumber:m,createCodec:I,createDecoder:et,decAnyMetadata:Zs,enhanceCodec:N,enhanceDecoder:nt,enhanceEncoder:tt,ethAccount:_n,fixedStr:bs,fromBufferToBase58:nn,getMultisigAccountId:ao,getSs58AddressInfo:tn,h64:he,i128:dr,i16:ar,i256:yr,i32:ur,i64:lr,i8:ir,metadata:De,selfDecoder:gn,selfEncoder:pn,sortMultisigSignatories:Xn,str:_,u128:hr,u16:Ee,u256:fr,u32:re,u64:He,u8:T,v14:Dn,v14Lookup:Ge,v15:$n});const lo=(e,t,n)=>(r,s,o,...c)=>{const{id:i}=r;if(s.has(i))return s.get(i);if(o.has(i)){const a=t(()=>s.get(i),r,...c);return s.set(i,a),a}o.add(i);let f=e(r,s,o,...c);return o.delete(i),s.has(i)&&(f=n(f,s.get(i),r,...c)),s.set(i,f),f},ho=Le(),zn=lo((e,t,n,r)=>{if(e.type==="primitive")return uo[e.value];if(e.type==="void")return v;if(e.type==="AccountId32")return r;if(e.type==="AccountId20")return _n;if(e.type==="compact")return e.isBig?hn:m;if(e.type==="bitSequence")return dn;const s=l=>zn(l,t,n,r),o=(l,y)=>{const p=s(l);return y?le(p,y):le(p)},c=l=>Se(...l.map(s)),i=l=>{const y=Object.fromEntries(Object.entries(l).map(([p,b])=>[p,s(b)]));return S(y)};if(e.type==="sequence"&&e.value.type==="primitive"&&e.value.value==="u8")return ho;if(e.type==="array")return e.value.type==="primitive"&&e.value.value==="u8"?Le(e.len):o(e.value,e.len);if(e.type==="sequence")return o(e.value);if(e.type==="tuple")return c(e.value);if(e.type==="struct")return i(e.value);if(e.type==="option")return Ie(s(e.value));if(e.type==="result")return ze(s(e.value.ok),s(e.value.ko));const f=Object.values(e.value).map(l=>{switch(l.type){case"void":return v;case"lookupEntry":return s(l.value);case"tuple":return c(l.value);case"struct":return i(l.value);case"array":return o(l.value,l.len)}}),a=Object.fromEntries(Object.keys(e.value).map((l,y)=>[l,f[y]])),u=Object.values(e.value).map(l=>l.idx),h=u.every((l,y)=>l===y)?be(a):be(a,u);return e.byteLength?yo(h,e.byteLength):h},bn,e=>e),fo=(e,t=it())=>{const n=new Map,r=s=>zn(e(s),n,new Set,t);return s=>r(s)},yo=(e,t)=>{const n=D(t);return I(r=>n.enc(e.enc(r)),r=>e.dec(n.dec(r)))},po=e=>{const{metadata:t}=e,n=fo(e),r=(u="")=>{const d=e.storage[u];if(!d)throw new Error(`Storage entry ${u||"{root}"} not found`);const h=d.key==null?v:n(d.key);return{key:Gn(h,d.keyPrefix),value:n(d.typeId)}},s=u=>{const d=S(Object.fromEntries(u.args.map(h=>[h.label,n(h.type.type)])));return{call:Gn(d,u.selector),value:n(u.returnType.type)}},o=u=>{const d=t.spec.constructors.find(h=>h.label===u);if(!d)throw new Error(`Constructor ${u} not found`);return s(d)},c=u=>{const d=t.spec.messages.find(h=>h.label===u);if(!d)throw new Error(`Message ${u} not found`);return s(d)},i=u=>S(Object.fromEntries(u.args.map(d=>[d.label,n(d.type.type)])));return{buildConstructor:o,buildMessage:c,buildStorage:r,buildEvents:()=>be(Object.fromEntries(t.spec.events.map(u=>[u.label,i(u)]))),buildEvent:u=>{const d=t.spec.events,h=(y,p)=>N(y,b=>b.value,b=>({type:p,value:b}));if(u){const y=d.find(p=>p.signature_topic===u);return y?h(i(y),y.label):null}const l=d.filter(y=>y.signature_topic===u);return l.length?go(l.map(y=>h(i(y),y.label))):null}}},Gn=(e,t)=>{const n=Z.fromHex(t).asBytes(),r=Se(D(n.length),e);return N(r,s=>[n,s],([,s])=>s)},go=e=>I(t=>{for(const n of e)try{n.enc(t)}catch{}throw new Error("Unable to encode")},t=>{for(const n of e)try{n.dec(t)}catch{}throw new Error("Unable to decode")}),Wn=e=>N(Xe(e),t=>{if(typeof t=="string")return{tag:t,value:void 0};const[n,r]=Object.entries(t)[0];return{tag:n,value:r}},t=>({[t.tag]:t.value})),Ve=(e,t)=>N(le(e,t),n=>n??[],n=>n),Yn=Ie(_),Ye=Ve(_),bo=Wn({bool:v,char:v,str:v,u8:v,u16:v,u32:v,u64:v,u128:v,u256:v,i8:v,i16:v,i32:v,i64:v,i128:v,i256:v}),Jn=Ve(S({name:Yn,type:m,typeName:Yn,docs:Ye})),mo=S({len:re,type:m}),vo=S({bitStoreType:m,bitOrderType:m}),wo=Ve(S({name:_,fields:Jn,index:T,docs:Ye})),Eo=Wn({composite:S({fields:Jn}),variant:S({variants:wo}),sequence:S({type:m}),array:mo,tuple:le(m),primitive:bo,compact:m,bitSequence:vo}),xo=S({name:_,type:Ie(m)}),Io=Ve(xo),Bo=S({id:m,path:Ye,params:Io,def:Eo,docs:Ye}),Ao=N(Bo,e=>({id:e.id,path:e.type.path,params:e.type.params??[],def:e.type.def,docs:[]}),e=>({id:e.id,type:{def:e.def,path:e.path,params:e.params}})),ko=Ve(Ao),_o=e=>{const t=ko.enc(e.types),n=Ge.dec(t),r=e.spec.environment.accountId.type,s=n.find(i=>i.id===r);s&&(s.path=["AccountId32"]);const o=Oo(e,n),c=tr(n);return Object.assign(c,{metadata:e,lookup:n,storage:o})};function Oo(e,t){const n={},r=(s,o=[])=>{function c(f){const a=t.length;return t[a]={id:a,docs:[],def:f,params:[],path:[]},a}if("root"in s){const f=Number(e.version)===4?Z.fromBytes(Z.fromHex(s.root.root_key).asBytes().reverse()).asHex():s.root.root_key,a=r(s.root.layout,o);if(s.root.ty!=null){let u=function(d,h){const l=e.types[d].type,y="composite"in l.def?new Map((l.def.composite.fields??[]).map(b=>[b.name,b.type])):null,p=new Map((l.params??[]).map(b=>[b.name,b.type]));if(p.size===2&&p.has("V")&&y&&y.size===2&&y.has("len")&&y.has("elements")){u(y.get("len"),[...h,"len"]),u(y.get("elements"),h);return}else p.size===3&&p.has("K")&&p.has("V")?n[h.join(".")]={keyPrefix:f,key:p.get("K"),typeId:p.get("V")}:p.size===2&&p.has("V")&&(n[h.join(".")]={keyPrefix:f,key:null,typeId:p.get("V")})};u(s.root.ty,o)}return n[o.join(".")]||(n[o.join(".")]={keyPrefix:f,key:null,typeId:a}),c({tag:"composite",value:[]})}if("leaf"in s)return s.leaf.ty;if("hash"in s)throw new Error("HashLayout not implemented");if("array"in s){const f=r(s.array.layout,o);return f==null?null:c({tag:"array",value:{len:s.array.len,type:f}})}if("struct"in s){const f=s.struct.fields.map(a=>({name:a.name,type:r(a.layout,[...o,a.name]),typeName:void 0,docs:[]})).filter(a=>a.type!=null);return c({tag:"composite",value:f})}const i=Object.values(s.enum.variants).map((f,a)=>({name:f.name,fields:f.fields.map(u=>({name:u.name,type:r(u.layout,[...o,f.name,u.name]),typeName:void 0,docs:[]})).filter(u=>u.type!==null),index:a,docs:[]}));return c({tag:"variant",value:i})};return r(e.storage),n}const Uo=e=>{const t=_o(e.metadata),n=po(t),r=Zn(n.buildConstructor),s=Zn(n.buildMessage),o=a=>{const u=t.metadata.spec.constructors.find(d=>d.label===a);if(!u)throw new Error(`Constructor ${a} not found`);return u},c=a=>{const u=t.metadata.spec.messages.find(d=>d.label===a);if(!u)throw new Error(`Message ${a} not found`);return u},i=t.metadata.spec.constructors.find(a=>a.default)?.label,f=t.metadata.spec.messages.find(a=>a.default)?.label;return{constructor:a=>({attributes:Qn(o(a)),...r(a)}),defaultConstructor:i,message:a=>({attributes:Qn(c(a)),...s(a)}),defaultMessage:f,storage:To(n.buildStorage),event:Number(t.metadata.version)===4?Lo(n.buildEvents):Co(t,n.buildEvent)}},Qn=e=>({payable:e.payable,default:e.default,mutates:"mutates"in e?e.mutates:!0}),Zn=e=>t=>{const n=e(t);return{encode:r=>Z.fromBytes(n.call.enc(r||{})),decode:r=>n.value.dec(r.data.asBytes())}},To=e=>t=>{const n=e(t);return{encode:r=>Z.fromBytes(n.key.enc(r)),decode:r=>n.value.dec(r.asBytes())}},Lo=e=>{const t=r=>e().dec(r.data.asBytes());return{decode:t,filter:(r,s=[])=>s.map(c=>"event"in c?c.event:c).filter(c=>c.type==="Contracts"&&c.value.type==="ContractEmitted"&&c.value.value.contract===r).map(c=>{try{return t(c.value.value)}catch(i){throw console.error(`Contract ${r} emitted an incompatible event`,c.value.value),i}})}},Co=(e,t)=>{const n=new Set(e.metadata.spec.events.map(c=>c.signature_topic).filter(c=>c!=null)),r=e.metadata.spec.events.some(c=>c.signature_topic==null),s=(c,i)=>{if(i!=null){if(!n.has(i))throw new Error(`Event with signature topic ${c} not found`);return t(i).dec(c.data.asBytes())}if(!r)throw new Error("Event signature topic required");return t(void 0).dec(c.data.asBytes())};return{decode:s,filter:(c,i=[])=>i.map(a=>"event"in a?a:{event:a,topics:a.topics}).filter(a=>a.event.type==="Contracts"&&a.event.value.type==="ContractEmitted"&&a.event.value.value.contract===c).map(a=>{const u=a.topics.map(h=>h.asHex()),d=u.find(h=>n.has(h));try{return s(a.event.value.value,d)}catch{return console.error(`Contract ${c} emitted an incompatible event`,{event:a.event.value.value.data.asHex(),eventTopics:u,metadataEventTopics:[...n],hasAnonymousEvents:r}),null}}).filter(a=>a!==null)}};Be.getInkClient=Uo});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(R,W){typeof exports=="object"&&typeof module<"u"?W(exports):typeof define=="function"&&define.amd?define(["exports"],W):(R=typeof globalThis<"u"?globalThis:R||self,W(R.papiPjsSigner={}))})(this,function(R){"use strict";var W=Object.defineProperty,ot=(e,t,n)=>t in e?W(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ge=(e,t,n)=>(ot(e,typeof t!="symbol"?t+"":t,n),n),oe={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function it(e){const t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,s=new Uint8Array(r);t&&(s[0]=0|oe[e[2]]);for(let o=0;o<r;){const i=n+o*2,c=oe[e[i]],h=oe[e[i+1]];s[t+o++]=c<<4|h}return s}var ye=class extends Uint8Array{constructor(e){super(e),ge(this,"i",0),ge(this,"v"),this.v=new DataView(e)}},_=e=>t=>e(t instanceof ye?t:new ye(t instanceof Uint8Array?t.buffer:typeof t=="string"?it(t).buffer:t)),O=e=>{const t=e.length;let n=0;for(let s=0;s<t;s++)n+=e[s].length;const r=new Uint8Array(n);for(let s=0,o=0;s<t;s++){const i=e[s];r.set(i,o),o+=i.byteLength}return r};function Z(e,t){const n=Object.keys(e),r=n.length,s={};for(let o=0;o<r;o++){const i=n[o];s[i]=t(e[i],i)}return s}var B=(e,t)=>{const n=[e,t];return n.enc=e,n.dec=t,n},ie=(e,t)=>n=>e(t(n)),me=(e,t)=>n=>t(e(n)),ee=([e,t],n,r)=>B(ie(e,n),me(t,r));function ct(e,t){return _(n=>{const r=n.v[t](n.i,!0);return n.i+=e,r})}function at(e,t){return n=>{const r=new Uint8Array(e);return new DataView(r.buffer)[t](0,n,!0),r}}function H(e,t,n){return B(at(e,n),ct(e,t))}var I=H(1,"getUint8","setUint8"),te=H(2,"getUint16","setUint16"),M=H(4,"getUint32","setUint32"),we=H(8,"getBigUint64","setBigUint64");H(1,"getInt8","setInt8"),H(2,"getInt16","setInt16"),H(4,"getInt32","setInt32"),H(8,"getBigInt64","setBigInt64");var be=e=>{const t=new Uint8Array(16),n=new DataView(t.buffer);return n.setBigInt64(0,e,!0),n.setBigInt64(8,e>>64n,!0),t},xe=e=>_(t=>{const{v:n,i:r}=t,s=n.getBigUint64(r,!0),o=n[e](r+8,!0);return t.i+=16,o<<64n|s});B(be,xe("getBigUint64")),B(be,xe("getBigInt64"));var Ee=e=>{const t=new Uint8Array(32),n=new DataView(t.buffer);return n.setBigInt64(0,e,!0),n.setBigInt64(8,e>>64n,!0),n.setBigInt64(16,e>>128n,!0),n.setBigInt64(24,e>>192n,!0),t},Ae=e=>_(t=>{let n=t.v.getBigUint64(t.i,!0);return t.i+=8,n|=t.v.getBigUint64(t.i,!0)<<64n,t.i+=8,n|=t.v.getBigUint64(t.i,!0)<<128n,t.i+=8,n|=t.v[e](t.i,!0)<<192n,t.i+=8,n});B(Ee,Ae("getBigUint64")),B(Ee,Ae("getBigInt64")),ee(I,e=>e?1:0,Boolean);var ut=[I[1],te[1],M[1]],lt=_(e=>{const t=e[e.i],n=t&3;if(n<3)return ut[n](e)>>>2;const r=(t>>>2)+4;e.i++;let s=0n;const o=r/8|0;let i=0n;for(let h=0;h<o;h++)s=we[1](e)<<i|s,i+=64n;let c=r%8;return c>3&&(s=BigInt(M[1](e))<<i|s,i+=32n,c-=4),c>1&&(s=BigInt(te[1](e))<<i|s,i+=16n,c-=2),c&&(s=BigInt(I[1](e))<<i|s),s}),ht=1n<<56n,dt=1<<24,ft=256,vt=4294967295n,pt=64,gt=16384,yt=1<<30,mt=e=>{if(e<0)throw new Error(`Wrong compact input (${e})`);const t=Number(e)<<2;if(e<pt)return I[0](t);if(e<gt)return te[0](t|1);if(e<yt)return M[0](t|2);let n=[new Uint8Array(1)],r=BigInt(e);for(;r>=ht;)n.push(we[0](r)),r>>=64n;r>=dt&&(n.push(M[0](Number(r&vt))),r>>=32n);let s=Number(r);s>=ft&&(n.push(te[0](s)),s>>=16),s&&n.push(I[0](s));const o=O(n);return o[0]=o.length-5<<2|3,o},T=B(mt,lt),wt=new TextEncoder,bt=e=>{const t=wt.encode(e);return O([T.enc(t.length),t])},xt=new TextDecoder,Et=_(e=>{let t=T.dec(e);const n=new DataView(e.buffer,e.i,t);return e.i+=t,xt.decode(n)}),U=B(bt,Et),At=()=>{},Bt=new Uint8Array(0),x=B(()=>Bt,At),Be=e=>e===void 0?t=>O([T.enc(t.length),t]):t=>t.length===e?t:t.slice(0,e),ke=e=>_(t=>{const n=e===void 0?T.dec(t):e!==1/0?e:t.byteLength-t.i,r=new Uint8Array(t.buffer.slice(t.i,t.i+n));return t.i+=n,r}),K=e=>B(Be(e),ke(e));K.enc=Be,K.dec=ke;var Ie=(e,t)=>{const n=Object.keys(e),r=new Map(t?.map((o,i)=>[n[i],o])??n.map((o,i)=>[o,i])),s=o=>r.get(o);return({tag:o,value:i})=>O([I.enc(s(o)),e[o](i)])},Ue=(e,t)=>{const n=Object.keys(e),r=new Map(t?.map((s,o)=>[s,n[o]])??n.map((s,o)=>[o,s]));return _(s=>{const o=I.dec(s),i=r.get(o),c=e[i];return{tag:i,value:c(s)}})},q=(e,...t)=>B(Ie(Z(e,([n])=>n),...t),Ue(Z(e,([,n])=>n),...t));q.enc=Ie,q.dec=Ue;var Le=e=>_(t=>I[1](t)>0?e(t):void 0),Te=e=>t=>{const n=new Uint8Array(1);return t===void 0?n:(n[0]=1,O([n,e(t)]))},S=e=>B(Te(e[0]),Le(e[1]));S.enc=Te,S.dec=Le;var _e=(...e)=>_(t=>e.map(n=>n(t))),Se=(...e)=>t=>O(e.map((n,r)=>n(t[r]))),X=(...e)=>B(Se(...e.map(([t])=>t)),_e(...e.map(([,t])=>t)));X.enc=Se,X.dec=_e;var Ce=e=>{const t=Object.keys(e);return ie(X.enc(...Object.values(e)),n=>t.map(r=>n[r]))},Oe=e=>{const t=Object.keys(e);return me(X.dec(...Object.values(e)),n=>Object.fromEntries(n.map((r,s)=>[t[s],r])))},w=e=>B(Ce(Z(e,t=>t[0])),Oe(Z(e,t=>t[1])));w.enc=Ce,w.dec=Oe;var De=(e,t)=>t>=0?n=>O(n.map(e)):n=>O([T.enc(n.length),O(n.map(e))]),je=(e,t)=>_(n=>{const r=t>=0?t:T.dec(n),s=new Array(r);for(let o=0;o<r;o++)s[o]=e(n);return s}),E=(e,t)=>B(De(e[0],t),je(e[1],t));E.enc=De,E.dec=je;/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function kt(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function He(e,t){return Array.isArray(t)?t.length===0?!0:e?t.every(n=>typeof n=="string"):t.every(n=>Number.isSafeInteger(n)):!1}function ce(e,t){if(typeof t!="string")throw new Error(`${e}: string expected`);return!0}function Me(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function ae(e){if(!Array.isArray(e))throw new Error("array expected")}function Pe(e,t){if(!He(!0,t))throw new Error(`${e}: array of strings expected`)}function It(e,t){if(!He(!1,t))throw new Error(`${e}: array of numbers expected`)}function Ut(...e){const t=o=>o,n=(o,i)=>c=>o(i(c)),r=e.map(o=>o.encode).reduceRight(n,t),s=e.map(o=>o.decode).reduce(n,t);return{encode:r,decode:s}}function Lt(e){const t=typeof e=="string"?e.split(""):e,n=t.length;Pe("alphabet",t);const r=new Map(t.map((s,o)=>[s,o]));return{encode:s=>(ae(s),s.map(o=>{if(!Number.isSafeInteger(o)||o<0||o>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${o}". Allowed: ${e}`);return t[o]})),decode:s=>(ae(s),s.map(o=>{ce("alphabet.decode",o);const i=r.get(o);if(i===void 0)throw new Error(`Unknown letter: "${o}". Allowed: ${e}`);return i}))}}function Tt(e=""){return ce("join",e),{encode:t=>(Pe("join.decode",t),t.join(e)),decode:t=>(ce("join.decode",t),t.split(e))}}function Ve(e,t,n){if(t<2)throw new Error(`convertRadix: invalid from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: invalid to=${n}, base cannot be less than 2`);if(ae(e),!e.length)return[];let r=0;const s=[],o=Array.from(e,c=>{if(Me(c),c<0||c>=t)throw new Error(`invalid integer: ${c}`);return c}),i=o.length;for(;;){let c=0,h=!0;for(let p=r;p<i;p++){const d=o[p],l=t*c,a=l+d;if(!Number.isSafeInteger(a)||l/t!==c||a-d!==l)throw new Error("convertRadix: carry overflow");const y=a/n;c=a%n;const f=Math.floor(y);if(o[p]=f,!Number.isSafeInteger(f)||f*n+c!==a)throw new Error("convertRadix: carry overflow");if(h)f?h=!1:r=p;else continue}if(s.push(c),h)break}for(let c=0;c<e.length-1&&e[c]===0;c++)s.push(0);return s.reverse()}function _t(e){Me(e);const t=2**8;return{encode:n=>{if(!kt(n))throw new Error("radix.encode input should be Uint8Array");return Ve(Array.from(n),t,e)},decode:n=>(It("radix.decode",n),Uint8Array.from(Ve(n,e,t)))}}const Ne=(e=>Ut(_t(58),Lt(e),Tt("")))("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function ue(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function St(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function $e(e,...t){if(!St(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Re(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 Ct(e,t){$e(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ne(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}const F=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Ke(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const D=F?e=>e:e=>Ke(e);function G(e){for(let t=0;t<e.length;t++)e[t]=Ke(e[t])}function Ot(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function Y(e){return typeof e=="string"&&(e=Ot(e)),$e(e),e}class Dt{clone(){return this._cloneInto()}}function jt(e){const t=(r,s)=>e(s).update(Y(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}const Ht=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]);class Mt extends Dt{constructor(t,n,r={},s,o,i){if(super(),this.blockLen=t,this.outputLen=n,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,ue(t),ue(n),ue(s),n<0||n>s)throw new Error("outputLen bigger than keyLen");if(r.key!==void 0&&(r.key.length<1||r.key.length>s))throw new Error("key length must be undefined or 1.."+s);if(r.salt!==void 0&&r.salt.length!==o)throw new Error("salt must be undefined or "+o);if(r.personalization!==void 0&&r.personalization.length!==i)throw new Error("personalization must be undefined or "+i);this.buffer=new Uint8Array(t),this.buffer32=ne(this.buffer)}update(t){Re(this);const{blockLen:n,buffer:r,buffer32:s}=this;t=Y(t);const o=t.length,i=t.byteOffset,c=t.buffer;for(let h=0;h<o;){this.pos===n&&(F||G(s),this.compress(s,0,!1),F||G(s),this.pos=0);const p=Math.min(n-this.pos,o-h),d=i+h;if(p===n&&!(d%4)&&h+p<o){const l=new Uint32Array(c,d,Math.floor((o-h)/4));F||G(l);for(let a=0;h+n<o;a+=s.length,h+=n)this.length+=n,this.compress(l,a,!1);F||G(l);continue}r.set(t.subarray(h,h+p),this.pos),this.pos+=p,this.length+=p,h+=p}return this}digestInto(t){Re(this),Ct(t,this);const{pos:n,buffer32:r}=this;this.finished=!0,this.buffer.subarray(n).fill(0),F||G(r),this.compress(r,0,!0),F||G(r);const s=ne(t);this.get().forEach((o,i)=>s[i]=D(o))}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){const{buffer:n,length:r,finished:s,destroyed:o,outputLen:i,pos:c}=this;return t||(t=new this.constructor({dkLen:i})),t.set(...this.get()),t.length=r,t.finished=s,t.destroyed=o,t.outputLen=i,t.buffer.set(n),t.pos=c,t}}const re=BigInt(2**32-1),le=BigInt(32);function qe(e,t=!1){return t?{h:Number(e&re),l:Number(e>>le&re)}:{h:Number(e>>le&re)|0,l:Number(e&re)|0}}function Pt(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let s=0;s<e.length;s++){const{h:o,l:i}=qe(e[s],t);[n[s],r[s]]=[o,i]}return[n,r]}const Vt=(e,t)=>BigInt(e>>>0)<<le|BigInt(t>>>0),Nt=(e,t,n)=>e>>>n,$t=(e,t,n)=>e<<32-n|t>>>n,Rt=(e,t,n)=>e>>>n|t<<32-n,Kt=(e,t,n)=>e<<32-n|t>>>n,qt=(e,t,n)=>e<<64-n|t>>>n-32,Ft=(e,t,n)=>e>>>n-32|t<<64-n,Xt=(e,t)=>t,Gt=(e,t)=>e,zt=(e,t,n)=>e<<n|t>>>32-n,Wt=(e,t,n)=>t<<n|e>>>32-n,Yt=(e,t,n)=>t<<n-32|e>>>64-n,Jt=(e,t,n)=>e<<n-32|t>>>64-n;function Qt(e,t,n,r){const s=(t>>>0)+(r>>>0);return{h:e+n+(s/2**32|0)|0,l:s|0}}const k={fromBig:qe,split:Pt,toBig:Vt,shrSH:Nt,shrSL:$t,rotrSH:Rt,rotrSL:Kt,rotrBH:qt,rotrBL:Ft,rotr32H:Xt,rotr32L:Gt,rotlSH:zt,rotlSL:Wt,rotlBH:Yt,rotlBL:Jt,add:Qt,add3L:(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),add3H:(e,t,n,r)=>t+n+r+(e/2**32|0)|0,add4L:(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),add4H:(e,t,n,r,s)=>t+n+r+s+(e/2**32|0)|0,add5H:(e,t,n,r,s,o)=>t+n+r+s+o+(e/2**32|0)|0,add5L:(e,t,n,r,s)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(s>>>0)},A=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),u=new Uint32Array(32);function P(e,t,n,r,s,o){const i=s[o],c=s[o+1];let h=u[2*e],p=u[2*e+1],d=u[2*t],l=u[2*t+1],a=u[2*n],y=u[2*n+1],f=u[2*r],v=u[2*r+1],b=k.add3L(h,d,i);p=k.add3H(b,p,l,c),h=b|0,{Dh:v,Dl:f}={Dh:v^p,Dl:f^h},{Dh:v,Dl:f}={Dh:k.rotr32H(v,f),Dl:k.rotr32L(v,f)},{h:y,l:a}=k.add(y,a,v,f),{Bh:l,Bl:d}={Bh:l^y,Bl:d^a},{Bh:l,Bl:d}={Bh:k.rotrSH(l,d,24),Bl:k.rotrSL(l,d,24)},u[2*e]=h,u[2*e+1]=p,u[2*t]=d,u[2*t+1]=l,u[2*n]=a,u[2*n+1]=y,u[2*r]=f,u[2*r+1]=v}function V(e,t,n,r,s,o){const i=s[o],c=s[o+1];let h=u[2*e],p=u[2*e+1],d=u[2*t],l=u[2*t+1],a=u[2*n],y=u[2*n+1],f=u[2*r],v=u[2*r+1],b=k.add3L(h,d,i);p=k.add3H(b,p,l,c),h=b|0,{Dh:v,Dl:f}={Dh:v^p,Dl:f^h},{Dh:v,Dl:f}={Dh:k.rotrSH(v,f,16),Dl:k.rotrSL(v,f,16)},{h:y,l:a}=k.add(y,a,v,f),{Bh:l,Bl:d}={Bh:l^y,Bl:d^a},{Bh:l,Bl:d}={Bh:k.rotrBH(l,d,63),Bl:k.rotrBL(l,d,63)},u[2*e]=h,u[2*e+1]=p,u[2*t]=d,u[2*t+1]=l,u[2*n]=a,u[2*n+1]=y,u[2*r]=f,u[2*r+1]=v}class Zt extends Mt{constructor(t={}){super(128,t.dkLen===void 0?64:t.dkLen,t,64,16,16),this.v0l=A[0]|0,this.v0h=A[1]|0,this.v1l=A[2]|0,this.v1h=A[3]|0,this.v2l=A[4]|0,this.v2h=A[5]|0,this.v3l=A[6]|0,this.v3h=A[7]|0,this.v4l=A[8]|0,this.v4h=A[9]|0,this.v5l=A[10]|0,this.v5h=A[11]|0,this.v6l=A[12]|0,this.v6h=A[13]|0,this.v7l=A[14]|0,this.v7h=A[15]|0;const n=t.key?t.key.length:0;if(this.v0l^=this.outputLen|n<<8|65536|1<<24,t.salt){const r=ne(Y(t.salt));this.v4l^=D(r[0]),this.v4h^=D(r[1]),this.v5l^=D(r[2]),this.v5h^=D(r[3])}if(t.personalization){const r=ne(Y(t.personalization));this.v6l^=D(r[0]),this.v6h^=D(r[1]),this.v7l^=D(r[2]),this.v7h^=D(r[3])}if(t.key){const r=new Uint8Array(this.blockLen);r.set(Y(t.key)),this.update(r)}}get(){let{v0l:t,v0h:n,v1l:r,v1h:s,v2l:o,v2h:i,v3l:c,v3h:h,v4l:p,v4h:d,v5l:l,v5h:a,v6l:y,v6h:f,v7l:v,v7h:b}=this;return[t,n,r,s,o,i,c,h,p,d,l,a,y,f,v,b]}set(t,n,r,s,o,i,c,h,p,d,l,a,y,f,v,b){this.v0l=t|0,this.v0h=n|0,this.v1l=r|0,this.v1h=s|0,this.v2l=o|0,this.v2h=i|0,this.v3l=c|0,this.v3h=h|0,this.v4l=p|0,this.v4h=d|0,this.v5l=l|0,this.v5h=a|0,this.v6l=y|0,this.v6h=f|0,this.v7l=v|0,this.v7h=b|0}compress(t,n,r){this.get().forEach((h,p)=>u[p]=h),u.set(A,16);let{h:s,l:o}=k.fromBig(BigInt(this.length));u[24]=A[8]^o,u[25]=A[9]^s,r&&(u[28]=~u[28],u[29]=~u[29]);let i=0;const c=Ht;for(let h=0;h<12;h++)P(0,4,8,12,t,n+2*c[i++]),V(0,4,8,12,t,n+2*c[i++]),P(1,5,9,13,t,n+2*c[i++]),V(1,5,9,13,t,n+2*c[i++]),P(2,6,10,14,t,n+2*c[i++]),V(2,6,10,14,t,n+2*c[i++]),P(3,7,11,15,t,n+2*c[i++]),V(3,7,11,15,t,n+2*c[i++]),P(0,5,10,15,t,n+2*c[i++]),V(0,5,10,15,t,n+2*c[i++]),P(1,6,11,12,t,n+2*c[i++]),V(1,6,11,12,t,n+2*c[i++]),P(2,7,8,13,t,n+2*c[i++]),V(2,7,8,13,t,n+2*c[i++]),P(3,4,9,14,t,n+2*c[i++]),V(3,4,9,14,t,n+2*c[i++]);this.v0l^=u[0]^u[16],this.v0h^=u[1]^u[17],this.v1l^=u[2]^u[18],this.v1h^=u[3]^u[19],this.v2l^=u[4]^u[20],this.v2h^=u[5]^u[21],this.v3l^=u[6]^u[22],this.v3h^=u[7]^u[23],this.v4l^=u[8]^u[24],this.v4h^=u[9]^u[25],this.v5l^=u[10]^u[26],this.v5h^=u[11]^u[27],this.v6l^=u[12]^u[28],this.v6h^=u[13]^u[29],this.v7l^=u[14]^u[30],this.v7h^=u[15]^u[31],u.fill(0)}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const he=jt(e=>new Zt(e)),Fe=new TextEncoder().encode("SS58PRE"),de=2,en=e=>{try{const t=Ne.decode(e),n=t.subarray(0,t[0]&64?2:1),r=t.subarray(n.length,t.length-de),s=t.subarray(n.length+r.length),o=he(Uint8Array.of(...Fe,...n,...r),{dkLen:64}).subarray(0,de);return s[0]===o[0]&&s[1]===o[1]?{isValid:!0,ss58Format:tn(n),publicKey:r.slice()}:{isValid:!1}}catch{return{isValid:!1}}},tn=e=>{const t=new DataView(e.buffer,e.byteOffset,e.byteLength);return t.byteLength===1?t.getUint8(0):t.getUint16(0)},nn=e=>{const t=e<64?Uint8Array.of(e):Uint8Array.of((e&252)>>2|64,e>>8|(e&3)<<6);return n=>{const r=he(Uint8Array.of(...Fe,...t,...n),{dkLen:64}).subarray(0,de);return Ne.encode(Uint8Array.of(...t,...n,...r))}};function rn(e,t){return n=>{const r=en(n);if(!r.isValid)throw new Error("Invalid checksum");const{publicKey:s}=r;if(s.length!==e)throw new Error("Invalid public key length");return s}}const sn=(e=42,t=32)=>ee(K(t),rn(t),nn(e)),Xe="0123456789abcdef";function N(e){const t=new Array(e.length+1);t[0]="0x";for(let n=0;n<e.length;){const r=e[n++];t[n]=Xe[r>>4]+Xe[r&15]}return t.join("")}const fe={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function J(e){const t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,s=new Uint8Array(r);t&&(s[0]=0|fe[e[2]]);for(let o=0;o<r;){const i=n+o*2,c=fe[e[i]],h=fe[e[i+1]];s[t+o++]=c<<4|h}return s}const Ge=(...e)=>{const t=e.reduce((r,s)=>r+s.byteLength,0),n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const o=e[r];n.set(o,s),s+=o.byteLength}return n},g=ee(T,e=>e,Number),on=ee(T,e=>e,BigInt),ze=e=>{const t=K.enc(e);return n=>t(J(n))},We=e=>{const t=K.dec(e);return n=>N(t(n))},Q=e=>B(ze(e),We(e));Q.enc=ze,Q.dec=We;const j=E(U),Ye=S(U),cn=q({bool:x,char:x,str:x,u8:x,u16:x,u32:x,u64:x,u128:x,u256:x,i8:x,i16:x,i32:x,i64:x,i128:x,i256:x}),Je=E(w({name:Ye,type:g,typeName:Ye,docs:j})),an=w({len:M,type:g}),un=w({bitStoreType:g,bitOrderType:g}),ln=E(w({name:U,fields:Je,index:I,docs:j})),hn=q({composite:Je,variant:ln,sequence:g,array:an,tuple:E(g),primitive:cn,compact:g,bitSequence:un}),dn=w({name:U,type:S(g)}),fn=E(dn),vn=w({id:g,path:j,params:fn,def:hn,docs:j}),Qe=E(vn),pn=q({Blake2128:x,Blake2256:x,Blake2128Concat:x,Twox128:x,Twox256:x,Twox64Concat:x,Identity:x}),gn=E(pn),yn=w({hashers:gn,key:g,value:g}),mn=w({name:U,modifier:I,type:q({plain:g,map:yn}),fallback:Q(),docs:j}),wn=S(w({prefix:U,items:E(mn)})),Ze={name:U,storage:wn,calls:S(g),events:S(g),constants:E(w({name:U,type:g,value:Q(),docs:j})),errors:S(g),index:I},bn={...Ze,docs:j},xn=new Uint8Array,et=e=>B(()=>xn,()=>e),En=w({type:g,version:I,signedExtensions:E(w({identifier:U,type:g,additionalSigned:g}))}),An=w({lookup:Qe,pallets:E(w({...Ze,docs:et([])})),extrinsic:En,type:g,apis:et([])}),Bn=w({name:U,methods:E(w({name:U,inputs:E(w({name:U,type:g})),output:g,docs:j})),docs:j}),kn=w({version:I,address:g,call:g,signature:g,extra:g,signedExtensions:E(w({identifier:U,type:g,additionalSigned:g}))}),In=w({lookup:Qe,pallets:E(w(bn)),extrinsic:kn,type:g,apis:E(Bn),outerEnums:w({call:g,event:g,error:g}),custom:E(X(U,w({type:g,value:Q()})))}),tt=()=>{throw new Error("Unsupported metadata version!")},L=B(tt,tt),se=w({magicNumber:M,metadata:q({v0:L,v1:L,v2:L,v3:L,v4:L,v5:L,v6:L,v7:L,v8:L,v9:L,v10:L,v11:L,v12:L,v13:L,v14:An,v15:In})}),ve=K(),Un=S(ve),Ln=X(T,ve),Tn=e=>{try{return se.dec(e)}catch{}try{return se.dec(Un.dec(e))}catch{}try{return se.dec(ve.dec(e))}catch{}try{return se.dec(Ln.dec(e)[1])}catch{}throw null},_n={dkLen:32},Sn=e=>he(e,_n),nt=(e,t)=>e.type==="array"&&e.len===t&&e.value.type==="primitive"&&e.value.value==="u8",$={type:"void"},Cn=(e,t=()=>null)=>{const n=new Map,r=new Set,s=d=>l=>{let a=n.get(l);if(a)return a;if(r.has(l)){const f={id:l};return n.set(l,f),f}r.add(l);const y=d(l);return a=n.get(l),a?Object.assign(a,y):(a={id:l,...y},n.set(l,a)),r.delete(l),a};let o=!0,i=!0;const c=s(d=>{const l=t(e[d]);if(l)return l;const{def:a,path:y,params:f}=e[d];if(a.tag==="composite"){if(a.value.length===0)return $;if(a.value.length===1){const v=c(a.value[0].type);return o&&y.at(-1)==="AccountId32"&&nt(v,32)?(o=!1,{type:"AccountId32"}):i&&y.at(-1)==="AccountId20"&&nt(v,20)?(i=!1,{type:"AccountId20"}):v}return h(a.value)}if(a.tag==="variant"){if(y.length===1&&y[0]==="Option"&&f.length===1&&f[0].name==="T"){const m=c(f[0].type);return m.type==="void"?{type:"primitive",value:"bool"}:{type:"option",value:m}}if(y.length===1&&y[0]==="Result"&&f.length===2&&f[0].name==="T"&&f[1].name==="E")return{type:"result",value:{ok:c(f[0].type),ko:c(f[1].type)}};if(a.value.length===0)return $;const v={},b={};return a.value.forEach(m=>{const C=m.name;if(b[C]=m.docs,m.fields.length===0){v[C]={...$,idx:m.index};return}if(m.fields.length===1&&!m.fields[0].name){v[C]={type:"lookupEntry",value:c(m.fields[0].type),idx:m.index};return}v[C]={...h(m.fields),idx:m.index}}),{type:"enum",value:v,innerDocs:b}}if(a.tag==="sequence")return{type:"sequence",value:c(a.value)};if(a.tag==="array"){const{len:v}=a.value,b=c(a.value.type);return!v||b.type==="void"?$:v>1?{type:"array",value:b,len:a.value.len}:b}if(a.tag==="tuple")return a.value.length===0?$:a.value.length>1?p(a.value.map(v=>c(v)),a.value.map(v=>e[v].docs)):c(a.value[0]);if(a.tag==="primitive")return{type:"primitive",value:a.value.tag};if(a.tag==="compact"){const v=c(a.value);return v.type==="void"?$:{type:"compact",isBig:Number(v.value.slice(1))>32,size:v.value}}return{type:a.tag}}),h=d=>{let l=!0;const a={},y={};return d.forEach((f,v)=>{l=l&&!!f.name;const b=f.name||v,m=c(f.type);m.type!=="void"&&(a[b]=m,y[b]=f.docs)}),l?{type:"struct",value:a,innerDocs:y}:p(Object.values(a),Object.values(y))},p=(d,l)=>{if(d.every(a=>a.id===d[0].id)&&l.every(a=>!a.length)){const[a]=d;return a.type==="void"?$:{type:"array",value:d[0],len:d.length}}return{type:"tuple",value:d,innerDocs:l}};return c},On=e=>{const t=Cn(e.lookup,({def:s})=>{if(s.tag==="composite"){const o=n(s);if(o)return{type:"enum",innerDocs:{},value:Object.fromEntries(e.pallets.map(i=>[i.name,i.errors==null?{...$,idx:i.index}:{type:"lookupEntry",value:t(i.errors),idx:i.index}])),byteLength:o}}return null});function n(s){if(!(s.value.length===2&&s.value[0].name==="index"&&s.value[1].name==="error"))return null;const i=t(s.value[0].type),c=t(s.value[1].type);return i.type==="primitive"&&i.value==="u8"&&c.type==="array"&&c.value.type==="primitive"&&c.value.value==="u8"?1+c.len:null}return Object.assign(t,{metadata:e,call:"outerEnums"in e?e.outerEnums.call:e.lookup[e.extrinsic?.type]?.params.find(i=>i.name==="Call")?.type??null})},Dn=ie(I.enc,e=>+!!e.signed<<7|e.version),pe=()=>new Error("Unkown signer"),jn=e=>{const{extrinsic:t}=e,n=On(e);let r,s;if("address"in t)r=n(t.address),s=n(t.signature);else{const o=Object.fromEntries(e.lookup[t.type].params.filter(i=>i.type!=null).map(i=>[i.name,n(i.type)]));if(r=o.Address,s=o.Signature,!r||!s)throw pe()}if(r.type==="AccountId20"&&s.type==="array"&&s.len===65&&s.value.type==="primitive"&&s.value.value==="u8")return[1,[]];if(s.type!=="enum"||["Ecdsa","Ed25519","Sr25519"].some(o=>!(o in s.value)))throw pe();if(r.type==="enum"){const o=r.value.Id;if(o.type==="lookupEntry"&&o.value.type==="AccountId32")return[0,[o.idx]]}else if(r.type==="AccountId32")return[0,[]];throw pe()},Hn=(e,t,n,r,s,o)=>{const[i,c]=jn(e),h=Ge(Dn({signed:!0,version:4}),i===1?t:new Uint8Array([...c,...t]),n,...r,s);return Ge(T.enc(h.length),h)},z=(e,t)=>{let n=e.toString(16);n=(n.length%2?"0":"")+n;const r=Math.max(0,(t||0)-n.length/2);return"0x"+"00".repeat(r)+n},Mn=({additionalSigned:e})=>({genesisHash:N(e)}),Pn=({value:e})=>({nonce:z(T.dec(e),4)}),Vn=({additionalSigned:e})=>({transactionVersion:z(M.dec(e),4)}),Nn=w({tip:T,asset:S(K(1/0))}).dec;var rt=Object.freeze({__proto__:null,ChargeAssetTxPayment:({value:e})=>{const{tip:t,asset:n}=Nn(e);return{...n?{assetId:N(n)}:{},tip:z(t,16)}},ChargeTransactionPayment:({value:e})=>({tip:z(on.dec(e),16)}),CheckGenesis:Mn,CheckMetadataHash:({value:e,additionalSigned:t})=>e.length&&e[0]?{mode:1,metadataHash:N(t.length?t.slice(1):t)}:{},CheckMortality:({value:e,additionalSigned:t},n)=>({era:N(e),blockHash:N(t),blockNumber:z(n,4)}),CheckNonce:Pn,CheckSpecVersion:({additionalSigned:e})=>({specVersion:z(M.dec(e),4)}),CheckTxVersion:Vn});const $n=sn().enc,Rn=e=>e.startsWith("0x")?J(e):$n(e);function st(e,t,n){const r=i=>n({address:e,data:N(i),type:"bytes"}).then(({signature:c})=>J(c)),s=Rn(e);return{publicKey:s,signTx:async(i,c,h,p,d=Sn)=>{let l;try{const m=Tn(h);if(m.metadata.tag!=="v14"&&m.metadata.tag!=="v15")throw null;l=m.metadata.value}catch{throw new Error("Unsupported metadata version")}const a={};a.signedExtensions=[];const{version:y}=l.extrinsic,f=[];l.extrinsic.signedExtensions.map(({identifier:m})=>{const C=c[m];if(!C)throw new Error(`Missing ${m} signed-extension`);if(f.push(C.value),a.signedExtensions.push(m),!rt[m]){if(C.value.length===0&&C.additionalSigned.length===0)return;throw new Error(`PJS does not support this signed-extension: ${m}`)}Object.assign(a,rt[m](C,p))}),a.address=e,a.method=N(i),a.version=y,a.withSignedTransaction=!0;const v=await t(a),b=v.signedTransaction;return b?typeof b=="string"?J(b):b:Hn(l,s,J(v.signature),f,i)},signBytes:r}}const Kn=new Set(["ed25519","sr25519","ecdsa","ethereum"]),qn=async(e,t)=>{let n=window.injectedWeb3?.[e];if(!n)throw new Error(`Unavailable extension: "${e}"`);const r=await n.enable(t),s=r.signer.signPayload.bind(r.signer),o=r.signer.signRaw.bind(r.signer),i=d=>d.filter(({type:l})=>Kn.has(l)).map(l=>{const a=st(l.address,s,o);return{...l,polkadotSigner:a}});let c=i(await r.accounts.get());const h=new Set,p=r.accounts.subscribe(d=>{c=i(d),h.forEach(l=>{l(c)})});return{name:e,getAccounts:()=>c,subscribe:d=>(h.add(d),()=>{h.delete(d)}),disconnect:()=>{p()}}},Fn=()=>{const{injectedWeb3:e}=window;return e?Object.keys(e):[]};R.connectInjectedExtension=qn,R.getInjectedExtensions=Fn,R.getPolkadotSignerFromPjs=st});
|
|
1
|
+
(function(H,W){typeof exports=="object"&&typeof module<"u"?W(exports):typeof define=="function"&&define.amd?define(["exports"],W):(H=typeof globalThis<"u"?globalThis:H||self,W(H.papiPjsSigner={}))})(this,function(H){"use strict";var W=Object.defineProperty,dt=(e,t,n)=>t in e?W(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,me=(e,t,n)=>(dt(e,typeof t!="symbol"?t+"":t,n),n),se={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function ft(e){const t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,s=new Uint8Array(r);t&&(s[0]=0|se[e[2]]);for(let o=0;o<r;){const i=n+o*2,c=se[e[i]],h=se[e[i+1]];s[t+o++]=c<<4|h}return s}var we=class extends Uint8Array{constructor(e){super(e),me(this,"i",0),me(this,"v"),this.v=new DataView(e)}},C=e=>t=>e(t instanceof we?t:new we(t instanceof Uint8Array?t.buffer:typeof t=="string"?ft(t).buffer:t)),L=e=>{const t=e.length;let n=0;for(let s=0;s<t;s++)n+=e[s].length;const r=new Uint8Array(n);for(let s=0,o=0;s<t;s++){const i=e[s];r.set(i,o),o+=i.byteLength}return r};function Q(e,t){const n=Object.keys(e),r=n.length,s={};for(let o=0;o<r;o++){const i=n[o];s[i]=t(e[i],i)}return s}var B=(e,t)=>{const n=[e,t];return n.enc=e,n.dec=t,n},oe=(e,t)=>n=>e(t(n)),be=(e,t)=>n=>t(e(n)),Z=([e,t],n,r)=>B(oe(e,n),be(t,r));function pt(e,t){return C(n=>{const r=n.v[t](n.i,!0);return n.i+=e,r})}function vt(e,t){return n=>{const r=new Uint8Array(e);return new DataView(r.buffer)[t](0,n,!0),r}}function j(e,t,n){return B(vt(e,n),pt(e,t))}var k=j(1,"getUint8","setUint8"),ee=j(2,"getUint16","setUint16"),M=j(4,"getUint32","setUint32"),xe=j(8,"getBigUint64","setBigUint64");j(1,"getInt8","setInt8"),j(2,"getInt16","setInt16"),j(4,"getInt32","setInt32"),j(8,"getBigInt64","setBigInt64");var Ee=e=>{const t=new Uint8Array(16),n=new DataView(t.buffer);return n.setBigInt64(0,e,!0),n.setBigInt64(8,e>>64n,!0),t},Ae=e=>C(t=>{const{v:n,i:r}=t,s=n.getBigUint64(r,!0),o=n[e](r+8,!0);return t.i+=16,o<<64n|s});B(Ee,Ae("getBigUint64")),B(Ee,Ae("getBigInt64"));var Be=e=>{const t=new Uint8Array(32),n=new DataView(t.buffer);return n.setBigInt64(0,e,!0),n.setBigInt64(8,e>>64n,!0),n.setBigInt64(16,e>>128n,!0),n.setBigInt64(24,e>>192n,!0),t},ke=e=>C(t=>{let n=t.v.getBigUint64(t.i,!0);return t.i+=8,n|=t.v.getBigUint64(t.i,!0)<<64n,t.i+=8,n|=t.v.getBigUint64(t.i,!0)<<128n,t.i+=8,n|=t.v[e](t.i,!0)<<192n,t.i+=8,n});B(Be,ke("getBigUint64")),B(Be,ke("getBigInt64")),Z(k,e=>e?1:0,Boolean);var gt=[k[1],ee[1],M[1]],yt=C(e=>{const t=e[e.i],n=t&3;if(n<3)return gt[n](e)>>>2;const r=(t>>>2)+4;e.i++;let s=0n;const o=r/8|0;let i=0n;for(let h=0;h<o;h++)s=xe[1](e)<<i|s,i+=64n;let c=r%8;return c>3&&(s=BigInt(M[1](e))<<i|s,i+=32n,c-=4),c>1&&(s=BigInt(ee[1](e))<<i|s,i+=16n,c-=2),c&&(s=BigInt(k[1](e))<<i|s),s}),mt=1n<<56n,wt=1<<24,bt=256,xt=4294967295n,Et=64,At=16384,Bt=1<<30,kt=e=>{if(e<0)throw new Error(`Wrong compact input (${e})`);const t=Number(e)<<2;if(e<Et)return k[0](t);if(e<At)return ee[0](t|1);if(e<Bt)return M[0](t|2);let n=[new Uint8Array(1)],r=BigInt(e);for(;r>=mt;)n.push(xe[0](r)),r>>=64n;r>=wt&&(n.push(M[0](Number(r&xt))),r>>=32n);let s=Number(r);s>=bt&&(n.push(ee[0](s)),s>>=16),s&&n.push(k[0](s));const o=L(n);return o[0]=o.length-5<<2|3,o},T=B(kt,yt),It=new TextEncoder,Ut=e=>{const t=It.encode(e);return L([T.enc(t.length),t])},Tt=new TextDecoder,_t=C(e=>{let t=T.dec(e);const n=new DataView(e.buffer,e.i,t);return e.i+=t,Tt.decode(n)}),I=B(Ut,_t),Ct=()=>{},Ot=new Uint8Array(0),x=B(()=>Ot,Ct),Ie=e=>e===void 0?t=>L([T.enc(t.length),t]):t=>t.length===e?t:t.slice(0,e),Ue=e=>C(t=>{const n=e===void 0?T.dec(t):e!==1/0?e:t.byteLength-t.i,r=new Uint8Array(t.buffer.slice(t.i,t.i+n));return t.i+=n,r}),R=e=>B(Ie(e),Ue(e));R.enc=Ie,R.dec=Ue;var Te=(e,t)=>{const n=Object.keys(e),r=new Map(t?.map((o,i)=>[n[i],o])??n.map((o,i)=>[o,i])),s=o=>r.get(o);return({tag:o,value:i})=>L([k.enc(s(o)),e[o](i)])},_e=(e,t)=>{const n=Object.keys(e),r=new Map(t?.map((s,o)=>[s,n[o]])??n.map((s,o)=>[o,s]));return C(s=>{const o=k.dec(s),i=r.get(o),c=e[i];return{tag:i,value:c(s)}})},K=(e,...t)=>B(Te(Q(e,([n])=>n),...t),_e(Q(e,([,n])=>n),...t));K.enc=Te,K.dec=_e;var Ce=e=>C(t=>k[1](t)>0?e(t):void 0),Oe=e=>t=>{const n=new Uint8Array(1);return t===void 0?n:(n[0]=1,L([n,e(t)]))},_=e=>B(Oe(e[0]),Ce(e[1]));_.enc=Oe,_.dec=Ce;var Le=(...e)=>C(t=>e.map(n=>n(t))),De=(...e)=>t=>L(e.map((n,r)=>n(t[r]))),q=(...e)=>B(De(...e.map(([t])=>t)),Le(...e.map(([,t])=>t)));q.enc=De,q.dec=Le;var Se=e=>{const t=Object.keys(e);return oe(q.enc(...Object.values(e)),n=>t.map(r=>n[r]))},je=e=>{const t=Object.keys(e);return be(q.dec(...Object.values(e)),n=>Object.fromEntries(n.map((r,s)=>[t[s],r])))},m=e=>B(Se(Q(e,t=>t[0])),je(Q(e,t=>t[1])));m.enc=Se,m.dec=je;var Me=(e,t)=>t>=0?n=>L(n.map(e)):n=>L([T.enc(n.length),L(n.map(e))]),Pe=(e,t)=>C(n=>{const r=t>=0?t:T.dec(n),s=new Array(r);for(let o=0;o<r;o++)s[o]=e(n);return s}),E=(e,t)=>B(Me(e[0],t),Pe(e[1],t));E.enc=Me,E.dec=Pe;/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Lt(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Ve(e,t){return Array.isArray(t)?t.length===0?!0:e?t.every(n=>typeof n=="string"):t.every(n=>Number.isSafeInteger(n)):!1}function ie(e,t){if(typeof t!="string")throw new Error(`${e}: string expected`);return!0}function Ne(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function ce(e){if(!Array.isArray(e))throw new Error("array expected")}function $e(e,t){if(!Ve(!0,t))throw new Error(`${e}: array of strings expected`)}function Dt(e,t){if(!Ve(!1,t))throw new Error(`${e}: array of numbers expected`)}function St(...e){const t=o=>o,n=(o,i)=>c=>o(i(c)),r=e.map(o=>o.encode).reduceRight(n,t),s=e.map(o=>o.decode).reduce(n,t);return{encode:r,decode:s}}function jt(e){const t=typeof e=="string"?e.split(""):e,n=t.length;$e("alphabet",t);const r=new Map(t.map((s,o)=>[s,o]));return{encode:s=>(ce(s),s.map(o=>{if(!Number.isSafeInteger(o)||o<0||o>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${o}". Allowed: ${e}`);return t[o]})),decode:s=>(ce(s),s.map(o=>{ie("alphabet.decode",o);const i=r.get(o);if(i===void 0)throw new Error(`Unknown letter: "${o}". Allowed: ${e}`);return i}))}}function Mt(e=""){return ie("join",e),{encode:t=>($e("join.decode",t),t.join(e)),decode:t=>(ie("join.decode",t),t.split(e))}}function He(e,t,n){if(t<2)throw new Error(`convertRadix: invalid from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: invalid to=${n}, base cannot be less than 2`);if(ce(e),!e.length)return[];let r=0;const s=[],o=Array.from(e,c=>{if(Ne(c),c<0||c>=t)throw new Error(`invalid integer: ${c}`);return c}),i=o.length;for(;;){let c=0,h=!0;for(let v=r;v<i;v++){const d=o[v],l=t*c,a=l+d;if(!Number.isSafeInteger(a)||l/t!==c||a-d!==l)throw new Error("convertRadix: carry overflow");const y=a/n;c=a%n;const p=Math.floor(y);if(o[v]=p,!Number.isSafeInteger(p)||p*n+c!==a)throw new Error("convertRadix: carry overflow");if(h)p?h=!1:r=v;else continue}if(s.push(c),h)break}for(let c=0;c<e.length-1&&e[c]===0;c++)s.push(0);return s.reverse()}function Pt(e){Ne(e);const t=2**8;return{encode:n=>{if(!Lt(n))throw new Error("radix.encode input should be Uint8Array");return He(Array.from(n),t,e)},decode:n=>(Dt("radix.decode",n),Uint8Array.from(He(n,e,t)))}}const Re=(e=>St(Pt(58),jt(e),Mt("")))("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Vt(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ae(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function ue(e,...t){if(!Vt(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Ke(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 Nt(e,t){ue(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function te(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function le(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const qe=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Fe(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const D=qe?e=>e:e=>Fe(e);function $t(e){for(let t=0;t<e.length;t++)e[t]=Fe(e[t]);return e}const F=qe?e=>e:$t;function Ht(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function z(e){return typeof e=="string"&&(e=Ht(e)),ue(e),e}class Rt{}function Kt(e){const t=(r,s)=>e(s).update(z(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}const qt=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]),ne=BigInt(2**32-1),Xe=BigInt(32);function Ft(e,t=!1){return t?{h:Number(e&ne),l:Number(e>>Xe&ne)}:{h:Number(e>>Xe&ne)|0,l:Number(e&ne)|0}}const Ge=(e,t,n)=>e>>>n|t<<32-n,We=(e,t,n)=>e<<32-n|t>>>n,Xt=(e,t,n)=>e<<64-n|t>>>n-32,Gt=(e,t,n)=>e>>>n-32|t<<64-n,Wt=(e,t)=>t,zt=(e,t)=>e;function ze(e,t,n,r){const s=(t>>>0)+(r>>>0);return{h:e+n+(s/2**32|0)|0,l:s|0}}const Ye=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),Je=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,A=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),u=new Uint32Array(32);function P(e,t,n,r,s,o){const i=s[o],c=s[o+1];let h=u[2*e],v=u[2*e+1],d=u[2*t],l=u[2*t+1],a=u[2*n],y=u[2*n+1],p=u[2*r],f=u[2*r+1],b=Ye(h,d,i);v=Je(b,v,l,c),h=b|0,{Dh:f,Dl:p}={Dh:f^v,Dl:p^h},{Dh:f,Dl:p}={Dh:Wt(f,p),Dl:zt(f)},{h:y,l:a}=ze(y,a,f,p),{Bh:l,Bl:d}={Bh:l^y,Bl:d^a},{Bh:l,Bl:d}={Bh:Ge(l,d,24),Bl:We(l,d,24)},u[2*e]=h,u[2*e+1]=v,u[2*t]=d,u[2*t+1]=l,u[2*n]=a,u[2*n+1]=y,u[2*r]=p,u[2*r+1]=f}function V(e,t,n,r,s,o){const i=s[o],c=s[o+1];let h=u[2*e],v=u[2*e+1],d=u[2*t],l=u[2*t+1],a=u[2*n],y=u[2*n+1],p=u[2*r],f=u[2*r+1],b=Ye(h,d,i);v=Je(b,v,l,c),h=b|0,{Dh:f,Dl:p}={Dh:f^v,Dl:p^h},{Dh:f,Dl:p}={Dh:Ge(f,p,16),Dl:We(f,p,16)},{h:y,l:a}=ze(y,a,f,p),{Bh:l,Bl:d}={Bh:l^y,Bl:d^a},{Bh:l,Bl:d}={Bh:Xt(l,d,63),Bl:Gt(l,d,63)},u[2*e]=h,u[2*e+1]=v,u[2*t]=d,u[2*t+1]=l,u[2*n]=a,u[2*n+1]=y,u[2*r]=p,u[2*r+1]=f}function Yt(e,t={},n,r,s){if(ae(n),e<0||e>n)throw new Error("outputLen bigger than keyLen");const{key:o,salt:i,personalization:c}=t;if(o!==void 0&&(o.length<1||o.length>n))throw new Error("key length must be undefined or 1.."+n);if(i!==void 0&&i.length!==r)throw new Error("salt must be undefined or "+r);if(c!==void 0&&c.length!==s)throw new Error("personalization must be undefined or "+s)}class Jt extends Rt{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,ae(t),ae(n),this.blockLen=t,this.outputLen=n,this.buffer=new Uint8Array(t),this.buffer32=te(this.buffer)}update(t){Ke(this),t=z(t),ue(t);const{blockLen:n,buffer:r,buffer32:s}=this,o=t.length,i=t.byteOffset,c=t.buffer;for(let h=0;h<o;){this.pos===n&&(F(s),this.compress(s,0,!1),F(s),this.pos=0);const v=Math.min(n-this.pos,o-h),d=i+h;if(v===n&&!(d%4)&&h+v<o){const l=new Uint32Array(c,d,Math.floor((o-h)/4));F(l);for(let a=0;h+n<o;a+=s.length,h+=n)this.length+=n,this.compress(l,a,!1);F(l);continue}r.set(t.subarray(h,h+v),this.pos),this.pos+=v,this.length+=v,h+=v}return this}digestInto(t){Ke(this),Nt(t,this);const{pos:n,buffer32:r}=this;this.finished=!0,le(this.buffer.subarray(n)),F(r),this.compress(r,0,!0),F(r);const s=te(t);this.get().forEach((o,i)=>s[i]=D(o))}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){const{buffer:n,length:r,finished:s,destroyed:o,outputLen:i,pos:c}=this;return t||(t=new this.constructor({dkLen:i})),t.set(...this.get()),t.buffer.set(n),t.destroyed=o,t.finished=s,t.length=r,t.pos=c,t.outputLen=i,t}clone(){return this._cloneInto()}}class Qt extends Jt{constructor(t={}){const n=t.dkLen===void 0?64:t.dkLen;super(128,n),this.v0l=A[0]|0,this.v0h=A[1]|0,this.v1l=A[2]|0,this.v1h=A[3]|0,this.v2l=A[4]|0,this.v2h=A[5]|0,this.v3l=A[6]|0,this.v3h=A[7]|0,this.v4l=A[8]|0,this.v4h=A[9]|0,this.v5l=A[10]|0,this.v5h=A[11]|0,this.v6l=A[12]|0,this.v6h=A[13]|0,this.v7l=A[14]|0,this.v7h=A[15]|0,Yt(n,t,64,16,16);let{key:r,personalization:s,salt:o}=t,i=0;if(r!==void 0&&(r=z(r),i=r.length),this.v0l^=this.outputLen|i<<8|65536|1<<24,o!==void 0){o=z(o);const c=te(o);this.v4l^=D(c[0]),this.v4h^=D(c[1]),this.v5l^=D(c[2]),this.v5h^=D(c[3])}if(s!==void 0){s=z(s);const c=te(s);this.v6l^=D(c[0]),this.v6h^=D(c[1]),this.v7l^=D(c[2]),this.v7h^=D(c[3])}if(r!==void 0){const c=new Uint8Array(this.blockLen);c.set(r),this.update(c)}}get(){let{v0l:t,v0h:n,v1l:r,v1h:s,v2l:o,v2h:i,v3l:c,v3h:h,v4l:v,v4h:d,v5l:l,v5h:a,v6l:y,v6h:p,v7l:f,v7h:b}=this;return[t,n,r,s,o,i,c,h,v,d,l,a,y,p,f,b]}set(t,n,r,s,o,i,c,h,v,d,l,a,y,p,f,b){this.v0l=t|0,this.v0h=n|0,this.v1l=r|0,this.v1h=s|0,this.v2l=o|0,this.v2h=i|0,this.v3l=c|0,this.v3h=h|0,this.v4l=v|0,this.v4h=d|0,this.v5l=l|0,this.v5h=a|0,this.v6l=y|0,this.v6h=p|0,this.v7l=f|0,this.v7h=b|0}compress(t,n,r){this.get().forEach((h,v)=>u[v]=h),u.set(A,16);let{h:s,l:o}=Ft(BigInt(this.length));u[24]=A[8]^o,u[25]=A[9]^s,r&&(u[28]=~u[28],u[29]=~u[29]);let i=0;const c=qt;for(let h=0;h<12;h++)P(0,4,8,12,t,n+2*c[i++]),V(0,4,8,12,t,n+2*c[i++]),P(1,5,9,13,t,n+2*c[i++]),V(1,5,9,13,t,n+2*c[i++]),P(2,6,10,14,t,n+2*c[i++]),V(2,6,10,14,t,n+2*c[i++]),P(3,7,11,15,t,n+2*c[i++]),V(3,7,11,15,t,n+2*c[i++]),P(0,5,10,15,t,n+2*c[i++]),V(0,5,10,15,t,n+2*c[i++]),P(1,6,11,12,t,n+2*c[i++]),V(1,6,11,12,t,n+2*c[i++]),P(2,7,8,13,t,n+2*c[i++]),V(2,7,8,13,t,n+2*c[i++]),P(3,4,9,14,t,n+2*c[i++]),V(3,4,9,14,t,n+2*c[i++]);this.v0l^=u[0]^u[16],this.v0h^=u[1]^u[17],this.v1l^=u[2]^u[18],this.v1h^=u[3]^u[19],this.v2l^=u[4]^u[20],this.v2h^=u[5]^u[21],this.v3l^=u[6]^u[22],this.v3h^=u[7]^u[23],this.v4l^=u[8]^u[24],this.v4h^=u[9]^u[25],this.v5l^=u[10]^u[26],this.v5h^=u[11]^u[27],this.v6l^=u[12]^u[28],this.v6h^=u[13]^u[29],this.v7l^=u[14]^u[30],this.v7h^=u[15]^u[31],le(u)}destroy(){this.destroyed=!0,le(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const he=Kt(e=>new Qt(e)),Qe=new TextEncoder().encode("SS58PRE"),de=2,Zt=e=>{try{const t=Re.decode(e),n=t.subarray(0,t[0]&64?2:1),r=t.subarray(n.length,t.length-de),s=t.subarray(n.length+r.length),o=he(Uint8Array.of(...Qe,...n,...r),{dkLen:64}).subarray(0,de);return s[0]===o[0]&&s[1]===o[1]?{isValid:!0,ss58Format:en(n),publicKey:r.slice()}:{isValid:!1}}catch{return{isValid:!1}}},en=e=>{const t=new DataView(e.buffer,e.byteOffset,e.byteLength);return t.byteLength===1?t.getUint8(0):t.getUint16(0)},tn=e=>{const t=e<64?Uint8Array.of(e):Uint8Array.of((e&252)>>2|64,e>>8|(e&3)<<6);return n=>{const r=he(Uint8Array.of(...Qe,...t,...n),{dkLen:64}).subarray(0,de);return Re.encode(Uint8Array.of(...t,...n,...r))}};function nn(e,t){return n=>{const r=Zt(n);if(!r.isValid)throw new Error("Invalid checksum");const{publicKey:s}=r;if(s.length!==e)throw new Error("Invalid public key length");return s}}const rn=(e=42,t=32)=>Z(R(t),nn(t),tn(e)),Ze="0123456789abcdef";function N(e){const t=new Array(e.length+1);t[0]="0x";for(let n=0;n<e.length;){const r=e[n++];t[n]=Ze[r>>4]+Ze[r&15]}return t.join("")}const fe={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function Y(e){const t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,s=new Uint8Array(r);t&&(s[0]=0|fe[e[2]]);for(let o=0;o<r;){const i=n+o*2,c=fe[e[i]],h=fe[e[i+1]];s[t+o++]=c<<4|h}return s}const et=(...e)=>{const t=e.reduce((r,s)=>r+s.byteLength,0),n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const o=e[r];n.set(o,s),s+=o.byteLength}return n},g=Z(T,e=>e,Number),sn=Z(T,e=>e,BigInt),tt=e=>{const t=R.enc(e);return n=>t(Y(n))},nt=e=>{const t=R.dec(e);return n=>N(t(n))},J=e=>B(tt(e),nt(e));J.enc=tt,J.dec=nt;const X=(e,t)=>{const n=e;return n.inner=t,n},pe=e=>X(m(e),e);pe.enc=e=>X(m.enc(e),e),pe.dec=e=>X(m.dec(e),e);const ve=e=>X(_(e),e);ve.enc=e=>X(_.enc(e),e),ve.dec=e=>X(_.dec(e),e);const S=E(I),rt=_(I),on=K({bool:x,char:x,str:x,u8:x,u16:x,u32:x,u64:x,u128:x,u256:x,i8:x,i16:x,i32:x,i64:x,i128:x,i256:x}),st=E(m({name:rt,type:g,typeName:rt,docs:S})),cn=m({len:M,type:g}),an=m({bitStoreType:g,bitOrderType:g}),un=E(m({name:I,fields:st,index:k,docs:S})),ln=K({composite:st,variant:un,sequence:g,array:cn,tuple:E(g),primitive:on,compact:g,bitSequence:an}),hn=m({name:I,type:_(g)}),dn=E(hn),fn=m({id:g,path:S,params:dn,def:ln,docs:S}),ot=E(fn),pn=K({Blake2128:x,Blake2256:x,Blake2128Concat:x,Twox128:x,Twox256:x,Twox64Concat:x,Identity:x}),vn=E(pn),gn=m({hashers:vn,key:g,value:g}),yn=m({name:I,modifier:k,type:K({plain:g,map:gn}),fallback:J(),docs:S}),mn=_(m({prefix:I,items:E(yn)})),it={name:I,storage:mn,calls:_(g),events:_(g),constants:E(m({name:I,type:g,value:J(),docs:S})),errors:_(g),index:k},wn={...it,docs:S},bn=new Uint8Array,ct=e=>B(()=>bn,()=>e),xn=m({type:g,version:k,signedExtensions:E(m({identifier:I,type:g,additionalSigned:g}))}),En=m({lookup:ot,pallets:E(m({...it,docs:ct([])})),extrinsic:xn,type:g,apis:ct([])}),An=m({name:I,methods:E(m({name:I,inputs:E(m({name:I,type:g})),output:g,docs:S})),docs:S}),Bn=m({version:k,address:g,call:g,signature:g,extra:g,signedExtensions:E(m({identifier:I,type:g,additionalSigned:g}))}),kn=m({lookup:ot,pallets:E(m(wn)),extrinsic:Bn,type:g,apis:E(An),outerEnums:m({call:g,event:g,error:g}),custom:E(q(I,m({type:g,value:J()})))}),at=()=>{throw new Error("Unsupported metadata version!")},U=B(at,at),re=m({magicNumber:M,metadata:K({v0:U,v1:U,v2:U,v3:U,v4:U,v5:U,v6:U,v7:U,v8:U,v9:U,v10:U,v11:U,v12:U,v13:U,v14:En,v15:kn})}),ge=R(),In=_(ge),Un=q(T,ge),Tn=e=>{try{return re.dec(e)}catch{}try{return re.dec(In.dec(e))}catch{}try{return re.dec(ge.dec(e))}catch{}try{return re.dec(Un.dec(e)[1])}catch{}throw null},_n={dkLen:32},Cn=e=>he(e,_n),ut=(e,t)=>e.type==="array"&&e.len===t&&e.value.type==="primitive"&&e.value.value==="u8",$={type:"void"},On=(e,t=()=>null)=>{const n=new Map,r=new Set,s=d=>l=>{let a=n.get(l);if(a)return a;if(r.has(l)){const p={id:l};return n.set(l,p),p}r.add(l);const y=d(l);return a=n.get(l),a?Object.assign(a,y):(a={id:l,...y},n.set(l,a)),r.delete(l),a};let o=!0,i=!0;const c=s(d=>{const l=t(e[d]);if(l)return l;const{def:a,path:y,params:p}=e[d];if(a.tag==="composite"){if(a.value.length===0)return $;if(a.value.length===1){const f=c(a.value[0].type);return o&&y.at(-1)==="AccountId32"&&ut(f,32)?(o=!1,{type:"AccountId32"}):i&&y.at(-1)==="AccountId20"&&ut(f,20)?(i=!1,{type:"AccountId20"}):f}return h(a.value)}if(a.tag==="variant"){if(y.length===1&&y[0]==="Option"&&p.length===1&&p[0].name==="T"){const w=c(p[0].type);return w.type==="void"?{type:"primitive",value:"bool"}:{type:"option",value:w}}if(y.length===1&&y[0]==="Result"&&p.length===2&&p[0].name==="T"&&p[1].name==="E")return{type:"result",value:{ok:c(p[0].type),ko:c(p[1].type)}};if(a.value.length===0)return $;const f={},b={};return a.value.forEach(w=>{const O=w.name;if(b[O]=w.docs,w.fields.length===0){f[O]={...$,idx:w.index};return}if(w.fields.length===1&&!w.fields[0].name){f[O]={type:"lookupEntry",value:c(w.fields[0].type),idx:w.index};return}f[O]={...h(w.fields),idx:w.index}}),{type:"enum",value:f,innerDocs:b}}if(a.tag==="sequence")return{type:"sequence",value:c(a.value)};if(a.tag==="array"){const{len:f}=a.value,b=c(a.value.type);return!f||b.type==="void"?$:f>1?{type:"array",value:b,len:a.value.len}:b}if(a.tag==="tuple")return a.value.length===0?$:a.value.length>1?v(a.value.map(f=>c(f)),a.value.map(f=>e[f].docs)):c(a.value[0]);if(a.tag==="primitive")return{type:"primitive",value:a.value.tag};if(a.tag==="compact"){const f=c(a.value);return f.type==="void"?$:{type:"compact",isBig:Number(f.value.slice(1))>32,size:f.value}}return{type:a.tag}}),h=d=>{let l=!0;const a={},y={};return d.forEach((p,f)=>{l=l&&!!p.name;const b=p.name||f,w=c(p.type);w.type!=="void"&&(a[b]=w,y[b]=p.docs)}),l?{type:"struct",value:a,innerDocs:y}:v(Object.values(a),Object.values(y))},v=(d,l)=>{if(d.every(a=>a.id===d[0].id)&&l.every(a=>!a.length)){const[a]=d;return a.type==="void"?$:{type:"array",value:d[0],len:d.length}}return{type:"tuple",value:d,innerDocs:l}};return c},Ln=e=>{const t=On(e.lookup,({def:s})=>{if(s.tag==="composite"){const o=n(s);if(o)return{type:"enum",innerDocs:{},value:Object.fromEntries(e.pallets.map(i=>[i.name,i.errors==null?{...$,idx:i.index}:{type:"lookupEntry",value:t(i.errors),idx:i.index}])),byteLength:o}}return null});function n(s){if(!(s.value.length===2&&s.value[0].name==="index"&&s.value[1].name==="error"))return null;const i=t(s.value[0].type),c=t(s.value[1].type);return i.type==="primitive"&&i.value==="u8"&&c.type==="array"&&c.value.type==="primitive"&&c.value.value==="u8"?1+c.len:null}return Object.assign(t,{metadata:e,call:"outerEnums"in e?e.outerEnums.call:e.lookup[e.extrinsic?.type]?.params.find(i=>i.name==="Call")?.type??null})},Dn=oe(k.enc,e=>+!!e.signed<<7|e.version),ye=()=>new Error("Unkown signer"),Sn=e=>{const{extrinsic:t}=e,n=Ln(e);let r,s;if("address"in t)r=n(t.address),s=n(t.signature);else{const o=Object.fromEntries(e.lookup[t.type].params.filter(i=>i.type!=null).map(i=>[i.name,n(i.type)]));if(r=o.Address,s=o.Signature,!r||!s)throw ye()}if(r.type==="AccountId20"&&s.type==="array"&&s.len===65&&s.value.type==="primitive"&&s.value.value==="u8")return[1,[]];if(s.type!=="enum"||["Ecdsa","Ed25519","Sr25519"].some(o=>!(o in s.value)))throw ye();if(r.type==="enum"){const o=r.value.Id;if(o.type==="lookupEntry"&&o.value.type==="AccountId32")return[0,[o.idx]]}else if(r.type==="AccountId32")return[0,[]];throw ye()},jn=(e,t,n,r,s,o)=>{const[i,c]=Sn(e),h=et(Dn({signed:!0,version:4}),i===1?t:new Uint8Array([...c,...t]),n,...r,s);return et(T.enc(h.length),h)},G=(e,t)=>{let n=e.toString(16);n=(n.length%2?"0":"")+n;const r=Math.max(0,(t||0)-n.length/2);return"0x"+"00".repeat(r)+n},Mn=({additionalSigned:e})=>({genesisHash:N(e)}),Pn=({value:e})=>({nonce:G(T.dec(e),4)}),Vn=({additionalSigned:e})=>({transactionVersion:G(M.dec(e),4)}),Nn=pe({tip:T,asset:ve(R(1/0))}).dec;var lt=Object.freeze({__proto__:null,ChargeAssetTxPayment:({value:e})=>{const{tip:t,asset:n}=Nn(e);return{...n?{assetId:N(n)}:{},tip:G(t,16)}},ChargeTransactionPayment:({value:e})=>({tip:G(sn.dec(e),16)}),CheckGenesis:Mn,CheckMetadataHash:({value:e,additionalSigned:t})=>e.length&&e[0]?{mode:1,metadataHash:N(t.length?t.slice(1):t)}:{},CheckMortality:({value:e,additionalSigned:t},n)=>({era:N(e),blockHash:N(t),blockNumber:G(n,4)}),CheckNonce:Pn,CheckSpecVersion:({additionalSigned:e})=>({specVersion:G(M.dec(e),4)}),CheckTxVersion:Vn});const $n=rn().enc,Hn=e=>e.startsWith("0x")?Y(e):$n(e);function ht(e,t,n){const r=i=>n({address:e,data:N(i),type:"bytes"}).then(({signature:c})=>Y(c)),s=Hn(e);return{publicKey:s,signTx:async(i,c,h,v,d=Cn)=>{let l;try{const w=Tn(h);if(w.metadata.tag!=="v14"&&w.metadata.tag!=="v15")throw null;l=w.metadata.value}catch{throw new Error("Unsupported metadata version")}const a={};a.signedExtensions=[];const{version:y}=l.extrinsic,p=[];l.extrinsic.signedExtensions.map(({identifier:w})=>{const O=c[w];if(!O)throw new Error(`Missing ${w} signed-extension`);if(p.push(O.value),a.signedExtensions.push(w),!lt[w]){if(O.value.length===0&&O.additionalSigned.length===0)return;throw new Error(`PJS does not support this signed-extension: ${w}`)}Object.assign(a,lt[w](O,v))}),a.address=e,a.method=N(i),a.version=y,a.withSignedTransaction=!0;const f=await t(a),b=f.signedTransaction;return b?typeof b=="string"?Y(b):b:jn(l,s,Y(f.signature),p,i)},signBytes:r}}const Rn=new Set(["ed25519","sr25519","ecdsa","ethereum"]),Kn=async(e,t)=>{let n=window.injectedWeb3?.[e];if(!n)throw new Error(`Unavailable extension: "${e}"`);const r=await n.enable(t),s=r.signer.signPayload.bind(r.signer),o=r.signer.signRaw.bind(r.signer),i=d=>d.filter(({type:l})=>Rn.has(l)).map(l=>{const a=ht(l.address,s,o);return{...l,polkadotSigner:a}});let c=i(await r.accounts.get());const h=new Set,v=r.accounts.subscribe(d=>{c=i(d),h.forEach(l=>{l(c)})});return{name:e,getAccounts:()=>c,subscribe:d=>(h.add(d),()=>{h.delete(d)}),disconnect:()=>{v()}}},qn=()=>{const{injectedWeb3:e}=window;return e?Object.keys(e):[]};H.connectInjectedExtension=Kn,H.getInjectedExtensions=qn,H.getPolkadotSignerFromPjs=ht});
|
package/dist/umd/signer.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(z,X){typeof exports=="object"&&typeof module<"u"?X(exports):typeof define=="function"&&define.amd?define(["exports"],X):(z=typeof globalThis<"u"?globalThis:z||self,X(z.papiSigner={}))})(this,function(z){"use strict";const X="0123456789abcdef";function ve(e){const t=new Array(e.length+1);t[0]="0x";for(let n=0;n<e.length;){const r=e[n++];t[n]=X[r>>4]+X[r&15]}return t.join("")}const pe={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function ye(e){const t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,s=new Uint8Array(r);t&&(s[0]=0|pe[e[2]]);for(let i=0;i<r;){const o=n+i*2,c=pe[e[o]],d=pe[e[o+1]];s[t+i++]=c<<4|d}return s}const Y=(...e)=>{const t=e.reduce((r,s)=>r+s.byteLength,0),n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const i=e[r];n.set(i,s),s+=i.byteLength}return n};var vt=Object.defineProperty,pt=(e,t,n)=>t in e?vt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_e=(e,t,n)=>(pt(e,typeof t!="symbol"?t+"":t,n),n),ge={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function yt(e){const t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,s=new Uint8Array(r);t&&(s[0]=0|ge[e[2]]);for(let i=0;i<r;){const o=n+i*2,c=ge[e[o]],d=ge[e[o+1]];s[t+i++]=c<<4|d}return s}var ke=class extends Uint8Array{constructor(e){super(e),_e(this,"i",0),_e(this,"v"),this.v=new DataView(e)}},S=e=>t=>e(t instanceof ke?t:new ke(t instanceof Uint8Array?t.buffer:typeof t=="string"?yt(t).buffer:t)),T=e=>{const t=e.length;let n=0;for(let s=0;s<t;s++)n+=e[s].length;const r=new Uint8Array(n);for(let s=0,i=0;s<t;s++){const o=e[s];r.set(o,i),i+=o.byteLength}return r};function re(e,t){const n=Object.keys(e),r=n.length,s={};for(let i=0;i<r;i++){const o=n[i];s[o]=t(e[o],o)}return s}var b=(e,t)=>{const n=[e,t];return n.enc=e,n.dec=t,n},we=(e,t)=>n=>e(t(n)),Le=(e,t)=>n=>t(e(n)),se=([e,t],n,r)=>b(we(e,n),Le(t,r));function gt(e,t){return S(n=>{const r=n.v[t](n.i,!0);return n.i+=e,r})}function wt(e,t){return n=>{const r=new Uint8Array(e);return new DataView(r.buffer)[t](0,n,!0),r}}function $(e,t,n){return b(wt(e,n),gt(e,t))}var U=$(1,"getUint8","setUint8"),ie=$(2,"getUint16","setUint16"),F=$(4,"getUint32","setUint32"),Se=$(8,"getBigUint64","setBigUint64");$(1,"getInt8","setInt8"),$(2,"getInt16","setInt16"),$(4,"getInt32","setInt32"),$(8,"getBigInt64","setBigInt64");var Te=e=>{const t=new Uint8Array(16),n=new DataView(t.buffer);return n.setBigInt64(0,e,!0),n.setBigInt64(8,e>>64n,!0),t},De=e=>S(t=>{const{v:n,i:r}=t,s=n.getBigUint64(r,!0),i=n[e](r+8,!0);return t.i+=16,i<<64n|s});b(Te,De("getBigUint64")),b(Te,De("getBigInt64"));var Oe=e=>{const t=new Uint8Array(32),n=new DataView(t.buffer);return n.setBigInt64(0,e,!0),n.setBigInt64(8,e>>64n,!0),n.setBigInt64(16,e>>128n,!0),n.setBigInt64(24,e>>192n,!0),t},He=e=>S(t=>{let n=t.v.getBigUint64(t.i,!0);return t.i+=8,n|=t.v.getBigUint64(t.i,!0)<<64n,t.i+=8,n|=t.v.getBigUint64(t.i,!0)<<128n,t.i+=8,n|=t.v[e](t.i,!0)<<192n,t.i+=8,n});b(Oe,He("getBigUint64")),b(Oe,He("getBigInt64")),se(U,e=>e?1:0,Boolean);var mt=[U[1],ie[1],F[1]],xt=S(e=>{const t=e[e.i],n=t&3;if(n<3)return mt[n](e)>>>2;const r=(t>>>2)+4;e.i++;let s=0n;const i=r/8|0;let o=0n;for(let d=0;d<i;d++)s=Se[1](e)<<o|s,o+=64n;let c=r%8;return c>3&&(s=BigInt(F[1](e))<<o|s,o+=32n,c-=4),c>1&&(s=BigInt(ie[1](e))<<o|s,o+=16n,c-=2),c&&(s=BigInt(U[1](e))<<o|s),s}),Bt=1n<<56n,Et=1<<24,bt=256,At=4294967295n,It=64,Ut=16384,_t=1<<30,kt=e=>{if(e<0)throw new Error(`Wrong compact input (${e})`);const t=Number(e)<<2;if(e<It)return U[0](t);if(e<Ut)return ie[0](t|1);if(e<_t)return F[0](t|2);let n=[new Uint8Array(1)],r=BigInt(e);for(;r>=Bt;)n.push(Se[0](r)),r>>=64n;r>=Et&&(n.push(F[0](Number(r&At))),r>>=32n);let s=Number(r);s>=bt&&(n.push(ie[0](s)),s>>=16),s&&n.push(U[0](s));const i=T(n);return i[0]=i.length-5<<2|3,i},L=b(kt,xt),Lt=new TextEncoder,St=e=>{const t=Lt.encode(e);return T([L.enc(t.length),t])},Tt=new TextDecoder,Dt=S(e=>{let t=L.dec(e);const n=new DataView(e.buffer,e.i,t);return e.i+=t,Tt.decode(n)}),_=b(St,Dt),Ot=()=>{},Ht=new Uint8Array(0),m=b(()=>Ht,Ot),Me=e=>e===void 0?t=>T([L.enc(t.length),t]):t=>t.length===e?t:t.slice(0,e),Ce=e=>S(t=>{const n=e===void 0?L.dec(t):e!==1/0?e:t.byteLength-t.i,r=new Uint8Array(t.buffer.slice(t.i,t.i+n));return t.i+=n,r}),j=e=>b(Me(e),Ce(e));j.enc=Me,j.dec=Ce;var $e=(e,t)=>{const n=Object.keys(e),r=new Map(t?.map((i,o)=>[n[o],i])??n.map((i,o)=>[i,o])),s=i=>r.get(i);return({tag:i,value:o})=>T([U.enc(s(i)),e[i](o)])},Ne=(e,t)=>{const n=Object.keys(e),r=new Map(t?.map((s,i)=>[s,n[i]])??n.map((s,i)=>[i,s]));return S(s=>{const i=U.dec(s),o=r.get(i),c=e[o];return{tag:o,value:c(s)}})},q=(e,...t)=>b($e(re(e,([n])=>n),...t),Ne(re(e,([,n])=>n),...t));q.enc=$e,q.dec=Ne;var Ve=e=>S(t=>U[1](t)>0?e(t):void 0),Pe=e=>t=>{const n=new Uint8Array(1);return t===void 0?n:(n[0]=1,T([n,e(t)]))},D=e=>b(Pe(e[0]),Ve(e[1]));D.enc=Pe,D.dec=Ve;var je=(...e)=>S(t=>e.map(n=>n(t))),qe=(...e)=>t=>T(e.map((n,r)=>n(t[r]))),R=(...e)=>b(qe(...e.map(([t])=>t)),je(...e.map(([,t])=>t)));R.enc=qe,R.dec=je;var Re=e=>{const t=Object.keys(e);return we(R.enc(...Object.values(e)),n=>t.map(r=>n[r]))},Ke=e=>{const t=Object.keys(e);return Le(R.dec(...Object.values(e)),n=>Object.fromEntries(n.map((r,s)=>[t[s],r])))},w=e=>b(Re(re(e,t=>t[0])),Ke(re(e,t=>t[1])));w.enc=Re,w.dec=Ke;var We=(e,t)=>t>=0?n=>T(n.map(e)):n=>T([L.enc(n.length),T(n.map(e))]),Xe=(e,t)=>S(n=>{const r=t>=0?t:L.dec(n),s=new Array(r);for(let i=0;i<r;i++)s[i]=e(n);return s}),B=(e,t)=>b(We(e[0],t),Xe(e[1],t));B.enc=We,B.dec=Xe;/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Mt(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Fe(e,t){return Array.isArray(t)?t.length===0?!0:e?t.every(n=>typeof n=="string"):t.every(n=>Number.isSafeInteger(n)):!1}function me(e,t){if(typeof t!="string")throw new Error(`${e}: string expected`);return!0}function Ge(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function xe(e){if(!Array.isArray(e))throw new Error("array expected")}function ze(e,t){if(!Fe(!0,t))throw new Error(`${e}: array of strings expected`)}function Ct(e,t){if(!Fe(!1,t))throw new Error(`${e}: array of numbers expected`)}function $t(...e){const t=i=>i,n=(i,o)=>c=>i(o(c)),r=e.map(i=>i.encode).reduceRight(n,t),s=e.map(i=>i.decode).reduce(n,t);return{encode:r,decode:s}}function Nt(e){const t=typeof e=="string"?e.split(""):e,n=t.length;ze("alphabet",t);const r=new Map(t.map((s,i)=>[s,i]));return{encode:s=>(xe(s),s.map(i=>{if(!Number.isSafeInteger(i)||i<0||i>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${i}". Allowed: ${e}`);return t[i]})),decode:s=>(xe(s),s.map(i=>{me("alphabet.decode",i);const o=r.get(i);if(o===void 0)throw new Error(`Unknown letter: "${i}". Allowed: ${e}`);return o}))}}function Vt(e=""){return me("join",e),{encode:t=>(ze("join.decode",t),t.join(e)),decode:t=>(me("join.decode",t),t.split(e))}}function Ye(e,t,n){if(t<2)throw new Error(`convertRadix: invalid from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: invalid to=${n}, base cannot be less than 2`);if(xe(e),!e.length)return[];let r=0;const s=[],i=Array.from(e,c=>{if(Ge(c),c<0||c>=t)throw new Error(`invalid integer: ${c}`);return c}),o=i.length;for(;;){let c=0,d=!0;for(let p=r;p<o;p++){const v=i[p],u=t*c,l=u+v;if(!Number.isSafeInteger(l)||u/t!==c||l-v!==u)throw new Error("convertRadix: carry overflow");const g=l/n;c=l%n;const h=Math.floor(g);if(i[p]=h,!Number.isSafeInteger(h)||h*n+c!==l)throw new Error("convertRadix: carry overflow");if(d)h?d=!1:r=p;else continue}if(s.push(c),d)break}for(let c=0;c<e.length-1&&e[c]===0;c++)s.push(0);return s.reverse()}function Pt(e){Ge(e);const t=2**8;return{encode:n=>{if(!Mt(n))throw new Error("radix.encode input should be Uint8Array");return Ye(Array.from(n),t,e)},decode:n=>(Ct("radix.decode",n),Uint8Array.from(Ye(n,e,t)))}}const Je=(e=>$t(Pt(58),Nt(e),Vt("")))("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function Be(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function jt(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Qe(e,...t){if(!jt(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Ze(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 qt(e,t){Qe(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function oe(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}const K=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function et(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const O=K?e=>e:e=>et(e);function G(e){for(let t=0;t<e.length;t++)e[t]=et(e[t])}function Rt(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function J(e){return typeof e=="string"&&(e=Rt(e)),Qe(e),e}class Kt{clone(){return this._cloneInto()}}function Wt(e){const t=(r,s)=>e(s).update(J(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}const Xt=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]);class Ft extends Kt{constructor(t,n,r={},s,i,o){if(super(),this.blockLen=t,this.outputLen=n,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,Be(t),Be(n),Be(s),n<0||n>s)throw new Error("outputLen bigger than keyLen");if(r.key!==void 0&&(r.key.length<1||r.key.length>s))throw new Error("key length must be undefined or 1.."+s);if(r.salt!==void 0&&r.salt.length!==i)throw new Error("salt must be undefined or "+i);if(r.personalization!==void 0&&r.personalization.length!==o)throw new Error("personalization must be undefined or "+o);this.buffer=new Uint8Array(t),this.buffer32=oe(this.buffer)}update(t){Ze(this);const{blockLen:n,buffer:r,buffer32:s}=this;t=J(t);const i=t.length,o=t.byteOffset,c=t.buffer;for(let d=0;d<i;){this.pos===n&&(K||G(s),this.compress(s,0,!1),K||G(s),this.pos=0);const p=Math.min(n-this.pos,i-d),v=o+d;if(p===n&&!(v%4)&&d+p<i){const u=new Uint32Array(c,v,Math.floor((i-d)/4));K||G(u);for(let l=0;d+n<i;l+=s.length,d+=n)this.length+=n,this.compress(u,l,!1);K||G(u);continue}r.set(t.subarray(d,d+p),this.pos),this.pos+=p,this.length+=p,d+=p}return this}digestInto(t){Ze(this),qt(t,this);const{pos:n,buffer32:r}=this;this.finished=!0,this.buffer.subarray(n).fill(0),K||G(r),this.compress(r,0,!0),K||G(r);const s=oe(t);this.get().forEach((i,o)=>s[o]=O(i))}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){const{buffer:n,length:r,finished:s,destroyed:i,outputLen:o,pos:c}=this;return t||(t=new this.constructor({dkLen:o})),t.set(...this.get()),t.length=r,t.finished=s,t.destroyed=i,t.outputLen=o,t.buffer.set(n),t.pos=c,t}}const ce=BigInt(2**32-1),Ee=BigInt(32);function tt(e,t=!1){return t?{h:Number(e&ce),l:Number(e>>Ee&ce)}:{h:Number(e>>Ee&ce)|0,l:Number(e&ce)|0}}function Gt(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let s=0;s<e.length;s++){const{h:i,l:o}=tt(e[s],t);[n[s],r[s]]=[i,o]}return[n,r]}const zt=(e,t)=>BigInt(e>>>0)<<Ee|BigInt(t>>>0),Yt=(e,t,n)=>e>>>n,Jt=(e,t,n)=>e<<32-n|t>>>n,Qt=(e,t,n)=>e>>>n|t<<32-n,Zt=(e,t,n)=>e<<32-n|t>>>n,en=(e,t,n)=>e<<64-n|t>>>n-32,tn=(e,t,n)=>e>>>n-32|t<<64-n,nn=(e,t)=>t,rn=(e,t)=>e,sn=(e,t,n)=>e<<n|t>>>32-n,on=(e,t,n)=>t<<n|e>>>32-n,cn=(e,t,n)=>t<<n-32|e>>>64-n,an=(e,t,n)=>e<<n-32|t>>>64-n;function ln(e,t,n,r){const s=(t>>>0)+(r>>>0);return{h:e+n+(s/2**32|0)|0,l:s|0}}const I={fromBig:tt,split:Gt,toBig:zt,shrSH:Yt,shrSL:Jt,rotrSH:Qt,rotrSL:Zt,rotrBH:en,rotrBL:tn,rotr32H:nn,rotr32L:rn,rotlSH:sn,rotlSL:on,rotlBH:cn,rotlBL:an,add:ln,add3L:(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),add3H:(e,t,n,r)=>t+n+r+(e/2**32|0)|0,add4L:(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),add4H:(e,t,n,r,s)=>t+n+r+s+(e/2**32|0)|0,add5H:(e,t,n,r,s,i)=>t+n+r+s+i+(e/2**32|0)|0,add5L:(e,t,n,r,s)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(s>>>0)},E=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),a=new Uint32Array(32);function N(e,t,n,r,s,i){const o=s[i],c=s[i+1];let d=a[2*e],p=a[2*e+1],v=a[2*t],u=a[2*t+1],l=a[2*n],g=a[2*n+1],h=a[2*r],f=a[2*r+1],x=I.add3L(d,v,o);p=I.add3H(x,p,u,c),d=x|0,{Dh:f,Dl:h}={Dh:f^p,Dl:h^d},{Dh:f,Dl:h}={Dh:I.rotr32H(f,h),Dl:I.rotr32L(f,h)},{h:g,l}=I.add(g,l,f,h),{Bh:u,Bl:v}={Bh:u^g,Bl:v^l},{Bh:u,Bl:v}={Bh:I.rotrSH(u,v,24),Bl:I.rotrSL(u,v,24)},a[2*e]=d,a[2*e+1]=p,a[2*t]=v,a[2*t+1]=u,a[2*n]=l,a[2*n+1]=g,a[2*r]=h,a[2*r+1]=f}function V(e,t,n,r,s,i){const o=s[i],c=s[i+1];let d=a[2*e],p=a[2*e+1],v=a[2*t],u=a[2*t+1],l=a[2*n],g=a[2*n+1],h=a[2*r],f=a[2*r+1],x=I.add3L(d,v,o);p=I.add3H(x,p,u,c),d=x|0,{Dh:f,Dl:h}={Dh:f^p,Dl:h^d},{Dh:f,Dl:h}={Dh:I.rotrSH(f,h,16),Dl:I.rotrSL(f,h,16)},{h:g,l}=I.add(g,l,f,h),{Bh:u,Bl:v}={Bh:u^g,Bl:v^l},{Bh:u,Bl:v}={Bh:I.rotrBH(u,v,63),Bl:I.rotrBL(u,v,63)},a[2*e]=d,a[2*e+1]=p,a[2*t]=v,a[2*t+1]=u,a[2*n]=l,a[2*n+1]=g,a[2*r]=h,a[2*r+1]=f}class un extends Ft{constructor(t={}){super(128,t.dkLen===void 0?64:t.dkLen,t,64,16,16),this.v0l=E[0]|0,this.v0h=E[1]|0,this.v1l=E[2]|0,this.v1h=E[3]|0,this.v2l=E[4]|0,this.v2h=E[5]|0,this.v3l=E[6]|0,this.v3h=E[7]|0,this.v4l=E[8]|0,this.v4h=E[9]|0,this.v5l=E[10]|0,this.v5h=E[11]|0,this.v6l=E[12]|0,this.v6h=E[13]|0,this.v7l=E[14]|0,this.v7h=E[15]|0;const n=t.key?t.key.length:0;if(this.v0l^=this.outputLen|n<<8|65536|1<<24,t.salt){const r=oe(J(t.salt));this.v4l^=O(r[0]),this.v4h^=O(r[1]),this.v5l^=O(r[2]),this.v5h^=O(r[3])}if(t.personalization){const r=oe(J(t.personalization));this.v6l^=O(r[0]),this.v6h^=O(r[1]),this.v7l^=O(r[2]),this.v7h^=O(r[3])}if(t.key){const r=new Uint8Array(this.blockLen);r.set(J(t.key)),this.update(r)}}get(){let{v0l:t,v0h:n,v1l:r,v1h:s,v2l:i,v2h:o,v3l:c,v3h:d,v4l:p,v4h:v,v5l:u,v5h:l,v6l:g,v6h:h,v7l:f,v7h:x}=this;return[t,n,r,s,i,o,c,d,p,v,u,l,g,h,f,x]}set(t,n,r,s,i,o,c,d,p,v,u,l,g,h,f,x){this.v0l=t|0,this.v0h=n|0,this.v1l=r|0,this.v1h=s|0,this.v2l=i|0,this.v2h=o|0,this.v3l=c|0,this.v3h=d|0,this.v4l=p|0,this.v4h=v|0,this.v5l=u|0,this.v5h=l|0,this.v6l=g|0,this.v6h=h|0,this.v7l=f|0,this.v7h=x|0}compress(t,n,r){this.get().forEach((d,p)=>a[p]=d),a.set(E,16);let{h:s,l:i}=I.fromBig(BigInt(this.length));a[24]=E[8]^i,a[25]=E[9]^s,r&&(a[28]=~a[28],a[29]=~a[29]);let o=0;const c=Xt;for(let d=0;d<12;d++)N(0,4,8,12,t,n+2*c[o++]),V(0,4,8,12,t,n+2*c[o++]),N(1,5,9,13,t,n+2*c[o++]),V(1,5,9,13,t,n+2*c[o++]),N(2,6,10,14,t,n+2*c[o++]),V(2,6,10,14,t,n+2*c[o++]),N(3,7,11,15,t,n+2*c[o++]),V(3,7,11,15,t,n+2*c[o++]),N(0,5,10,15,t,n+2*c[o++]),V(0,5,10,15,t,n+2*c[o++]),N(1,6,11,12,t,n+2*c[o++]),V(1,6,11,12,t,n+2*c[o++]),N(2,7,8,13,t,n+2*c[o++]),V(2,7,8,13,t,n+2*c[o++]),N(3,4,9,14,t,n+2*c[o++]),V(3,4,9,14,t,n+2*c[o++]);this.v0l^=a[0]^a[16],this.v0h^=a[1]^a[17],this.v1l^=a[2]^a[18],this.v1h^=a[3]^a[19],this.v2l^=a[4]^a[20],this.v2h^=a[5]^a[21],this.v3l^=a[6]^a[22],this.v3h^=a[7]^a[23],this.v4l^=a[8]^a[24],this.v4h^=a[9]^a[25],this.v5l^=a[10]^a[26],this.v5h^=a[11]^a[27],this.v6l^=a[12]^a[28],this.v6h^=a[13]^a[29],this.v7l^=a[14]^a[30],this.v7h^=a[15]^a[31],a.fill(0)}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const be=Wt(e=>new un(e)),nt=new TextEncoder().encode("SS58PRE"),Ae=2,hn=e=>{try{const t=Je.decode(e),n=t.subarray(0,t[0]&64?2:1),r=t.subarray(n.length,t.length-Ae),s=t.subarray(n.length+r.length),i=be(Uint8Array.of(...nt,...n,...r),{dkLen:64}).subarray(0,Ae);return s[0]===i[0]&&s[1]===i[1]?{isValid:!0,ss58Format:dn(n),publicKey:r.slice()}:{isValid:!1}}catch{return{isValid:!1}}},dn=e=>{const t=new DataView(e.buffer,e.byteOffset,e.byteLength);return t.byteLength===1?t.getUint8(0):t.getUint16(0)},fn=e=>{const t=e<64?Uint8Array.of(e):Uint8Array.of((e&252)>>2|64,e>>8|(e&3)<<6);return n=>{const r=be(Uint8Array.of(...nt,...t,...n),{dkLen:64}).subarray(0,Ae);return Je.encode(Uint8Array.of(...t,...n,...r))}};function vn(e,t){return n=>{const r=hn(n);if(!r.isValid)throw new Error("Invalid checksum");const{publicKey:s}=r;if(s.length!==e)throw new Error("Invalid public key length");return s}}const pn=(e=42,t=32)=>se(j(t),vn(t),fn(e));var yn=Object.defineProperty,rt=e=>{throw TypeError(e)},gn=(e,t,n)=>t in e?yn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Q=(e,t,n)=>gn(e,typeof t!="symbol"?t+"":t,n),st=(e,t,n)=>t.has(e)||rt("Cannot "+n),H=(e,t,n)=>(st(e,t,"read from private field"),n?n.call(e):t.get(e)),Z=(e,t,n)=>t.has(e)?rt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),W=(e,t,n,r)=>(st(e,t,"write to private field"),t.set(e,n),n),M,ee,ae,le,ue;const wn=new TextEncoder,mn=new TextDecoder,xn=R(L,j(1/0))[1];class Bn{constructor(t,n=!1){if(Z(this,M),Z(this,ee,null),Z(this,ae,null),Z(this,le,null),Z(this,ue,null),Q(this,"asText",()=>H(this,ue)??W(this,ue,mn.decode(H(this,M)))),Q(this,"asHex",()=>H(this,ae)||W(this,ae,ve(H(this,M)))),Q(this,"asOpaqueHex",()=>H(this,le)||W(this,le,ve(this.asBytes()))),Q(this,"asBytes",()=>H(this,M)),Q(this,"asOpaqueBytes",()=>H(this,ee)||W(this,ee,Y(L[0](H(this,M).length),H(this,M)))),n){try{const[r,s]=xn(t);if(r===s.length){W(this,M,s),W(this,ee,t);return}}catch{}throw new Error("Invalid opaque bytes")}else W(this,M,t)}static fromText(t){return new this(wn.encode(t))}static fromHex(t){return new this(ye(t))}static fromOpaqueHex(t){return new this(ye(t),!0)}static fromBytes(t){return new this(t)}static fromOpaqueBytes(t){return new this(t,!0)}}M=new WeakMap,ee=new WeakMap,ae=new WeakMap,le=new WeakMap,ue=new WeakMap;const[ar]=pn(),y=se(L,e=>e,Number);se(L,e=>e,BigInt);const it=e=>{const t=j.enc(e);return n=>t(ye(n))},ot=e=>{const t=j.dec(e);return n=>ve(t(n))},te=e=>b(it(e),ot(e));te.enc=it,te.dec=ot;const C=B(_),ct=D(_),En=q({bool:m,char:m,str:m,u8:m,u16:m,u32:m,u64:m,u128:m,u256:m,i8:m,i16:m,i32:m,i64:m,i128:m,i256:m}),at=B(w({name:ct,type:y,typeName:ct,docs:C})),bn=w({len:F,type:y}),An=w({bitStoreType:y,bitOrderType:y}),In=B(w({name:_,fields:at,index:U,docs:C})),Un=q({composite:at,variant:In,sequence:y,array:bn,tuple:B(y),primitive:En,compact:y,bitSequence:An}),_n=w({name:_,type:D(y)}),kn=B(_n),Ln=w({id:y,path:C,params:kn,def:Un,docs:C}),lt=B(Ln),Sn=q({Blake2128:m,Blake2256:m,Blake2128Concat:m,Twox128:m,Twox256:m,Twox64Concat:m,Identity:m}),Tn=B(Sn),Dn=w({hashers:Tn,key:y,value:y}),On=w({name:_,modifier:U,type:q({plain:y,map:Dn}),fallback:te(),docs:C}),Hn=D(w({prefix:_,items:B(On)})),ut={name:_,storage:Hn,calls:D(y),events:D(y),constants:B(w({name:_,type:y,value:te(),docs:C})),errors:D(y),index:U},Mn={...ut,docs:C},Cn=new Uint8Array,ht=e=>b(()=>Cn,()=>e),$n=w({type:y,version:U,signedExtensions:B(w({identifier:_,type:y,additionalSigned:y}))}),Nn=w({lookup:lt,pallets:B(w({...ut,docs:ht([])})),extrinsic:$n,type:y,apis:ht([])}),Vn=w({name:_,methods:B(w({name:_,inputs:B(w({name:_,type:y})),output:y,docs:C})),docs:C}),Pn=w({version:U,address:y,call:y,signature:y,extra:y,signedExtensions:B(w({identifier:_,type:y,additionalSigned:y}))}),jn=w({lookup:lt,pallets:B(w(Mn)),extrinsic:Pn,type:y,apis:B(Vn),outerEnums:w({call:y,event:y,error:y}),custom:B(R(_,w({type:y,value:te()})))}),dt=()=>{throw new Error("Unsupported metadata version!")},k=b(dt,dt),he=w({magicNumber:F,metadata:q({v0:k,v1:k,v2:k,v3:k,v4:k,v5:k,v6:k,v7:k,v8:k,v9:k,v10:k,v11:k,v12:k,v13:k,v14:Nn,v15:jn})}),Ie=j(),qn=D(Ie),Rn=R(L,Ie),Kn=e=>{try{return he.dec(e)}catch{}try{return he.dec(qn.dec(e))}catch{}try{return he.dec(Ie.dec(e))}catch{}try{return he.dec(Rn.dec(e)[1])}catch{}throw null},Wn={dkLen:32},Xn=e=>be(e,Wn),ft=(e,t)=>e.type==="array"&&e.len===t&&e.value.type==="primitive"&&e.value.value==="u8",P={type:"void"},Fn=(e,t=()=>null)=>{const n=new Map,r=new Set,s=v=>u=>{let l=n.get(u);if(l)return l;if(r.has(u)){const h={id:u};return n.set(u,h),h}r.add(u);const g=v(u);return l=n.get(u),l?Object.assign(l,g):(l={id:u,...g},n.set(u,l)),r.delete(u),l};let i=!0,o=!0;const c=s(v=>{const u=t(e[v]);if(u)return u;const{def:l,path:g,params:h}=e[v];if(l.tag==="composite"){if(l.value.length===0)return P;if(l.value.length===1){const f=c(l.value[0].type);return i&&g.at(-1)==="AccountId32"&&ft(f,32)?(i=!1,{type:"AccountId32"}):o&&g.at(-1)==="AccountId20"&&ft(f,20)?(o=!1,{type:"AccountId20"}):f}return d(l.value)}if(l.tag==="variant"){if(g.length===1&&g[0]==="Option"&&h.length===1&&h[0].name==="T"){const A=c(h[0].type);return A.type==="void"?{type:"primitive",value:"bool"}:{type:"option",value:A}}if(g.length===1&&g[0]==="Result"&&h.length===2&&h[0].name==="T"&&h[1].name==="E")return{type:"result",value:{ok:c(h[0].type),ko:c(h[1].type)}};if(l.value.length===0)return P;const f={},x={};return l.value.forEach(A=>{const fe=A.name;if(x[fe]=A.docs,A.fields.length===0){f[fe]={...P,idx:A.index};return}if(A.fields.length===1&&!A.fields[0].name){f[fe]={type:"lookupEntry",value:c(A.fields[0].type),idx:A.index};return}f[fe]={...d(A.fields),idx:A.index}}),{type:"enum",value:f,innerDocs:x}}if(l.tag==="sequence")return{type:"sequence",value:c(l.value)};if(l.tag==="array"){const{len:f}=l.value,x=c(l.value.type);return!f||x.type==="void"?P:f>1?{type:"array",value:x,len:l.value.len}:x}if(l.tag==="tuple")return l.value.length===0?P:l.value.length>1?p(l.value.map(f=>c(f)),l.value.map(f=>e[f].docs)):c(l.value[0]);if(l.tag==="primitive")return{type:"primitive",value:l.value.tag};if(l.tag==="compact"){const f=c(l.value);return f.type==="void"?P:{type:"compact",isBig:Number(f.value.slice(1))>32,size:f.value}}return{type:l.tag}}),d=v=>{let u=!0;const l={},g={};return v.forEach((h,f)=>{u=u&&!!h.name;const x=h.name||f,A=c(h.type);A.type!=="void"&&(l[x]=A,g[x]=h.docs)}),u?{type:"struct",value:l,innerDocs:g}:p(Object.values(l),Object.values(g))},p=(v,u)=>{if(v.every(l=>l.id===v[0].id)&&u.every(l=>!l.length)){const[l]=v;return l.type==="void"?P:{type:"array",value:v[0],len:v.length}}return{type:"tuple",value:v,innerDocs:u}};return c},Gn=e=>{const t=Fn(e.lookup,({def:s})=>{if(s.tag==="composite"){const i=n(s);if(i)return{type:"enum",innerDocs:{},value:Object.fromEntries(e.pallets.map(o=>[o.name,o.errors==null?{...P,idx:o.index}:{type:"lookupEntry",value:t(o.errors),idx:o.index}])),byteLength:i}}return null});function n(s){if(!(s.value.length===2&&s.value[0].name==="index"&&s.value[1].name==="error"))return null;const o=t(s.value[0].type),c=t(s.value[1].type);return o.type==="primitive"&&o.value==="u8"&&c.type==="array"&&c.value.type==="primitive"&&c.value.value==="u8"?1+c.len:null}return Object.assign(t,{metadata:e,call:"outerEnums"in e?e.outerEnums.call:e.lookup[e.extrinsic?.type]?.params.find(o=>o.name==="Call")?.type??null})},zn=we(U.enc,e=>+!!e.signed<<7|e.version),Ue=()=>new Error("Unkown signer"),Yn=e=>{const{extrinsic:t}=e,n=Gn(e);let r,s;if("address"in t)r=n(t.address),s=n(t.signature);else{const i=Object.fromEntries(e.lookup[t.type].params.filter(o=>o.type!=null).map(o=>[o.name,n(o.type)]));if(r=i.Address,s=i.Signature,!r||!s)throw Ue()}if(r.type==="AccountId20"&&s.type==="array"&&s.len===65&&s.value.type==="primitive"&&s.value.value==="u8")return[1,[]];if(s.type!=="enum"||["Ecdsa","Ed25519","Sr25519"].some(i=>!(i in s.value)))throw Ue();if(r.type==="enum"){const i=r.value.Id;if(i.type==="lookupEntry"&&i.value.type==="AccountId32")return[0,[i.idx]]}else if(r.type==="AccountId32")return[0,[]];throw Ue()},Jn={Ed25519:0,Sr25519:1,Ecdsa:2},Qn=(e,t,n,r,s,i)=>{const[o,c]=Yn(e),d=Y(zn({signed:!0,version:4}),o===1?t:new Uint8Array([...c,...t]),o===1||!i?n:new Uint8Array([Jn[i],...n]),...r,s);return Y(L.enc(d.length),d)},[de,ne]=["<Bytes>","</Bytes>"].map(e=>Bn.fromText(e).asBytes()),Zn=e=>async t=>{let n=!0,r;for(r=0;n&&r<de.length;r++)n=de[r]===t[r];n=n&&r===de.length;const s=t.length-ne.length;for(r=0;n&&r<ne.length;r++)n=ne[r]===t[s+r];return n=n&&r===ne.length,e(n?t:Y(de,t,ne))};function er(e,t,n){return{publicKey:e,signTx:async(s,i,o,c,d=Xn)=>{let p;try{const h=Kn(o);if(h.metadata.tag!=="v14"&&h.metadata.tag!=="v15")throw null;p=h.metadata.value}catch{throw new Error("Unsupported metadata version")}const v=[],u=[];p.extrinsic.signedExtensions.map(({identifier:h})=>{const f=i[h];if(!f)throw new Error(`Missing ${h} signed extension`);v.push(f.value),u.push(f.additionalSigned)});const l=Y(s,...v,...u),g=await n(l.length>256?d(l):l);return Qn(p,e,g,v,s,t)},signBytes:Zn(n)}}z.getPolkadotSigner=er});
|
|
1
|
+
(function(F,K){typeof exports=="object"&&typeof module<"u"?K(exports):typeof define=="function"&&define.amd?define(["exports"],K):(F=typeof globalThis<"u"?globalThis:F||self,K(F.papiSigner={}))})(this,function(F){"use strict";const K="0123456789abcdef";function fe(e){const t=new Array(e.length+1);t[0]="0x";for(let n=0;n<e.length;){const r=e[n++];t[n]=K[r>>4]+K[r&15]}return t.join("")}const de={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function ve(e){const t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,s=new Uint8Array(r);t&&(s[0]=0|de[e[2]]);for(let i=0;i<r;){const o=n+i*2,c=de[e[o]],h=de[e[o+1]];s[t+i++]=c<<4|h}return s}const G=(...e)=>{const t=e.reduce((r,s)=>r+s.byteLength,0),n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const i=e[r];n.set(i,s),s+=i.byteLength}return n};var wt=Object.defineProperty,mt=(e,t,n)=>t in e?wt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ue=(e,t,n)=>(mt(e,typeof t!="symbol"?t+"":t,n),n),pe={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function xt(e){const t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,s=new Uint8Array(r);t&&(s[0]=0|pe[e[2]]);for(let i=0;i<r;){const o=n+i*2,c=pe[e[o]],h=pe[e[o+1]];s[t+i++]=c<<4|h}return s}var _e=class extends Uint8Array{constructor(e){super(e),Ue(this,"i",0),Ue(this,"v"),this.v=new DataView(e)}},O=e=>t=>e(t instanceof _e?t:new _e(t instanceof Uint8Array?t.buffer:typeof t=="string"?xt(t).buffer:t)),D=e=>{const t=e.length;let n=0;for(let s=0;s<t;s++)n+=e[s].length;const r=new Uint8Array(n);for(let s=0,i=0;s<t;s++){const o=e[s];r.set(o,i),i+=o.byteLength}return r};function te(e,t){const n=Object.keys(e),r=n.length,s={};for(let i=0;i<r;i++){const o=n[i];s[o]=t(e[o],o)}return s}var B=(e,t)=>{const n=[e,t];return n.enc=e,n.dec=t,n},ye=(e,t)=>n=>e(t(n)),ke=(e,t)=>n=>t(e(n)),ne=([e,t],n,r)=>B(ye(e,n),ke(t,r));function Et(e,t){return O(n=>{const r=n.v[t](n.i,!0);return n.i+=e,r})}function bt(e,t){return n=>{const r=new Uint8Array(e);return new DataView(r.buffer)[t](0,n,!0),r}}function C(e,t,n){return B(bt(e,n),Et(e,t))}var I=C(1,"getUint8","setUint8"),re=C(2,"getUint16","setUint16"),W=C(4,"getUint32","setUint32"),Oe=C(8,"getBigUint64","setBigUint64");C(1,"getInt8","setInt8"),C(2,"getInt16","setInt16"),C(4,"getInt32","setInt32"),C(8,"getBigInt64","setBigInt64");var De=e=>{const t=new Uint8Array(16),n=new DataView(t.buffer);return n.setBigInt64(0,e,!0),n.setBigInt64(8,e>>64n,!0),t},Te=e=>O(t=>{const{v:n,i:r}=t,s=n.getBigUint64(r,!0),i=n[e](r+8,!0);return t.i+=16,i<<64n|s});B(De,Te("getBigUint64")),B(De,Te("getBigInt64"));var Le=e=>{const t=new Uint8Array(32),n=new DataView(t.buffer);return n.setBigInt64(0,e,!0),n.setBigInt64(8,e>>64n,!0),n.setBigInt64(16,e>>128n,!0),n.setBigInt64(24,e>>192n,!0),t},Se=e=>O(t=>{let n=t.v.getBigUint64(t.i,!0);return t.i+=8,n|=t.v.getBigUint64(t.i,!0)<<64n,t.i+=8,n|=t.v.getBigUint64(t.i,!0)<<128n,t.i+=8,n|=t.v[e](t.i,!0)<<192n,t.i+=8,n});B(Le,Se("getBigUint64")),B(Le,Se("getBigInt64")),ne(I,e=>e?1:0,Boolean);var Bt=[I[1],re[1],W[1]],At=O(e=>{const t=e[e.i],n=t&3;if(n<3)return Bt[n](e)>>>2;const r=(t>>>2)+4;e.i++;let s=0n;const i=r/8|0;let o=0n;for(let h=0;h<i;h++)s=Oe[1](e)<<o|s,o+=64n;let c=r%8;return c>3&&(s=BigInt(W[1](e))<<o|s,o+=32n,c-=4),c>1&&(s=BigInt(re[1](e))<<o|s,o+=16n,c-=2),c&&(s=BigInt(I[1](e))<<o|s),s}),It=1n<<56n,Ut=1<<24,_t=256,kt=4294967295n,Ot=64,Dt=16384,Tt=1<<30,Lt=e=>{if(e<0)throw new Error(`Wrong compact input (${e})`);const t=Number(e)<<2;if(e<Ot)return I[0](t);if(e<Dt)return re[0](t|1);if(e<Tt)return W[0](t|2);let n=[new Uint8Array(1)],r=BigInt(e);for(;r>=It;)n.push(Oe[0](r)),r>>=64n;r>=Ut&&(n.push(W[0](Number(r&kt))),r>>=32n);let s=Number(r);s>=_t&&(n.push(re[0](s)),s>>=16),s&&n.push(I[0](s));const i=D(n);return i[0]=i.length-5<<2|3,i},k=B(Lt,At),St=new TextEncoder,Mt=e=>{const t=St.encode(e);return D([k.enc(t.length),t])},$t=new TextDecoder,Ct=O(e=>{let t=k.dec(e);const n=new DataView(e.buffer,e.i,t);return e.i+=t,$t.decode(n)}),U=B(Mt,Ct),Nt=()=>{},Vt=new Uint8Array(0),m=B(()=>Vt,Nt),Me=e=>e===void 0?t=>D([k.enc(t.length),t]):t=>t.length===e?t:t.slice(0,e),$e=e=>O(t=>{const n=e===void 0?k.dec(t):e!==1/0?e:t.byteLength-t.i,r=new Uint8Array(t.buffer.slice(t.i,t.i+n));return t.i+=n,r}),P=e=>B(Me(e),$e(e));P.enc=Me,P.dec=$e;var Ce=(e,t)=>{const n=Object.keys(e),r=new Map(t?.map((i,o)=>[n[o],i])??n.map((i,o)=>[i,o])),s=i=>r.get(i);return({tag:i,value:o})=>D([I.enc(s(i)),e[i](o)])},Ne=(e,t)=>{const n=Object.keys(e),r=new Map(t?.map((s,i)=>[s,n[i]])??n.map((s,i)=>[i,s]));return O(s=>{const i=I.dec(s),o=r.get(i),c=e[o];return{tag:o,value:c(s)}})},j=(e,...t)=>B(Ce(te(e,([n])=>n),...t),Ne(te(e,([,n])=>n),...t));j.enc=Ce,j.dec=Ne;var Ve=e=>O(t=>I[1](t)>0?e(t):void 0),He=e=>t=>{const n=new Uint8Array(1);return t===void 0?n:(n[0]=1,D([n,e(t)]))},T=e=>B(He(e[0]),Ve(e[1]));T.enc=He,T.dec=Ve;var Pe=(...e)=>O(t=>e.map(n=>n(t))),je=(...e)=>t=>D(e.map((n,r)=>n(t[r]))),q=(...e)=>B(je(...e.map(([t])=>t)),Pe(...e.map(([,t])=>t)));q.enc=je,q.dec=Pe;var qe=e=>{const t=Object.keys(e);return ye(q.enc(...Object.values(e)),n=>t.map(r=>n[r]))},Re=e=>{const t=Object.keys(e);return ke(q.dec(...Object.values(e)),n=>Object.fromEntries(n.map((r,s)=>[t[s],r])))},w=e=>B(qe(te(e,t=>t[0])),Re(te(e,t=>t[1])));w.enc=qe,w.dec=Re;var Ke=(e,t)=>t>=0?n=>D(n.map(e)):n=>D([k.enc(n.length),D(n.map(e))]),We=(e,t)=>O(n=>{const r=t>=0?t:k.dec(n),s=new Array(r);for(let i=0;i<r;i++)s[i]=e(n);return s}),E=(e,t)=>B(Ke(e[0],t),We(e[1],t));E.enc=Ke,E.dec=We;/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ht(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Xe(e,t){return Array.isArray(t)?t.length===0?!0:e?t.every(n=>typeof n=="string"):t.every(n=>Number.isSafeInteger(n)):!1}function ge(e,t){if(typeof t!="string")throw new Error(`${e}: string expected`);return!0}function Fe(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function we(e){if(!Array.isArray(e))throw new Error("array expected")}function Ge(e,t){if(!Xe(!0,t))throw new Error(`${e}: array of strings expected`)}function Pt(e,t){if(!Xe(!1,t))throw new Error(`${e}: array of numbers expected`)}function jt(...e){const t=i=>i,n=(i,o)=>c=>i(o(c)),r=e.map(i=>i.encode).reduceRight(n,t),s=e.map(i=>i.decode).reduce(n,t);return{encode:r,decode:s}}function qt(e){const t=typeof e=="string"?e.split(""):e,n=t.length;Ge("alphabet",t);const r=new Map(t.map((s,i)=>[s,i]));return{encode:s=>(we(s),s.map(i=>{if(!Number.isSafeInteger(i)||i<0||i>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${i}". Allowed: ${e}`);return t[i]})),decode:s=>(we(s),s.map(i=>{ge("alphabet.decode",i);const o=r.get(i);if(o===void 0)throw new Error(`Unknown letter: "${i}". Allowed: ${e}`);return o}))}}function Rt(e=""){return ge("join",e),{encode:t=>(Ge("join.decode",t),t.join(e)),decode:t=>(ge("join.decode",t),t.split(e))}}function ze(e,t,n){if(t<2)throw new Error(`convertRadix: invalid from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: invalid to=${n}, base cannot be less than 2`);if(we(e),!e.length)return[];let r=0;const s=[],i=Array.from(e,c=>{if(Fe(c),c<0||c>=t)throw new Error(`invalid integer: ${c}`);return c}),o=i.length;for(;;){let c=0,h=!0;for(let p=r;p<o;p++){const v=i[p],l=t*c,u=l+v;if(!Number.isSafeInteger(u)||l/t!==c||u-v!==l)throw new Error("convertRadix: carry overflow");const g=u/n;c=u%n;const f=Math.floor(g);if(i[p]=f,!Number.isSafeInteger(f)||f*n+c!==u)throw new Error("convertRadix: carry overflow");if(h)f?h=!1:r=p;else continue}if(s.push(c),h)break}for(let c=0;c<e.length-1&&e[c]===0;c++)s.push(0);return s.reverse()}function Kt(e){Fe(e);const t=2**8;return{encode:n=>{if(!Ht(n))throw new Error("radix.encode input should be Uint8Array");return ze(Array.from(n),t,e)},decode:n=>(Pt("radix.decode",n),Uint8Array.from(ze(n,e,t)))}}const Ye=(e=>jt(Kt(58),qt(e),Rt("")))("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Wt(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function me(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function xe(e,...t){if(!Wt(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Je(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){xe(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function se(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Ee(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const Qe=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Ze(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const L=Qe?e=>e:e=>Ze(e);function Ft(e){for(let t=0;t<e.length;t++)e[t]=Ze(e[t]);return e}const X=Qe?e=>e:Ft;function Gt(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function z(e){return typeof e=="string"&&(e=Gt(e)),xe(e),e}class zt{}function Yt(e){const t=(r,s)=>e(s).update(z(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}const Jt=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]),ie=BigInt(2**32-1),et=BigInt(32);function Qt(e,t=!1){return t?{h:Number(e&ie),l:Number(e>>et&ie)}:{h:Number(e>>et&ie)|0,l:Number(e&ie)|0}}const tt=(e,t,n)=>e>>>n|t<<32-n,nt=(e,t,n)=>e<<32-n|t>>>n,Zt=(e,t,n)=>e<<64-n|t>>>n-32,en=(e,t,n)=>e>>>n-32|t<<64-n,tn=(e,t)=>t,nn=(e,t)=>e;function rt(e,t,n,r){const s=(t>>>0)+(r>>>0);return{h:e+n+(s/2**32|0)|0,l:s|0}}const st=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),it=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,b=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),a=new Uint32Array(32);function N(e,t,n,r,s,i){const o=s[i],c=s[i+1];let h=a[2*e],p=a[2*e+1],v=a[2*t],l=a[2*t+1],u=a[2*n],g=a[2*n+1],f=a[2*r],d=a[2*r+1],x=st(h,v,o);p=it(x,p,l,c),h=x|0,{Dh:d,Dl:f}={Dh:d^p,Dl:f^h},{Dh:d,Dl:f}={Dh:tn(d,f),Dl:nn(d)},{h:g,l:u}=rt(g,u,d,f),{Bh:l,Bl:v}={Bh:l^g,Bl:v^u},{Bh:l,Bl:v}={Bh:tt(l,v,24),Bl:nt(l,v,24)},a[2*e]=h,a[2*e+1]=p,a[2*t]=v,a[2*t+1]=l,a[2*n]=u,a[2*n+1]=g,a[2*r]=f,a[2*r+1]=d}function V(e,t,n,r,s,i){const o=s[i],c=s[i+1];let h=a[2*e],p=a[2*e+1],v=a[2*t],l=a[2*t+1],u=a[2*n],g=a[2*n+1],f=a[2*r],d=a[2*r+1],x=st(h,v,o);p=it(x,p,l,c),h=x|0,{Dh:d,Dl:f}={Dh:d^p,Dl:f^h},{Dh:d,Dl:f}={Dh:tt(d,f,16),Dl:nt(d,f,16)},{h:g,l:u}=rt(g,u,d,f),{Bh:l,Bl:v}={Bh:l^g,Bl:v^u},{Bh:l,Bl:v}={Bh:Zt(l,v,63),Bl:en(l,v,63)},a[2*e]=h,a[2*e+1]=p,a[2*t]=v,a[2*t+1]=l,a[2*n]=u,a[2*n+1]=g,a[2*r]=f,a[2*r+1]=d}function rn(e,t={},n,r,s){if(me(n),e<0||e>n)throw new Error("outputLen bigger than keyLen");const{key:i,salt:o,personalization:c}=t;if(i!==void 0&&(i.length<1||i.length>n))throw new Error("key length must be undefined or 1.."+n);if(o!==void 0&&o.length!==r)throw new Error("salt must be undefined or "+r);if(c!==void 0&&c.length!==s)throw new Error("personalization must be undefined or "+s)}class sn extends zt{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,me(t),me(n),this.blockLen=t,this.outputLen=n,this.buffer=new Uint8Array(t),this.buffer32=se(this.buffer)}update(t){Je(this),t=z(t),xe(t);const{blockLen:n,buffer:r,buffer32:s}=this,i=t.length,o=t.byteOffset,c=t.buffer;for(let h=0;h<i;){this.pos===n&&(X(s),this.compress(s,0,!1),X(s),this.pos=0);const p=Math.min(n-this.pos,i-h),v=o+h;if(p===n&&!(v%4)&&h+p<i){const l=new Uint32Array(c,v,Math.floor((i-h)/4));X(l);for(let u=0;h+n<i;u+=s.length,h+=n)this.length+=n,this.compress(l,u,!1);X(l);continue}r.set(t.subarray(h,h+p),this.pos),this.pos+=p,this.length+=p,h+=p}return this}digestInto(t){Je(this),Xt(t,this);const{pos:n,buffer32:r}=this;this.finished=!0,Ee(this.buffer.subarray(n)),X(r),this.compress(r,0,!0),X(r);const s=se(t);this.get().forEach((i,o)=>s[o]=L(i))}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){const{buffer:n,length:r,finished:s,destroyed:i,outputLen:o,pos:c}=this;return t||(t=new this.constructor({dkLen:o})),t.set(...this.get()),t.buffer.set(n),t.destroyed=i,t.finished=s,t.length=r,t.pos=c,t.outputLen=o,t}clone(){return this._cloneInto()}}class on extends sn{constructor(t={}){const n=t.dkLen===void 0?64:t.dkLen;super(128,n),this.v0l=b[0]|0,this.v0h=b[1]|0,this.v1l=b[2]|0,this.v1h=b[3]|0,this.v2l=b[4]|0,this.v2h=b[5]|0,this.v3l=b[6]|0,this.v3h=b[7]|0,this.v4l=b[8]|0,this.v4h=b[9]|0,this.v5l=b[10]|0,this.v5h=b[11]|0,this.v6l=b[12]|0,this.v6h=b[13]|0,this.v7l=b[14]|0,this.v7h=b[15]|0,rn(n,t,64,16,16);let{key:r,personalization:s,salt:i}=t,o=0;if(r!==void 0&&(r=z(r),o=r.length),this.v0l^=this.outputLen|o<<8|65536|1<<24,i!==void 0){i=z(i);const c=se(i);this.v4l^=L(c[0]),this.v4h^=L(c[1]),this.v5l^=L(c[2]),this.v5h^=L(c[3])}if(s!==void 0){s=z(s);const c=se(s);this.v6l^=L(c[0]),this.v6h^=L(c[1]),this.v7l^=L(c[2]),this.v7h^=L(c[3])}if(r!==void 0){const c=new Uint8Array(this.blockLen);c.set(r),this.update(c)}}get(){let{v0l:t,v0h:n,v1l:r,v1h:s,v2l:i,v2h:o,v3l:c,v3h:h,v4l:p,v4h:v,v5l:l,v5h:u,v6l:g,v6h:f,v7l:d,v7h:x}=this;return[t,n,r,s,i,o,c,h,p,v,l,u,g,f,d,x]}set(t,n,r,s,i,o,c,h,p,v,l,u,g,f,d,x){this.v0l=t|0,this.v0h=n|0,this.v1l=r|0,this.v1h=s|0,this.v2l=i|0,this.v2h=o|0,this.v3l=c|0,this.v3h=h|0,this.v4l=p|0,this.v4h=v|0,this.v5l=l|0,this.v5h=u|0,this.v6l=g|0,this.v6h=f|0,this.v7l=d|0,this.v7h=x|0}compress(t,n,r){this.get().forEach((h,p)=>a[p]=h),a.set(b,16);let{h:s,l:i}=Qt(BigInt(this.length));a[24]=b[8]^i,a[25]=b[9]^s,r&&(a[28]=~a[28],a[29]=~a[29]);let o=0;const c=Jt;for(let h=0;h<12;h++)N(0,4,8,12,t,n+2*c[o++]),V(0,4,8,12,t,n+2*c[o++]),N(1,5,9,13,t,n+2*c[o++]),V(1,5,9,13,t,n+2*c[o++]),N(2,6,10,14,t,n+2*c[o++]),V(2,6,10,14,t,n+2*c[o++]),N(3,7,11,15,t,n+2*c[o++]),V(3,7,11,15,t,n+2*c[o++]),N(0,5,10,15,t,n+2*c[o++]),V(0,5,10,15,t,n+2*c[o++]),N(1,6,11,12,t,n+2*c[o++]),V(1,6,11,12,t,n+2*c[o++]),N(2,7,8,13,t,n+2*c[o++]),V(2,7,8,13,t,n+2*c[o++]),N(3,4,9,14,t,n+2*c[o++]),V(3,4,9,14,t,n+2*c[o++]);this.v0l^=a[0]^a[16],this.v0h^=a[1]^a[17],this.v1l^=a[2]^a[18],this.v1h^=a[3]^a[19],this.v2l^=a[4]^a[20],this.v2h^=a[5]^a[21],this.v3l^=a[6]^a[22],this.v3h^=a[7]^a[23],this.v4l^=a[8]^a[24],this.v4h^=a[9]^a[25],this.v5l^=a[10]^a[26],this.v5h^=a[11]^a[27],this.v6l^=a[12]^a[28],this.v6h^=a[13]^a[29],this.v7l^=a[14]^a[30],this.v7h^=a[15]^a[31],Ee(a)}destroy(){this.destroyed=!0,Ee(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const be=Yt(e=>new on(e)),ot=new TextEncoder().encode("SS58PRE"),Be=2,cn=e=>{try{const t=Ye.decode(e),n=t.subarray(0,t[0]&64?2:1),r=t.subarray(n.length,t.length-Be),s=t.subarray(n.length+r.length),i=be(Uint8Array.of(...ot,...n,...r),{dkLen:64}).subarray(0,Be);return s[0]===i[0]&&s[1]===i[1]?{isValid:!0,ss58Format:an(n),publicKey:r.slice()}:{isValid:!1}}catch{return{isValid:!1}}},an=e=>{const t=new DataView(e.buffer,e.byteOffset,e.byteLength);return t.byteLength===1?t.getUint8(0):t.getUint16(0)},un=e=>{const t=e<64?Uint8Array.of(e):Uint8Array.of((e&252)>>2|64,e>>8|(e&3)<<6);return n=>{const r=be(Uint8Array.of(...ot,...t,...n),{dkLen:64}).subarray(0,Be);return Ye.encode(Uint8Array.of(...t,...n,...r))}};function ln(e,t){return n=>{const r=cn(n);if(!r.isValid)throw new Error("Invalid checksum");const{publicKey:s}=r;if(s.length!==e)throw new Error("Invalid public key length");return s}}const hn=(e=42,t=32)=>ne(P(t),ln(t),un(e));var fn=Object.defineProperty,ct=e=>{throw TypeError(e)},dn=(e,t,n)=>t in e?fn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Y=(e,t,n)=>dn(e,typeof t!="symbol"?t+"":t,n),at=(e,t,n)=>t.has(e)||ct("Cannot "+n),S=(e,t,n)=>(at(e,t,"read from private field"),n?n.call(e):t.get(e)),J=(e,t,n)=>t.has(e)?ct("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),R=(e,t,n,r)=>(at(e,t,"write to private field"),t.set(e,n),n),M,Q,oe,ce,ae;const vn=new TextEncoder,pn=new TextDecoder,yn=q(k,P(1/0))[1];class gn{constructor(t,n=!1){if(J(this,M),J(this,Q,null),J(this,oe,null),J(this,ce,null),J(this,ae,null),Y(this,"asText",()=>S(this,ae)??R(this,ae,pn.decode(S(this,M)))),Y(this,"asHex",()=>S(this,oe)||R(this,oe,fe(S(this,M)))),Y(this,"asOpaqueHex",()=>S(this,ce)||R(this,ce,fe(this.asBytes()))),Y(this,"asBytes",()=>S(this,M)),Y(this,"asOpaqueBytes",()=>S(this,Q)||R(this,Q,G(k[0](S(this,M).length),S(this,M)))),n){try{const[r,s]=yn(t);if(r===s.length){R(this,M,s),R(this,Q,t);return}}catch{}throw new Error("Invalid opaque bytes")}else R(this,M,t)}static fromText(t){return new this(vn.encode(t))}static fromHex(t){return new this(ve(t))}static fromOpaqueHex(t){return new this(ve(t),!0)}static fromBytes(t){return new this(t)}static fromOpaqueBytes(t){return new this(t,!0)}}M=new WeakMap,Q=new WeakMap,oe=new WeakMap,ce=new WeakMap,ae=new WeakMap;const[Zn]=hn(),y=ne(k,e=>e,Number);ne(k,e=>e,BigInt);const ut=e=>{const t=P.enc(e);return n=>t(ve(n))},lt=e=>{const t=P.dec(e);return n=>fe(t(n))},Z=e=>B(ut(e),lt(e));Z.enc=ut,Z.dec=lt;const $=E(U),ht=T(U),wn=j({bool:m,char:m,str:m,u8:m,u16:m,u32:m,u64:m,u128:m,u256:m,i8:m,i16:m,i32:m,i64:m,i128:m,i256:m}),ft=E(w({name:ht,type:y,typeName:ht,docs:$})),mn=w({len:W,type:y}),xn=w({bitStoreType:y,bitOrderType:y}),En=E(w({name:U,fields:ft,index:I,docs:$})),bn=j({composite:ft,variant:En,sequence:y,array:mn,tuple:E(y),primitive:wn,compact:y,bitSequence:xn}),Bn=w({name:U,type:T(y)}),An=E(Bn),In=w({id:y,path:$,params:An,def:bn,docs:$}),dt=E(In),Un=j({Blake2128:m,Blake2256:m,Blake2128Concat:m,Twox128:m,Twox256:m,Twox64Concat:m,Identity:m}),_n=E(Un),kn=w({hashers:_n,key:y,value:y}),On=w({name:U,modifier:I,type:j({plain:y,map:kn}),fallback:Z(),docs:$}),Dn=T(w({prefix:U,items:E(On)})),vt={name:U,storage:Dn,calls:T(y),events:T(y),constants:E(w({name:U,type:y,value:Z(),docs:$})),errors:T(y),index:I},Tn={...vt,docs:$},Ln=new Uint8Array,pt=e=>B(()=>Ln,()=>e),Sn=w({type:y,version:I,signedExtensions:E(w({identifier:U,type:y,additionalSigned:y}))}),Mn=w({lookup:dt,pallets:E(w({...vt,docs:pt([])})),extrinsic:Sn,type:y,apis:pt([])}),$n=w({name:U,methods:E(w({name:U,inputs:E(w({name:U,type:y})),output:y,docs:$})),docs:$}),Cn=w({version:I,address:y,call:y,signature:y,extra:y,signedExtensions:E(w({identifier:U,type:y,additionalSigned:y}))}),Nn=w({lookup:dt,pallets:E(w(Tn)),extrinsic:Cn,type:y,apis:E($n),outerEnums:w({call:y,event:y,error:y}),custom:E(q(U,w({type:y,value:Z()})))}),yt=()=>{throw new Error("Unsupported metadata version!")},_=B(yt,yt),ue=w({magicNumber:W,metadata:j({v0:_,v1:_,v2:_,v3:_,v4:_,v5:_,v6:_,v7:_,v8:_,v9:_,v10:_,v11:_,v12:_,v13:_,v14:Mn,v15:Nn})}),Ae=P(),Vn=T(Ae),Hn=q(k,Ae),Pn=e=>{try{return ue.dec(e)}catch{}try{return ue.dec(Vn.dec(e))}catch{}try{return ue.dec(Ae.dec(e))}catch{}try{return ue.dec(Hn.dec(e)[1])}catch{}throw null},jn={dkLen:32},qn=e=>be(e,jn),gt=(e,t)=>e.type==="array"&&e.len===t&&e.value.type==="primitive"&&e.value.value==="u8",H={type:"void"},Rn=(e,t=()=>null)=>{const n=new Map,r=new Set,s=v=>l=>{let u=n.get(l);if(u)return u;if(r.has(l)){const f={id:l};return n.set(l,f),f}r.add(l);const g=v(l);return u=n.get(l),u?Object.assign(u,g):(u={id:l,...g},n.set(l,u)),r.delete(l),u};let i=!0,o=!0;const c=s(v=>{const l=t(e[v]);if(l)return l;const{def:u,path:g,params:f}=e[v];if(u.tag==="composite"){if(u.value.length===0)return H;if(u.value.length===1){const d=c(u.value[0].type);return i&&g.at(-1)==="AccountId32"&>(d,32)?(i=!1,{type:"AccountId32"}):o&&g.at(-1)==="AccountId20"&>(d,20)?(o=!1,{type:"AccountId20"}):d}return h(u.value)}if(u.tag==="variant"){if(g.length===1&&g[0]==="Option"&&f.length===1&&f[0].name==="T"){const A=c(f[0].type);return A.type==="void"?{type:"primitive",value:"bool"}:{type:"option",value:A}}if(g.length===1&&g[0]==="Result"&&f.length===2&&f[0].name==="T"&&f[1].name==="E")return{type:"result",value:{ok:c(f[0].type),ko:c(f[1].type)}};if(u.value.length===0)return H;const d={},x={};return u.value.forEach(A=>{const he=A.name;if(x[he]=A.docs,A.fields.length===0){d[he]={...H,idx:A.index};return}if(A.fields.length===1&&!A.fields[0].name){d[he]={type:"lookupEntry",value:c(A.fields[0].type),idx:A.index};return}d[he]={...h(A.fields),idx:A.index}}),{type:"enum",value:d,innerDocs:x}}if(u.tag==="sequence")return{type:"sequence",value:c(u.value)};if(u.tag==="array"){const{len:d}=u.value,x=c(u.value.type);return!d||x.type==="void"?H:d>1?{type:"array",value:x,len:u.value.len}:x}if(u.tag==="tuple")return u.value.length===0?H:u.value.length>1?p(u.value.map(d=>c(d)),u.value.map(d=>e[d].docs)):c(u.value[0]);if(u.tag==="primitive")return{type:"primitive",value:u.value.tag};if(u.tag==="compact"){const d=c(u.value);return d.type==="void"?H:{type:"compact",isBig:Number(d.value.slice(1))>32,size:d.value}}return{type:u.tag}}),h=v=>{let l=!0;const u={},g={};return v.forEach((f,d)=>{l=l&&!!f.name;const x=f.name||d,A=c(f.type);A.type!=="void"&&(u[x]=A,g[x]=f.docs)}),l?{type:"struct",value:u,innerDocs:g}:p(Object.values(u),Object.values(g))},p=(v,l)=>{if(v.every(u=>u.id===v[0].id)&&l.every(u=>!u.length)){const[u]=v;return u.type==="void"?H:{type:"array",value:v[0],len:v.length}}return{type:"tuple",value:v,innerDocs:l}};return c},Kn=e=>{const t=Rn(e.lookup,({def:s})=>{if(s.tag==="composite"){const i=n(s);if(i)return{type:"enum",innerDocs:{},value:Object.fromEntries(e.pallets.map(o=>[o.name,o.errors==null?{...H,idx:o.index}:{type:"lookupEntry",value:t(o.errors),idx:o.index}])),byteLength:i}}return null});function n(s){if(!(s.value.length===2&&s.value[0].name==="index"&&s.value[1].name==="error"))return null;const o=t(s.value[0].type),c=t(s.value[1].type);return o.type==="primitive"&&o.value==="u8"&&c.type==="array"&&c.value.type==="primitive"&&c.value.value==="u8"?1+c.len:null}return Object.assign(t,{metadata:e,call:"outerEnums"in e?e.outerEnums.call:e.lookup[e.extrinsic?.type]?.params.find(o=>o.name==="Call")?.type??null})},Wn=ye(I.enc,e=>+!!e.signed<<7|e.version),Ie=()=>new Error("Unkown signer"),Xn=e=>{const{extrinsic:t}=e,n=Kn(e);let r,s;if("address"in t)r=n(t.address),s=n(t.signature);else{const i=Object.fromEntries(e.lookup[t.type].params.filter(o=>o.type!=null).map(o=>[o.name,n(o.type)]));if(r=i.Address,s=i.Signature,!r||!s)throw Ie()}if(r.type==="AccountId20"&&s.type==="array"&&s.len===65&&s.value.type==="primitive"&&s.value.value==="u8")return[1,[]];if(s.type!=="enum"||["Ecdsa","Ed25519","Sr25519"].some(i=>!(i in s.value)))throw Ie();if(r.type==="enum"){const i=r.value.Id;if(i.type==="lookupEntry"&&i.value.type==="AccountId32")return[0,[i.idx]]}else if(r.type==="AccountId32")return[0,[]];throw Ie()},Fn={Ed25519:0,Sr25519:1,Ecdsa:2},Gn=(e,t,n,r,s,i)=>{const[o,c]=Xn(e),h=G(Wn({signed:!0,version:4}),o===1?t:new Uint8Array([...c,...t]),o===1||!i?n:new Uint8Array([Fn[i],...n]),...r,s);return G(k.enc(h.length),h)},[le,ee]=["<Bytes>","</Bytes>"].map(e=>gn.fromText(e).asBytes()),zn=e=>async t=>{let n=!0,r;for(r=0;n&&r<le.length;r++)n=le[r]===t[r];n=n&&r===le.length;const s=t.length-ee.length;for(r=0;n&&r<ee.length;r++)n=ee[r]===t[s+r];return n=n&&r===ee.length,e(n?t:G(le,t,ee))};function Yn(e,t,n){return{publicKey:e,signTx:async(s,i,o,c,h=qn)=>{let p;try{const f=Pn(o);if(f.metadata.tag!=="v14"&&f.metadata.tag!=="v15")throw null;p=f.metadata.value}catch{throw new Error("Unsupported metadata version")}const v=[],l=[];p.extrinsic.signedExtensions.map(({identifier:f})=>{const d=i[f];if(!d)throw new Error(`Missing ${f} signed extension`);v.push(d.value),l.push(d.additionalSigned)});const u=G(s,...v,...l),g=await n(u.length>256?h(u):u);return Gn(p,e,g,v,s,t)},signBytes:zn(n)}}F.getPolkadotSigner=Yn});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "polkadot-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.1",
|
|
4
4
|
"author": "Josep M Sobrepere (https://github.com/josepot)",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -192,28 +192,28 @@
|
|
|
192
192
|
},
|
|
193
193
|
"dependencies": {
|
|
194
194
|
"@rx-state/core": "^0.1.4",
|
|
195
|
-
"@polkadot-api/cli": "0.11.
|
|
196
|
-
"@polkadot-api/ink-contracts": "0.
|
|
197
|
-
"@polkadot-api/known-chains": "0.7.3",
|
|
198
|
-
"@polkadot-api/metadata-builders": "0.10.2",
|
|
195
|
+
"@polkadot-api/cli": "0.11.12",
|
|
196
|
+
"@polkadot-api/ink-contracts": "0.3.0",
|
|
199
197
|
"@polkadot-api/json-rpc-provider": "0.0.4",
|
|
200
|
-
"@polkadot-api/metadata-compatibility": "0.2.0",
|
|
201
198
|
"@polkadot-api/logs-provider": "0.0.6",
|
|
202
|
-
"@polkadot-api/
|
|
203
|
-
"@polkadot-api/
|
|
204
|
-
"@polkadot-api/
|
|
205
|
-
"@polkadot-api/
|
|
206
|
-
"@polkadot-api/polkadot-signer": "0.1.6",
|
|
199
|
+
"@polkadot-api/metadata-builders": "0.11.0",
|
|
200
|
+
"@polkadot-api/known-chains": "0.7.4",
|
|
201
|
+
"@polkadot-api/metadata-compatibility": "0.2.1",
|
|
202
|
+
"@polkadot-api/observable-client": "0.9.0",
|
|
207
203
|
"@polkadot-api/polkadot-sdk-compat": "2.3.2",
|
|
208
|
-
"@polkadot-api/
|
|
209
|
-
"@polkadot-api/
|
|
210
|
-
"@polkadot-api/utils": "0.1.2",
|
|
204
|
+
"@polkadot-api/pjs-signer": "0.6.6",
|
|
205
|
+
"@polkadot-api/polkadot-signer": "0.1.6",
|
|
211
206
|
"@polkadot-api/smoldot": "0.3.8",
|
|
212
|
-
"@polkadot-api/
|
|
207
|
+
"@polkadot-api/sm-provider": "0.1.7",
|
|
208
|
+
"@polkadot-api/signer": "0.1.16",
|
|
209
|
+
"@polkadot-api/substrate-client": "0.3.0",
|
|
210
|
+
"@polkadot-api/substrate-bindings": "0.12.0",
|
|
211
|
+
"@polkadot-api/ws-provider": "0.4.0",
|
|
212
|
+
"@polkadot-api/utils": "0.1.2"
|
|
213
213
|
},
|
|
214
214
|
"devDependencies": {
|
|
215
215
|
"rxjs": "^7.8.2",
|
|
216
|
-
"@polkadot-api/codegen": "0.
|
|
216
|
+
"@polkadot-api/codegen": "0.14.0"
|
|
217
217
|
},
|
|
218
218
|
"scripts": {
|
|
219
219
|
"build-core": "tsc --noEmit && rollup -c",
|