coinley-checkout
Version:
A React SDK for Coinley cryptocurrency payment processing with multi-network support
3 lines • 3.09 MB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).CoinleyCheckout={},e.React)}(this,(function(e,t){"use strict";function n(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const n in e)if("default"!==n){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}return t.default=e,Object.freeze(t)}const r=n(t),i="2.33.2";let s=({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,o=`viem@${i}`,a=class e extends Error{constructor(t,n={}){const r=n.cause instanceof e?n.cause.details:n.cause?.message?n.cause.message:n.details,a=n.cause instanceof e&&n.cause.docsPath||n.docsPath,c=s?.({...n,docsPath:a});super([t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...c?[`Docs: ${c}`]:[],...r?[`Details: ${r}`]:[],...o?[`Version: ${o}`]:[]].join("\n"),n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=a,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=i}walk(e){return c(this,e)}};function c(e,t){return t?.(e)?e:e&&"object"==typeof e&&"cause"in e&&void 0!==e.cause?c(e.cause,t):t?null:e}let l=class extends a{constructor({max:e,min:t,signed:n,size:r,value:i}){super(`Number "${i}" is not in safe ${r?`${8*r}-bit ${n?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:"IntegerOutOfRangeError"})}};class u extends a{constructor(e){super(`Bytes value "${e}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}class d extends a{constructor(e){super(`Hex value "${e}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let h=class extends a{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}},p=class extends a{constructor({offset:e,position:t,size:n}){super(`Slice ${"start"===t?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}},f=class extends a{constructor({size:e,targetSize:t,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:"SizeExceedsPaddingSizeError"})}};class g extends a{constructor({size:e,targetSize:t,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${t} ${n} long, but is ${e} ${n} long.`,{name:"InvalidBytesLengthError"})}}function m(e,{dir:t,size:n=32}={}){return"string"==typeof e?y(e,{dir:t,size:n}):function(e,{dir:t,size:n=32}={}){if(null===n)return e;if(e.length>n)throw new f({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let i=0;i<n;i++){const s="right"===t;r[s?i:n-i-1]=e[s?i:e.length-i-1]}return r}(e,{dir:t,size:n})}function y(e,{dir:t,size:n=32}={}){if(null===n)return e;const r=e.replace("0x","");if(r.length>2*n)throw new f({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r["right"===t?"padEnd":"padStart"](2*n,"0")}`}function w(e,{strict:t=!0}={}){return!!e&&("string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")))}function b(e){return w(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function v(e,{dir:t="left"}={}){let n="string"==typeof e?e.replace("0x",""):e,r=0;for(let i=0;i<n.length-1&&"0"===n["left"===t?i:n.length-i-1].toString();i++)r++;return n="left"===t?n.slice(r):n.slice(0,n.length-r),"string"==typeof e?(1===n.length&&"right"===t&&(n=`${n}0`),`0x${n.length%2==1?`0${n}`:n}`):n}const E=new TextEncoder;function C(e,t={}){return"number"==typeof e||"bigint"==typeof e?function(e,t){const n=L(e,t);return S(n)}(e,t):"boolean"==typeof e?function(e,t={}){const n=new Uint8Array(1);if(n[0]=Number(e),"number"==typeof t.size)return I(n,{size:t.size}),m(n,{size:t.size});return n}(e,t):w(e)?S(e,t):k(e,t)}const _={zero:48,nine:57,A:65,F:70,a:97,f:102};function x(e){return e>=_.zero&&e<=_.nine?e-_.zero:e>=_.A&&e<=_.F?e-(_.A-10):e>=_.a&&e<=_.f?e-(_.a-10):void 0}function S(e,t={}){let n=e;t.size&&(I(n,{size:t.size}),n=m(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const i=r.length/2,s=new Uint8Array(i);for(let o=0,c=0;o<i;o++){const e=x(r.charCodeAt(c++)),t=x(r.charCodeAt(c++));if(void 0===e||void 0===t)throw new a(`Invalid byte sequence ("${r[c-2]}${r[c-1]}" in "${r}").`);s[o]=16*e+t}return s}function k(e,t={}){const n=E.encode(e);return"number"==typeof t.size?(I(n,{size:t.size}),m(n,{dir:"right",size:t.size})):n}function I(e,{size:t}){if(b(e)>t)throw new h({givenSize:b(e),maxSize:t})}function A(e,t={}){const{signed:n}=t;t.size&&I(e,{size:t.size});const r=BigInt(e);if(!n)return r;const i=(e.length-2)/2;return r<=(1n<<8n*BigInt(i)-1n)-1n?r:r-BigInt(`0x${"f".padStart(2*i,"f")}`)-1n}function P(e,t={}){return Number(A(e,t))}function O(e,t={}){let n=S(e);return t.size&&(I(n,{size:t.size}),n=v(n,{dir:"right"})),(new TextDecoder).decode(n)}const T=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function N(e,t={}){return"number"==typeof e||"bigint"==typeof e?L(e,t):"string"==typeof e?B(e,t):"boolean"==typeof e?R(e,t):M(e,t)}function R(e,t={}){const n=`0x${Number(e)}`;return"number"==typeof t.size?(I(n,{size:t.size}),m(n,{size:t.size})):n}function M(e,t={}){let n="";for(let i=0;i<e.length;i++)n+=T[e[i]];const r=`0x${n}`;return"number"==typeof t.size?(I(r,{size:t.size}),m(r,{dir:"right",size:t.size})):r}function L(e,t={}){const{signed:n,size:r}=t,i=BigInt(e);let s;r?s=n?(1n<<8n*BigInt(r)-1n)-1n:2n**(8n*BigInt(r))-1n:"number"==typeof e&&(s=BigInt(Number.MAX_SAFE_INTEGER));const o="bigint"==typeof s&&n?-s-1n:0;if(s&&i>s||i<o){const t="bigint"==typeof e?"n":"";throw new l({max:s?`${s}${t}`:void 0,min:`${o}${t}`,signed:n,size:r,value:`${e}${t}`})}const a=`0x${(n&&i<0?(1n<<BigInt(8*r))+BigInt(i):i).toString(16)}`;return r?m(a,{size:r}):a}const j=new TextEncoder;function B(e,t={}){return M(j.encode(e),t)}function D(e,{includeName:t=!1}={}){if("function"!==e.type&&"event"!==e.type&&"error"!==e.type)throw new le(e.type);return`${e.name}(${$(e.inputs,{includeName:t})})`}function $(e,{includeName:t=!1}={}){return e?e.map((e=>function(e,{includeName:t}){if(e.type.startsWith("tuple"))return`(${$(e.components,{includeName:t})})${e.type.slice(5)}`;return e.type+(t&&e.name?` ${e.name}`:"")}(e,{includeName:t}))).join(t?", ":","):""}class U extends a{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join("\n"),{docsPath:e,name:"AbiConstructorNotFoundError"})}}class F extends a{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join("\n"),{docsPath:e,name:"AbiConstructorParamsNotFoundError"})}}class z extends a{constructor({data:e,params:t,size:n}){super([`Data size of ${n} bytes is too small for given parameters.`].join("\n"),{metaMessages:[`Params: (${$(t,{includeName:!0})})`,`Data: ${e} (${n} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=t,this.size=n}}class q extends a{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class H extends a{constructor({expectedLength:e,givenLength:t,type:n}){super([`ABI encoding array length mismatch for type ${n}.`,`Expected length: ${e}`,`Given length: ${t}`].join("\n"),{name:"AbiEncodingArrayLengthMismatchError"})}}class W extends a{constructor({expectedSize:e,value:t}){super(`Size of bytes "${t}" (bytes${b(t)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class K extends a{constructor({expectedLength:e,givenLength:t}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${t}`].join("\n"),{name:"AbiEncodingLengthMismatchError"})}}class V extends a{constructor(e,{docsPath:t}){super([`Arguments (\`args\`) were provided to "${e}", but "${e}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join("\n"),{docsPath:t,name:"AbiErrorInputsNotFoundError"})}}class G extends a{constructor(e,{docsPath:t}={}){super([`Error ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it."].join("\n"),{docsPath:t,name:"AbiErrorNotFoundError"})}}class Z extends a{constructor(e,{docsPath:t}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join("\n"),{docsPath:t,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class Y extends a{constructor({docsPath:e}){super("Cannot extract event signature from empty topics.",{docsPath:e,name:"AbiEventSignatureEmptyTopicsError"})}}class J extends a{constructor(e,{docsPath:t}){super([`Encoded event signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${e}.`].join("\n"),{docsPath:t,name:"AbiEventSignatureNotFoundError"})}}class Q extends a{constructor(e,{docsPath:t}={}){super([`Event ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join("\n"),{docsPath:t,name:"AbiEventNotFoundError"})}}class X extends a{constructor(e,{docsPath:t}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join("\n"),{docsPath:t,name:"AbiFunctionNotFoundError"})}}class ee extends a{constructor(e,{docsPath:t}){super([`Function "${e}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join("\n"),{docsPath:t,name:"AbiFunctionOutputsNotFoundError"})}}class te extends a{constructor(e,{docsPath:t}){super([`Encoded function signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${e}.`].join("\n"),{docsPath:t,name:"AbiFunctionSignatureNotFoundError"})}}class ne extends a{constructor(e,t){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${D(e.abiItem)}\`, and`,`\`${t.type}\` in \`${D(t.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let re=class extends a{constructor({expectedSize:e,givenSize:t}){super(`Expected bytes${e}, got bytes${t}.`,{name:"BytesSizeMismatchError"})}};class ie extends a{constructor({abiItem:e,data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for non-indexed event parameters.`].join("\n"),{metaMessages:[`Params: (${$(n,{includeName:!0})})`,`Data: ${t} (${r} bytes)`],name:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e,this.data=t,this.params=n,this.size=r}}class se extends a{constructor({abiItem:e,param:t}){super([`Expected a topic for indexed event parameter${t.name?` "${t.name}"`:""} on event "${D(e,{includeName:!0})}".`].join("\n"),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e}}class oe extends a{constructor(e,{docsPath:t}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join("\n"),{docsPath:t,name:"InvalidAbiEncodingType"})}}class ae extends a{constructor(e,{docsPath:t}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join("\n"),{docsPath:t,name:"InvalidAbiDecodingType"})}}let ce=class extends a{constructor(e){super([`Value "${e}" is not a valid array.`].join("\n"),{name:"InvalidArrayError"})}};class le extends a{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join("\n"),{name:"InvalidDefinitionTypeError"})}}class ue extends a{constructor(e){super(`Type "${e}" is not supported for packed encoding.`,{name:"UnsupportedPackedAbiType"})}}function de(e){return"string"==typeof e[0]?he(e):function(e){let t=0;for(const i of e)t+=i.length;const n=new Uint8Array(t);let r=0;for(const i of e)n.set(i,r),r+=i.length;return n}(e)}function he(e){return`0x${e.reduce(((e,t)=>e+t.replace("0x","")),"")}`}let pe=class extends a{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}},fe=class extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const t=super.get(e);return super.has(e)&&void 0!==t&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){const e=this.keys().next().value;e&&this.delete(e)}return this}};const ge=BigInt(2**32-1),me=BigInt(32);function ye(e,t=!1){return t?{h:Number(e&ge),l:Number(e>>me&ge)}:{h:0|Number(e>>me&ge),l:0|Number(e&ge)}}const we="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
function be(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function ve(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Ee(e,...t){if(!be(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 Ce(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function _e(e,t){Ee(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function xe(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Se(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ke(e,t){return e<<32-t|e>>>t}const Ie=(()=>68===new Uint8Array(new Uint32Array([287454020]).buffer)[0])()?e=>e:function(e){for(let n=0;n<e.length;n++)e[n]=(t=e[n])<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;var t;return e},Ae=(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),Pe=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function Oe(e){if(Ee(e),Ae)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Pe[e[n]];return t}const Te=48,Ne=57,Re=65,Me=70,Le=97,je=102;function Be(e){return e>=Te&&e<=Ne?e-Te:e>=Re&&e<=Me?e-(Re-10):e>=Le&&e<=je?e-(Le-10):void 0}function De(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);if(Ae)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let i=0,s=0;i<n;i++,s+=2){const t=Be(e.charCodeAt(s)),n=Be(e.charCodeAt(s+1));if(void 0===t||void 0===n){const t=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+s)}r[i]=16*t+n}return r}function $e(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))}(e)),Ee(e),e}function Ue(...e){let t=0;for(let r=0;r<e.length;r++){const n=e[r];Ee(n),t+=n.length}const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const t=e[r];n.set(t,i),i+=t.length}return n}let Fe=class{};function ze(e){const t=t=>e().update($e(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function qe(e=32){if(we&&"function"==typeof we.getRandomValues)return we.getRandomValues(new Uint8Array(e));if(we&&"function"==typeof we.randomBytes)return Uint8Array.from(we.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const He=BigInt(0),We=BigInt(1),Ke=BigInt(2),Ve=BigInt(7),Ge=BigInt(256),Ze=BigInt(113),Ye=[],Je=[],Qe=[];for(let M2e=0,L2e=We,j2e=1,B2e=0;M2e<24;M2e++){[j2e,B2e]=[B2e,(2*j2e+3*B2e)%5],Ye.push(2*(5*B2e+j2e)),Je.push((M2e+1)*(M2e+2)/2%64);let e=He;for(let t=0;t<7;t++)L2e=(L2e<<We^(L2e>>Ve)*Ze)%Ge,L2e&Ke&&(e^=We<<(We<<BigInt(t))-We);Qe.push(e)}const Xe=function(e,t=!1){const n=e.length;let r=new Uint32Array(n),i=new Uint32Array(n);for(let s=0;s<n;s++){const{h:n,l:o}=ye(e[s],t);[r[s],i[s]]=[n,o]}return[r,i]}(Qe,!0),et=Xe[0],tt=Xe[1],nt=(e,t,n)=>n>32?((e,t,n)=>t<<n-32|e>>>64-n)(e,t,n):((e,t,n)=>e<<n|t>>>32-n)(e,t,n),rt=(e,t,n)=>n>32?((e,t,n)=>e<<n-32|t>>>64-n)(e,t,n):((e,t,n)=>t<<n|e>>>32-n)(e,t,n);let it=class e extends Fe{constructor(e,t,n,r=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=i,ve(n),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");var s;this.state=new Uint8Array(200),this.state32=(s=this.state,new Uint32Array(s.buffer,s.byteOffset,Math.floor(s.byteLength/4)))}clone(){return this._cloneInto()}keccak(){Ie(this.state32),function(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let r=0;r<10;r++)n[r]=e[r]^e[r+10]^e[r+20]^e[r+30]^e[r+40];for(let r=0;r<10;r+=2){const t=(r+8)%10,i=(r+2)%10,s=n[i],o=n[i+1],a=nt(s,o,1)^n[t],c=rt(s,o,1)^n[t+1];for(let n=0;n<50;n+=10)e[r+n]^=a,e[r+n+1]^=c}let t=e[2],i=e[3];for(let n=0;n<24;n++){const r=Je[n],s=nt(t,i,r),o=rt(t,i,r),a=Ye[n];t=e[a],i=e[a+1],e[a]=s,e[a+1]=o}for(let r=0;r<50;r+=10){for(let t=0;t<10;t++)n[t]=e[r+t];for(let t=0;t<10;t++)e[r+t]^=~n[(t+2)%10]&n[(t+4)%10]}e[0]^=et[r],e[1]^=tt[r]}xe(n)}(this.state32,this.rounds),Ie(this.state32),this.posOut=0,this.pos=0}update(e){Ce(this),Ee(e=$e(e));const{blockLen:t,state:n}=this,r=e.length;for(let i=0;i<r;){const s=Math.min(t-this.pos,r-i);for(let t=0;t<s;t++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,128&t&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){Ce(this,!1),Ee(e),this.finish();const t=this.state,{blockLen:n}=this;for(let r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();const s=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+s),r),this.posOut+=s,r+=s}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return ve(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(_e(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,xe(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new e(n,r,i,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}};const st=(()=>{return e=1,t=136,n=32,ze((()=>new it(t,e,n)));var e,t,n})();function ot(e,t){const n=t||"hex",r=st(w(e,{strict:!1})?C(e):e);return"bytes"===n?r:N(r)}const at=new fe(8192);function ct(e,t){if(at.has(`${e}.${t}`))return at.get(`${e}.${t}`);const n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=ot(k(n),"bytes"),i=(t?n.substring(`${t}0x`.length):n).split("");for(let o=0;o<40;o+=2)r[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(15&r[o>>1])>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return at.set(`${e}.${t}`,s),s}function lt(e,t){if(!ht(e,{strict:!1}))throw new pe({address:e});return ct(e,t)}const ut=/^0x[a-fA-F0-9]{40}$/,dt=new fe(8192);function ht(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(dt.has(r))return dt.get(r);const i=!(!ut.test(e)||e.toLowerCase()!==e&&n&&ct(e)!==e);return dt.set(r,i),i}function pt(e,t,n,{strict:r}={}){return w(e,{strict:!1})?yt(e,t,n,{strict:r}):mt(e,t,n,{strict:r})}function ft(e,t){if("number"==typeof t&&t>0&&t>b(e)-1)throw new p({offset:t,position:"start",size:b(e)})}function gt(e,t,n){if("number"==typeof t&&"number"==typeof n&&b(e)!==n-t)throw new p({offset:n,position:"end",size:b(e)})}function mt(e,t,n,{strict:r}={}){ft(e,t);const i=e.slice(t,n);return r&>(i,t,n),i}function yt(e,t,n,{strict:r}={}){ft(e,t);const i=`0x${e.replace("0x","").slice(2*(t??0),2*(n??e.length))}`;return r&>(i,t,n),i}const wt=/^(.*)\[([0-9]*)\]$/,bt=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,vt=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function Et(e,t){if(e.length!==t.length)throw new K({expectedLength:e.length,givenLength:t.length});const n=function({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(Ct({param:e[r],value:t[r]}));return n}({params:e,values:t}),r=_t(n);return 0===r.length?"0x":r}function Ct({param:e,value:t}){const n=xt(e.type);if(n){const[r,i]=n;return function(e,{length:t,param:n}){const r=null===t;if(!Array.isArray(e))throw new ce(e);if(!r&&e.length!==t)throw new H({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let i=!1;const s=[];for(let o=0;o<e.length;o++){const t=Ct({param:n,value:e[o]});t.dynamic&&(i=!0),s.push(t)}if(r||i){const e=_t(s);if(r){const t=L(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?de([t,e]):t}}if(i)return{dynamic:!0,encoded:e}}return{dynamic:!1,encoded:de(s.map((({encoded:e})=>e)))}}(t,{length:r,param:{...e,type:i}})}if("tuple"===e.type)return function(e,{param:t}){let n=!1;const r=[];for(let i=0;i<t.components.length;i++){const s=t.components[i],o=Ct({param:s,value:e[Array.isArray(e)?i:s.name]});r.push(o),o.dynamic&&(n=!0)}return{dynamic:n,encoded:n?_t(r):de(r.map((({encoded:e})=>e)))}}(t,{param:e});if("address"===e.type)return function(e){if(!ht(e))throw new pe({address:e});return{dynamic:!1,encoded:y(e.toLowerCase())}}(t);if("bool"===e.type)return function(e){if("boolean"!=typeof e)throw new a(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:y(R(e))}}(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const n=e.type.startsWith("int"),[,,r="256"]=vt.exec(e.type)??[];return function(e,{signed:t,size:n=256}){if("number"==typeof n){const r=2n**(BigInt(n)-(t?1n:0n))-1n,i=t?-r-1n:0n;if(e>r||e<i)throw new l({max:r.toString(),min:i.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:L(e,{size:32,signed:t})}}(t,{signed:n,size:Number(r)})}if(e.type.startsWith("bytes"))return function(e,{param:t}){const[,n]=t.type.split("bytes"),r=b(e);if(!n){let t=e;return r%32!=0&&(t=y(t,{dir:"right",size:32*Math.ceil((e.length-2)/2/32)})),{dynamic:!0,encoded:de([y(L(r,{size:32})),t])}}if(r!==Number.parseInt(n))throw new W({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:y(e,{dir:"right"})}}(t,{param:e});if("string"===e.type)return function(e){const t=B(e),n=Math.ceil(b(t)/32),r=[];for(let i=0;i<n;i++)r.push(y(pt(t,32*i,32*(i+1)),{dir:"right"}));return{dynamic:!0,encoded:de([y(L(b(t),{size:32})),...r])}}(t);throw new oe(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function _t(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:n,encoded:r}=e[s];t+=n?32:b(r)}const n=[],r=[];let i=0;for(let s=0;s<e.length;s++){const{dynamic:o,encoded:a}=e[s];o?(n.push(L(t+i,{size:32})),r.push(a),i+=b(a)):n.push(a)}return de([...n,...r])}function xt(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const St="/docs/contract/encodeDeployData";function kt(e){const{abi:t,args:n,bytecode:r}=e;if(!n||0===n.length)return r;const i=t.find((e=>"type"in e&&"constructor"===e.type));if(!i)throw new U({docsPath:St});if(!("inputs"in i))throw new F({docsPath:St});if(!i.inputs||0===i.inputs.length)throw new F({docsPath:St});return he([r,Et(i.inputs,n)])}function It(e){return"string"==typeof e?{address:e,type:"json-rpc"}:e}class At extends a{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join("\n"),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class Pt extends a{constructor({docsPath:e,metaMessages:t,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:e,metaMessages:t,name:"AccountTypeNotSupportedError"})}}function Ot(e){if(0===e||1===e)return e;if(27===e)return 0;if(28===e)return 1;throw new Error("Invalid yParityOrV value")}async function Tt({hash:e,signature:t}){return n=await async function({hash:e,signature:t}){const n=w(e)?e:N(e),{secp256k1:r}=await Promise.resolve().then((()=>Fd));return`0x${(()=>{if("object"==typeof t&&"r"in t&&"s"in t){const{r:e,s:n,v:i,yParity:s}=t,o=Ot(Number(s??i));return new r.Signature(A(e),A(n)).addRecoveryBit(o)}const e=w(t)?t:N(t);if(65!==b(e))throw new Error("invalid signature length");const n=Ot(P(`0x${e.slice(130)}`));return r.Signature.fromCompact(e.substring(2,130)).addRecoveryBit(n)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}({hash:e,signature:t}),ct(`0x${ot(`0x${n.substring(4)}`).substring(26)}`);var n}class Nt extends a{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class Rt extends a{constructor({length:e,position:t}){super(`Position \`${t}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class Mt extends a{constructor({count:e,limit:t}){super(`Recursive read limit of \`${t}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const Lt={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new Mt({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Rt({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Nt({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new Nt({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,255&e),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function jt(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(Lt);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function Bt(e,t="hex"){const n=Dt(e),r=jt(new Uint8Array(n.length));return n.encode(r),"hex"===t?M(r.bytes):r.bytes}function Dt(e){return Array.isArray(e)?function(e){const t=e.reduce(((e,t)=>e+t.length),0),n=$t(t);return{length:t<=55?1+t:1+n+t,encode(r){t<=55?r.pushByte(192+t):(r.pushByte(247+n),1===n?r.pushUint8(t):2===n?r.pushUint16(t):3===n?r.pushUint24(t):r.pushUint32(t));for(const{encode:t}of e)t(r)}}}(e.map((e=>Dt(e)))):function(e){const t="string"==typeof e?S(e):e,n=$t(t.length),r=1===t.length&&t[0]<128?1:t.length<=55?1+t.length:1+n+t.length;return{length:r,encode(e){1===t.length&&t[0]<128?e.pushBytes(t):t.length<=55?(e.pushByte(128+t.length),e.pushBytes(t)):(e.pushByte(183+n),1===n?e.pushUint8(t.length):2===n?e.pushUint16(t.length):3===n?e.pushUint24(t.length):e.pushUint32(t.length),e.pushBytes(t))}}}(e)}function $t(e){if(e<256)return 1;if(e<65536)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new a("Length is too large.")}function Ut(e){const{chainId:t,nonce:n,to:r}=e,i=e.contractAddress??e.address,s=ot(he(["0x05",Bt([t?L(t):"0x",i,n?L(n):"0x"])]));return"bytes"===r?S(s):s}async function Ft(e){const{authorization:t,signature:n}=e;return Tt({hash:Ut(t),signature:n??t})}class zt extends a{constructor({blockNumber:e,chain:t,contract:n}){super(`Chain "${t.name}" does not support contract "${n.name}".`,{metaMessages:["This could be due to any of the following:",...e&&n.blockCreated&&n.blockCreated>e?[`- The contract "${n.name}" was not deployed until block ${n.blockCreated} (current block ${e}).`]:[`- The chain does not have the contract "${n.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class qt extends a{constructor({chain:e,currentChainId:t}){super(`The current chain of the wallet (id: ${t}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${t}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class Ht extends a{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join("\n"),{name:"ChainNotFoundError"})}}class Wt extends a{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}class Kt extends a{constructor({chainId:e}){super("number"==typeof e?`Chain ID "${e}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}const Vt={gwei:9,wei:18},Gt={ether:-9,wei:9},Zt={ether:-18,gwei:-9};function Yt(e,t){let n=e.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[i,s]=[n.slice(0,n.length-t),n.slice(n.length-t)];return s=s.replace(/(0+)$/,""),`${r?"-":""}${i||"0"}${s?`.${s}`:""}`}function Jt(e,t="wei"){return Yt(e,Gt[t])}let Qt=class extends a{constructor({cause:e,message:t}={}){const n=t?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}};Object.defineProperty(Qt,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Qt,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Xt extends a{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${Jt(t)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(Xt,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class en extends a{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${Jt(t)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(en,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class tn extends a{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(tn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class nn extends a{constructor({cause:e,nonce:t}={}){super([`Nonce provided for the transaction ${t?`(${t}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join("\n"),{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(nn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class rn extends a{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(rn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class sn extends a{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join("\n"),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(sn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class on extends a{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(on,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class an extends a{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(an,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class cn extends a{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(cn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class ln extends a{constructor({cause:e,maxPriorityFeePerGas:t,maxFeePerGas:n}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${t?` = ${Jt(t)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n?` = ${Jt(n)} gwei`:""}).`].join("\n"),{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(ln,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class un extends a{constructor({cause:e}){super(`An error occurred while executing: ${e?.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}function dn(e,t="wei"){return Yt(e,Vt[t])}function hn(e){const t=Object.entries(e).map((([e,t])=>void 0===t||!1===t?null:[e,t])).filter(Boolean),n=t.reduce(((e,[t])=>Math.max(e,t.length)),0);return t.map((([e,t])=>` ${`${e}:`.padEnd(n+1)} ${t}`)).join("\n")}class pn extends a{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join("\n"),{name:"FeeConflictError"})}}class fn extends a{constructor({v:e}){super(`Invalid \`v\` value "${e}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}}class gn extends a{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",hn(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class mn extends a{constructor({storageKey:e}){super(`Size for storage key "${e}" is invalid. Expected 32 bytes. Got ${Math.floor((e.length-2)/2)} bytes.`,{name:"InvalidStorageKeySizeError"})}}class yn extends a{constructor(e,{account:t,docsPath:n,chain:r,data:i,gas:s,gasPrice:o,maxFeePerGas:a,maxPriorityFeePerGas:c,nonce:l,to:u,value:d}){const h=hn({chain:r&&`${r?.name} (id: ${r?.id})`,from:t?.address,to:u,value:void 0!==d&&`${dn(d)} ${r?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:s,gasPrice:void 0!==o&&`${Jt(o)} gwei`,maxFeePerGas:void 0!==a&&`${Jt(a)} gwei`,maxPriorityFeePerGas:void 0!==c&&`${Jt(c)} gwei`,nonce:l});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",h].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class wn extends a{constructor({blockHash:e,blockNumber:t,blockTag:n,hash:r,index:i}){let s="Transaction";n&&void 0!==i&&(s=`Transaction at block time "${n}" at index "${i}"`),e&&void 0!==i&&(s=`Transaction at block hash "${e}" at index "${i}"`),t&&void 0!==i&&(s=`Transaction at block number "${t}" at index "${i}"`),r&&(s=`Transaction with hash "${r}"`),super(`${s} could not be found.`,{name:"TransactionNotFoundError"})}}class bn extends a{constructor({hash:e}){super(`Transaction receipt with hash "${e}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}class vn extends a{constructor({hash:e}){super(`Timed out while waiting for transaction with hash "${e}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const En=(e,t,n)=>JSON.stringify(e,((e,n)=>{const r="bigint"==typeof n?n.toString():n;return"function"==typeof t?t(e,r):r}),n);class Cn extends a{constructor({body:e,cause:t,details:n,headers:r,status:i,url:s}){super("HTTP request failed.",{cause:t,details:n,metaMessages:[i&&`Status: ${i}`,`URL: ${s}`,e&&`Request body: ${En(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=r,this.status=i,this.url=s}}class _n extends a{constructor({body:e,error:t,url:n}){super("RPC Request failed.",{cause:t,details:t.message,metaMessages:[`URL: ${n}`,`Request body: ${En(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=t.code,this.data=t.data}}class xn extends a{constructor({body:e,url:t}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${t}`,`Request body: ${En(e)}`],name:"TimeoutError"})}}class Sn extends a{constructor(e,{code:t,docsPath:n,metaMessages:r,name:i,shortMessage:s}){super(s,{cause:e,docsPath:n,metaMessages:r||e?.metaMessages,name:i||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=i||e.name,this.code=e instanceof _n?e.code:t??-1}}class kn extends Sn{constructor(e,t){super(e,t),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t.data}}class In extends Sn{constructor(e){super(e,{code:In.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(In,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class An extends Sn{constructor(e){super(e,{code:An.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(An,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class Pn extends Sn{constructor(e,{method:t}={}){super(e,{code:Pn.code,name:"MethodNotFoundRpcError",shortMessage:`The method${t?` "${t}"`:""} does not exist / is not available.`})}}Object.defineProperty(Pn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class On extends Sn{constructor(e){super(e,{code:On.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join("\n")})}}Object.defineProperty(On,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Tn extends Sn{constructor(e){super(e,{code:Tn.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Tn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Nn extends Sn{constructor(e){super(e,{code:Nn.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join("\n")})}}Object.defineProperty(Nn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Rn extends Sn{constructor(e){super(e,{code:Rn.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Rn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Mn extends Sn{constructor(e){super(e,{code:Mn.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Mn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Ln extends Sn{constructor(e){super(e,{code:Ln.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Ln,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class jn extends Sn{constructor(e,{method:t}={}){super(e,{code:jn.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${t?` "${t}"`:""} is not supported.`})}}Object.defineProperty(jn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Bn extends Sn{constructor(e){super(e,{code:Bn.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Bn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Dn extends Sn{constructor(e){super(e,{code:Dn.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Dn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class $n extends kn{constructor(e){super(e,{code:$n.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty($n,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Un extends kn{constructor(e){super(e,{code:Un.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Un,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Fn extends kn{constructor(e,{method:t}={}){super(e,{code:Fn.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${t?` " ${t}"`:""}.`})}}Object.defineProperty(Fn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class zn extends kn{constructor(e){super(e,{code:zn.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(zn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class qn extends kn{constructor(e){super(e,{code:qn.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(qn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Hn extends kn{constructor(e){super(e,{code:Hn.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(Hn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class Wn extends kn{constructor(e){super(e,{code:Wn.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(Wn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class Kn extends kn{constructor(e){super(e,{code:Kn.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(Kn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class Vn extends kn{constructor(e){super(e,{code:Vn.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(Vn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class Gn extends kn{constructor(e){super(e,{code:Gn.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(Gn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class Zn extends kn{constructor(e){super(e,{code:Zn.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(Zn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class Yn extends kn{constructor(e){super(e,{code:Yn.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(Yn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class Jn extends kn{constructor(e){super(e,{code:Jn.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(Jn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class Qn extends Sn{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}function Xn(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof a?e.walk((e=>e?.code===Qt.code)):e;return r instanceof a?new Qt({cause:e,message:r.details}):Qt.nodeMessage.test(n)?new Qt({cause:e,message:e.details}):Xt.nodeMessage.test(n)?new Xt({cause:e,maxFeePerGas:t?.maxFeePerGas}):en.nodeMessage.test(n)?new en({cause:e,maxFeePerGas:t?.maxFeePer