@notabene/verify-proof 1.8.0 → 1.8.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.
@@ -1,2 +1,2 @@
1
- import{ProofStatus as e,ProofTypes as t}from"@notabene/javascript-sdk";import{encode as r}from"varuint-bitcoin";import n,{createBase58check as s,bech32 as o,base64 as i,base58 as c}from"@scure/base";import{Hash as a,PersonalMessage as u,Hex as d,Signature as f,Secp256k1 as h,Address as l,PublicKey as p,Bytes as y}from"ox";import b,{secp256k1 as g}from"@noble/curves/secp256k1";import{Verifier as A}from"bip322-js";import m from"tweetnacl";import _ from"@cardano-foundation/cardano-verify-datasignature";import{Client as x}from"xrpl";import E from"@noble/curves/abstract/utils";import w from"@noble/curves/ed25519";import{Keypair as H}from"@stellar/stellar-sdk";function I(){return I=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},I.apply(null,arguments)}var v;!function(e){e.P2WPKH="p2wpkh",e.P2SH_P2WPKH="p2sh(p2wpkh)"}(v||(v={}));const S={bitcoin:{messagePrefix:"Bitcoin Signed Message:\n",pubKeyHashVersion:0,scriptHashVersion:5,bech32Prefix:"bc",isTestnet:!1},bitcoincash:{messagePrefix:"Bitcoin Signed Message:\n",pubKeyHashVersion:0,scriptHashVersion:5,bech32Prefix:"bc",isTestnet:!1},litecoin:{messagePrefix:"Litecoin Signed Message:\n",pubKeyHashVersion:48,scriptHashVersion:50,bech32Prefix:"ltc",isTestnet:!1},dogecoin:{messagePrefix:"Dogecoin Signed Message:\n",pubKeyHashVersion:30,scriptHashVersion:22,isTestnet:!1},dash:{messagePrefix:"DarkCoin Signed Message:\n",pubKeyHashVersion:76,scriptHashVersion:16,isTestnet:!1},zcash:{messagePrefix:"Zcash Signed Message:\n",pubKeyHashVersion:Uint8Array.from([28,184]),scriptHashVersion:Uint8Array.from([28,189]),isTestnet:!1},testnet:{messagePrefix:"Bitcoin Signed Message:\n",pubKeyHashVersion:111,scriptHashVersion:196,bech32Prefix:"tb",isTestnet:!0}};var D;function P(t,r){const{attestation:n,proof:s}=r;return I({},r,{status:A.verifySignature(t,n,s)?e.VERIFIED:e.FAILED})}function L(t,n,s){const o=Boolean(s.bech32Prefix&&[D.SEGWIT,D.NATIVE].includes(function(e){if(e.match("^(bc1|tb1|ltc1).*"))return D.NATIVE;if(e.match("^[32M].*"))return D.SEGWIT;if(e.match("^[1nmL].*"))return D.LEGACY;if(e.match("^(D).*"))return D.DOGECOIN;if(e.match("^(q).*"))return D.BCH;throw new Error("INVALID ADDRESS: ".concat(e).concat(" is not a valid or a supported address"))}(t))),c=function(e,t,n,s,o){const{compressed:c,segwitType:u,signature:d}=function(e){const t=i.decode(e);if(65!==t.length)throw new Error("Invalid signature length");const r=t[0]-27;if(r>15||r<0)throw new Error("Invalid signature parameter");const n=!!(12&r),s=3&r,o=g.Signature.fromCompact(t.slice(1));return{compressed:n,segwitType:8&r?4&r?v.P2WPKH:v.P2SH_P2WPKH:void 0,signature:o.addRecoveryBit(s)}}(n);if(s&&!c)throw new Error("checkSegwitAlways can only be used with a compressed pubkey signature flagbyte");const f=function(e,t){const n=(new TextEncoder).encode(t),s=(new TextEncoder).encode(e),o=r(s.length).buffer,i=new Uint8Array(n.length+o.byteLength+s.length);return i.set(n),i.set(new Uint8Array(o),n.length),i.set(s,n.length+o.byteLength),function(e){return a.sha256(a.sha256(e))}(i)}(e,o.messagePrefix),h=(l=d.recoverPublicKey(f).toRawBytes(c),a.ripemd160(a.sha256(l)));var l;let p="";if(t.startsWith("q"))return p=V(o.pubKeyHashVersion,h),p.startsWith("1");if(u)p=u===v.P2SH_P2WPKH?V(o.scriptHashVersion,h):o.bech32Prefix?U(h,o.bech32Prefix):V(o.scriptHashVersion,h);else if(s&&o.bech32Prefix)try{p=U(h,o.bech32Prefix)}catch(e){p=V(o.scriptHashVersion,h)}else p=V(o.pubKeyHashVersion,h);return p===t}(n.attestation,t,n.proof,o,s);return I({},n,{status:c?e.VERIFIED:e.FAILED})}!function(e){e.LEGACY="Legacy",e.NATIVE="Native SegWit",e.SEGWIT="SegWit",e.P2SH_SEGWIT="p2sh",e.BCH="Bitcoin Cash",e.ETHEREUM="Ethereum",e.DOGECOIN="Dogecoin",e.UNKNOWN="Unknown"}(D||(D={}));const B=s(a.sha256);function V(e,t){const r="number"==typeof e?Uint8Array.of(e):e,n=new Uint8Array(r.length+t.length);return n.set(r),n.set(t,r.length),B.encode(n)}function U(e,t="bc"){const r=o.toWords(e);return r.unshift(0),o.encode(t,r)}function C(e,t){const r=[];let n=t;for(;n<e.length&&null!=(s=e[n])&&s.startsWith("- ");){var s;r.push(e[n].substring(2)),n++}return r}function k(e,t,r){try{const s=(n=d.fromString(t),a.keccak256(function(e){const t=d.from(e);return d.concat("0x19",d.fromString("TRON Signed Message:\n"+d.size(t)),t)}(n))),o=f.fromHex(r),i=h.recoverPublicKey({payload:s,signature:o}),u=`0x41${a.keccak256(`0x${p.toHex(i).slice(4)}`).substring(26)}`,l=y.from(u),b=y.from(a.sha256(a.sha256(u))).slice(0,4),g=y.concat(l,b);return c.encode(g)===e}catch(e){return!1}var n}var F="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function T(e){var t={exports:{}};return e(t,t.exports),t.exports}var O=T(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=void 0,t.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0}),K=T(function(e,t){function r(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function n(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function s(e,...t){if(!r(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 o(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function i(e){for(let t=0;t<e.length;t++)e[t]=o(e[t]);return e}Object.defineProperty(t,"__esModule",{value:!0}),t.wrapXOFConstructorWithOpts=t.wrapConstructorWithOpts=t.wrapConstructor=t.Hash=t.nextTick=t.swap32IfBE=t.byteSwapIfBE=t.swap8IfBE=t.isLE=void 0,t.isBytes=r,t.anumber=n,t.abytes=s,t.ahash=function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.createHasher");n(e.outputLen),n(e.blockLen)},t.aexists=function(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")},t.aoutput=function(e,t){s(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)},t.u8=function(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},t.u32=function(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))},t.clean=function(...e){for(let t=0;t<e.length;t++)e[t].fill(0)},t.createView=function(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)},t.rotr=function(e,t){return e<<32-t|e>>>t},t.rotl=function(e,t){return e<<t|e>>>32-t>>>0},t.byteSwap=o,t.byteSwap32=i,t.bytesToHex=function(e){if(s(e),c)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=a[e[r]];return t},t.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);if(c)return Uint8Array.fromHex(e);const t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,s=0;t<r;t++,s+=2){const r=d(e.charCodeAt(s)),o=d(e.charCodeAt(s+1));if(void 0===r||void 0===o)throw new Error('hex string expected, got non-hex character "'+(e[s]+e[s+1])+'" at index '+s);n[t]=16*r+o}return n},t.asyncLoop=async function(e,r,n){let s=Date.now();for(let o=0;o<e;o++){n(o);const e=Date.now()-s;e>=0&&e<r||(await(0,t.nextTick)(),s+=e)}},t.utf8ToBytes=f,t.bytesToUtf8=function(e){return(new TextDecoder).decode(e)},t.toBytes=h,t.kdfInputToBytes=function(e){return"string"==typeof e&&(e=f(e)),s(e),e},t.concatBytes=function(...e){let t=0;for(let r=0;r<e.length;r++){const n=e[r];s(n),t+=n.length}const r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){const s=e[t];r.set(s,n),n+=s.length}return r},t.checkOpts=function(e,t){if(void 0!==t&&"[object Object]"!=={}.toString.call(t))throw new Error("options should be object or undefined");return Object.assign(e,t)},t.createHasher=l,t.createOptHasher=p,t.createXOFer=y,t.randomBytes=function(e=32){if(O.crypto&&"function"==typeof O.crypto.getRandomValues)return O.crypto.getRandomValues(new Uint8Array(e));if(O.crypto&&"function"==typeof O.crypto.randomBytes)return Uint8Array.from(O.crypto.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")},t.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],t.swap8IfBE=t.isLE?e=>e:e=>o(e),t.byteSwapIfBE=t.swap8IfBE,t.swap32IfBE=t.isLE?e=>e:i;const c=/* @__PURE__ */(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),a=/* @__PURE__ */Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),u={_0:48,_9:57,A:65,F:70,a:97,f:102};function d(e){return e>=u._0&&e<=u._9?e-u._0:e>=u.A&&e<=u.F?e-(u.A-10):e>=u.a&&e<=u.f?e-(u.a-10):void 0}function f(e){if("string"!=typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))}function h(e){return"string"==typeof e&&(e=f(e)),s(e),e}function l(e){const t=t=>e().update(h(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function p(e){const t=(t,r)=>e(r).update(h(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}function y(e){const t=(t,r)=>e(r).update(h(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}t.nextTick=async()=>{},t.Hash=class{},t.wrapConstructor=l,t.wrapConstructorWithOpts=p,t.wrapXOFConstructorWithOpts=y}),M=T(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.equal=t.concat=t.HEX_REGEX=void 0,t.HEX_REGEX=/^[A-F0-9]*$/iu,t.concat=function(e){return(0,K.concatBytes)(...e)},t.equal=function(e,t){if(e.byteLength!==t.byteLength)return!1;const r=new Int8Array(e),n=new Int8Array(t);for(let t=0;t!==e.byteLength;t++)if(r[t]!==n[t])return!1;return!0}}),j=T(function(e,t){var r=F&&F.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),n=F&&F.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytes=t.stringToHex=t.hexToString=t.hexToBytes=t.bytesToHex=void 0,t.bytesToHex=e=>(0,K.bytesToHex)(e instanceof Uint8Array?e:Uint8Array.from(e)).toUpperCase(),t.hexToBytes=e=>{const t=new Uint8Array(e.length/2);if(!M.HEX_REGEX.test(e))throw new Error("Invalid hex string");for(let r=0;r<t.length;r++){const n=2*r,s=e.slice(n,n+2),o=Number.parseInt(s,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[r]=o}return t},t.hexToString=(e,r="utf8")=>new TextDecoder(r).decode((0,t.hexToBytes)(e)),t.stringToHex=e=>(0,t.bytesToHex)((new TextEncoder).encode(e)),t.randomBytes=K.randomBytes,n(M,t)}),N=T(function(e,t){function r(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const s=BigInt(32),o=BigInt(4294967295),i=Number(r>>s&o),c=Number(r&o),a=n?0:4;e.setUint32(t+(n?4:0),i,n),e.setUint32(t+a,c,n)}Object.defineProperty(t,"__esModule",{value:!0}),t.SHA512_IV=t.SHA384_IV=t.SHA224_IV=t.SHA256_IV=t.HashMD=void 0,t.setBigUint64=r,t.Chi=function(e,t,r){return e&t^~e&r},t.Maj=function(e,t,r){return e&t^e&r^t&r},t.HashMD=class extends K.Hash{constructor(e,t,r,n){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=(0,K.createView)(this.buffer)}update(e){(0,K.aexists)(this),e=(0,K.toBytes)(e),(0,K.abytes)(e);const{view:t,buffer:r,blockLen:n}=this,s=e.length;for(let o=0;o<s;){const i=Math.min(n-this.pos,s-o);if(i===n){const t=(0,K.createView)(e);for(;n<=s-o;o+=n)this.process(t,o);continue}r.set(e.subarray(o,o+i),this.pos),this.pos+=i,o+=i,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,K.aexists)(this),(0,K.aoutput)(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:s,isLE:o}=this;let{pos:i}=this;t[i++]=128,(0,K.clean)(this.buffer.subarray(i)),this.padOffset>s-i&&(this.process(n,0),i=0);for(let e=i;e<s;e++)t[e]=0;r(n,s-8,BigInt(8*this.length),o),this.process(n,0);const c=(0,K.createView)(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,d=this.get();if(u>d.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<u;e++)c.setUint32(4*e,d[e],o)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:s,destroyed:o,pos:i}=this;return e.destroyed=o,e.finished=s,e.length=n,e.pos=i,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}},t.SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),t.SHA224_IV=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),t.SHA384_IV=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),t.SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209])}),R=T(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.toBig=t.shrSL=t.shrSH=t.rotrSL=t.rotrSH=t.rotrBL=t.rotrBH=t.rotr32L=t.rotr32H=t.rotlSL=t.rotlSH=t.rotlBL=t.rotlBH=t.add5L=t.add5H=t.add4L=t.add4H=t.add3L=t.add3H=void 0,t.add=m,t.fromBig=s,t.split=o;const r=/* @__PURE__ */BigInt(2**32-1),n=/* @__PURE__ */BigInt(32);function s(e,t=!1){return t?{h:Number(e&r),l:Number(e>>n&r)}:{h:0|Number(e>>n&r),l:0|Number(e&r)}}function o(e,t=!1){const r=e.length;let n=new Uint32Array(r),o=new Uint32Array(r);for(let i=0;i<r;i++){const{h:r,l:c}=s(e[i],t);[n[i],o[i]]=[r,c]}return[n,o]}const i=(e,t)=>BigInt(e>>>0)<<n|BigInt(t>>>0);t.toBig=i;const c=(e,t,r)=>e>>>r;t.shrSH=c;const a=(e,t,r)=>e<<32-r|t>>>r;t.shrSL=a;const u=(e,t,r)=>e>>>r|t<<32-r;t.rotrSH=u;const d=(e,t,r)=>e<<32-r|t>>>r;t.rotrSL=d;const f=(e,t,r)=>e<<64-r|t>>>r-32;t.rotrBH=f;const h=(e,t,r)=>e>>>r-32|t<<64-r;t.rotrBL=h;const l=(e,t)=>t;t.rotr32H=l;const p=(e,t)=>e;t.rotr32L=p;const y=(e,t,r)=>e<<r|t>>>32-r;t.rotlSH=y;const b=(e,t,r)=>t<<r|e>>>32-r;t.rotlSL=b;const g=(e,t,r)=>t<<r-32|e>>>64-r;t.rotlBH=g;const A=(e,t,r)=>e<<r-32|t>>>64-r;function m(e,t,r,n){const s=(t>>>0)+(n>>>0);return{h:e+r+(s/2**32|0)|0,l:0|s}}t.rotlBL=A;const _=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);t.add3L=_;const x=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;t.add3H=x;const E=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);t.add4L=E;const w=(e,t,r,n,s)=>t+r+n+s+(e/2**32|0)|0;t.add4H=w;const H=(e,t,r,n,s)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(s>>>0);t.add5L=H;const I=(e,t,r,n,s,o)=>t+r+n+s+o+(e/2**32|0)|0;t.add5H=I,t.default={fromBig:s,split:o,toBig:i,shrSH:c,shrSL:a,rotrSH:u,rotrSL:d,rotrBH:f,rotrBL:h,rotr32H:l,rotr32L:p,rotlSH:y,rotlSL:b,rotlBH:g,rotlBL:A,add:m,add3L:_,add3H:x,add4L:E,add4H:w,add5H:I,add5L:H}}),W=N,$=R,G=T(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.sha512_224=t.sha512_256=t.sha384=t.sha512=t.sha224=t.sha256=t.SHA512_256=t.SHA512_224=t.SHA384=t.SHA512=t.SHA224=t.SHA256=void 0;const r=/* @__PURE__ */Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),n=/* @__PURE__ */new Uint32Array(64);class s extends W.HashMD{constructor(e=32){super(64,e,8,!1),this.A=0|W.SHA256_IV[0],this.B=0|W.SHA256_IV[1],this.C=0|W.SHA256_IV[2],this.D=0|W.SHA256_IV[3],this.E=0|W.SHA256_IV[4],this.F=0|W.SHA256_IV[5],this.G=0|W.SHA256_IV[6],this.H=0|W.SHA256_IV[7]}get(){const{A:e,B:t,C:r,D:n,E:s,F:o,G:i,H:c}=this;return[e,t,r,n,s,o,i,c]}set(e,t,r,n,s,o,i,c){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|s,this.F=0|o,this.G=0|i,this.H=0|c}process(e,t){for(let r=0;r<16;r++,t+=4)n[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=n[e-15],r=n[e-2],s=(0,K.rotr)(t,7)^(0,K.rotr)(t,18)^t>>>3,o=(0,K.rotr)(r,17)^(0,K.rotr)(r,19)^r>>>10;n[e]=o+n[e-7]+s+n[e-16]|0}let{A:s,B:o,C:i,D:c,E:a,F:u,G:d,H:f}=this;for(let e=0;e<64;e++){const t=f+((0,K.rotr)(a,6)^(0,K.rotr)(a,11)^(0,K.rotr)(a,25))+(0,W.Chi)(a,u,d)+r[e]+n[e]|0,h=((0,K.rotr)(s,2)^(0,K.rotr)(s,13)^(0,K.rotr)(s,22))+(0,W.Maj)(s,o,i)|0;f=d,d=u,u=a,a=c+t|0,c=i,i=o,o=s,s=t+h|0}s=s+this.A|0,o=o+this.B|0,i=i+this.C|0,c=c+this.D|0,a=a+this.E|0,u=u+this.F|0,d=d+this.G|0,f=f+this.H|0,this.set(s,o,i,c,a,u,d,f)}roundClean(){(0,K.clean)(n)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,K.clean)(this.buffer)}}t.SHA256=s;class o extends s{constructor(){super(28),this.A=0|W.SHA224_IV[0],this.B=0|W.SHA224_IV[1],this.C=0|W.SHA224_IV[2],this.D=0|W.SHA224_IV[3],this.E=0|W.SHA224_IV[4],this.F=0|W.SHA224_IV[5],this.G=0|W.SHA224_IV[6],this.H=0|W.SHA224_IV[7]}}t.SHA224=o;const i=/* @__PURE__ */(()=>$.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))))(),c=/* @__PURE__ */(()=>i[0])(),a=/* @__PURE__ */(()=>i[1])(),u=/* @__PURE__ */new Uint32Array(80),d=/* @__PURE__ */new Uint32Array(80);class f extends W.HashMD{constructor(e=64){super(128,e,16,!1),this.Ah=0|W.SHA512_IV[0],this.Al=0|W.SHA512_IV[1],this.Bh=0|W.SHA512_IV[2],this.Bl=0|W.SHA512_IV[3],this.Ch=0|W.SHA512_IV[4],this.Cl=0|W.SHA512_IV[5],this.Dh=0|W.SHA512_IV[6],this.Dl=0|W.SHA512_IV[7],this.Eh=0|W.SHA512_IV[8],this.El=0|W.SHA512_IV[9],this.Fh=0|W.SHA512_IV[10],this.Fl=0|W.SHA512_IV[11],this.Gh=0|W.SHA512_IV[12],this.Gl=0|W.SHA512_IV[13],this.Hh=0|W.SHA512_IV[14],this.Hl=0|W.SHA512_IV[15]}get(){const{Ah:e,Al:t,Bh:r,Bl:n,Ch:s,Cl:o,Dh:i,Dl:c,Eh:a,El:u,Fh:d,Fl:f,Gh:h,Gl:l,Hh:p,Hl:y}=this;return[e,t,r,n,s,o,i,c,a,u,d,f,h,l,p,y]}set(e,t,r,n,s,o,i,c,a,u,d,f,h,l,p,y){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|s,this.Cl=0|o,this.Dh=0|i,this.Dl=0|c,this.Eh=0|a,this.El=0|u,this.Fh=0|d,this.Fl=0|f,this.Gh=0|h,this.Gl=0|l,this.Hh=0|p,this.Hl=0|y}process(e,t){for(let r=0;r<16;r++,t+=4)u[r]=e.getUint32(t),d[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|u[e-15],r=0|d[e-15],n=$.rotrSH(t,r,1)^$.rotrSH(t,r,8)^$.shrSH(t,r,7),s=$.rotrSL(t,r,1)^$.rotrSL(t,r,8)^$.shrSL(t,r,7),o=0|u[e-2],i=0|d[e-2],c=$.rotrSH(o,i,19)^$.rotrBH(o,i,61)^$.shrSH(o,i,6),a=$.rotrSL(o,i,19)^$.rotrBL(o,i,61)^$.shrSL(o,i,6),f=$.add4L(s,a,d[e-7],d[e-16]),h=$.add4H(f,n,c,u[e-7],u[e-16]);u[e]=0|h,d[e]=0|f}let{Ah:r,Al:n,Bh:s,Bl:o,Ch:i,Cl:f,Dh:h,Dl:l,Eh:p,El:y,Fh:b,Fl:g,Gh:A,Gl:m,Hh:_,Hl:x}=this;for(let e=0;e<80;e++){const t=$.rotrSH(p,y,14)^$.rotrSH(p,y,18)^$.rotrBH(p,y,41),E=$.rotrSL(p,y,14)^$.rotrSL(p,y,18)^$.rotrBL(p,y,41),w=p&b^~p&A,H=$.add5L(x,E,y&g^~y&m,a[e],d[e]),I=$.add5H(H,_,t,w,c[e],u[e]),v=0|H,S=$.rotrSH(r,n,28)^$.rotrBH(r,n,34)^$.rotrBH(r,n,39),D=$.rotrSL(r,n,28)^$.rotrBL(r,n,34)^$.rotrBL(r,n,39),P=r&s^r&i^s&i,L=n&o^n&f^o&f;_=0|A,x=0|m,A=0|b,m=0|g,b=0|p,g=0|y,({h:p,l:y}=$.add(0|h,0|l,0|I,0|v)),h=0|i,l=0|f,i=0|s,f=0|o,s=0|r,o=0|n;const B=$.add3L(v,D,L);r=$.add3H(B,I,S,P),n=0|B}({h:r,l:n}=$.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:s,l:o}=$.add(0|this.Bh,0|this.Bl,0|s,0|o)),({h:i,l:f}=$.add(0|this.Ch,0|this.Cl,0|i,0|f)),({h,l}=$.add(0|this.Dh,0|this.Dl,0|h,0|l)),({h:p,l:y}=$.add(0|this.Eh,0|this.El,0|p,0|y)),({h:b,l:g}=$.add(0|this.Fh,0|this.Fl,0|b,0|g)),({h:A,l:m}=$.add(0|this.Gh,0|this.Gl,0|A,0|m)),({h:_,l:x}=$.add(0|this.Hh,0|this.Hl,0|_,0|x)),this.set(r,n,s,o,i,f,h,l,p,y,b,g,A,m,_,x)}roundClean(){(0,K.clean)(u,d)}destroy(){(0,K.clean)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}t.SHA512=f;class h extends f{constructor(){super(48),this.Ah=0|W.SHA384_IV[0],this.Al=0|W.SHA384_IV[1],this.Bh=0|W.SHA384_IV[2],this.Bl=0|W.SHA384_IV[3],this.Ch=0|W.SHA384_IV[4],this.Cl=0|W.SHA384_IV[5],this.Dh=0|W.SHA384_IV[6],this.Dl=0|W.SHA384_IV[7],this.Eh=0|W.SHA384_IV[8],this.El=0|W.SHA384_IV[9],this.Fh=0|W.SHA384_IV[10],this.Fl=0|W.SHA384_IV[11],this.Gh=0|W.SHA384_IV[12],this.Gl=0|W.SHA384_IV[13],this.Hh=0|W.SHA384_IV[14],this.Hl=0|W.SHA384_IV[15]}}t.SHA384=h;const l=/* @__PURE__ */Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),p=/* @__PURE__ */Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class y extends f{constructor(){super(28),this.Ah=0|l[0],this.Al=0|l[1],this.Bh=0|l[2],this.Bl=0|l[3],this.Ch=0|l[4],this.Cl=0|l[5],this.Dh=0|l[6],this.Dl=0|l[7],this.Eh=0|l[8],this.El=0|l[9],this.Fh=0|l[10],this.Fl=0|l[11],this.Gh=0|l[12],this.Gl=0|l[13],this.Hh=0|l[14],this.Hl=0|l[15]}}t.SHA512_224=y;class b extends f{constructor(){super(32),this.Ah=0|p[0],this.Al=0|p[1],this.Bh=0|p[2],this.Bl=0|p[3],this.Ch=0|p[4],this.Cl=0|p[5],this.Dh=0|p[6],this.Dl=0|p[7],this.Eh=0|p[8],this.El=0|p[9],this.Fh=0|p[10],this.Fl=0|p[11],this.Gh=0|p[12],this.Gl=0|p[13],this.Hh=0|p[14],this.Hl=0|p[15]}}t.SHA512_256=b,t.sha256=(0,K.createHasher)(()=>new s),t.sha224=(0,K.createHasher)(()=>new o),t.sha512=(0,K.createHasher)(()=>new f),t.sha384=(0,K.createHasher)(()=>new h),t.sha512_256=(0,K.createHasher)(()=>new b),t.sha512_224=(0,K.createHasher)(()=>new y)}),X=T(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.sha224=t.SHA224=t.sha256=t.SHA256=void 0,t.SHA256=G.SHA256,t.sha256=G.sha256,t.SHA224=G.SHA224,t.sha224=G.sha224});const q=(F&&F.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(/*#__PURE__*/Object.defineProperty({default:function(e){return Array.isArray(e)?new Uint8Array(e):e}},"__esModule",{value:!0}));var z=/*#__PURE__*/Object.defineProperty({default:function(e){function t(t){return e((0,q.default)(t))}return t.create=()=>{const t=e.create();return{update(e){return t.update((0,q.default)(e)),this},digest:()=>t.digest()}},t}},"__esModule",{value:!0}),Y=X,Z=T(function(e,t){var r=F&&F.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.sha256=void 0;const n=r(z);t.sha256=(0,n.default)(Y.sha256)}),J=T(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.concatArgs=t.arrayEqual=void 0,t.arrayEqual=function(e,t){return e.length===t.length&&e.every((e,r)=>e===t[r])},t.concatArgs=function(...e){return e.flatMap(e=>"number"==typeof e?[e]:Array.from(e))}}),Q=T(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isValidClassicAddress=t.decodeAccountPublic=t.encodeAccountPublic=t.encodeNodePublic=t.decodeNodePublic=t.decodeAddress=t.decodeAccountID=t.encodeAddress=t.encodeAccountID=t.decodeSeed=t.encodeSeed=t.codec=void 0;const r=[1,225,75],s={sha256:Z.sha256},o=new class{constructor(e){this._sha256=e.sha256,this._codec=n.base58xrp}encode(e,t){return this._encodeVersioned(e,t.versions,t.expectedLength)}decode(e,t){var r;const n=t.versions,s=t.versionTypes,o=this.decodeChecked(e);if(n.length>1&&!t.expectedLength)throw new Error("expectedLength is required because there are >= 2 possible versions");const i=null!==(r=t.expectedLength)&&void 0!==r?r:o.length-("number"==typeof n[0]?1:n[0].length),c=o.slice(0,-i),a=o.slice(-i);for(let e=0;e<n.length;e++){const t=Array.isArray(n[e])?n[e]:[n[e]];if((0,J.arrayEqual)(c,t))return{version:t,bytes:a,type:s?s[e]:null}}throw new Error("version_invalid: version bytes do not match any of the provided version(s)")}encodeChecked(e){const t=this._sha256(this._sha256(e)).slice(0,4);return this._encodeRaw(Uint8Array.from((0,J.concatArgs)(e,t)))}decodeChecked(e){const t=this._decodeRaw(e);if(t.byteLength<5)throw new Error("invalid_input_size: decoded data must have length >= 5");if(!this._verifyCheckSum(t))throw new Error("checksum_invalid");return t.slice(0,-4)}_encodeVersioned(e,t,r){if(!a(e,r))throw new Error("unexpected_payload_length: bytes.length does not match expectedLength. Ensure that the bytes are a Uint8Array.");return this.encodeChecked((0,J.concatArgs)(t,e))}_encodeRaw(e){return this._codec.encode(Uint8Array.from(e))}_decodeRaw(e){return this._codec.decode(e)}_verifyCheckSum(e){const t=this._sha256(this._sha256(e.slice(0,-4))).slice(0,4),r=e.slice(-4);return(0,J.arrayEqual)(t,r)}}(s);function i(e){return o.encode(e,{versions:[0],expectedLength:20})}function c(e){return o.decode(e,{versions:[0],expectedLength:20}).bytes}function a(e,t){return"byteLength"in e?e.byteLength===t:e.length===t}t.codec=o,t.encodeSeed=function(e,t){if(!a(e,16))throw new Error("entropy must have length 16");return o.encode(e,{expectedLength:16,versions:"ed25519"===t?r:[33]})},t.decodeSeed=function(e,t={versionTypes:["ed25519","secp256k1"],versions:[r,33],expectedLength:16}){return o.decode(e,t)},t.encodeAccountID=i,t.encodeAddress=i,t.decodeAccountID=c,t.decodeAddress=c,t.decodeNodePublic=function(e){return o.decode(e,{versions:[28],expectedLength:33}).bytes},t.encodeNodePublic=function(e){return o.encode(e,{versions:[28],expectedLength:33})},t.encodeAccountPublic=function(e){return o.encode(e,{versions:[35],expectedLength:33})},t.decodeAccountPublic=function(e){return o.decode(e,{versions:[35],expectedLength:33}).bytes},t.isValidClassicAddress=function(e){try{c(e)}catch(e){return!1}return!0}}),ee=T(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isValidXAddress=t.decodeXAddress=t.xAddressToClassicAddress=t.encodeXAddress=t.classicAddressToXAddress=t.isValidClassicAddress=t.decodeAccountPublic=t.encodeAccountPublic=t.decodeNodePublic=t.encodeNodePublic=t.decodeAccountID=t.encodeAccountID=t.decodeSeed=t.encodeSeed=t.codec=void 0,Object.defineProperty(t,"codec",{enumerable:!0,get:function(){return Q.codec}}),Object.defineProperty(t,"encodeSeed",{enumerable:!0,get:function(){return Q.encodeSeed}}),Object.defineProperty(t,"decodeSeed",{enumerable:!0,get:function(){return Q.decodeSeed}}),Object.defineProperty(t,"encodeAccountID",{enumerable:!0,get:function(){return Q.encodeAccountID}}),Object.defineProperty(t,"decodeAccountID",{enumerable:!0,get:function(){return Q.decodeAccountID}}),Object.defineProperty(t,"encodeNodePublic",{enumerable:!0,get:function(){return Q.encodeNodePublic}}),Object.defineProperty(t,"decodeNodePublic",{enumerable:!0,get:function(){return Q.decodeNodePublic}}),Object.defineProperty(t,"encodeAccountPublic",{enumerable:!0,get:function(){return Q.encodeAccountPublic}}),Object.defineProperty(t,"decodeAccountPublic",{enumerable:!0,get:function(){return Q.decodeAccountPublic}}),Object.defineProperty(t,"isValidClassicAddress",{enumerable:!0,get:function(){return Q.isValidClassicAddress}});const r={main:Uint8Array.from([5,68]),test:Uint8Array.from([4,147])};function n(e,t,n){if(20!==e.length)throw new Error("Account ID must be 20 bytes");if(!1!==t&&t>4294967295)throw new Error("Invalid tag");const s=t||0,o=(0,j.concat)([n?r.test:r.main,e,Uint8Array.from([!1===t||null==t?0:1,255&s,s>>8&255,s>>16&255,s>>24&255,0,0,0,0])]);return Q.codec.encodeChecked(o)}function s(e){const t=Q.codec.decodeChecked(e),n=function(e){const t=e.slice(0,2);if((0,j.equal)(r.main,t))return!1;if((0,j.equal)(r.test,t))return!0;throw new Error("Invalid X-address: bad prefix")}(t);return{accountId:t.slice(2,22),tag:function(e){const t=e[22];if(t>=2)throw new Error("Unsupported X-address");if(1===t)return e[23]+256*e[24]+65536*e[25]+16777216*e[26];if(0!==t)throw new Error("flag must be zero to indicate no tag");if(!(0,j.equal)((0,j.hexToBytes)("0000000000000000"),e.slice(23,31)))throw new Error("remaining bytes must be zero");return!1}(t),test:n}}t.classicAddressToXAddress=function(e,t,r){return n((0,Q.decodeAccountID)(e),t,r)},t.encodeXAddress=n,t.xAddressToClassicAddress=function(e){const{accountId:t,tag:r,test:n}=s(e);return{classicAddress:(0,Q.encodeAccountID)(t),tag:r,test:n}},t.decodeXAddress=s,t.isValidXAddress=function(e){try{s(e)}catch(e){return!1}return!0}}),te=T(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ripemd160=t.RIPEMD160=t.md5=t.MD5=t.sha1=t.SHA1=void 0;const r=/* @__PURE__ */Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),n=/* @__PURE__ */new Uint32Array(80);class s extends W.HashMD{constructor(){super(64,20,8,!1),this.A=0|r[0],this.B=0|r[1],this.C=0|r[2],this.D=0|r[3],this.E=0|r[4]}get(){const{A:e,B:t,C:r,D:n,E:s}=this;return[e,t,r,n,s]}set(e,t,r,n,s){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|s}process(e,t){for(let r=0;r<16;r++,t+=4)n[r]=e.getUint32(t,!1);for(let e=16;e<80;e++)n[e]=(0,K.rotl)(n[e-3]^n[e-8]^n[e-14]^n[e-16],1);let{A:r,B:s,C:o,D:i,E:c}=this;for(let e=0;e<80;e++){let t,a;e<20?(t=(0,W.Chi)(s,o,i),a=1518500249):e<40?(t=s^o^i,a=1859775393):e<60?(t=(0,W.Maj)(s,o,i),a=2400959708):(t=s^o^i,a=3395469782);const u=(0,K.rotl)(r,5)+t+c+a+n[e]|0;c=i,i=o,o=(0,K.rotl)(s,30),s=r,r=u}r=r+this.A|0,s=s+this.B|0,o=o+this.C|0,i=i+this.D|0,c=c+this.E|0,this.set(r,s,o,i,c)}roundClean(){(0,K.clean)(n)}destroy(){this.set(0,0,0,0,0),(0,K.clean)(this.buffer)}}t.SHA1=s,t.sha1=(0,K.createHasher)(()=>new s);const o=/* @__PURE__ */Math.pow(2,32),i=/* @__PURE__ */Array.from({length:64},(e,t)=>Math.floor(o*Math.abs(Math.sin(t+1)))),c=/* @__PURE__ */r.slice(0,4),a=/* @__PURE__ */new Uint32Array(16);class u extends W.HashMD{constructor(){super(64,16,8,!0),this.A=0|c[0],this.B=0|c[1],this.C=0|c[2],this.D=0|c[3]}get(){const{A:e,B:t,C:r,D:n}=this;return[e,t,r,n]}set(e,t,r,n){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n}process(e,t){for(let r=0;r<16;r++,t+=4)a[r]=e.getUint32(t,!0);let{A:r,B:n,C:s,D:o}=this;for(let e=0;e<64;e++){let t,c,u;e<16?(t=(0,W.Chi)(n,s,o),c=e,u=[7,12,17,22]):e<32?(t=(0,W.Chi)(o,n,s),c=(5*e+1)%16,u=[5,9,14,20]):e<48?(t=n^s^o,c=(3*e+5)%16,u=[4,11,16,23]):(t=s^(n|~o),c=7*e%16,u=[6,10,15,21]),t=t+r+i[e]+a[c],r=o,o=s,s=n,n+=(0,K.rotl)(t,u[e%4])}r=r+this.A|0,n=n+this.B|0,s=s+this.C|0,o=o+this.D|0,this.set(r,n,s,o)}roundClean(){(0,K.clean)(a)}destroy(){this.set(0,0,0,0),(0,K.clean)(this.buffer)}}t.MD5=u,t.md5=(0,K.createHasher)(()=>new u);const d=/* @__PURE__ */Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),f=/* @__PURE__ */(()=>Uint8Array.from(new Array(16).fill(0).map((e,t)=>t)))(),h=/* @__PURE__ */(()=>f.map(e=>(9*e+5)%16))(),l=/* @__PURE__ */(()=>{const e=[[f],[h]];for(let t=0;t<4;t++)for(let r of e)r.push(r[t].map(e=>d[e]));return e})(),p=/* @__PURE__ */(()=>l[0])(),y=/* @__PURE__ */(()=>l[1])(),b=/* @__PURE__ */[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>Uint8Array.from(e)),g=/* @__PURE__ */p.map((e,t)=>e.map(e=>b[t][e])),A=/* @__PURE__ */y.map((e,t)=>e.map(e=>b[t][e])),m=/* @__PURE__ */Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),_=/* @__PURE__ */Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function x(e,t,r,n){return 0===e?t^r^n:1===e?t&r|~t&n:2===e?(t|~r)^n:3===e?t&n|r&~n:t^(r|~n)}const E=/* @__PURE__ */new Uint32Array(16);class w extends W.HashMD{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:t,h2:r,h3:n,h4:s}=this;return[e,t,r,n,s]}set(e,t,r,n,s){this.h0=0|e,this.h1=0|t,this.h2=0|r,this.h3=0|n,this.h4=0|s}process(e,t){for(let r=0;r<16;r++,t+=4)E[r]=e.getUint32(t,!0);let r=0|this.h0,n=r,s=0|this.h1,o=s,i=0|this.h2,c=i,a=0|this.h3,u=a,d=0|this.h4,f=d;for(let e=0;e<5;e++){const t=4-e,h=m[e],l=_[e],b=p[e],w=y[e],H=g[e],I=A[e];for(let t=0;t<16;t++){const n=(0,K.rotl)(r+x(e,s,i,a)+E[b[t]]+h,H[t])+d|0;r=d,d=a,a=0|(0,K.rotl)(i,10),i=s,s=n}for(let e=0;e<16;e++){const r=(0,K.rotl)(n+x(t,o,c,u)+E[w[e]]+l,I[e])+f|0;n=f,f=u,u=0|(0,K.rotl)(c,10),c=o,o=r}}this.set(this.h1+i+u|0,this.h2+a+f|0,this.h3+d+n|0,this.h4+r+o|0,this.h0+s+c|0)}roundClean(){(0,K.clean)(E)}destroy(){this.destroyed=!0,(0,K.clean)(this.buffer),this.set(0,0,0,0,0)}}t.RIPEMD160=w,t.ripemd160=(0,K.createHasher)(()=>new w)}),re=T(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ripemd160=t.RIPEMD160=void 0,t.RIPEMD160=te.RIPEMD160,t.ripemd160=te.ripemd160}),ne=T(function(e,t){var r=F&&F.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ripemd160=void 0;const n=r(z);t.ripemd160=(0,n.default)(re.ripemd160)}),se=T(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.sha512_256=t.SHA512_256=t.sha512_224=t.SHA512_224=t.sha384=t.SHA384=t.sha512=t.SHA512=void 0,t.SHA512=G.SHA512,t.sha512=G.sha512,t.SHA384=G.SHA384,t.sha384=G.sha384,t.SHA512_224=G.SHA512_224,t.sha512_224=G.sha512_224,t.SHA512_256=G.SHA512_256,t.sha512_256=G.sha512_256}),oe=T(function(e,t){var r=F&&F.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.sha512=void 0;const n=r(z);t.sha512=(0,n.default)(se.sha512)});class ie{constructor(){this.hash=oe.sha512.create()}static half(e){return(new ie).add(e).first256()}add(e){return this.hash.update(e),this}addU32(e){const t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e),this.add(t)}finish(){return this.hash.digest()}first256(){return this.finish().slice(0,32)}first256BigInt(){return(0,E.bytesToNumberBE)(this.first256())}}var ce=/*#__PURE__*/Object.defineProperty({default:ie},"__esModule",{value:!0}),ae=T(function(e,t){var r=F&&F.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.accountPublicFromPublicGenerator=t.derivePrivateKey=void 0;const n=r(ce),s=BigInt(0);function o(e,t){const r=b.secp256k1.CURVE.n;for(let o=0;o<=4294967295;o++){const i=(new n.default).add(e);void 0!==t&&i.addU32(t),i.addU32(o);const c=i.first256BigInt();if(c>s&&c<r)return c}throw new Error("impossible unicorn ;)")}t.derivePrivateKey=function(e,t={}){const r=t.validator,n=b.secp256k1.CURVE.n,s=o(e);return r?s:(o(b.secp256k1.ProjectivePoint.BASE.multiply(s).toRawBytes(!0),t.accountIndex||0)+s)%n},t.accountPublicFromPublicGenerator=function(e){const t=b.secp256k1.ProjectivePoint.fromHex(e),r=o(e,0),n=b.secp256k1.ProjectivePoint.BASE.multiply(r);return t.add(n).toRawBytes(!0)}}),ue=/*#__PURE__*/Object.defineProperty({default:{ok(e,t){if(!e)throw new Error(t)}}},"__esModule",{value:!0}),de=T(function(e,t){var r;Object.defineProperty(t,"__esModule",{value:!0}),t.getAlgorithmFromPrivateKey=t.getAlgorithmFromPublicKey=t.getAlgorithmFromKey=void 0,function(e){e[e.NONE=-1]="NONE",e[e.ED25519=237]="ED25519",e[e.SECP256K1_PUB_X=2]="SECP256K1_PUB_X",e[e.SECP256K1_PUB_X_ODD_Y=3]="SECP256K1_PUB_X_ODD_Y",e[e.SECP256K1_PUB_XY=4]="SECP256K1_PUB_XY",e[e.SECP256K1_PRIVATE=0]="SECP256K1_PRIVATE"}(r||(r={}));const n={[`private_${r.NONE}_32`]:"ecdsa-secp256k1",[`private_${r.SECP256K1_PRIVATE}_33`]:"ecdsa-secp256k1",[`private_${r.ED25519}_33`]:"ed25519",[`public_${r.ED25519}_33`]:"ed25519",[`public_${r.SECP256K1_PUB_X}_33`]:"ecdsa-secp256k1",[`public_${r.SECP256K1_PUB_X_ODD_Y}_33`]:"ecdsa-secp256k1",[`public_${r.SECP256K1_PUB_XY}_65`]:"ecdsa-secp256k1"};function s(e){return e===r.NONE?"None":`0x${e.toString(16).padStart(2,"0")}`}function o(e,t){const{prefix:o,len:i}=function(e){return{prefix:e.length<2?r.NONE:parseInt(e.slice(0,2),16),len:e.length/2}}(e),c="private"===t&&32===i?r.NONE:o,a=n[`${t}_${c}_${i}`];if(!a)throw new Error(function({key:e,type:t,prefix:r,len:o}){const i=function(e){return Object.entries(n).filter(([t])=>t.startsWith(e)).map(([e,t])=>{const[,r,n]=e.split("_");return`${t.padEnd(17)} - Prefix: ${s(Number(r)).padEnd(6)} Length: ${n} bytes`}).join("\n")}(t);return`invalid_key:\n\nType: ${t}\nKey: ${e}\nPrefix: ${s(r)} \nLength: ${o} bytes\n\nAcceptable ${t} formats are:\n${i}\n`}({key:e,type:t,len:i,prefix:c}));return a}t.getAlgorithmFromKey=o,t.getAlgorithmFromPublicKey=function(e){return o(e,"public")},t.getAlgorithmFromPrivateKey=function(e){return o(e,"private")}}),fe=F&&F.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const he=fe(ue),le=fe(ce);var pe=/*#__PURE__*/Object.defineProperty({default:{deriveKeypair(e,t){const r=(0,ae.derivePrivateKey)(e,t);return{privateKey:"00"+(0,j.bytesToHex)((0,E.numberToBytesBE)(r,32)),publicKey:(0,j.bytesToHex)(b.secp256k1.getPublicKey(r,!0))}},sign(e,t){he.default.ok(66===t.length&&t.startsWith("00")||64===t.length);const r=66===t.length?t.slice(2):t;return b.secp256k1.sign(le.default.half(e),r,{lowS:!0,extraEntropy:void 0}).toDERHex(!0).toUpperCase()},verify(e,t,r){const n=b.secp256k1.Signature.fromDER(t);return b.secp256k1.verify(n,le.default.half(e),r)}}},"__esModule",{value:!0}),ye=F&&F.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const be=ye(ue),ge=ye(ce);var Ae=/*#__PURE__*/Object.defineProperty({default:{deriveKeypair(e){const t=ge.default.half(e);return{privateKey:"ED"+(0,j.bytesToHex)(t),publicKey:"ED"+(0,j.bytesToHex)(w.ed25519.getPublicKey(t))}},sign:(e,t)=>(be.default.ok(e instanceof Uint8Array,"message must be array of octets"),be.default.ok(66===t.length,"private key must be 33 bytes including prefix"),(0,j.bytesToHex)(w.ed25519.sign(e,t.slice(2)))),verify:(e,t,r)=>(be.default.ok(66===r.length,"public key must be 33 bytes including prefix"),w.ed25519.verify(t,e,r.slice(2),{zip215:!1}))}},"__esModule",{value:!0}),me=T(function(e,t){var r=F&&F.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.decodeSeed=t.deriveNodeAddress=t.deriveAddress=t.verify=t.sign=t.deriveKeypair=t.generateSeed=void 0,Object.defineProperty(t,"decodeSeed",{enumerable:!0,get:function(){return ee.decodeSeed}});const n=r(ce),s=r(ue),o=r(pe),i=r(Ae);function c(e){return{"ecdsa-secp256k1":o.default,ed25519:i.default}[e]}function a(e){return(0,ee.encodeAccountID)(function(e){return(0,ne.ripemd160)((0,Z.sha256)(e))}(e))}t.generateSeed=function(e={}){s.default.ok(!e.entropy||e.entropy.length>=16,"entropy too short");const t=e.entropy?e.entropy.slice(0,16):(0,j.randomBytes)(16);return(0,ee.encodeSeed)(t,"ed25519"===e.algorithm?"ed25519":"secp256k1")},t.deriveKeypair=function(e,t){var r;const s=(0,ee.decodeSeed)(e),o=c("ed25519"===(null!==(r=null==t?void 0:t.algorithm)&&void 0!==r?r:s.type)?"ed25519":"ecdsa-secp256k1"),i=o.deriveKeypair(s.bytes,t),a=n.default.half("This test message should verify."),u=o.sign(a,i.privateKey);if(!o.verify(a,u,i.publicKey))throw new Error("derived keypair did not generate verifiable signature");return i},t.sign=function(e,t){return c((0,de.getAlgorithmFromPrivateKey)(t)).sign((0,j.hexToBytes)(e),t)},t.verify=function(e,t,r){return c((0,de.getAlgorithmFromPublicKey)(r)).verify((0,j.hexToBytes)(e),t,r)},t.deriveAddress=function(e){return a((0,j.hexToBytes)(e))},t.deriveNodeAddress=function(e){const t=(0,ee.decodeNodePublic)(e);return a((0,ae.accountPublicFromPublicGenerator)(t))}});const _e=["wss://s1.ripple.com","wss://xrplcluster.com/","wss://s2.ripple.com/"];function xe(e){for(let n=0;n<e.length;n++){var t,r;return null!=(t=null==(r=e[n])||null==(r=r.tx_json)?void 0:r.SigningPubKey)?t:"0x"}throw new Error("No valid pubkey found in the latest transactions")}const Ee={testnet:{grpcUrl:"https://grpc.testnet.concordium.com:20000",walletProxyUrl:"https://wallet-proxy.testnet.concordium.com"},mainnet:{grpcUrl:"https://grpc.mainnet.concordium.com:20000",walletProxyUrl:"https://wallet-proxy.mainnet.concordium.software"}},we={network:"testnet",timeout:5e4,retries:3,testMode:!0};function He(e){try{if("string"==typeof e)return e;if(e&&"object"==typeof e){const t=e=>{if("string"==typeof e)return e;if(e&&"object"==typeof e)for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const n=e[r];if("string"==typeof n)return n;if("object"==typeof n){const e=t(n);if(e)return e}}return null},r=t(e);if(r)return r}throw new Error("Unable to extract signature from object")}catch(e){const t=e instanceof Error?e.message:"Unknown error";throw new Error(`Invalid signature format: ${t}`)}}async function Ie(e,t){let r=new Error("No attempts made");for(let o=0;o<=t;o++)try{return await e()}catch(e){var n,s;const i=e instanceof Error?e:new Error(String(e));if(r=i,null!=(n=i.message)&&n.includes("Invalid signature")||null!=(s=i.message)&&s.includes("Account not found"))throw i;if(o===t)break;const c=Math.min(1e3*Math.pow(2,o),5e3);await new Promise(e=>setTimeout(e,c))}throw r}async function ve(r,n){switch(r.type){case t.SelfDeclaration:return I({},r,{status:r.confirmed?e.VERIFIED:e.FAILED});case t.Screenshot:return I({},r,{status:r.url?e.FLAGGED:e.FAILED});case t.CIP8:return async function(t){const[r,,n]=t.address.split(/:/),s=t.chainSpecificData&&"cardanoCoseKey"in t.chainSpecificData?t.chainSpecificData.cardanoCoseKey:null;if("cardano"!==r||!s)return I({},t,{status:e.FAILED});try{return I({},t,{status:_(t.proof,s,t.attestation,n)?e.VERIFIED:e.FAILED})}catch(r){return I({},t,{status:e.FAILED})}}(r);case t.EIP191:return async function(t){const[r,,n]=t.address.split(/:/);if("eip155"!==r)return I({},t,{status:e.FAILED});const s=function(e,t,r){try{const n=u.getSignPayload(d.fromString(t)),s=f.fromHex(r),o=h.recoverPublicKey({payload:n,signature:s});return l.checksum(l.fromPublicKey(o)).toString()===l.checksum(e)}catch(e){return!1}}(n,t.attestation,t.proof);return I({},t,{status:s?e.VERIFIED:e.FAILED})}(r);case t.ED25519:return async function(t){const[r,,n]=t.address.split(/:/);if("solana"!==r)return I({},t,{status:e.FAILED});try{const r=c.decode(n),s=(new TextEncoder).encode(t.attestation),o=i.decode(t.proof);return I({},t,{status:m.sign.detached.verify(s,o,r)?e.VERIFIED:e.FAILED})}catch(r){return I({},t,{status:e.FAILED})}}(r);case t.SOL_SIWX:return async function(t){const[r]=t.address.split(/:/);if("solana"!==r)return I({},t,{status:e.FAILED});if(!t.chainSpecificData||!function(e){if(!e||"object"!=typeof e)return!1;const t=e;if(!t.account||"object"!=typeof t.account)return!1;const r=t.account;if("string"!=typeof r.address)return!1;if(!r.publicKey)return!1;if(!(r.publicKey instanceof Uint8Array)){const e=r.publicKey;if("object"!=typeof e)return!1;{const t=Object.keys(e).filter(e=>!isNaN(Number(e))).sort((e,t)=>Number(e)-Number(t));if(32!==t.length)return!1;{const n=t.map(t=>Number(e[t]));if(!n.every(e=>"number"==typeof e&&e>=0&&e<=255))return!1;r.publicKey=new Uint8Array(n)}}}if(!t.signedMessage)return!1;if(!(t.signedMessage instanceof Uint8Array)){const e=t.signedMessage;if("Buffer"!==e.type||!Array.isArray(e.data))return!1;t.signedMessage=new Uint8Array(e.data)}if(!t.signature)return!1;if(!(t.signature instanceof Uint8Array)){const e=t.signature;if("Buffer"!==e.type||!Array.isArray(e.data))return!1;t.signature=new Uint8Array(e.data)}if(!t.message||"object"!=typeof t.message)return!1;const n=t.message;if("object"==typeof n&&null!==n){const e=n;if(!e.address&&t.signedMessage instanceof Uint8Array)try{const r=(new TextDecoder).decode(t.signedMessage).split("\n");if(r.length>=2){const t=r[1].trim();t&&/^[a-zA-Z0-9]{32,44}$/.test(t)&&(e.address=t)}}catch(e){}}return!!function(e){return!(!e||"object"!=typeof e)&&"string"==typeof e.domain&&"string"==typeof e.address&&(void 0===e.statement||"string"==typeof e.statement)&&(void 0===e.uri||"string"==typeof e.uri)&&(void 0===e.version||"string"==typeof e.version)&&(void 0===e.chainId||"string"==typeof e.chainId)&&(void 0===e.nonce||"string"==typeof e.nonce)&&(void 0===e.issuedAt||"string"==typeof e.issuedAt)&&(void 0===e.expirationTime||"string"==typeof e.expirationTime)&&(void 0===e.notBefore||"string"==typeof e.notBefore)&&(void 0===e.requestId||"string"==typeof e.requestId)&&(void 0===e.resources||Array.isArray(e.resources))}(t.message)}(t.chainSpecificData))return I({},t,{status:e.FAILED});try{const r=t.chainSpecificData,n=(new TextDecoder).decode(r.signedMessage),s=function(e){try{const t=e.split("\n"),r=function(e){var t;const r=null==(t=e[0])?void 0:t.match(/^(.+) wants you to sign in with your Solana account:$/);if(!r)return null;const n=r[1],s=e[1];return s&&/^[a-zA-Z0-9]{32,44}$/.test(s)?{domain:n,address:s}:null}(t);if(!r)return null;const n=I({},r);let s=2;const o=function(e,t){let r=t;if(""===e[r]&&e[r+1]&&!e[r+1].includes(":")){r++;const t=e[r];return r++,""===e[r]&&r++,{statement:t,nextIndex:r}}return{nextIndex:r}}(t,s);void 0!==o.statement&&(n.statement=o.statement,s=o.nextIndex);const i=function(e,t){const r={},n=[{prefix:"URI: ",key:"uri"},{prefix:"Version: ",key:"version"},{prefix:"Chain ID: ",key:"chainId"},{prefix:"Nonce: ",key:"nonce"},{prefix:"Issued At: ",key:"issuedAt"},{prefix:"Expiration Time: ",key:"expirationTime"},{prefix:"Not Before: ",key:"notBefore"},{prefix:"Request ID: ",key:"requestId"}];let s=t;for(;s<e.length;){const t=e[s];if(t){if(t.startsWith("Resources:")){const t=C(e,s+1);if(t.length>0){r.resources=t,s+=t.length+1;continue}}for(const{prefix:e,key:s}of n)if(t.startsWith(e)){const n=t.substring(e.length);r[s]=n;break}s++}else s++}return r}(t,s);return Object.assign(n,i),n}catch(e){return null}}(n);return s&&function(e,t){if(e.domain!==t.domain||e.address!==t.address)return!1;const r=[{inputKey:"statement",parsedKey:"statement"},{inputKey:"uri",parsedKey:"uri"},{inputKey:"version",parsedKey:"version"},{inputKey:"chainId",parsedKey:"chainId"},{inputKey:"nonce",parsedKey:"nonce"},{inputKey:"issuedAt",parsedKey:"issuedAt"},{inputKey:"expirationTime",parsedKey:"expirationTime"},{inputKey:"notBefore",parsedKey:"notBefore"},{inputKey:"requestId",parsedKey:"requestId"},{inputKey:"resources",parsedKey:"resources",validator:(e,t)=>!(!Array.isArray(e)||!Array.isArray(t))&&e.length===t.length&&e.every((e,r)=>e===t[r])}];for(const{inputKey:n,parsedKey:s,validator:o}of r){const r=t[n],i=e[s];if(void 0!==r)if(o){if(!o(r,i))return!1}else if(r!==i)return!1}return function(e){const t=Date.now();if(e.issuedAt){const r=new Date(e.issuedAt),n=864e5;if(Math.abs(r.getTime()-t)>n)return!1}return!(e.expirationTime&&new Date(e.expirationTime).getTime()<=t||e.notBefore&&new Date(e.notBefore).getTime()>t)}(e)}(s,r.message)?function(e){let t=`${e.domain} wants you to sign in with your Solana account:\n`;t+=`${e.address}`,e.statement&&(t+=`\n\n${e.statement}`);const r=function(e){const t=[],r=[{key:"uri",prefix:"URI: "},{key:"version",prefix:"Version: "},{key:"chainId",prefix:"Chain ID: "},{key:"nonce",prefix:"Nonce: "},{key:"issuedAt",prefix:"Issued At: "},{key:"expirationTime",prefix:"Expiration Time: "},{key:"notBefore",prefix:"Not Before: "},{key:"requestId",prefix:"Request ID: "},{key:"resources",prefix:"Resources:",formatter:e=>Array.isArray(e)&&e.length>0?["Resources:",...e.map(e=>`- ${e}`)]:[]}];for(const{key:n,prefix:s,formatter:o}of r){const r=e[n];if(void 0!==r)if(o){const e=o(r);t.push(...e)}else"string"==typeof r&&t.push(`${s}${r}`)}return t}(e);return r.length&&(t+=`\n\n${r.join("\n")}`),t}(s)!==n?I({},t,{status:e.FAILED}):I({},t,{status:m.sign.detached.verify(r.signedMessage,r.signature,r.account.publicKey)?e.VERIFIED:e.FAILED}):I({},t,{status:e.FAILED})}catch(r){return I({},t,{status:e.FAILED})}}(r);case t.XRP_ED25519:return async function(t,r){const[n,,s]=t.address.split(/:/);if("xrpl"!==n)return I({},t,{status:e.FAILED});if(r||(r=await async function(e){const t=_e;for(const n of t)try{var r;const t=new x(n);await t.connect();const s=await t.request({command:"account_tx",account:e,binary:!1,limit:2,forward:!1});return await t.disconnect(),xe(null==(r=s.result)?void 0:r.transactions)}catch(e){let t="Connection to XRPL server failed";e instanceof Error&&(t+=`: ${e.message}`),console.error(t)}}(s)),!r)return I({},t,{status:e.FAILED});const o=function(e,t,r){return me.verify(Buffer.from(e).toString("hex"),r,t)}(t.attestation,r,t.proof);return I({},t,{status:o?e.VERIFIED:e.FAILED})}(r,n);case t.XLM_ED25519:return function(t){const[r,,n]=t.address.split(/:/);if("stellar"!==r)return I({},t,{status:e.FAILED});try{const r=H.fromPublicKey(n),s=Buffer.from(t.attestation,"utf-8"),o=Buffer.from(t.proof,"base64");return I({},t,{status:r.verify(s,o)?e.VERIFIED:e.FAILED})}catch(r){return console.error(r),I({},t,{status:e.FAILED})}}(r);case t.CONCORDIUM:return(async(t,r={})=>{const n=I({},we,r),[s,o,i]=t.address.split(/:/);if("ccd"!==s)return I({},t,{status:e.FAILED});let c=n.network;o&&(c=o.includes("testnet")?"testnet":"mainnet");try{let r;try{r=JSON.parse(t.proof)}catch(r){return I({},t,{status:e.FAILED})}if(!r||"object"!=typeof r||0===Object.keys(r).length)return I({},t,{status:e.FAILED});if(n.testMode)try{const n=He(r);return!n||n.length<64||!/^[0-9a-fA-F]+$/.test(n)?I({},t,{status:e.FAILED}):I({},t,{status:e.VERIFIED})}catch(r){return I({},t,{status:e.FAILED})}const s=await Ie(()=>async function(e,t,r){const n=Ee[t];try{const t=new AbortController,s=setTimeout(()=>t.abort(),r),o=await fetch(`${n.walletProxyUrl}/v0/accEncryptionKey/${e}`,{method:"GET",headers:{Accept:"application/json","User-Agent":"verify-proof/1.6.0"},signal:t.signal});return clearTimeout(s),o.ok}catch(e){if(e instanceof Error&&"AbortError"===e.name)throw new Error(`Account validation timeout after ${r}ms`);throw e}}(i,c,n.timeout),n.retries);if(!s)return I({},t,{status:e.FAILED});const o=await Ie(()=>async function(e,t){try{const t=He(e);return!(!t||t.length<64)&&t.length>=64&&/^[0-9a-fA-F]+$/.test(t)}catch(e){if(e instanceof Error){var r,n,s;if(null!=(r=e.message)&&r.includes("timeout"))throw new Error(`Signature verification timeout after ${t}ms`);if(null!=(n=e.message)&&n.includes("UNAVAILABLE"))throw new Error("Concordium node unavailable");if(null!=(s=e.message)&&s.includes("NOT_FOUND"))return!1}throw e}}(r,n.timeout),n.retries);return I({},t,o?{status:e.VERIFIED}:{status:e.FAILED})}catch(r){return I({},t,{status:e.FAILED})}})(r);case t.EIP712:case t.BIP137:case t.BIP322:return async function(r){const[n,,s]=r.address.split(/:/);if("bip122"!==n)return I({},r,{status:e.FAILED});const o=function(e){return e.startsWith("1")||e.startsWith("3")||e.startsWith("bc1")?S.bitcoin:e.startsWith("t1")||e.startsWith("t3")?S.zcash:e.startsWith("L")||e.startsWith("M")||e.startsWith("ltc1")?S.litecoin:e.startsWith("D")||e.startsWith("A")?S.dogecoin:e.startsWith("X")||e.startsWith("7")?S.dash:e.startsWith("q")?S.bitcoincash:e.startsWith("tb1")?S.testnet:S.bitcoin}(s);if(!o)return I({},r,{status:e.FAILED});if(s.startsWith("t1")||s.startsWith("t3"))return L(s,r,o);if(o.isTestnet)return P(s,r);try{switch(r.type){case t.BIP137:return L(s,r,o);case t.BIP322:return P(s,r);default:return I({},r,{status:e.FAILED})}}catch(t){return console.error("error verifying proof",t),I({},r,{status:e.FAILED})}}(r);case t.TIP191:return async function(t){const[r,,n]=t.address.split(/:/);return I({},t,"tron"!==r?{status:e.FAILED}:{status:k(n,t.attestation,t.proof)?e.VERIFIED:e.FAILED})}(r)}return r}export{ve as verifyProof};
1
+ import{ProofStatus as e,ProofTypes as t}from"@notabene/javascript-sdk";import{encode as r}from"varuint-bitcoin";import n,{createBase58check as s,bech32 as o,base64 as i,base58 as c}from"@scure/base";import{Hash as a,PersonalMessage as u,Hex as d,Signature as f,Secp256k1 as h,Address as l,PublicKey as p,Bytes as y}from"ox";import b,{secp256k1 as g}from"@noble/curves/secp256k1";import{Verifier as A}from"bip322-js";import m from"tweetnacl";import _ from"@cardano-foundation/cardano-verify-datasignature";import{Client as x}from"xrpl";import E from"@noble/curves/abstract/utils";import w from"@noble/curves/ed25519";import{Keypair as H}from"@stellar/stellar-sdk";function I(){return I=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},I.apply(null,arguments)}var v;!function(e){e.P2WPKH="p2wpkh",e.P2SH_P2WPKH="p2sh(p2wpkh)"}(v||(v={}));const S={bitcoin:{messagePrefix:"Bitcoin Signed Message:\n",pubKeyHashVersion:0,scriptHashVersion:5,bech32Prefix:"bc",isTestnet:!1},bitcoincash:{messagePrefix:"Bitcoin Signed Message:\n",pubKeyHashVersion:0,scriptHashVersion:5,bech32Prefix:"bc",isTestnet:!1},litecoin:{messagePrefix:"Litecoin Signed Message:\n",pubKeyHashVersion:48,scriptHashVersion:50,bech32Prefix:"ltc",isTestnet:!1},dogecoin:{messagePrefix:"Dogecoin Signed Message:\n",pubKeyHashVersion:30,scriptHashVersion:22,isTestnet:!1},dash:{messagePrefix:"DarkCoin Signed Message:\n",pubKeyHashVersion:76,scriptHashVersion:16,isTestnet:!1},zcash:{messagePrefix:"Zcash Signed Message:\n",pubKeyHashVersion:Uint8Array.from([28,184]),scriptHashVersion:Uint8Array.from([28,189]),isTestnet:!1},testnet:{messagePrefix:"Bitcoin Signed Message:\n",pubKeyHashVersion:111,scriptHashVersion:196,bech32Prefix:"tb",isTestnet:!0}};var D;function P(t,r){const{attestation:n,proof:s}=r;return I({},r,{status:A.verifySignature(t,n,s)?e.VERIFIED:e.FAILED})}function L(t,n,s){const o=function(e){if(e.match("^(bc1|tb1|ltc1).*"))return D.NATIVE;if(e.match("^[32M].*"))return D.SEGWIT;if(e.match("^[1nmL].*"))return D.LEGACY;if(e.match("^(D).*"))return D.DOGECOIN;if(e.match("^(q).*"))return D.BCH;if(e.match("^(t1|t3).*"))return D.LEGACY;if(e.match("^[X7].*"))return D.LEGACY;throw new Error("INVALID ADDRESS: ".concat(e).concat(" is not a valid or a supported address"))}(t),c=Boolean(s.bech32Prefix&&(o===D.NATIVE||o===D.SEGWIT&&!t.startsWith("1"))),u=function(e,t,n,s,o){const{compressed:c,segwitType:u,signature:d}=function(e){const t=i.decode(e);if(65!==t.length)throw new Error("Invalid signature length");const r=t[0]-27;if(r>15||r<0)throw new Error("Invalid signature parameter");const n=!!(12&r),s=3&r,o=g.Signature.fromCompact(t.slice(1));return{compressed:n,segwitType:8&r?4&r?v.P2WPKH:v.P2SH_P2WPKH:void 0,signature:o.addRecoveryBit(s)}}(n);if(s&&!c)throw new Error("checkSegwitAlways can only be used with a compressed pubkey signature flagbyte");const f=function(e,t){const n=(new TextEncoder).encode(t),s=(new TextEncoder).encode(e),o=r(s.length).buffer,i=new Uint8Array(n.length+o.byteLength+s.length);return i.set(n),i.set(new Uint8Array(o),n.length),i.set(s,n.length+o.byteLength),function(e){return a.sha256(a.sha256(e))}(i)}(e,o.messagePrefix),h=C(d.recoverPublicKey(f).toRawBytes(c));let l="";if(t.startsWith("q"))return l=V(o.pubKeyHashVersion,h),l.startsWith("1");if(u)l=u===v.P2SH_P2WPKH?V(o.scriptHashVersion,h):o.bech32Prefix?U(h,o.bech32Prefix):V(o.scriptHashVersion,h);else if(t.startsWith("3")&&!u){const e=new Uint8Array(22);e[0]=0,e[1]=20,e.set(h,2);const r=C(e),n=V(o.scriptHashVersion,r),s=V(o.scriptHashVersion,h);if(t===n||t===s)return!0;l=s}else if(s&&o.bech32Prefix)try{l=U(h,o.bech32Prefix)}catch(e){l=V(o.scriptHashVersion,h)}else l=V(o.pubKeyHashVersion,h);return l===t}(n.attestation,t,n.proof,c,s);return I({},n,{status:u?e.VERIFIED:e.FAILED})}!function(e){e.LEGACY="Legacy",e.NATIVE="Native SegWit",e.SEGWIT="SegWit",e.P2SH_SEGWIT="p2sh",e.BCH="Bitcoin Cash",e.ETHEREUM="Ethereum",e.DOGECOIN="Dogecoin",e.UNKNOWN="Unknown"}(D||(D={}));const B=s(a.sha256);function V(e,t){const r="number"==typeof e?Uint8Array.of(e):e,n=new Uint8Array(r.length+t.length);return n.set(r),n.set(t,r.length),B.encode(n)}function U(e,t="bc"){const r=o.toWords(e);return r.unshift(0),o.encode(t,r)}function C(e){return a.ripemd160(a.sha256(e))}function k(e,t){const r=[];let n=t;for(;n<e.length&&null!=(s=e[n])&&s.startsWith("- ");){var s;r.push(e[n].substring(2)),n++}return r}function F(e,t,r){try{const s=(n=d.fromString(t),a.keccak256(function(e){const t=d.from(e);return d.concat("0x19",d.fromString("TRON Signed Message:\n"+d.size(t)),t)}(n))),o=f.fromHex(r),i=h.recoverPublicKey({payload:s,signature:o}),u=`0x41${a.keccak256(`0x${p.toHex(i).slice(4)}`).substring(26)}`,l=y.from(u),b=y.from(a.sha256(a.sha256(u))).slice(0,4),g=y.concat(l,b);return c.encode(g)===e}catch(e){return!1}var n}var T="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function O(e){var t={exports:{}};return e(t,t.exports),t.exports}var K=O(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=void 0,t.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0}),M=O(function(e,t){function r(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function n(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function s(e,...t){if(!r(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 o(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function i(e){for(let t=0;t<e.length;t++)e[t]=o(e[t]);return e}Object.defineProperty(t,"__esModule",{value:!0}),t.wrapXOFConstructorWithOpts=t.wrapConstructorWithOpts=t.wrapConstructor=t.Hash=t.nextTick=t.swap32IfBE=t.byteSwapIfBE=t.swap8IfBE=t.isLE=void 0,t.isBytes=r,t.anumber=n,t.abytes=s,t.ahash=function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.createHasher");n(e.outputLen),n(e.blockLen)},t.aexists=function(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")},t.aoutput=function(e,t){s(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)},t.u8=function(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},t.u32=function(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))},t.clean=function(...e){for(let t=0;t<e.length;t++)e[t].fill(0)},t.createView=function(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)},t.rotr=function(e,t){return e<<32-t|e>>>t},t.rotl=function(e,t){return e<<t|e>>>32-t>>>0},t.byteSwap=o,t.byteSwap32=i,t.bytesToHex=function(e){if(s(e),c)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=a[e[r]];return t},t.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);if(c)return Uint8Array.fromHex(e);const t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,s=0;t<r;t++,s+=2){const r=d(e.charCodeAt(s)),o=d(e.charCodeAt(s+1));if(void 0===r||void 0===o)throw new Error('hex string expected, got non-hex character "'+(e[s]+e[s+1])+'" at index '+s);n[t]=16*r+o}return n},t.asyncLoop=async function(e,r,n){let s=Date.now();for(let o=0;o<e;o++){n(o);const e=Date.now()-s;e>=0&&e<r||(await(0,t.nextTick)(),s+=e)}},t.utf8ToBytes=f,t.bytesToUtf8=function(e){return(new TextDecoder).decode(e)},t.toBytes=h,t.kdfInputToBytes=function(e){return"string"==typeof e&&(e=f(e)),s(e),e},t.concatBytes=function(...e){let t=0;for(let r=0;r<e.length;r++){const n=e[r];s(n),t+=n.length}const r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){const s=e[t];r.set(s,n),n+=s.length}return r},t.checkOpts=function(e,t){if(void 0!==t&&"[object Object]"!=={}.toString.call(t))throw new Error("options should be object or undefined");return Object.assign(e,t)},t.createHasher=l,t.createOptHasher=p,t.createXOFer=y,t.randomBytes=function(e=32){if(K.crypto&&"function"==typeof K.crypto.getRandomValues)return K.crypto.getRandomValues(new Uint8Array(e));if(K.crypto&&"function"==typeof K.crypto.randomBytes)return Uint8Array.from(K.crypto.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")},t.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],t.swap8IfBE=t.isLE?e=>e:e=>o(e),t.byteSwapIfBE=t.swap8IfBE,t.swap32IfBE=t.isLE?e=>e:i;const c=/* @__PURE__ */(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),a=/* @__PURE__ */Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),u={_0:48,_9:57,A:65,F:70,a:97,f:102};function d(e){return e>=u._0&&e<=u._9?e-u._0:e>=u.A&&e<=u.F?e-(u.A-10):e>=u.a&&e<=u.f?e-(u.a-10):void 0}function f(e){if("string"!=typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))}function h(e){return"string"==typeof e&&(e=f(e)),s(e),e}function l(e){const t=t=>e().update(h(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function p(e){const t=(t,r)=>e(r).update(h(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}function y(e){const t=(t,r)=>e(r).update(h(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}t.nextTick=async()=>{},t.Hash=class{},t.wrapConstructor=l,t.wrapConstructorWithOpts=p,t.wrapXOFConstructorWithOpts=y}),j=O(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.equal=t.concat=t.HEX_REGEX=void 0,t.HEX_REGEX=/^[A-F0-9]*$/iu,t.concat=function(e){return(0,M.concatBytes)(...e)},t.equal=function(e,t){if(e.byteLength!==t.byteLength)return!1;const r=new Int8Array(e),n=new Int8Array(t);for(let t=0;t!==e.byteLength;t++)if(r[t]!==n[t])return!1;return!0}}),N=O(function(e,t){var r=T&&T.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),n=T&&T.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytes=t.stringToHex=t.hexToString=t.hexToBytes=t.bytesToHex=void 0,t.bytesToHex=e=>(0,M.bytesToHex)(e instanceof Uint8Array?e:Uint8Array.from(e)).toUpperCase(),t.hexToBytes=e=>{const t=new Uint8Array(e.length/2);if(!j.HEX_REGEX.test(e))throw new Error("Invalid hex string");for(let r=0;r<t.length;r++){const n=2*r,s=e.slice(n,n+2),o=Number.parseInt(s,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[r]=o}return t},t.hexToString=(e,r="utf8")=>new TextDecoder(r).decode((0,t.hexToBytes)(e)),t.stringToHex=e=>(0,t.bytesToHex)((new TextEncoder).encode(e)),t.randomBytes=M.randomBytes,n(j,t)}),R=O(function(e,t){function r(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const s=BigInt(32),o=BigInt(4294967295),i=Number(r>>s&o),c=Number(r&o),a=n?0:4;e.setUint32(t+(n?4:0),i,n),e.setUint32(t+a,c,n)}Object.defineProperty(t,"__esModule",{value:!0}),t.SHA512_IV=t.SHA384_IV=t.SHA224_IV=t.SHA256_IV=t.HashMD=void 0,t.setBigUint64=r,t.Chi=function(e,t,r){return e&t^~e&r},t.Maj=function(e,t,r){return e&t^e&r^t&r},t.HashMD=class extends M.Hash{constructor(e,t,r,n){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=(0,M.createView)(this.buffer)}update(e){(0,M.aexists)(this),e=(0,M.toBytes)(e),(0,M.abytes)(e);const{view:t,buffer:r,blockLen:n}=this,s=e.length;for(let o=0;o<s;){const i=Math.min(n-this.pos,s-o);if(i===n){const t=(0,M.createView)(e);for(;n<=s-o;o+=n)this.process(t,o);continue}r.set(e.subarray(o,o+i),this.pos),this.pos+=i,o+=i,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,M.aexists)(this),(0,M.aoutput)(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:s,isLE:o}=this;let{pos:i}=this;t[i++]=128,(0,M.clean)(this.buffer.subarray(i)),this.padOffset>s-i&&(this.process(n,0),i=0);for(let e=i;e<s;e++)t[e]=0;r(n,s-8,BigInt(8*this.length),o),this.process(n,0);const c=(0,M.createView)(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,d=this.get();if(u>d.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<u;e++)c.setUint32(4*e,d[e],o)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:s,destroyed:o,pos:i}=this;return e.destroyed=o,e.finished=s,e.length=n,e.pos=i,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}},t.SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),t.SHA224_IV=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),t.SHA384_IV=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),t.SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209])}),W=O(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.toBig=t.shrSL=t.shrSH=t.rotrSL=t.rotrSH=t.rotrBL=t.rotrBH=t.rotr32L=t.rotr32H=t.rotlSL=t.rotlSH=t.rotlBL=t.rotlBH=t.add5L=t.add5H=t.add4L=t.add4H=t.add3L=t.add3H=void 0,t.add=m,t.fromBig=s,t.split=o;const r=/* @__PURE__ */BigInt(2**32-1),n=/* @__PURE__ */BigInt(32);function s(e,t=!1){return t?{h:Number(e&r),l:Number(e>>n&r)}:{h:0|Number(e>>n&r),l:0|Number(e&r)}}function o(e,t=!1){const r=e.length;let n=new Uint32Array(r),o=new Uint32Array(r);for(let i=0;i<r;i++){const{h:r,l:c}=s(e[i],t);[n[i],o[i]]=[r,c]}return[n,o]}const i=(e,t)=>BigInt(e>>>0)<<n|BigInt(t>>>0);t.toBig=i;const c=(e,t,r)=>e>>>r;t.shrSH=c;const a=(e,t,r)=>e<<32-r|t>>>r;t.shrSL=a;const u=(e,t,r)=>e>>>r|t<<32-r;t.rotrSH=u;const d=(e,t,r)=>e<<32-r|t>>>r;t.rotrSL=d;const f=(e,t,r)=>e<<64-r|t>>>r-32;t.rotrBH=f;const h=(e,t,r)=>e>>>r-32|t<<64-r;t.rotrBL=h;const l=(e,t)=>t;t.rotr32H=l;const p=(e,t)=>e;t.rotr32L=p;const y=(e,t,r)=>e<<r|t>>>32-r;t.rotlSH=y;const b=(e,t,r)=>t<<r|e>>>32-r;t.rotlSL=b;const g=(e,t,r)=>t<<r-32|e>>>64-r;t.rotlBH=g;const A=(e,t,r)=>e<<r-32|t>>>64-r;function m(e,t,r,n){const s=(t>>>0)+(n>>>0);return{h:e+r+(s/2**32|0)|0,l:0|s}}t.rotlBL=A;const _=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);t.add3L=_;const x=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;t.add3H=x;const E=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);t.add4L=E;const w=(e,t,r,n,s)=>t+r+n+s+(e/2**32|0)|0;t.add4H=w;const H=(e,t,r,n,s)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(s>>>0);t.add5L=H;const I=(e,t,r,n,s,o)=>t+r+n+s+o+(e/2**32|0)|0;t.add5H=I,t.default={fromBig:s,split:o,toBig:i,shrSH:c,shrSL:a,rotrSH:u,rotrSL:d,rotrBH:f,rotrBL:h,rotr32H:l,rotr32L:p,rotlSH:y,rotlSL:b,rotlBH:g,rotlBL:A,add:m,add3L:_,add3H:x,add4L:E,add4H:w,add5H:I,add5L:H}}),G=R,$=W,X=O(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.sha512_224=t.sha512_256=t.sha384=t.sha512=t.sha224=t.sha256=t.SHA512_256=t.SHA512_224=t.SHA384=t.SHA512=t.SHA224=t.SHA256=void 0;const r=/* @__PURE__ */Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),n=/* @__PURE__ */new Uint32Array(64);class s extends G.HashMD{constructor(e=32){super(64,e,8,!1),this.A=0|G.SHA256_IV[0],this.B=0|G.SHA256_IV[1],this.C=0|G.SHA256_IV[2],this.D=0|G.SHA256_IV[3],this.E=0|G.SHA256_IV[4],this.F=0|G.SHA256_IV[5],this.G=0|G.SHA256_IV[6],this.H=0|G.SHA256_IV[7]}get(){const{A:e,B:t,C:r,D:n,E:s,F:o,G:i,H:c}=this;return[e,t,r,n,s,o,i,c]}set(e,t,r,n,s,o,i,c){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|s,this.F=0|o,this.G=0|i,this.H=0|c}process(e,t){for(let r=0;r<16;r++,t+=4)n[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=n[e-15],r=n[e-2],s=(0,M.rotr)(t,7)^(0,M.rotr)(t,18)^t>>>3,o=(0,M.rotr)(r,17)^(0,M.rotr)(r,19)^r>>>10;n[e]=o+n[e-7]+s+n[e-16]|0}let{A:s,B:o,C:i,D:c,E:a,F:u,G:d,H:f}=this;for(let e=0;e<64;e++){const t=f+((0,M.rotr)(a,6)^(0,M.rotr)(a,11)^(0,M.rotr)(a,25))+(0,G.Chi)(a,u,d)+r[e]+n[e]|0,h=((0,M.rotr)(s,2)^(0,M.rotr)(s,13)^(0,M.rotr)(s,22))+(0,G.Maj)(s,o,i)|0;f=d,d=u,u=a,a=c+t|0,c=i,i=o,o=s,s=t+h|0}s=s+this.A|0,o=o+this.B|0,i=i+this.C|0,c=c+this.D|0,a=a+this.E|0,u=u+this.F|0,d=d+this.G|0,f=f+this.H|0,this.set(s,o,i,c,a,u,d,f)}roundClean(){(0,M.clean)(n)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,M.clean)(this.buffer)}}t.SHA256=s;class o extends s{constructor(){super(28),this.A=0|G.SHA224_IV[0],this.B=0|G.SHA224_IV[1],this.C=0|G.SHA224_IV[2],this.D=0|G.SHA224_IV[3],this.E=0|G.SHA224_IV[4],this.F=0|G.SHA224_IV[5],this.G=0|G.SHA224_IV[6],this.H=0|G.SHA224_IV[7]}}t.SHA224=o;const i=/* @__PURE__ */(()=>$.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))))(),c=/* @__PURE__ */(()=>i[0])(),a=/* @__PURE__ */(()=>i[1])(),u=/* @__PURE__ */new Uint32Array(80),d=/* @__PURE__ */new Uint32Array(80);class f extends G.HashMD{constructor(e=64){super(128,e,16,!1),this.Ah=0|G.SHA512_IV[0],this.Al=0|G.SHA512_IV[1],this.Bh=0|G.SHA512_IV[2],this.Bl=0|G.SHA512_IV[3],this.Ch=0|G.SHA512_IV[4],this.Cl=0|G.SHA512_IV[5],this.Dh=0|G.SHA512_IV[6],this.Dl=0|G.SHA512_IV[7],this.Eh=0|G.SHA512_IV[8],this.El=0|G.SHA512_IV[9],this.Fh=0|G.SHA512_IV[10],this.Fl=0|G.SHA512_IV[11],this.Gh=0|G.SHA512_IV[12],this.Gl=0|G.SHA512_IV[13],this.Hh=0|G.SHA512_IV[14],this.Hl=0|G.SHA512_IV[15]}get(){const{Ah:e,Al:t,Bh:r,Bl:n,Ch:s,Cl:o,Dh:i,Dl:c,Eh:a,El:u,Fh:d,Fl:f,Gh:h,Gl:l,Hh:p,Hl:y}=this;return[e,t,r,n,s,o,i,c,a,u,d,f,h,l,p,y]}set(e,t,r,n,s,o,i,c,a,u,d,f,h,l,p,y){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|s,this.Cl=0|o,this.Dh=0|i,this.Dl=0|c,this.Eh=0|a,this.El=0|u,this.Fh=0|d,this.Fl=0|f,this.Gh=0|h,this.Gl=0|l,this.Hh=0|p,this.Hl=0|y}process(e,t){for(let r=0;r<16;r++,t+=4)u[r]=e.getUint32(t),d[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|u[e-15],r=0|d[e-15],n=$.rotrSH(t,r,1)^$.rotrSH(t,r,8)^$.shrSH(t,r,7),s=$.rotrSL(t,r,1)^$.rotrSL(t,r,8)^$.shrSL(t,r,7),o=0|u[e-2],i=0|d[e-2],c=$.rotrSH(o,i,19)^$.rotrBH(o,i,61)^$.shrSH(o,i,6),a=$.rotrSL(o,i,19)^$.rotrBL(o,i,61)^$.shrSL(o,i,6),f=$.add4L(s,a,d[e-7],d[e-16]),h=$.add4H(f,n,c,u[e-7],u[e-16]);u[e]=0|h,d[e]=0|f}let{Ah:r,Al:n,Bh:s,Bl:o,Ch:i,Cl:f,Dh:h,Dl:l,Eh:p,El:y,Fh:b,Fl:g,Gh:A,Gl:m,Hh:_,Hl:x}=this;for(let e=0;e<80;e++){const t=$.rotrSH(p,y,14)^$.rotrSH(p,y,18)^$.rotrBH(p,y,41),E=$.rotrSL(p,y,14)^$.rotrSL(p,y,18)^$.rotrBL(p,y,41),w=p&b^~p&A,H=$.add5L(x,E,y&g^~y&m,a[e],d[e]),I=$.add5H(H,_,t,w,c[e],u[e]),v=0|H,S=$.rotrSH(r,n,28)^$.rotrBH(r,n,34)^$.rotrBH(r,n,39),D=$.rotrSL(r,n,28)^$.rotrBL(r,n,34)^$.rotrBL(r,n,39),P=r&s^r&i^s&i,L=n&o^n&f^o&f;_=0|A,x=0|m,A=0|b,m=0|g,b=0|p,g=0|y,({h:p,l:y}=$.add(0|h,0|l,0|I,0|v)),h=0|i,l=0|f,i=0|s,f=0|o,s=0|r,o=0|n;const B=$.add3L(v,D,L);r=$.add3H(B,I,S,P),n=0|B}({h:r,l:n}=$.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:s,l:o}=$.add(0|this.Bh,0|this.Bl,0|s,0|o)),({h:i,l:f}=$.add(0|this.Ch,0|this.Cl,0|i,0|f)),({h,l}=$.add(0|this.Dh,0|this.Dl,0|h,0|l)),({h:p,l:y}=$.add(0|this.Eh,0|this.El,0|p,0|y)),({h:b,l:g}=$.add(0|this.Fh,0|this.Fl,0|b,0|g)),({h:A,l:m}=$.add(0|this.Gh,0|this.Gl,0|A,0|m)),({h:_,l:x}=$.add(0|this.Hh,0|this.Hl,0|_,0|x)),this.set(r,n,s,o,i,f,h,l,p,y,b,g,A,m,_,x)}roundClean(){(0,M.clean)(u,d)}destroy(){(0,M.clean)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}t.SHA512=f;class h extends f{constructor(){super(48),this.Ah=0|G.SHA384_IV[0],this.Al=0|G.SHA384_IV[1],this.Bh=0|G.SHA384_IV[2],this.Bl=0|G.SHA384_IV[3],this.Ch=0|G.SHA384_IV[4],this.Cl=0|G.SHA384_IV[5],this.Dh=0|G.SHA384_IV[6],this.Dl=0|G.SHA384_IV[7],this.Eh=0|G.SHA384_IV[8],this.El=0|G.SHA384_IV[9],this.Fh=0|G.SHA384_IV[10],this.Fl=0|G.SHA384_IV[11],this.Gh=0|G.SHA384_IV[12],this.Gl=0|G.SHA384_IV[13],this.Hh=0|G.SHA384_IV[14],this.Hl=0|G.SHA384_IV[15]}}t.SHA384=h;const l=/* @__PURE__ */Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),p=/* @__PURE__ */Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class y extends f{constructor(){super(28),this.Ah=0|l[0],this.Al=0|l[1],this.Bh=0|l[2],this.Bl=0|l[3],this.Ch=0|l[4],this.Cl=0|l[5],this.Dh=0|l[6],this.Dl=0|l[7],this.Eh=0|l[8],this.El=0|l[9],this.Fh=0|l[10],this.Fl=0|l[11],this.Gh=0|l[12],this.Gl=0|l[13],this.Hh=0|l[14],this.Hl=0|l[15]}}t.SHA512_224=y;class b extends f{constructor(){super(32),this.Ah=0|p[0],this.Al=0|p[1],this.Bh=0|p[2],this.Bl=0|p[3],this.Ch=0|p[4],this.Cl=0|p[5],this.Dh=0|p[6],this.Dl=0|p[7],this.Eh=0|p[8],this.El=0|p[9],this.Fh=0|p[10],this.Fl=0|p[11],this.Gh=0|p[12],this.Gl=0|p[13],this.Hh=0|p[14],this.Hl=0|p[15]}}t.SHA512_256=b,t.sha256=(0,M.createHasher)(()=>new s),t.sha224=(0,M.createHasher)(()=>new o),t.sha512=(0,M.createHasher)(()=>new f),t.sha384=(0,M.createHasher)(()=>new h),t.sha512_256=(0,M.createHasher)(()=>new b),t.sha512_224=(0,M.createHasher)(()=>new y)}),q=O(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.sha224=t.SHA224=t.sha256=t.SHA256=void 0,t.SHA256=X.SHA256,t.sha256=X.sha256,t.SHA224=X.SHA224,t.sha224=X.sha224});const Y=(T&&T.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(/*#__PURE__*/Object.defineProperty({default:function(e){return Array.isArray(e)?new Uint8Array(e):e}},"__esModule",{value:!0}));var z=/*#__PURE__*/Object.defineProperty({default:function(e){function t(t){return e((0,Y.default)(t))}return t.create=()=>{const t=e.create();return{update(e){return t.update((0,Y.default)(e)),this},digest:()=>t.digest()}},t}},"__esModule",{value:!0}),Z=q,J=O(function(e,t){var r=T&&T.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.sha256=void 0;const n=r(z);t.sha256=(0,n.default)(Z.sha256)}),Q=O(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.concatArgs=t.arrayEqual=void 0,t.arrayEqual=function(e,t){return e.length===t.length&&e.every((e,r)=>e===t[r])},t.concatArgs=function(...e){return e.flatMap(e=>"number"==typeof e?[e]:Array.from(e))}}),ee=O(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isValidClassicAddress=t.decodeAccountPublic=t.encodeAccountPublic=t.encodeNodePublic=t.decodeNodePublic=t.decodeAddress=t.decodeAccountID=t.encodeAddress=t.encodeAccountID=t.decodeSeed=t.encodeSeed=t.codec=void 0;const r=[1,225,75],s={sha256:J.sha256},o=new class{constructor(e){this._sha256=e.sha256,this._codec=n.base58xrp}encode(e,t){return this._encodeVersioned(e,t.versions,t.expectedLength)}decode(e,t){var r;const n=t.versions,s=t.versionTypes,o=this.decodeChecked(e);if(n.length>1&&!t.expectedLength)throw new Error("expectedLength is required because there are >= 2 possible versions");const i=null!==(r=t.expectedLength)&&void 0!==r?r:o.length-("number"==typeof n[0]?1:n[0].length),c=o.slice(0,-i),a=o.slice(-i);for(let e=0;e<n.length;e++){const t=Array.isArray(n[e])?n[e]:[n[e]];if((0,Q.arrayEqual)(c,t))return{version:t,bytes:a,type:s?s[e]:null}}throw new Error("version_invalid: version bytes do not match any of the provided version(s)")}encodeChecked(e){const t=this._sha256(this._sha256(e)).slice(0,4);return this._encodeRaw(Uint8Array.from((0,Q.concatArgs)(e,t)))}decodeChecked(e){const t=this._decodeRaw(e);if(t.byteLength<5)throw new Error("invalid_input_size: decoded data must have length >= 5");if(!this._verifyCheckSum(t))throw new Error("checksum_invalid");return t.slice(0,-4)}_encodeVersioned(e,t,r){if(!a(e,r))throw new Error("unexpected_payload_length: bytes.length does not match expectedLength. Ensure that the bytes are a Uint8Array.");return this.encodeChecked((0,Q.concatArgs)(t,e))}_encodeRaw(e){return this._codec.encode(Uint8Array.from(e))}_decodeRaw(e){return this._codec.decode(e)}_verifyCheckSum(e){const t=this._sha256(this._sha256(e.slice(0,-4))).slice(0,4),r=e.slice(-4);return(0,Q.arrayEqual)(t,r)}}(s);function i(e){return o.encode(e,{versions:[0],expectedLength:20})}function c(e){return o.decode(e,{versions:[0],expectedLength:20}).bytes}function a(e,t){return"byteLength"in e?e.byteLength===t:e.length===t}t.codec=o,t.encodeSeed=function(e,t){if(!a(e,16))throw new Error("entropy must have length 16");return o.encode(e,{expectedLength:16,versions:"ed25519"===t?r:[33]})},t.decodeSeed=function(e,t={versionTypes:["ed25519","secp256k1"],versions:[r,33],expectedLength:16}){return o.decode(e,t)},t.encodeAccountID=i,t.encodeAddress=i,t.decodeAccountID=c,t.decodeAddress=c,t.decodeNodePublic=function(e){return o.decode(e,{versions:[28],expectedLength:33}).bytes},t.encodeNodePublic=function(e){return o.encode(e,{versions:[28],expectedLength:33})},t.encodeAccountPublic=function(e){return o.encode(e,{versions:[35],expectedLength:33})},t.decodeAccountPublic=function(e){return o.decode(e,{versions:[35],expectedLength:33}).bytes},t.isValidClassicAddress=function(e){try{c(e)}catch(e){return!1}return!0}}),te=O(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isValidXAddress=t.decodeXAddress=t.xAddressToClassicAddress=t.encodeXAddress=t.classicAddressToXAddress=t.isValidClassicAddress=t.decodeAccountPublic=t.encodeAccountPublic=t.decodeNodePublic=t.encodeNodePublic=t.decodeAccountID=t.encodeAccountID=t.decodeSeed=t.encodeSeed=t.codec=void 0,Object.defineProperty(t,"codec",{enumerable:!0,get:function(){return ee.codec}}),Object.defineProperty(t,"encodeSeed",{enumerable:!0,get:function(){return ee.encodeSeed}}),Object.defineProperty(t,"decodeSeed",{enumerable:!0,get:function(){return ee.decodeSeed}}),Object.defineProperty(t,"encodeAccountID",{enumerable:!0,get:function(){return ee.encodeAccountID}}),Object.defineProperty(t,"decodeAccountID",{enumerable:!0,get:function(){return ee.decodeAccountID}}),Object.defineProperty(t,"encodeNodePublic",{enumerable:!0,get:function(){return ee.encodeNodePublic}}),Object.defineProperty(t,"decodeNodePublic",{enumerable:!0,get:function(){return ee.decodeNodePublic}}),Object.defineProperty(t,"encodeAccountPublic",{enumerable:!0,get:function(){return ee.encodeAccountPublic}}),Object.defineProperty(t,"decodeAccountPublic",{enumerable:!0,get:function(){return ee.decodeAccountPublic}}),Object.defineProperty(t,"isValidClassicAddress",{enumerable:!0,get:function(){return ee.isValidClassicAddress}});const r={main:Uint8Array.from([5,68]),test:Uint8Array.from([4,147])};function n(e,t,n){if(20!==e.length)throw new Error("Account ID must be 20 bytes");if(!1!==t&&t>4294967295)throw new Error("Invalid tag");const s=t||0,o=(0,N.concat)([n?r.test:r.main,e,Uint8Array.from([!1===t||null==t?0:1,255&s,s>>8&255,s>>16&255,s>>24&255,0,0,0,0])]);return ee.codec.encodeChecked(o)}function s(e){const t=ee.codec.decodeChecked(e),n=function(e){const t=e.slice(0,2);if((0,N.equal)(r.main,t))return!1;if((0,N.equal)(r.test,t))return!0;throw new Error("Invalid X-address: bad prefix")}(t);return{accountId:t.slice(2,22),tag:function(e){const t=e[22];if(t>=2)throw new Error("Unsupported X-address");if(1===t)return e[23]+256*e[24]+65536*e[25]+16777216*e[26];if(0!==t)throw new Error("flag must be zero to indicate no tag");if(!(0,N.equal)((0,N.hexToBytes)("0000000000000000"),e.slice(23,31)))throw new Error("remaining bytes must be zero");return!1}(t),test:n}}t.classicAddressToXAddress=function(e,t,r){return n((0,ee.decodeAccountID)(e),t,r)},t.encodeXAddress=n,t.xAddressToClassicAddress=function(e){const{accountId:t,tag:r,test:n}=s(e);return{classicAddress:(0,ee.encodeAccountID)(t),tag:r,test:n}},t.decodeXAddress=s,t.isValidXAddress=function(e){try{s(e)}catch(e){return!1}return!0}}),re=O(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ripemd160=t.RIPEMD160=t.md5=t.MD5=t.sha1=t.SHA1=void 0;const r=/* @__PURE__ */Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),n=/* @__PURE__ */new Uint32Array(80);class s extends G.HashMD{constructor(){super(64,20,8,!1),this.A=0|r[0],this.B=0|r[1],this.C=0|r[2],this.D=0|r[3],this.E=0|r[4]}get(){const{A:e,B:t,C:r,D:n,E:s}=this;return[e,t,r,n,s]}set(e,t,r,n,s){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|s}process(e,t){for(let r=0;r<16;r++,t+=4)n[r]=e.getUint32(t,!1);for(let e=16;e<80;e++)n[e]=(0,M.rotl)(n[e-3]^n[e-8]^n[e-14]^n[e-16],1);let{A:r,B:s,C:o,D:i,E:c}=this;for(let e=0;e<80;e++){let t,a;e<20?(t=(0,G.Chi)(s,o,i),a=1518500249):e<40?(t=s^o^i,a=1859775393):e<60?(t=(0,G.Maj)(s,o,i),a=2400959708):(t=s^o^i,a=3395469782);const u=(0,M.rotl)(r,5)+t+c+a+n[e]|0;c=i,i=o,o=(0,M.rotl)(s,30),s=r,r=u}r=r+this.A|0,s=s+this.B|0,o=o+this.C|0,i=i+this.D|0,c=c+this.E|0,this.set(r,s,o,i,c)}roundClean(){(0,M.clean)(n)}destroy(){this.set(0,0,0,0,0),(0,M.clean)(this.buffer)}}t.SHA1=s,t.sha1=(0,M.createHasher)(()=>new s);const o=/* @__PURE__ */Math.pow(2,32),i=/* @__PURE__ */Array.from({length:64},(e,t)=>Math.floor(o*Math.abs(Math.sin(t+1)))),c=/* @__PURE__ */r.slice(0,4),a=/* @__PURE__ */new Uint32Array(16);class u extends G.HashMD{constructor(){super(64,16,8,!0),this.A=0|c[0],this.B=0|c[1],this.C=0|c[2],this.D=0|c[3]}get(){const{A:e,B:t,C:r,D:n}=this;return[e,t,r,n]}set(e,t,r,n){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n}process(e,t){for(let r=0;r<16;r++,t+=4)a[r]=e.getUint32(t,!0);let{A:r,B:n,C:s,D:o}=this;for(let e=0;e<64;e++){let t,c,u;e<16?(t=(0,G.Chi)(n,s,o),c=e,u=[7,12,17,22]):e<32?(t=(0,G.Chi)(o,n,s),c=(5*e+1)%16,u=[5,9,14,20]):e<48?(t=n^s^o,c=(3*e+5)%16,u=[4,11,16,23]):(t=s^(n|~o),c=7*e%16,u=[6,10,15,21]),t=t+r+i[e]+a[c],r=o,o=s,s=n,n+=(0,M.rotl)(t,u[e%4])}r=r+this.A|0,n=n+this.B|0,s=s+this.C|0,o=o+this.D|0,this.set(r,n,s,o)}roundClean(){(0,M.clean)(a)}destroy(){this.set(0,0,0,0),(0,M.clean)(this.buffer)}}t.MD5=u,t.md5=(0,M.createHasher)(()=>new u);const d=/* @__PURE__ */Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),f=/* @__PURE__ */(()=>Uint8Array.from(new Array(16).fill(0).map((e,t)=>t)))(),h=/* @__PURE__ */(()=>f.map(e=>(9*e+5)%16))(),l=/* @__PURE__ */(()=>{const e=[[f],[h]];for(let t=0;t<4;t++)for(let r of e)r.push(r[t].map(e=>d[e]));return e})(),p=/* @__PURE__ */(()=>l[0])(),y=/* @__PURE__ */(()=>l[1])(),b=/* @__PURE__ */[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>Uint8Array.from(e)),g=/* @__PURE__ */p.map((e,t)=>e.map(e=>b[t][e])),A=/* @__PURE__ */y.map((e,t)=>e.map(e=>b[t][e])),m=/* @__PURE__ */Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),_=/* @__PURE__ */Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function x(e,t,r,n){return 0===e?t^r^n:1===e?t&r|~t&n:2===e?(t|~r)^n:3===e?t&n|r&~n:t^(r|~n)}const E=/* @__PURE__ */new Uint32Array(16);class w extends G.HashMD{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:t,h2:r,h3:n,h4:s}=this;return[e,t,r,n,s]}set(e,t,r,n,s){this.h0=0|e,this.h1=0|t,this.h2=0|r,this.h3=0|n,this.h4=0|s}process(e,t){for(let r=0;r<16;r++,t+=4)E[r]=e.getUint32(t,!0);let r=0|this.h0,n=r,s=0|this.h1,o=s,i=0|this.h2,c=i,a=0|this.h3,u=a,d=0|this.h4,f=d;for(let e=0;e<5;e++){const t=4-e,h=m[e],l=_[e],b=p[e],w=y[e],H=g[e],I=A[e];for(let t=0;t<16;t++){const n=(0,M.rotl)(r+x(e,s,i,a)+E[b[t]]+h,H[t])+d|0;r=d,d=a,a=0|(0,M.rotl)(i,10),i=s,s=n}for(let e=0;e<16;e++){const r=(0,M.rotl)(n+x(t,o,c,u)+E[w[e]]+l,I[e])+f|0;n=f,f=u,u=0|(0,M.rotl)(c,10),c=o,o=r}}this.set(this.h1+i+u|0,this.h2+a+f|0,this.h3+d+n|0,this.h4+r+o|0,this.h0+s+c|0)}roundClean(){(0,M.clean)(E)}destroy(){this.destroyed=!0,(0,M.clean)(this.buffer),this.set(0,0,0,0,0)}}t.RIPEMD160=w,t.ripemd160=(0,M.createHasher)(()=>new w)}),ne=O(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ripemd160=t.RIPEMD160=void 0,t.RIPEMD160=re.RIPEMD160,t.ripemd160=re.ripemd160}),se=O(function(e,t){var r=T&&T.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ripemd160=void 0;const n=r(z);t.ripemd160=(0,n.default)(ne.ripemd160)}),oe=O(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.sha512_256=t.SHA512_256=t.sha512_224=t.SHA512_224=t.sha384=t.SHA384=t.sha512=t.SHA512=void 0,t.SHA512=X.SHA512,t.sha512=X.sha512,t.SHA384=X.SHA384,t.sha384=X.sha384,t.SHA512_224=X.SHA512_224,t.sha512_224=X.sha512_224,t.SHA512_256=X.SHA512_256,t.sha512_256=X.sha512_256}),ie=O(function(e,t){var r=T&&T.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.sha512=void 0;const n=r(z);t.sha512=(0,n.default)(oe.sha512)});class ce{constructor(){this.hash=ie.sha512.create()}static half(e){return(new ce).add(e).first256()}add(e){return this.hash.update(e),this}addU32(e){const t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e),this.add(t)}finish(){return this.hash.digest()}first256(){return this.finish().slice(0,32)}first256BigInt(){return(0,E.bytesToNumberBE)(this.first256())}}var ae=/*#__PURE__*/Object.defineProperty({default:ce},"__esModule",{value:!0}),ue=O(function(e,t){var r=T&&T.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.accountPublicFromPublicGenerator=t.derivePrivateKey=void 0;const n=r(ae),s=BigInt(0);function o(e,t){const r=b.secp256k1.CURVE.n;for(let o=0;o<=4294967295;o++){const i=(new n.default).add(e);void 0!==t&&i.addU32(t),i.addU32(o);const c=i.first256BigInt();if(c>s&&c<r)return c}throw new Error("impossible unicorn ;)")}t.derivePrivateKey=function(e,t={}){const r=t.validator,n=b.secp256k1.CURVE.n,s=o(e);return r?s:(o(b.secp256k1.ProjectivePoint.BASE.multiply(s).toRawBytes(!0),t.accountIndex||0)+s)%n},t.accountPublicFromPublicGenerator=function(e){const t=b.secp256k1.ProjectivePoint.fromHex(e),r=o(e,0),n=b.secp256k1.ProjectivePoint.BASE.multiply(r);return t.add(n).toRawBytes(!0)}}),de=/*#__PURE__*/Object.defineProperty({default:{ok(e,t){if(!e)throw new Error(t)}}},"__esModule",{value:!0}),fe=O(function(e,t){var r;Object.defineProperty(t,"__esModule",{value:!0}),t.getAlgorithmFromPrivateKey=t.getAlgorithmFromPublicKey=t.getAlgorithmFromKey=void 0,function(e){e[e.NONE=-1]="NONE",e[e.ED25519=237]="ED25519",e[e.SECP256K1_PUB_X=2]="SECP256K1_PUB_X",e[e.SECP256K1_PUB_X_ODD_Y=3]="SECP256K1_PUB_X_ODD_Y",e[e.SECP256K1_PUB_XY=4]="SECP256K1_PUB_XY",e[e.SECP256K1_PRIVATE=0]="SECP256K1_PRIVATE"}(r||(r={}));const n={[`private_${r.NONE}_32`]:"ecdsa-secp256k1",[`private_${r.SECP256K1_PRIVATE}_33`]:"ecdsa-secp256k1",[`private_${r.ED25519}_33`]:"ed25519",[`public_${r.ED25519}_33`]:"ed25519",[`public_${r.SECP256K1_PUB_X}_33`]:"ecdsa-secp256k1",[`public_${r.SECP256K1_PUB_X_ODD_Y}_33`]:"ecdsa-secp256k1",[`public_${r.SECP256K1_PUB_XY}_65`]:"ecdsa-secp256k1"};function s(e){return e===r.NONE?"None":`0x${e.toString(16).padStart(2,"0")}`}function o(e,t){const{prefix:o,len:i}=function(e){return{prefix:e.length<2?r.NONE:parseInt(e.slice(0,2),16),len:e.length/2}}(e),c="private"===t&&32===i?r.NONE:o,a=n[`${t}_${c}_${i}`];if(!a)throw new Error(function({key:e,type:t,prefix:r,len:o}){const i=function(e){return Object.entries(n).filter(([t])=>t.startsWith(e)).map(([e,t])=>{const[,r,n]=e.split("_");return`${t.padEnd(17)} - Prefix: ${s(Number(r)).padEnd(6)} Length: ${n} bytes`}).join("\n")}(t);return`invalid_key:\n\nType: ${t}\nKey: ${e}\nPrefix: ${s(r)} \nLength: ${o} bytes\n\nAcceptable ${t} formats are:\n${i}\n`}({key:e,type:t,len:i,prefix:c}));return a}t.getAlgorithmFromKey=o,t.getAlgorithmFromPublicKey=function(e){return o(e,"public")},t.getAlgorithmFromPrivateKey=function(e){return o(e,"private")}}),he=T&&T.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const le=he(de),pe=he(ae);var ye=/*#__PURE__*/Object.defineProperty({default:{deriveKeypair(e,t){const r=(0,ue.derivePrivateKey)(e,t);return{privateKey:"00"+(0,N.bytesToHex)((0,E.numberToBytesBE)(r,32)),publicKey:(0,N.bytesToHex)(b.secp256k1.getPublicKey(r,!0))}},sign(e,t){le.default.ok(66===t.length&&t.startsWith("00")||64===t.length);const r=66===t.length?t.slice(2):t;return b.secp256k1.sign(pe.default.half(e),r,{lowS:!0,extraEntropy:void 0}).toDERHex(!0).toUpperCase()},verify(e,t,r){const n=b.secp256k1.Signature.fromDER(t);return b.secp256k1.verify(n,pe.default.half(e),r)}}},"__esModule",{value:!0}),be=T&&T.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const ge=be(de),Ae=be(ae);var me=/*#__PURE__*/Object.defineProperty({default:{deriveKeypair(e){const t=Ae.default.half(e);return{privateKey:"ED"+(0,N.bytesToHex)(t),publicKey:"ED"+(0,N.bytesToHex)(w.ed25519.getPublicKey(t))}},sign:(e,t)=>(ge.default.ok(e instanceof Uint8Array,"message must be array of octets"),ge.default.ok(66===t.length,"private key must be 33 bytes including prefix"),(0,N.bytesToHex)(w.ed25519.sign(e,t.slice(2)))),verify:(e,t,r)=>(ge.default.ok(66===r.length,"public key must be 33 bytes including prefix"),w.ed25519.verify(t,e,r.slice(2),{zip215:!1}))}},"__esModule",{value:!0}),_e=O(function(e,t){var r=T&&T.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.decodeSeed=t.deriveNodeAddress=t.deriveAddress=t.verify=t.sign=t.deriveKeypair=t.generateSeed=void 0,Object.defineProperty(t,"decodeSeed",{enumerable:!0,get:function(){return te.decodeSeed}});const n=r(ae),s=r(de),o=r(ye),i=r(me);function c(e){return{"ecdsa-secp256k1":o.default,ed25519:i.default}[e]}function a(e){return(0,te.encodeAccountID)(function(e){return(0,se.ripemd160)((0,J.sha256)(e))}(e))}t.generateSeed=function(e={}){s.default.ok(!e.entropy||e.entropy.length>=16,"entropy too short");const t=e.entropy?e.entropy.slice(0,16):(0,N.randomBytes)(16);return(0,te.encodeSeed)(t,"ed25519"===e.algorithm?"ed25519":"secp256k1")},t.deriveKeypair=function(e,t){var r;const s=(0,te.decodeSeed)(e),o=c("ed25519"===(null!==(r=null==t?void 0:t.algorithm)&&void 0!==r?r:s.type)?"ed25519":"ecdsa-secp256k1"),i=o.deriveKeypair(s.bytes,t),a=n.default.half("This test message should verify."),u=o.sign(a,i.privateKey);if(!o.verify(a,u,i.publicKey))throw new Error("derived keypair did not generate verifiable signature");return i},t.sign=function(e,t){return c((0,fe.getAlgorithmFromPrivateKey)(t)).sign((0,N.hexToBytes)(e),t)},t.verify=function(e,t,r){return c((0,fe.getAlgorithmFromPublicKey)(r)).verify((0,N.hexToBytes)(e),t,r)},t.deriveAddress=function(e){return a((0,N.hexToBytes)(e))},t.deriveNodeAddress=function(e){const t=(0,te.decodeNodePublic)(e);return a((0,ue.accountPublicFromPublicGenerator)(t))}});const xe=["wss://s1.ripple.com","wss://xrplcluster.com/","wss://s2.ripple.com/"];function Ee(e){for(let n=0;n<e.length;n++){var t,r;return null!=(t=null==(r=e[n])||null==(r=r.tx_json)?void 0:r.SigningPubKey)?t:"0x"}throw new Error("No valid pubkey found in the latest transactions")}const we={testnet:{grpcUrl:"https://grpc.testnet.concordium.com:20000",walletProxyUrl:"https://wallet-proxy.testnet.concordium.com"},mainnet:{grpcUrl:"https://grpc.mainnet.concordium.com:20000",walletProxyUrl:"https://wallet-proxy.mainnet.concordium.software"}},He={network:"testnet",timeout:5e4,retries:3,testMode:!0};function Ie(e){try{if("string"==typeof e)return e;if(e&&"object"==typeof e){const t=e=>{if("string"==typeof e)return e;if(e&&"object"==typeof e)for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const n=e[r];if("string"==typeof n)return n;if("object"==typeof n){const e=t(n);if(e)return e}}return null},r=t(e);if(r)return r}throw new Error("Unable to extract signature from object")}catch(e){const t=e instanceof Error?e.message:"Unknown error";throw new Error(`Invalid signature format: ${t}`)}}async function ve(e,t){let r=new Error("No attempts made");for(let o=0;o<=t;o++)try{return await e()}catch(e){var n,s;const i=e instanceof Error?e:new Error(String(e));if(r=i,null!=(n=i.message)&&n.includes("Invalid signature")||null!=(s=i.message)&&s.includes("Account not found"))throw i;if(o===t)break;const c=Math.min(1e3*Math.pow(2,o),5e3);await new Promise(e=>setTimeout(e,c))}throw r}async function Se(r,n){switch(r.type){case t.SelfDeclaration:return I({},r,{status:r.confirmed?e.VERIFIED:e.FAILED});case t.Screenshot:return I({},r,{status:r.url?e.FLAGGED:e.FAILED});case t.CIP8:return async function(t){const[r,,n]=t.address.split(/:/),s=t.chainSpecificData&&"cardanoCoseKey"in t.chainSpecificData?t.chainSpecificData.cardanoCoseKey:null;if("cardano"!==r||!s)return I({},t,{status:e.FAILED});try{return I({},t,{status:_(t.proof,s,t.attestation,n)?e.VERIFIED:e.FAILED})}catch(r){return I({},t,{status:e.FAILED})}}(r);case t.EIP191:return async function(t){const[r,,n]=t.address.split(/:/);if("eip155"!==r)return I({},t,{status:e.FAILED});const s=function(e,t,r){try{const n=u.getSignPayload(d.fromString(t)),s=f.fromHex(r),o=h.recoverPublicKey({payload:n,signature:s});return l.checksum(l.fromPublicKey(o)).toString()===l.checksum(e)}catch(e){return!1}}(n,t.attestation,t.proof);return I({},t,{status:s?e.VERIFIED:e.FAILED})}(r);case t.ED25519:return async function(t){const[r,,n]=t.address.split(/:/);if("solana"!==r)return I({},t,{status:e.FAILED});try{const r=c.decode(n),s=(new TextEncoder).encode(t.attestation),o=i.decode(t.proof);return I({},t,{status:m.sign.detached.verify(s,o,r)?e.VERIFIED:e.FAILED})}catch(r){return I({},t,{status:e.FAILED})}}(r);case t.SOL_SIWX:return async function(t){const[r]=t.address.split(/:/);if("solana"!==r)return I({},t,{status:e.FAILED});if(!t.chainSpecificData||!function(e){if(!e||"object"!=typeof e)return!1;const t=e;if(!t.account||"object"!=typeof t.account)return!1;const r=t.account;if("string"!=typeof r.address)return!1;if(!r.publicKey)return!1;if(!(r.publicKey instanceof Uint8Array)){const e=r.publicKey;if("object"!=typeof e)return!1;{const t=Object.keys(e).filter(e=>!isNaN(Number(e))).sort((e,t)=>Number(e)-Number(t));if(32!==t.length)return!1;{const n=t.map(t=>Number(e[t]));if(!n.every(e=>"number"==typeof e&&e>=0&&e<=255))return!1;r.publicKey=new Uint8Array(n)}}}if(!t.signedMessage)return!1;if(!(t.signedMessage instanceof Uint8Array)){const e=t.signedMessage;if("Buffer"!==e.type||!Array.isArray(e.data))return!1;t.signedMessage=new Uint8Array(e.data)}if(!t.signature)return!1;if(!(t.signature instanceof Uint8Array)){const e=t.signature;if("Buffer"!==e.type||!Array.isArray(e.data))return!1;t.signature=new Uint8Array(e.data)}if(!t.message||"object"!=typeof t.message)return!1;const n=t.message;if("object"==typeof n&&null!==n){const e=n;if(!e.address&&t.signedMessage instanceof Uint8Array)try{const r=(new TextDecoder).decode(t.signedMessage).split("\n");if(r.length>=2){const t=r[1].trim();t&&/^[a-zA-Z0-9]{32,44}$/.test(t)&&(e.address=t)}}catch(e){}}return!!function(e){return!(!e||"object"!=typeof e)&&"string"==typeof e.domain&&"string"==typeof e.address&&(void 0===e.statement||"string"==typeof e.statement)&&(void 0===e.uri||"string"==typeof e.uri)&&(void 0===e.version||"string"==typeof e.version)&&(void 0===e.chainId||"string"==typeof e.chainId)&&(void 0===e.nonce||"string"==typeof e.nonce)&&(void 0===e.issuedAt||"string"==typeof e.issuedAt)&&(void 0===e.expirationTime||"string"==typeof e.expirationTime)&&(void 0===e.notBefore||"string"==typeof e.notBefore)&&(void 0===e.requestId||"string"==typeof e.requestId)&&(void 0===e.resources||Array.isArray(e.resources))}(t.message)}(t.chainSpecificData))return I({},t,{status:e.FAILED});try{const r=t.chainSpecificData,n=(new TextDecoder).decode(r.signedMessage),s=function(e){try{const t=e.split("\n"),r=function(e){var t;const r=null==(t=e[0])?void 0:t.match(/^(.+) wants you to sign in with your Solana account:$/);if(!r)return null;const n=r[1],s=e[1];return s&&/^[a-zA-Z0-9]{32,44}$/.test(s)?{domain:n,address:s}:null}(t);if(!r)return null;const n=I({},r);let s=2;const o=function(e,t){let r=t;if(""===e[r]&&e[r+1]&&!e[r+1].includes(":")){r++;const t=e[r];return r++,""===e[r]&&r++,{statement:t,nextIndex:r}}return{nextIndex:r}}(t,s);void 0!==o.statement&&(n.statement=o.statement,s=o.nextIndex);const i=function(e,t){const r={},n=[{prefix:"URI: ",key:"uri"},{prefix:"Version: ",key:"version"},{prefix:"Chain ID: ",key:"chainId"},{prefix:"Nonce: ",key:"nonce"},{prefix:"Issued At: ",key:"issuedAt"},{prefix:"Expiration Time: ",key:"expirationTime"},{prefix:"Not Before: ",key:"notBefore"},{prefix:"Request ID: ",key:"requestId"}];let s=t;for(;s<e.length;){const t=e[s];if(t){if(t.startsWith("Resources:")){const t=k(e,s+1);if(t.length>0){r.resources=t,s+=t.length+1;continue}}for(const{prefix:e,key:s}of n)if(t.startsWith(e)){const n=t.substring(e.length);r[s]=n;break}s++}else s++}return r}(t,s);return Object.assign(n,i),n}catch(e){return null}}(n);return s&&function(e,t){if(e.domain!==t.domain||e.address!==t.address)return!1;const r=[{inputKey:"statement",parsedKey:"statement"},{inputKey:"uri",parsedKey:"uri"},{inputKey:"version",parsedKey:"version"},{inputKey:"chainId",parsedKey:"chainId"},{inputKey:"nonce",parsedKey:"nonce"},{inputKey:"issuedAt",parsedKey:"issuedAt"},{inputKey:"expirationTime",parsedKey:"expirationTime"},{inputKey:"notBefore",parsedKey:"notBefore"},{inputKey:"requestId",parsedKey:"requestId"},{inputKey:"resources",parsedKey:"resources",validator:(e,t)=>!(!Array.isArray(e)||!Array.isArray(t))&&e.length===t.length&&e.every((e,r)=>e===t[r])}];for(const{inputKey:n,parsedKey:s,validator:o}of r){const r=t[n],i=e[s];if(void 0!==r)if(o){if(!o(r,i))return!1}else if(r!==i)return!1}return function(e){const t=Date.now();if(e.issuedAt){const r=new Date(e.issuedAt),n=864e5;if(Math.abs(r.getTime()-t)>n)return!1}return!(e.expirationTime&&new Date(e.expirationTime).getTime()<=t||e.notBefore&&new Date(e.notBefore).getTime()>t)}(e)}(s,r.message)?function(e){let t=`${e.domain} wants you to sign in with your Solana account:\n`;t+=`${e.address}`,e.statement&&(t+=`\n\n${e.statement}`);const r=function(e){const t=[],r=[{key:"uri",prefix:"URI: "},{key:"version",prefix:"Version: "},{key:"chainId",prefix:"Chain ID: "},{key:"nonce",prefix:"Nonce: "},{key:"issuedAt",prefix:"Issued At: "},{key:"expirationTime",prefix:"Expiration Time: "},{key:"notBefore",prefix:"Not Before: "},{key:"requestId",prefix:"Request ID: "},{key:"resources",prefix:"Resources:",formatter:e=>Array.isArray(e)&&e.length>0?["Resources:",...e.map(e=>`- ${e}`)]:[]}];for(const{key:n,prefix:s,formatter:o}of r){const r=e[n];if(void 0!==r)if(o){const e=o(r);t.push(...e)}else"string"==typeof r&&t.push(`${s}${r}`)}return t}(e);return r.length&&(t+=`\n\n${r.join("\n")}`),t}(s)!==n?I({},t,{status:e.FAILED}):I({},t,{status:m.sign.detached.verify(r.signedMessage,r.signature,r.account.publicKey)?e.VERIFIED:e.FAILED}):I({},t,{status:e.FAILED})}catch(r){return I({},t,{status:e.FAILED})}}(r);case t.XRP_ED25519:return async function(t,r){const[n,,s]=t.address.split(/:/);if("xrpl"!==n)return I({},t,{status:e.FAILED});if(r||(r=await async function(e){const t=xe;for(const n of t)try{var r;const t=new x(n);await t.connect();const s=await t.request({command:"account_tx",account:e,binary:!1,limit:2,forward:!1});return await t.disconnect(),Ee(null==(r=s.result)?void 0:r.transactions)}catch(e){let t="Connection to XRPL server failed";e instanceof Error&&(t+=`: ${e.message}`),console.error(t)}}(s)),!r)return I({},t,{status:e.FAILED});const o=function(e,t,r){return _e.verify(Buffer.from(e).toString("hex"),r,t)}(t.attestation,r,t.proof);return I({},t,{status:o?e.VERIFIED:e.FAILED})}(r,n);case t.XLM_ED25519:return function(t){const[r,,n]=t.address.split(/:/);if("stellar"!==r)return I({},t,{status:e.FAILED});try{const r=H.fromPublicKey(n),s=Buffer.from(t.attestation,"utf-8"),o=Buffer.from(t.proof,"base64");return I({},t,{status:r.verify(s,o)?e.VERIFIED:e.FAILED})}catch(r){return console.error(r),I({},t,{status:e.FAILED})}}(r);case t.CONCORDIUM:return(async(t,r={})=>{const n=I({},He,r),[s,o,i]=t.address.split(/:/);if("ccd"!==s)return I({},t,{status:e.FAILED});let c=n.network;o&&(c=o.includes("testnet")?"testnet":"mainnet");try{let r;try{r=JSON.parse(t.proof)}catch(r){return I({},t,{status:e.FAILED})}if(!r||"object"!=typeof r||0===Object.keys(r).length)return I({},t,{status:e.FAILED});if(n.testMode)try{const n=Ie(r);return!n||n.length<64||!/^[0-9a-fA-F]+$/.test(n)?I({},t,{status:e.FAILED}):I({},t,{status:e.VERIFIED})}catch(r){return I({},t,{status:e.FAILED})}const s=await ve(()=>async function(e,t,r){const n=we[t];try{const t=new AbortController,s=setTimeout(()=>t.abort(),r),o=await fetch(`${n.walletProxyUrl}/v0/accEncryptionKey/${e}`,{method:"GET",headers:{Accept:"application/json","User-Agent":"verify-proof/1.6.0"},signal:t.signal});return clearTimeout(s),o.ok}catch(e){if(e instanceof Error&&"AbortError"===e.name)throw new Error(`Account validation timeout after ${r}ms`);throw e}}(i,c,n.timeout),n.retries);if(!s)return I({},t,{status:e.FAILED});const o=await ve(()=>async function(e,t){try{const t=Ie(e);return!(!t||t.length<64)&&t.length>=64&&/^[0-9a-fA-F]+$/.test(t)}catch(e){if(e instanceof Error){var r,n,s;if(null!=(r=e.message)&&r.includes("timeout"))throw new Error(`Signature verification timeout after ${t}ms`);if(null!=(n=e.message)&&n.includes("UNAVAILABLE"))throw new Error("Concordium node unavailable");if(null!=(s=e.message)&&s.includes("NOT_FOUND"))return!1}throw e}}(r,n.timeout),n.retries);return I({},t,o?{status:e.VERIFIED}:{status:e.FAILED})}catch(r){return I({},t,{status:e.FAILED})}})(r);case t.EIP712:case t.BIP137:case t.BIP322:return async function(r){const[n,,s]=r.address.split(/:/);if("bip122"!==n)return I({},r,{status:e.FAILED});const o=function(e){return e.startsWith("1")||e.startsWith("3")||e.startsWith("bc1")?S.bitcoin:e.startsWith("t1")||e.startsWith("t3")?S.zcash:e.startsWith("L")||e.startsWith("M")||e.startsWith("ltc1")?S.litecoin:e.startsWith("D")||e.startsWith("A")?S.dogecoin:e.startsWith("X")||e.startsWith("7")?S.dash:e.startsWith("q")?S.bitcoincash:e.startsWith("tb1")?S.testnet:S.bitcoin}(s);if(!o)return I({},r,{status:e.FAILED});if(s.startsWith("t1")||s.startsWith("t3"))return L(s,r,o);if(o.isTestnet)return P(s,r);try{switch(r.type){case t.BIP137:return L(s,r,o);case t.BIP322:return P(s,r);default:return I({},r,{status:e.FAILED})}}catch(t){return console.error("error verifying proof",t),I({},r,{status:e.FAILED})}}(r);case t.TIP191:return async function(t){const[r,,n]=t.address.split(/:/);return I({},t,"tron"!==r?{status:e.FAILED}:{status:F(n,t.attestation,t.proof)?e.VERIFIED:e.FAILED})}(r)}return r}export{Se as verifyProof};
2
2
  //# sourceMappingURL=index.modern.js.map