@boostxyz/cli 5.0.6 → 5.1.0
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/{ccip-5qPuVSlX.cjs → ccip-BKtQCYbq.cjs} +1 -1
- package/dist/{ccip-BmAT9pAw.js → ccip-CS9Qngig.js} +1 -1
- package/dist/cli.cjs +2 -2
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +55 -55
- package/dist/commands/deploy.cjs +14 -14
- package/dist/commands/deploy.d.ts +23 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +158 -158
- package/dist/commands/seed.cjs +1 -1
- package/dist/commands/seed.d.ts +1251 -0
- package/dist/commands/seed.d.ts.map +1 -0
- package/dist/commands/seed.js +19 -15
- package/dist/help.d.ts +3 -0
- package/dist/help.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/seed-BtP-9KaP.cjs +35 -0
- package/dist/{seed-D3rLsa0v.js → seed-DyYeHsUg.js} +7377 -7272
- package/dist/utils.d.ts +67 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +4 -4
- package/dist/seed-BsgCaY_s.cjs +0 -35
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type Hex } from 'viem';
|
|
2
|
+
import * as chains from 'viem/chains';
|
|
3
|
+
import { type ZodType, z } from 'zod';
|
|
4
|
+
export declare const Chains: Record<string, chains.Chain>;
|
|
5
|
+
export type Options = {
|
|
6
|
+
help?: boolean;
|
|
7
|
+
version?: boolean;
|
|
8
|
+
chain?: string;
|
|
9
|
+
privateKey?: string;
|
|
10
|
+
mnemonic?: string;
|
|
11
|
+
rpcUrl?: string;
|
|
12
|
+
out?: string;
|
|
13
|
+
cacheDir?: string;
|
|
14
|
+
force?: boolean;
|
|
15
|
+
format?: 'env' | 'json';
|
|
16
|
+
};
|
|
17
|
+
export type Command<T extends Record<string, unknown> = {}> = (positionals: string[], options: Options) => Promise<T>;
|
|
18
|
+
export declare function objectToEnv<T extends object>(obj: T): string;
|
|
19
|
+
export declare function envToObject(str: string): object;
|
|
20
|
+
export declare function validateJson(str: string): Record<string, unknown> | false;
|
|
21
|
+
export declare function getDeployableOptions({ chain: _chain, privateKey, mnemonic, rpcUrl, }: {
|
|
22
|
+
chain: string;
|
|
23
|
+
privateKey?: string;
|
|
24
|
+
mnemonic?: string;
|
|
25
|
+
rpcUrl?: string;
|
|
26
|
+
}): readonly [{
|
|
27
|
+
readonly config: import("@wagmi/core").Config<readonly [chains.Chain], Record<number, import("@wagmi/core").Transport<string, Record<string, any>, import("viem").EIP1193RequestFn>>>;
|
|
28
|
+
readonly account: {
|
|
29
|
+
address: import("viem").Address;
|
|
30
|
+
nonceManager?: import("viem").NonceManager | undefined;
|
|
31
|
+
sign: (parameters: {
|
|
32
|
+
hash: import("viem").Hash;
|
|
33
|
+
}) => Promise<Hex>;
|
|
34
|
+
experimental_signAuthorization: (parameters: import("viem/experimental").Authorization) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
|
|
35
|
+
signMessage: ({ message }: {
|
|
36
|
+
message: import("viem").SignableMessage;
|
|
37
|
+
}) => Promise<Hex>;
|
|
38
|
+
signTransaction: <serializer extends import("viem").SerializeTransactionFn<import("viem").TransactionSerializable> = import("viem").SerializeTransactionFn<import("viem").TransactionSerializable>, transaction extends Parameters<serializer>[0] = Parameters<serializer>[0]>(transaction: transaction, options?: {
|
|
39
|
+
serializer?: serializer | undefined;
|
|
40
|
+
} | undefined) => Promise<import("viem").IsNarrowable<import("viem").TransactionSerialized<import("viem").GetTransactionType<transaction>>, Hex> extends true ? import("viem").TransactionSerialized<import("viem").GetTransactionType<transaction>> : Hex>;
|
|
41
|
+
signTypedData: <const typedData extends import("viem").TypedData | Record<string, unknown>, primaryType extends keyof typedData | "EIP712Domain" = keyof typedData>(parameters: import("viem").TypedDataDefinition<typedData, primaryType>) => Promise<Hex>;
|
|
42
|
+
publicKey: Hex;
|
|
43
|
+
source: "privateKey";
|
|
44
|
+
type: "local";
|
|
45
|
+
} | {
|
|
46
|
+
address: import("viem").Address;
|
|
47
|
+
nonceManager?: import("viem").NonceManager | undefined;
|
|
48
|
+
sign: (parameters: {
|
|
49
|
+
hash: import("viem").Hash;
|
|
50
|
+
}) => Promise<Hex>;
|
|
51
|
+
experimental_signAuthorization?: ((parameters: import("viem/experimental").Authorization) => Promise<import("viem/accounts").SignAuthorizationReturnType>) | undefined;
|
|
52
|
+
signMessage: ({ message }: {
|
|
53
|
+
message: import("viem").SignableMessage;
|
|
54
|
+
}) => Promise<Hex>;
|
|
55
|
+
signTransaction: <serializer extends import("viem").SerializeTransactionFn<import("viem").TransactionSerializable> = import("viem").SerializeTransactionFn<import("viem").TransactionSerializable>, transaction extends Parameters<serializer>[0] = Parameters<serializer>[0]>(transaction: transaction, options?: {
|
|
56
|
+
serializer?: serializer | undefined;
|
|
57
|
+
} | undefined) => Promise<import("viem").IsNarrowable<import("viem").TransactionSerialized<import("viem").GetTransactionType<transaction>>, Hex> extends true ? import("viem").TransactionSerialized<import("viem").GetTransactionType<transaction>> : Hex>;
|
|
58
|
+
signTypedData: <const typedData extends import("viem").TypedData | Record<string, unknown>, primaryType extends keyof typedData | "EIP712Domain" = keyof typedData>(parameters: import("viem").TypedDataDefinition<typedData, primaryType>) => Promise<Hex>;
|
|
59
|
+
publicKey: Hex;
|
|
60
|
+
source: "hd";
|
|
61
|
+
type: "local";
|
|
62
|
+
getHdKey: () => import("viem").HDKey;
|
|
63
|
+
};
|
|
64
|
+
}, chains.Chain];
|
|
65
|
+
export declare function coerceBigInts<T extends ZodType>(obj: unknown, schema: T): z.infer<T>;
|
|
66
|
+
export declare function stringifyBigInts<T extends ZodType>(schema: T): ZodType;
|
|
67
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,GAAG,EAKT,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAkC,KAAK,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAEtE,eAAO,MAAM,MAAM,EAAa,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;AAE7D,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,IAAI,CAC5D,WAAW,EAAE,MAAM,EAAE,EACrB,OAAO,EAAE,OAAO,KACb,OAAO,CAAC,CAAC,CAAC,CAAC;AAEhB,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,UAInD;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAc/C;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,KAAK,CAMzE;AAED,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EAAE,MAAM,EACb,UAAU,EACV,QAAQ,EACR,MAAM,GACP,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;;;;;;;;;;;;wTAHiB,CAAC;sBACD,CAAC;;;;;;;;;;;;;;;;wTADD,CAAC;sBACD,CAAC;;;;;;;;iBAmClB;AAED,wBAAgB,aAAa,CAAC,CAAC,SAAS,OAAO,EAC7C,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,CAAC,GACR,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAyBZ;AAED,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,OAAO,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CAoBtE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boostxyz/cli",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "A repository of useful scripts to interact with the protocol",
|
|
5
5
|
"repository": "https://github.com/boostxyz/boost-protocol",
|
|
6
6
|
"author": "Boost Team<boost-team@boost.xyz>",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
},
|
|
46
46
|
"license": "GPL-3.0-or-later",
|
|
47
47
|
"optionalDependencies": {
|
|
48
|
-
"@boostxyz/sdk": "6.1.
|
|
48
|
+
"@boostxyz/sdk": "6.1.3"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
|
-
"build": "vite build",
|
|
52
|
-
"check:ts": "tsc --build --emitDeclarationOnly --declaration --declarationMap --force",
|
|
51
|
+
"build": "vite build && pnpm check:ts",
|
|
52
|
+
"check:ts": "tsc --build --emitDeclarationOnly --sourceMap --declaration --declarationMap --force",
|
|
53
53
|
"dev": "vite build --watch",
|
|
54
54
|
"clean": "rm -rf dist"
|
|
55
55
|
}
|
package/dist/seed-BsgCaY_s.cjs
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";const la=require("node:fs/promises"),fa=require("node:path"),j=require("@boostxyz/sdk"),W=require("./utils-dz3mUqTs.cjs");function Pn(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;let n,r;if(Array.isArray(t)&&Array.isArray(e)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Pn(t[r],e[r]))return!1;return!0}if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();const s=Object.keys(t);if(n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const a=s[r];if(a&&!Pn(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}class ha extends W.BaseError$1{constructor({value:e}){super(`Number \`${e}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function pa(t,e){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(t))throw new ha({value:t});let[n,r="0"]=t.split(".");const s=n.startsWith("-");if(s&&(n=n.slice(1)),r=r.replace(/(0+)$/,""),e===0)Math.round(+`.${r}`)===1&&(n=`${BigInt(n)+1n}`),r="";else if(r.length>e){const[a,i,o]=[r.slice(0,e-1),r.slice(e-1,e),r.slice(e)],u=Math.round(+`${i}.${o}`);u>9?r=`${BigInt(a)+BigInt(1)}0`.padStart(a.length+1,"0"):r=`${a}${u}`,r.length>e&&(r=r.slice(1),n=`${BigInt(n)+1n}`),r=r.slice(0,e)}else r=r.padEnd(e,"0");return BigInt(`${s?"-":""}${n}${r}`)}function zr(t,e="wei"){return pa(t,W.etherUnits[e])}const wr="0x0000000000000000000000000000000000000000",Zr="2.22.1";let tt={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:n})=>e?`${t??"https://viem.sh"}${e}${n?`#${n}`:""}`:void 0,version:`viem@${Zr}`},m=class En extends Error{constructor(e,n={}){var o;const r=(()=>{var u;return n.cause instanceof En?n.cause.details:(u=n.cause)!=null&&u.message?n.cause.message:n.details})(),s=n.cause instanceof En&&n.cause.docsPath||n.docsPath,a=(o=tt.getDocsUrl)==null?void 0:o.call(tt,{...n,docsPath:s}),i=[e||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...tt.version?[`Version: ${tt.version}`]:[]].join(`
|
|
2
|
-
`);super(i,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=e,this.version=Zr}walk(e){return Dr(this,e)}};function Dr(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?Dr(t.cause,e):e?null:t}class Lr extends m{constructor({max:e,min:n,signed:r,size:s,value:a}){super(`Number "${a}" is not in safe ${s?`${s*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${n} to ${e})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}}class ma extends m{constructor(e){super(`Bytes value "${e}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}class ya extends m{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}class Ur extends m{constructor({offset:e,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}}class Vr extends m{constructor({size:e,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}}class xr extends m{constructor({size:e,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${e} ${r} long.`,{name:"InvalidBytesLengthError"})}}function Qe(t,{dir:e,size:n=32}={}){return typeof t=="string"?xe(t,{dir:e,size:n}):ba(t,{dir:e,size:n})}function xe(t,{dir:e,size:n=32}={}){if(n===null)return t;const r=t.replace("0x","");if(r.length>n*2)throw new Vr({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[e==="right"?"padEnd":"padStart"](n*2,"0")}`}function ba(t,{dir:e,size:n=32}={}){if(n===null)return t;if(t.length>n)throw new Vr({size:t.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let s=0;s<n;s++){const a=e==="right";r[a?s:n-s-1]=t[a?s:t.length-s-1]}return r}function ye(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function F(t){return ye(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}function Gn(t,{dir:e="left"}={}){let n=typeof t=="string"?t.replace("0x",""):t,r=0;for(let s=0;s<n.length-1&&n[e==="left"?s:n.length-s-1].toString()==="0";s++)r++;return n=e==="left"?n.slice(r):n.slice(0,n.length-r),typeof t=="string"?(n.length===1&&e==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}const ga=new TextEncoder;function Hn(t,e={}){return typeof t=="number"||typeof t=="bigint"?wa(t,e):typeof t=="boolean"?va(t,e):ye(t)?be(t,e):Gr(t,e)}function va(t,e={}){const n=new Uint8Array(1);return n[0]=Number(t),typeof e.size=="number"?(ue(n,{size:e.size}),Qe(n,{size:e.size})):n}const fe={zero:48,nine:57,A:65,F:70,a:97,f:102};function _r(t){if(t>=fe.zero&&t<=fe.nine)return t-fe.zero;if(t>=fe.A&&t<=fe.F)return t-(fe.A-10);if(t>=fe.a&&t<=fe.f)return t-(fe.a-10)}function be(t,e={}){let n=t;e.size&&(ue(n,{size:e.size}),n=Qe(n,{dir:"right",size:e.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const s=r.length/2,a=new Uint8Array(s);for(let i=0,o=0;i<s;i++){const u=_r(r.charCodeAt(o++)),c=_r(r.charCodeAt(o++));if(u===void 0||c===void 0)throw new m(`Invalid byte sequence ("${r[o-2]}${r[o-1]}" in "${r}").`);a[i]=u*16+c}return a}function wa(t,e){const n=R(t,e);return be(n)}function Gr(t,e={}){const n=ga.encode(t);return typeof e.size=="number"?(ue(n,{size:e.size}),Qe(n,{dir:"right",size:e.size})):n}function ue(t,{size:e}){if(F(t)>e)throw new ya({givenSize:F(t),maxSize:e})}function it(t,e={}){const{signed:n}=e;e.size&&ue(t,{size:e.size});const r=BigInt(t);if(!n)return r;const s=(t.length-2)/2,a=(1n<<BigInt(s)*8n-1n)-1n;return r<=a?r:r-BigInt(`0x${"f".padStart(s*2,"f")}`)-1n}function He(t,e={}){return Number(it(t,e))}const xa=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function An(t,e={}){return typeof t=="number"||typeof t=="bigint"?R(t,e):typeof t=="string"?qn(t,e):typeof t=="boolean"?Hr(t,e):G(t,e)}function Hr(t,e={}){const n=`0x${Number(t)}`;return typeof e.size=="number"?(ue(n,{size:e.size}),Qe(n,{size:e.size})):n}function G(t,e={}){let n="";for(let s=0;s<t.length;s++)n+=xa[t[s]];const r=`0x${n}`;return typeof e.size=="number"?(ue(r,{size:e.size}),Qe(r,{dir:"right",size:e.size})):r}function R(t,e={}){const{signed:n,size:r}=e,s=BigInt(t);let a;r?n?a=(1n<<BigInt(r)*8n-1n)-1n:a=2n**(BigInt(r)*8n)-1n:typeof t=="number"&&(a=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof a=="bigint"&&n?-a-1n:0;if(a&&s>a||s<i){const u=typeof t=="bigint"?"n":"";throw new Lr({max:a?`${a}${u}`:void 0,min:`${i}${u}`,signed:n,size:r,value:`${t}${u}`})}const o=`0x${(n&&s<0?(1n<<BigInt(r*8))+BigInt(s):s).toString(16)}`;return r?Qe(o,{size:r}):o}const _a=new TextEncoder;function qn(t,e={}){const n=_a.encode(t);return G(n,e)}function qe(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new Ma(t.type);return`${t.name}(${Wn(t.inputs,{includeName:e})})`}function Wn(t,{includeName:e=!1}={}){return t?t.map(n=>Pa(n,{includeName:e})).join(e?", ":","):""}function Pa(t,{includeName:e}){return t.type.startsWith("tuple")?`(${Wn(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}class Ea extends m{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
|
|
3
|
-
`),{docsPath:e,name:"AbiConstructorNotFoundError"})}}class Pr extends m{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
|
|
4
|
-
`),{docsPath:e,name:"AbiConstructorParamsNotFoundError"})}}class Aa extends m{constructor({data:e,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
|
|
5
|
-
`),{metaMessages:[`Params: (${Wn(n,{includeName:!0})})`,`Data: ${e} (${r} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=n,this.size=r}}class Kn extends m{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class Ta extends m{constructor({expectedLength:e,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${e}`,`Given length: ${n}`].join(`
|
|
6
|
-
`),{name:"AbiEncodingArrayLengthMismatchError"})}}class ka extends m{constructor({expectedSize:e,value:n}){super(`Size of bytes "${n}" (bytes${F(n)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class $a extends m{constructor({expectedLength:e,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${n}`].join(`
|
|
7
|
-
`),{name:"AbiEncodingLengthMismatchError"})}}class qr extends m{constructor(e,{docsPath:n}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join(`
|
|
8
|
-
`),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class Vt extends m{constructor(e,{docsPath:n}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
|
|
9
|
-
`),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class Ca extends m{constructor(e,{docsPath:n}){super([`Function "${e}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
|
|
10
|
-
`),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class Sa extends m{constructor(e,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${qe(e.abiItem)}\`, and`,`\`${n.type}\` in \`${qe(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class Ia extends m{constructor(e,{docsPath:n}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
|
|
11
|
-
`),{docsPath:n,name:"InvalidAbiEncodingType"})}}class Ra extends m{constructor(e,{docsPath:n}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
|
|
12
|
-
`),{docsPath:n,name:"InvalidAbiDecodingType"})}}class Oa extends m{constructor(e){super([`Value "${e}" is not a valid array.`].join(`
|
|
13
|
-
`),{name:"InvalidArrayError"})}}class Ma extends m{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
|
|
14
|
-
`),{name:"InvalidDefinitionTypeError"})}}function Ie(t){return typeof t[0]=="string"?rn(t):ja(t)}function ja(t){let e=0;for(const s of t)e+=s.length;const n=new Uint8Array(e);let r=0;for(const s of t)n.set(s,r),r+=s.length;return n}function rn(t){return`0x${t.reduce((e,n)=>e+n.replace("0x",""),"")}`}class We extends m{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class sn extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const n=super.get(e);return super.has(e)&&n!==void 0&&(this.delete(e),super.set(e,n)),n}set(e,n){if(super.set(e,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}}function Nt(t,e){const n=e||"hex",r=W.keccak_256(ye(t,{strict:!1})?Hn(t):t);return n==="bytes"?r:An(r)}const pn=new sn(8192);function an(t,e){if(pn.has(`${t}.${e}`))return pn.get(`${t}.${e}`);const n=t.substring(2).toLowerCase(),r=Nt(Gr(n),"bytes"),s=n.split("");for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&s[i]&&(s[i]=s[i].toUpperCase()),(r[i>>1]&15)>=8&&s[i+1]&&(s[i+1]=s[i+1].toUpperCase());const a=`0x${s.join("")}`;return pn.set(`${t}.${e}`,a),a}function Na(t,e){if(!ge(t,{strict:!1}))throw new We({address:t});return an(t,e)}const Ba=/^0x[a-fA-F0-9]{40}$/,mn=new sn(8192);function ge(t,e){const{strict:n=!0}=e??{},r=`${t}.${n}`;if(mn.has(r))return mn.get(r);const s=Ba.test(t)?t.toLowerCase()===t?!0:n?an(t)===t:!0:!1;return mn.set(r,s),s}function Gt(t,e,n,{strict:r}={}){return ye(t,{strict:!1})?Fa(t,e,n,{strict:r}):Jr(t,e,n,{strict:r})}function Wr(t,e){if(typeof e=="number"&&e>0&&e>F(t)-1)throw new Ur({offset:e,position:"start",size:F(t)})}function Kr(t,e,n){if(typeof e=="number"&&typeof n=="number"&&F(t)!==n-e)throw new Ur({offset:n,position:"end",size:F(t)})}function Jr(t,e,n,{strict:r}={}){Wr(t,e);const s=t.slice(e,n);return r&&Kr(s,e,n),s}function Fa(t,e,n,{strict:r}={}){Wr(t,e);const s=`0x${t.replace("0x","").slice((e??0)*2,(n??t.length)*2)}`;return r&&Kr(s,e,n),s}const za=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function Jn(t,e){if(t.length!==e.length)throw new $a({expectedLength:t.length,givenLength:e.length});const n=Za({params:t,values:e}),r=Xn(n);return r.length===0?"0x":r}function Za({params:t,values:e}){const n=[];for(let r=0;r<t.length;r++)n.push(Yn({param:t[r],value:e[r]}));return n}function Yn({param:t,value:e}){const n=Qn(t.type);if(n){const[r,s]=n;return La(e,{length:r,param:{...t,type:s}})}if(t.type==="tuple")return qa(e,{param:t});if(t.type==="address")return Da(e);if(t.type==="bool")return Va(e);if(t.type.startsWith("uint")||t.type.startsWith("int")){const r=t.type.startsWith("int"),[,,s="256"]=za.exec(t.type)??[];return Ga(e,{signed:r,size:Number(s)})}if(t.type.startsWith("bytes"))return Ua(e,{param:t});if(t.type==="string")return Ha(e);throw new Ia(t.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Xn(t){let e=0;for(let a=0;a<t.length;a++){const{dynamic:i,encoded:o}=t[a];i?e+=32:e+=F(o)}const n=[],r=[];let s=0;for(let a=0;a<t.length;a++){const{dynamic:i,encoded:o}=t[a];i?(n.push(R(e+s,{size:32})),r.push(o),s+=F(o)):n.push(o)}return Ie([...n,...r])}function Da(t){if(!ge(t))throw new We({address:t});return{dynamic:!1,encoded:xe(t.toLowerCase())}}function La(t,{length:e,param:n}){const r=e===null;if(!Array.isArray(t))throw new Oa(t);if(!r&&t.length!==e)throw new Ta({expectedLength:e,givenLength:t.length,type:`${n.type}[${e}]`});let s=!1;const a=[];for(let i=0;i<t.length;i++){const o=Yn({param:n,value:t[i]});o.dynamic&&(s=!0),a.push(o)}if(r||s){const i=Xn(a);if(r){const o=R(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?Ie([o,i]):o}}if(s)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:Ie(a.map(({encoded:i})=>i))}}function Ua(t,{param:e}){const[,n]=e.type.split("bytes"),r=F(t);if(!n){let s=t;return r%32!==0&&(s=xe(s,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:Ie([xe(R(r,{size:32})),s])}}if(r!==Number.parseInt(n))throw new ka({expectedSize:Number.parseInt(n),value:t});return{dynamic:!1,encoded:xe(t,{dir:"right"})}}function Va(t){if(typeof t!="boolean")throw new m(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:xe(Hr(t))}}function Ga(t,{signed:e,size:n=256}){if(typeof n=="number"){const r=2n**(BigInt(n)-(e?1n:0n))-1n,s=e?-r-1n:0n;if(t>r||t<s)throw new Lr({max:r.toString(),min:s.toString(),signed:e,size:n/8,value:t.toString()})}return{dynamic:!1,encoded:R(t,{size:32,signed:e})}}function Ha(t){const e=qn(t),n=Math.ceil(F(e)/32),r=[];for(let s=0;s<n;s++)r.push(xe(Gt(e,s*32,(s+1)*32),{dir:"right"}));return{dynamic:!0,encoded:Ie([xe(R(F(e),{size:32})),...r])}}function qa(t,{param:e}){let n=!1;const r=[];for(let s=0;s<e.components.length;s++){const a=e.components[s],i=Array.isArray(t)?s:a.name,o=Yn({param:a,value:t[i]});r.push(o),o.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Xn(r):Ie(r.map(({encoded:s})=>s))}}function Qn(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const yn="/docs/contract/encodeDeployData";function Yr(t){const{abi:e,args:n,bytecode:r}=t;if(!n||n.length===0)return r;const s=e.find(i=>"type"in i&&i.type==="constructor");if(!s)throw new Ea({docsPath:yn});if(!("inputs"in s))throw new Pr({docsPath:yn});if(!s.inputs||s.inputs.length===0)throw new Pr({docsPath:yn});const a=Jn(s.inputs,n);return rn([r,a])}function de(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}class Xr extends m{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(`
|
|
15
|
-
`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class bn extends m{constructor({docsPath:e,metaMessages:n,type:r}){super(`Account type "${r}" is not supported.`,{docsPath:e,metaMessages:n,name:"AccountTypeNotSupportedError"})}}function Wa(t){const e=Nt(`0x${t.substring(4)}`).substring(26);return an(`0x${e}`)}async function Ka({hash:t,signature:e}){const n=ye(t)?t:An(t),{secp256k1:r}=await Promise.resolve().then(()=>require("./utils-dz3mUqTs.cjs")).then(i=>i.secp256k1);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:c,s:d,v:f,yParity:h}=e,y=Number(h??f),v=Er(y);return new r.Signature(it(c),it(d)).addRecoveryBit(v)}const i=ye(e)?e:An(e),o=He(`0x${i.slice(130)}`),u=Er(o);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(u)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Er(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function Ja({hash:t,signature:e}){return Wa(await Ka({hash:t,signature:e}))}class Ar extends m{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class Ya extends m{constructor({length:e,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class Xa extends m{constructor({count:e,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const Qa={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 Xa({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new Ya({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new Ar({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new Ar({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const n=e??this.position;return this.assertPosition(n+t-1),this.bytes.subarray(n,n+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const n=this.inspectBytes(t);return this.position+=e??t,n},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function er(t,{recursiveReadLimit:e=8192}={}){const n=Object.create(Qa);return n.bytes=t,n.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=e,n}function ei(t,e="hex"){const n=Qr(t),r=er(new Uint8Array(n.length));return n.encode(r),e==="hex"?G(r.bytes):r.bytes}function Qr(t){return Array.isArray(t)?ti(t.map(e=>Qr(e))):ni(t)}function ti(t){const e=t.reduce((s,a)=>s+a.length,0),n=es(e);return{length:e<=55?1+e:1+n+e,encode(s){e<=55?s.pushByte(192+e):(s.pushByte(247+n),n===1?s.pushUint8(e):n===2?s.pushUint16(e):n===3?s.pushUint24(e):s.pushUint32(e));for(const{encode:a}of t)a(s)}}}function ni(t){const e=typeof t=="string"?be(t):t,n=es(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+n+e.length,encode(s){e.length===1&&e[0]<128?s.pushBytes(e):e.length<=55?(s.pushByte(128+e.length),s.pushBytes(e)):(s.pushByte(183+n),n===1?s.pushUint8(e.length):n===2?s.pushUint16(e.length):n===3?s.pushUint24(e.length):s.pushUint32(e.length),s.pushBytes(e))}}}function es(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new m("Length is too large.")}function ri(t){const{chainId:e,contractAddress:n,nonce:r,to:s}=t,a=Nt(rn(["0x05",ei([e?R(e):"0x",n,r?R(r):"0x"])]));return s==="bytes"?be(a):a}async function ts(t){const{authorization:e,signature:n}=t;return Ja({hash:ri(e),signature:n??e})}class Tn extends m{constructor({blockNumber:e,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...e&&r.blockCreated&&r.blockCreated>e?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${e}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class si extends m{constructor({chain:e,currentChainId:n}){super(`The current chain of the wallet (id: ${n}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${n}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class ai extends m{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(`
|
|
16
|
-
`),{name:"ChainNotFoundError"})}}class ns extends m{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}function ii({chain:t,currentChainId:e}){if(!t)throw new ai;if(e!==t.id)throw new si({chain:t,currentChainId:e})}const oi={gwei:9,wei:18},ci={ether:-9,wei:9};function rs(t,e){let n=t.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(e,"0");let[s,a]=[n.slice(0,n.length-e),n.slice(n.length-e)];return a=a.replace(/(0+)$/,""),`${r?"-":""}${s||"0"}${a?`.${a}`:""}`}function V(t,e="wei"){return rs(t,ci[e])}class De extends m{constructor({cause:e,message:n}={}){var s;const r=(s=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:s.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(De,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(De,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Ht extends m{constructor({cause:e,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${V(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(Ht,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class kn extends m{constructor({cause:e,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${V(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(kn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class $n extends m{constructor({cause:e,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty($n,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Cn extends m{constructor({cause:e,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
|
|
17
|
-
`),{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(Cn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Sn extends m{constructor({cause:e,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(Sn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class In extends m{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
|
|
18
|
-
`),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(In,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class Rn extends m{constructor({cause:e,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(Rn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class On extends m{constructor({cause:e,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(On,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Mn extends m{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Mn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class qt extends m{constructor({cause:e,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${V(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${V(r)} gwei`:""}).`].join(`
|
|
19
|
-
`),{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(qt,"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 on extends m{constructor({cause:e}){super(`An error occurred while executing: ${e==null?void 0:e.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}function tr(t,e="wei"){return rs(t,oi[e])}function Bt(t){const e=Object.entries(t).map(([r,s])=>s===void 0||s===!1?null:[r,s]).filter(Boolean),n=e.reduce((r,[s])=>Math.max(r,s.length),0);return e.map(([r,s])=>` ${`${r}:`.padEnd(n+1)} ${s}`).join(`
|
|
20
|
-
`)}class ui extends m{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
|
|
21
|
-
`),{name:"FeeConflictError"})}}class di extends m{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Bt(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class li extends m{constructor(e,{account:n,docsPath:r,chain:s,data:a,gas:i,gasPrice:o,maxFeePerGas:u,maxPriorityFeePerGas:c,nonce:d,to:f,value:h}){var v;const y=Bt({chain:s&&`${s==null?void 0:s.name} (id: ${s==null?void 0:s.id})`,from:n==null?void 0:n.address,to:f,value:typeof h<"u"&&`${tr(h)} ${((v=s==null?void 0:s.nativeCurrency)==null?void 0:v.symbol)||"ETH"}`,data:a,gas:i,gasPrice:typeof o<"u"&&`${V(o)} gwei`,maxFeePerGas:typeof u<"u"&&`${V(u)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${V(c)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",y].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}const Ft=(t,e,n)=>JSON.stringify(t,(r,s)=>typeof s=="bigint"?s.toString():s,n),fi=t=>t,nr=t=>t;class rr extends m{constructor({body:e,cause:n,details:r,headers:s,status:a,url:i}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[a&&`Status: ${a}`,`URL: ${nr(i)}`,e&&`Request body: ${Ft(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=s,this.status=a,this.url=i}}class ss extends m{constructor({body:e,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${nr(r)}`,`Request body: ${Ft(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code,this.data=n.data}}const hi=-1;class H extends m{constructor(e,{code:n,docsPath:r,metaMessages:s,name:a,shortMessage:i}){super(i,{cause:e,docsPath:r,metaMessages:s||(e==null?void 0:e.metaMessages),name:a||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=a||e.name,this.code=e instanceof ss?e.code:n??hi}}class et extends H{constructor(e,n){super(e,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class ot extends H{constructor(e){super(e,{code:ot.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(ot,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class ct extends H{constructor(e){super(e,{code:ct.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(ct,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class ut extends H{constructor(e,{method:n}={}){super(e,{code:ut.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(ut,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class dt extends H{constructor(e){super(e,{code:dt.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
|
|
22
|
-
`)})}}Object.defineProperty(dt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Re extends H{constructor(e){super(e,{code:Re.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Re,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class lt extends H{constructor(e){super(e,{code:lt.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
|
|
23
|
-
`)})}}Object.defineProperty(lt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class ft extends H{constructor(e){super(e,{code:ft.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(ft,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class ht extends H{constructor(e){super(e,{code:ht.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(ht,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class pt extends H{constructor(e){super(e,{code:pt.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(pt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class mt extends H{constructor(e,{method:n}={}){super(e,{code:mt.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not implemented.`})}}Object.defineProperty(mt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Ke extends H{constructor(e){super(e,{code:Ke.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Ke,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class yt extends H{constructor(e){super(e,{code:yt.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(yt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Ue extends et{constructor(e){super(e,{code:Ue.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Ue,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class bt extends et{constructor(e){super(e,{code:bt.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(bt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class gt extends et{constructor(e,{method:n}={}){super(e,{code:gt.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(gt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class vt extends et{constructor(e){super(e,{code:vt.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(vt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class wt extends et{constructor(e){super(e,{code:wt.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(wt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class xt extends et{constructor(e){super(e,{code:xt.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(xt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class pi extends H{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}function sr(t,e){const n=(t.details||"").toLowerCase(),r=t instanceof m?t.walk(s=>(s==null?void 0:s.code)===De.code):t;return r instanceof m?new De({cause:t,message:r.details}):De.nodeMessage.test(n)?new De({cause:t,message:t.details}):Ht.nodeMessage.test(n)?new Ht({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):kn.nodeMessage.test(n)?new kn({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):$n.nodeMessage.test(n)?new $n({cause:t,nonce:e==null?void 0:e.nonce}):Cn.nodeMessage.test(n)?new Cn({cause:t,nonce:e==null?void 0:e.nonce}):Sn.nodeMessage.test(n)?new Sn({cause:t,nonce:e==null?void 0:e.nonce}):In.nodeMessage.test(n)?new In({cause:t}):Rn.nodeMessage.test(n)?new Rn({cause:t,gas:e==null?void 0:e.gas}):On.nodeMessage.test(n)?new On({cause:t,gas:e==null?void 0:e.gas}):Mn.nodeMessage.test(n)?new Mn({cause:t}):qt.nodeMessage.test(n)?new qt({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new on({cause:t})}function mi(t,{docsPath:e,...n}){const r=(()=>{const s=sr(t,n);return s instanceof on?t:s})();return new li(r,{docsPath:e,...n})}function ar(t,{format:e}){if(!e)return{};const n={};function r(a){const i=Object.keys(a);for(const o of i)o in t&&(n[o]=t[o]),a[o]&&typeof a[o]=="object"&&!Array.isArray(a[o])&&r(a[o])}const s=e(t||{});return r(s),n}const yi={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function ir(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=bi(t.authorizationList)),typeof t.accessList<"u"&&(e.accessList=t.accessList),typeof t.blobVersionedHashes<"u"&&(e.blobVersionedHashes=t.blobVersionedHashes),typeof t.blobs<"u"&&(typeof t.blobs[0]!="string"?e.blobs=t.blobs.map(n=>G(n)):e.blobs=t.blobs),typeof t.data<"u"&&(e.data=t.data),typeof t.from<"u"&&(e.from=t.from),typeof t.gas<"u"&&(e.gas=R(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=R(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=R(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=R(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=R(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=R(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=yi[t.type]),typeof t.value<"u"&&(e.value=R(t.value)),e}function bi(t){return t.map(e=>({address:e.contractAddress,r:e.r,s:e.s,chainId:R(e.chainId),nonce:R(e.nonce),...typeof e.yParity<"u"?{yParity:R(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:R(e.v)}:{}}))}function Z(t,e,n){const r=t[e.name];if(typeof r=="function")return r;const s=t[n];return typeof s=="function"?s:a=>e(t,a)}const gi=2n**256n-1n;function cn(t){const{account:e,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:s,to:a}=t,i=e?de(e):void 0;if(i&&!ge(i.address))throw new We({address:i.address});if(a&&!ge(a))throw new We({address:a});if(typeof n<"u"&&(typeof r<"u"||typeof s<"u"))throw new ui;if(r&&r>gi)throw new Ht({maxFeePerGas:r});if(s&&r&&s>r)throw new qt({maxFeePerGas:r,maxPriorityFeePerGas:s})}async function as(t){const e=await t.request({method:"eth_chainId"},{dedupe:!0});return He(e)}class vi extends m{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class or extends m{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class wi extends m{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${V(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class xi extends m{constructor({blockHash:e,blockNumber:n}){let r="Block";e&&(r=`Block at hash "${e}"`),n&&(r=`Block at number "${n}"`),super(`${r} could not be found.`,{name:"BlockNotFoundError"})}}const _i={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Pi(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?He(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?He(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?_i[t.type]:void 0,typeHex:t.type?t.type:void 0,value:t.value?BigInt(t.value):void 0,v:t.v?BigInt(t.v):void 0};return t.authorizationList&&(e.authorizationList=Ei(t.authorizationList)),e.yParity=(()=>{if(t.yParity)return Number(t.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e.type==="eip1559"&&delete e.maxFeePerBlobGas,e}function Ei(t){return t.map(e=>({contractAddress:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))}function Ai(t){const e=(t.transactions??[]).map(n=>typeof n=="string"?n:Pi(n));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:e,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}async function Wt(t,{blockHash:e,blockNumber:n,blockTag:r,includeTransactions:s}={}){var d,f,h;const a=r??"latest",i=s??!1,o=n!==void 0?R(n):void 0;let u=null;if(e?u=await t.request({method:"eth_getBlockByHash",params:[e,i]},{dedupe:!0}):u=await t.request({method:"eth_getBlockByNumber",params:[o||a,i]},{dedupe:!!o}),!u)throw new xi({blockHash:e,blockNumber:n});return(((h=(f=(d=t.chain)==null?void 0:d.formatters)==null?void 0:f.block)==null?void 0:h.format)||Ai)(u)}async function is(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function Ti(t,e){var a,i;const{block:n,chain:r=t.chain,request:s}=e||{};try{const o=((a=r==null?void 0:r.fees)==null?void 0:a.maxPriorityFeePerGas)??((i=r==null?void 0:r.fees)==null?void 0:i.defaultPriorityFee);if(typeof o=="function"){const c=n||await Z(t,Wt,"getBlock")({}),d=await o({block:c,client:t,request:s});if(d===null)throw new Error;return d}if(typeof o<"u")return o;const u=await t.request({method:"eth_maxPriorityFeePerGas"});return it(u)}catch{const[o,u]=await Promise.all([n?Promise.resolve(n):Z(t,Wt,"getBlock")({}),Z(t,is,"getGasPrice")({})]);if(typeof o.baseFeePerGas!="bigint")throw new or;const c=u-o.baseFeePerGas;return c<0n?0n:c}}async function Tr(t,e){var h,y;const{block:n,chain:r=t.chain,request:s,type:a="eip1559"}=e||{},i=await(async()=>{var v,k;return typeof((v=r==null?void 0:r.fees)==null?void 0:v.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:t,request:s}):((k=r==null?void 0:r.fees)==null?void 0:k.baseFeeMultiplier)??1.2})();if(i<1)throw new vi;const u=10**(((h=i.toString().split(".")[1])==null?void 0:h.length)??0),c=v=>v*BigInt(Math.ceil(i*u))/BigInt(u),d=n||await Z(t,Wt,"getBlock")({});if(typeof((y=r==null?void 0:r.fees)==null?void 0:y.estimateFeesPerGas)=="function"){const v=await r.fees.estimateFeesPerGas({block:n,client:t,multiply:c,request:s,type:a});if(v!==null)return v}if(a==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new or;const v=typeof(s==null?void 0:s.maxPriorityFeePerGas)=="bigint"?s.maxPriorityFeePerGas:await Ti(t,{block:d,chain:r,request:s}),k=c(d.baseFeePerGas);return{maxFeePerGas:(s==null?void 0:s.maxFeePerGas)??k+v,maxPriorityFeePerGas:v}}return{gasPrice:(s==null?void 0:s.gasPrice)??c(await Z(t,is,"getGasPrice")({}))}}class ki extends m{constructor(e,{account:n,docsPath:r,chain:s,data:a,gas:i,gasPrice:o,maxFeePerGas:u,maxPriorityFeePerGas:c,nonce:d,to:f,value:h}){var v;const y=Bt({from:n==null?void 0:n.address,to:f,value:typeof h<"u"&&`${tr(h)} ${((v=s==null?void 0:s.nativeCurrency)==null?void 0:v.symbol)||"ETH"}`,data:a,gas:i,gasPrice:typeof o<"u"&&`${V(o)} gwei`,maxFeePerGas:typeof u<"u"&&`${V(u)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${V(c)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",y].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}function $i(t,{docsPath:e,...n}){const r=(()=>{const s=sr(t,n);return s instanceof on?t:s})();return new ki(r,{docsPath:e,...n})}class Ci extends m{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class Si extends m{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function kr(t){return t.reduce((e,{slot:n,value:r})=>`${e} ${n}: ${r}
|
|
24
|
-
`,"")}function Ii(t){return t.reduce((e,{address:n,...r})=>{let s=`${e} ${n}:
|
|
25
|
-
`;return r.nonce&&(s+=` nonce: ${r.nonce}
|
|
26
|
-
`),r.balance&&(s+=` balance: ${r.balance}
|
|
27
|
-
`),r.code&&(s+=` code: ${r.code}
|
|
28
|
-
`),r.state&&(s+=` state:
|
|
29
|
-
`,s+=kr(r.state)),r.stateDiff&&(s+=` stateDiff:
|
|
30
|
-
`,s+=kr(r.stateDiff)),s},` State Override:
|
|
31
|
-
`).slice(0,-1)}function $r(t){if(!(!t||t.length===0))return t.reduce((e,{slot:n,value:r})=>{if(n.length!==66)throw new xr({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new xr({size:r.length,targetSize:66,type:"hex"});return e[n]=r,e},{})}function Ri(t){const{balance:e,nonce:n,state:r,stateDiff:s,code:a}=t,i={};if(a!==void 0&&(i.code=a),e!==void 0&&(i.balance=R(e)),n!==void 0&&(i.nonce=R(n)),r!==void 0&&(i.state=$r(r)),s!==void 0){if(i.state)throw new Si;i.stateDiff=$r(s)}return i}function os(t){if(!t)return;const e={};for(const{address:n,...r}of t){if(!ge(n,{strict:!1}))throw new We({address:n});if(e[n])throw new Ci({address:n});e[n]=Ri(r)}return e}async function Oi(t,{address:e,blockNumber:n,blockTag:r="latest"}){const s=n?R(n):void 0,a=await t.request({method:"eth_getBalance",params:[e,s||r]});return BigInt(a)}async function Mi(t,e){var s,a,i;const{account:n=t.account}=e,r=n?de(n):void 0;try{let le=function(U){const{block:Q,request:X,rpcStateOverride:$e}=U;return t.request({method:"eth_estimateGas",params:$e?[X,Q??"latest",$e]:Q?[X,Q]:[X]})};const{accessList:o,authorizationList:u,blobs:c,blobVersionedHashes:d,blockNumber:f,blockTag:h,data:y,gas:v,gasPrice:k,maxFeePerBlobGas:P,maxFeePerGas:S,maxPriorityFeePerGas:E,nonce:I,value:q,stateOverride:J,...B}=await hs(t,{...e,parameters:(r==null?void 0:r.type)==="local"?void 0:["blobVersionedHashes"]}),$=(f?R(f):void 0)||h,N=os(J),Be=await(async()=>{if(B.to)return B.to;if(u&&u.length>0)return await ts({authorization:u[0]}).catch(()=>{throw new m("`to` is required. Could not infer from `authorizationList`")})})();cn(e);const ke=(i=(a=(s=t.chain)==null?void 0:s.formatters)==null?void 0:a.transactionRequest)==null?void 0:i.format,Y=(ke||ir)({...ar(B,{format:ke}),from:r==null?void 0:r.address,accessList:o,authorizationList:u,blobs:c,blobVersionedHashes:d,data:y,gas:v,gasPrice:k,maxFeePerBlobGas:P,maxFeePerGas:S,maxPriorityFeePerGas:E,nonce:I,to:Be,value:q});let ae=BigInt(await le({block:$,request:Y,rpcStateOverride:N}));if(u){const U=await Oi(t,{address:Y.from}),Q=await Promise.all(u.map(async X=>{const{contractAddress:$e}=X,ze=await le({block:$,request:{authorizationList:void 0,data:y,from:r==null?void 0:r.address,to:$e,value:R(U)},rpcStateOverride:N}).catch(()=>100000n);return 2n*BigInt(ze)}));ae+=Q.reduce((X,$e)=>X+$e,0n)}return ae}catch(o){throw $i(o,{...e,account:r,chain:t.chain})}}async function ji(t,{address:e,blockTag:n="latest",blockNumber:r}){const s=await t.request({method:"eth_getTransactionCount",params:[e,r?R(r):n]},{dedupe:!!r});return He(s)}function cs(t){const{kzg:e}=t,n=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),r=typeof t.blobs[0]=="string"?t.blobs.map(a=>be(a)):t.blobs,s=[];for(const a of r)s.push(Uint8Array.from(e.blobToKzgCommitment(a)));return n==="bytes"?s:s.map(a=>G(a))}function us(t){const{kzg:e}=t,n=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),r=typeof t.blobs[0]=="string"?t.blobs.map(i=>be(i)):t.blobs,s=typeof t.commitments[0]=="string"?t.commitments.map(i=>be(i)):t.commitments,a=[];for(let i=0;i<r.length;i++){const o=r[i],u=s[i];a.push(Uint8Array.from(e.computeBlobKzgProof(o,u)))}return n==="bytes"?a:a.map(i=>G(i))}function Ni(t,e){return W.sha256(ye(t,{strict:!1})?Hn(t):t)}function Bi(t){const{commitment:e,version:n=1}=t,r=t.to??(typeof e=="string"?"hex":"bytes"),s=Ni(e);return s.set([n],0),r==="bytes"?s:G(s)}function Fi(t){const{commitments:e,version:n}=t,r=t.to??(typeof e[0]=="string"?"hex":"bytes"),s=[];for(const a of e)s.push(Bi({commitment:a,to:r,version:n}));return s}const Cr=6,ds=32,cr=4096,ls=ds*cr,Sr=ls*Cr-1-1*cr*Cr;class zi extends m{constructor({maxSize:e,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class Zi extends m{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function Di(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),n=typeof t.data=="string"?be(t.data):t.data,r=F(n);if(!r)throw new Zi;if(r>Sr)throw new zi({maxSize:Sr,size:r});const s=[];let a=!0,i=0;for(;a;){const o=er(new Uint8Array(ls));let u=0;for(;u<cr;){const c=n.slice(i,i+(ds-1));if(o.pushByte(0),o.pushBytes(c),c.length<31){o.pushByte(128),a=!1;break}u++,i+=31}s.push(o)}return e==="bytes"?s.map(o=>o.bytes):s.map(o=>G(o.bytes))}function Li(t){const{data:e,kzg:n,to:r}=t,s=t.blobs??Di({data:e,to:r}),a=t.commitments??cs({blobs:s,kzg:n,to:r}),i=t.proofs??us({blobs:s,commitments:a,kzg:n,to:r}),o=[];for(let u=0;u<s.length;u++)o.push({blob:s[u],commitment:a[u],proof:i[u]});return o}function Ui(t){if(t.type)return t.type;if(typeof t.authorizationList<"u")return"eip7702";if(typeof t.blobs<"u"||typeof t.blobVersionedHashes<"u"||typeof t.maxFeePerBlobGas<"u"||typeof t.sidecars<"u")return"eip4844";if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")return"eip1559";if(typeof t.gasPrice<"u")return typeof t.accessList<"u"?"eip2930":"legacy";throw new di({transaction:t})}const fs=["blobVersionedHashes","chainId","fees","gas","nonce","type"];async function hs(t,e){const{account:n=t.account,blobs:r,chain:s,gas:a,kzg:i,nonce:o,nonceManager:u,parameters:c=fs,type:d}=e,f=n&&de(n),h={...e,...f?{from:f==null?void 0:f.address}:{}};let y;async function v(){return y||(y=await Z(t,Wt,"getBlock")({blockTag:"latest"}),y)}let k;async function P(){return k||(s?s.id:typeof e.chainId<"u"?e.chainId:(k=await Z(t,as,"getChainId")({}),k))}if((c.includes("blobVersionedHashes")||c.includes("sidecars"))&&r&&i){const S=cs({blobs:r,kzg:i});if(c.includes("blobVersionedHashes")){const E=Fi({commitments:S,to:"hex"});h.blobVersionedHashes=E}if(c.includes("sidecars")){const E=us({blobs:r,commitments:S,kzg:i}),I=Li({blobs:r,commitments:S,proofs:E,to:"hex"});h.sidecars=I}}if(c.includes("chainId")&&(h.chainId=await P()),c.includes("nonce")&&typeof o>"u"&&f)if(u){const S=await P();h.nonce=await u.consume({address:f.address,chainId:S,client:t})}else h.nonce=await Z(t,ji,"getTransactionCount")({address:f.address,blockTag:"pending"});if((c.includes("fees")||c.includes("type"))&&typeof d>"u")try{h.type=Ui(h)}catch{const S=await v();h.type=typeof(S==null?void 0:S.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(c.includes("fees"))if(h.type!=="legacy"&&h.type!=="eip2930"){if(typeof h.maxFeePerGas>"u"||typeof h.maxPriorityFeePerGas>"u"){const S=await v(),{maxFeePerGas:E,maxPriorityFeePerGas:I}=await Tr(t,{block:S,chain:s,request:h});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas<I)throw new wi({maxPriorityFeePerGas:I});h.maxPriorityFeePerGas=I,h.maxFeePerGas=E}}else{if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")throw new or;const S=await v(),{gasPrice:E}=await Tr(t,{block:S,chain:s,request:h,type:"legacy"});h.gasPrice=E}return c.includes("gas")&&typeof a>"u"&&(h.gas=await Z(t,Mi,"estimateGas")({...h,account:f&&{address:f.address,type:"json-rpc"}})),cn(h),delete h.parameters,h}async function Vi(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const gn=new sn(128);async function Gi(t,e){var S,E,I,q;const{account:n=t.account,chain:r=t.chain,accessList:s,authorizationList:a,blobs:i,data:o,gas:u,gasPrice:c,maxFeePerBlobGas:d,maxFeePerGas:f,maxPriorityFeePerGas:h,nonce:y,value:v,...k}=e;if(typeof n>"u")throw new Xr({docsPath:"/docs/actions/wallet/sendTransaction"});const P=n?de(n):null;try{cn(e);const J=await(async()=>{if(e.to)return e.to;if(a&&a.length>0)return await ts({authorization:a[0]}).catch(()=>{throw new m("`to` is required. Could not infer from `authorizationList`.")})})();if((P==null?void 0:P.type)==="json-rpc"||P===null){let B;r!==null&&(B=await Z(t,as,"getChainId")({}),ii({currentChainId:B,chain:r}));const se=(I=(E=(S=t.chain)==null?void 0:S.formatters)==null?void 0:E.transactionRequest)==null?void 0:I.format,N=(se||ir)({...ar(k,{format:se}),accessList:s,authorizationList:a,blobs:i,chainId:B,data:o,from:P==null?void 0:P.address,gas:u,gasPrice:c,maxFeePerBlobGas:d,maxFeePerGas:f,maxPriorityFeePerGas:h,nonce:y,to:J,value:v}),Be=gn.get(t.uid),ke=Be?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:ke,params:[N]},{retryCount:0})}catch(Fe){if(Be===!1)throw Fe;const Y=Fe;if(Y.name==="InvalidInputRpcError"||Y.name==="InvalidParamsRpcError"||Y.name==="MethodNotFoundRpcError"||Y.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[N]},{retryCount:0}).then(le=>(gn.set(t.uid,!0),le)).catch(le=>{const ae=le;throw ae.name==="MethodNotFoundRpcError"||ae.name==="MethodNotSupportedRpcError"?(gn.set(t.uid,!1),Y):ae});throw Y}}if((P==null?void 0:P.type)==="local"){const B=await Z(t,hs,"prepareTransactionRequest")({account:P,accessList:s,authorizationList:a,blobs:i,chain:r,data:o,gas:u,gasPrice:c,maxFeePerBlobGas:d,maxFeePerGas:f,maxPriorityFeePerGas:h,nonce:y,nonceManager:P.nonceManager,parameters:[...fs,"sidecars"],value:v,...k,to:J}),se=(q=r==null?void 0:r.serializers)==null?void 0:q.transaction,$=await P.signTransaction(B,{serializer:se});return await Z(t,Vi,"sendRawTransaction")({serializedTransaction:$})}throw(P==null?void 0:P.type)==="smart"?new bn({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new bn({docsPath:"/docs/actions/wallet/sendTransaction",type:P==null?void 0:P.type})}catch(J){throw J instanceof bn?J:mi(J,{...e,account:P,chain:e.chain||void 0})}}const Ir=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}];function Hi(t,e={}){typeof e.size<"u"&&ue(t,{size:e.size});const n=G(t,e);return it(n,e)}function qi(t,e={}){let n=t;if(typeof e.size<"u"&&(ue(n,{size:e.size}),n=Gn(n)),n.length>1||n[0]>1)throw new ma(n);return!!n[0]}function me(t,e={}){typeof e.size<"u"&&ue(t,{size:e.size});const n=G(t,e);return He(n,e)}function Wi(t,e={}){let n=t;return typeof e.size<"u"&&(ue(n,{size:e.size}),n=Gn(n,{dir:"right"})),new TextDecoder().decode(n)}function ps(t,e){const n=typeof e=="string"?be(e):e,r=er(n);if(F(n)===0&&t.length>0)throw new Kn;if(F(e)&&F(e)<32)throw new Aa({data:typeof e=="string"?e:G(e),params:t,size:F(e)});let s=0;const a=[];for(let i=0;i<t.length;++i){const o=t[i];r.setPosition(s);const[u,c]=Ve(r,o,{staticPosition:0});s+=c,a.push(u)}return a}function Ve(t,e,{staticPosition:n}){const r=Qn(e.type);if(r){const[s,a]=r;return Ji(t,{...e,type:a},{length:s,staticPosition:n})}if(e.type==="tuple")return eo(t,e,{staticPosition:n});if(e.type==="address")return Ki(t);if(e.type==="bool")return Yi(t);if(e.type.startsWith("bytes"))return Xi(t,e,{staticPosition:n});if(e.type.startsWith("uint")||e.type.startsWith("int"))return Qi(t,e);if(e.type==="string")return to(t,{staticPosition:n});throw new Ra(e.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const Rr=32,jn=32;function Ki(t){const e=t.readBytes(32);return[an(G(Jr(e,-20))),32]}function Ji(t,e,{length:n,staticPosition:r}){if(!n){const i=me(t.readBytes(jn)),o=r+i,u=o+Rr;t.setPosition(o);const c=me(t.readBytes(Rr)),d=_t(e);let f=0;const h=[];for(let y=0;y<c;++y){t.setPosition(u+(d?y*32:f));const[v,k]=Ve(t,e,{staticPosition:u});f+=k,h.push(v)}return t.setPosition(r+32),[h,32]}if(_t(e)){const i=me(t.readBytes(jn)),o=r+i,u=[];for(let c=0;c<n;++c){t.setPosition(o+c*32);const[d]=Ve(t,e,{staticPosition:o});u.push(d)}return t.setPosition(r+32),[u,32]}let s=0;const a=[];for(let i=0;i<n;++i){const[o,u]=Ve(t,e,{staticPosition:r+s});s+=u,a.push(o)}return[a,s]}function Yi(t){return[qi(t.readBytes(32),{size:32}),32]}function Xi(t,e,{staticPosition:n}){const[r,s]=e.type.split("bytes");if(!s){const i=me(t.readBytes(32));t.setPosition(n+i);const o=me(t.readBytes(32));if(o===0)return t.setPosition(n+32),["0x",32];const u=t.readBytes(o);return t.setPosition(n+32),[G(u),32]}return[G(t.readBytes(Number.parseInt(s),32)),32]}function Qi(t,e){const n=e.type.startsWith("int"),r=Number.parseInt(e.type.split("int")[1]||"256"),s=t.readBytes(32);return[r>48?Hi(s,{signed:n}):me(s,{signed:n}),32]}function eo(t,e,{staticPosition:n}){const r=e.components.length===0||e.components.some(({name:i})=>!i),s=r?[]:{};let a=0;if(_t(e)){const i=me(t.readBytes(jn)),o=n+i;for(let u=0;u<e.components.length;++u){const c=e.components[u];t.setPosition(o+a);const[d,f]=Ve(t,c,{staticPosition:o});a+=f,s[r?u:c==null?void 0:c.name]=d}return t.setPosition(n+32),[s,32]}for(let i=0;i<e.components.length;++i){const o=e.components[i],[u,c]=Ve(t,o,{staticPosition:n});s[r?i:o==null?void 0:o.name]=u,a+=c}return[s,a]}function to(t,{staticPosition:e}){const n=me(t.readBytes(32)),r=e+n;t.setPosition(r);const s=me(t.readBytes(32));if(s===0)return t.setPosition(e+32),["",32];const a=t.readBytes(s,32),i=Wi(Gn(a));return t.setPosition(e+32),[i,32]}function _t(t){var r;const{type:e}=t;if(e==="string"||e==="bytes"||e.endsWith("[]"))return!0;if(e==="tuple")return(r=t.components)==null?void 0:r.some(_t);const n=Qn(t.type);return!!(n&&_t({...t,type:n[1]}))}const no=t=>Nt(Hn(t));function ro(t){return no(t)}const so="1.0.7";class D extends Error{constructor(e,n={}){var i;const r=n.cause instanceof D?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,s=n.cause instanceof D&&n.cause.docsPath||n.docsPath,a=[e||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: https://abitype.dev${s}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${so}`].join(`
|
|
32
|
-
`);super(a),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:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.shortMessage=e}}function Te(t,e){const n=t.exec(e);return n==null?void 0:n.groups}const ms=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ys=/^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)?$/,bs=/^\(.+?\).*?$/,Or=/^tuple(?<array>(\[(\d*)\])*)$/;function Nn(t){let e=t.type;if(Or.test(t.type)&&"components"in t){e="(";const n=t.components.length;for(let s=0;s<n;s++){const a=t.components[s];e+=Nn(a),s<n-1&&(e+=", ")}const r=Te(Or,t.type);return e+=`)${(r==null?void 0:r.array)??""}`,Nn({...t,type:e})}return"indexed"in t&&t.indexed&&(e=`${e} indexed`),t.name?`${e} ${t.name}`:e}function nt(t){let e="";const n=t.length;for(let r=0;r<n;r++){const s=t[r];e+=Nn(s),r!==n-1&&(e+=", ")}return e}function ao(t){var e;return t.type==="function"?`function ${t.name}(${nt(t.inputs)})${t.stateMutability&&t.stateMutability!=="nonpayable"?` ${t.stateMutability}`:""}${(e=t.outputs)!=null&&e.length?` returns (${nt(t.outputs)})`:""}`:t.type==="event"?`event ${t.name}(${nt(t.inputs)})`:t.type==="error"?`error ${t.name}(${nt(t.inputs)})`:t.type==="constructor"?`constructor(${nt(t.inputs)})${t.stateMutability==="payable"?" payable":""}`:t.type==="fallback"?`fallback() external${t.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const gs=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function io(t){return gs.test(t)}function oo(t){return Te(gs,t)}const vs=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function co(t){return vs.test(t)}function uo(t){return Te(vs,t)}const ws=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function lo(t){return ws.test(t)}function fo(t){return Te(ws,t)}const xs=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function _s(t){return xs.test(t)}function ho(t){return Te(xs,t)}const Ps=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function po(t){return Ps.test(t)}function mo(t){return Te(Ps,t)}const yo=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function bo(t){return yo.test(t)}const go=/^receive\(\) external payable$/;function vo(t){return go.test(t)}const wo=new Set(["indexed"]),Bn=new Set(["calldata","memory","storage"]);class xo extends D{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class _o extends D{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class Po extends D{constructor({param:e}){super("Invalid ABI parameter.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Eo extends D{constructor({param:e,name:n}){super("Invalid ABI parameter.",{details:e,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class Ao extends D{constructor({param:e,type:n,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class To extends D{constructor({param:e,type:n,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class ko extends D{constructor({abiParameter:e}){super("Invalid ABI parameter.",{details:JSON.stringify(e,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class rt extends D{constructor({signature:e,type:n}){super(`Invalid ${n} signature.`,{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class $o extends D{constructor({signature:e}){super("Unknown signature.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Co extends D{constructor({signature:e}){super("Invalid struct signature.",{details:e,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class So extends D{constructor({type:e}){super("Circular reference detected.",{metaMessages:[`Struct "${e}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class Io extends D{constructor({current:e,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${e.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function Ro(t,e,n){let r="";if(n)for(const s of Object.entries(n)){if(!s)continue;let a="";for(const i of s[1])a+=`[${i.type}${i.name?`:${i.name}`:""}]`;r+=`(${s[0]}{${a}})`}return e?`${e}:${t}${r}`:t}const vn=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function Oo(t,e={}){if(lo(t)){const n=fo(t);if(!n)throw new rt({signature:t,type:"function"});const r=ee(n.parameters),s=[],a=r.length;for(let o=0;o<a;o++)s.push(Ce(r[o],{modifiers:Bn,structs:e,type:"function"}));const i=[];if(n.returns){const o=ee(n.returns),u=o.length;for(let c=0;c<u;c++)i.push(Ce(o[c],{modifiers:Bn,structs:e,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:s,outputs:i}}if(co(t)){const n=uo(t);if(!n)throw new rt({signature:t,type:"event"});const r=ee(n.parameters),s=[],a=r.length;for(let i=0;i<a;i++)s.push(Ce(r[i],{modifiers:wo,structs:e,type:"event"}));return{name:n.name,type:"event",inputs:s}}if(io(t)){const n=oo(t);if(!n)throw new rt({signature:t,type:"error"});const r=ee(n.parameters),s=[],a=r.length;for(let i=0;i<a;i++)s.push(Ce(r[i],{structs:e,type:"error"}));return{name:n.name,type:"error",inputs:s}}if(po(t)){const n=mo(t);if(!n)throw new rt({signature:t,type:"constructor"});const r=ee(n.parameters),s=[],a=r.length;for(let i=0;i<a;i++)s.push(Ce(r[i],{structs:e,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:s}}if(bo(t))return{type:"fallback"};if(vo(t))return{type:"receive",stateMutability:"payable"};throw new $o({signature:t})}const Mo=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,jo=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,No=/^u?int$/;function Ce(t,e){var f,h;const n=Ro(t,e==null?void 0:e.type,e==null?void 0:e.structs);if(vn.has(n))return vn.get(n);const r=bs.test(t),s=Te(r?jo:Mo,t);if(!s)throw new Po({param:t});if(s.name&&Fo(s.name))throw new Eo({param:t,name:s.name});const a=s.name?{name:s.name}:{},i=s.modifier==="indexed"?{indexed:!0}:{},o=(e==null?void 0:e.structs)??{};let u,c={};if(r){u="tuple";const y=ee(s.type),v=[],k=y.length;for(let P=0;P<k;P++)v.push(Ce(y[P],{structs:o}));c={components:v}}else if(s.type in o)u="tuple",c={components:o[s.type]};else if(No.test(s.type))u=`${s.type}256`;else if(u=s.type,(e==null?void 0:e.type)!=="struct"&&!Es(u))throw new _o({type:u});if(s.modifier){if(!((h=(f=e==null?void 0:e.modifiers)==null?void 0:f.has)!=null&&h.call(f,s.modifier)))throw new Ao({param:t,type:e==null?void 0:e.type,modifier:s.modifier});if(Bn.has(s.modifier)&&!zo(u,!!s.array))throw new To({param:t,type:e==null?void 0:e.type,modifier:s.modifier})}const d={type:`${u}${s.array??""}`,...a,...i,...c};return vn.set(n,d),d}function ee(t,e=[],n="",r=0){const s=t.trim().length;for(let a=0;a<s;a++){const i=t[a],o=t.slice(a+1);switch(i){case",":return r===0?ee(o,[...e,n.trim()]):ee(o,e,`${n}${i}`,r);case"(":return ee(o,e,`${n}${i}`,r+1);case")":return ee(o,e,`${n}${i}`,r-1);default:return ee(o,e,`${n}${i}`,r)}}if(n==="")return e;if(r!==0)throw new Io({current:n,depth:r});return e.push(n.trim()),e}function Es(t){return t==="address"||t==="bool"||t==="function"||t==="string"||ms.test(t)||ys.test(t)}const Bo=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function Fo(t){return t==="address"||t==="bool"||t==="function"||t==="string"||t==="tuple"||ms.test(t)||ys.test(t)||Bo.test(t)}function zo(t,e){return e||t==="bytes"||t==="string"||t==="tuple"}function Zo(t){const e={},n=t.length;for(let i=0;i<n;i++){const o=t[i];if(!_s(o))continue;const u=ho(o);if(!u)throw new rt({signature:o,type:"struct"});const c=u.properties.split(";"),d=[],f=c.length;for(let h=0;h<f;h++){const v=c[h].trim();if(!v)continue;const k=Ce(v,{type:"struct"});d.push(k)}if(!d.length)throw new Co({signature:o});e[u.name]=d}const r={},s=Object.entries(e),a=s.length;for(let i=0;i<a;i++){const[o,u]=s[i];r[o]=As(u,e)}return r}const Do=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function As(t,e,n=new Set){const r=[],s=t.length;for(let a=0;a<s;a++){const i=t[a];if(bs.test(i.type))r.push(i);else{const u=Te(Do,i.type);if(!(u!=null&&u.type))throw new ko({abiParameter:i});const{array:c,type:d}=u;if(d in e){if(n.has(d))throw new So({type:d});r.push({...i,type:`tuple${c??""}`,components:As(e[d]??[],e,new Set([...n,d]))})}else if(Es(d))r.push(i);else throw new xo({type:d})}}return r}function Ts(t){const e=Zo(t),n=[],r=t.length;for(let s=0;s<r;s++){const a=t[s];_s(a)||n.push(Oo(a,e))}return n}function Lo(t){let e=!0,n="",r=0,s="",a=!1;for(let i=0;i<t.length;i++){const o=t[i];if(["(",")",","].includes(o)&&(e=!0),o==="("&&r++,o===")"&&r--,!!e){if(r===0){if(o===" "&&["event","function",""].includes(s))s="";else if(s+=o,o===")"){a=!0;break}continue}if(o===" "){t[i-1]!==","&&n!==","&&n!==",("&&(n="",e=!1);continue}s+=o,n+=o}}if(!a)throw new m("Unable to normalize signature.");return s}const Uo=t=>{const e=typeof t=="string"?t:ao(t);return Lo(e)};function ks(t){return ro(Uo(t))}const Vo=ks,ur=t=>Gt(ks(t),0,4);function dr(t){const{abi:e,args:n=[],name:r}=t,s=ye(r,{strict:!1}),a=e.filter(o=>s?o.type==="function"?ur(o)===r:o.type==="event"?Vo(o)===r:!1:"name"in o&&o.name===r);if(a.length===0)return;if(a.length===1)return a[0];let i;for(const o of a){if(!("inputs"in o))continue;if(!n||n.length===0){if(!o.inputs||o.inputs.length===0)return o;continue}if(!o.inputs||o.inputs.length===0||o.inputs.length!==n.length)continue;if(n.every((c,d)=>{const f="inputs"in o&&o.inputs[d];return f?Fn(c,f):!1})){if(i&&"inputs"in i&&i.inputs){const c=$s(o.inputs,i.inputs,n);if(c)throw new Sa({abiItem:o,type:c[0]},{abiItem:i,type:c[1]})}i=o}}return i||a[0]}function Fn(t,e){const n=typeof t,r=e.type;switch(r){case"address":return ge(t,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in e?Object.values(e.components).every((s,a)=>Fn(Object.values(t)[a],s)):/^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)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(t)&&t.every(s=>Fn(s,{...e,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function $s(t,e,n){for(const r in t){const s=t[r],a=e[r];if(s.type==="tuple"&&a.type==="tuple"&&"components"in s&&"components"in a)return $s(s.components,a.components,n[r]);const i=[s.type,a.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?ge(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?ge(n[r],{strict:!1}):!1)return i}}const wn="/docs/contract/decodeFunctionResult";function lr(t){const{abi:e,args:n,functionName:r,data:s}=t;let a=e[0];if(r){const o=dr({abi:e,args:n,name:r});if(!o)throw new Vt(r,{docsPath:wn});a=o}if(a.type!=="function")throw new Vt(void 0,{docsPath:wn});if(!a.outputs)throw new Ca(a.name,{docsPath:wn});const i=ps(a.outputs,s);if(i&&i.length>1)return i;if(i&&i.length===1)return i[0]}const Mr="/docs/contract/encodeFunctionData";function Go(t){const{abi:e,args:n,functionName:r}=t;let s=e[0];if(r){const a=dr({abi:e,args:n,name:r});if(!a)throw new Vt(r,{docsPath:Mr});s=a}if(s.type!=="function")throw new Vt(void 0,{docsPath:Mr});return{abi:[s],functionName:ur(qe(s))}}function un(t){const{args:e}=t,{abi:n,functionName:r}=(()=>{var o;return t.abi.length===1&&((o=t.functionName)!=null&&o.startsWith("0x"))?t:Go(t)})(),s=n[0],a=r,i="inputs"in s&&s.inputs?Jn(s.inputs,e??[]):void 0;return rn([a,i??"0x"])}function Ho({blockNumber:t,chain:e,contract:n}){var s;const r=(s=e==null?void 0:e.contracts)==null?void 0:s[n];if(!r)throw new Tn({chain:e,contract:{name:n}});if(t&&r.blockCreated&&r.blockCreated>t)throw new Tn({blockNumber:t,chain:e,contract:{name:n,blockCreated:r.blockCreated}});return r.address}const qo={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},Wo={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},Ko={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function Cs(t){const{abi:e,data:n}=t,r=Gt(n,0,4);if(r==="0x")throw new Kn;const a=[...e||[],Wo,Ko].find(i=>i.type==="error"&&r===ur(qe(i)));if(!a)throw new qr(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:a,args:"inputs"in a&&a.inputs&&a.inputs.length>0?ps(a.inputs,Gt(n,4)):void 0,errorName:a.name}}function Ss({abiItem:t,args:e,includeFunctionName:n=!0,includeName:r=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${n?t.name:""}(${t.inputs.map((s,a)=>`${r&&s.name?`${s.name}: `:""}${typeof e[a]=="object"?Ft(e[a]):e[a]}`).join(", ")})`}class Jo extends m{constructor(e,{account:n,docsPath:r,chain:s,data:a,gas:i,gasPrice:o,maxFeePerGas:u,maxPriorityFeePerGas:c,nonce:d,to:f,value:h,stateOverride:y}){var P;const v=n?de(n):void 0;let k=Bt({from:v==null?void 0:v.address,to:f,value:typeof h<"u"&&`${tr(h)} ${((P=s==null?void 0:s.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:a,gas:i,gasPrice:typeof o<"u"&&`${V(o)} gwei`,maxFeePerGas:typeof u<"u"&&`${V(u)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${V(c)} gwei`,nonce:d});y&&(k+=`
|
|
33
|
-
${Ii(y)}`),super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Raw Call Arguments:",k].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class Yo extends m{constructor(e,{abi:n,args:r,contractAddress:s,docsPath:a,functionName:i,sender:o}){const u=dr({abi:n,args:r,name:i}),c=u?Ss({abiItem:u,args:r,includeFunctionName:!1,includeName:!1}):void 0,d=u?qe(u,{includeName:!0}):void 0,f=Bt({address:s&&fi(s),function:d,args:c&&c!=="()"&&`${[...Array((i==null?void 0:i.length)??0).keys()].map(()=>" ").join("")}${c}`,sender:o});super(e.shortMessage||`An unknown error occurred while executing the contract function "${i}".`,{cause:e,docsPath:a,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],f&&"Contract Call:",f].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=n,this.args=r,this.cause=e,this.contractAddress=s,this.functionName=i,this.sender=o}}class Xo extends m{constructor({abi:e,data:n,functionName:r,message:s}){let a,i,o,u;if(n&&n!=="0x")try{i=Cs({abi:e,data:n});const{abiItem:d,errorName:f,args:h}=i;if(f==="Error")u=h[0];else if(f==="Panic"){const[y]=h;u=qo[y]}else{const y=d?qe(d,{includeName:!0}):void 0,v=d&&h?Ss({abiItem:d,args:h,includeFunctionName:!1,includeName:!1}):void 0;o=[y?`Error: ${y}`:"",v&&v!=="()"?` ${[...Array((f==null?void 0:f.length)??0).keys()].map(()=>" ").join("")}${v}`:""]}}catch(d){a=d}else s&&(u=s);let c;a instanceof qr&&(c=a.signature,o=[`Unable to decode signature "${c}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${c}.`]),super(u&&u!=="execution reverted"||c?[`The contract function "${r}" reverted with the following ${c?"signature":"reason"}:`,u||c].join(`
|
|
34
|
-
`):`The contract function "${r}" reverted.`,{cause:a,metaMessages:o,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=i,this.reason=u,this.signature=c}}class Qo extends m{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class ec extends m{constructor({factory:e}){super(`Deployment for counterfactual contract call failed${e?` for factory "${e}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class Is extends m{constructor({data:e,message:n}){super(n||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}const tc=3;function fr(t,{abi:e,address:n,args:r,docsPath:s,functionName:a,sender:i}){const o=t instanceof Is?t:t instanceof m?t.walk(v=>"data"in v)||t.walk():{},{code:u,data:c,details:d,message:f,shortMessage:h}=o,y=t instanceof Kn?new Qo({functionName:a}):[tc,Re.code].includes(u)&&(c||d||f||h)?new Xo({abi:e,data:typeof c=="object"?c.data:c,functionName:a,message:o instanceof ss?d:h??f}):t;return new Yo(y,{abi:e,args:r,contractAddress:n,docsPath:s,functionName:a,sender:i})}const nc="0x82ad56cb",rc="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",sc="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe";function ac(t,{docsPath:e,...n}){const r=(()=>{const s=sr(t,n);return s instanceof on?t:s})();return new Jo(r,{docsPath:e,...n})}function ic(){let t=()=>{},e=()=>{};return{promise:new Promise((r,s)=>{t=r,e=s}),resolve:t,reject:e}}const xn=new Map;function oc({fn:t,id:e,shouldSplitBatch:n,wait:r=0,sort:s}){const a=async()=>{const d=u();i();const f=d.map(({args:h})=>h);f.length!==0&&t(f).then(h=>{s&&Array.isArray(h)&&h.sort(s);for(let y=0;y<d.length;y++){const{resolve:v}=d[y];v==null||v([h[y],h])}}).catch(h=>{for(let y=0;y<d.length;y++){const{reject:v}=d[y];v==null||v(h)}})},i=()=>xn.delete(e),o=()=>u().map(({args:d})=>d),u=()=>xn.get(e)||[],c=d=>xn.set(e,[...u(),d]);return{flush:i,async schedule(d){const{promise:f,resolve:h,reject:y}=ic();return(n==null?void 0:n([...o(),d]))&&a(),u().length>0?(c({args:d,resolve:h,reject:y}),f):(c({args:d,resolve:h,reject:y}),setTimeout(a,r),f)}}}async function hr(t,e){var ke,Fe,Y,le;const{account:n=t.account,batch:r=!!((ke=t.batch)!=null&&ke.multicall),blockNumber:s,blockTag:a="latest",accessList:i,blobs:o,code:u,data:c,factory:d,factoryData:f,gas:h,gasPrice:y,maxFeePerBlobGas:v,maxFeePerGas:k,maxPriorityFeePerGas:P,nonce:S,to:E,value:I,stateOverride:q,...J}=e,B=n?de(n):void 0;if(u&&(d||f))throw new m("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(u&&E)throw new m("Cannot provide both `code` & `to` as parameters.");const se=u&&c,$=d&&f&&E&&c,N=se||$,Be=se?dc({code:u,data:c}):$?lc({data:c,factory:d,factoryData:f,to:E}):c;try{cn(e);const U=(s?R(s):void 0)||a,Q=os(q),X=(le=(Y=(Fe=t.chain)==null?void 0:Fe.formatters)==null?void 0:Y.transactionRequest)==null?void 0:le.format,ze=(X||ir)({...ar(J,{format:X}),from:B==null?void 0:B.address,accessList:i,blobs:o,data:Be,gas:h,gasPrice:y,maxFeePerBlobGas:v,maxFeePerGas:k,maxPriorityFeePerGas:P,nonce:S,to:N?void 0:E,value:I});if(r&&cc({request:ze})&&!Q)try{return await uc(t,{...ze,blockNumber:s,blockTag:a})}catch(hn){if(!(hn instanceof ns)&&!(hn instanceof Tn))throw hn}const vr=await t.request({method:"eth_call",params:Q?[ze,U,Q]:[ze,U]});return vr==="0x"?{data:void 0}:{data:vr}}catch(ae){const U=fc(ae),{offchainLookup:Q,offchainLookupSignature:X}=await Promise.resolve().then(()=>require("./ccip-5qPuVSlX.cjs"));if(t.ccipRead!==!1&&(U==null?void 0:U.slice(0,10))===X&&E)return{data:await Q(t,{data:U,to:E})};throw N&&(U==null?void 0:U.slice(0,10))==="0x101bb98d"?new ec({factory:d}):ac(ae,{...e,account:B,chain:t.chain})}}function cc({request:t}){const{data:e,to:n,...r}=t;return!(!e||e.startsWith(nc)||!n||Object.values(r).filter(s=>typeof s<"u").length>0)}async function uc(t,e){var k;const{batchSize:n=1024,wait:r=0}=typeof((k=t.batch)==null?void 0:k.multicall)=="object"?t.batch.multicall:{},{blockNumber:s,blockTag:a="latest",data:i,multicallAddress:o,to:u}=e;let c=o;if(!c){if(!t.chain)throw new ns;c=Ho({blockNumber:s,chain:t.chain,contract:"multicall3"})}const f=(s?R(s):void 0)||a,{schedule:h}=oc({id:`${t.uid}.${f}`,wait:r,shouldSplitBatch(P){return P.reduce((E,{data:I})=>E+(I.length-2),0)>n*2},fn:async P=>{const S=P.map(q=>({allowFailure:!0,callData:q.data,target:q.to})),E=un({abi:Ir,args:[S],functionName:"aggregate3"}),I=await t.request({method:"eth_call",params:[{data:E,to:c},f]});return lr({abi:Ir,args:[S],functionName:"aggregate3",data:I||"0x"})}}),[{returnData:y,success:v}]=await h({data:i,to:u});if(!v)throw new Is({data:y});return y==="0x"?{data:void 0}:{data:y}}function dc(t){const{code:e,data:n}=t;return Yr({abi:Ts(["constructor(bytes, bytes)"]),bytecode:rc,args:[e,n]})}function lc(t){const{data:e,factory:n,factoryData:r,to:s}=t;return Yr({abi:Ts(["constructor(address, bytes, address, bytes)"]),bytecode:sc,args:[s,e,n,r]})}function fc(t){var n;if(!(t instanceof m))return;const e=t.walk();return typeof(e==null?void 0:e.data)=="object"?(n=e.data)==null?void 0:n.data:e.data}async function hc(t,e){const{abi:n,address:r,args:s,functionName:a,...i}=e,o=un({abi:n,args:s,functionName:a});try{const{data:u}=await Z(t,hr,"call")({...i,data:o,to:r});return lr({abi:n,args:s,functionName:a,data:u||"0x"})}catch(u){throw fr(u,{abi:n,address:r,args:s,docsPath:"/docs/contract/readContract",functionName:a})}}async function pc(t){return new Promise(e=>setTimeout(e,t))}const Zt=new sn(8192);function mc(t,{enabled:e=!0,id:n}){if(!e||!n)return t();if(Zt.get(n))return Zt.get(n);const r=t().finally(()=>Zt.delete(n));return Zt.set(n,r),r}function yc(t,{delay:e=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((s,a)=>{const i=async({count:o=0}={})=>{const u=async({error:c})=>{const d=typeof e=="function"?e({count:o,error:c}):e;d&&await pc(d),i({count:o+1})};try{const c=await t();s(c)}catch(c){if(o<n&&await r({count:o,error:c}))return u({error:c});a(c)}};i()})}function bc(t,e={}){return async(n,r={})=>{const{dedupe:s=!1,retryDelay:a=150,retryCount:i=3,uid:o}={...e,...r},u=s?Nt(qn(`${o}.${Ft(n)}`)):void 0;return mc(()=>yc(async()=>{try{return await t(n)}catch(c){const d=c;switch(d.code){case ot.code:throw new ot(d);case ct.code:throw new ct(d);case ut.code:throw new ut(d,{method:n.method});case dt.code:throw new dt(d);case Re.code:throw new Re(d);case lt.code:throw new lt(d);case ft.code:throw new ft(d);case ht.code:throw new ht(d);case pt.code:throw new pt(d);case mt.code:throw new mt(d,{method:n.method});case Ke.code:throw new Ke(d);case yt.code:throw new yt(d);case Ue.code:throw new Ue(d);case bt.code:throw new bt(d);case gt.code:throw new gt(d);case vt.code:throw new vt(d);case wt.code:throw new wt(d);case xt.code:throw new xt(d);case 5e3:throw new Ue(d);default:throw c instanceof m?c:new pi(d)}}},{delay:({count:c,error:d})=>{var f;if(d&&d instanceof rr){const h=(f=d==null?void 0:d.headers)==null?void 0:f.get("Retry-After");if(h!=null&&h.match(/\d/))return Number.parseInt(h)*1e3}return~~(1<<c)*a},retryCount:i,shouldRetry:({error:c})=>gc(c)}),{enabled:s,id:u})}}function gc(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===Ke.code||t.code===Re.code:t instanceof rr&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}async function vc(t,e){const{abi:n,address:r,args:s,dataSuffix:a,functionName:i,...o}=e,u=o.account?de(o.account):t.account,c=un({abi:n,args:s,functionName:i});try{const{data:d}=await Z(t,hr,"call")({batch:!1,data:`${c}${a?a.replace("0x",""):""}`,to:r,...o,account:u}),f=lr({abi:n,args:s,functionName:i,data:d||"0x"}),h=n.filter(y=>"name"in y&&y.name===e.functionName);return{result:f,request:{abi:h,address:r,args:s,dataSuffix:a,functionName:i,...o,account:u}}}catch(d){throw fr(d,{abi:n,address:r,args:s,docsPath:"/docs/contract/simulateContract",functionName:i,sender:u==null?void 0:u.address})}}async function wc(t,e){const{abi:n,account:r=t.account,address:s,args:a,dataSuffix:i,functionName:o,...u}=e;if(typeof r>"u")throw new Xr({docsPath:"/docs/contract/writeContract"});const c=r?de(r):null,d=un({abi:n,args:a,functionName:o});try{return await Z(t,Gi,"sendTransaction")({data:`${d}${i?i.replace("0x",""):""}`,to:s,account:c,...u})}catch(f){throw fr(f,{abi:n,address:s,args:a,docsPath:"/docs/contract/writeContract",functionName:o,sender:c==null?void 0:c.address})}}const zn=256;let Dt=zn,Lt;function Rs(t=11){if(!Lt||Dt+t>zn*2){Lt="",Dt=0;for(let e=0;e<zn;e++)Lt+=(256+Math.random()*256|0).toString(16).substring(1)}return Lt.substring(Dt,Dt+++t)}function xc(t){const{batch:e,cacheTime:n=t.pollingInterval??4e3,ccipRead:r,key:s="base",name:a="Base Client",pollingInterval:i=4e3,type:o="base"}=t,u=t.chain,c=t.account?de(t.account):void 0,{config:d,request:f,value:h}=t.transport({chain:u,pollingInterval:i}),y={...d,...h},v={account:c,batch:e,cacheTime:n,ccipRead:r,chain:u,key:s,name:a,pollingInterval:i,request:f,transport:y,type:o,uid:Rs()};function k(P){return S=>{const E=S(P);for(const q in v)delete E[q];const I={...P,...E};return Object.assign(I,{extend:k(I)})}}return Object.assign(v,{extend:k(v)})}function _c({key:t,name:e,request:n,retryCount:r=3,retryDelay:s=150,timeout:a,type:i},o){const u=Rs();return{config:{key:t,name:e,request:n,retryCount:r,retryDelay:s,timeout:a,type:i},request:bc(n,{retryCount:r,retryDelay:s,uid:u}),value:o}}function Pc(t,e={}){const{key:n="custom",name:r="Custom Provider",retryDelay:s}=e;return({retryCount:a})=>_c({key:n,name:r,request:t.request.bind(t),retryCount:e.retryCount??a,retryDelay:s,type:"custom"})}function dn(t){const e=t.state.current,n=t.state.connections.get(e),r=n==null?void 0:n.accounts,s=r==null?void 0:r[0],a=t.chains.find(o=>o.id===(n==null?void 0:n.chainId)),i=t.state.status;switch(i){case"connected":return{address:s,addresses:r,chain:a,chainId:n==null?void 0:n.chainId,connector:n==null?void 0:n.connector,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:i};case"reconnecting":return{address:s,addresses:r,chain:a,chainId:n==null?void 0:n.chainId,connector:n==null?void 0:n.connector,isConnected:!!s,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:i};case"connecting":return{address:s,addresses:r,chain:a,chainId:n==null?void 0:n.chainId,connector:n==null?void 0:n.connector,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:i};case"disconnected":return{address:void 0,addresses:void 0,chain:void 0,chainId:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:i}}}function pr(t){return t.state.chainId}function mr(t,e,n){const r=t[e.name];if(typeof r=="function")return r;const s=t[n];return typeof s=="function"?s:a=>e(t,a)}const Ec="2.13.8",Ac=()=>`@wagmi/core@${Ec}`;var Os=function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},Kt,Ms;class Oe extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return Ac()}constructor(e,n={}){var r;super(),Kt.add(this),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:"WagmiCoreError"});const s=n.cause instanceof Oe?n.cause.details:(r=n.cause)!=null&&r.message?n.cause.message:n.details,a=n.cause instanceof Oe&&n.cause.docsPath||n.docsPath;this.message=[e||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...a?[`Docs: ${this.docsBaseUrl}${a}.html${n.docsSlug?`#${n.docsSlug}`:""}`]:[],...s?[`Details: ${s}`]:[],`Version: ${this.version}`].join(`
|
|
35
|
-
`),n.cause&&(this.cause=n.cause),this.details=s,this.docsPath=a,this.metaMessages=n.metaMessages,this.shortMessage=e}walk(e){return Os(this,Kt,"m",Ms).call(this,this,e)}}Kt=new WeakSet,Ms=function t(e,n){return n!=null&&n(e)?e:e.cause?Os(this,Kt,"m",t).call(this,e.cause,n):e};class Tc extends Oe{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class kc extends Oe{constructor({address:e,connector:n}){super(`Account "${e}" not found for connector "${n.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}class $c extends Oe{constructor({connectionChainId:e,connectorChainId:n}){super(`The current chain of the connector (id: ${n}) does not match the connection's chain (id: ${e}).`,{metaMessages:[`Current Chain ID: ${n}`,`Expected Chain ID: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class Cc extends Oe{constructor({connector:e}){super(`Connector "${e.name}" unavailable while reconnecting.`,{details:["During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uuid`.","All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.","This error commonly occurs for connectors that asynchronously inject after reconnection has already started."].join(" ")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorUnavailableReconnectingError"})}}async function js(t,e={}){let n;if(e.connector){const{connector:c}=e;if(t.state.status==="reconnecting"&&!c.getAccounts&&!c.getChainId)throw new Cc({connector:c});const[d,f]=await Promise.all([c.getAccounts(),c.getChainId()]);n={accounts:d,chainId:f,connector:c}}else n=t.state.connections.get(t.state.current);if(!n)throw new Tc;const r=e.chainId??n.chainId,s=await n.connector.getChainId();if(s!==n.chainId)throw new $c({connectionChainId:n.chainId,connectorChainId:s});const a=n.connector;if(a.getClient)return a.getClient({chainId:r});const i=de(e.account??n.accounts[0]);if(i.address=Na(i.address),e.account&&!n.accounts.some(c=>c.toLowerCase()===i.address.toLowerCase()))throw new kc({address:i.address,connector:a});const o=t.chains.find(c=>c.id===r),u=await n.connector.getProvider({chainId:r});return xc({account:i,chain:o,name:"Connector Client",transport:c=>Pc(u)({...c,retryCount:0})})}async function Zn(t,e){const{abi:n,chainId:r,connector:s,...a}=e;let i;e.account?i=e.account:i=(await js(t,{chainId:r,connector:s})).account;const o=t.getClient({chainId:r}),u=mr(o,vc,"simulateContract"),{result:c,request:d}=await u({...a,abi:n,account:i});return{chainId:o.chain.id,result:c,request:{__mode:"prepared",...d,chainId:r}}}function yr(t){return t.address!==void 0&&typeof t.address=="object"?(e,n)=>{var r;const s=pr(e),a=dn(e),i=(n==null?void 0:n.chainId)??a.chainId??s;return Zn(e,{...n,...t.functionName?{functionName:t.functionName}:{},address:(r=t.address)==null?void 0:r[i],abi:t.abi})}:(e,n)=>Zn(e,{...n,...t.address?{address:t.address}:{},...t.functionName?{functionName:t.functionName}:{},abi:t.abi})}function jr(t,e){const{chainId:n,...r}=e,s=t.getClient({chainId:n});return mr(s,hc,"readContract")(r)}function Ns(t){return t.address!==void 0&&typeof t.address=="object"?(e,n)=>{var r;const s=pr(e),a=dn(e),i=(n==null?void 0:n.chainId)??a.chainId??s;return jr(e,{...n,...t.functionName?{functionName:t.functionName}:{},address:(r=t.address)==null?void 0:r[i],abi:t.abi})}:(e,n)=>jr(e,{...n,...t.address?{address:t.address}:{},...t.functionName?{functionName:t.functionName}:{},abi:t.abi})}async function Nr(t,e){const{account:n,chainId:r,connector:s,__mode:a,...i}=e;let o;typeof n=="object"&&n.type==="local"?o=t.getClient({chainId:r}):o=await js(t,{account:n,chainId:r,connector:s});const{connector:u}=dn(t);let c;if(a==="prepared"||u!=null&&u.supportsSimulation)c=i;else{const{request:d}=await Zn(t,{...i,account:n,chainId:r});c=d}return await mr(o,wc,"writeContract")({...c,...n?{account:n}:{},chain:r?{id:r}:null})}function br(t){return t.address!==void 0&&typeof t.address=="object"?(e,n)=>{var r;const s=pr(e),a=dn(e);let i;return n.chainId?i=n.chainId:n.account&&n.account===a.address||n.account===void 0?i=a.chainId:i=s,Nr(e,{...n,...t.functionName?{functionName:t.functionName}:{},address:i?(r=t.address)==null?void 0:r[i]:void 0,abi:t.abi})}:(e,n)=>Nr(e,{...n,...t.address?{address:t.address}:{},...t.functionName?{functionName:t.functionName}:{},abi:t.abi})}const we=[{type:"error",inputs:[],name:"AllowanceOverflow"},{type:"error",inputs:[],name:"AllowanceUnderflow"},{type:"error",inputs:[],name:"InsufficientAllowance"},{type:"error",inputs:[],name:"InsufficientBalance"},{type:"error",inputs:[],name:"InvalidPermit"},{type:"error",inputs:[],name:"PermitExpired"},{type:"error",inputs:[],name:"TotalSupplyOverflow"},{type:"event",anonymous:!1,inputs:[{name:"owner",internalType:"address",type:"address",indexed:!0},{name:"spender",internalType:"address",type:"address",indexed:!0},{name:"amount",internalType:"uint256",type:"uint256",indexed:!1}],name:"Approval"},{type:"event",anonymous:!1,inputs:[{name:"from",internalType:"address",type:"address",indexed:!0},{name:"to",internalType:"address",type:"address",indexed:!0},{name:"amount",internalType:"uint256",type:"uint256",indexed:!1}],name:"Transfer"},{type:"function",inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{name:"result",internalType:"bytes32",type:"bytes32"}],stateMutability:"view"},{type:"function",inputs:[{name:"owner",internalType:"address",type:"address"},{name:"spender",internalType:"address",type:"address"}],name:"allowance",outputs:[{name:"result",internalType:"uint256",type:"uint256"}],stateMutability:"view"},{type:"function",inputs:[{name:"spender",internalType:"address",type:"address"},{name:"amount",internalType:"uint256",type:"uint256"}],name:"approve",outputs:[{name:"",internalType:"bool",type:"bool"}],stateMutability:"nonpayable"},{type:"function",inputs:[{name:"owner",internalType:"address",type:"address"}],name:"balanceOf",outputs:[{name:"result",internalType:"uint256",type:"uint256"}],stateMutability:"view"},{type:"function",inputs:[],name:"decimals",outputs:[{name:"",internalType:"uint8",type:"uint8"}],stateMutability:"view"},{type:"function",inputs:[{name:"to",internalType:"address",type:"address"},{name:"amount",internalType:"uint256",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable"},{type:"function",inputs:[{name:"to",internalType:"address",type:"address"},{name:"amount",internalType:"uint256",type:"uint256"}],name:"mintPayable",outputs:[],stateMutability:"payable"},{type:"function",inputs:[],name:"name",outputs:[{name:"",internalType:"string",type:"string"}],stateMutability:"pure"},{type:"function",inputs:[{name:"owner",internalType:"address",type:"address"}],name:"nonces",outputs:[{name:"result",internalType:"uint256",type:"uint256"}],stateMutability:"view"},{type:"function",inputs:[{name:"owner",internalType:"address",type:"address"},{name:"spender",internalType:"address",type:"address"},{name:"value",internalType:"uint256",type:"uint256"},{name:"deadline",internalType:"uint256",type:"uint256"},{name:"v",internalType:"uint8",type:"uint8"},{name:"r",internalType:"bytes32",type:"bytes32"},{name:"s",internalType:"bytes32",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable"},{type:"function",inputs:[],name:"symbol",outputs:[{name:"",internalType:"string",type:"string"}],stateMutability:"pure"},{type:"function",inputs:[],name:"totalSupply",outputs:[{name:"result",internalType:"uint256",type:"uint256"}],stateMutability:"view"},{type:"function",inputs:[{name:"to",internalType:"address",type:"address"},{name:"amount",internalType:"uint256",type:"uint256"}],name:"transfer",outputs:[{name:"",internalType:"bool",type:"bool"}],stateMutability:"nonpayable"},{type:"function",inputs:[{name:"from",internalType:"address",type:"address"},{name:"to",internalType:"address",type:"address"},{name:"amount",internalType:"uint256",type:"uint256"}],name:"transferFrom",outputs:[{name:"",internalType:"bool",type:"bool"}],stateMutability:"nonpayable"}],Sc=Ns({abi:we,functionName:"allowance"}),Ic=Ns({abi:we,functionName:"balanceOf"}),Rc=br({abi:we,functionName:"approve"}),Oc=br({abi:we,functionName:"mint"}),Mc=br({abi:we,functionName:"mintPayable"}),jc=yr({abi:we,functionName:"approve"}),Nc=yr({abi:we,functionName:"mint"}),Bc=yr({abi:we,functionName:"mintPayable"}),Fc="0x6080604052348015600e575f80fd5b50610a3c8061001c5f395ff3fe6080604052600436106100d9575f3560e01c806340c10f191161007c57806395d89b411161005757806395d89b4114610323578063a9059cbb14610368578063d505accf14610387578063dd62ed3e146103a6575f80fd5b806340c10f19146102a257806370a08231146102c15780637ecebe00146102f2575f80fd5b806318160ddd116100b757806318160ddd1461017857806323b872dd1461019e578063313ce567146101bd5780633644e515146101d8575f80fd5b806306fdde03146100dd578063095ea7b31461013457806317d304b014610163575b5f80fd5b3480156100e8575f80fd5b5060408051808201909152600a81527f4d6f636b2045524332300000000000000000000000000000000000000000000060208201525b60405161012b9190610833565b60405180910390f35b34801561013f575f80fd5b5061015361014e3660046108ae565b6103da565b604051901515815260200161012b565b6101766101713660046108ae565b610429565b005b348015610183575f80fd5b506805345cdf77eb68f44c545b60405190815260200161012b565b3480156101a9575f80fd5b506101536101b83660046108d6565b6104af565b3480156101c8575f80fd5b506040516012815260200161012b565b3480156101e3575f80fd5b50604080518082018252600a81527f4d6f636b2045524332300000000000000000000000000000000000000000000060209182015281517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81527fa5c9260bf133e670eeaf4d41f5c4289fc23bb146bf11ba8fa70a2ea91ba1a330918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc69181019190915246606082015230608082015260a09020610190565b3480156102ad575f80fd5b506101766102bc3660046108ae565b6104a1565b3480156102cc575f80fd5b506101906102db366004610910565b6387a211a2600c9081525f91909152602090205490565b3480156102fd575f80fd5b5061019061030c366004610910565b6338377508600c9081525f91909152602090205490565b34801561032e575f80fd5b5060408051808201909152600481527f4d4f434b00000000000000000000000000000000000000000000000000000000602082015261011e565b348015610373575f80fd5b506101536103823660046108ae565b610569565b348015610392575f80fd5b506101766103a1366004610930565b6105e0565b3480156103b1575f80fd5b506101906103c036600461099d565b602052637f5e9f20600c9081525f91909152603490205490565b5f82602052637f5e9f20600c52335f52816034600c2055815f52602c5160601c337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560205fa350600192915050565b6104346064826109ce565b3410156104a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4d6f636b45524332303a2067696d6d65206d6f7265206d6f6e65792100000000604482015260640160405180910390fd5b6104ab82826107b7565b5050565b5f8360601b33602052637f5e9f208117600c526034600c20805460018101156104ed57808511156104e7576313be252b5f526004601cfd5b84810382555b50506387a211a28117600c526020600c208054808511156105155763f4d678b85f526004601cfd5b84810382555050835f526020600c208381540181555082602052600c5160601c8160601c7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602080a3505060019392505050565b5f6387a211a2600c52335f526020600c208054808411156105915763f4d678b85f526004601cfd5b83810382555050825f526020600c208281540181555081602052600c5160601c337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602080a350600192915050565b60408051808201909152600a81527f4d6f636b204552433230000000000000000000000000000000000000000000006020909101527fa5c9260bf133e670eeaf4d41f5c4289fc23bb146bf11ba8fa70a2ea91ba1a3308442111561064b57631a15a3cc5f526004601cfd5b6040518860601b60601c98508760601b60601c975065383775081901600e52885f526020600c2080547f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f83528360208401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6604084015246606084015230608084015260a08320602e527f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c983528a60208401528960408401528860608401528060808401528760a084015260c08320604e526042602c205f528660ff16602052856040528460605260208060805f60015afa8b3d51146107535763ddafbaef5f526004601cfd5b019055777f5e9f20000000000000000000000000000000000000000088176040526034602c2087905587897f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925602060608501a360405250505f606052505050505050565b6805345cdf77eb68f44c54818101818110156107da5763e5cfe9575f526004601cfd5b806805345cdf77eb68f44c5550506387a211a2600c52815f526020600c208181540181555080602052600c5160601c5f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602080a35050565b602081525f82518060208401528060208501604085015e5f6040828501015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011684010191505092915050565b803573ffffffffffffffffffffffffffffffffffffffff811681146108a9575f80fd5b919050565b5f80604083850312156108bf575f80fd5b6108c883610886565b946020939093013593505050565b5f805f606084860312156108e8575f80fd5b6108f184610886565b92506108ff60208501610886565b929592945050506040919091013590565b5f60208284031215610920575f80fd5b61092982610886565b9392505050565b5f805f805f805f60e0888a031215610946575f80fd5b61094f88610886565b965061095d60208901610886565b95506040880135945060608801359350608088013560ff81168114610980575f80fd5b9699959850939692959460a0840135945060c09093013592915050565b5f80604083850312156109ae575f80fd5b6109b783610886565b91506109c560208401610886565b90509250929050565b5f82610a01577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b50049056fea2646970667358221220a27cf4eb58983f34470237d40a3f6ea7247af029518c7eec2d89f9256927389564736f6c634300081a0033";class Bs extends j.Deployable{async balanceOf(e,n){return await Ic(this._config,{address:this.assertValidAddress(),args:[e],...n})}async allowance(e,n,r){return await Sc(this._config,{address:this.assertValidAddress(),args:[e,n],...r})}async approve(e,n,r){return await this.awaitResult(this.approveRaw(e,n,r))}async approveRaw(e,n,r){const{request:s,result:a}=await jc(this._config,{address:this.assertValidAddress(),args:[e,n],...this.optionallyAttachAccount(),...r});return{hash:await Rc(this._config,s),result:a}}async mint(e,n,r){return await this.awaitResult(this.mintRaw(e,n,r))}async mintRaw(e,n,r){const{request:s,result:a}=await Nc(this._config,{address:this.assertValidAddress(),args:[e,n],...this.optionallyAttachAccount(),...r});return{hash:await Oc(this._config,s),result:a}}async mintPayable(e,n,r){return await this.awaitResult(this.mintPayableRaw(e,n,r))}async mintPayableRaw(e,n,r){const{request:s,result:a}=await Bc(this._config,{address:this.assertValidAddress(),args:[e,n],...this.optionallyAttachAccount(),...r});return{hash:await Mc(this._config,s),result:a}}buildParameters(e={},n){const[,r]=this.validateDeploymentConfig(e,n);return{abi:we,bytecode:Fc,...this.optionallyAttachAccount(r.account)}}}const zc=[{account:"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",key:"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"},{account:"0x70997970C51812dc3A010C7d01b50e0d17dc79C8",key:"0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"},{account:"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC",key:"0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a"},{account:"0x90F79bf6EB2c4f870365E785982E1f101E93b906",key:"0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6"},{account:"0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65",key:"0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a"},{account:"0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc",key:"0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba"},{account:"0x70997970C51812dc3A010C7d01b50e0d17dc79C8",key:"0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"},{account:"0x70997970C51812dc3A010C7d01b50e0d17dc79C8",key:"0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"},{account:"0x70997970C51812dc3A010C7d01b50e0d17dc79C8",key:"0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"},{account:"0x70997970C51812dc3A010C7d01b50e0d17dc79C8",key:"0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"}].map(t=>({...t,privateKey:W.privateKeyToAccount(t.key)}));var C;(function(t){t.assertEqual=s=>s;function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},t.getValidEnumValues=s=>{const a=t.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(a){return s[a]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},t.find=(s,a)=>{for(const i of s)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function r(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(C||(C={}));var Dn;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Dn||(Dn={}));const g=C.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),pe=t=>{switch(typeof t){case"undefined":return g.undefined;case"string":return g.string;case"number":return isNaN(t)?g.nan:g.number;case"boolean":return g.boolean;case"function":return g.function;case"bigint":return g.bigint;case"symbol":return g.symbol;case"object":return Array.isArray(t)?g.array:t===null?g.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?g.promise:typeof Map<"u"&&t instanceof Map?g.map:typeof Set<"u"&&t instanceof Set?g.set:typeof Date<"u"&&t instanceof Date?g.date:g.object;default:return g.unknown}},l=C.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Zc=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class K extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(a){return a.message},r={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let o=r,u=0;for(;u<i.path.length;){const c=i.path[u];u===i.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(n(i))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return s(this),r}static assert(e){if(!(e instanceof K))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,C.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(e(s))):r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}K.create=t=>new K(t);const Je=(t,e)=>{let n;switch(t.code){case l.invalid_type:t.received===g.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case l.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,C.jsonStringifyReplacer)}`;break;case l.unrecognized_keys:n=`Unrecognized key(s) in object: ${C.joinValues(t.keys,", ")}`;break;case l.invalid_union:n="Invalid input";break;case l.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${C.joinValues(t.options)}`;break;case l.invalid_enum_value:n=`Invalid enum value. Expected ${C.joinValues(t.options)}, received '${t.received}'`;break;case l.invalid_arguments:n="Invalid function arguments";break;case l.invalid_return_type:n="Invalid function return type";break;case l.invalid_date:n="Invalid date";break;case l.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:C.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case l.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case l.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case l.custom:n="Invalid input";break;case l.invalid_intersection_types:n="Intersection results could not be merged";break;case l.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case l.not_finite:n="Number must be finite";break;default:n=e.defaultError,C.assertNever(t)}return{message:n}};let Fs=Je;function Dc(t){Fs=t}function Jt(){return Fs}const Yt=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,a=[...n,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const u=r.filter(c=>!!c).slice().reverse();for(const c of u)o=c(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}},Lc=[];function b(t,e){const n=Jt(),r=Yt({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Je?void 0:Je].filter(s=>!!s)});t.common.issues.push(r)}class z{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return _;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const s of n){const a=await s.key,i=await s.value;r.push({key:a,value:i})}return z.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return _;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(r[a.value]=i.value)}return{status:e.value,value:r}}}const _=Object.freeze({status:"aborted"}),Le=t=>({status:"dirty",value:t}),L=t=>({status:"valid",value:t}),Ln=t=>t.status==="aborted",Un=t=>t.status==="dirty",Me=t=>t.status==="valid",Pt=t=>typeof Promise<"u"&&t instanceof Promise;function Xt(t,e,n,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function zs(t,e,n,r,s){if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var w;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(w||(w={}));var st,at;class oe{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Br=(t,e)=>{if(Me(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new K(t.common.issues);return this._error=n,this._error}}};function A(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{var u,c;const{message:d}=t;return i.code==="invalid_enum_value"?{message:d??o.defaultError}:typeof o.data>"u"?{message:(u=d??r)!==null&&u!==void 0?u:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(c=d??n)!==null&&c!==void 0?c:o.defaultError}},description:s}}class T{get description(){return this._def.description}_getType(e){return pe(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:pe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new z,ctx:{common:e.parent.common,data:e.data,parsedType:pe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Pt(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;const s={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:pe(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Br(s,a)}"~validate"(e){var n,r;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:pe(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:s});return Me(a)?{value:a.value}:{issues:s.common.issues}}catch(a){!((r=(n=a==null?void 0:a.message)===null||n===void 0?void 0:n.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(a=>Me(a)?{value:a.value}:{issues:s.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:pe(e)},s=this._parse({data:e,path:r.path,parent:r}),a=await(Pt(s)?s:Promise.resolve(s));return Br(r,a)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:l.custom,...r(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new re({schema:this,typeName:x.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return ie.create(this,this._def)}nullable(){return Ae.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ne.create(this)}promise(){return Xe.create(this,this._def)}or(e){return kt.create([this,e],this._def)}and(e){return $t.create(this,e,this._def)}transform(e){return new re({...A(this._def),schema:this,typeName:x.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Ot({...A(this._def),innerType:this,defaultValue:n,typeName:x.ZodDefault})}brand(){return new gr({typeName:x.ZodBranded,type:this,...A(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Mt({...A(this._def),innerType:this,catchValue:n,typeName:x.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return zt.create(this,e)}readonly(){return jt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Uc=/^c[^\s-]{8,}$/i,Vc=/^[0-9a-z]+$/,Gc=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Hc=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,qc=/^[a-z0-9_-]{21}$/i,Wc=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Kc=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Jc=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Yc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let _n;const Xc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Qc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,eu=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,tu=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ru=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Zs="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",su=new RegExp(`^${Zs}$`);function Ds(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function au(t){return new RegExp(`^${Ds(t)}$`)}function Ls(t){let e=`${Zs}T${Ds(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function iu(t,e){return!!((e==="v4"||!e)&&Xc.test(t)||(e==="v6"||!e)&&eu.test(t))}function ou(t,e){if(!Wc.test(t))return!1;try{const[n]=t.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||!s.typ||!s.alg||e&&s.alg!==e)}catch{return!1}}function cu(t,e){return!!((e==="v4"||!e)&&Qc.test(t)||(e==="v6"||!e)&&tu.test(t))}class te extends T{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==g.string){const a=this._getOrReturnCtx(e);return b(a,{code:l.invalid_type,expected:g.string,received:a.parsedType}),_}const r=new z;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),b(s,{code:l.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),b(s,{code:l.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?b(s,{code:l.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&b(s,{code:l.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")Jc.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"email",code:l.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")_n||(_n=new RegExp(Yc,"u")),_n.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"emoji",code:l.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")Hc.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"uuid",code:l.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")qc.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"nanoid",code:l.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")Uc.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"cuid",code:l.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")Vc.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"cuid2",code:l.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")Gc.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"ulid",code:l.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),b(s,{validation:"url",code:l.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"regex",code:l.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),b(s,{code:l.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),b(s,{code:l.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),b(s,{code:l.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?Ls(a).test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{code:l.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?su.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{code:l.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?au(a).test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{code:l.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?Kc.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"duration",code:l.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?iu(e.data,a.version)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"ip",code:l.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?ou(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"jwt",code:l.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?cu(e.data,a.version)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"cidr",code:l.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?nu.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"base64",code:l.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?ru.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"base64url",code:l.invalid_string,message:a.message}),r.dirty()):C.assertNever(a);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:l.invalid_string,...w.errToObj(r)})}_addCheck(e){return new te({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...w.errToObj(e)})}url(e){return this._addCheck({kind:"url",...w.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...w.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...w.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...w.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...w.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...w.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...w.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...w.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...w.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...w.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...w.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...w.errToObj(e)})}datetime(e){var n,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...w.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...w.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...w.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...w.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...w.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...w.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...w.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...w.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...w.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...w.errToObj(n)})}nonempty(e){return this.min(1,w.errToObj(e))}trim(){return new te({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new te({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new te({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}te.create=t=>{var e;return new te({checks:[],typeName:x.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...A(t)})};function uu(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,a=parseInt(t.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}class _e extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==g.number){const a=this._getOrReturnCtx(e);return b(a,{code:l.invalid_type,expected:g.number,received:a.parsedType}),_}let r;const s=new z;for(const a of this._def.checks)a.kind==="int"?C.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),b(r,{code:l.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),b(r,{code:l.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),b(r,{code:l.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?uu(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),b(r,{code:l.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),b(r,{code:l.not_finite,message:a.message}),s.dirty()):C.assertNever(a);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,w.toString(n))}gt(e,n){return this.setLimit("min",e,!1,w.toString(n))}lte(e,n){return this.setLimit("max",e,!0,w.toString(n))}lt(e,n){return this.setLimit("max",e,!1,w.toString(n))}setLimit(e,n,r,s){return new _e({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:w.toString(s)}]})}_addCheck(e){return new _e({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:w.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:w.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:w.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:w.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:w.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&C.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}_e.create=t=>new _e({checks:[],typeName:x.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...A(t)});class Pe extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==g.bigint)return this._getInvalidInput(e);let r;const s=new z;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),b(r,{code:l.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),b(r,{code:l.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),b(r,{code:l.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):C.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return b(n,{code:l.invalid_type,expected:g.bigint,received:n.parsedType}),_}gte(e,n){return this.setLimit("min",e,!0,w.toString(n))}gt(e,n){return this.setLimit("min",e,!1,w.toString(n))}lte(e,n){return this.setLimit("max",e,!0,w.toString(n))}lt(e,n){return this.setLimit("max",e,!1,w.toString(n))}setLimit(e,n,r,s){return new Pe({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:w.toString(s)}]})}_addCheck(e){return new Pe({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:w.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Pe.create=t=>{var e;return new Pe({checks:[],typeName:x.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...A(t)})};class Et extends T{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==g.boolean){const r=this._getOrReturnCtx(e);return b(r,{code:l.invalid_type,expected:g.boolean,received:r.parsedType}),_}return L(e.data)}}Et.create=t=>new Et({typeName:x.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...A(t)});class je extends T{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==g.date){const a=this._getOrReturnCtx(e);return b(a,{code:l.invalid_type,expected:g.date,received:a.parsedType}),_}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return b(a,{code:l.invalid_date}),_}const r=new z;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),b(s,{code:l.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),b(s,{code:l.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):C.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new je({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:w.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:w.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}je.create=t=>new je({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:x.ZodDate,...A(t)});class Qt extends T{_parse(e){if(this._getType(e)!==g.symbol){const r=this._getOrReturnCtx(e);return b(r,{code:l.invalid_type,expected:g.symbol,received:r.parsedType}),_}return L(e.data)}}Qt.create=t=>new Qt({typeName:x.ZodSymbol,...A(t)});class At extends T{_parse(e){if(this._getType(e)!==g.undefined){const r=this._getOrReturnCtx(e);return b(r,{code:l.invalid_type,expected:g.undefined,received:r.parsedType}),_}return L(e.data)}}At.create=t=>new At({typeName:x.ZodUndefined,...A(t)});class Tt extends T{_parse(e){if(this._getType(e)!==g.null){const r=this._getOrReturnCtx(e);return b(r,{code:l.invalid_type,expected:g.null,received:r.parsedType}),_}return L(e.data)}}Tt.create=t=>new Tt({typeName:x.ZodNull,...A(t)});class Ye extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return L(e.data)}}Ye.create=t=>new Ye({typeName:x.ZodAny,...A(t)});class Se extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return L(e.data)}}Se.create=t=>new Se({typeName:x.ZodUnknown,...A(t)});class ve extends T{_parse(e){const n=this._getOrReturnCtx(e);return b(n,{code:l.invalid_type,expected:g.never,received:n.parsedType}),_}}ve.create=t=>new ve({typeName:x.ZodNever,...A(t)});class en extends T{_parse(e){if(this._getType(e)!==g.undefined){const r=this._getOrReturnCtx(e);return b(r,{code:l.invalid_type,expected:g.void,received:r.parsedType}),_}return L(e.data)}}en.create=t=>new en({typeName:x.ZodVoid,...A(t)});class ne extends T{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==g.array)return b(n,{code:l.invalid_type,expected:g.array,received:n.parsedType}),_;if(s.exactLength!==null){const i=n.data.length>s.exactLength.value,o=n.data.length<s.exactLength.value;(i||o)&&(b(n,{code:i?l.too_big:l.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(b(n,{code:l.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(b(n,{code:l.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,o)=>s.type._parseAsync(new oe(n,i,n.path,o)))).then(i=>z.mergeArray(r,i));const a=[...n.data].map((i,o)=>s.type._parseSync(new oe(n,i,n.path,o)));return z.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new ne({...this._def,minLength:{value:e,message:w.toString(n)}})}max(e,n){return new ne({...this._def,maxLength:{value:e,message:w.toString(n)}})}length(e,n){return new ne({...this._def,exactLength:{value:e,message:w.toString(n)}})}nonempty(e){return this.min(1,e)}}ne.create=(t,e)=>new ne({type:t,minLength:null,maxLength:null,exactLength:null,typeName:x.ZodArray,...A(e)});function Ze(t){if(t instanceof M){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=ie.create(Ze(r))}return new M({...t._def,shape:()=>e})}else return t instanceof ne?new ne({...t._def,type:Ze(t.element)}):t instanceof ie?ie.create(Ze(t.unwrap())):t instanceof Ae?Ae.create(Ze(t.unwrap())):t instanceof ce?ce.create(t.items.map(e=>Ze(e))):t}class M extends T{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=C.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==g.object){const c=this._getOrReturnCtx(e);return b(c,{code:l.invalid_type,expected:g.object,received:c.parsedType}),_}const{status:r,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof ve&&this._def.unknownKeys==="strip"))for(const c in s.data)i.includes(c)||o.push(c);const u=[];for(const c of i){const d=a[c],f=s.data[c];u.push({key:{status:"valid",value:c},value:d._parse(new oe(s,f,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof ve){const c=this._def.unknownKeys;if(c==="passthrough")for(const d of o)u.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(c==="strict")o.length>0&&(b(s,{code:l.unrecognized_keys,keys:o}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const d of o){const f=s.data[d];u.push({key:{status:"valid",value:d},value:c._parse(new oe(s,f,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const d of u){const f=await d.key,h=await d.value;c.push({key:f,value:h,alwaysSet:d.alwaysSet})}return c}).then(c=>z.mergeObjectSync(r,c)):z.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(e){return w.errToObj,new M({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var s,a,i,o;const u=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,n,r).message)!==null&&i!==void 0?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(o=w.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new M({...this._def,unknownKeys:"strip"})}passthrough(){return new M({...this._def,unknownKeys:"passthrough"})}extend(e){return new M({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new M({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:x.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new M({...this._def,catchall:e})}pick(e){const n={};return C.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new M({...this._def,shape:()=>n})}omit(e){const n={};return C.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new M({...this._def,shape:()=>n})}deepPartial(){return Ze(this)}partial(e){const n={};return C.objectKeys(this.shape).forEach(r=>{const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}),new M({...this._def,shape:()=>n})}required(e){const n={};return C.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof ie;)a=a._def.innerType;n[r]=a}}),new M({...this._def,shape:()=>n})}keyof(){return Us(C.objectKeys(this.shape))}}M.create=(t,e)=>new M({shape:()=>t,unknownKeys:"strip",catchall:ve.create(),typeName:x.ZodObject,...A(e)});M.strictCreate=(t,e)=>new M({shape:()=>t,unknownKeys:"strict",catchall:ve.create(),typeName:x.ZodObject,...A(e)});M.lazycreate=(t,e)=>new M({shape:t,unknownKeys:"strip",catchall:ve.create(),typeName:x.ZodObject,...A(e)});class kt extends T{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new K(o.ctx.common.issues));return b(n,{code:l.invalid_union,unionErrors:i}),_}if(n.common.async)return Promise.all(r.map(async a=>{const i={...n,common:{...n.common,issues:[]},parent:null};return{result:await a._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const u of r){const c={...n,common:{...n.common,issues:[]},parent:null},d=u._parseSync({data:n.data,path:n.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!a&&(a={result:d,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(u=>new K(u));return b(n,{code:l.invalid_union,unionErrors:o}),_}}get options(){return this._def.options}}kt.create=(t,e)=>new kt({options:t,typeName:x.ZodUnion,...A(e)});const he=t=>t instanceof St?he(t.schema):t instanceof re?he(t.innerType()):t instanceof It?[t.value]:t instanceof Ee?t.options:t instanceof Rt?C.objectValues(t.enum):t instanceof Ot?he(t._def.innerType):t instanceof At?[void 0]:t instanceof Tt?[null]:t instanceof ie?[void 0,...he(t.unwrap())]:t instanceof Ae?[null,...he(t.unwrap())]:t instanceof gr||t instanceof jt?he(t.unwrap()):t instanceof Mt?he(t._def.innerType):[];class ln extends T{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==g.object)return b(n,{code:l.invalid_type,expected:g.object,received:n.parsedType}),_;const r=this.discriminator,s=n.data[r],a=this.optionsMap.get(s);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(b(n,{code:l.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),_)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const s=new Map;for(const a of n){const i=he(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new ln({typeName:x.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...A(r)})}}function Vn(t,e){const n=pe(t),r=pe(e);if(t===e)return{valid:!0,data:t};if(n===g.object&&r===g.object){const s=C.objectKeys(e),a=C.objectKeys(t).filter(o=>s.indexOf(o)!==-1),i={...t,...e};for(const o of a){const u=Vn(t[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(n===g.array&&r===g.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<t.length;a++){const i=t[a],o=e[a],u=Vn(i,o);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return n===g.date&&r===g.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class $t extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(a,i)=>{if(Ln(a)||Ln(i))return _;const o=Vn(a.value,i.value);return o.valid?((Un(a)||Un(i))&&n.dirty(),{status:n.value,value:o.data}):(b(r,{code:l.invalid_intersection_types}),_)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}$t.create=(t,e,n)=>new $t({left:t,right:e,typeName:x.ZodIntersection,...A(n)});class ce extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.array)return b(r,{code:l.invalid_type,expected:g.array,received:r.parsedType}),_;if(r.data.length<this._def.items.length)return b(r,{code:l.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_;!this._def.rest&&r.data.length>this._def.items.length&&(b(r,{code:l.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const a=[...r.data].map((i,o)=>{const u=this._def.items[o]||this._def.rest;return u?u._parse(new oe(r,i,r.path,o)):null}).filter(i=>!!i);return r.common.async?Promise.all(a).then(i=>z.mergeArray(n,i)):z.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new ce({...this._def,rest:e})}}ce.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ce({items:t,typeName:x.ZodTuple,rest:null,...A(e)})};class Ct extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.object)return b(r,{code:l.invalid_type,expected:g.object,received:r.parsedType}),_;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in r.data)s.push({key:a._parse(new oe(r,o,r.path,o)),value:i._parse(new oe(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?z.mergeObjectAsync(n,s):z.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof T?new Ct({keyType:e,valueType:n,typeName:x.ZodRecord,...A(r)}):new Ct({keyType:te.create(),valueType:e,typeName:x.ZodRecord,...A(n)})}}class tn extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.map)return b(r,{code:l.invalid_type,expected:g.map,received:r.parsedType}),_;const s=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map(([o,u],c)=>({key:s._parse(new oe(r,o,r.path,[c,"key"])),value:a._parse(new oe(r,u,r.path,[c,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of i){const c=await u.key,d=await u.value;if(c.status==="aborted"||d.status==="aborted")return _;(c.status==="dirty"||d.status==="dirty")&&n.dirty(),o.set(c.value,d.value)}return{status:n.value,value:o}})}else{const o=new Map;for(const u of i){const c=u.key,d=u.value;if(c.status==="aborted"||d.status==="aborted")return _;(c.status==="dirty"||d.status==="dirty")&&n.dirty(),o.set(c.value,d.value)}return{status:n.value,value:o}}}}tn.create=(t,e,n)=>new tn({valueType:e,keyType:t,typeName:x.ZodMap,...A(n)});class Ne extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.set)return b(r,{code:l.invalid_type,expected:g.set,received:r.parsedType}),_;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(b(r,{code:l.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(b(r,{code:l.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const a=this._def.valueType;function i(u){const c=new Set;for(const d of u){if(d.status==="aborted")return _;d.status==="dirty"&&n.dirty(),c.add(d.value)}return{status:n.value,value:c}}const o=[...r.data.values()].map((u,c)=>a._parse(new oe(r,u,r.path,c)));return r.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,n){return new Ne({...this._def,minSize:{value:e,message:w.toString(n)}})}max(e,n){return new Ne({...this._def,maxSize:{value:e,message:w.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Ne.create=(t,e)=>new Ne({valueType:t,minSize:null,maxSize:null,typeName:x.ZodSet,...A(e)});class Ge extends T{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==g.function)return b(n,{code:l.invalid_type,expected:g.function,received:n.parsedType}),_;function r(o,u){return Yt({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Jt(),Je].filter(c=>!!c),issueData:{code:l.invalid_arguments,argumentsError:u}})}function s(o,u){return Yt({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Jt(),Je].filter(c=>!!c),issueData:{code:l.invalid_return_type,returnTypeError:u}})}const a={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof Xe){const o=this;return L(async function(...u){const c=new K([]),d=await o._def.args.parseAsync(u,a).catch(y=>{throw c.addIssue(r(u,y)),c}),f=await Reflect.apply(i,this,d);return await o._def.returns._def.type.parseAsync(f,a).catch(y=>{throw c.addIssue(s(f,y)),c})})}else{const o=this;return L(function(...u){const c=o._def.args.safeParse(u,a);if(!c.success)throw new K([r(u,c.error)]);const d=Reflect.apply(i,this,c.data),f=o._def.returns.safeParse(d,a);if(!f.success)throw new K([s(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ge({...this._def,args:ce.create(e).rest(Se.create())})}returns(e){return new Ge({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new Ge({args:e||ce.create([]).rest(Se.create()),returns:n||Se.create(),typeName:x.ZodFunction,...A(r)})}}class St extends T{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}St.create=(t,e)=>new St({getter:t,typeName:x.ZodLazy,...A(e)});class It extends T{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return b(n,{received:n.data,code:l.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:e.data}}get value(){return this._def.value}}It.create=(t,e)=>new It({value:t,typeName:x.ZodLiteral,...A(e)});function Us(t,e){return new Ee({values:t,typeName:x.ZodEnum,...A(e)})}class Ee extends T{constructor(){super(...arguments),st.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return b(n,{expected:C.joinValues(r),received:n.parsedType,code:l.invalid_type}),_}if(Xt(this,st)||zs(this,st,new Set(this._def.values)),!Xt(this,st).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return b(n,{received:n.data,code:l.invalid_enum_value,options:r}),_}return L(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Ee.create(e,{...this._def,...n})}exclude(e,n=this._def){return Ee.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}st=new WeakMap;Ee.create=Us;class Rt extends T{constructor(){super(...arguments),at.set(this,void 0)}_parse(e){const n=C.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==g.string&&r.parsedType!==g.number){const s=C.objectValues(n);return b(r,{expected:C.joinValues(s),received:r.parsedType,code:l.invalid_type}),_}if(Xt(this,at)||zs(this,at,new Set(C.getValidEnumValues(this._def.values))),!Xt(this,at).has(e.data)){const s=C.objectValues(n);return b(r,{received:r.data,code:l.invalid_enum_value,options:s}),_}return L(e.data)}get enum(){return this._def.values}}at=new WeakMap;Rt.create=(t,e)=>new Rt({values:t,typeName:x.ZodNativeEnum,...A(e)});class Xe extends T{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==g.promise&&n.common.async===!1)return b(n,{code:l.invalid_type,expected:g.promise,received:n.parsedType}),_;const r=n.parsedType===g.promise?n.data:Promise.resolve(n.data);return L(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Xe.create=(t,e)=>new Xe({type:t,typeName:x.ZodPromise,...A(e)});class re extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===x.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{b(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(r.data,a);if(r.common.async)return Promise.resolve(i).then(async o=>{if(n.value==="aborted")return _;const u=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return u.status==="aborted"?_:u.status==="dirty"||n.value==="dirty"?Le(u.value):u});{if(n.value==="aborted")return _;const o=this._def.schema._parseSync({data:i,path:r.path,parent:r});return o.status==="aborted"?_:o.status==="dirty"||n.value==="dirty"?Le(o.value):o}}if(s.type==="refinement"){const i=o=>{const u=s.refinement(o,a);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?_:(o.status==="dirty"&&n.dirty(),i(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?_:(o.status==="dirty"&&n.dirty(),i(o.value).then(()=>({status:n.value,value:o.value}))))}if(s.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Me(i))return i;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>Me(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:n.value,value:o})):i);C.assertNever(s)}}re.create=(t,e,n)=>new re({schema:t,typeName:x.ZodEffects,effect:e,...A(n)});re.createWithPreprocess=(t,e,n)=>new re({schema:e,effect:{type:"preprocess",transform:t},typeName:x.ZodEffects,...A(n)});class ie extends T{_parse(e){return this._getType(e)===g.undefined?L(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ie.create=(t,e)=>new ie({innerType:t,typeName:x.ZodOptional,...A(e)});class Ae extends T{_parse(e){return this._getType(e)===g.null?L(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ae.create=(t,e)=>new Ae({innerType:t,typeName:x.ZodNullable,...A(e)});class Ot extends T{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===g.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Ot.create=(t,e)=>new Ot({innerType:t,typeName:x.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...A(e)});class Mt extends T{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Pt(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new K(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new K(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Mt.create=(t,e)=>new Mt({innerType:t,typeName:x.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...A(e)});class nn extends T{_parse(e){if(this._getType(e)!==g.nan){const r=this._getOrReturnCtx(e);return b(r,{code:l.invalid_type,expected:g.nan,received:r.parsedType}),_}return{status:"valid",value:e.data}}}nn.create=t=>new nn({typeName:x.ZodNaN,...A(t)});const du=Symbol("zod_brand");class gr extends T{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class zt extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?_:a.status==="dirty"?(n.dirty(),Le(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?_:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new zt({in:e,out:n,typeName:x.ZodPipeline})}}class jt extends T{_parse(e){const n=this._def.innerType._parse(e),r=s=>(Me(s)&&(s.value=Object.freeze(s.value)),s);return Pt(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}jt.create=(t,e)=>new jt({innerType:t,typeName:x.ZodReadonly,...A(e)});function Vs(t,e={},n){return t?Ye.create().superRefine((r,s)=>{var a,i;if(!t(r)){const o=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,u=(i=(a=o.fatal)!==null&&a!==void 0?a:n)!==null&&i!==void 0?i:!0,c=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...c,fatal:u})}}):Ye.create()}const lu={object:M.lazycreate};var x;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(x||(x={}));const fu=(t,e={message:`Input not instance of ${t.name}`})=>Vs(n=>n instanceof t,e),Gs=te.create,Hs=_e.create,hu=nn.create,pu=Pe.create,qs=Et.create,mu=je.create,yu=Qt.create,bu=At.create,gu=Tt.create,vu=Ye.create,wu=Se.create,xu=ve.create,_u=en.create,Pu=ne.create,Eu=M.create,Au=M.strictCreate,Tu=kt.create,ku=ln.create,$u=$t.create,Cu=ce.create,Su=Ct.create,Iu=tn.create,Ru=Ne.create,Ou=Ge.create,Mu=St.create,ju=It.create,Nu=Ee.create,Bu=Rt.create,Fu=Xe.create,Fr=re.create,zu=ie.create,Zu=Ae.create,Du=re.createWithPreprocess,Lu=zt.create,Uu=()=>Gs().optional(),Vu=()=>Hs().optional(),Gu=()=>qs().optional(),Hu={string:t=>te.create({...t,coerce:!0}),number:t=>_e.create({...t,coerce:!0}),boolean:t=>Et.create({...t,coerce:!0}),bigint:t=>Pe.create({...t,coerce:!0}),date:t=>je.create({...t,coerce:!0})},qu=_;var p=Object.freeze({__proto__:null,defaultErrorMap:Je,setErrorMap:Dc,getErrorMap:Jt,makeIssue:Yt,EMPTY_PATH:Lc,addIssueToContext:b,ParseStatus:z,INVALID:_,DIRTY:Le,OK:L,isAborted:Ln,isDirty:Un,isValid:Me,isAsync:Pt,get util(){return C},get objectUtil(){return Dn},ZodParsedType:g,getParsedType:pe,ZodType:T,datetimeRegex:Ls,ZodString:te,ZodNumber:_e,ZodBigInt:Pe,ZodBoolean:Et,ZodDate:je,ZodSymbol:Qt,ZodUndefined:At,ZodNull:Tt,ZodAny:Ye,ZodUnknown:Se,ZodNever:ve,ZodVoid:en,ZodArray:ne,ZodObject:M,ZodUnion:kt,ZodDiscriminatedUnion:ln,ZodIntersection:$t,ZodTuple:ce,ZodRecord:Ct,ZodMap:tn,ZodSet:Ne,ZodFunction:Ge,ZodLazy:St,ZodLiteral:It,ZodEnum:Ee,ZodNativeEnum:Rt,ZodPromise:Xe,ZodEffects:re,ZodTransformer:re,ZodOptional:ie,ZodNullable:Ae,ZodDefault:Ot,ZodCatch:Mt,ZodNaN:nn,BRAND:du,ZodBranded:gr,ZodPipeline:zt,ZodReadonly:jt,custom:Vs,Schema:T,ZodSchema:T,late:lu,get ZodFirstPartyTypeKind(){return x},coerce:Hu,any:vu,array:Pu,bigint:pu,boolean:qs,date:mu,discriminatedUnion:ku,effect:Fr,enum:Nu,function:Ou,instanceof:fu,intersection:$u,lazy:Mu,literal:ju,map:Iu,nan:hu,nativeEnum:Bu,never:xu,null:gu,nullable:Zu,number:Hs,object:Eu,oboolean:Gu,onumber:Vu,optional:zu,ostring:Uu,pipeline:Lu,preprocess:Du,promise:Fu,record:Su,set:Ru,strictObject:Au,string:Gs,symbol:yu,transformer:Fr,tuple:Cu,undefined:bu,union:Tu,unknown:wu,void:_u,NEVER:qu,ZodIssueCode:l,quotelessJson:Zc,ZodError:K});const Wu="test test test test test test test test test test test junk",Ku=async function(e,n){const r=n.privateKey,s=n.mnemonic??Wu,a=n.chain||"anvil",[{config:i,account:o},u]=W.getDeployableOptions({chain:a,rpcUrl:n.rpcUrl,privateKey:r,mnemonic:s}),c=u.id;if(e.at(0)==="generate")return da({account:o==null?void 0:o.address,chainId:c});if(e.at(0)==="erc20"){let E=new Bs({config:i,account:o},{});return await E.deploy(),{erc20:E.assertValidAddress()}}const d=j.BOOST_REGISTRY_ADDRESSES[c];if(!d)throw new Error(`Unable to select a deployed BoostRegistry with chain ID ${c}`);const f=new j.BoostRegistry({config:i,account:o,address:d}),h=j.BOOST_CORE_ADDRESSES[c];if(!h)throw new Error(`Unable to select a deployed BoostCore with chain ID ${c}`);const y=new j.BoostCore({config:i,account:o,address:h});if(!e.length)throw new Error("No seed provided");const v=await Promise.all(e.map(Ju));let k,P;const S=[];for(const E of v){let I;if(typeof E.budget=="string"&&W.isAddress$1(E.budget))I=y.ManagedBudget(E.budget);else if(Pn(P,E.budget)&&k)I=k;else{const $={...E.budget,authorized:[...E.budget.authorized,h],roles:[...E.budget.roles,j.Roles.MANAGER]};I=await f.initialize(crypto.randomUUID(),y.ManagedBudget($)),k=I,P=E.budget}const q=E.incentives.map(async $=>{let N=0n;switch($.type){case"AllowListIncentive":return y.AllowListIncentive($);case"PointsIncentive":return y.PointsIncentive($);case"ERC20Incentive":return $.strategy===j.StrategyType.RAFFLE&&(N+=$.reward),$.strategy===j.StrategyType.POOL&&(N+=$.reward*$.limit),$.shouldMintAndAllocate&&await Ut(I,N,$.asset,{config:i,account:o}),y.ERC20Incentive($);case"ERC20VariableCriteriaIncentive":return N+=$.limit,$.shouldMintAndAllocate&&await Ut(I,N,$.asset,{config:i,account:o}),y.ERC20VariableCriteriaIncentive($);case"ERC20VariableIncentive":return N+=$.limit,$.shouldMintAndAllocate&&await Ut(I,N,$.asset,{config:i,account:o}),y.ERC20VariableIncentive($);case"CGDAIncentive":return N+=$.totalBudget,$.shouldMintAndAllocate&&await Ut(I,N,$.asset,{config:i,account:o}),y.CGDAIncentive($)}}),J=await Promise.all(q),B={protocolFee:E.protocolFee,maxParticipants:E.maxParticipants,budget:I,action:y.EventAction(E.action),allowList:await Qu(E,{core:y}),incentives:J};E.validator&&(B.validator=y.SignerValidator(E.validator));const se=await y.createBoost(B);S.push(se.id.toString())}return{boostIds:S}};async function Ut(t,e,n,r){if(n&&e){let s=new Bs(r,n);await ed(r,s,t,zr(e.toString()))}}async function Ju(t){const e=await la.readFile(fa.normalize(t),{encoding:"utf8"});return ua.parse(JSON.parse(e))}const Yu=p.custom(W.isHex$1,"invalid Hex payload"),O=p.string().transform((t,e)=>(/^0x[a-fA-F0-9]{40}$/.test(t)||e.addIssue({code:p.ZodIssueCode.custom,message:`Invalid Address ${t}`}),t)).pipe(p.custom(W.isAddress$1,"invalid eth address")),Xu=p.coerce.number().min(1).max(2).transform(BigInt).pipe(p.custom()),Ws=p.object({type:p.literal("ManagedBudget"),owner:O,authorized:p.array(O),roles:p.array(Xu)}).refine(t=>t.authorized.length===t.roles.length,"length mismatch authorized and roles"),fn=p.custom().pipe(p.string().regex(/^(event|function) .*/,{message:"signature must start with `event` or function`"}).transform(t=>{if(t.startsWith("function"))return W.pad(W.toFunctionSelector(t));if(t.startsWith("event"))return W.toEventSelector(t);throw new Error("unreachable")})),Ks=p.object({signatureType:p.nativeEnum(j.SignatureType),signature:fn,fieldIndex:p.number().nonnegative(),targetContract:O,chainid:p.number().nonnegative()}),Js=p.object({filterType:p.nativeEnum(j.FilterType),fieldType:p.nativeEnum(j.PrimitiveType),fieldIndex:p.number().nonnegative(),filterData:Yu}),Ys=p.object({signature:fn,signatureType:p.nativeEnum(j.SignatureType),actionType:p.number().optional(),targetContract:O,chainid:p.number().nonnegative(),actionParameter:Js}),Xs=p.object({type:p.literal("EventAction"),actionClaimant:Ks,actionSteps:p.array(Ys).max(4)}),Qs=p.object({type:p.literal("SignerValidator"),signers:p.array(O),validatorCaller:O}),ea=p.object({type:p.literal("SimpleDenyList"),owner:O,denied:p.array(O)}),ta=p.object({type:p.literal("SimpleAllowList"),owner:O,allowed:p.array(O)}),na=p.object({type:p.literal("AllowListIncentive"),allowList:O,limit:p.coerce.bigint()}),ra=p.object({type:p.literal("ERC20Incentive"),asset:O,shouldMintAndAllocate:p.boolean().optional().default(!1),strategy:p.nativeEnum(j.StrategyType),reward:p.coerce.bigint(),limit:p.coerce.bigint(),manager:O.optional()}),sa=p.object({type:p.literal("ERC20VariableIncentive"),asset:O,shouldMintAndAllocate:p.boolean().optional().default(!1),reward:p.coerce.bigint(),limit:p.coerce.bigint(),manager:O}),aa=p.object({criteriaType:p.nativeEnum(j.SignatureType),signature:fn,fieldIndex:p.number().nonnegative(),targetContract:O}),ia=p.object({type:p.literal("ERC20VariableCriteriaIncentive"),asset:O,shouldMintAndAllocate:p.boolean().optional().default(!1),reward:p.coerce.bigint(),limit:p.coerce.bigint(),manager:O.optional(),criteria:aa}),oa=p.object({type:p.literal("CGDAIncentive"),asset:O,shouldMintAndAllocate:p.boolean().optional().default(!1),initialReward:p.coerce.bigint(),rewardDecay:p.coerce.bigint(),rewardBoost:p.coerce.bigint(),totalBudget:p.coerce.bigint(),manager:O}),ca=p.object({type:p.literal("PointsIncentive"),venue:O,selector:fn,reward:p.coerce.bigint(),limit:p.coerce.bigint()}),ua=p.object({protocolFee:p.coerce.bigint(),maxParticipants:p.coerce.bigint(),budget:p.union([O,Ws]),action:p.union([O,Xs]),validator:p.union([O,Qs]).optional(),allowList:p.union([O,ea,ta]).optional(),incentives:p.array(p.union([na,ra,ia,sa,oa,ca]))});async function Qu({allowList:t},{core:e}){if(!t)return e.OpenAllowList();if(typeof t=="string"&&W.isAddress$1(t))return await j.allowListFromAddress({config:e._config,account:e._account},t);switch(t.type){case"SimpleAllowList":return e.SimpleAllowList(t);case"SimpleDenyList":return e.SimpleDenyList(t);default:throw new Error("unusupported AllowList: "+t)}}async function ed(t,e,n,r=zr("110")){return await e.mint(t.account.address,r),await e.approve(n.assertValidAddress(),r),await n.allocate({amount:r,asset:e.assertValidAddress(),target:t.account.address}),{budget:n,erc20:e}}function da({asset:t="0xf3B2d0E4f2d8F453DBCc278b10e88b20d7f19f8D",account:e=zc[0].account,chainId:n}){return{protocolFee:0n,maxParticipants:10n,budget:{type:"ManagedBudget",owner:e,authorized:[e],roles:[j.Roles.MANAGER]},action:{type:"EventAction",actionClaimant:{signatureType:j.SignatureType.FUNC,signature:"function mint(address to, uint256 amount)",fieldIndex:0,targetContract:wr,chainid:n},actionSteps:[{signature:"event Minted(address to, uint256 amount)",signatureType:j.SignatureType.FUNC,actionType:0,targetContract:wr,chainid:n,actionParameter:{filterType:j.FilterType.EQUAL,fieldType:j.PrimitiveType.ADDRESS,fieldIndex:0,filterData:e}}]},validator:{type:"SignerValidator",signers:[e],validatorCaller:e},allowList:{type:"SimpleDenyList",owner:e,denied:[]},incentives:[{type:"ERC20Incentive",asset:t,shouldMintAndAllocate:!1,strategy:0,reward:1n,limit:1n,manager:e}]}}exports.ActionClaimantSchema=Ks;exports.ActionStepCriteriaSchema=Js;exports.ActionStepSchema=Ys;exports.AllowListIncentiveSchema=na;exports.BaseError=m;exports.BoostSeedConfigSchema=ua;exports.CGDAIncentiveSchema=oa;exports.ERC20IncentiveSchema=ra;exports.ERC20VariableCriteriaIncentiveSchema=ia;exports.ERC20VariableIncentiveSchema=sa;exports.EventActionSchema=Xs;exports.HttpRequestError=rr;exports.IncentiveCriteriaSchema=aa;exports.InvalidAddressError=We;exports.ManagedBudgetSchema=Ws;exports.PointsIncentiveSchema=ca;exports.SignerValidatorSchema=Qs;exports.SimpleAllowListSchema=ta;exports.SimpleDenyListSchema=ea;exports.call=hr;exports.concat=Ie;exports.decodeErrorResult=Cs;exports.encodeAbiParameters=Jn;exports.getUrl=nr;exports.isAddress=ge;exports.isHex=ye;exports.makeSeed=da;exports.seed=Ku;exports.stringify=Ft;
|