@silencelaboratories/walletprovider-sdk 0.0.1 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/EOAauthentication.d.ts +23 -0
- package/dist/EOAauthentication.d.ts.map +1 -0
- package/dist/authentication.d.ts +20 -9
- package/dist/authentication.d.ts.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -11
- package/dist/networkSigner.d.ts +15 -12
- package/dist/networkSigner.d.ts.map +1 -1
- package/dist/viemSigner.d.ts.map +1 -1
- package/dist/walletProviderServiceClient.d.ts +15 -11
- package/dist/walletProviderServiceClient.d.ts.map +1 -1
- package/dist/walletProviderServiceClientInterface.d.ts +20 -0
- package/dist/walletProviderServiceClientInterface.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/sdkEOAauthentication.d.ts +0 -5
- package/dist/sdkEOAauthentication.d.ts.map +0 -1
- package/dist/walletEIP6963.d.ts +0 -40
- package/dist/walletEIP6963.d.ts.map +0 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { KeygenSetupOpts, type SignSetupOpts } from './networkSigner.ts';
|
|
2
|
+
import { type UserAuthentication } from './authentication.ts';
|
|
3
|
+
import type { TypedDataDomain } from 'viem';
|
|
4
|
+
export type FieldDefinition = {
|
|
5
|
+
name: string;
|
|
6
|
+
type: string;
|
|
7
|
+
};
|
|
8
|
+
export type TypedData<T> = {
|
|
9
|
+
types: Record<string, Array<FieldDefinition>>;
|
|
10
|
+
domain: TypedDataDomain;
|
|
11
|
+
primaryType: string;
|
|
12
|
+
message: T;
|
|
13
|
+
};
|
|
14
|
+
export interface IBrowserWallet {
|
|
15
|
+
signTypedData<T>(from: string, request: TypedData<T>): Promise<unknown>;
|
|
16
|
+
}
|
|
17
|
+
export declare function authenticateUsingEOA({ setup, user_id, challenge, browserWallet, }: {
|
|
18
|
+
setup: KeygenSetupOpts | SignSetupOpts;
|
|
19
|
+
user_id: string;
|
|
20
|
+
challenge: string;
|
|
21
|
+
browserWallet: IBrowserWallet;
|
|
22
|
+
}): Promise<UserAuthentication>;
|
|
23
|
+
//# sourceMappingURL=EOAauthentication.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EOAauthentication.d.ts","sourceRoot":"","sources":["../src/EOAauthentication.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC1F,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAE5C,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAOF,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;IACzB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;IAC9C,MAAM,EAAE,eAAe,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,CAAC,CAAC;CACZ,CAAC;AAEF,MAAM,WAAW,cAAc;IAa7B,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACzE;AAkJD,wBAAsB,oBAAoB,CAAC,EACzC,KAAK,EACL,OAAO,EACP,SAAS,EACT,aAAa,GACd,EAAE;IACD,KAAK,EAAE,eAAe,GAAG,aAAa,CAAC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,cAAc,CAAC;CAC/B,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA4B9B"}
|
package/dist/authentication.d.ts
CHANGED
|
@@ -1,22 +1,33 @@
|
|
|
1
1
|
import { KeygenSetupOpts, SignSetupOpts } from './networkSigner';
|
|
2
|
-
import {
|
|
2
|
+
import { IBrowserWallet } from './EOAauthentication';
|
|
3
|
+
import { IWalletProviderServiceClient } from './walletProviderServiceClientInterface';
|
|
3
4
|
export declare enum AuthMethod {
|
|
4
5
|
EOA = 0,
|
|
5
6
|
NONE = 1
|
|
6
7
|
}
|
|
7
|
-
export type
|
|
8
|
-
|
|
8
|
+
export type UserCredentials = {
|
|
9
|
+
id: string;
|
|
10
|
+
method: string;
|
|
11
|
+
credentials: string;
|
|
12
|
+
};
|
|
9
13
|
export type UserAuthentication = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
user_sig: UserSignature;
|
|
14
|
+
credentials: UserCredentials;
|
|
15
|
+
signature: string;
|
|
13
16
|
};
|
|
14
17
|
export interface AuthModule {
|
|
15
|
-
authenticate(
|
|
18
|
+
authenticate({ setup, challenge, }: {
|
|
19
|
+
setup: KeygenSetupOpts | SignSetupOpts;
|
|
20
|
+
challenge: string;
|
|
21
|
+
}): Promise<UserAuthentication>;
|
|
16
22
|
}
|
|
17
23
|
export declare class EOAAuth implements AuthModule {
|
|
18
24
|
userId: string;
|
|
19
|
-
|
|
20
|
-
|
|
25
|
+
browserWallet: IBrowserWallet;
|
|
26
|
+
wpClient: IWalletProviderServiceClient;
|
|
27
|
+
constructor(userId: string, browserWallet: IBrowserWallet, wpClient: IWalletProviderServiceClient);
|
|
28
|
+
authenticate({ setup, challenge, }: {
|
|
29
|
+
setup: KeygenSetupOpts | SignSetupOpts;
|
|
30
|
+
challenge: string;
|
|
31
|
+
}): Promise<UserAuthentication>;
|
|
21
32
|
}
|
|
22
33
|
//# sourceMappingURL=authentication.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../src/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../src/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAwB,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AAEtF,oBAAY,UAAU;IACpB,GAAG,IAAA;IACH,IAAI,IAAA;CACL;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IAEX,MAAM,EAAE,MAAM,CAAC;IAEf,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,EAAE,eAAe,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,UAAU;IACzB,YAAY,CAAC,EACX,KAAK,EACL,SAAS,GACV,EAAE;QACD,KAAK,EAAE,eAAe,GAAG,aAAa,CAAC;QACvC,SAAS,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACjC;AAED,qBAAa,OAAQ,YAAW,UAAU;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,cAAc,CAAC;IAC9B,QAAQ,EAAE,4BAA4B,CAAC;gBAE3B,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,4BAA4B;IAM3F,YAAY,CAAC,EACjB,KAAK,EACL,SAAS,GACV,EAAE;QACD,KAAK,EAAE,eAAe,GAAG,aAAa,CAAC;QACvC,SAAS,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAQhC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type { TypedData } from './walletEIP6963.ts';
|
|
3
|
-
export { HashAlgo, NetworkSigner } from './networkSigner.ts';
|
|
1
|
+
export { KeygenSetupOpts, NetworkSigner } from './networkSigner.ts';
|
|
4
2
|
export { createViemAccount } from './viemSigner.ts';
|
|
5
3
|
export { AuthMethod, EOAAuth } from './authentication.ts';
|
|
6
|
-
export type {
|
|
4
|
+
export type { TypedData } from './EOAauthentication.ts';
|
|
5
|
+
export type { UserAuthenticatedRequest, KeygenResponse, SignSetupOpts, SignResponse } from './networkSigner.ts';
|
|
6
|
+
export type { IWalletProviderServiceClient } from './walletProviderServiceClientInterface.ts';
|
|
7
|
+
export { WalletProviderServiceClient } from './walletProviderServiceClient.ts';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE1D,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,YAAY,EAAE,wBAAwB,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEhH,YAAY,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AAC9F,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var zq=Object.defineProperty;var jq=($,J)=>{for(var Q in J)zq($,Q,{get:J[Q],enumerable:!0,configurable:!0,set:(q)=>J[Q]=()=>q})};var f=($,J)=>()=>($&&(J=$($=0)),J);function D$($,{strict:J=!0}={}){if(!$)return!1;if(typeof $!=="string")return!1;return J?/^0x[0-9a-fA-F]*$/.test($):$.startsWith("0x")}var u$=f(()=>{});function b($){if(D$($,{strict:!1}))return Math.ceil(($.length-2)/2);return $.length}var U$=f(()=>{u$()});var V8;var O8=f(()=>{V8="2.11.1"});var U8;var w8=f(()=>{O8();U8=()=>`viem@${V8}`});class z extends Error{constructor($,J={}){super();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,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ViemError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:U8()});const Q=J.cause instanceof z?J.cause.details:J.cause?.message?J.cause.message:J.details,q=J.cause instanceof z?J.cause.docsPath||J.docsPath:J.docsPath;if(this.message=[$||"An error occurred.","",...J.metaMessages?[...J.metaMessages,""]:[],...q?[`Docs: https://viem.sh${q}${J.docsSlug?`#${J.docsSlug}`:""}`]:[],...Q?[`Details: ${Q}`]:[],`Version: ${this.version}`].join("\n"),J.cause)this.cause=J.cause;this.details=Q,this.docsPath=q,this.metaMessages=J.metaMessages,this.shortMessage=$}walk($){return C8(this,$)}}var C8;var n=f(()=>{w8();C8=function($,J){if(J?.($))return $;if($&&typeof $==="object"&&"cause"in $)return C8($.cause,J);return J?null:$}});class a0 extends z{constructor({expectedLength:$,givenLength:J,type:Q}){super([`ABI encoding array length mismatch for type ${Q}.`,`Expected length: ${$}`,`Given length: ${J}`].join("\n"));Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingArrayLengthMismatchError"})}}class e0 extends z{constructor({expectedSize:$,value:J}){super(`Size of bytes "${J}" (bytes${b(J)}) does not match expected size (bytes${$}).`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingBytesSizeMismatchError"})}}class s0 extends z{constructor({expectedLength:$,givenLength:J}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${$}`,`Given length (values): ${J}`].join("\n"));Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingLengthMismatchError"})}}class $J extends z{constructor({expectedSize:$,givenSize:J}){super(`Expected bytes${$}, got bytes${J}.`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BytesSizeMismatchError"})}}class JJ extends z{constructor($,{docsPath:J}){super([`Type "${$}" is not a valid encoding type.`,"Please provide a valid ABI type."].join("\n"),{docsPath:J});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiEncodingType"})}}class QJ extends z{constructor($){super([`Value "${$}" is not a valid array.`].join("\n"));Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidArrayError"})}}var qJ=f(()=>{U$();n()});class M0 extends z{constructor({offset:$,position:J,size:Q}){super(`Slice ${J==="start"?"starting":"ending"} at offset "${$}" is out-of-bounds (size: ${Q}).`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SliceOffsetOutOfBoundsError"})}}class V0 extends z{constructor({size:$,targetSize:J,type:Q}){super(`${Q.charAt(0).toUpperCase()}${Q.slice(1).toLowerCase()} size (${$}) exceeds padding size (${J}).`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeExceedsPaddingSizeError"})}}var YJ=f(()=>{n()});function w$($,{dir:J,size:Q=32}={}){if(typeof $==="string")return G$($,{dir:J,size:Q});return Hq($,{dir:J,size:Q})}function G$($,{dir:J,size:Q=32}={}){if(Q===null)return $;const q=$.replace("0x","");if(q.length>Q*2)throw new V0({size:Math.ceil(q.length/2),targetSize:Q,type:"hex"});return`0x${q[J==="right"?"padEnd":"padStart"](Q*2,"0")}`}function Hq($,{dir:J,size:Q=32}={}){if(Q===null)return $;if($.length>Q)throw new V0({size:$.length,targetSize:Q,type:"bytes"});const q=new Uint8Array(Q);for(let Y=0;Y<Q;Y++){const W=J==="right";q[W?Y:Q-Y-1]=$[W?Y:$.length-Y-1]}return q}var O0=f(()=>{YJ()});class WJ extends z{constructor({max:$,min:J,signed:Q,size:q,value:Y}){super(`Number "${Y}" is not in safe ${q?`${q*8}-bit ${Q?"signed":"unsigned"} `:""}integer range ${$?`(${J} to ${$})`:`(above ${J})`}`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntegerOutOfRangeError"})}}class IJ extends z{constructor({givenSize:$,maxSize:J}){super(`Size cannot exceed ${J} bytes. Given size: ${$} bytes.`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeOverflowError"})}}var XJ=f(()=>{n()});function DJ($,{dir:J="left"}={}){let Q=typeof $==="string"?$.replace("0x",""):$,q=0;for(let Y=0;Y<Q.length-1;Y++)if(Q[J==="left"?Y:Q.length-Y-1].toString()==="0")q++;else break;if(Q=J==="left"?Q.slice(q):Q.slice(0,Q.length-q),typeof $==="string"){if(Q.length===1&&J==="right")Q=`${Q}0`;return`0x${Q.length%2===1?`0${Q}`:Q}`}return Q}var z8=f(()=>{});function C$($,{size:J}){if(b($)>J)throw new IJ({givenSize:b($),maxSize:J})}function U0($,J={}){const{signed:Q}=J;if(J.size)C$($,{size:J.size});const q=BigInt($);if(!Q)return q;const Y=($.length-2)/2,W=(1n<<BigInt(Y)*8n-1n)-1n;if(q<=W)return q;return q-BigInt(`0x${"f".padStart(Y*2,"f")}`)-1n}function j8($,J={}){return Number(U0($,J))}var r$=f(()=>{XJ();U$()});function B($,J={}){if(typeof $==="number"||typeof $==="bigint")return $$($,J);if(typeof $==="string")return C0($,J);if(typeof $==="boolean")return w0($,J);return m($,J)}function w0($,J={}){const Q=`0x${Number($)}`;if(typeof J.size==="number")return C$(Q,{size:J.size}),w$(Q,{size:J.size});return Q}function m($,J={}){let Q="";for(let Y=0;Y<$.length;Y++)Q+=fq[$[Y]];const q=`0x${Q}`;if(typeof J.size==="number")return C$(q,{size:J.size}),w$(q,{dir:"right",size:J.size});return q}function $$($,J={}){const{signed:Q,size:q}=J,Y=BigInt($);let W;if(q)if(Q)W=(1n<<BigInt(q)*8n-1n)-1n;else W=2n**(BigInt(q)*8n)-1n;else if(typeof $==="number")W=BigInt(Number.MAX_SAFE_INTEGER);const I=typeof W==="bigint"&&Q?-W-1n:0;if(W&&Y>W||Y<I){const D=typeof $==="bigint"?"n":"";throw new WJ({max:W?`${W}${D}`:void 0,min:`${I}${D}`,signed:Q,size:q,value:`${$}${D}`})}const X=`0x${(Q&&Y<0?(1n<<BigInt(q*8))+BigInt(Y):Y).toString(16)}`;if(q)return w$(X,{size:q});return X}function C0($,J={}){const Q=Rq.encode($);return m(Q,J)}var fq,Rq;var i=f(()=>{XJ();O0();r$();fq=Array.from({length:256},($,J)=>J.toString(16).padStart(2,"0")),Rq=new TextEncoder});function c$($,J={}){if(typeof $==="number"||typeof $==="bigint")return kq($,J);if(typeof $==="boolean")return Lq($,J);if(D$($))return Y$($,J);return l$($,J)}function Lq($,J={}){const Q=new Uint8Array(1);if(Q[0]=Number($),typeof J.size==="number")return C$(Q,{size:J.size}),w$(Q,{size:J.size});return Q}function Y$($,J={}){let Q=$;if(J.size)C$(Q,{size:J.size}),Q=w$(Q,{dir:"right",size:J.size});let q=Q.slice(2);if(q.length%2)q=`0${q}`;const Y=q.length/2,W=new Uint8Array(Y);for(let I=0,X=0;I<Y;I++){const D=E8(q.charCodeAt(X++)),A=E8(q.charCodeAt(X++));if(D===void 0||A===void 0)throw new z(`Invalid byte sequence ("${q[X-2]}${q[X-1]}" in "${q}").`);W[I]=D*16+A}return W}function kq($,J){const Q=$$($,J);return Y$(Q)}function l$($,J={}){const Q=Bq.encode($);if(typeof J.size==="number")return C$(Q,{size:J.size}),w$(Q,{dir:"right",size:J.size});return Q}var E8,Bq,Z$;var K$=f(()=>{n();u$();O0();r$();i();E8=function($){if($>=Z$.zero&&$<=Z$.nine)return $-Z$.zero;if($>=Z$.A&&$<=Z$.F)return $-(Z$.A-10);if($>=Z$.a&&$<=Z$.f)return $-(Z$.a-10);return};Bq=new TextEncoder,Z$={zero:48,nine:57,A:65,F:70,a:97,f:102}});var t$,a$,S8,N$,z0;var j0=f(()=>{t$=function($){if(!Number.isSafeInteger($)||$<0)throw new Error(`Wrong positive integer: ${$}`)},a$=function($,...J){if(!($ instanceof Uint8Array))throw new Error("Expected Uint8Array");if(J.length>0&&!J.includes($.length))throw new Error(`Expected Uint8Array of length ${J}, not of length=${$.length}`)},S8=function($){if(typeof $!=="function"||typeof $.create!=="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");t$($.outputLen),t$($.blockLen)},N$=function($,J=!0){if($.destroyed)throw new Error("Hash instance has been destroyed");if(J&&$.finished)throw new Error("Hash#digest() has already been called")},z0=function($,J){a$($);const Q=J.outputLen;if($.length<Q)throw new Error(`digestInto() expects output buffer of length at least ${Q}`)}});var Pq,H8,E0,T8,f8,R8,B8,L8;var k8=f(()=>{Pq=function($,J=!1){if(J)return{h:Number($&E0),l:Number($>>T8&E0)};return{h:Number($>>T8&E0)|0,l:Number($&E0)|0}},H8=function($,J=!1){let Q=new Uint32Array($.length),q=new Uint32Array($.length);for(let Y=0;Y<$.length;Y++){const{h:W,l:I}=Pq($[Y],J);[Q[Y],q[Y]]=[W,I]}return[Q,q]},E0=BigInt(4294967295),T8=BigInt(32),f8=($,J,Q)=>$<<Q|J>>>32-Q,R8=($,J,Q)=>J<<Q|$>>>32-Q,B8=($,J,Q)=>J<<Q-32|$>>>64-Q,L8=($,J,Q)=>$<<Q-32|J>>>64-Q});var S0;var P8=f(()=>{S0=typeof globalThis==="object"&&"crypto"in globalThis?globalThis.crypto:void 0});function xq($){if(typeof $!=="string")throw new Error(`utf8ToBytes expected string, got ${typeof $}`);return new Uint8Array((new TextEncoder()).encode($))}function B$($){if(typeof $==="string")$=xq($);if(!_8($))throw new Error(`expected Uint8Array, got ${typeof $}`);return $}function F8(...$){const J=new Uint8Array($.reduce((q,Y)=>q+Y.length,0));let Q=0;return $.forEach((q)=>{if(!_8(q))throw new Error("Uint8Array expected");J.set(q,Q),Q+=q.length}),J}function H0($){const J=(q)=>$().update(B$(q)).digest(),Q=$();return J.outputLen=Q.outputLen,J.blockLen=Q.blockLen,J.create=()=>$(),J}function b8($=32){if(S0&&typeof S0.getRandomValues==="function")return S0.getRandomValues(new Uint8Array($));throw new Error("crypto.getRandomValues must be defined")}class L${clone(){return this._cloneInto()}}var _8,x8,T0,W$,_q,e9;var h$=f(()=>{P8();/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */_8=($)=>$ instanceof Uint8Array,x8=($)=>new Uint32Array($.buffer,$.byteOffset,Math.floor($.byteLength/4)),T0=($)=>new DataView($.buffer,$.byteOffset,$.byteLength),W$=($,J)=>$<<32-J|$>>>J,_q=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!_q)throw new Error("Non little-endian hardware is not supported");e9={}.toString});function lq($,J=24){const Q=new Uint32Array(10);for(let q=24-J;q<24;q++){for(let I=0;I<10;I++)Q[I]=$[I]^$[I+10]^$[I+20]^$[I+30]^$[I+40];for(let I=0;I<10;I+=2){const X=(I+8)%10,D=(I+2)%10,A=Q[D],Z=Q[D+1],K=v8(A,Z,1)^Q[X],U=g8(A,Z,1)^Q[X+1];for(let C=0;C<50;C+=10)$[I+C]^=K,$[I+C+1]^=U}let Y=$[2],W=$[3];for(let I=0;I<24;I++){const X=u8[I],D=v8(Y,W,X),A=g8(Y,W,X),Z=y8[I];Y=$[Z],W=$[Z+1],$[Z]=D,$[Z+1]=A}for(let I=0;I<50;I+=10){for(let X=0;X<10;X++)Q[X]=$[I+X];for(let X=0;X<10;X++)$[I+X]^=~Q[(X+2)%10]&Q[(X+4)%10]}$[0]^=uq[q],$[1]^=cq[q]}Q.fill(0)}class AJ extends L${constructor($,J,Q,q=!1,Y=24){super();if(this.blockLen=$,this.suffix=J,this.outputLen=Q,this.enableXOF=q,this.rounds=Y,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,t$(Q),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=x8(this.state)}keccak(){lq(this.state32,this.rounds),this.posOut=0,this.pos=0}update($){N$(this);const{blockLen:J,state:Q}=this;$=B$($);const q=$.length;for(let Y=0;Y<q;){const W=Math.min(J-this.pos,q-Y);for(let I=0;I<W;I++)Q[this.pos++]^=$[Y++];if(this.pos===J)this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:$,suffix:J,pos:Q,blockLen:q}=this;if($[Q]^=J,(J&128)!==0&&Q===q-1)this.keccak();$[q-1]^=128,this.keccak()}writeInto($){N$(this,!1),a$($),this.finish();const J=this.state,{blockLen:Q}=this;for(let q=0,Y=$.length;q<Y;){if(this.posOut>=Q)this.keccak();const W=Math.min(Q-this.posOut,Y-q);$.set(J.subarray(this.posOut,this.posOut+W),q),this.posOut+=W,q+=W}return $}xofInto($){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto($)}xof($){return t$($),this.xofInto(new Uint8Array($))}digestInto($){if(z0($,this),this.finished)throw new Error("digest() was already called");return this.writeInto($),this.destroy(),$}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto($){const{blockLen:J,suffix:Q,outputLen:q,rounds:Y,enableXOF:W}=this;return $||($=new AJ(J,Q,q,W,Y)),$.state32.set(this.state32),$.pos=this.pos,$.posOut=this.posOut,$.finished=this.finished,$.rounds=Y,$.suffix=Q,$.outputLen=q,$.enableXOF=W,$.destroyed=this.destroyed,$}}var y8,u8,c8,Fq,e$,bq,vq,gq,yq,uq,cq,v8,g8,hq,l8;var h8=f(()=>{j0();k8();h$();[y8,u8,c8]=[[],[],[]],Fq=BigInt(0),e$=BigInt(1),bq=BigInt(2),vq=BigInt(7),gq=BigInt(256),yq=BigInt(113);for(let $=0,J=e$,Q=1,q=0;$<24;$++){[Q,q]=[q,(2*Q+3*q)%5],y8.push(2*(5*q+Q)),u8.push(($+1)*($+2)/2%64);let Y=Fq;for(let W=0;W<7;W++)if(J=(J<<e$^(J>>vq)*yq)%gq,J&bq)Y^=e$<<(e$<<BigInt(W))-e$;c8.push(Y)}[uq,cq]=H8(c8,!0),v8=($,J,Q)=>Q>32?B8($,J,Q):f8($,J,Q),g8=($,J,Q)=>Q>32?L8($,J,Q):R8($,J,Q);hq=($,J,Q)=>H0(()=>new AJ(J,$,Q)),l8=hq(1,136,32)});function l($,J){const Q=J||"hex",q=l8(D$($,{strict:!1})?c$($):$);if(Q==="bytes")return q;return B(q)}var m$=f(()=>{h8();u$();K$();i()});class o extends z{constructor({address:$}){super(`Address "${$}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAddressError"})}}var d$=f(()=>{n()});class s$ extends Map{constructor($){super();Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=$}set($,J){if(super.set($,J),this.maxSize&&this.size>this.maxSize)this.delete(this.keys().next().value);return this}}var GJ=f(()=>{});function f0($,J){if(ZJ.has(`${$}.${J}`))return ZJ.get(`${$}.${J}`);const Q=J?`${J}${$.toLowerCase()}`:$.substring(2).toLowerCase(),q=l(l$(Q),"bytes"),Y=(J?Q.substring(`${J}0x`.length):Q).split("");for(let I=0;I<40;I+=2){if(q[I>>1]>>4>=8&&Y[I])Y[I]=Y[I].toUpperCase();if((q[I>>1]&15)>=8&&Y[I+1])Y[I+1]=Y[I+1].toUpperCase()}const W=`0x${Y.join("")}`;return ZJ.set(`${$}.${J}`,W),W}var ZJ;var KJ=f(()=>{K$();m$();GJ();ZJ=new s$(8192)});function a($,J){const{strict:Q=!0}=J??{};if(NJ.has($))return NJ.get($);const q=(()=>{if(!mq.test($))return!1;if($.toLowerCase()===$)return!0;if(Q)return f0($)===$;return!0})();return NJ.set($,q),q}var mq,NJ;var p$=f(()=>{GJ();KJ();mq=/^0x[a-fA-F0-9]{40}$/,NJ=new s$(8192)});function I$($){if(typeof $[0]==="string")return $0($);return dq($)}function dq($){let J=0;for(let Y of $)J+=Y.length;const Q=new Uint8Array(J);let q=0;for(let Y of $)Q.set(Y,q),q+=Y.length;return Q}function $0($){return`0x${$.reduce((J,Q)=>J+Q.replace("0x",""),"")}`}var J0=f(()=>{});function R0($,J,Q,{strict:q}={}){if(D$($,{strict:!1}))return nq($,J,Q,{strict:q});return pq($,J,Q,{strict:q})}function pq($,J,Q,{strict:q}={}){m8($,J);const Y=$.slice(J,Q);if(q)d8(Y,J,Q);return Y}function nq($,J,Q,{strict:q}={}){m8($,J);const Y=`0x${$.replace("0x","").slice((J??0)*2,(Q??$.length)*2)}`;if(q)d8(Y,J,Q);return Y}var m8,d8;var MJ=f(()=>{YJ();u$();U$();m8=function($,J){if(typeof J==="number"&&J>0&&J>b($)-1)throw new M0({offset:J,position:"start",size:b($)})},d8=function($,J,Q){if(typeof J==="number"&&typeof Q==="number"&&b($)!==Q-J)throw new M0({offset:Q,position:"end",size:b($)})}});function VJ($,J){if($.length!==J.length)throw new s0({expectedLength:$.length,givenLength:J.length});const Q=iq({params:$,values:J}),q=UJ(Q);if(q.length===0)return"0x";return q}function JY($){const J=$.match(/^(.*)\[(\d+)?\]$/);return J?[J[2]?Number(J[2]):null,J[1]]:void 0}var iq,OJ,UJ,oq,rq,tq,aq,eq,sq,$Y;var p8=f(()=>{qJ();d$();n();p$();J0();O0();U$();MJ();i();iq=function({params:$,values:J}){const Q=[];for(let q=0;q<$.length;q++)Q.push(OJ({param:$[q],value:J[q]}));return Q},OJ=function({param:$,value:J}){const Q=JY($.type);if(Q){const[q,Y]=Q;return rq(J,{length:q,param:{...$,type:Y}})}if($.type==="tuple")return $Y(J,{param:$});if($.type==="address")return oq(J);if($.type==="bool")return aq(J);if($.type.startsWith("uint")||$.type.startsWith("int")){const q=$.type.startsWith("int");return eq(J,{signed:q})}if($.type.startsWith("bytes"))return tq(J,{param:$});if($.type==="string")return sq(J);throw new JJ($.type,{docsPath:"/docs/contract/encodeAbiParameters"})},UJ=function($){let J=0;for(let W=0;W<$.length;W++){const{dynamic:I,encoded:X}=$[W];if(I)J+=32;else J+=b(X)}const Q=[],q=[];let Y=0;for(let W=0;W<$.length;W++){const{dynamic:I,encoded:X}=$[W];if(I)Q.push($$(J+Y,{size:32})),q.push(X),Y+=b(X);else Q.push(X)}return I$([...Q,...q])},oq=function($){if(!a($))throw new o({address:$});return{dynamic:!1,encoded:G$($.toLowerCase())}},rq=function($,{length:J,param:Q}){const q=J===null;if(!Array.isArray($))throw new QJ($);if(!q&&$.length!==J)throw new a0({expectedLength:J,givenLength:$.length,type:`${Q.type}[${J}]`});let Y=!1;const W=[];for(let I=0;I<$.length;I++){const X=OJ({param:Q,value:$[I]});if(X.dynamic)Y=!0;W.push(X)}if(q||Y){const I=UJ(W);if(q){const X=$$(W.length,{size:32});return{dynamic:!0,encoded:W.length>0?I$([X,I]):X}}if(Y)return{dynamic:!0,encoded:I}}return{dynamic:!1,encoded:I$(W.map(({encoded:I})=>I))}},tq=function($,{param:J}){const[,Q]=J.type.split("bytes"),q=b($);if(!Q){let Y=$;if(q%32!==0)Y=G$(Y,{dir:"right",size:Math.ceil(($.length-2)/2/32)*32});return{dynamic:!0,encoded:I$([G$($$(q,{size:32})),Y])}}if(q!==Number.parseInt(Q))throw new e0({expectedSize:Number.parseInt(Q),value:$});return{dynamic:!1,encoded:G$($,{dir:"right"})}},aq=function($){if(typeof $!=="boolean")throw new z(`Invalid boolean value: "${$}" (type: ${typeof $}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:G$(w0($))}},eq=function($,{signed:J}){return{dynamic:!1,encoded:$$($,{size:32,signed:J})}},sq=function($){const J=C0($),Q=Math.ceil(b(J)/32),q=[];for(let Y=0;Y<Q;Y++)q.push(G$(R0(J,Y*32,(Y+1)*32),{dir:"right"}));return{dynamic:!0,encoded:I$([G$($$(b(J),{size:32})),...q])}},$Y=function($,{param:J}){let Q=!1;const q=[];for(let Y=0;Y<J.components.length;Y++){const W=J.components[Y],I=Array.isArray($)?Y:W.name,X=OJ({param:W,value:$[I]});if(q.push(X),X.dynamic)Q=!0}return{dynamic:Q,encoded:Q?UJ(q):I$(q.map(({encoded:Y})=>Y))}}});class B0 extends z{constructor({offset:$}){super(`Offset \`${$}\` cannot be negative.`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NegativeOffsetError"})}}class wJ extends z{constructor({length:$,position:J}){super(`Position \`${J}\` is out of bounds (\`0 < position < ${$}\`).`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PositionOutOfBoundsError"})}}class CJ extends z{constructor({count:$,limit:J}){super(`Recursive read limit of \`${J}\` exceeded (recursive read count: \`${$}\`).`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RecursiveReadLimitExceededError"})}}var n8=f(()=>{n()});function L0($,{recursiveReadLimit:J=8192}={}){const Q=Object.create(QY);return Q.bytes=$,Q.dataView=new DataView($.buffer,$.byteOffset,$.byteLength),Q.positionReadCount=new Map,Q.recursiveReadLimit=J,Q}var QY;var zJ=f(()=>{n8();QY={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 CJ({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition($){if($<0||$>this.bytes.length-1)throw new wJ({length:this.bytes.length,position:$})},decrementPosition($){if($<0)throw new B0({offset:$});const J=this.position-$;this.assertPosition(J),this.position=J},getReadCount($){return this.positionReadCount.get($||this.position)||0},incrementPosition($){if($<0)throw new B0({offset:$});const J=this.position+$;this.assertPosition(J),this.position=J},inspectByte($){const J=$??this.position;return this.assertPosition(J),this.bytes[J]},inspectBytes($,J){const Q=J??this.position;return this.assertPosition(Q+$-1),this.bytes.subarray(Q,Q+$)},inspectUint8($){const J=$??this.position;return this.assertPosition(J),this.bytes[J]},inspectUint16($){const J=$??this.position;return this.assertPosition(J+1),this.dataView.getUint16(J)},inspectUint24($){const J=$??this.position;return this.assertPosition(J+2),(this.dataView.getUint16(J)<<8)+this.dataView.getUint8(J+2)},inspectUint32($){const J=$??this.position;return this.assertPosition(J+3),this.dataView.getUint32(J)},pushByte($){this.assertPosition(this.position),this.bytes[this.position]=$,this.position++},pushBytes($){this.assertPosition(this.position+$.length-1),this.bytes.set($,this.position),this.position+=$.length},pushUint8($){this.assertPosition(this.position),this.bytes[this.position]=$,this.position++},pushUint16($){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,$),this.position+=2},pushUint24($){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,$>>8),this.dataView.setUint8(this.position+2,$&~4294967040),this.position+=3},pushUint32($){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,$),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const $=this.inspectByte();return this.position++,$},readBytes($,J){this.assertReadLimit(),this._touch();const Q=this.inspectBytes($);return this.position+=J??$,Q},readUint8(){this.assertReadLimit(),this._touch();const $=this.inspectUint8();return this.position+=1,$},readUint16(){this.assertReadLimit(),this._touch();const $=this.inspectUint16();return this.position+=2,$},readUint24(){this.assertReadLimit(),this._touch();const $=this.inspectUint24();return this.position+=3,$},readUint32(){this.assertReadLimit(),this._touch();const $=this.inspectUint32();return this.position+=4,$},get remaining(){return this.bytes.length-this.position},setPosition($){const J=this.position;return this.assertPosition($),this.position=$,()=>this.position=J},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const $=this.getReadCount();if(this.positionReadCount.set(this.position,$+1),$>0)this.recursiveReadCount++}}});var i8;var o8=f(()=>{i8={ether:-9,wei:9}});function r8($,J){let Q=$.toString();const q=Q.startsWith("-");if(q)Q=Q.slice(1);Q=Q.padStart(J,"0");let[Y,W]=[Q.slice(0,Q.length-J),Q.slice(Q.length-J)];return W=W.replace(/(0+)$/,""),`${q?"-":""}${Y||"0"}${W?`.${W}`:""}`}var t8=f(()=>{});function Q0($,J="wei"){return r8($,i8[J])}var a8=f(()=>{o8();t8()});function qY($){const J=Object.entries($).map(([q,Y])=>{if(Y===void 0||Y===!1)return null;return[q,Y]}).filter(Boolean),Q=J.reduce((q,[Y])=>Math.max(q,Y.length),0);return J.map(([q,Y])=>` ${`${q}:`.padEnd(Q+1)} ${Y}`).join("\n")}class jJ extends z{constructor({v:$}){super(`Invalid \`v\` value "${$}". Expected 27 or 28.`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidLegacyVError"})}}class EJ extends z{constructor({transaction:$}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",qY($),"}","","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","- a Legacy Transaction with `gasPrice`"]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSerializableTransactionError"})}}class SJ extends z{constructor({storageKey:$}){super(`Size for storage key "${$}" is invalid. Expected 32 bytes. Got ${Math.floor(($.length-2)/2)} bytes.`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStorageKeySizeError"})}}var k0=f(()=>{n()});class TJ extends z{constructor({cause:$,message:J}={}){const Q=J?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${Q?`with reason: ${Q}`:"for an unknown reason"}.`,{cause:$});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ExecutionRevertedError"})}}class n$ extends z{constructor({cause:$,maxFeePerGas:J}={}){super(`The fee cap (\`maxFeePerGas\`${J?` = ${Q0(J)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:$});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooHigh"})}}class e8 extends z{constructor({cause:$,maxFeePerGas:J}={}){super(`The fee cap (\`maxFeePerGas\`${J?` = ${Q0(J)}`:""} gwei) cannot be lower than the block base fee.`,{cause:$});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooLow"})}}class s8 extends z{constructor({cause:$,nonce:J}={}){super(`Nonce provided for the transaction ${J?`(${J}) `:""}is higher than the next one expected.`,{cause:$});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooHighError"})}}class $Q extends z{constructor({cause:$,nonce:J}={}){super([`Nonce provided for the transaction ${J?`(${J}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join("\n"),{cause:$});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooLowError"})}}class JQ extends z{constructor({cause:$,nonce:J}={}){super(`Nonce provided for the transaction ${J?`(${J}) `:""}exceeds the maximum allowed nonce.`,{cause:$});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceMaxValueError"})}}class QQ extends z{constructor({cause:$}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join("\n"),{cause:$,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."]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InsufficientFundsError"})}}class qQ extends z{constructor({cause:$,gas:J}={}){super(`The amount of gas ${J?`(${J}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:$});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooHighError"})}}class YQ extends z{constructor({cause:$,gas:J}={}){super(`The amount of gas ${J?`(${J}) `:""}provided for the transaction is too low.`,{cause:$});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooLowError"})}}class WQ extends z{constructor({cause:$}){super("The transaction type is not supported for this chain.",{cause:$});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionTypeNotSupportedError"})}}class P0 extends z{constructor({cause:$,maxPriorityFeePerGas:J,maxFeePerGas:Q}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${J?` = ${Q0(J)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${Q?` = ${Q0(Q)} gwei`:""}).`].join("\n"),{cause:$});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TipAboveFeeCapError"})}}var IQ=f(()=>{a8();n();Object.defineProperty(TJ,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(TJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});Object.defineProperty(n$,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});Object.defineProperty(e8,"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/});Object.defineProperty(s8,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});Object.defineProperty($Q,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});Object.defineProperty(JQ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});Object.defineProperty(QQ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds/});Object.defineProperty(qQ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});Object.defineProperty(YQ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});Object.defineProperty(WQ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});Object.defineProperty(P0,"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 HJ extends L${constructor($,J,Q,q){super();this.blockLen=$,this.outputLen=J,this.padOffset=Q,this.isLE=q,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array($),this.view=T0(this.buffer)}update($){N$(this);const{view:J,buffer:Q,blockLen:q}=this;$=B$($);const Y=$.length;for(let W=0;W<Y;){const I=Math.min(q-this.pos,Y-W);if(I===q){const X=T0($);for(;q<=Y-W;W+=q)this.process(X,W);continue}if(Q.set($.subarray(W,W+I),this.pos),this.pos+=I,W+=I,this.pos===q)this.process(J,0),this.pos=0}return this.length+=$.length,this.roundClean(),this}digestInto($){N$(this),z0($,this),this.finished=!0;const{buffer:J,view:Q,blockLen:q,isLE:Y}=this;let{pos:W}=this;if(J[W++]=128,this.buffer.subarray(W).fill(0),this.padOffset>q-W)this.process(Q,0),W=0;for(let Z=W;Z<q;Z++)J[Z]=0;YY(Q,q-8,BigInt(this.length*8),Y),this.process(Q,0);const I=T0($),X=this.outputLen;if(X%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const D=X/4,A=this.get();if(D>A.length)throw new Error("_sha2: outputLen bigger than state");for(let Z=0;Z<D;Z++)I.setUint32(4*Z,A[Z],Y)}digest(){const{buffer:$,outputLen:J}=this;this.digestInto($);const Q=$.slice(0,J);return this.destroy(),Q}_cloneInto($){$||($=new this.constructor),$.set(...this.get());const{blockLen:J,buffer:Q,length:q,finished:Y,destroyed:W,pos:I}=this;if($.length=q,$.pos=I,$.finished=Y,$.destroyed=W,q%J)$.buffer.set(Q);return $}}var YY;var XQ=f(()=>{j0();h$();YY=function($,J,Q,q){if(typeof $.setBigUint64==="function")return $.setBigUint64(J,Q,q);const Y=BigInt(32),W=BigInt(4294967295),I=Number(Q>>Y&W),X=Number(Q&W),D=q?4:0,A=q?0:4;$.setUint32(J+D,I,q),$.setUint32(J+A,X,q)}});class DQ extends HJ{constructor(){super(64,32,8,!1);this.A=z$[0]|0,this.B=z$[1]|0,this.C=z$[2]|0,this.D=z$[3]|0,this.E=z$[4]|0,this.F=z$[5]|0,this.G=z$[6]|0,this.H=z$[7]|0}get(){const{A:$,B:J,C:Q,D:q,E:Y,F:W,G:I,H:X}=this;return[$,J,Q,q,Y,W,I,X]}set($,J,Q,q,Y,W,I,X){this.A=$|0,this.B=J|0,this.C=Q|0,this.D=q|0,this.E=Y|0,this.F=W|0,this.G=I|0,this.H=X|0}process($,J){for(let Z=0;Z<16;Z++,J+=4)j$[Z]=$.getUint32(J,!1);for(let Z=16;Z<64;Z++){const K=j$[Z-15],U=j$[Z-2],C=W$(K,7)^W$(K,18)^K>>>3,G=W$(U,17)^W$(U,19)^U>>>10;j$[Z]=G+j$[Z-7]+C+j$[Z-16]|0}let{A:Q,B:q,C:Y,D:W,E:I,F:X,G:D,H:A}=this;for(let Z=0;Z<64;Z++){const K=W$(I,6)^W$(I,11)^W$(I,25),U=A+K+WY(I,X,D)+XY[Z]+j$[Z]|0,G=(W$(Q,2)^W$(Q,13)^W$(Q,22))+IY(Q,q,Y)|0;A=D,D=X,X=I,I=W+U|0,W=Y,Y=q,q=Q,Q=U+G|0}Q=Q+this.A|0,q=q+this.B|0,Y=Y+this.C|0,W=W+this.D|0,I=I+this.E|0,X=X+this.F|0,D=D+this.G|0,A=A+this.H|0,this.set(Q,q,Y,W,I,X,D,A)}roundClean(){j$.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}var WY,IY,XY,z$,j$,F0;var fJ=f(()=>{XQ();h$();WY=($,J,Q)=>$&J^~$&Q,IY=($,J,Q)=>$&J^$&Q^J&Q,XY=new Uint32Array([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]),z$=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),j$=new Uint32Array(64);F0=H0(()=>new DQ)});class Y0 extends z{constructor({chainId:$}){super(typeof $==="number"?`Chain ID "${$}" is invalid.`:"Chain ID is invalid.");Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidChainIdError"})}}var wQ=f(()=>{n()});var uJ={};jq(uJ,{validateObject:()=>{{return S$}},utf8ToBytes:()=>{{return zY}},numberToVarBytesBE:()=>{{return wY}},numberToHexUnpadded:()=>{{return vQ}},numberToBytesLE:()=>{{return l0}},numberToBytesBE:()=>{{return E$}},hexToNumber:()=>{{return gJ}},hexToBytes:()=>{{return P$}},equalBytes:()=>{{return CY}},ensureBytes:()=>{{return e}},createHmacDrbg:()=>{{return yJ}},concatBytes:()=>{{return o$}},bytesToNumberLE:()=>{{return c0}},bytesToNumberBE:()=>{{return M$}},bytesToHex:()=>{{return k$}},bitSet:()=>{{return SY}},bitMask:()=>{{return W0}},bitLen:()=>{{return jY}},bitGet:()=>{{return EY}}});function k$($){if(!u0($))throw new Error("Uint8Array expected");let J="";for(let Q=0;Q<$.length;Q++)J+=UY[$[Q]];return J}function vQ($){const J=$.toString(16);return J.length&1?`0${J}`:J}function gJ($){if(typeof $!=="string")throw new Error("hex string expected, got "+typeof $);return BigInt($===""?"0":`0x${$}`)}function P$($){if(typeof $!=="string")throw new Error("hex string expected, got "+typeof $);const J=$.length;if(J%2)throw new Error("padded hex string expected, got unpadded hex of length "+J);const Q=new Uint8Array(J/2);for(let q=0;q<Q.length;q++){const Y=q*2,W=$.slice(Y,Y+2),I=Number.parseInt(W,16);if(Number.isNaN(I)||I<0)throw new Error("Invalid byte sequence");Q[q]=I}return Q}function M$($){return gJ(k$($))}function c0($){if(!u0($))throw new Error("Uint8Array expected");return gJ(k$(Uint8Array.from($).reverse()))}function E$($,J){return P$($.toString(16).padStart(J*2,"0"))}function l0($,J){return E$($,J).reverse()}function wY($){return P$(vQ($))}function e($,J,Q){let q;if(typeof J==="string")try{q=P$(J)}catch(W){throw new Error(`${$} must be valid hex string, got "${J}". Cause: ${W}`)}else if(u0(J))q=Uint8Array.from(J);else throw new Error(`${$} must be hex string or Uint8Array`);const Y=q.length;if(typeof Q==="number"&&Y!==Q)throw new Error(`${$} expected ${Q} bytes, got ${Y}`);return q}function o$(...$){const J=new Uint8Array($.reduce((q,Y)=>q+Y.length,0));let Q=0;return $.forEach((q)=>{if(!u0(q))throw new Error("Uint8Array expected");J.set(q,Q),Q+=q.length}),J}function CY($,J){if($.length!==J.length)return!1;for(let Q=0;Q<$.length;Q++)if($[Q]!==J[Q])return!1;return!0}function zY($){if(typeof $!=="string")throw new Error(`utf8ToBytes expected string, got ${typeof $}`);return new Uint8Array((new TextEncoder()).encode($))}function jY($){let J;for(J=0;$>bQ;$>>=y0,J+=1);return J}function EY($,J){return $>>BigInt(J)&y0}function yJ($,J,Q){if(typeof $!=="number"||$<2)throw new Error("hashLen must be a number");if(typeof J!=="number"||J<2)throw new Error("qByteLen must be a number");if(typeof Q!=="function")throw new Error("hmacFn must be a function");let q=vJ($),Y=vJ($),W=0;const I=()=>{q.fill(1),Y.fill(0),W=0},X=(...K)=>Q(Y,q,...K),D=(K=vJ())=>{if(Y=X(FQ([0]),K),q=X(),K.length===0)return;Y=X(FQ([1]),K),q=X()},A=()=>{if(W++>=1000)throw new Error("drbg: tried 1000 values");let K=0;const U=[];while(K<J){q=X();const C=q.slice();U.push(C),K+=q.length}return o$(...U)};return(K,U)=>{I(),D(K);let C=void 0;while(!(C=U(A())))D();return I(),C}}function S$($,J,Q={}){const q=(Y,W,I)=>{const X=TY[W];if(typeof X!=="function")throw new Error(`Invalid validator "${W}", expected function`);const D=$[Y];if(I&&D===void 0)return;if(!X(D,$))throw new Error(`Invalid param ${String(Y)}=${D} (${typeof D}), expected ${W}`)};for(let[Y,W]of Object.entries(J))q(Y,W,!1);for(let[Y,W]of Object.entries(Q))q(Y,W,!0);return $}var bQ,y0,OY,u0,UY,SY,W0,vJ,FQ,TY;var I0=f(()=>{/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */bQ=BigInt(0),y0=BigInt(1),OY=BigInt(2),u0=($)=>$ instanceof Uint8Array,UY=Array.from({length:256},($,J)=>J.toString(16).padStart(2,"0")),SY=($,J,Q)=>{return $|(Q?y0:bQ)<<BigInt(J)},W0=($)=>(OY<<BigInt($-1))-y0,vJ=($)=>new Uint8Array($),FQ=($)=>Uint8Array.from($),TY={bigint:($)=>typeof $==="bigint",function:($)=>typeof $==="function",boolean:($)=>typeof $==="boolean",string:($)=>typeof $==="string",stringOrUint8Array:($)=>typeof $==="string"||$ instanceof Uint8Array,isSafeInteger:($)=>Number.isSafeInteger($),array:($)=>Array.isArray($),field:($,J)=>J.Fp.isValid($),hash:($)=>typeof $==="function"&&Number.isSafeInteger($.outputLen)}});function h($,J){const Q=$%J;return Q>=y?Q:J+Q}function BY($,J,Q){if(Q<=y||J<y)throw new Error("Expected power/modulo > 0");if(Q===v)return y;let q=v;while(J>y){if(J&v)q=q*$%Q;$=$*$%Q,J>>=v}return q}function s($,J,Q){let q=$;while(J-- >y)q*=q,q%=Q;return q}function h0($,J){if($===y||J<=y)throw new Error(`invert: expected positive integers, got n=${$} mod=${J}`);let Q=h($,J),q=J,Y=y,W=v,I=v,X=y;while(Q!==y){const A=q/Q,Z=q%Q,K=Y-I*A,U=W-X*A;q=Q,Q=Z,Y=I,W=X,I=K,X=U}if(q!==v)throw new Error("invert: does not exist");return h(Y,J)}function LY($){const J=($-v)/_$;let Q,q,Y;for(Q=$-v,q=0;Q%_$===y;Q/=_$,q++);for(Y=_$;Y<$&&BY(Y,J,$)!==$-v;Y++);if(q===1){const I=($+v)/cJ;return function X(D,A){const Z=D.pow(A,I);if(!D.eql(D.sqr(Z),A))throw new Error("Cannot find square root");return Z}}const W=(Q+v)/_$;return function I(X,D){if(X.pow(D,J)===X.neg(X.ONE))throw new Error("Cannot find square root");let A=q,Z=X.pow(X.mul(X.ONE,Y),Q),K=X.pow(D,W),U=X.pow(D,Q);while(!X.eql(U,X.ONE)){if(X.eql(U,X.ZERO))return X.ZERO;let C=1;for(let N=X.sqr(U);C<A;C++){if(X.eql(N,X.ONE))break;N=X.sqr(N)}const G=X.pow(Z,v<<BigInt(A-C-1));Z=X.sqr(G),K=X.mul(K,G),U=X.mul(U,Z),A=C}return K}}function kY($){if($%cJ===HY){const J=($+v)/cJ;return function Q(q,Y){const W=q.pow(Y,J);if(!q.eql(q.sqr(W),Y))throw new Error("Cannot find square root");return W}}if($%yQ===gQ){const J=($-gQ)/yQ;return function Q(q,Y){const W=q.mul(Y,_$),I=q.pow(W,J),X=q.mul(Y,I),D=q.mul(q.mul(X,_$),I),A=q.mul(X,q.sub(D,q.ONE));if(!q.eql(q.sqr(A),Y))throw new Error("Cannot find square root");return A}}if($%RY===fY);return LY($)}function lJ($){const J={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},Q=PY.reduce((q,Y)=>{return q[Y]="function",q},J);return S$($,Q)}function _Y($,J,Q){if(Q<y)throw new Error("Expected power > 0");if(Q===y)return $.ONE;if(Q===v)return J;let q=$.ONE,Y=J;while(Q>y){if(Q&v)q=$.mul(q,Y);Y=$.sqr(Y),Q>>=v}return q}function xY($,J){const Q=new Array(J.length),q=J.reduce((W,I,X)=>{if($.is0(I))return W;return Q[X]=W,$.mul(W,I)},$.ONE),Y=$.inv(q);return J.reduceRight((W,I,X)=>{if($.is0(I))return W;return Q[X]=$.mul(W,Q[X]),$.mul(W,I)},Y),Q}function hJ($,J){const Q=J!==void 0?J:$.toString(2).length,q=Math.ceil(Q/8);return{nBitLength:Q,nByteLength:q}}function uQ($,J,Q=!1,q={}){if($<=y)throw new Error(`Expected Field ORDER > 0, got ${$}`);const{nBitLength:Y,nByteLength:W}=hJ($,J);if(W>2048)throw new Error("Field lengths over 2048 bytes are not supported");const I=kY($),X=Object.freeze({ORDER:$,BITS:Y,BYTES:W,MASK:W0(Y),ZERO:y,ONE:v,create:(D)=>h(D,$),isValid:(D)=>{if(typeof D!=="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof D}`);return y<=D&&D<$},is0:(D)=>D===y,isOdd:(D)=>(D&v)===v,neg:(D)=>h(-D,$),eql:(D,A)=>D===A,sqr:(D)=>h(D*D,$),add:(D,A)=>h(D+A,$),sub:(D,A)=>h(D-A,$),mul:(D,A)=>h(D*A,$),pow:(D,A)=>_Y(X,D,A),div:(D,A)=>h(D*h0(A,$),$),sqrN:(D)=>D*D,addN:(D,A)=>D+A,subN:(D,A)=>D-A,mulN:(D,A)=>D*A,inv:(D)=>h0(D,$),sqrt:q.sqrt||((D)=>I(X,D)),invertBatch:(D)=>xY(X,D),cmov:(D,A,Z)=>Z?A:D,toBytes:(D)=>Q?l0(D,W):E$(D,W),fromBytes:(D)=>{if(D.length!==W)throw new Error(`Fp.fromBytes: expected ${W}, got ${D.length}`);return Q?c0(D):M$(D)}});return Object.freeze(X)}function cQ($){if(typeof $!=="bigint")throw new Error("field order must be bigint");const J=$.toString(2).length;return Math.ceil(J/8)}function mJ($){const J=cQ($);return J+Math.ceil(J/2)}function lQ($,J,Q=!1){const q=$.length,Y=cQ(J),W=mJ(J);if(q<16||q<W||q>1024)throw new Error(`expected ${W}-1024 bytes of input, got ${q}`);const I=Q?M$($):c0($),X=h(I,J-v)+v;return Q?l0(X,Y):E$(X,Y)}var y,v,_$,HY,cJ,gQ,yQ,fY,RY,PY;var m0=f(()=>{I0();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */y=BigInt(0),v=BigInt(1),_$=BigInt(2),HY=BigInt(3),cJ=BigInt(4),gQ=BigInt(5),yQ=BigInt(8),fY=BigInt(9),RY=BigInt(16),PY=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"]});function hQ($,J){const Q=(Y,W)=>{const I=W.negate();return Y?I:W},q=(Y)=>{const W=Math.ceil(J/Y)+1,I=2**(Y-1);return{windows:W,windowSize:I}};return{constTimeNegate:Q,unsafeLadder(Y,W){let I=$.ZERO,X=Y;while(W>bY){if(W&dJ)I=I.add(X);X=X.double(),W>>=dJ}return I},precomputeWindow(Y,W){const{windows:I,windowSize:X}=q(W),D=[];let A=Y,Z=A;for(let K=0;K<I;K++){Z=A,D.push(Z);for(let U=1;U<X;U++)Z=Z.add(A),D.push(Z);A=Z.double()}return D},wNAF(Y,W,I){const{windows:X,windowSize:D}=q(Y);let{ZERO:A,BASE:Z}=$;const K=BigInt(2**Y-1),U=2**Y,C=BigInt(Y);for(let G=0;G<X;G++){const N=G*D;let O=Number(I&K);if(I>>=C,O>D)O-=U,I+=dJ;const V=N,j=N+Math.abs(O)-1,R=G%2!==0,H=O<0;if(O===0)Z=Z.add(Q(R,W[V]));else A=A.add(Q(H,W[j]))}return{p:A,f:Z}},wNAFCached(Y,W,I,X){const D=Y._WINDOW_SIZE||1;let A=W.get(Y);if(!A){if(A=this.precomputeWindow(Y,D),D!==1)W.set(Y,X(A))}return this.wNAF(D,A,I)}}}function pJ($){return lJ($.Fp),S$($,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...hJ($.n,$.nBitLength),...$,...{p:$.Fp.ORDER}})}var bY,dJ;var mQ=f(()=>{m0();I0();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */bY=BigInt(0),dJ=BigInt(1)});function uY($){const J=vY($),{Fp:Q}=J,q=J.toBytes||((G,N,O)=>{const V=N.toAffine();return o$(Uint8Array.from([4]),Q.toBytes(V.x),Q.toBytes(V.y))}),Y=J.fromBytes||((G)=>{const N=G.subarray(1),O=Q.fromBytes(N.subarray(0,Q.BYTES)),V=Q.fromBytes(N.subarray(Q.BYTES,2*Q.BYTES));return{x:O,y:V}});function W(G){const{a:N,b:O}=J,V=Q.sqr(G),j=Q.mul(V,G);return Q.add(Q.add(j,Q.mul(G,N)),O)}if(!Q.eql(Q.sqr(J.Gy),W(J.Gx)))throw new Error("bad generator point: equation left != right");function I(G){return typeof G==="bigint"&&V$<G&&G<J.n}function X(G){if(!I(G))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function D(G){const{allowedPrivateKeyLengths:N,nByteLength:O,wrapPrivateKey:V,n:j}=J;if(N&&typeof G!=="bigint"){if(G instanceof Uint8Array)G=k$(G);if(typeof G!=="string"||!N.includes(G.length))throw new Error("Invalid key");G=G.padStart(O*2,"0")}let R;try{R=typeof G==="bigint"?G:M$(e("private key",G,O))}catch(H){throw new Error(`private key must be ${O} bytes, hex or bigint, not ${typeof G}`)}if(V)R=h(R,j);return X(R),R}const A=new Map;function Z(G){if(!(G instanceof K))throw new Error("ProjectivePoint expected")}class K{constructor(G,N,O){if(this.px=G,this.py=N,this.pz=O,G==null||!Q.isValid(G))throw new Error("x required");if(N==null||!Q.isValid(N))throw new Error("y required");if(O==null||!Q.isValid(O))throw new Error("z required")}static fromAffine(G){const{x:N,y:O}=G||{};if(!G||!Q.isValid(N)||!Q.isValid(O))throw new Error("invalid affine point");if(G instanceof K)throw new Error("projective point not allowed");const V=(j)=>Q.eql(j,Q.ZERO);if(V(N)&&V(O))return K.ZERO;return new K(N,O,Q.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(G){const N=Q.invertBatch(G.map((O)=>O.pz));return G.map((O,V)=>O.toAffine(N[V])).map(K.fromAffine)}static fromHex(G){const N=K.fromAffine(Y(e("pointHex",G)));return N.assertValidity(),N}static fromPrivateKey(G){return K.BASE.multiply(D(G))}_setWindowSize(G){this._WINDOW_SIZE=G,A.delete(this)}assertValidity(){if(this.is0()){if(J.allowInfinityPoint&&!Q.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:G,y:N}=this.toAffine();if(!Q.isValid(G)||!Q.isValid(N))throw new Error("bad point: x or y not FE");const O=Q.sqr(N),V=W(G);if(!Q.eql(O,V))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:G}=this.toAffine();if(Q.isOdd)return!Q.isOdd(G);throw new Error("Field doesn't support isOdd")}equals(G){Z(G);const{px:N,py:O,pz:V}=this,{px:j,py:R,pz:H}=G,E=Q.eql(Q.mul(N,H),Q.mul(j,V)),S=Q.eql(Q.mul(O,H),Q.mul(R,V));return E&&S}negate(){return new K(this.px,Q.neg(this.py),this.pz)}double(){const{a:G,b:N}=J,O=Q.mul(N,dQ),{px:V,py:j,pz:R}=this;let{ZERO:H,ZERO:E,ZERO:S}=Q,L=Q.mul(V,V),Q$=Q.mul(j,j),_=Q.mul(R,R),P=Q.mul(V,j);return P=Q.add(P,P),S=Q.mul(V,R),S=Q.add(S,S),H=Q.mul(G,S),E=Q.mul(O,_),E=Q.add(H,E),H=Q.sub(Q$,E),E=Q.add(Q$,E),E=Q.mul(H,E),H=Q.mul(P,H),S=Q.mul(O,S),_=Q.mul(G,_),P=Q.sub(L,_),P=Q.mul(G,P),P=Q.add(P,S),S=Q.add(L,L),L=Q.add(S,L),L=Q.add(L,_),L=Q.mul(L,P),E=Q.add(E,L),_=Q.mul(j,R),_=Q.add(_,_),L=Q.mul(_,P),H=Q.sub(H,L),S=Q.mul(_,Q$),S=Q.add(S,S),S=Q.add(S,S),new K(H,E,S)}add(G){Z(G);const{px:N,py:O,pz:V}=this,{px:j,py:R,pz:H}=G;let{ZERO:E,ZERO:S,ZERO:L}=Q;const Q$=J.a,_=Q.mul(J.b,dQ);let P=Q.mul(N,j),p=Q.mul(O,R),r=Q.mul(V,H),O$=Q.add(N,O),c=Q.add(j,R);O$=Q.mul(O$,c),c=Q.add(P,p),O$=Q.sub(O$,c),c=Q.add(N,V);let M=Q.add(j,H);return c=Q.mul(c,M),M=Q.add(P,r),c=Q.sub(c,M),M=Q.add(O,V),E=Q.add(R,H),M=Q.mul(M,E),E=Q.add(p,r),M=Q.sub(M,E),L=Q.mul(Q$,c),E=Q.mul(_,r),L=Q.add(E,L),E=Q.sub(p,L),L=Q.add(p,L),S=Q.mul(E,L),p=Q.add(P,P),p=Q.add(p,P),r=Q.mul(Q$,r),c=Q.mul(_,c),p=Q.add(p,r),r=Q.sub(P,r),r=Q.mul(Q$,r),c=Q.add(c,r),P=Q.mul(p,c),S=Q.add(S,P),P=Q.mul(M,c),E=Q.mul(O$,E),E=Q.sub(E,P),P=Q.mul(O$,p),L=Q.mul(M,L),L=Q.add(L,P),new K(E,S,L)}subtract(G){return this.add(G.negate())}is0(){return this.equals(K.ZERO)}wNAF(G){return C.wNAFCached(this,A,G,(N)=>{const O=Q.invertBatch(N.map((V)=>V.pz));return N.map((V,j)=>V.toAffine(O[j])).map(K.fromAffine)})}multiplyUnsafe(G){const N=K.ZERO;if(G===V$)return N;if(X(G),G===J$)return this;const{endo:O}=J;if(!O)return C.unsafeLadder(this,G);let{k1neg:V,k1:j,k2neg:R,k2:H}=O.splitScalar(G),E=N,S=N,L=this;while(j>V$||H>V$){if(j&J$)E=E.add(L);if(H&J$)S=S.add(L);L=L.double(),j>>=J$,H>>=J$}if(V)E=E.negate();if(R)S=S.negate();return S=new K(Q.mul(S.px,O.beta),S.py,S.pz),E.add(S)}multiply(G){X(G);let N=G,O,V;const{endo:j}=J;if(j){const{k1neg:R,k1:H,k2neg:E,k2:S}=j.splitScalar(N);let{p:L,f:Q$}=this.wNAF(H),{p:_,f:P}=this.wNAF(S);L=C.constTimeNegate(R,L),_=C.constTimeNegate(E,_),_=new K(Q.mul(_.px,j.beta),_.py,_.pz),O=L.add(_),V=Q$.add(P)}else{const{p:R,f:H}=this.wNAF(N);O=R,V=H}return K.normalizeZ([O,V])[0]}multiplyAndAddUnsafe(G,N,O){const V=K.BASE,j=(H,E)=>E===V$||E===J$||!H.equals(V)?H.multiplyUnsafe(E):H.multiply(E),R=j(this,N).add(j(G,O));return R.is0()?void 0:R}toAffine(G){const{px:N,py:O,pz:V}=this,j=this.is0();if(G==null)G=j?Q.ONE:Q.inv(V);const R=Q.mul(N,G),H=Q.mul(O,G),E=Q.mul(V,G);if(j)return{x:Q.ZERO,y:Q.ZERO};if(!Q.eql(E,Q.ONE))throw new Error("invZ was invalid");return{x:R,y:H}}isTorsionFree(){const{h:G,isTorsionFree:N}=J;if(G===J$)return!0;if(N)return N(K,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:G,clearCofactor:N}=J;if(G===J$)return this;if(N)return N(K,this);return this.multiplyUnsafe(J.h)}toRawBytes(G=!0){return this.assertValidity(),q(K,this,G)}toHex(G=!0){return k$(this.toRawBytes(G))}}K.BASE=new K(J.Gx,J.Gy,Q.ONE),K.ZERO=new K(Q.ZERO,Q.ONE,Q.ZERO);const U=J.nBitLength,C=hQ(K,J.endo?Math.ceil(U/2):U);return{CURVE:J,ProjectivePoint:K,normPrivateKeyToScalar:D,weierstrassEquation:W,isWithinCurveOrder:I}}function pQ($){const J=cY($),{Fp:Q,n:q}=J,Y=Q.BYTES+1,W=2*Q.BYTES+1;function I(M){return V$<M&&M<Q.ORDER}function X(M){return h(M,q)}function D(M){return h0(M,q)}const{ProjectivePoint:A,normPrivateKeyToScalar:Z,weierstrassEquation:K,isWithinCurveOrder:U}=uY({...J,toBytes(M,T,k){const x=T.toAffine(),F=Q.toBytes(x.x),g=o$;if(k)return g(Uint8Array.from([T.hasEvenY()?2:3]),F);else return g(Uint8Array.from([4]),F,Q.toBytes(x.y))},fromBytes(M){const T=M.length,k=M[0],x=M.subarray(1);if(T===Y&&(k===2||k===3)){const F=M$(x);if(!I(F))throw new Error("Point is not on curve");const g=K(F);let q$=Q.sqrt(g);const t=(q$&J$)===J$;if((k&1)===1!==t)q$=Q.neg(q$);return{x:F,y:q$}}else if(T===W&&k===4){const F=Q.fromBytes(x.subarray(0,Q.BYTES)),g=Q.fromBytes(x.subarray(Q.BYTES,2*Q.BYTES));return{x:F,y:g}}else throw new Error(`Point of length ${T} was invalid. Expected ${Y} compressed bytes or ${W} uncompressed bytes`)}}),C=(M)=>k$(E$(M,J.nByteLength));function G(M){const T=q>>J$;return M>T}function N(M){return G(M)?X(-M):M}const O=(M,T,k)=>M$(M.slice(T,k));class V{constructor(M,T,k){this.r=M,this.s=T,this.recovery=k,this.assertValidity()}static fromCompact(M){const T=J.nByteLength;return M=e("compactSignature",M,T*2),new V(O(M,0,T),O(M,T,2*T))}static fromDER(M){const{r:T,s:k}=x$.toSig(e("DER",M));return new V(T,k)}assertValidity(){if(!U(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!U(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(M){return new V(this.r,this.s,M)}recoverPublicKey(M){const{r:T,s:k,recovery:x}=this,F=L(e("msgHash",M));if(x==null||![0,1,2,3].includes(x))throw new Error("recovery id invalid");const g=x===2||x===3?T+J.n:T;if(g>=Q.ORDER)throw new Error("recovery id 2 or 3 invalid");const q$=(x&1)===0?"02":"03",t=A.fromHex(q$+C(g)),A$=D(g),T$=X(-F*A$),v$=X(k*A$),H$=A.BASE.multiplyAndAddUnsafe(t,T$,v$);if(!H$)throw new Error("point at infinify");return H$.assertValidity(),H$}hasHighS(){return G(this.s)}normalizeS(){return this.hasHighS()?new V(this.r,X(-this.s),this.recovery):this}toDERRawBytes(){return P$(this.toDERHex())}toDERHex(){return x$.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return P$(this.toCompactHex())}toCompactHex(){return C(this.r)+C(this.s)}}const j={isValidPrivateKey(M){try{return Z(M),!0}catch(T){return!1}},normPrivateKeyToScalar:Z,randomPrivateKey:()=>{const M=mJ(J.n);return lQ(J.randomBytes(M),J.n)},precompute(M=8,T=A.BASE){return T._setWindowSize(M),T.multiply(BigInt(3)),T}};function R(M,T=!0){return A.fromPrivateKey(M).toRawBytes(T)}function H(M){const T=M instanceof Uint8Array,k=typeof M==="string",x=(T||k)&&M.length;if(T)return x===Y||x===W;if(k)return x===2*Y||x===2*W;if(M instanceof A)return!0;return!1}function E(M,T,k=!0){if(H(M))throw new Error("first arg must be private key");if(!H(T))throw new Error("second arg must be public key");return A.fromHex(T).multiply(Z(M)).toRawBytes(k)}const S=J.bits2int||function(M){const T=M$(M),k=M.length*8-J.nBitLength;return k>0?T>>BigInt(k):T},L=J.bits2int_modN||function(M){return X(S(M))},Q$=W0(J.nBitLength);function _(M){if(typeof M!=="bigint")throw new Error("bigint expected");if(!(V$<=M&&M<Q$))throw new Error(`bigint expected < 2^${J.nBitLength}`);return E$(M,J.nByteLength)}function P(M,T,k=p){if(["recovered","canonical"].some((f$)=>(f$ in k)))throw new Error("sign() legacy options not supported");const{hash:x,randomBytes:F}=J;let{lowS:g,prehash:q$,extraEntropy:t}=k;if(g==null)g=!0;if(M=e("msgHash",M),q$)M=e("prehashed msgHash",x(M));const A$=L(M),T$=Z(T),v$=[_(T$),_(A$)];if(t!=null){const f$=t===!0?F(Q.BYTES):t;v$.push(e("extraEntropy",f$))}const H$=o$(...v$),G0=A$;function r0(f$){const g$=S(f$);if(!U(g$))return;const X8=D(g$),X$=A.BASE.multiply(g$).toAffine(),y$=X(X$.x);if(y$===V$)return;const Z0=X(X8*X(G0+y$*T$));if(Z0===V$)return;let D8=(X$.x===y$?0:2)|Number(X$.y&J$),A8=Z0;if(g&&G(Z0))A8=N(Z0),D8^=1;return new V(y$,A8,D8)}return{seed:H$,k2sig:r0}}const p={lowS:J.lowS,prehash:!1},r={lowS:J.lowS,prehash:!1};function O$(M,T,k=p){const{seed:x,k2sig:F}=P(M,T,k),g=J;return yJ(g.hash.outputLen,g.nByteLength,g.hmac)(x,F)}A.BASE._setWindowSize(8);function c(M,T,k,x=r){const F=M;if(T=e("msgHash",T),k=e("publicKey",k),"strict"in x)throw new Error("options.strict was renamed to lowS");const{lowS:g,prehash:q$}=x;let t=void 0,A$;try{if(typeof F==="string"||F instanceof Uint8Array)try{t=V.fromDER(F)}catch(X$){if(!(X$ instanceof x$.Err))throw X$;t=V.fromCompact(F)}else if(typeof F==="object"&&typeof F.r==="bigint"&&typeof F.s==="bigint"){const{r:X$,s:y$}=F;t=new V(X$,y$)}else throw new Error("PARSE");A$=A.fromHex(k)}catch(X$){if(X$.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(g&&t.hasHighS())return!1;if(q$)T=J.hash(T);const{r:T$,s:v$}=t,H$=L(T),G0=D(v$),r0=X(H$*G0),f$=X(T$*G0),g$=A.BASE.multiplyAndAddUnsafe(A$,r0,f$)?.toAffine();if(!g$)return!1;return X(g$.x)===T$}return{CURVE:J,getPublicKey:R,getSharedSecret:E,sign:O$,verify:c,ProjectivePoint:A,Signature:V,utils:j}}var vY,cY,gY,yY,x$,V$,J$,pX,dQ,nX;var nQ=f(()=>{m0();I0();I0();mQ();vY=function($){const J=pJ($);S$(J,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:Q,Fp:q,a:Y}=J;if(Q){if(!q.eql(Y,q.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof Q!=="object"||typeof Q.beta!=="bigint"||typeof Q.splitScalar!=="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...J})};cY=function($){const J=pJ($);return S$(J,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...J})};/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */({bytesToNumberBE:gY,hexToBytes:yY}=uJ),x$={Err:class $ extends Error{constructor(J=""){super(J)}},_parseInt($){const{Err:J}=x$;if($.length<2||$[0]!==2)throw new J("Invalid signature integer tag");const Q=$[1],q=$.subarray(2,Q+2);if(!Q||q.length!==Q)throw new J("Invalid signature integer: wrong length");if(q[0]&128)throw new J("Invalid signature integer: negative");if(q[0]===0&&!(q[1]&128))throw new J("Invalid signature integer: unnecessary leading zero");return{d:gY(q),l:$.subarray(Q+2)}},toSig($){const{Err:J}=x$,Q=typeof $==="string"?yY($):$;if(!(Q instanceof Uint8Array))throw new Error("ui8a expected");let q=Q.length;if(q<2||Q[0]!=48)throw new J("Invalid signature tag");if(Q[1]!==q-2)throw new J("Invalid signature: incorrect length");const{d:Y,l:W}=x$._parseInt(Q.subarray(2)),{d:I,l:X}=x$._parseInt(W);if(X.length)throw new J("Invalid signature: left bytes after parsing");return{r:Y,s:I}},hexFromSig($){const J=(A)=>Number.parseInt(A[0],16)&8?"00"+A:A,Q=(A)=>{const Z=A.toString(16);return Z.length&1?`0${Z}`:Z},q=J(Q($.s)),Y=J(Q($.r)),W=q.length/2,I=Y.length/2,X=Q(W),D=Q(I);return`30${Q(I+W+4)}02${D}${Y}02${X}${q}`}},V$=BigInt(0),J$=BigInt(1),pX=BigInt(2),dQ=BigInt(3),nX=BigInt(4)});class nJ extends L${constructor($,J){super();this.finished=!1,this.destroyed=!1,S8($);const Q=B$(J);if(this.iHash=$.create(),typeof this.iHash.update!=="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const q=this.blockLen,Y=new Uint8Array(q);Y.set(Q.length>q?$.create().update(Q).digest():Q);for(let W=0;W<Y.length;W++)Y[W]^=54;this.iHash.update(Y),this.oHash=$.create();for(let W=0;W<Y.length;W++)Y[W]^=54^92;this.oHash.update(Y),Y.fill(0)}update($){return N$(this),this.iHash.update($),this}digestInto($){N$(this),a$($,this.outputLen),this.finished=!0,this.iHash.digestInto($),this.oHash.update($),this.oHash.digestInto($),this.destroy()}digest(){const $=new Uint8Array(this.oHash.outputLen);return this.digestInto($),$}_cloneInto($){$||($=Object.create(Object.getPrototypeOf(this),{}));const{oHash:J,iHash:Q,finished:q,destroyed:Y,blockLen:W,outputLen:I}=this;return $=$,$.finished=q,$.destroyed=Y,$.blockLen=W,$.outputLen=I,$.oHash=J._cloneInto($.oHash),$.iHash=Q._cloneInto($.iHash),$}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}var iJ;var iQ=f(()=>{j0();h$();iJ=($,J,Q)=>new nJ($,J).update(Q).digest();iJ.create=($,J)=>new nJ($,J)});function lY($){return{hash:$,hmac:(J,...Q)=>iJ($,J,F8(...Q)),randomBytes:b8}}function oQ($,J){const Q=(q)=>pQ({...$,...lY(q)});return Object.freeze({...Q(J),create:Q})}var rQ=f(()=>{iQ();h$();nQ();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */});var mY,eQ,tQ,hY,oJ,aQ,rJ,tJ,YD,WD;var sQ=f(()=>{fJ();m0();rQ();mY=function($){const J=eQ,Q=BigInt(3),q=BigInt(6),Y=BigInt(11),W=BigInt(22),I=BigInt(23),X=BigInt(44),D=BigInt(88),A=$*$*$%J,Z=A*A*$%J,K=s(Z,Q,J)*Z%J,U=s(K,Q,J)*Z%J,C=s(U,oJ,J)*A%J,G=s(C,Y,J)*C%J,N=s(G,W,J)*G%J,O=s(N,X,J)*N%J,V=s(O,D,J)*O%J,j=s(V,X,J)*N%J,R=s(j,Q,J)*Z%J,H=s(R,I,J)*G%J,E=s(H,q,J)*A%J,S=s(E,oJ,J);if(!rJ.eql(rJ.sqr(S),$))throw new Error("Cannot find square root");return S};/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */eQ=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),tQ=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),hY=BigInt(1),oJ=BigInt(2),aQ=($,J)=>($+J/oJ)/J,rJ=uQ(eQ,void 0,void 0,{sqrt:mY}),tJ=oQ({a:BigInt(0),b:BigInt(7),Fp:rJ,n:tQ,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:($)=>{const J=tQ,Q=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),q=-hY*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),Y=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),W=Q,I=BigInt("0x100000000000000000000000000000000"),X=aQ(W*$,J),D=aQ(-q*$,J);let A=h($-X*Q-D*Y,J),Z=h(-X*q-D*W,J);const K=A>I,U=Z>I;if(K)A=J-A;if(U)Z=J-Z;if(A>I||Z>I)throw new Error("splitScalar: Endomorphism failed, k="+$);return{k1neg:K,k1:A,k2neg:U,k2:Z}}}},F0),YD=BigInt(0),WD=tJ.ProjectivePoint});function Z8($){console.log("Setting up browser wallet as active",$.info.name),K0=$.provider,N0=[]}async function Tq(){if(!K0)throw Error("No wallet selected!");N0=await K0.request({method:"eth_requestAccounts"}),console.log("Wallet connected with accounts ",N0)}async function K8($,J){return K0?.request({method:"eth_signTypedData_v4",params:[$,JSON.stringify(J)]})}var G8=new Map,t0="",K0=null,N0,Eq=()=>{console.log("Waiting for wallets to announce"),window.addEventListener("eip6963:announceProvider",($)=>{const J=$;console.log("Wallet announced:",J.detail.info.name),Sq(J.detail)}),window.dispatchEvent(new Event("eip6963:requestProvider"))},Sq=async($)=>{if(t0==="")t0=$.info.name,Z8($);G8.set($.info.name,$)};function N8($){return $.message!==void 0}var R$;(function(q){q["SHA256"]="sha256";q["SHA256D"]="sha256d";q["NO_HASH"]="nohash"})(R$||(R$={}));class M8{authModule;threshold;totalNodes;ttl;wp_client;constructor($,J,Q,q,Y=10){if(J===0)throw new Error("Threshold cannot be 0");this.threshold=J,this.totalNodes=Q,this.authModule=q,this.ttl=Y,this.wp_client=$}async authenticateAndCreateKey(){try{const $={t:this.threshold,n:this.totalNodes};console.log("Generated Payload:",$);const J=await this.authModule.authenticate($,this.wp_client),Q={setup:$,user_authentication:J,ttl:this.ttl},q=await this.wp_client.startKeygen(Q);return console.log("Keygen response:",q),q}catch($){throw console.error($),$}}async authenticateAndSign($,J,Q){const q={hash_algo:Q,key_id:$,message:J},Y=await this.authModule.authenticate(q,this.wp_client),W={setup:q,user_authentication:Y,ttl:this.ttl},I=await this.wp_client.startSigngen(W);return console.log("Sign response:",I),I}}K$();i();function _0($){const{kzg:J}=$,Q=$.to??(typeof $.blobs[0]==="string"?"hex":"bytes"),q=typeof $.blobs[0]==="string"?$.blobs.map((W)=>Y$(W)):$.blobs,Y=[];for(let W of q)Y.push(Uint8Array.from(J.blobToKzgCommitment(W)));return Q==="bytes"?Y:Y.map((W)=>m(W))}K$();i();function x0($){const{kzg:J}=$,Q=$.to??(typeof $.blobs[0]==="string"?"hex":"bytes"),q=typeof $.blobs[0]==="string"?$.blobs.map((I)=>Y$(I)):$.blobs,Y=typeof $.commitments[0]==="string"?$.commitments.map((I)=>Y$(I)):$.commitments,W=[];for(let I=0;I<q.length;I++){const X=q[I],D=Y[I];W.push(Uint8Array.from(J.computeBlobKzgProof(X,D)))}return Q==="bytes"?W:W.map((I)=>m(I))}i();fJ();u$();K$();i();function AQ($,J){const Q=J||"hex",q=F0(D$($,{strict:!1})?c$($):$);if(Q==="bytes")return q;return B(q)}function GQ($){const{commitment:J,version:Q=1}=$,q=$.to??(typeof J==="string"?"hex":"bytes"),Y=AQ(J,"bytes");return Y.set([Q],0),q==="bytes"?Y:m(Y)}function ZQ($){const{commitments:J,version:Q}=$,q=$.to??(typeof J[0]==="string"?"hex":"bytes"),Y=[];for(let W of J)Y.push(GQ({commitment:W,to:q,version:Q}));return Y}var KQ=32,NQ=4096,MQ=131072,RJ=761855;var b0=1;n();class BJ extends z{constructor({maxSize:$,size:J}){super("Blob size is too large.",{metaMessages:[`Max: ${$} bytes`,`Given: ${J} bytes`]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlobSizeTooLargeError"})}}class q0 extends z{constructor(){super("Blob data must not be empty.");Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EmptyBlobError"})}}class LJ extends z{constructor({hash:$,size:J}){super(`Versioned hash "${$}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${J}`]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidVersionedHashSizeError"})}}class kJ extends z{constructor({hash:$,version:J}){super(`Versioned hash "${$}" version is invalid.`,{metaMessages:[`Expected: ${b0}`,`Received: ${J}`]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidVersionedHashVersionError"})}}zJ();U$();K$();i();function VQ($){const J=$.to??(typeof $.data==="string"?"hex":"bytes"),Q=typeof $.data==="string"?Y$($.data):$.data,q=b(Q);if(!q)throw new q0;if(q>RJ)throw new BJ({maxSize:RJ,size:q});const Y=[];let W=!0,I=0;while(W){const X=L0(new Uint8Array(MQ));let D=0;while(D<NQ){const A=Q.slice(I,I+(KQ-1));if(X.pushByte(0),X.pushBytes(A),A.length<31){X.pushByte(128),W=!1;break}D++,I+=31}Y.push(X)}return J==="bytes"?Y.map((X)=>X.bytes):Y.map((X)=>m(X.bytes))}function OQ($){const{data:J,kzg:Q,to:q}=$,Y=$.blobs??VQ({data:J,to:q}),W=$.commitments??_0({blobs:Y,kzg:Q,to:q}),I=$.proofs??x0({blobs:Y,commitments:W,kzg:Q,to:q}),X=[];for(let D=0;D<Y.length;D++)X.push({blob:Y[D],commitment:W[D],proof:I[D]});return X}k0();function UQ($){if($.type)return $.type;if(typeof $.blobs!=="undefined"||typeof $.blobVersionedHashes!=="undefined"||typeof $.maxFeePerBlobGas!=="undefined"||typeof $.sidecars!=="undefined")return"eip4844";if(typeof $.maxFeePerGas!=="undefined"||typeof $.maxPriorityFeePerGas!=="undefined")return"eip1559";if(typeof $.gasPrice!=="undefined"){if(typeof $.accessList!=="undefined")return"eip2930";return"legacy"}throw new EJ({transaction:$})}KJ();m$();function v0($){const J=l(`0x${$.substring(4)}`).substring(26);return f0(`0x${J}`)}var CQ=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,zQ=/^(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)?$/;qJ();d$();p$();U$();i();p8();J0();i();m$();function PJ($){const{domain:J={},message:Q,primaryType:q}=$,Y={EIP712Domain:RQ({domain:J}),...$.types};fQ({domain:J,message:Q,primaryType:q,types:Y});const W=["0x1901"];if(J)W.push(jQ({domain:J,types:Y}));if(q!=="EIP712Domain")W.push(EQ({data:Q,primaryType:q,types:Y}));return l(I$(W))}function jQ({domain:$,types:J}){return EQ({data:$,primaryType:"EIP712Domain",types:J})}var EQ=function({data:$,primaryType:J,types:Q}){const q=SQ({data:$,primaryType:J,types:Q});return l(q)},SQ=function({data:$,primaryType:J,types:Q}){const q=[{type:"bytes32"}],Y=[DY({primaryType:J,types:Q})];for(let W of Q[J]){const[I,X]=HQ({types:Q,name:W.name,type:W.type,value:$[W.name]});q.push(I),Y.push(X)}return VJ(q,Y)},DY=function({primaryType:$,types:J}){const Q=B(AY({primaryType:$,types:J}));return l(Q)},AY=function({primaryType:$,types:J}){let Q="";const q=TQ({primaryType:$,types:J});q.delete($);const Y=[$,...Array.from(q).sort()];for(let W of Y)Q+=`${W}(${J[W].map(({name:I,type:X})=>`${X} ${I}`).join(",")})`;return Q},TQ=function({primaryType:$,types:J},Q=new Set){const Y=$.match(/^\w*/u)?.[0];if(Q.has(Y)||J[Y]===void 0)return Q;Q.add(Y);for(let W of J[Y])TQ({primaryType:W.type,types:J},Q);return Q},HQ=function({types:$,name:J,type:Q,value:q}){if($[Q]!==void 0)return[{type:"bytes32"},l(SQ({data:q,primaryType:Q,types:$}))];if(Q==="bytes")return q=`0x${(q.length%2?"0":"")+q.slice(2)}`,[{type:"bytes32"},l(q)];if(Q==="string")return[{type:"bytes32"},l(B(q))];if(Q.lastIndexOf("]")===Q.length-1){const Y=Q.slice(0,Q.lastIndexOf("[")),W=q.map((I)=>HQ({name:J,type:Y,types:$,value:I}));return[{type:"bytes32"},l(VJ(W.map(([I])=>I),W.map(([,I])=>I)))]}return[{type:Q},q]};function fQ($){const{domain:J,message:Q,primaryType:q,types:Y}=$,W=(I,X)=>{for(let D of I){const{name:A,type:Z}=D,K=X[A],U=Z.match(zQ);if(U&&(typeof K==="number"||typeof K==="bigint")){const[N,O,V]=U;$$(K,{signed:O==="int",size:Number.parseInt(V)/8})}if(Z==="address"&&typeof K==="string"&&!a(K))throw new o({address:K});const C=Z.match(CQ);if(C){const[N,O]=C;if(O&&b(K)!==Number.parseInt(O))throw new $J({expectedSize:Number.parseInt(O),givenSize:b(K)})}const G=Y[Z];if(G)W(G,K)}};if(Y.EIP712Domain&&J)W(Y.EIP712Domain,J);if(q!=="EIP712Domain"){const I=Y[q];W(I,Q)}}function RQ({domain:$}){return[typeof $?.name==="string"&&{name:"name",type:"string"},$?.version&&{name:"version",type:"string"},typeof $?.chainId==="number"&&{name:"chainId",type:"uint256"},$?.verifyingContract&&{name:"verifyingContract",type:"address"},$?.salt&&{name:"salt",type:"bytes32"}].filter(Boolean)}n();zJ();K$();i();function i$($,J="hex"){const Q=BQ($),q=L0(new Uint8Array(Q.length));if(Q.encode(q),J==="hex")return m(q.bytes);return q.bytes}var BQ=function($){if(Array.isArray($))return GY($.map((J)=>BQ(J)));return ZY($)},GY=function($){const J=$.reduce((Y,W)=>Y+W.length,0),Q=LQ(J);return{length:(()=>{if(J<=55)return 1+J;return 1+Q+J})(),encode(Y){if(J<=55)Y.pushByte(192+J);else if(Y.pushByte(247+Q),Q===1)Y.pushUint8(J);else if(Q===2)Y.pushUint16(J);else if(Q===3)Y.pushUint24(J);else Y.pushUint32(J);for(let{encode:W}of $)W(Y)}}},ZY=function($){const J=typeof $==="string"?Y$($):$,Q=LQ(J.length);return{length:(()=>{if(J.length===1&&J[0]<128)return 1;if(J.length<=55)return 1+J.length;return 1+Q+J.length})(),encode(Y){if(J.length===1&&J[0]<128)Y.pushBytes(J);else if(J.length<=55)Y.pushByte(128+J.length),Y.pushBytes(J);else{if(Y.pushByte(183+Q),Q===1)Y.pushUint8(J.length);else if(Q===2)Y.pushUint16(J.length);else if(Q===3)Y.pushUint24(J.length);else Y.pushUint32(J.length);Y.pushBytes(J)}}}},LQ=function($){if($<256)return 1;if($<65536)return 2;if($<16777216)return 3;if($<4294967296)return 4;throw new z("Length is too large.")};var kQ=`\x19Ethereum Signed Message:
|
|
2
|
-
`;J0();
|
|
1
|
+
var Uq=Object.defineProperty;var wq=($,J)=>{for(var Q in J)Uq($,Q,{get:J[Q],enumerable:!0,configurable:!0,set:(q)=>J[Q]=()=>q})};var f=($,J)=>()=>($&&(J=$($=0)),J);function I$($,{strict:J=!0}={}){if(!$)return!1;if(typeof $!=="string")return!1;return J?/^0x[0-9a-fA-F]*$/.test($):$.startsWith("0x")}var u$=f(()=>{});function b($){if(I$($,{strict:!1}))return Math.ceil(($.length-2)/2);return $.length}var w$=f(()=>{u$()});var G8;var K8=f(()=>{G8="2.11.1"});var N8;var M8=f(()=>{K8();N8=()=>`viem@${G8}`});class C extends Error{constructor($,J={}){super();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,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ViemError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:N8()});const Q=J.cause instanceof C?J.cause.details:J.cause?.message?J.cause.message:J.details,q=J.cause instanceof C?J.cause.docsPath||J.docsPath:J.docsPath;if(this.message=[$||"An error occurred.","",...J.metaMessages?[...J.metaMessages,""]:[],...q?[`Docs: https://viem.sh${q}${J.docsSlug?`#${J.docsSlug}`:""}`]:[],...Q?[`Details: ${Q}`]:[],`Version: ${this.version}`].join("\n"),J.cause)this.cause=J.cause;this.details=Q,this.docsPath=q,this.metaMessages=J.metaMessages,this.shortMessage=$}walk($){return V8(this,$)}}var V8;var i=f(()=>{M8();V8=function($,J){if(J?.($))return $;if($&&typeof $==="object"&&"cause"in $)return V8($.cause,J);return J?null:$}});class t0 extends C{constructor({expectedLength:$,givenLength:J,type:Q}){super([`ABI encoding array length mismatch for type ${Q}.`,`Expected length: ${$}`,`Given length: ${J}`].join("\n"));Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingArrayLengthMismatchError"})}}class a0 extends C{constructor({expectedSize:$,value:J}){super(`Size of bytes "${J}" (bytes${b(J)}) does not match expected size (bytes${$}).`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingBytesSizeMismatchError"})}}class s0 extends C{constructor({expectedLength:$,givenLength:J}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${$}`,`Given length (values): ${J}`].join("\n"));Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingLengthMismatchError"})}}class e0 extends C{constructor({expectedSize:$,givenSize:J}){super(`Expected bytes${$}, got bytes${J}.`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BytesSizeMismatchError"})}}class $J extends C{constructor($,{docsPath:J}){super([`Type "${$}" is not a valid encoding type.`,"Please provide a valid ABI type."].join("\n"),{docsPath:J});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiEncodingType"})}}class JJ extends C{constructor($){super([`Value "${$}" is not a valid array.`].join("\n"));Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidArrayError"})}}var QJ=f(()=>{w$();i()});class N0 extends C{constructor({offset:$,position:J,size:Q}){super(`Slice ${J==="start"?"starting":"ending"} at offset "${$}" is out-of-bounds (size: ${Q}).`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SliceOffsetOutOfBoundsError"})}}class M0 extends C{constructor({size:$,targetSize:J,type:Q}){super(`${Q.charAt(0).toUpperCase()}${Q.slice(1).toLowerCase()} size (${$}) exceeds padding size (${J}).`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeExceedsPaddingSizeError"})}}var qJ=f(()=>{i()});function z$($,{dir:J,size:Q=32}={}){if(typeof $==="string")return G$($,{dir:J,size:Q});return zq($,{dir:J,size:Q})}function G$($,{dir:J,size:Q=32}={}){if(Q===null)return $;const q=$.replace("0x","");if(q.length>Q*2)throw new M0({size:Math.ceil(q.length/2),targetSize:Q,type:"hex"});return`0x${q[J==="right"?"padEnd":"padStart"](Q*2,"0")}`}function zq($,{dir:J,size:Q=32}={}){if(Q===null)return $;if($.length>Q)throw new M0({size:$.length,targetSize:Q,type:"bytes"});const q=new Uint8Array(Q);for(let Y=0;Y<Q;Y++){const W=J==="right";q[W?Y:Q-Y-1]=$[W?Y:$.length-Y-1]}return q}var V0=f(()=>{qJ()});class YJ extends C{constructor({max:$,min:J,signed:Q,size:q,value:Y}){super(`Number "${Y}" is not in safe ${q?`${q*8}-bit ${Q?"signed":"unsigned"} `:""}integer range ${$?`(${J} to ${$})`:`(above ${J})`}`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntegerOutOfRangeError"})}}class WJ extends C{constructor({givenSize:$,maxSize:J}){super(`Size cannot exceed ${J} bytes. Given size: ${$} bytes.`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeOverflowError"})}}var DJ=f(()=>{i()});function XJ($,{dir:J="left"}={}){let Q=typeof $==="string"?$.replace("0x",""):$,q=0;for(let Y=0;Y<Q.length-1;Y++)if(Q[J==="left"?Y:Q.length-Y-1].toString()==="0")q++;else break;if(Q=J==="left"?Q.slice(q):Q.slice(0,Q.length-q),typeof $==="string"){if(Q.length===1&&J==="right")Q=`${Q}0`;return`0x${Q.length%2===1?`0${Q}`:Q}`}return Q}var O8=f(()=>{});function C$($,{size:J}){if(b($)>J)throw new WJ({givenSize:b($),maxSize:J})}function O0($,J={}){const{signed:Q}=J;if(J.size)C$($,{size:J.size});const q=BigInt($);if(!Q)return q;const Y=($.length-2)/2,W=(1n<<BigInt(Y)*8n-1n)-1n;if(q<=W)return q;return q-BigInt(`0x${"f".padStart(Y*2,"f")}`)-1n}function U8($,J={}){return Number(O0($,J))}var r$=f(()=>{DJ();w$()});function B($,J={}){if(typeof $==="number"||typeof $==="bigint")return J$($,J);if(typeof $==="string")return w0($,J);if(typeof $==="boolean")return U0($,J);return d($,J)}function U0($,J={}){const Q=`0x${Number($)}`;if(typeof J.size==="number")return C$(Q,{size:J.size}),z$(Q,{size:J.size});return Q}function d($,J={}){let Q="";for(let Y=0;Y<$.length;Y++)Q+=Cq[$[Y]];const q=`0x${Q}`;if(typeof J.size==="number")return C$(q,{size:J.size}),z$(q,{dir:"right",size:J.size});return q}function J$($,J={}){const{signed:Q,size:q}=J,Y=BigInt($);let W;if(q)if(Q)W=(1n<<BigInt(q)*8n-1n)-1n;else W=2n**(BigInt(q)*8n)-1n;else if(typeof $==="number")W=BigInt(Number.MAX_SAFE_INTEGER);const D=typeof W==="bigint"&&Q?-W-1n:0;if(W&&Y>W||Y<D){const A=typeof $==="bigint"?"n":"";throw new YJ({max:W?`${W}${A}`:void 0,min:`${D}${A}`,signed:Q,size:q,value:`${$}${A}`})}const X=`0x${(Q&&Y<0?(1n<<BigInt(q*8))+BigInt(Y):Y).toString(16)}`;if(q)return z$(X,{size:q});return X}function w0($,J={}){const Q=jq.encode($);return d(Q,J)}var Cq,jq;var o=f(()=>{DJ();V0();r$();Cq=Array.from({length:256},($,J)=>J.toString(16).padStart(2,"0")),jq=new TextEncoder});function h$($,J={}){if(typeof $==="number"||typeof $==="bigint")return Hq($,J);if(typeof $==="boolean")return Tq($,J);if(I$($))return W$($,J);return l$($,J)}function Tq($,J={}){const Q=new Uint8Array(1);if(Q[0]=Number($),typeof J.size==="number")return C$(Q,{size:J.size}),z$(Q,{size:J.size});return Q}function W$($,J={}){let Q=$;if(J.size)C$(Q,{size:J.size}),Q=z$(Q,{dir:"right",size:J.size});let q=Q.slice(2);if(q.length%2)q=`0${q}`;const Y=q.length/2,W=new Uint8Array(Y);for(let D=0,X=0;D<Y;D++){const A=w8(q.charCodeAt(X++)),I=w8(q.charCodeAt(X++));if(A===void 0||I===void 0)throw new C(`Invalid byte sequence ("${q[X-2]}${q[X-1]}" in "${q}").`);W[D]=A*16+I}return W}function Hq($,J){const Q=J$($,J);return W$(Q)}function l$($,J={}){const Q=Eq.encode($);if(typeof J.size==="number")return C$(Q,{size:J.size}),z$(Q,{dir:"right",size:J.size});return Q}var w8,Eq,K$;var N$=f(()=>{i();u$();V0();r$();o();w8=function($){if($>=K$.zero&&$<=K$.nine)return $-K$.zero;if($>=K$.A&&$<=K$.F)return $-(K$.A-10);if($>=K$.a&&$<=K$.f)return $-(K$.a-10);return};Eq=new TextEncoder,K$={zero:48,nine:57,A:65,F:70,a:97,f:102}});var t$,a$,z8,M$,z0;var C0=f(()=>{t$=function($){if(!Number.isSafeInteger($)||$<0)throw new Error(`Wrong positive integer: ${$}`)},a$=function($,...J){if(!($ instanceof Uint8Array))throw new Error("Expected Uint8Array");if(J.length>0&&!J.includes($.length))throw new Error(`Expected Uint8Array of length ${J}, not of length=${$.length}`)},z8=function($){if(typeof $!=="function"||typeof $.create!=="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");t$($.outputLen),t$($.blockLen)},M$=function($,J=!0){if($.destroyed)throw new Error("Hash instance has been destroyed");if(J&&$.finished)throw new Error("Hash#digest() has already been called")},z0=function($,J){a$($);const Q=J.outputLen;if($.length<Q)throw new Error(`digestInto() expects output buffer of length at least ${Q}`)}});var Sq,j8,j0,C8,E8,T8,H8,S8;var f8=f(()=>{Sq=function($,J=!1){if(J)return{h:Number($&j0),l:Number($>>C8&j0)};return{h:Number($>>C8&j0)|0,l:Number($&j0)|0}},j8=function($,J=!1){let Q=new Uint32Array($.length),q=new Uint32Array($.length);for(let Y=0;Y<$.length;Y++){const{h:W,l:D}=Sq($[Y],J);[Q[Y],q[Y]]=[W,D]}return[Q,q]},j0=BigInt(4294967295),C8=BigInt(32),E8=($,J,Q)=>$<<Q|J>>>32-Q,T8=($,J,Q)=>J<<Q|$>>>32-Q,H8=($,J,Q)=>J<<Q-32|$>>>64-Q,S8=($,J,Q)=>$<<Q-32|J>>>64-Q});var E0;var R8=f(()=>{E0=typeof globalThis==="object"&&"crypto"in globalThis?globalThis.crypto:void 0});function Rq($){if(typeof $!=="string")throw new Error(`utf8ToBytes expected string, got ${typeof $}`);return new Uint8Array((new TextEncoder()).encode($))}function B$($){if(typeof $==="string")$=Rq($);if(!B8($))throw new Error(`expected Uint8Array, got ${typeof $}`);return $}function k8(...$){const J=new Uint8Array($.reduce((q,Y)=>q+Y.length,0));let Q=0;return $.forEach((q)=>{if(!B8(q))throw new Error("Uint8Array expected");J.set(q,Q),Q+=q.length}),J}function H0($){const J=(q)=>$().update(B$(q)).digest(),Q=$();return J.outputLen=Q.outputLen,J.blockLen=Q.blockLen,J.create=()=>$(),J}function _8($=32){if(E0&&typeof E0.getRandomValues==="function")return E0.getRandomValues(new Uint8Array($));throw new Error("crypto.getRandomValues must be defined")}class L${clone(){return this._cloneInto()}}var B8,L8,T0,D$,fq,n9;var c$=f(()=>{R8();/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */B8=($)=>$ instanceof Uint8Array,L8=($)=>new Uint32Array($.buffer,$.byteOffset,Math.floor($.byteLength/4)),T0=($)=>new DataView($.buffer,$.byteOffset,$.byteLength),D$=($,J)=>$<<32-J|$>>>J,fq=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!fq)throw new Error("Non little-endian hardware is not supported");n9={}.toString});function bq($,J=24){const Q=new Uint32Array(10);for(let q=24-J;q<24;q++){for(let D=0;D<10;D++)Q[D]=$[D]^$[D+10]^$[D+20]^$[D+30]^$[D+40];for(let D=0;D<10;D+=2){const X=(D+8)%10,A=(D+2)%10,I=Q[A],G=Q[A+1],K=P8(I,G,1)^Q[X],U=x8(I,G,1)^Q[X+1];for(let z=0;z<50;z+=10)$[D+z]^=K,$[D+z+1]^=U}let Y=$[2],W=$[3];for(let D=0;D<24;D++){const X=b8[D],A=P8(Y,W,X),I=x8(Y,W,X),G=F8[D];Y=$[G],W=$[G+1],$[G]=A,$[G+1]=I}for(let D=0;D<50;D+=10){for(let X=0;X<10;X++)Q[X]=$[D+X];for(let X=0;X<10;X++)$[D+X]^=~Q[(X+2)%10]&Q[(X+4)%10]}$[0]^=xq[q],$[1]^=Fq[q]}Q.fill(0)}class AJ extends L${constructor($,J,Q,q=!1,Y=24){super();if(this.blockLen=$,this.suffix=J,this.outputLen=Q,this.enableXOF=q,this.rounds=Y,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,t$(Q),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=L8(this.state)}keccak(){bq(this.state32,this.rounds),this.posOut=0,this.pos=0}update($){M$(this);const{blockLen:J,state:Q}=this;$=B$($);const q=$.length;for(let Y=0;Y<q;){const W=Math.min(J-this.pos,q-Y);for(let D=0;D<W;D++)Q[this.pos++]^=$[Y++];if(this.pos===J)this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:$,suffix:J,pos:Q,blockLen:q}=this;if($[Q]^=J,(J&128)!==0&&Q===q-1)this.keccak();$[q-1]^=128,this.keccak()}writeInto($){M$(this,!1),a$($),this.finish();const J=this.state,{blockLen:Q}=this;for(let q=0,Y=$.length;q<Y;){if(this.posOut>=Q)this.keccak();const W=Math.min(Q-this.posOut,Y-q);$.set(J.subarray(this.posOut,this.posOut+W),q),this.posOut+=W,q+=W}return $}xofInto($){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto($)}xof($){return t$($),this.xofInto(new Uint8Array($))}digestInto($){if(z0($,this),this.finished)throw new Error("digest() was already called");return this.writeInto($),this.destroy(),$}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto($){const{blockLen:J,suffix:Q,outputLen:q,rounds:Y,enableXOF:W}=this;return $||($=new AJ(J,Q,q,W,Y)),$.state32.set(this.state32),$.pos=this.pos,$.posOut=this.posOut,$.finished=this.finished,$.rounds=Y,$.suffix=Q,$.outputLen=q,$.enableXOF=W,$.destroyed=this.destroyed,$}}var F8,b8,v8,Bq,s$,Lq,kq,_q,Pq,xq,Fq,P8,x8,vq,g8;var y8=f(()=>{C0();f8();c$();[F8,b8,v8]=[[],[],[]],Bq=BigInt(0),s$=BigInt(1),Lq=BigInt(2),kq=BigInt(7),_q=BigInt(256),Pq=BigInt(113);for(let $=0,J=s$,Q=1,q=0;$<24;$++){[Q,q]=[q,(2*Q+3*q)%5],F8.push(2*(5*q+Q)),b8.push(($+1)*($+2)/2%64);let Y=Bq;for(let W=0;W<7;W++)if(J=(J<<s$^(J>>kq)*Pq)%_q,J&Lq)Y^=s$<<(s$<<BigInt(W))-s$;v8.push(Y)}[xq,Fq]=j8(v8,!0),P8=($,J,Q)=>Q>32?H8($,J,Q):E8($,J,Q),x8=($,J,Q)=>Q>32?S8($,J,Q):T8($,J,Q);vq=($,J,Q)=>H0(()=>new AJ(J,$,Q)),g8=vq(1,136,32)});function c($,J){const Q=J||"hex",q=g8(I$($,{strict:!1})?h$($):$);if(Q==="bytes")return q;return B(q)}var m$=f(()=>{y8();u$();N$();o()});class r extends C{constructor({address:$}){super(`Address "${$}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAddressError"})}}var d$=f(()=>{i()});class e$ extends Map{constructor($){super();Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=$}set($,J){if(super.set($,J),this.maxSize&&this.size>this.maxSize)this.delete(this.keys().next().value);return this}}var IJ=f(()=>{});function S0($,J){if(ZJ.has(`${$}.${J}`))return ZJ.get(`${$}.${J}`);const Q=J?`${J}${$.toLowerCase()}`:$.substring(2).toLowerCase(),q=c(l$(Q),"bytes"),Y=(J?Q.substring(`${J}0x`.length):Q).split("");for(let D=0;D<40;D+=2){if(q[D>>1]>>4>=8&&Y[D])Y[D]=Y[D].toUpperCase();if((q[D>>1]&15)>=8&&Y[D+1])Y[D+1]=Y[D+1].toUpperCase()}const W=`0x${Y.join("")}`;return ZJ.set(`${$}.${J}`,W),W}var ZJ;var GJ=f(()=>{N$();m$();IJ();ZJ=new e$(8192)});function s($,J){const{strict:Q=!0}=J??{};if(KJ.has($))return KJ.get($);const q=(()=>{if(!gq.test($))return!1;if($.toLowerCase()===$)return!0;if(Q)return S0($)===$;return!0})();return KJ.set($,q),q}var gq,KJ;var p$=f(()=>{IJ();GJ();gq=/^0x[a-fA-F0-9]{40}$/,KJ=new e$(8192)});function X$($){if(typeof $[0]==="string")return $0($);return yq($)}function yq($){let J=0;for(let Y of $)J+=Y.length;const Q=new Uint8Array(J);let q=0;for(let Y of $)Q.set(Y,q),q+=Y.length;return Q}function $0($){return`0x${$.reduce((J,Q)=>J+Q.replace("0x",""),"")}`}var J0=f(()=>{});function f0($,J,Q,{strict:q}={}){if(I$($,{strict:!1}))return hq($,J,Q,{strict:q});return uq($,J,Q,{strict:q})}function uq($,J,Q,{strict:q}={}){u8($,J);const Y=$.slice(J,Q);if(q)h8(Y,J,Q);return Y}function hq($,J,Q,{strict:q}={}){u8($,J);const Y=`0x${$.replace("0x","").slice((J??0)*2,(Q??$.length)*2)}`;if(q)h8(Y,J,Q);return Y}var u8,h8;var NJ=f(()=>{qJ();u$();w$();u8=function($,J){if(typeof J==="number"&&J>0&&J>b($)-1)throw new N0({offset:J,position:"start",size:b($)})},h8=function($,J,Q){if(typeof J==="number"&&typeof Q==="number"&&b($)!==Q-J)throw new N0({offset:Q,position:"end",size:b($)})}});function MJ($,J){if($.length!==J.length)throw new s0({expectedLength:$.length,givenLength:J.length});const Q=lq({params:$,values:J}),q=OJ(Q);if(q.length===0)return"0x";return q}function rq($){const J=$.match(/^(.*)\[(\d+)?\]$/);return J?[J[2]?Number(J[2]):null,J[1]]:void 0}var lq,VJ,OJ,cq,mq,dq,pq,nq,iq,oq;var l8=f(()=>{QJ();d$();i();p$();J0();V0();w$();NJ();o();lq=function({params:$,values:J}){const Q=[];for(let q=0;q<$.length;q++)Q.push(VJ({param:$[q],value:J[q]}));return Q},VJ=function({param:$,value:J}){const Q=rq($.type);if(Q){const[q,Y]=Q;return mq(J,{length:q,param:{...$,type:Y}})}if($.type==="tuple")return oq(J,{param:$});if($.type==="address")return cq(J);if($.type==="bool")return pq(J);if($.type.startsWith("uint")||$.type.startsWith("int")){const q=$.type.startsWith("int");return nq(J,{signed:q})}if($.type.startsWith("bytes"))return dq(J,{param:$});if($.type==="string")return iq(J);throw new $J($.type,{docsPath:"/docs/contract/encodeAbiParameters"})},OJ=function($){let J=0;for(let W=0;W<$.length;W++){const{dynamic:D,encoded:X}=$[W];if(D)J+=32;else J+=b(X)}const Q=[],q=[];let Y=0;for(let W=0;W<$.length;W++){const{dynamic:D,encoded:X}=$[W];if(D)Q.push(J$(J+Y,{size:32})),q.push(X),Y+=b(X);else Q.push(X)}return X$([...Q,...q])},cq=function($){if(!s($))throw new r({address:$});return{dynamic:!1,encoded:G$($.toLowerCase())}},mq=function($,{length:J,param:Q}){const q=J===null;if(!Array.isArray($))throw new JJ($);if(!q&&$.length!==J)throw new t0({expectedLength:J,givenLength:$.length,type:`${Q.type}[${J}]`});let Y=!1;const W=[];for(let D=0;D<$.length;D++){const X=VJ({param:Q,value:$[D]});if(X.dynamic)Y=!0;W.push(X)}if(q||Y){const D=OJ(W);if(q){const X=J$(W.length,{size:32});return{dynamic:!0,encoded:W.length>0?X$([X,D]):X}}if(Y)return{dynamic:!0,encoded:D}}return{dynamic:!1,encoded:X$(W.map(({encoded:D})=>D))}},dq=function($,{param:J}){const[,Q]=J.type.split("bytes"),q=b($);if(!Q){let Y=$;if(q%32!==0)Y=G$(Y,{dir:"right",size:Math.ceil(($.length-2)/2/32)*32});return{dynamic:!0,encoded:X$([G$(J$(q,{size:32})),Y])}}if(q!==Number.parseInt(Q))throw new a0({expectedSize:Number.parseInt(Q),value:$});return{dynamic:!1,encoded:G$($,{dir:"right"})}},pq=function($){if(typeof $!=="boolean")throw new C(`Invalid boolean value: "${$}" (type: ${typeof $}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:G$(U0($))}},nq=function($,{signed:J}){return{dynamic:!1,encoded:J$($,{size:32,signed:J})}},iq=function($){const J=w0($),Q=Math.ceil(b(J)/32),q=[];for(let Y=0;Y<Q;Y++)q.push(G$(f0(J,Y*32,(Y+1)*32),{dir:"right"}));return{dynamic:!0,encoded:X$([G$(J$(b(J),{size:32})),...q])}},oq=function($,{param:J}){let Q=!1;const q=[];for(let Y=0;Y<J.components.length;Y++){const W=J.components[Y],D=Array.isArray($)?Y:W.name,X=VJ({param:W,value:$[D]});if(q.push(X),X.dynamic)Q=!0}return{dynamic:Q,encoded:Q?OJ(q):X$(q.map(({encoded:Y})=>Y))}}});class R0 extends C{constructor({offset:$}){super(`Offset \`${$}\` cannot be negative.`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NegativeOffsetError"})}}class UJ extends C{constructor({length:$,position:J}){super(`Position \`${J}\` is out of bounds (\`0 < position < ${$}\`).`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PositionOutOfBoundsError"})}}class wJ extends C{constructor({count:$,limit:J}){super(`Recursive read limit of \`${J}\` exceeded (recursive read count: \`${$}\`).`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RecursiveReadLimitExceededError"})}}var c8=f(()=>{i()});function B0($,{recursiveReadLimit:J=8192}={}){const Q=Object.create(tq);return Q.bytes=$,Q.dataView=new DataView($.buffer,$.byteOffset,$.byteLength),Q.positionReadCount=new Map,Q.recursiveReadLimit=J,Q}var tq;var zJ=f(()=>{c8();tq={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 wJ({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition($){if($<0||$>this.bytes.length-1)throw new UJ({length:this.bytes.length,position:$})},decrementPosition($){if($<0)throw new R0({offset:$});const J=this.position-$;this.assertPosition(J),this.position=J},getReadCount($){return this.positionReadCount.get($||this.position)||0},incrementPosition($){if($<0)throw new R0({offset:$});const J=this.position+$;this.assertPosition(J),this.position=J},inspectByte($){const J=$??this.position;return this.assertPosition(J),this.bytes[J]},inspectBytes($,J){const Q=J??this.position;return this.assertPosition(Q+$-1),this.bytes.subarray(Q,Q+$)},inspectUint8($){const J=$??this.position;return this.assertPosition(J),this.bytes[J]},inspectUint16($){const J=$??this.position;return this.assertPosition(J+1),this.dataView.getUint16(J)},inspectUint24($){const J=$??this.position;return this.assertPosition(J+2),(this.dataView.getUint16(J)<<8)+this.dataView.getUint8(J+2)},inspectUint32($){const J=$??this.position;return this.assertPosition(J+3),this.dataView.getUint32(J)},pushByte($){this.assertPosition(this.position),this.bytes[this.position]=$,this.position++},pushBytes($){this.assertPosition(this.position+$.length-1),this.bytes.set($,this.position),this.position+=$.length},pushUint8($){this.assertPosition(this.position),this.bytes[this.position]=$,this.position++},pushUint16($){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,$),this.position+=2},pushUint24($){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,$>>8),this.dataView.setUint8(this.position+2,$&~4294967040),this.position+=3},pushUint32($){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,$),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const $=this.inspectByte();return this.position++,$},readBytes($,J){this.assertReadLimit(),this._touch();const Q=this.inspectBytes($);return this.position+=J??$,Q},readUint8(){this.assertReadLimit(),this._touch();const $=this.inspectUint8();return this.position+=1,$},readUint16(){this.assertReadLimit(),this._touch();const $=this.inspectUint16();return this.position+=2,$},readUint24(){this.assertReadLimit(),this._touch();const $=this.inspectUint24();return this.position+=3,$},readUint32(){this.assertReadLimit(),this._touch();const $=this.inspectUint32();return this.position+=4,$},get remaining(){return this.bytes.length-this.position},setPosition($){const J=this.position;return this.assertPosition($),this.position=$,()=>this.position=J},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const $=this.getReadCount();if(this.positionReadCount.set(this.position,$+1),$>0)this.recursiveReadCount++}}});var m8;var d8=f(()=>{m8={ether:-9,wei:9}});function p8($,J){let Q=$.toString();const q=Q.startsWith("-");if(q)Q=Q.slice(1);Q=Q.padStart(J,"0");let[Y,W]=[Q.slice(0,Q.length-J),Q.slice(Q.length-J)];return W=W.replace(/(0+)$/,""),`${q?"-":""}${Y||"0"}${W?`.${W}`:""}`}var n8=f(()=>{});function Q0($,J="wei"){return p8($,m8[J])}var i8=f(()=>{d8();n8()});function aq($){const J=Object.entries($).map(([q,Y])=>{if(Y===void 0||Y===!1)return null;return[q,Y]}).filter(Boolean),Q=J.reduce((q,[Y])=>Math.max(q,Y.length),0);return J.map(([q,Y])=>` ${`${q}:`.padEnd(Q+1)} ${Y}`).join("\n")}class CJ extends C{constructor({v:$}){super(`Invalid \`v\` value "${$}". Expected 27 or 28.`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidLegacyVError"})}}class jJ extends C{constructor({transaction:$}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",aq($),"}","","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","- a Legacy Transaction with `gasPrice`"]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSerializableTransactionError"})}}class EJ extends C{constructor({storageKey:$}){super(`Size for storage key "${$}" is invalid. Expected 32 bytes. Got ${Math.floor(($.length-2)/2)} bytes.`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStorageKeySizeError"})}}var L0=f(()=>{i()});class TJ extends C{constructor({cause:$,message:J}={}){const Q=J?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${Q?`with reason: ${Q}`:"for an unknown reason"}.`,{cause:$});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ExecutionRevertedError"})}}class n$ extends C{constructor({cause:$,maxFeePerGas:J}={}){super(`The fee cap (\`maxFeePerGas\`${J?` = ${Q0(J)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:$});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooHigh"})}}class o8 extends C{constructor({cause:$,maxFeePerGas:J}={}){super(`The fee cap (\`maxFeePerGas\`${J?` = ${Q0(J)}`:""} gwei) cannot be lower than the block base fee.`,{cause:$});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooLow"})}}class r8 extends C{constructor({cause:$,nonce:J}={}){super(`Nonce provided for the transaction ${J?`(${J}) `:""}is higher than the next one expected.`,{cause:$});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooHighError"})}}class t8 extends C{constructor({cause:$,nonce:J}={}){super([`Nonce provided for the transaction ${J?`(${J}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join("\n"),{cause:$});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooLowError"})}}class a8 extends C{constructor({cause:$,nonce:J}={}){super(`Nonce provided for the transaction ${J?`(${J}) `:""}exceeds the maximum allowed nonce.`,{cause:$});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceMaxValueError"})}}class s8 extends C{constructor({cause:$}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join("\n"),{cause:$,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."]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InsufficientFundsError"})}}class e8 extends C{constructor({cause:$,gas:J}={}){super(`The amount of gas ${J?`(${J}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:$});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooHighError"})}}class $Q extends C{constructor({cause:$,gas:J}={}){super(`The amount of gas ${J?`(${J}) `:""}provided for the transaction is too low.`,{cause:$});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooLowError"})}}class JQ extends C{constructor({cause:$}){super("The transaction type is not supported for this chain.",{cause:$});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionTypeNotSupportedError"})}}class k0 extends C{constructor({cause:$,maxPriorityFeePerGas:J,maxFeePerGas:Q}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${J?` = ${Q0(J)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${Q?` = ${Q0(Q)} gwei`:""}).`].join("\n"),{cause:$});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TipAboveFeeCapError"})}}var QQ=f(()=>{i8();i();Object.defineProperty(TJ,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(TJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});Object.defineProperty(n$,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});Object.defineProperty(o8,"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/});Object.defineProperty(r8,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});Object.defineProperty(t8,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});Object.defineProperty(a8,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});Object.defineProperty(s8,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds/});Object.defineProperty(e8,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});Object.defineProperty($Q,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});Object.defineProperty(JQ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});Object.defineProperty(k0,"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 HJ extends L${constructor($,J,Q,q){super();this.blockLen=$,this.outputLen=J,this.padOffset=Q,this.isLE=q,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array($),this.view=T0(this.buffer)}update($){M$(this);const{view:J,buffer:Q,blockLen:q}=this;$=B$($);const Y=$.length;for(let W=0;W<Y;){const D=Math.min(q-this.pos,Y-W);if(D===q){const X=T0($);for(;q<=Y-W;W+=q)this.process(X,W);continue}if(Q.set($.subarray(W,W+D),this.pos),this.pos+=D,W+=D,this.pos===q)this.process(J,0),this.pos=0}return this.length+=$.length,this.roundClean(),this}digestInto($){M$(this),z0($,this),this.finished=!0;const{buffer:J,view:Q,blockLen:q,isLE:Y}=this;let{pos:W}=this;if(J[W++]=128,this.buffer.subarray(W).fill(0),this.padOffset>q-W)this.process(Q,0),W=0;for(let G=W;G<q;G++)J[G]=0;sq(Q,q-8,BigInt(this.length*8),Y),this.process(Q,0);const D=T0($),X=this.outputLen;if(X%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const A=X/4,I=this.get();if(A>I.length)throw new Error("_sha2: outputLen bigger than state");for(let G=0;G<A;G++)D.setUint32(4*G,I[G],Y)}digest(){const{buffer:$,outputLen:J}=this;this.digestInto($);const Q=$.slice(0,J);return this.destroy(),Q}_cloneInto($){$||($=new this.constructor),$.set(...this.get());const{blockLen:J,buffer:Q,length:q,finished:Y,destroyed:W,pos:D}=this;if($.length=q,$.pos=D,$.finished=Y,$.destroyed=W,q%J)$.buffer.set(Q);return $}}var sq;var qQ=f(()=>{C0();c$();sq=function($,J,Q,q){if(typeof $.setBigUint64==="function")return $.setBigUint64(J,Q,q);const Y=BigInt(32),W=BigInt(4294967295),D=Number(Q>>Y&W),X=Number(Q&W),A=q?4:0,I=q?0:4;$.setUint32(J+A,D,q),$.setUint32(J+I,X,q)}});class YQ extends HJ{constructor(){super(64,32,8,!1);this.A=j$[0]|0,this.B=j$[1]|0,this.C=j$[2]|0,this.D=j$[3]|0,this.E=j$[4]|0,this.F=j$[5]|0,this.G=j$[6]|0,this.H=j$[7]|0}get(){const{A:$,B:J,C:Q,D:q,E:Y,F:W,G:D,H:X}=this;return[$,J,Q,q,Y,W,D,X]}set($,J,Q,q,Y,W,D,X){this.A=$|0,this.B=J|0,this.C=Q|0,this.D=q|0,this.E=Y|0,this.F=W|0,this.G=D|0,this.H=X|0}process($,J){for(let G=0;G<16;G++,J+=4)E$[G]=$.getUint32(J,!1);for(let G=16;G<64;G++){const K=E$[G-15],U=E$[G-2],z=D$(K,7)^D$(K,18)^K>>>3,Z=D$(U,17)^D$(U,19)^U>>>10;E$[G]=Z+E$[G-7]+z+E$[G-16]|0}let{A:Q,B:q,C:Y,D:W,E:D,F:X,G:A,H:I}=this;for(let G=0;G<64;G++){const K=D$(D,6)^D$(D,11)^D$(D,25),U=I+K+eq(D,X,A)+JY[G]+E$[G]|0,Z=(D$(Q,2)^D$(Q,13)^D$(Q,22))+$Y(Q,q,Y)|0;I=A,A=X,X=D,D=W+U|0,W=Y,Y=q,q=Q,Q=U+Z|0}Q=Q+this.A|0,q=q+this.B|0,Y=Y+this.C|0,W=W+this.D|0,D=D+this.E|0,X=X+this.F|0,A=A+this.G|0,I=I+this.H|0,this.set(Q,q,Y,W,D,X,A,I)}roundClean(){E$.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}var eq,$Y,JY,j$,E$,x0;var SJ=f(()=>{qQ();c$();eq=($,J,Q)=>$&J^~$&Q,$Y=($,J,Q)=>$&J^$&Q^J&Q,JY=new Uint32Array([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]),j$=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),E$=new Uint32Array(64);x0=H0(()=>new YQ)});class Y0 extends C{constructor({chainId:$}){super(typeof $==="number"?`Chain ID "${$}" is invalid.`:"Chain ID is invalid.");Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidChainIdError"})}}var MQ=f(()=>{i()});var yJ={};wq(yJ,{validateObject:()=>{{return H$}},utf8ToBytes:()=>{{return MY}},numberToVarBytesBE:()=>{{return KY}},numberToHexUnpadded:()=>{{return PQ}},numberToBytesLE:()=>{{return h0}},numberToBytesBE:()=>{{return T$}},hexToNumber:()=>{{return vJ}},hexToBytes:()=>{{return _$}},equalBytes:()=>{{return NY}},ensureBytes:()=>{{return e}},createHmacDrbg:()=>{{return gJ}},concatBytes:()=>{{return o$}},bytesToNumberLE:()=>{{return u0}},bytesToNumberBE:()=>{{return V$}},bytesToHex:()=>{{return k$}},bitSet:()=>{{return UY}},bitMask:()=>{{return W0}},bitLen:()=>{{return VY}},bitGet:()=>{{return OY}}});function k$($){if(!y0($))throw new Error("Uint8Array expected");let J="";for(let Q=0;Q<$.length;Q++)J+=GY[$[Q]];return J}function PQ($){const J=$.toString(16);return J.length&1?`0${J}`:J}function vJ($){if(typeof $!=="string")throw new Error("hex string expected, got "+typeof $);return BigInt($===""?"0":`0x${$}`)}function _$($){if(typeof $!=="string")throw new Error("hex string expected, got "+typeof $);const J=$.length;if(J%2)throw new Error("padded hex string expected, got unpadded hex of length "+J);const Q=new Uint8Array(J/2);for(let q=0;q<Q.length;q++){const Y=q*2,W=$.slice(Y,Y+2),D=Number.parseInt(W,16);if(Number.isNaN(D)||D<0)throw new Error("Invalid byte sequence");Q[q]=D}return Q}function V$($){return vJ(k$($))}function u0($){if(!y0($))throw new Error("Uint8Array expected");return vJ(k$(Uint8Array.from($).reverse()))}function T$($,J){return _$($.toString(16).padStart(J*2,"0"))}function h0($,J){return T$($,J).reverse()}function KY($){return _$(PQ($))}function e($,J,Q){let q;if(typeof J==="string")try{q=_$(J)}catch(W){throw new Error(`${$} must be valid hex string, got "${J}". Cause: ${W}`)}else if(y0(J))q=Uint8Array.from(J);else throw new Error(`${$} must be hex string or Uint8Array`);const Y=q.length;if(typeof Q==="number"&&Y!==Q)throw new Error(`${$} expected ${Q} bytes, got ${Y}`);return q}function o$(...$){const J=new Uint8Array($.reduce((q,Y)=>q+Y.length,0));let Q=0;return $.forEach((q)=>{if(!y0(q))throw new Error("Uint8Array expected");J.set(q,Q),Q+=q.length}),J}function NY($,J){if($.length!==J.length)return!1;for(let Q=0;Q<$.length;Q++)if($[Q]!==J[Q])return!1;return!0}function MY($){if(typeof $!=="string")throw new Error(`utf8ToBytes expected string, got ${typeof $}`);return new Uint8Array((new TextEncoder()).encode($))}function VY($){let J;for(J=0;$>_Q;$>>=g0,J+=1);return J}function OY($,J){return $>>BigInt(J)&g0}function gJ($,J,Q){if(typeof $!=="number"||$<2)throw new Error("hashLen must be a number");if(typeof J!=="number"||J<2)throw new Error("qByteLen must be a number");if(typeof Q!=="function")throw new Error("hmacFn must be a function");let q=bJ($),Y=bJ($),W=0;const D=()=>{q.fill(1),Y.fill(0),W=0},X=(...K)=>Q(Y,q,...K),A=(K=bJ())=>{if(Y=X(kQ([0]),K),q=X(),K.length===0)return;Y=X(kQ([1]),K),q=X()},I=()=>{if(W++>=1000)throw new Error("drbg: tried 1000 values");let K=0;const U=[];while(K<J){q=X();const z=q.slice();U.push(z),K+=q.length}return o$(...U)};return(K,U)=>{D(),A(K);let z=void 0;while(!(z=U(I())))A();return D(),z}}function H$($,J,Q={}){const q=(Y,W,D)=>{const X=wY[W];if(typeof X!=="function")throw new Error(`Invalid validator "${W}", expected function`);const A=$[Y];if(D&&A===void 0)return;if(!X(A,$))throw new Error(`Invalid param ${String(Y)}=${A} (${typeof A}), expected ${W}`)};for(let[Y,W]of Object.entries(J))q(Y,W,!1);for(let[Y,W]of Object.entries(Q))q(Y,W,!0);return $}var _Q,g0,ZY,y0,GY,UY,W0,bJ,kQ,wY;var D0=f(()=>{/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */_Q=BigInt(0),g0=BigInt(1),ZY=BigInt(2),y0=($)=>$ instanceof Uint8Array,GY=Array.from({length:256},($,J)=>J.toString(16).padStart(2,"0")),UY=($,J,Q)=>{return $|(Q?g0:_Q)<<BigInt(J)},W0=($)=>(ZY<<BigInt($-1))-g0,bJ=($)=>new Uint8Array($),kQ=($)=>Uint8Array.from($),wY={bigint:($)=>typeof $==="bigint",function:($)=>typeof $==="function",boolean:($)=>typeof $==="boolean",string:($)=>typeof $==="string",stringOrUint8Array:($)=>typeof $==="string"||$ instanceof Uint8Array,isSafeInteger:($)=>Number.isSafeInteger($),array:($)=>Array.isArray($),field:($,J)=>J.Fp.isValid($),hash:($)=>typeof $==="function"&&Number.isSafeInteger($.outputLen)}});function m($,J){const Q=$%J;return Q>=u?Q:J+Q}function EY($,J,Q){if(Q<=u||J<u)throw new Error("Expected power/modulo > 0");if(Q===v)return u;let q=v;while(J>u){if(J&v)q=q*$%Q;$=$*$%Q,J>>=v}return q}function $$($,J,Q){let q=$;while(J-- >u)q*=q,q%=Q;return q}function l0($,J){if($===u||J<=u)throw new Error(`invert: expected positive integers, got n=${$} mod=${J}`);let Q=m($,J),q=J,Y=u,W=v,D=v,X=u;while(Q!==u){const I=q/Q,G=q%Q,K=Y-D*I,U=W-X*I;q=Q,Q=G,Y=D,W=X,D=K,X=U}if(q!==v)throw new Error("invert: does not exist");return m(Y,J)}function TY($){const J=($-v)/P$;let Q,q,Y;for(Q=$-v,q=0;Q%P$===u;Q/=P$,q++);for(Y=P$;Y<$&&EY(Y,J,$)!==$-v;Y++);if(q===1){const D=($+v)/uJ;return function X(A,I){const G=A.pow(I,D);if(!A.eql(A.sqr(G),I))throw new Error("Cannot find square root");return G}}const W=(Q+v)/P$;return function D(X,A){if(X.pow(A,J)===X.neg(X.ONE))throw new Error("Cannot find square root");let I=q,G=X.pow(X.mul(X.ONE,Y),Q),K=X.pow(A,W),U=X.pow(A,Q);while(!X.eql(U,X.ONE)){if(X.eql(U,X.ZERO))return X.ZERO;let z=1;for(let N=X.sqr(U);z<I;z++){if(X.eql(N,X.ONE))break;N=X.sqr(N)}const Z=X.pow(G,v<<BigInt(I-z-1));G=X.sqr(Z),K=X.mul(K,Z),U=X.mul(U,G),I=z}return K}}function HY($){if($%uJ===zY){const J=($+v)/uJ;return function Q(q,Y){const W=q.pow(Y,J);if(!q.eql(q.sqr(W),Y))throw new Error("Cannot find square root");return W}}if($%FQ===xQ){const J=($-xQ)/FQ;return function Q(q,Y){const W=q.mul(Y,P$),D=q.pow(W,J),X=q.mul(Y,D),A=q.mul(q.mul(X,P$),D),I=q.mul(X,q.sub(A,q.ONE));if(!q.eql(q.sqr(I),Y))throw new Error("Cannot find square root");return I}}if($%jY===CY);return TY($)}function hJ($){const J={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},Q=SY.reduce((q,Y)=>{return q[Y]="function",q},J);return H$($,Q)}function fY($,J,Q){if(Q<u)throw new Error("Expected power > 0");if(Q===u)return $.ONE;if(Q===v)return J;let q=$.ONE,Y=J;while(Q>u){if(Q&v)q=$.mul(q,Y);Y=$.sqr(Y),Q>>=v}return q}function RY($,J){const Q=new Array(J.length),q=J.reduce((W,D,X)=>{if($.is0(D))return W;return Q[X]=W,$.mul(W,D)},$.ONE),Y=$.inv(q);return J.reduceRight((W,D,X)=>{if($.is0(D))return W;return Q[X]=$.mul(W,Q[X]),$.mul(W,D)},Y),Q}function lJ($,J){const Q=J!==void 0?J:$.toString(2).length,q=Math.ceil(Q/8);return{nBitLength:Q,nByteLength:q}}function bQ($,J,Q=!1,q={}){if($<=u)throw new Error(`Expected Field ORDER > 0, got ${$}`);const{nBitLength:Y,nByteLength:W}=lJ($,J);if(W>2048)throw new Error("Field lengths over 2048 bytes are not supported");const D=HY($),X=Object.freeze({ORDER:$,BITS:Y,BYTES:W,MASK:W0(Y),ZERO:u,ONE:v,create:(A)=>m(A,$),isValid:(A)=>{if(typeof A!=="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof A}`);return u<=A&&A<$},is0:(A)=>A===u,isOdd:(A)=>(A&v)===v,neg:(A)=>m(-A,$),eql:(A,I)=>A===I,sqr:(A)=>m(A*A,$),add:(A,I)=>m(A+I,$),sub:(A,I)=>m(A-I,$),mul:(A,I)=>m(A*I,$),pow:(A,I)=>fY(X,A,I),div:(A,I)=>m(A*l0(I,$),$),sqrN:(A)=>A*A,addN:(A,I)=>A+I,subN:(A,I)=>A-I,mulN:(A,I)=>A*I,inv:(A)=>l0(A,$),sqrt:q.sqrt||((A)=>D(X,A)),invertBatch:(A)=>RY(X,A),cmov:(A,I,G)=>G?I:A,toBytes:(A)=>Q?h0(A,W):T$(A,W),fromBytes:(A)=>{if(A.length!==W)throw new Error(`Fp.fromBytes: expected ${W}, got ${A.length}`);return Q?u0(A):V$(A)}});return Object.freeze(X)}function vQ($){if(typeof $!=="bigint")throw new Error("field order must be bigint");const J=$.toString(2).length;return Math.ceil(J/8)}function cJ($){const J=vQ($);return J+Math.ceil(J/2)}function gQ($,J,Q=!1){const q=$.length,Y=vQ(J),W=cJ(J);if(q<16||q<W||q>1024)throw new Error(`expected ${W}-1024 bytes of input, got ${q}`);const D=Q?V$($):u0($),X=m(D,J-v)+v;return Q?h0(X,Y):T$(X,Y)}var u,v,P$,zY,uJ,xQ,FQ,CY,jY,SY;var c0=f(()=>{D0();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */u=BigInt(0),v=BigInt(1),P$=BigInt(2),zY=BigInt(3),uJ=BigInt(4),xQ=BigInt(5),FQ=BigInt(8),CY=BigInt(9),jY=BigInt(16),SY=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"]});function yQ($,J){const Q=(Y,W)=>{const D=W.negate();return Y?D:W},q=(Y)=>{const W=Math.ceil(J/Y)+1,D=2**(Y-1);return{windows:W,windowSize:D}};return{constTimeNegate:Q,unsafeLadder(Y,W){let D=$.ZERO,X=Y;while(W>LY){if(W&mJ)D=D.add(X);X=X.double(),W>>=mJ}return D},precomputeWindow(Y,W){const{windows:D,windowSize:X}=q(W),A=[];let I=Y,G=I;for(let K=0;K<D;K++){G=I,A.push(G);for(let U=1;U<X;U++)G=G.add(I),A.push(G);I=G.double()}return A},wNAF(Y,W,D){const{windows:X,windowSize:A}=q(Y);let{ZERO:I,BASE:G}=$;const K=BigInt(2**Y-1),U=2**Y,z=BigInt(Y);for(let Z=0;Z<X;Z++){const N=Z*A;let O=Number(D&K);if(D>>=z,O>A)O-=U,D+=mJ;const V=N,j=N+Math.abs(O)-1,R=Z%2!==0,S=O<0;if(O===0)G=G.add(Q(R,W[V]));else I=I.add(Q(S,W[j]))}return{p:I,f:G}},wNAFCached(Y,W,D,X){const A=Y._WINDOW_SIZE||1;let I=W.get(Y);if(!I){if(I=this.precomputeWindow(Y,A),A!==1)W.set(Y,X(I))}return this.wNAF(A,I,D)}}}function dJ($){return hJ($.Fp),H$($,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...lJ($.n,$.nBitLength),...$,...{p:$.Fp.ORDER}})}var LY,mJ;var uQ=f(()=>{c0();D0();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */LY=BigInt(0),mJ=BigInt(1)});function xY($){const J=kY($),{Fp:Q}=J,q=J.toBytes||((Z,N,O)=>{const V=N.toAffine();return o$(Uint8Array.from([4]),Q.toBytes(V.x),Q.toBytes(V.y))}),Y=J.fromBytes||((Z)=>{const N=Z.subarray(1),O=Q.fromBytes(N.subarray(0,Q.BYTES)),V=Q.fromBytes(N.subarray(Q.BYTES,2*Q.BYTES));return{x:O,y:V}});function W(Z){const{a:N,b:O}=J,V=Q.sqr(Z),j=Q.mul(V,Z);return Q.add(Q.add(j,Q.mul(Z,N)),O)}if(!Q.eql(Q.sqr(J.Gy),W(J.Gx)))throw new Error("bad generator point: equation left != right");function D(Z){return typeof Z==="bigint"&&O$<Z&&Z<J.n}function X(Z){if(!D(Z))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function A(Z){const{allowedPrivateKeyLengths:N,nByteLength:O,wrapPrivateKey:V,n:j}=J;if(N&&typeof Z!=="bigint"){if(Z instanceof Uint8Array)Z=k$(Z);if(typeof Z!=="string"||!N.includes(Z.length))throw new Error("Invalid key");Z=Z.padStart(O*2,"0")}let R;try{R=typeof Z==="bigint"?Z:V$(e("private key",Z,O))}catch(S){throw new Error(`private key must be ${O} bytes, hex or bigint, not ${typeof Z}`)}if(V)R=m(R,j);return X(R),R}const I=new Map;function G(Z){if(!(Z instanceof K))throw new Error("ProjectivePoint expected")}class K{constructor(Z,N,O){if(this.px=Z,this.py=N,this.pz=O,Z==null||!Q.isValid(Z))throw new Error("x required");if(N==null||!Q.isValid(N))throw new Error("y required");if(O==null||!Q.isValid(O))throw new Error("z required")}static fromAffine(Z){const{x:N,y:O}=Z||{};if(!Z||!Q.isValid(N)||!Q.isValid(O))throw new Error("invalid affine point");if(Z instanceof K)throw new Error("projective point not allowed");const V=(j)=>Q.eql(j,Q.ZERO);if(V(N)&&V(O))return K.ZERO;return new K(N,O,Q.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(Z){const N=Q.invertBatch(Z.map((O)=>O.pz));return Z.map((O,V)=>O.toAffine(N[V])).map(K.fromAffine)}static fromHex(Z){const N=K.fromAffine(Y(e("pointHex",Z)));return N.assertValidity(),N}static fromPrivateKey(Z){return K.BASE.multiply(A(Z))}_setWindowSize(Z){this._WINDOW_SIZE=Z,I.delete(this)}assertValidity(){if(this.is0()){if(J.allowInfinityPoint&&!Q.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:Z,y:N}=this.toAffine();if(!Q.isValid(Z)||!Q.isValid(N))throw new Error("bad point: x or y not FE");const O=Q.sqr(N),V=W(Z);if(!Q.eql(O,V))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:Z}=this.toAffine();if(Q.isOdd)return!Q.isOdd(Z);throw new Error("Field doesn't support isOdd")}equals(Z){G(Z);const{px:N,py:O,pz:V}=this,{px:j,py:R,pz:S}=Z,E=Q.eql(Q.mul(N,S),Q.mul(j,V)),T=Q.eql(Q.mul(O,S),Q.mul(R,V));return E&&T}negate(){return new K(this.px,Q.neg(this.py),this.pz)}double(){const{a:Z,b:N}=J,O=Q.mul(N,hQ),{px:V,py:j,pz:R}=this;let{ZERO:S,ZERO:E,ZERO:T}=Q,L=Q.mul(V,V),q$=Q.mul(j,j),P=Q.mul(R,R),_=Q.mul(V,j);return _=Q.add(_,_),T=Q.mul(V,R),T=Q.add(T,T),S=Q.mul(Z,T),E=Q.mul(O,P),E=Q.add(S,E),S=Q.sub(q$,E),E=Q.add(q$,E),E=Q.mul(S,E),S=Q.mul(_,S),T=Q.mul(O,T),P=Q.mul(Z,P),_=Q.sub(L,P),_=Q.mul(Z,_),_=Q.add(_,T),T=Q.add(L,L),L=Q.add(T,L),L=Q.add(L,P),L=Q.mul(L,_),E=Q.add(E,L),P=Q.mul(j,R),P=Q.add(P,P),L=Q.mul(P,_),S=Q.sub(S,L),T=Q.mul(P,q$),T=Q.add(T,T),T=Q.add(T,T),new K(S,E,T)}add(Z){G(Z);const{px:N,py:O,pz:V}=this,{px:j,py:R,pz:S}=Z;let{ZERO:E,ZERO:T,ZERO:L}=Q;const q$=J.a,P=Q.mul(J.b,hQ);let _=Q.mul(N,j),n=Q.mul(O,R),t=Q.mul(V,S),U$=Q.add(N,O),l=Q.add(j,R);U$=Q.mul(U$,l),l=Q.add(_,n),U$=Q.sub(U$,l),l=Q.add(N,V);let M=Q.add(j,S);return l=Q.mul(l,M),M=Q.add(_,t),l=Q.sub(l,M),M=Q.add(O,V),E=Q.add(R,S),M=Q.mul(M,E),E=Q.add(n,t),M=Q.sub(M,E),L=Q.mul(q$,l),E=Q.mul(P,t),L=Q.add(E,L),E=Q.sub(n,L),L=Q.add(n,L),T=Q.mul(E,L),n=Q.add(_,_),n=Q.add(n,_),t=Q.mul(q$,t),l=Q.mul(P,l),n=Q.add(n,t),t=Q.sub(_,t),t=Q.mul(q$,t),l=Q.add(l,t),_=Q.mul(n,l),T=Q.add(T,_),_=Q.mul(M,l),E=Q.mul(U$,E),E=Q.sub(E,_),_=Q.mul(U$,n),L=Q.mul(M,L),L=Q.add(L,_),new K(E,T,L)}subtract(Z){return this.add(Z.negate())}is0(){return this.equals(K.ZERO)}wNAF(Z){return z.wNAFCached(this,I,Z,(N)=>{const O=Q.invertBatch(N.map((V)=>V.pz));return N.map((V,j)=>V.toAffine(O[j])).map(K.fromAffine)})}multiplyUnsafe(Z){const N=K.ZERO;if(Z===O$)return N;if(X(Z),Z===Q$)return this;const{endo:O}=J;if(!O)return z.unsafeLadder(this,Z);let{k1neg:V,k1:j,k2neg:R,k2:S}=O.splitScalar(Z),E=N,T=N,L=this;while(j>O$||S>O$){if(j&Q$)E=E.add(L);if(S&Q$)T=T.add(L);L=L.double(),j>>=Q$,S>>=Q$}if(V)E=E.negate();if(R)T=T.negate();return T=new K(Q.mul(T.px,O.beta),T.py,T.pz),E.add(T)}multiply(Z){X(Z);let N=Z,O,V;const{endo:j}=J;if(j){const{k1neg:R,k1:S,k2neg:E,k2:T}=j.splitScalar(N);let{p:L,f:q$}=this.wNAF(S),{p:P,f:_}=this.wNAF(T);L=z.constTimeNegate(R,L),P=z.constTimeNegate(E,P),P=new K(Q.mul(P.px,j.beta),P.py,P.pz),O=L.add(P),V=q$.add(_)}else{const{p:R,f:S}=this.wNAF(N);O=R,V=S}return K.normalizeZ([O,V])[0]}multiplyAndAddUnsafe(Z,N,O){const V=K.BASE,j=(S,E)=>E===O$||E===Q$||!S.equals(V)?S.multiplyUnsafe(E):S.multiply(E),R=j(this,N).add(j(Z,O));return R.is0()?void 0:R}toAffine(Z){const{px:N,py:O,pz:V}=this,j=this.is0();if(Z==null)Z=j?Q.ONE:Q.inv(V);const R=Q.mul(N,Z),S=Q.mul(O,Z),E=Q.mul(V,Z);if(j)return{x:Q.ZERO,y:Q.ZERO};if(!Q.eql(E,Q.ONE))throw new Error("invZ was invalid");return{x:R,y:S}}isTorsionFree(){const{h:Z,isTorsionFree:N}=J;if(Z===Q$)return!0;if(N)return N(K,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:Z,clearCofactor:N}=J;if(Z===Q$)return this;if(N)return N(K,this);return this.multiplyUnsafe(J.h)}toRawBytes(Z=!0){return this.assertValidity(),q(K,this,Z)}toHex(Z=!0){return k$(this.toRawBytes(Z))}}K.BASE=new K(J.Gx,J.Gy,Q.ONE),K.ZERO=new K(Q.ZERO,Q.ONE,Q.ZERO);const U=J.nBitLength,z=yQ(K,J.endo?Math.ceil(U/2):U);return{CURVE:J,ProjectivePoint:K,normPrivateKeyToScalar:A,weierstrassEquation:W,isWithinCurveOrder:D}}function lQ($){const J=FY($),{Fp:Q,n:q}=J,Y=Q.BYTES+1,W=2*Q.BYTES+1;function D(M){return O$<M&&M<Q.ORDER}function X(M){return m(M,q)}function A(M){return l0(M,q)}const{ProjectivePoint:I,normPrivateKeyToScalar:G,weierstrassEquation:K,isWithinCurveOrder:U}=xY({...J,toBytes(M,H,k){const x=H.toAffine(),F=Q.toBytes(x.x),g=o$;if(k)return g(Uint8Array.from([H.hasEvenY()?2:3]),F);else return g(Uint8Array.from([4]),F,Q.toBytes(x.y))},fromBytes(M){const H=M.length,k=M[0],x=M.subarray(1);if(H===Y&&(k===2||k===3)){const F=V$(x);if(!D(F))throw new Error("Point is not on curve");const g=K(F);let Y$=Q.sqrt(g);const a=(Y$&Q$)===Q$;if((k&1)===1!==a)Y$=Q.neg(Y$);return{x:F,y:Y$}}else if(H===W&&k===4){const F=Q.fromBytes(x.subarray(0,Q.BYTES)),g=Q.fromBytes(x.subarray(Q.BYTES,2*Q.BYTES));return{x:F,y:g}}else throw new Error(`Point of length ${H} was invalid. Expected ${Y} compressed bytes or ${W} uncompressed bytes`)}}),z=(M)=>k$(T$(M,J.nByteLength));function Z(M){const H=q>>Q$;return M>H}function N(M){return Z(M)?X(-M):M}const O=(M,H,k)=>V$(M.slice(H,k));class V{constructor(M,H,k){this.r=M,this.s=H,this.recovery=k,this.assertValidity()}static fromCompact(M){const H=J.nByteLength;return M=e("compactSignature",M,H*2),new V(O(M,0,H),O(M,H,2*H))}static fromDER(M){const{r:H,s:k}=x$.toSig(e("DER",M));return new V(H,k)}assertValidity(){if(!U(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!U(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(M){return new V(this.r,this.s,M)}recoverPublicKey(M){const{r:H,s:k,recovery:x}=this,F=L(e("msgHash",M));if(x==null||![0,1,2,3].includes(x))throw new Error("recovery id invalid");const g=x===2||x===3?H+J.n:H;if(g>=Q.ORDER)throw new Error("recovery id 2 or 3 invalid");const Y$=(x&1)===0?"02":"03",a=I.fromHex(Y$+z(g)),Z$=A(g),S$=X(-F*Z$),v$=X(k*Z$),f$=I.BASE.multiplyAndAddUnsafe(a,S$,v$);if(!f$)throw new Error("point at infinify");return f$.assertValidity(),f$}hasHighS(){return Z(this.s)}normalizeS(){return this.hasHighS()?new V(this.r,X(-this.s),this.recovery):this}toDERRawBytes(){return _$(this.toDERHex())}toDERHex(){return x$.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return _$(this.toCompactHex())}toCompactHex(){return z(this.r)+z(this.s)}}const j={isValidPrivateKey(M){try{return G(M),!0}catch(H){return!1}},normPrivateKeyToScalar:G,randomPrivateKey:()=>{const M=cJ(J.n);return gQ(J.randomBytes(M),J.n)},precompute(M=8,H=I.BASE){return H._setWindowSize(M),H.multiply(BigInt(3)),H}};function R(M,H=!0){return I.fromPrivateKey(M).toRawBytes(H)}function S(M){const H=M instanceof Uint8Array,k=typeof M==="string",x=(H||k)&&M.length;if(H)return x===Y||x===W;if(k)return x===2*Y||x===2*W;if(M instanceof I)return!0;return!1}function E(M,H,k=!0){if(S(M))throw new Error("first arg must be private key");if(!S(H))throw new Error("second arg must be public key");return I.fromHex(H).multiply(G(M)).toRawBytes(k)}const T=J.bits2int||function(M){const H=V$(M),k=M.length*8-J.nBitLength;return k>0?H>>BigInt(k):H},L=J.bits2int_modN||function(M){return X(T(M))},q$=W0(J.nBitLength);function P(M){if(typeof M!=="bigint")throw new Error("bigint expected");if(!(O$<=M&&M<q$))throw new Error(`bigint expected < 2^${J.nBitLength}`);return T$(M,J.nByteLength)}function _(M,H,k=n){if(["recovered","canonical"].some((R$)=>(R$ in k)))throw new Error("sign() legacy options not supported");const{hash:x,randomBytes:F}=J;let{lowS:g,prehash:Y$,extraEntropy:a}=k;if(g==null)g=!0;if(M=e("msgHash",M),Y$)M=e("prehashed msgHash",x(M));const Z$=L(M),S$=G(H),v$=[P(S$),P(Z$)];if(a!=null){const R$=a===!0?F(Q.BYTES):a;v$.push(e("extraEntropy",R$))}const f$=o$(...v$),Z0=Z$;function o0(R$){const g$=T(R$);if(!U(g$))return;const D8=A(g$),A$=I.BASE.multiply(g$).toAffine(),y$=X(A$.x);if(y$===O$)return;const G0=X(D8*X(Z0+y$*S$));if(G0===O$)return;let X8=(A$.x===y$?0:2)|Number(A$.y&Q$),A8=G0;if(g&&Z(G0))A8=N(G0),X8^=1;return new V(y$,A8,X8)}return{seed:f$,k2sig:o0}}const n={lowS:J.lowS,prehash:!1},t={lowS:J.lowS,prehash:!1};function U$(M,H,k=n){const{seed:x,k2sig:F}=_(M,H,k),g=J;return gJ(g.hash.outputLen,g.nByteLength,g.hmac)(x,F)}I.BASE._setWindowSize(8);function l(M,H,k,x=t){const F=M;if(H=e("msgHash",H),k=e("publicKey",k),"strict"in x)throw new Error("options.strict was renamed to lowS");const{lowS:g,prehash:Y$}=x;let a=void 0,Z$;try{if(typeof F==="string"||F instanceof Uint8Array)try{a=V.fromDER(F)}catch(A$){if(!(A$ instanceof x$.Err))throw A$;a=V.fromCompact(F)}else if(typeof F==="object"&&typeof F.r==="bigint"&&typeof F.s==="bigint"){const{r:A$,s:y$}=F;a=new V(A$,y$)}else throw new Error("PARSE");Z$=I.fromHex(k)}catch(A$){if(A$.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(g&&a.hasHighS())return!1;if(Y$)H=J.hash(H);const{r:S$,s:v$}=a,f$=L(H),Z0=A(v$),o0=X(f$*Z0),R$=X(S$*Z0),g$=I.BASE.multiplyAndAddUnsafe(Z$,o0,R$)?.toAffine();if(!g$)return!1;return X(g$.x)===S$}return{CURVE:J,getPublicKey:R,getSharedSecret:E,sign:U$,verify:l,ProjectivePoint:I,Signature:V,utils:j}}var kY,FY,_Y,PY,x$,O$,Q$,uX,hQ,hX;var cQ=f(()=>{c0();D0();D0();uQ();kY=function($){const J=dJ($);H$(J,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:Q,Fp:q,a:Y}=J;if(Q){if(!q.eql(Y,q.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof Q!=="object"||typeof Q.beta!=="bigint"||typeof Q.splitScalar!=="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...J})};FY=function($){const J=dJ($);return H$(J,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...J})};/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */({bytesToNumberBE:_Y,hexToBytes:PY}=yJ),x$={Err:class $ extends Error{constructor(J=""){super(J)}},_parseInt($){const{Err:J}=x$;if($.length<2||$[0]!==2)throw new J("Invalid signature integer tag");const Q=$[1],q=$.subarray(2,Q+2);if(!Q||q.length!==Q)throw new J("Invalid signature integer: wrong length");if(q[0]&128)throw new J("Invalid signature integer: negative");if(q[0]===0&&!(q[1]&128))throw new J("Invalid signature integer: unnecessary leading zero");return{d:_Y(q),l:$.subarray(Q+2)}},toSig($){const{Err:J}=x$,Q=typeof $==="string"?PY($):$;if(!(Q instanceof Uint8Array))throw new Error("ui8a expected");let q=Q.length;if(q<2||Q[0]!=48)throw new J("Invalid signature tag");if(Q[1]!==q-2)throw new J("Invalid signature: incorrect length");const{d:Y,l:W}=x$._parseInt(Q.subarray(2)),{d:D,l:X}=x$._parseInt(W);if(X.length)throw new J("Invalid signature: left bytes after parsing");return{r:Y,s:D}},hexFromSig($){const J=(I)=>Number.parseInt(I[0],16)&8?"00"+I:I,Q=(I)=>{const G=I.toString(16);return G.length&1?`0${G}`:G},q=J(Q($.s)),Y=J(Q($.r)),W=q.length/2,D=Y.length/2,X=Q(W),A=Q(D);return`30${Q(D+W+4)}02${A}${Y}02${X}${q}`}},O$=BigInt(0),Q$=BigInt(1),uX=BigInt(2),hQ=BigInt(3),hX=BigInt(4)});class pJ extends L${constructor($,J){super();this.finished=!1,this.destroyed=!1,z8($);const Q=B$(J);if(this.iHash=$.create(),typeof this.iHash.update!=="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const q=this.blockLen,Y=new Uint8Array(q);Y.set(Q.length>q?$.create().update(Q).digest():Q);for(let W=0;W<Y.length;W++)Y[W]^=54;this.iHash.update(Y),this.oHash=$.create();for(let W=0;W<Y.length;W++)Y[W]^=54^92;this.oHash.update(Y),Y.fill(0)}update($){return M$(this),this.iHash.update($),this}digestInto($){M$(this),a$($,this.outputLen),this.finished=!0,this.iHash.digestInto($),this.oHash.update($),this.oHash.digestInto($),this.destroy()}digest(){const $=new Uint8Array(this.oHash.outputLen);return this.digestInto($),$}_cloneInto($){$||($=Object.create(Object.getPrototypeOf(this),{}));const{oHash:J,iHash:Q,finished:q,destroyed:Y,blockLen:W,outputLen:D}=this;return $=$,$.finished=q,$.destroyed=Y,$.blockLen=W,$.outputLen=D,$.oHash=J._cloneInto($.oHash),$.iHash=Q._cloneInto($.iHash),$}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}var nJ;var mQ=f(()=>{C0();c$();nJ=($,J,Q)=>new pJ($,J).update(Q).digest();nJ.create=($,J)=>new pJ($,J)});function bY($){return{hash:$,hmac:(J,...Q)=>nJ($,J,k8(...Q)),randomBytes:_8}}function dQ($,J){const Q=(q)=>lQ({...$,...bY(q)});return Object.freeze({...Q(J),create:Q})}var pQ=f(()=>{mQ();c$();cQ();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */});var gY,oQ,nQ,vY,iJ,iQ,oJ,rJ,sX,eX;var rQ=f(()=>{SJ();c0();pQ();gY=function($){const J=oQ,Q=BigInt(3),q=BigInt(6),Y=BigInt(11),W=BigInt(22),D=BigInt(23),X=BigInt(44),A=BigInt(88),I=$*$*$%J,G=I*I*$%J,K=$$(G,Q,J)*G%J,U=$$(K,Q,J)*G%J,z=$$(U,iJ,J)*I%J,Z=$$(z,Y,J)*z%J,N=$$(Z,W,J)*Z%J,O=$$(N,X,J)*N%J,V=$$(O,A,J)*O%J,j=$$(V,X,J)*N%J,R=$$(j,Q,J)*G%J,S=$$(R,D,J)*Z%J,E=$$(S,q,J)*I%J,T=$$(E,iJ,J);if(!oJ.eql(oJ.sqr(T),$))throw new Error("Cannot find square root");return T};/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */oQ=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),nQ=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),vY=BigInt(1),iJ=BigInt(2),iQ=($,J)=>($+J/iJ)/J,oJ=bQ(oQ,void 0,void 0,{sqrt:gY}),rJ=dQ({a:BigInt(0),b:BigInt(7),Fp:oJ,n:nQ,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:($)=>{const J=nQ,Q=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),q=-vY*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),Y=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),W=Q,D=BigInt("0x100000000000000000000000000000000"),X=iQ(W*$,J),A=iQ(-q*$,J);let I=m($-X*Q-A*Y,J),G=m(-X*q-A*W,J);const K=I>D,U=G>D;if(K)I=J-I;if(U)G=J-G;if(I>D||G>D)throw new Error("splitScalar: Endomorphism failed, k="+$);return{k1neg:K,k1:I,k2neg:U,k2:G}}}},x0),sX=BigInt(0),eX=rJ.ProjectivePoint});function K0($){return $.message!==void 0}var I8=1;class r0{t;n;key_label;metadata;constructor({t:$,n:J,key_label:Q,permissions:q}){if(this.t=$,this.n=J,this.key_label=Q,this.metadata=[],q)this.metadata.push([I8,q]);else this.metadata.push([I8,""])}}class Z8{authModule;threshold;totalNodes;ttl;wp_client;constructor($,J,Q,q,Y=10){if(J===0)throw new Error("Threshold cannot be 0");this.threshold=J,this.totalNodes=Q,this.authModule=q,this.ttl=Y,this.wp_client=$}async authenticateAndCreateKey($){try{const J=new r0({t:this.threshold,n:this.totalNodes,permissions:$});console.log("Generated Payload:",J);const Q=(Y)=>this.authModule.authenticate({setup:J,challenge:Y}),q=await this.wp_client.startKeygen({setup:J,signer:Q});return console.log("Keygen response:",q),q}catch(J){throw console.error(J),J}}async authenticateAndSign($,J){const Q={t:this.threshold,key_id:$,message:J},q=(W)=>this.authModule.authenticate({setup:Q,challenge:W}),Y=await this.wp_client.startSigngen({setup:Q,signer:q});return console.log("Sign response:",Y),Y}}N$();o();function _0($){const{kzg:J}=$,Q=$.to??(typeof $.blobs[0]==="string"?"hex":"bytes"),q=typeof $.blobs[0]==="string"?$.blobs.map((W)=>W$(W)):$.blobs,Y=[];for(let W of q)Y.push(Uint8Array.from(J.blobToKzgCommitment(W)));return Q==="bytes"?Y:Y.map((W)=>d(W))}N$();o();function P0($){const{kzg:J}=$,Q=$.to??(typeof $.blobs[0]==="string"?"hex":"bytes"),q=typeof $.blobs[0]==="string"?$.blobs.map((D)=>W$(D)):$.blobs,Y=typeof $.commitments[0]==="string"?$.commitments.map((D)=>W$(D)):$.commitments,W=[];for(let D=0;D<q.length;D++){const X=q[D],A=Y[D];W.push(Uint8Array.from(J.computeBlobKzgProof(X,A)))}return Q==="bytes"?W:W.map((D)=>d(D))}o();SJ();u$();N$();o();function WQ($,J){const Q=J||"hex",q=x0(I$($,{strict:!1})?h$($):$);if(Q==="bytes")return q;return B(q)}function DQ($){const{commitment:J,version:Q=1}=$,q=$.to??(typeof J==="string"?"hex":"bytes"),Y=WQ(J,"bytes");return Y.set([Q],0),q==="bytes"?Y:d(Y)}function XQ($){const{commitments:J,version:Q}=$,q=$.to??(typeof J[0]==="string"?"hex":"bytes"),Y=[];for(let W of J)Y.push(DQ({commitment:W,to:q,version:Q}));return Y}var AQ=32,IQ=4096,ZQ=131072,fJ=761855;var F0=1;i();class RJ extends C{constructor({maxSize:$,size:J}){super("Blob size is too large.",{metaMessages:[`Max: ${$} bytes`,`Given: ${J} bytes`]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlobSizeTooLargeError"})}}class q0 extends C{constructor(){super("Blob data must not be empty.");Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EmptyBlobError"})}}class BJ extends C{constructor({hash:$,size:J}){super(`Versioned hash "${$}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${J}`]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidVersionedHashSizeError"})}}class LJ extends C{constructor({hash:$,version:J}){super(`Versioned hash "${$}" version is invalid.`,{metaMessages:[`Expected: ${F0}`,`Received: ${J}`]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidVersionedHashVersionError"})}}zJ();w$();N$();o();function GQ($){const J=$.to??(typeof $.data==="string"?"hex":"bytes"),Q=typeof $.data==="string"?W$($.data):$.data,q=b(Q);if(!q)throw new q0;if(q>fJ)throw new RJ({maxSize:fJ,size:q});const Y=[];let W=!0,D=0;while(W){const X=B0(new Uint8Array(ZQ));let A=0;while(A<IQ){const I=Q.slice(D,D+(AQ-1));if(X.pushByte(0),X.pushBytes(I),I.length<31){X.pushByte(128),W=!1;break}A++,D+=31}Y.push(X)}return J==="bytes"?Y.map((X)=>X.bytes):Y.map((X)=>d(X.bytes))}function KQ($){const{data:J,kzg:Q,to:q}=$,Y=$.blobs??GQ({data:J,to:q}),W=$.commitments??_0({blobs:Y,kzg:Q,to:q}),D=$.proofs??P0({blobs:Y,commitments:W,kzg:Q,to:q}),X=[];for(let A=0;A<Y.length;A++)X.push({blob:Y[A],commitment:W[A],proof:D[A]});return X}L0();function NQ($){if($.type)return $.type;if(typeof $.blobs!=="undefined"||typeof $.blobVersionedHashes!=="undefined"||typeof $.maxFeePerBlobGas!=="undefined"||typeof $.sidecars!=="undefined")return"eip4844";if(typeof $.maxFeePerGas!=="undefined"||typeof $.maxPriorityFeePerGas!=="undefined")return"eip1559";if(typeof $.gasPrice!=="undefined"){if(typeof $.accessList!=="undefined")return"eip2930";return"legacy"}throw new jJ({transaction:$})}GJ();m$();function b0($){const J=c(`0x${$.substring(4)}`).substring(26);return S0(`0x${J}`)}var VQ=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,OQ=/^(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)?$/;QJ();d$();p$();w$();o();l8();J0();o();m$();function kJ($){const{domain:J={},message:Q,primaryType:q}=$,Y={EIP712Domain:TQ({domain:J}),...$.types};EQ({domain:J,message:Q,primaryType:q,types:Y});const W=["0x1901"];if(J)W.push(UQ({domain:J,types:Y}));if(q!=="EIP712Domain")W.push(wQ({data:Q,primaryType:q,types:Y}));return c(X$(W))}function UQ({domain:$,types:J}){return wQ({data:$,primaryType:"EIP712Domain",types:J})}var wQ=function({data:$,primaryType:J,types:Q}){const q=zQ({data:$,primaryType:J,types:Q});return c(q)},zQ=function({data:$,primaryType:J,types:Q}){const q=[{type:"bytes32"}],Y=[QY({primaryType:J,types:Q})];for(let W of Q[J]){const[D,X]=jQ({types:Q,name:W.name,type:W.type,value:$[W.name]});q.push(D),Y.push(X)}return MJ(q,Y)},QY=function({primaryType:$,types:J}){const Q=B(qY({primaryType:$,types:J}));return c(Q)},qY=function({primaryType:$,types:J}){let Q="";const q=CQ({primaryType:$,types:J});q.delete($);const Y=[$,...Array.from(q).sort()];for(let W of Y)Q+=`${W}(${J[W].map(({name:D,type:X})=>`${X} ${D}`).join(",")})`;return Q},CQ=function({primaryType:$,types:J},Q=new Set){const Y=$.match(/^\w*/u)?.[0];if(Q.has(Y)||J[Y]===void 0)return Q;Q.add(Y);for(let W of J[Y])CQ({primaryType:W.type,types:J},Q);return Q},jQ=function({types:$,name:J,type:Q,value:q}){if($[Q]!==void 0)return[{type:"bytes32"},c(zQ({data:q,primaryType:Q,types:$}))];if(Q==="bytes")return q=`0x${(q.length%2?"0":"")+q.slice(2)}`,[{type:"bytes32"},c(q)];if(Q==="string")return[{type:"bytes32"},c(B(q))];if(Q.lastIndexOf("]")===Q.length-1){const Y=Q.slice(0,Q.lastIndexOf("[")),W=q.map((D)=>jQ({name:J,type:Y,types:$,value:D}));return[{type:"bytes32"},c(MJ(W.map(([D])=>D),W.map(([,D])=>D)))]}return[{type:Q},q]};function EQ($){const{domain:J,message:Q,primaryType:q,types:Y}=$,W=(D,X)=>{for(let A of D){const{name:I,type:G}=A,K=X[I],U=G.match(OQ);if(U&&(typeof K==="number"||typeof K==="bigint")){const[N,O,V]=U;J$(K,{signed:O==="int",size:Number.parseInt(V)/8})}if(G==="address"&&typeof K==="string"&&!s(K))throw new r({address:K});const z=G.match(VQ);if(z){const[N,O]=z;if(O&&b(K)!==Number.parseInt(O))throw new e0({expectedSize:Number.parseInt(O),givenSize:b(K)})}const Z=Y[G];if(Z)W(Z,K)}};if(Y.EIP712Domain&&J)W(Y.EIP712Domain,J);if(q!=="EIP712Domain"){const D=Y[q];W(D,Q)}}function TQ({domain:$}){return[typeof $?.name==="string"&&{name:"name",type:"string"},$?.version&&{name:"version",type:"string"},typeof $?.chainId==="number"&&{name:"chainId",type:"uint256"},$?.verifyingContract&&{name:"verifyingContract",type:"address"},$?.salt&&{name:"salt",type:"bytes32"}].filter(Boolean)}i();zJ();N$();o();function i$($,J="hex"){const Q=HQ($),q=B0(new Uint8Array(Q.length));if(Q.encode(q),J==="hex")return d(q.bytes);return q.bytes}var HQ=function($){if(Array.isArray($))return YY($.map((J)=>HQ(J)));return WY($)},YY=function($){const J=$.reduce((Y,W)=>Y+W.length,0),Q=SQ(J);return{length:(()=>{if(J<=55)return 1+J;return 1+Q+J})(),encode(Y){if(J<=55)Y.pushByte(192+J);else if(Y.pushByte(247+Q),Q===1)Y.pushUint8(J);else if(Q===2)Y.pushUint16(J);else if(Q===3)Y.pushUint24(J);else Y.pushUint32(J);for(let{encode:W}of $)W(Y)}}},WY=function($){const J=typeof $==="string"?W$($):$,Q=SQ(J.length);return{length:(()=>{if(J.length===1&&J[0]<128)return 1;if(J.length<=55)return 1+J.length;return 1+Q+J.length})(),encode(Y){if(J.length===1&&J[0]<128)Y.pushBytes(J);else if(J.length<=55)Y.pushByte(128+J.length),Y.pushBytes(J);else{if(Y.pushByte(183+Q),Q===1)Y.pushUint8(J.length);else if(Q===2)Y.pushUint16(J.length);else if(Q===3)Y.pushUint24(J.length);else Y.pushUint32(J.length);Y.pushBytes(J)}}}},SQ=function($){if($<256)return 1;if($<65536)return 2;if($<16777216)return 3;if($<4294967296)return 4;throw new C("Length is too large.")};var fQ=`\x19Ethereum Signed Message:
|
|
2
|
+
`;J0();N$();m$();function _J($,J){const Q=(()=>{if(typeof $==="string")return l$($);if($.raw instanceof Uint8Array)return $.raw;return h$($.raw)})(),q=l$(`${fQ}${Q.length}`);return c(X$([q,Q]),J)}d$();i();MQ();QQ();p$();w$();NJ();r$();function RQ($){const{blobVersionedHashes:J}=$;if(J){if(J.length===0)throw new q0;for(let Q of J){const q=b(Q),Y=U8(f0(Q,0,1));if(q!==32)throw new BJ({hash:Q,size:q});if(Y!==F0)throw new LJ({hash:Q,version:Y})}}PJ($)}function PJ($){const{chainId:J,maxPriorityFeePerGas:Q,maxFeePerGas:q,to:Y}=$;if(J<=0)throw new Y0({chainId:J});if(Y&&!s(Y))throw new r({address:Y});if(q&&q>2n**256n-1n)throw new n$({maxFeePerGas:q});if(Q&&q&&Q>q)throw new k0({maxFeePerGas:q,maxPriorityFeePerGas:Q})}function BQ($){const{chainId:J,maxPriorityFeePerGas:Q,gasPrice:q,maxFeePerGas:Y,to:W}=$;if(J<=0)throw new Y0({chainId:J});if(W&&!s(W))throw new r({address:W});if(Q||Y)throw new C("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(q&&q>2n**256n-1n)throw new n$({maxFeePerGas:q})}function LQ($){const{chainId:J,maxPriorityFeePerGas:Q,gasPrice:q,maxFeePerGas:Y,to:W,accessList:D}=$;if(W&&!s(W))throw new r({address:W});if(typeof J!=="undefined"&&J<=0)throw new Y0({chainId:J});if(Q||Y)throw new C("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(q&&q>2n**256n-1n)throw new n$({maxFeePerGas:q});if(D)throw new C("`accessList` is not a valid Legacy Transaction attribute.")}L0();J0();O8();o();d$();L0();p$();function v0($){if(!$||$.length===0)return[];const J=[];for(let Q=0;Q<$.length;Q++){const{address:q,storageKeys:Y}=$[Q];for(let W=0;W<Y.length;W++)if(Y[W].length-2!==64)throw new EJ({storageKey:Y[W]});if(!s(q,{strict:!1}))throw new r({address:q});J.push([q,Y])}return J}function xJ($,J){const Q=NQ($);if(Q==="eip1559")return XY($,J);if(Q==="eip2930")return AY($,J);if(Q==="eip4844")return DY($,J);return IY($,J)}var DY=function($,J){const{chainId:Q,gas:q,nonce:Y,to:W,value:D,maxFeePerBlobGas:X,maxFeePerGas:A,maxPriorityFeePerGas:I,accessList:G,data:K}=$;RQ($);let{blobVersionedHashes:U,sidecars:z}=$;if($.blobs&&(typeof U==="undefined"||typeof z==="undefined")){const R=typeof $.blobs[0]==="string"?$.blobs:$.blobs.map((T)=>d(T)),S=$.kzg,E=_0({blobs:R,kzg:S});if(typeof U==="undefined")U=XQ({commitments:E});if(typeof z==="undefined"){const T=P0({blobs:R,commitments:E,kzg:S});z=KQ({blobs:R,commitments:E,proofs:T})}}const Z=v0(G),N=[B(Q),Y?B(Y):"0x",I?B(I):"0x",A?B(A):"0x",q?B(q):"0x",W??"0x",D?B(D):"0x",K??"0x",Z,X?B(X):"0x",U??[],...FJ($,J)],O=[],V=[],j=[];if(z)for(let R=0;R<z.length;R++){const{blob:S,commitment:E,proof:T}=z[R];O.push(S),V.push(E),j.push(T)}return $0(["0x03",z?i$([N,O,V,j]):i$(N)])},XY=function($,J){const{chainId:Q,gas:q,nonce:Y,to:W,value:D,maxFeePerGas:X,maxPriorityFeePerGas:A,accessList:I,data:G}=$;PJ($);const K=v0(I),U=[B(Q),Y?B(Y):"0x",A?B(A):"0x",X?B(X):"0x",q?B(q):"0x",W??"0x",D?B(D):"0x",G??"0x",K,...FJ($,J)];return $0(["0x02",i$(U)])},AY=function($,J){const{chainId:Q,gas:q,data:Y,nonce:W,to:D,value:X,accessList:A,gasPrice:I}=$;BQ($);const G=v0(A),K=[B(Q),W?B(W):"0x",I?B(I):"0x",q?B(q):"0x",D??"0x",X?B(X):"0x",Y??"0x",G,...FJ($,J)];return $0(["0x01",i$(K)])},IY=function($,J){const{chainId:Q=0,gas:q,data:Y,nonce:W,to:D,value:X,gasPrice:A}=$;LQ($);let I=[W?B(W):"0x",A?B(A):"0x",q?B(q):"0x",D??"0x",X?B(X):"0x",Y??"0x"];if(J){const G=(()=>{if(J.v>=35n){if((J.v-35n)/2n>0)return J.v;return 27n+(J.v===35n?0n:1n)}if(Q>0)return BigInt(Q*2)+BigInt(35n+J.v-27n);const K=27n+(J.v===27n?0n:1n);if(J.v!==K)throw new CJ({v:J.v});return K})();I=[...I,B(G),J.r,J.s]}else if(Q>0)I=[...I,B(Q),"0x","0x"];return i$(I)};function FJ($,J){const{r:Q,s:q,v:Y,yParity:W}=J??$;if(typeof Q==="undefined")return[];if(typeof q==="undefined")return[];if(typeof Y==="undefined"&&typeof W==="undefined")return[];return[(()=>{if(typeof W==="number")return W?B(1):"0x";if(Y===0n)return"0x";if(Y===1n)return B(1);return Y===27n?"0x":B(1)})(),XJ(Q),XJ(q)]}rQ();r$();function X0({r:$,s:J,v:Q,yParity:q}){const Y=(()=>{if(q===0||q===1)return q;if(Q&&(Q===27n||Q===28n||Q>=35n))return Q%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})();return`0x${new rJ.Signature(O0($),O0(J)).toCompactHex()}${Y===0?"1b":"1c"}`}o();m$();var uY=`abdikace
|
|
3
3
|
abeceda
|
|
4
4
|
adresa
|
|
5
5
|
agrese
|
|
@@ -2046,7 +2046,7 @@ zvesela
|
|
|
2046
2046
|
zvon
|
|
2047
2047
|
zvrat
|
|
2048
2048
|
zvukovod
|
|
2049
|
-
zvyk`.split("\n");var
|
|
2049
|
+
zvyk`.split("\n");var hY=`abandon
|
|
2050
2050
|
ability
|
|
2051
2051
|
able
|
|
2052
2052
|
about
|
|
@@ -4093,7 +4093,7 @@ youth
|
|
|
4093
4093
|
zebra
|
|
4094
4094
|
zero
|
|
4095
4095
|
zone
|
|
4096
|
-
zoo`.split("\n");var
|
|
4096
|
+
zoo`.split("\n");var lY=`abaisser
|
|
4097
4097
|
abandon
|
|
4098
4098
|
abdiquer
|
|
4099
4099
|
abeille
|
|
@@ -6140,7 +6140,7 @@ yacht
|
|
|
6140
6140
|
ze\u0300bre
|
|
6141
6141
|
ze\u0301nith
|
|
6142
6142
|
zeste
|
|
6143
|
-
zoologie`.split("\n");var
|
|
6143
|
+
zoologie`.split("\n");var cY=`abaco
|
|
6144
6144
|
abbaglio
|
|
6145
6145
|
abbinato
|
|
6146
6146
|
abete
|
|
@@ -8187,7 +8187,7 @@ zotico
|
|
|
8187
8187
|
zucchero
|
|
8188
8188
|
zufolo
|
|
8189
8189
|
zulu
|
|
8190
|
-
zuppa`.split("\n");var
|
|
8190
|
+
zuppa`.split("\n");var mY=`\u3042\u3044\u3053\u304F\u3057\u3093
|
|
8191
8191
|
\u3042\u3044\u3055\u3064
|
|
8192
8192
|
\u3042\u3044\u305F\u3099
|
|
8193
8193
|
\u3042\u304A\u305D\u3099\u3089
|
|
@@ -10234,7 +10234,7 @@ zuppa`.split("\n");var rY=`\u3042\u3044\u3053\u304F\u3057\u3093
|
|
|
10234
10234
|
\u308F\u3057\u3099\u307E\u3057
|
|
10235
10235
|
\u308F\u3059\u308C\u3082\u306E
|
|
10236
10236
|
\u308F\u3089\u3046
|
|
10237
|
-
\u308F\u308C\u308B`.split("\n");var
|
|
10237
|
+
\u308F\u308C\u308B`.split("\n");var dY=`\u1100\u1161\u1100\u1167\u11A8
|
|
10238
10238
|
\u1100\u1161\u1101\u1173\u11B7
|
|
10239
10239
|
\u1100\u1161\u1102\u1161\u11AB
|
|
10240
10240
|
\u1100\u1161\u1102\u1173\u11BC
|
|
@@ -12281,7 +12281,7 @@ zuppa`.split("\n");var rY=`\u3042\u3044\u3053\u304F\u3057\u3093
|
|
|
12281
12281
|
\u1112\u1174\u1106\u1161\u11BC
|
|
12282
12282
|
\u1112\u1174\u1109\u1162\u11BC
|
|
12283
12283
|
\u1112\u1174\u11AB\u1109\u1162\u11A8
|
|
12284
|
-
\u1112\u1175\u11B7\u1101\u1165\u11BA`.split("\n");var
|
|
12284
|
+
\u1112\u1175\u11B7\u1101\u1165\u11BA`.split("\n");var pY=`\u7684
|
|
12285
12285
|
\u4E00
|
|
12286
12286
|
\u662F
|
|
12287
12287
|
\u5728
|
|
@@ -14328,7 +14328,7 @@ zuppa`.split("\n");var rY=`\u3042\u3044\u3053\u304F\u3057\u3093
|
|
|
14328
14328
|
\u97E6
|
|
14329
14329
|
\u6028
|
|
14330
14330
|
\u77EE
|
|
14331
|
-
\u6B47`.split("\n");var
|
|
14331
|
+
\u6B47`.split("\n");var nY=`a\u0301baco
|
|
14332
14332
|
abdomen
|
|
14333
14333
|
abeja
|
|
14334
14334
|
abierto
|
|
@@ -16375,7 +16375,7 @@ zarza
|
|
|
16375
16375
|
zona
|
|
16376
16376
|
zorro
|
|
16377
16377
|
zumo
|
|
16378
|
-
zurdo`.split("\n");var
|
|
16378
|
+
zurdo`.split("\n");var iY=`\u7684
|
|
16379
16379
|
\u4E00
|
|
16380
16380
|
\u662F
|
|
16381
16381
|
\u5728
|
|
@@ -18422,4 +18422,4 @@ zurdo`.split("\n");var sY=`\u7684
|
|
|
18422
18422
|
\u97CB
|
|
18423
18423
|
\u6028
|
|
18424
18424
|
\u77EE
|
|
18425
|
-
\u6B47`.split("\n");d$();p$();function aJ($){if(typeof $==="string"){if(!a($,{strict:!1}))throw new o({address:$});return{address:$,type:"json-rpc"}}if(!a($.address,{strict:!1}))throw new o({address:$.address});return{address:$.address,experimental_signAuthMessage:$.experimental_signAuthMessage,signMessage:$.signMessage,signTransaction:$.signTransaction,signTypedData:$.signTypedData,source:"custom",type:"local"}}/*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */var $8=2n**256n,b$=$8-0x1000003d1n,J8=$8-0x14551231950b75fc4402da1732fc9bebfn,Xq=0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n,Dq=0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n,Aq={p:b$,n:J8,a:0n,b:7n,Gx:Xq,Gy:Dq};var $q=($)=>w(w($*$)*$+Aq.b),u=($="")=>{throw new Error($)},n0=($)=>typeof $==="bigint",Gq=($)=>typeof $==="string",eJ=($)=>n0($)&&0n<$&&$<b$,Zq=($)=>n0($)&&0n<$&&$<J8,$9=($)=>$ instanceof Uint8Array||$!=null&&typeof $==="object"&&$.constructor.name==="Uint8Array",sJ=($,J)=>!$9($)||typeof J==="number"&&J>0&&$.length!==J?u("Uint8Array expected"):$,A0=($)=>new Uint8Array($),Q8=($,J)=>sJ(Gq($)?i0($):A0(sJ($)),J),w=($,J=b$)=>{let Q=$%J;return Q>=0n?Q:J+Q},Jq=($)=>$ instanceof d?$:u("Point expected");class d{constructor($,J,Q){this.px=$,this.py=J,this.pz=Q}static fromAffine($){return $.x===0n&&$.y===0n?d.ZERO:new d($.x,$.y,1n)}static fromHex($){$=Q8($);let J=void 0;const Q=$[0],q=$.subarray(1),Y=Qq(q,0,32),W=$.length;if(W===33&&[2,3].includes(Q)){if(!eJ(Y))u("Point hex invalid: x not FE");let I=J9($q(Y));const X=(I&1n)===1n;if((Q&1)===1!==X)I=w(-I);J=new d(Y,I,1n)}if(W===65&&Q===4)J=new d(Y,Qq(q,32,64),1n);return J?J.ok():u("Point is not on curve")}static fromPrivateKey($){return D0.mul(Q9($))}get x(){return this.aff().x}get y(){return this.aff().y}equals($){const{px:J,py:Q,pz:q}=this,{px:Y,py:W,pz:I}=Jq($),X=w(J*I),D=w(Y*q),A=w(Q*I),Z=w(W*q);return X===D&&A===Z}negate(){return new d(this.px,w(-this.py),this.pz)}double(){return this.add(this)}add($){const{px:J,py:Q,pz:q}=this,{px:Y,py:W,pz:I}=Jq($),{a:X,b:D}=Aq;let A=0n,Z=0n,K=0n;const U=w(D*3n);let C=w(J*Y),G=w(Q*W),N=w(q*I),O=w(J+Q),V=w(Y+W);O=w(O*V),V=w(C+G),O=w(O-V),V=w(J+q);let j=w(Y+I);return V=w(V*j),j=w(C+N),V=w(V-j),j=w(Q+q),A=w(W+I),j=w(j*A),A=w(G+N),j=w(j-A),K=w(X*V),A=w(U*N),K=w(A+K),A=w(G-K),K=w(G+K),Z=w(A*K),G=w(C+C),G=w(G+C),N=w(X*N),V=w(U*V),G=w(G+N),N=w(C-N),N=w(X*N),V=w(V+N),C=w(G*V),Z=w(Z+C),C=w(j*V),A=w(O*A),A=w(A-C),C=w(O*G),K=w(j*K),K=w(K+C),new d(A,Z,K)}mul($,J=!0){if(!J&&$===0n)return d0;if(!Zq($))u("invalid scalar");if(this.equals(D0))return I9($).p;let Q=d0,q=D0;for(let Y=this;$>0n;Y=Y.double(),$>>=1n)if($&1n)Q=Q.add(Y);else if(J)q=q.add(Y);return Q}mulAddQUns($,J,Q){return this.mul(J,!1).add($.mul(Q,!1)).ok()}toAffine(){const{px:$,py:J,pz:Q}=this;if(this.equals(d0))return{x:0n,y:0n};if(Q===1n)return{x:$,y:J};const q=Nq(Q);if(w(Q*q)!==1n)u("invalid inverse");return{x:w($*q),y:w(J*q)}}assertValidity(){const{x:$,y:J}=this.aff();if(!eJ($)||!eJ(J))u("Point invalid: x or y");return w(J*J)===$q($)?this:u("Point invalid: not on curve")}multiply($){return this.mul($)}aff(){return this.toAffine()}ok(){return this.assertValidity()}toHex($=!0){const{x:J,y:Q}=this.aff();return($?(Q&1n)===0n?"02":"03":"04")+qq(J)+($?"":qq(Q))}toRawBytes($=!0){return i0(this.toHex($))}}d.BASE=new d(Xq,Dq,1n);d.ZERO=new d(0n,1n,0n);var{BASE:D0,ZERO:d0}=d,Kq=($,J)=>$.toString(16).padStart(J,"0"),q8=($)=>Array.from($).map((J)=>Kq(J,2)).join(""),i0=($)=>{const J=$.length;if(!Gq($)||J%2)u("hex invalid 1");const Q=A0(J/2);for(let q=0;q<Q.length;q++){const Y=q*2,W=$.slice(Y,Y+2),I=Number.parseInt(W,16);if(Number.isNaN(I)||I<0)u("hex invalid 2");Q[q]=I}return Q},o0=($)=>BigInt("0x"+(q8($)||"0")),Qq=($,J,Q)=>o0($.slice(J,Q)),Y8=($)=>{return n0($)&&$>=0n&&$<$8?i0(Kq($,64)):u("bigint expected")},qq=($)=>q8(Y8($)),Yq=(...$)=>{const J=A0($.reduce((q,Y)=>q+sJ(Y).length,0));let Q=0;return $.forEach((q)=>{J.set(q,Q),Q+=q.length}),J},Nq=($,J=b$)=>{if($===0n||J<=0n)u("no inverse n="+$+" mod="+J);let Q=w($,J),q=J,Y=0n,W=1n,I=1n,X=0n;while(Q!==0n){const D=q/Q,A=q%Q,Z=Y-I*D,K=W-X*D;q=Q,Q=A,Y=I,W=X,I=Z,X=K}return q===1n?w(Y,J):u("no inverse")},J9=($)=>{let J=1n;for(let Q=$,q=(b$+1n)/4n;q>0n;q>>=1n){if(q&1n)J=J*Q%b$;Q=Q*Q%b$}return w(J*J)===$?J:u("sqrt invalid")},Q9=($)=>{if(!n0($))$=o0(Q8($,32));return Zq($)?$:u("private key out of range")};var Wq=()=>typeof globalThis==="object"&&("crypto"in globalThis)?globalThis.crypto:void 0,p0;var q9=($)=>{$=Q8($);const J=40;if($.length<J||$.length>1024)u("expected proper params");const Q=w(o0($),J8-1n)+1n;return Y8(Q)},Y9={hexToBytes:i0,bytesToHex:q8,concatBytes:Yq,bytesToNumberBE:o0,numberToBytesBE:Y8,mod:w,invert:Nq,hmacSha256Async:async($,...J)=>{const Q=Wq(),q=Q&&Q.subtle;if(!q)return u("etc.hmacSha256Async not set");const Y=await q.importKey("raw",$,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return A0(await q.sign("HMAC",Y,Yq(...J)))},hmacSha256Sync:p0,hashToPrivateKey:q9,randomBytes:($=32)=>{const J=Wq();if(!J||!J.getRandomValues)u("crypto.getRandomValues must be defined");return J.getRandomValues(A0($))}};Object.defineProperties(Y9,{hmacSha256Sync:{configurable:!1,get(){return p0},set($){if(!p0)p0=$}}});var F$=8,W9=()=>{const $=[],J=256/F$+1;let Q=D0,q=Q;for(let Y=0;Y<J;Y++){q=Q,$.push(q);for(let W=1;W<2**(F$-1);W++)q=q.add(Q),$.push(q);Q=q.double()}return $},Iq=void 0,I9=($)=>{const J=Iq||(Iq=W9()),Q=(Z,K)=>{let U=K.negate();return Z?U:K};let q=d0,Y=D0;const W=1+256/F$,I=2**(F$-1),X=BigInt(2**F$-1),D=2**F$,A=BigInt(F$);for(let Z=0;Z<W;Z++){const K=Z*I;let U=Number($&X);if($>>=A,U>I)U-=D,$+=1n;const C=K,G=K+Math.abs(U)-1,N=Z%2!==0,O=U<0;if(U===0)Y=Y.add(Q(N,J[C]));else q=q.add(Q(O,J[G]))}return{p:q,f:Y}};var Mq=($)=>Uint8Array.from(atob($),(J)=>J.charCodeAt(0));function X9($,J,Q){const q=D9(Q);return aJ({address:q,keyId:J,async signMessage({message:Y}){const W=await $.authenticateAndSign(J,_J(Y),R$.NO_HASH),I=W8(W);return X0(I)},async signTransaction(Y,W){const I=W?.serializer||FJ,X=(()=>{if(Y.type==="eip4844")return{...Y,sidecars:!1};return Y})(),D=await $.authenticateAndSign(J,l(I(X)),R$.NO_HASH),A=W8(D);return console.log("GENERATED SIGN ",A),I(Y,A)},async signTypedData(Y){const W=await $.authenticateAndSign(J,PJ(Y),R$.NO_HASH),I=W8(W);return X0(I)}})}var D9=function($){if($.startsWith("0x"))$=$.slice(2);if($.startsWith("04"))return v0(`0x${$} `);else if($.startsWith("02")||$.startsWith("03")){const J=d.fromHex($).toHex(!1);return v0(`0x${J}`)}else throw new Error("Invalid public key")},W8=function($){const J=$.sign,Q=Mq(J),q=B(Q.slice(0,32)),Y=B(Q.slice(32,64)),W=$.recid;return{r:q,s:Y,v:W===0?BigInt(27):BigInt(28),yParity:W}};var Z9=function($,J,Q){return{types:{EIP712Domain:Uq,...A9},domain:Oq,primaryType:"Request",message:{setup:$,authentication:{challenge:J,wallet_id:Q}}}},K9=function($,J,Q){return{types:{EIP712Domain:Uq,...G9},domain:Oq,primaryType:"Request",message:{setup:$,authentication:{challenge:J,wallet_id:Q}}}};async function wq($,J,Q){const q=await Q.requestAggregatedChallenge(J),Y=Q.getWalletId();let W;if(N8($))console.log("Creating Sign request"),W=K9($,q.challenge,Y);else console.log("Creating Keygen request"),W=Z9($,q.challenge,Y);const I=await K8(J,W);return console.log("User signed a request",I),await Q.verifyUserSignature(J,W,I,q.instance),{challenge:q.challenge,instance:q.instance,user_sig:I}}var Vq=[{name:"wallet_id",type:"string"},{name:"challenge",type:"string"}],A9={Request:[{name:"setup",type:"KeygenSetupOpts"},{name:"authentication",type:"AuthenticationOpts"}],AuthenticationOpts:Vq,KeygenSetupOpts:[{name:"t",type:"uint32"},{name:"n",type:"uint32"}]},G9={Request:[{name:"setup",type:"SignSetupOpts"},{name:"authentication",type:"AuthenticationOpts"}],AuthenticationOpts:Vq,SignSetupOpts:[{name:"message",type:"string"},{name:"key_id",type:"string"},{name:"hash_algo",type:"string"}]},Oq={name:"SilentShard authentication",version:"0.1.0"},Uq=[{name:"name",type:"string"},{name:"version",type:"string"}];var I8;(function(Q){Q[Q["EOA"]=0]="EOA";Q[Q["NONE"]=1]="NONE"})(I8||(I8={}));class Cq{userId;constructor($){this.userId=$}async authenticate($,J){return await wq($,this.userId,J)}}export{Z8 as setActiveBrowserWallet,t0 as selectedBrowserWalletId,G8 as discoveredBrowserWallets,Eq as detectBrowserWallets,X9 as createViemAccount,Tq as connectToBrowserWallet,N0 as accountsFromBrowserWallet,M8 as NetworkSigner,R$ as HashAlgo,Cq as EOAAuth,I8 as AuthMethod};
|
|
18425
|
+
\u6B47`.split("\n");d$();p$();function tJ($){if(typeof $==="string"){if(!s($,{strict:!1}))throw new r({address:$});return{address:$,type:"json-rpc"}}if(!s($.address,{strict:!1}))throw new r({address:$.address});return{address:$.address,experimental_signAuthMessage:$.experimental_signAuthMessage,signMessage:$.signMessage,signTransaction:$.signTransaction,signTypedData:$.signTypedData,source:"custom",type:"local"}}/*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */var eJ=2n**256n,b$=eJ-0x1000003d1n,$8=eJ-0x14551231950b75fc4402da1732fc9bebfn,qq=0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n,Yq=0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n,Wq={p:b$,n:$8,a:0n,b:7n,Gx:qq,Gy:Yq};var tQ=($)=>w(w($*$)*$+Wq.b),h=($="")=>{throw new Error($)},p0=($)=>typeof $==="bigint",Dq=($)=>typeof $==="string",aJ=($)=>p0($)&&0n<$&&$<b$,Xq=($)=>p0($)&&0n<$&&$<$8,oY=($)=>$ instanceof Uint8Array||$!=null&&typeof $==="object"&&$.constructor.name==="Uint8Array",sJ=($,J)=>!oY($)||typeof J==="number"&&J>0&&$.length!==J?h("Uint8Array expected"):$,I0=($)=>new Uint8Array($),J8=($,J)=>sJ(Dq($)?n0($):I0(sJ($)),J),w=($,J=b$)=>{let Q=$%J;return Q>=0n?Q:J+Q},aQ=($)=>$ instanceof p?$:h("Point expected");class p{constructor($,J,Q){this.px=$,this.py=J,this.pz=Q}static fromAffine($){return $.x===0n&&$.y===0n?p.ZERO:new p($.x,$.y,1n)}static fromHex($){$=J8($);let J=void 0;const Q=$[0],q=$.subarray(1),Y=sQ(q,0,32),W=$.length;if(W===33&&[2,3].includes(Q)){if(!aJ(Y))h("Point hex invalid: x not FE");let D=rY(tQ(Y));const X=(D&1n)===1n;if((Q&1)===1!==X)D=w(-D);J=new p(Y,D,1n)}if(W===65&&Q===4)J=new p(Y,sQ(q,32,64),1n);return J?J.ok():h("Point is not on curve")}static fromPrivateKey($){return A0.mul(tY($))}get x(){return this.aff().x}get y(){return this.aff().y}equals($){const{px:J,py:Q,pz:q}=this,{px:Y,py:W,pz:D}=aQ($),X=w(J*D),A=w(Y*q),I=w(Q*D),G=w(W*q);return X===A&&I===G}negate(){return new p(this.px,w(-this.py),this.pz)}double(){return this.add(this)}add($){const{px:J,py:Q,pz:q}=this,{px:Y,py:W,pz:D}=aQ($),{a:X,b:A}=Wq;let I=0n,G=0n,K=0n;const U=w(A*3n);let z=w(J*Y),Z=w(Q*W),N=w(q*D),O=w(J+Q),V=w(Y+W);O=w(O*V),V=w(z+Z),O=w(O-V),V=w(J+q);let j=w(Y+D);return V=w(V*j),j=w(z+N),V=w(V-j),j=w(Q+q),I=w(W+D),j=w(j*I),I=w(Z+N),j=w(j-I),K=w(X*V),I=w(U*N),K=w(I+K),I=w(Z-K),K=w(Z+K),G=w(I*K),Z=w(z+z),Z=w(Z+z),N=w(X*N),V=w(U*V),Z=w(Z+N),N=w(z-N),N=w(X*N),V=w(V+N),z=w(Z*V),G=w(G+z),z=w(j*V),I=w(O*I),I=w(I-z),z=w(O*Z),K=w(j*K),K=w(K+z),new p(I,G,K)}mul($,J=!0){if(!J&&$===0n)return m0;if(!Xq($))h("invalid scalar");if(this.equals(A0))return $9($).p;let Q=m0,q=A0;for(let Y=this;$>0n;Y=Y.double(),$>>=1n)if($&1n)Q=Q.add(Y);else if(J)q=q.add(Y);return Q}mulAddQUns($,J,Q){return this.mul(J,!1).add($.mul(Q,!1)).ok()}toAffine(){const{px:$,py:J,pz:Q}=this;if(this.equals(m0))return{x:0n,y:0n};if(Q===1n)return{x:$,y:J};const q=Iq(Q);if(w(Q*q)!==1n)h("invalid inverse");return{x:w($*q),y:w(J*q)}}assertValidity(){const{x:$,y:J}=this.aff();if(!aJ($)||!aJ(J))h("Point invalid: x or y");return w(J*J)===tQ($)?this:h("Point invalid: not on curve")}multiply($){return this.mul($)}aff(){return this.toAffine()}ok(){return this.assertValidity()}toHex($=!0){const{x:J,y:Q}=this.aff();return($?(Q&1n)===0n?"02":"03":"04")+eQ(J)+($?"":eQ(Q))}toRawBytes($=!0){return n0(this.toHex($))}}p.BASE=new p(qq,Yq,1n);p.ZERO=new p(0n,1n,0n);var{BASE:A0,ZERO:m0}=p,Aq=($,J)=>$.toString(16).padStart(J,"0"),Q8=($)=>Array.from($).map((J)=>Aq(J,2)).join(""),n0=($)=>{const J=$.length;if(!Dq($)||J%2)h("hex invalid 1");const Q=I0(J/2);for(let q=0;q<Q.length;q++){const Y=q*2,W=$.slice(Y,Y+2),D=Number.parseInt(W,16);if(Number.isNaN(D)||D<0)h("hex invalid 2");Q[q]=D}return Q},i0=($)=>BigInt("0x"+(Q8($)||"0")),sQ=($,J,Q)=>i0($.slice(J,Q)),q8=($)=>{return p0($)&&$>=0n&&$<eJ?n0(Aq($,64)):h("bigint expected")},eQ=($)=>Q8(q8($)),$q=(...$)=>{const J=I0($.reduce((q,Y)=>q+sJ(Y).length,0));let Q=0;return $.forEach((q)=>{J.set(q,Q),Q+=q.length}),J},Iq=($,J=b$)=>{if($===0n||J<=0n)h("no inverse n="+$+" mod="+J);let Q=w($,J),q=J,Y=0n,W=1n,D=1n,X=0n;while(Q!==0n){const A=q/Q,I=q%Q,G=Y-D*A,K=W-X*A;q=Q,Q=I,Y=D,W=X,D=G,X=K}return q===1n?w(Y,J):h("no inverse")},rY=($)=>{let J=1n;for(let Q=$,q=(b$+1n)/4n;q>0n;q>>=1n){if(q&1n)J=J*Q%b$;Q=Q*Q%b$}return w(J*J)===$?J:h("sqrt invalid")},tY=($)=>{if(!p0($))$=i0(J8($,32));return Xq($)?$:h("private key out of range")};var Jq=()=>typeof globalThis==="object"&&("crypto"in globalThis)?globalThis.crypto:void 0,d0;var aY=($)=>{$=J8($);const J=40;if($.length<J||$.length>1024)h("expected proper params");const Q=w(i0($),$8-1n)+1n;return q8(Q)},sY={hexToBytes:n0,bytesToHex:Q8,concatBytes:$q,bytesToNumberBE:i0,numberToBytesBE:q8,mod:w,invert:Iq,hmacSha256Async:async($,...J)=>{const Q=Jq(),q=Q&&Q.subtle;if(!q)return h("etc.hmacSha256Async not set");const Y=await q.importKey("raw",$,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return I0(await q.sign("HMAC",Y,$q(...J)))},hmacSha256Sync:d0,hashToPrivateKey:aY,randomBytes:($=32)=>{const J=Jq();if(!J||!J.getRandomValues)h("crypto.getRandomValues must be defined");return J.getRandomValues(I0($))}};Object.defineProperties(sY,{hmacSha256Sync:{configurable:!1,get(){return d0},set($){if(!d0)d0=$}}});var F$=8,eY=()=>{const $=[],J=256/F$+1;let Q=A0,q=Q;for(let Y=0;Y<J;Y++){q=Q,$.push(q);for(let W=1;W<2**(F$-1);W++)q=q.add(Q),$.push(q);Q=q.double()}return $},Qq=void 0,$9=($)=>{const J=Qq||(Qq=eY()),Q=(G,K)=>{let U=K.negate();return G?U:K};let q=m0,Y=A0;const W=1+256/F$,D=2**(F$-1),X=BigInt(2**F$-1),A=2**F$,I=BigInt(F$);for(let G=0;G<W;G++){const K=G*D;let U=Number($&X);if($>>=I,U>D)U-=A,$+=1n;const z=K,Z=K+Math.abs(U)-1,N=G%2!==0,O=U<0;if(U===0)Y=Y.add(Q(N,J[z]));else q=q.add(Q(O,J[Z]))}return{p:q,f:Y}};var Zq=($)=>Uint8Array.from(atob($),(J)=>J.charCodeAt(0)),Gq=($)=>btoa(String.fromCodePoint.apply(null,Array.from($)));function J9($,J,Q){const q=Q9(Q);return tJ({address:q,keyId:J,async signMessage({message:Y}){const W=await $.authenticateAndSign(J,_J(Y)),D=Y8(W);return X0(D)},async signTransaction(Y,W){const D=W?.serializer||xJ,X=(()=>{if(Y.type==="eip4844")return{...Y,sidecars:!1};return Y})(),A=await $.authenticateAndSign(J,c(D(X))),I=Y8(A);return console.log("GENERATED SIGN ",I),D(Y,I)},async signTypedData(Y){const W=await $.authenticateAndSign(J,kJ(Y)),D=Y8(W);return X0(D)}})}var Q9=function($){if($.startsWith("0x"))$=$.slice(2);if($.startsWith("04"))return b0(`0x${$} `);else if($.startsWith("02")||$.startsWith("03")){const J=p.fromHex($).toHex(!1);return b0(`0x${J}`)}else throw new Error("Invalid public key")},Y8=function($){const J=$.sign,Q=Zq(J),q=B(Q.slice(0,32)),Y=B(Q.slice(32,64)),W=$.recid;return{r:q,s:Y,v:W===0?BigInt(27):BigInt(28),yParity:W}};var D9=function($,J){const Q={t:$.t,n:$.n,key_label:$.key_label,metadata:[]};return{types:{EIP712Domain:Nq,...Y9},domain:Kq,primaryType:"Request",message:{setup:Q,challenge:J}}},X9=function($,J){return{types:{EIP712Domain:Nq,...W9},domain:Kq,primaryType:"Request",message:{setup:$,challenge:J}}};async function Mq({setup:$,user_id:J,challenge:Q,browserWallet:q}){let Y;if(K0($))console.log("Creating Sign request"),Y=X9($,Q);else console.log("Creating Keygen request"),Y=D9($,Q);console.log("typed request:"),console.log(JSON.stringify(Y,void 0,4));const W=await q.signTypedData(J,Y);return console.log("User signed a request",W),{credentials:{credentials:J,method:"eoa",id:"id"},signature:W}}var q9=[{name:"tag",type:"uint16"},{name:"value",type:"string"}],Y9={Request:[{name:"setup",type:"KeygenSetupOpts"},{name:"challenge",type:"string"}],KeygenSetupOpts:[{name:"t",type:"uint32"},{name:"n",type:"uint32"},{name:"metadata",type:"TaggedValue[]"}],TaggedValue:q9},W9={Request:[{name:"setup",type:"SignSetupOpts"},{name:"challenge",type:"string"}],SignSetupOpts:[{name:"t",type:"uint32"},{name:"key_id",type:"string"},{name:"message",type:"string"}]},Kq={name:"SilentShard authentication",version:"0.1.0"},Nq=[{name:"name",type:"string"},{name:"version",type:"string"}];var W8;(function(Q){Q[Q["EOA"]=0]="EOA";Q[Q["NONE"]=1]="NONE"})(W8||(W8={}));class Vq{userId;browserWallet;wpClient;constructor($,J,Q){this.userId=$,this.browserWallet=J,this.wpClient=Q}async authenticate({setup:$,challenge:J}){return await Mq({setup:$,user_id:this.userId,challenge:J,browserWallet:this.browserWallet})}}var y;(function(Y){Y[Y["initiated"]=0]="initiated";Y[Y["waitingForSign"]=1]="waitingForSign";Y[Y["waitingForResult"]=2]="waitingForResult";Y[Y["finished"]=3]="finished"})(y||(y={}));class Oq{walletProviderId;walletProviderUrl;constructor($){this.walletProviderId=$.walletProviderId,this.walletProviderUrl=$.walletProviderUrl}getWalletId(){return this.walletProviderId}async startKeygen({setup:$,signer:J}){return this.connect($,J).then((Q)=>Q)}async startSigngen({setup:$,signer:J}){return this.connect($,J).then((Q)=>Q)}connect($,J){return new Promise((Q,q)=>{let Y=y.initiated,W;if(K0($))W="signgen",$.message=Gq((new TextEncoder()).encode($.message));else W="keygen";const D=new WebSocket(`${this.walletProviderUrl}/${W}`);D.addEventListener("open",(X)=>{switch(console.log(`Connection opened in state ${Y} with event ${JSON.stringify(X,void 0,"\t")}`),Y){case y.initiated:Y=y.waitingForSign,console.log(`Sending setup: ${JSON.stringify($)}`),D.send(JSON.stringify($));break;case y.waitingForSign:case y.waitingForResult:Y=y.finished,q("Incorrect protocol state");break;case y.finished:break}}),D.addEventListener("message",async(X)=>{switch(console.log(`Connection message in state ${Y} with event ${JSON.stringify(X,void 0,"\t")}`),Y){case y.initiated:Y=y.finished,q("Incorrect protocol state");break;case y.waitingForSign:{Y=y.waitingForResult;const A=await J(X.data);console.log(`Sending signature: ${JSON.stringify(A)}`),D.send(JSON.stringify(A));break}case y.waitingForResult:Y=y.finished,D.close(),Q(X.data);break;case y.finished:break}}),D.addEventListener("error",(X)=>{if(console.log(`Connection error in state ${Y} with event ${JSON.stringify(X,void 0,"\t")}`),Y!=y.finished)Y=y.finished,q("Incorrect protocol state")}),D.addEventListener("close",(X)=>{if(console.log(`Connection closed in state ${Y} with event ${JSON.stringify(X,void 0,"\t")}`),Y!=y.finished)Y=y.finished,q("Incorrect protocol state")})})}}export{J9 as createViemAccount,Oq as WalletProviderServiceClient,Z8 as NetworkSigner,r0 as KeygenSetupOpts,Vq as EOAAuth,W8 as AuthMethod};
|
package/dist/networkSigner.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { AuthModule, UserAuthentication } from './authentication.ts';
|
|
2
|
-
import { type IWalletProviderServiceClient } from './
|
|
3
|
-
export declare enum HashAlgo {
|
|
4
|
-
SHA256 = "sha256",
|
|
5
|
-
SHA256D = "sha256d",
|
|
6
|
-
NO_HASH = "nohash"
|
|
7
|
-
}
|
|
2
|
+
import { type IWalletProviderServiceClient } from './walletProviderServiceClientInterface.ts';
|
|
8
3
|
export interface KeygenResponse {
|
|
9
4
|
key_id: string;
|
|
10
5
|
public_key: string;
|
|
@@ -14,14 +9,22 @@ export interface SignResponse {
|
|
|
14
9
|
recid?: number;
|
|
15
10
|
preSignId?: string;
|
|
16
11
|
}
|
|
17
|
-
export
|
|
12
|
+
export declare class KeygenSetupOpts {
|
|
18
13
|
t: number;
|
|
19
14
|
n: number;
|
|
20
|
-
|
|
15
|
+
key_label?: string;
|
|
16
|
+
metadata: [number, string][];
|
|
17
|
+
constructor({ t, n, key_label, permissions }: {
|
|
18
|
+
t: number;
|
|
19
|
+
n: number;
|
|
20
|
+
key_label?: string;
|
|
21
|
+
permissions?: string;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
21
24
|
export type SignSetupOpts = {
|
|
22
|
-
|
|
25
|
+
t: number;
|
|
23
26
|
key_id: string;
|
|
24
|
-
|
|
27
|
+
message: string;
|
|
25
28
|
};
|
|
26
29
|
export declare function isSignSetupOpts(params: KeygenSetupOpts | SignSetupOpts): params is SignSetupOpts;
|
|
27
30
|
export type UserAuthenticatedRequest<T> = {
|
|
@@ -36,7 +39,7 @@ export declare class NetworkSigner {
|
|
|
36
39
|
ttl: number;
|
|
37
40
|
wp_client: IWalletProviderServiceClient;
|
|
38
41
|
constructor(wp_client: IWalletProviderServiceClient, threshold: number, totalNodes: number, authModule: AuthModule, ttl?: number);
|
|
39
|
-
authenticateAndCreateKey(): Promise<KeygenResponse>;
|
|
40
|
-
authenticateAndSign(keyId: string,
|
|
42
|
+
authenticateAndCreateKey(permissions?: string): Promise<KeygenResponse>;
|
|
43
|
+
authenticateAndSign(keyId: string, message: string): Promise<SignResponse>;
|
|
41
44
|
}
|
|
42
45
|
//# sourceMappingURL=networkSigner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"networkSigner.d.ts","sourceRoot":"","sources":["../src/networkSigner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,
|
|
1
|
+
{"version":3,"file":"networkSigner.d.ts","sourceRoot":"","sources":["../src/networkSigner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAU,KAAK,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AAEtG,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID,qBAAa,eAAe;IAC1B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;gBAEjB,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE;CAYjH;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAGF,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,aAAa,GAAG,MAAM,IAAI,aAAa,CAEhG;AAGD,MAAM,MAAM,wBAAwB,CAAC,CAAC,IAAI;IACxC,KAAK,EAAE,CAAC,CAAC;IACT,mBAAmB,EAAE,kBAAkB,CAAC;IAExC,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,qBAAa,aAAa;IACxB,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,4BAA4B,CAAC;gBAGtC,SAAS,EAAE,4BAA4B,EACvC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,UAAU,EACtB,GAAG,GAAE,MAAW;IAcZ,wBAAwB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAuBvE,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;CAejF"}
|
package/dist/viemSigner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viemSigner.d.ts","sourceRoot":"","sources":["../src/viemSigner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAI7B,OAAO,
|
|
1
|
+
{"version":3,"file":"viemSigner.d.ts","sourceRoot":"","sources":["../src/viemSigner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAI7B,OAAO,EAAE,aAAa,EAAgB,MAAM,iBAAiB,CAAC;AAE9D;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC,YAAY,CAmCnH"}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export interface IWalletProviderServiceClient {
|
|
1
|
+
import { type KeygenSetupOpts, type KeygenResponse, type SignSetupOpts, type SignResponse } from './networkSigner';
|
|
2
|
+
import { type ClientConfig, IWalletProviderServiceClient, type Signer } from './walletProviderServiceClientInterface';
|
|
3
|
+
export declare class WalletProviderServiceClient implements IWalletProviderServiceClient {
|
|
4
|
+
walletProviderId: string;
|
|
5
|
+
walletProviderUrl: string;
|
|
6
|
+
constructor(config: ClientConfig);
|
|
8
7
|
getWalletId(): string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
startKeygen({ setup, signer }: {
|
|
9
|
+
setup: KeygenSetupOpts;
|
|
10
|
+
signer: Signer;
|
|
11
|
+
}): Promise<KeygenResponse>;
|
|
12
|
+
startSigngen({ setup, signer }: {
|
|
13
|
+
setup: SignSetupOpts;
|
|
14
|
+
signer: Signer;
|
|
15
|
+
}): Promise<SignResponse>;
|
|
16
|
+
connect(params: KeygenSetupOpts | SignSetupOpts, signer: Signer): Promise<KeygenResponse | SignResponse>;
|
|
13
17
|
}
|
|
14
18
|
//# sourceMappingURL=walletProviderServiceClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walletProviderServiceClient.d.ts","sourceRoot":"","sources":["../src/walletProviderServiceClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"walletProviderServiceClient.d.ts","sourceRoot":"","sources":["../src/walletProviderServiceClient.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,YAAY,EAElB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,KAAK,YAAY,EAAE,4BAA4B,EAAE,KAAK,MAAM,EAAE,MAAM,wCAAwC,CAAC;AAStH,qBAAa,2BAA4B,YAAW,4BAA4B;IAC9E,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;gBAEd,MAAM,EAAE,YAAY;IAKhC,WAAW,IAAI,MAAM;IAIf,WAAW,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QAAE,KAAK,EAAE,eAAe,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,CAAC;IAInG,YAAY,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QAAE,KAAK,EAAE,aAAa,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,CAAC;IAItG,OAAO,CAAC,MAAM,EAAE,eAAe,GAAG,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,YAAY,CAAC;CAkFzG"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { UserAuthentication } from './authentication';
|
|
2
|
+
import { KeygenResponse, KeygenSetupOpts, SignResponse, SignSetupOpts } from './networkSigner';
|
|
3
|
+
export type ClientConfig = {
|
|
4
|
+
walletProviderId: string;
|
|
5
|
+
walletProviderUrl: string;
|
|
6
|
+
secretKey: string;
|
|
7
|
+
};
|
|
8
|
+
export type Signer = (challenge: string) => Promise<UserAuthentication>;
|
|
9
|
+
export interface IWalletProviderServiceClient {
|
|
10
|
+
getWalletId(): string;
|
|
11
|
+
startKeygen({ setup, signer }: {
|
|
12
|
+
setup: KeygenSetupOpts;
|
|
13
|
+
signer: Signer;
|
|
14
|
+
}): Promise<KeygenResponse>;
|
|
15
|
+
startSigngen({ setup, signer }: {
|
|
16
|
+
setup: SignSetupOpts;
|
|
17
|
+
signer: Signer;
|
|
18
|
+
}): Promise<SignResponse>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=walletProviderServiceClientInterface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walletProviderServiceClientInterface.d.ts","sourceRoot":"","sources":["../src/walletProviderServiceClientInterface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE/F,MAAM,MAAM,YAAY,GAAG;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAExE,MAAM,WAAW,4BAA4B;IAC3C,WAAW,IAAI,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QAAE,KAAK,EAAE,eAAe,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACpG,YAAY,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QAAE,KAAK,EAAE,aAAa,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAClG"}
|
package/package.json
CHANGED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { type KeygenSetupOpts, type SignSetupOpts } from './networkSigner.ts';
|
|
2
|
-
import { type UserAuthentication } from './authentication.ts';
|
|
3
|
-
import { type IWalletProviderServiceClient } from './walletProviderServiceClient.ts';
|
|
4
|
-
export declare function authenticateUsingEOA(setup: KeygenSetupOpts | SignSetupOpts, user_id: string, wp_client: IWalletProviderServiceClient): Promise<UserAuthentication>;
|
|
5
|
-
//# sourceMappingURL=sdkEOAauthentication.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sdkEOAauthentication.d.ts","sourceRoot":"","sources":["../src/sdkEOAauthentication.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC/F,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,KAAK,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAoJrF,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,eAAe,GAAG,aAAa,EACtC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,4BAA4B,GACtC,OAAO,CAAC,kBAAkB,CAAC,CA8B7B"}
|
package/dist/walletEIP6963.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { TypedDataDomain } from 'viem';
|
|
2
|
-
interface EIP6963ProviderInfo {
|
|
3
|
-
uuid: string;
|
|
4
|
-
name: string;
|
|
5
|
-
icon: string;
|
|
6
|
-
rdns: string;
|
|
7
|
-
}
|
|
8
|
-
interface RequestArguments {
|
|
9
|
-
readonly method: string;
|
|
10
|
-
readonly params?: readonly unknown[] | object;
|
|
11
|
-
}
|
|
12
|
-
interface EIP1193Provider {
|
|
13
|
-
isStatus?: boolean;
|
|
14
|
-
host?: string;
|
|
15
|
-
path?: string;
|
|
16
|
-
request: (request: RequestArguments) => Promise<unknown>;
|
|
17
|
-
}
|
|
18
|
-
interface EIP6963ProviderDetail {
|
|
19
|
-
info: EIP6963ProviderInfo;
|
|
20
|
-
provider: EIP1193Provider;
|
|
21
|
-
}
|
|
22
|
-
export declare const discoveredBrowserWallets: Map<string, EIP6963ProviderDetail>;
|
|
23
|
-
export declare let selectedBrowserWalletId: string;
|
|
24
|
-
export declare let accountsFromBrowserWallet: Array<string>;
|
|
25
|
-
export declare const detectBrowserWallets: () => void;
|
|
26
|
-
export declare function setActiveBrowserWallet(wallet: EIP6963ProviderDetail): void;
|
|
27
|
-
export declare function connectToBrowserWallet(): Promise<void>;
|
|
28
|
-
export type FieldDefinition = {
|
|
29
|
-
name: string;
|
|
30
|
-
type: string;
|
|
31
|
-
};
|
|
32
|
-
export type TypedData<T> = {
|
|
33
|
-
types: Record<string, Array<FieldDefinition>>;
|
|
34
|
-
domain: TypedDataDomain;
|
|
35
|
-
primaryType: string;
|
|
36
|
-
message: T;
|
|
37
|
-
};
|
|
38
|
-
export declare function signTypedData<T>(from: string, request: TypedData<T>): Promise<unknown>;
|
|
39
|
-
export {};
|
|
40
|
-
//# sourceMappingURL=walletEIP6963.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"walletEIP6963.d.ts","sourceRoot":"","sources":["../src/walletEIP6963.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAG5C,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,gBAAgB;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,OAAO,EAAE,GAAG,MAAM,CAAC;CAC/C;AAED,UAAU,eAAe;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,OAAO,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1D;AAED,UAAU,qBAAqB;IAC7B,IAAI,EAAE,mBAAmB,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;CAC3B;AASD,eAAO,MAAM,wBAAwB,oCAA2C,CAAC;AACjF,eAAO,IAAI,uBAAuB,EAAE,MAAW,CAAC;AAIhD,eAAO,IAAI,yBAAyB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;AAGpD,eAAO,MAAM,oBAAoB,YAShC,CAAC;AAaF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,qBAAqB,QAOnE;AAQD,wBAAsB,sBAAsB,kBAW3C;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAOF,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;IACzB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;IAC9C,MAAM,EAAE,eAAe,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,CAAC,CAAC;CACZ,CAAC;AAKF,wBAAsB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAK5F"}
|