@aa-sdk/core 4.0.0-alpha.1 → 4.0.0-alpha.10
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/cjs/account/smartContractAccount.d.ts +9 -3
- package/dist/cjs/account/smartContractAccount.js +11 -6
- package/dist/cjs/account/smartContractAccount.js.map +1 -1
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.js.map +1 -1
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.js.map +1 -1
- package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.js.map +1 -1
- package/dist/cjs/actions/smartAccount/estimateUserOperationGas.js.map +1 -1
- package/dist/cjs/actions/smartAccount/internal/initUserOperation.js.map +1 -1
- package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.js.map +1 -1
- package/dist/cjs/actions/smartAccount/internal/sendUserOperation.js.map +1 -1
- package/dist/cjs/actions/smartAccount/sendUserOperation.js.map +1 -1
- package/dist/cjs/client/bundlerClient.js.map +1 -1
- package/dist/cjs/client/decorators/bundlerClient.js.map +1 -1
- package/dist/cjs/client/isSmartAccountClient.js.map +1 -1
- package/dist/cjs/client/types.d.ts +2 -7
- package/dist/cjs/client/types.js.map +1 -1
- package/dist/cjs/ens/utils.d.ts +1 -1
- package/dist/cjs/ens/utils.js +3 -3
- package/dist/cjs/ens/utils.js.map +1 -1
- package/dist/cjs/errors/account.js.map +1 -1
- package/dist/cjs/errors/client.js.map +1 -1
- package/dist/cjs/errors/entrypoint.js.map +1 -1
- package/dist/cjs/errors/signer.js.map +1 -1
- package/dist/cjs/errors/transaction.js.map +1 -1
- package/dist/cjs/errors/useroperation.js.map +1 -1
- package/dist/cjs/index.d.ts +3 -6
- package/dist/cjs/index.js +38 -64
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/logger.js.map +1 -1
- package/dist/cjs/middleware/actions.js +2 -18
- package/dist/cjs/middleware/actions.js.map +1 -1
- package/dist/cjs/middleware/defaults/gasEstimator.js +4 -2
- package/dist/cjs/middleware/defaults/gasEstimator.js.map +1 -1
- package/dist/cjs/middleware/erc7677middleware.d.ts +40 -0
- package/dist/cjs/middleware/erc7677middleware.js +77 -0
- package/dist/cjs/middleware/erc7677middleware.js.map +1 -0
- package/dist/cjs/middleware/noopMiddleware.d.ts +2 -1
- package/dist/cjs/middleware/noopMiddleware.js.map +1 -1
- package/dist/cjs/middleware/types.d.ts +3 -2
- package/dist/cjs/middleware/types.js.map +1 -1
- package/dist/cjs/signer/local-account.d.ts +44 -44
- package/dist/cjs/signer/local-account.js.map +1 -1
- package/dist/cjs/signer/wallet-client.d.ts +44 -44
- package/dist/cjs/signer/wallet-client.js.map +1 -1
- package/dist/cjs/transport/split.js.map +1 -1
- package/dist/cjs/utils/bigint.js.map +1 -1
- package/dist/cjs/utils/bytes.js.map +1 -1
- package/dist/cjs/utils/defaults.d.ts +2 -4
- package/dist/cjs/utils/defaults.js +5 -45
- package/dist/cjs/utils/defaults.js.map +1 -1
- package/dist/cjs/utils/index.d.ts +0 -3
- package/dist/cjs/utils/index.js +1 -25
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/types.js.map +1 -1
- package/dist/cjs/utils/userop.js.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/account/smartContractAccount.d.ts +9 -3
- package/dist/esm/account/smartContractAccount.js +6 -1
- package/dist/esm/account/smartContractAccount.js.map +1 -1
- package/dist/esm/actions/smartAccount/buildUserOperationFromTx.js.map +1 -1
- package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.js.map +1 -1
- package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.js.map +1 -1
- package/dist/esm/actions/smartAccount/estimateUserOperationGas.js.map +1 -1
- package/dist/esm/actions/smartAccount/internal/initUserOperation.js.map +1 -1
- package/dist/esm/actions/smartAccount/internal/runMiddlewareStack.js.map +1 -1
- package/dist/esm/actions/smartAccount/internal/sendUserOperation.js.map +1 -1
- package/dist/esm/actions/smartAccount/sendUserOperation.js.map +1 -1
- package/dist/esm/client/bundlerClient.js.map +1 -1
- package/dist/esm/client/decorators/bundlerClient.js.map +1 -1
- package/dist/esm/client/isSmartAccountClient.js.map +1 -1
- package/dist/esm/client/types.d.ts +2 -7
- package/dist/esm/client/types.js.map +1 -1
- package/dist/esm/ens/utils.d.ts +1 -1
- package/dist/esm/ens/utils.js +1 -1
- package/dist/esm/ens/utils.js.map +1 -1
- package/dist/esm/errors/account.js.map +1 -1
- package/dist/esm/errors/client.js.map +1 -1
- package/dist/esm/errors/entrypoint.js.map +1 -1
- package/dist/esm/errors/signer.js.map +1 -1
- package/dist/esm/errors/transaction.js.map +1 -1
- package/dist/esm/errors/useroperation.js.map +1 -1
- package/dist/esm/index.d.ts +3 -6
- package/dist/esm/index.js +2 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/logger.js.map +1 -1
- package/dist/esm/middleware/actions.js +3 -18
- package/dist/esm/middleware/actions.js.map +1 -1
- package/dist/esm/middleware/defaults/gasEstimator.js +4 -2
- package/dist/esm/middleware/defaults/gasEstimator.js.map +1 -1
- package/dist/esm/middleware/erc7677middleware.d.ts +40 -0
- package/dist/esm/middleware/erc7677middleware.js +73 -0
- package/dist/esm/middleware/erc7677middleware.js.map +1 -0
- package/dist/esm/middleware/noopMiddleware.d.ts +2 -1
- package/dist/esm/middleware/noopMiddleware.js.map +1 -1
- package/dist/esm/middleware/types.d.ts +3 -2
- package/dist/esm/middleware/types.js.map +1 -1
- package/dist/esm/signer/local-account.d.ts +44 -44
- package/dist/esm/signer/local-account.js.map +1 -1
- package/dist/esm/signer/wallet-client.d.ts +44 -44
- package/dist/esm/signer/wallet-client.js.map +1 -1
- package/dist/esm/transport/split.js.map +1 -1
- package/dist/esm/utils/bigint.js.map +1 -1
- package/dist/esm/utils/bytes.js.map +1 -1
- package/dist/esm/utils/defaults.d.ts +2 -4
- package/dist/esm/utils/defaults.js +1 -40
- package/dist/esm/utils/defaults.js.map +1 -1
- package/dist/esm/utils/index.d.ts +0 -3
- package/dist/esm/utils/index.js +0 -11
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/types.js.map +1 -1
- package/dist/esm/utils/userop.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/account/smartContractAccount.d.ts +17 -11
- package/dist/types/account/smartContractAccount.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/buildUserOperationFromTx.d.ts +33 -33
- package/dist/types/actions/smartAccount/buildUserOperationFromTxs.d.ts +43 -59
- package/dist/types/actions/smartAccount/buildUserOperationFromTxs.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/checkGasSponsorshipEligibility.d.ts +18 -18
- package/dist/types/actions/smartAccount/estimateUserOperationGas.d.ts +3 -3
- package/dist/types/actions/smartAccount/internal/initUserOperation.d.ts +3 -4
- package/dist/types/actions/smartAccount/internal/initUserOperation.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/internal/runMiddlewareStack.d.ts +0 -14
- package/dist/types/actions/smartAccount/internal/runMiddlewareStack.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/internal/sendUserOperation.d.ts +0 -7
- package/dist/types/actions/smartAccount/internal/sendUserOperation.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/sendUserOperation.d.ts +17 -3
- package/dist/types/actions/smartAccount/sendUserOperation.d.ts.map +1 -1
- package/dist/types/client/bundlerClient.d.ts +2 -2
- package/dist/types/client/decorators/bundlerClient.d.ts +8 -8
- package/dist/types/client/isSmartAccountClient.d.ts +4 -4
- package/dist/types/client/types.d.ts +2 -7
- package/dist/types/client/types.d.ts.map +1 -1
- package/dist/types/ens/utils.d.ts +1 -1
- package/dist/types/ens/utils.d.ts.map +1 -1
- package/dist/types/errors/account.d.ts +53 -4
- package/dist/types/errors/account.d.ts.map +1 -1
- package/dist/types/errors/client.d.ts +15 -0
- package/dist/types/errors/client.d.ts.map +1 -1
- package/dist/types/errors/entrypoint.d.ts +12 -0
- package/dist/types/errors/entrypoint.d.ts.map +1 -1
- package/dist/types/errors/signer.d.ts +5 -0
- package/dist/types/errors/signer.d.ts.map +1 -1
- package/dist/types/errors/transaction.d.ts +8 -1
- package/dist/types/errors/transaction.d.ts.map +1 -1
- package/dist/types/errors/useroperation.d.ts +5 -5
- package/dist/types/errors/useroperation.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -6
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/logger.d.ts +88 -0
- package/dist/types/logger.d.ts.map +1 -1
- package/dist/types/middleware/actions.d.ts +3 -3
- package/dist/types/middleware/actions.d.ts.map +1 -1
- package/dist/types/middleware/defaults/gasEstimator.d.ts +2 -2
- package/dist/types/middleware/defaults/gasEstimator.d.ts.map +1 -1
- package/dist/types/middleware/erc7677middleware.d.ts +62 -0
- package/dist/types/middleware/erc7677middleware.d.ts.map +1 -0
- package/dist/types/middleware/noopMiddleware.d.ts +4 -4
- package/dist/types/middleware/noopMiddleware.d.ts.map +1 -1
- package/dist/types/middleware/types.d.ts +3 -2
- package/dist/types/middleware/types.d.ts.map +1 -1
- package/dist/types/signer/local-account.d.ts +137 -45
- package/dist/types/signer/local-account.d.ts.map +1 -1
- package/dist/types/signer/wallet-client.d.ts +133 -44
- package/dist/types/signer/wallet-client.d.ts.map +1 -1
- package/dist/types/transport/split.d.ts +2 -2
- package/dist/types/utils/bigint.d.ts +14 -14
- package/dist/types/utils/bigint.d.ts.map +1 -1
- package/dist/types/utils/bytes.d.ts +5 -5
- package/dist/types/utils/defaults.d.ts +2 -12
- package/dist/types/utils/defaults.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +12 -22
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/types.d.ts +2 -2
- package/dist/types/utils/userop.d.ts +33 -33
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/account/smartContractAccount.ts +19 -13
- package/src/actions/smartAccount/buildUserOperationFromTx.ts +35 -35
- package/src/actions/smartAccount/buildUserOperationFromTxs.ts +44 -60
- package/src/actions/smartAccount/checkGasSponsorshipEligibility.ts +19 -19
- package/src/actions/smartAccount/estimateUserOperationGas.ts +3 -3
- package/src/actions/smartAccount/internal/initUserOperation.ts +3 -4
- package/src/actions/smartAccount/internal/runMiddlewareStack.ts +0 -22
- package/src/actions/smartAccount/internal/sendUserOperation.ts +0 -7
- package/src/actions/smartAccount/sendUserOperation.ts +17 -3
- package/src/client/bundlerClient.ts +2 -2
- package/src/client/decorators/bundlerClient.ts +8 -8
- package/src/client/isSmartAccountClient.ts +4 -4
- package/src/client/types.ts +2 -15
- package/src/ens/utils.ts +1 -2
- package/src/errors/account.ts +64 -4
- package/src/errors/client.ts +18 -0
- package/src/errors/entrypoint.ts +12 -0
- package/src/errors/signer.ts +6 -0
- package/src/errors/transaction.ts +10 -1
- package/src/errors/useroperation.ts +5 -6
- package/src/index.ts +2 -31
- package/src/logger.ts +88 -0
- package/src/middleware/actions.ts +6 -27
- package/src/middleware/defaults/gasEstimator.ts +9 -5
- package/src/middleware/erc7677middleware.ts +201 -0
- package/src/middleware/noopMiddleware.ts +6 -4
- package/src/middleware/types.ts +16 -7
- package/src/signer/local-account.ts +94 -2
- package/src/signer/wallet-client.ts +89 -0
- package/src/transport/split.ts +2 -2
- package/src/utils/bigint.ts +15 -15
- package/src/utils/bytes.ts +5 -5
- package/src/utils/defaults.ts +3 -76
- package/src/utils/index.ts +12 -35
- package/src/utils/types.ts +2 -2
- package/src/utils/userop.ts +33 -33
- package/src/version.ts +1 -1
- package/dist/cjs/account/base.d.ts +0 -49
- package/dist/cjs/account/base.js +0 -257
- package/dist/cjs/account/base.js.map +0 -1
- package/dist/cjs/account/schema.d.ts +0 -100
- package/dist/cjs/account/schema.js +0 -43
- package/dist/cjs/account/schema.js.map +0 -1
- package/dist/cjs/account/simple.d.ts +0 -14
- package/dist/cjs/account/simple.js +0 -119
- package/dist/cjs/account/simple.js.map +0 -1
- package/dist/cjs/account/types.d.ts +0 -30
- package/dist/cjs/account/types.js +0 -3
- package/dist/cjs/account/types.js.map +0 -1
- package/dist/cjs/chains/index.d.ts +0 -20
- package/dist/cjs/chains/index.js +0 -169
- package/dist/cjs/chains/index.js.map +0 -1
- package/dist/esm/account/base.d.ts +0 -49
- package/dist/esm/account/base.js +0 -253
- package/dist/esm/account/base.js.map +0 -1
- package/dist/esm/account/schema.d.ts +0 -100
- package/dist/esm/account/schema.js +0 -35
- package/dist/esm/account/schema.js.map +0 -1
- package/dist/esm/account/simple.d.ts +0 -14
- package/dist/esm/account/simple.js +0 -115
- package/dist/esm/account/simple.js.map +0 -1
- package/dist/esm/account/types.d.ts +0 -30
- package/dist/esm/account/types.js +0 -2
- package/dist/esm/account/types.js.map +0 -1
- package/dist/esm/chains/index.d.ts +0 -20
- package/dist/esm/chains/index.js +0 -166
- package/dist/esm/chains/index.js.map +0 -1
- package/dist/types/account/base.d.ts +0 -128
- package/dist/types/account/base.d.ts.map +0 -1
- package/dist/types/account/schema.d.ts +0 -101
- package/dist/types/account/schema.d.ts.map +0 -1
- package/dist/types/account/simple.d.ts +0 -15
- package/dist/types/account/simple.d.ts.map +0 -1
- package/dist/types/account/types.d.ts +0 -144
- package/dist/types/account/types.d.ts.map +0 -1
- package/dist/types/chains/index.d.ts +0 -21
- package/dist/types/chains/index.d.ts.map +0 -1
- package/src/account/base.ts +0 -415
- package/src/account/schema.ts +0 -51
- package/src/account/simple.ts +0 -221
- package/src/account/types.ts +0 -184
- package/src/chains/index.ts +0 -194
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { type Transport } from "viem";
|
|
2
|
-
import z from "zod";
|
|
3
|
-
import type { SmartAccountSigner } from "../signer/types.js";
|
|
4
|
-
export declare const createBaseSmartAccountParamsSchema: <TTransport extends Transport = Transport, TSigner extends SmartAccountSigner<any> = SmartAccountSigner<any>>() => z.ZodObject<{
|
|
5
|
-
rpcClient: z.ZodUnion<[z.ZodString, z.ZodType<import("../index.js").BundlerClient<TTransport>, z.ZodTypeDef, import("../index.js").BundlerClient<TTransport>>]>;
|
|
6
|
-
factoryAddress: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
7
|
-
signer: z.ZodType<TSigner, z.ZodTypeDef, TSigner>;
|
|
8
|
-
entryPointAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
9
|
-
chain: z.ZodType<import("viem").Chain, z.ZodTypeDef, import("viem").Chain>;
|
|
10
|
-
accountAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
11
|
-
initCode: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
12
|
-
entryPointVersion: z.ZodOptional<z.ZodType<keyof import("../entrypoint/types.js").EntryPointRegistryBase<unknown>, z.ZodTypeDef, keyof import("../entrypoint/types.js").EntryPointRegistryBase<unknown>>>;
|
|
13
|
-
}, "strip", z.ZodTypeAny, { [k_1 in keyof z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
14
|
-
rpcClient: z.ZodUnion<[z.ZodString, z.ZodType<import("../index.js").BundlerClient<TTransport>, z.ZodTypeDef, import("../index.js").BundlerClient<TTransport>>]>;
|
|
15
|
-
factoryAddress: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
16
|
-
signer: z.ZodType<TSigner, z.ZodTypeDef, TSigner>;
|
|
17
|
-
entryPointAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
18
|
-
chain: z.ZodType<import("viem").Chain, z.ZodTypeDef, import("viem").Chain>;
|
|
19
|
-
accountAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
20
|
-
initCode: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
21
|
-
entryPointVersion: z.ZodOptional<z.ZodType<keyof import("../entrypoint/types.js").EntryPointRegistryBase<unknown>, z.ZodTypeDef, keyof import("../entrypoint/types.js").EntryPointRegistryBase<unknown>>>;
|
|
22
|
-
}>, "chain" | "factoryAddress" | "rpcClient" | (undefined extends TSigner ? never : "signer")>]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
23
|
-
rpcClient: z.ZodUnion<[z.ZodString, z.ZodType<import("../index.js").BundlerClient<TTransport>, z.ZodTypeDef, import("../index.js").BundlerClient<TTransport>>]>;
|
|
24
|
-
factoryAddress: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
25
|
-
signer: z.ZodType<TSigner, z.ZodTypeDef, TSigner>;
|
|
26
|
-
entryPointAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
27
|
-
chain: z.ZodType<import("viem").Chain, z.ZodTypeDef, import("viem").Chain>;
|
|
28
|
-
accountAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
29
|
-
initCode: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
30
|
-
entryPointVersion: z.ZodOptional<z.ZodType<keyof import("../entrypoint/types.js").EntryPointRegistryBase<unknown>, z.ZodTypeDef, keyof import("../entrypoint/types.js").EntryPointRegistryBase<unknown>>>;
|
|
31
|
-
}>, "chain" | "factoryAddress" | "rpcClient" | (undefined extends TSigner ? never : "signer")>[k_1]; }, { [k_2 in keyof z.baseObjectInputType<{
|
|
32
|
-
rpcClient: z.ZodUnion<[z.ZodString, z.ZodType<import("../index.js").BundlerClient<TTransport>, z.ZodTypeDef, import("../index.js").BundlerClient<TTransport>>]>;
|
|
33
|
-
factoryAddress: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
34
|
-
signer: z.ZodType<TSigner, z.ZodTypeDef, TSigner>;
|
|
35
|
-
entryPointAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
36
|
-
chain: z.ZodType<import("viem").Chain, z.ZodTypeDef, import("viem").Chain>;
|
|
37
|
-
accountAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
38
|
-
initCode: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
39
|
-
entryPointVersion: z.ZodOptional<z.ZodType<keyof import("../entrypoint/types.js").EntryPointRegistryBase<unknown>, z.ZodTypeDef, keyof import("../entrypoint/types.js").EntryPointRegistryBase<unknown>>>;
|
|
40
|
-
}>]: z.baseObjectInputType<{
|
|
41
|
-
rpcClient: z.ZodUnion<[z.ZodString, z.ZodType<import("../index.js").BundlerClient<TTransport>, z.ZodTypeDef, import("../index.js").BundlerClient<TTransport>>]>;
|
|
42
|
-
factoryAddress: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
43
|
-
signer: z.ZodType<TSigner, z.ZodTypeDef, TSigner>;
|
|
44
|
-
entryPointAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
45
|
-
chain: z.ZodType<import("viem").Chain, z.ZodTypeDef, import("viem").Chain>;
|
|
46
|
-
accountAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
47
|
-
initCode: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
48
|
-
entryPointVersion: z.ZodOptional<z.ZodType<keyof import("../entrypoint/types.js").EntryPointRegistryBase<unknown>, z.ZodTypeDef, keyof import("../entrypoint/types.js").EntryPointRegistryBase<unknown>>>;
|
|
49
|
-
}>[k_2]; }>;
|
|
50
|
-
export declare const SimpleSmartAccountParamsSchema: <TTransport extends Transport = Transport, TSigner extends SmartAccountSigner<any> = SmartAccountSigner<any>>() => z.ZodObject<{
|
|
51
|
-
initCode: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
52
|
-
chain: z.ZodType<import("viem").Chain, z.ZodTypeDef, import("viem").Chain>;
|
|
53
|
-
factoryAddress: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
54
|
-
signer: z.ZodType<TSigner, z.ZodTypeDef, TSigner>;
|
|
55
|
-
entryPointAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
56
|
-
accountAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
57
|
-
entryPointVersion: z.ZodOptional<z.ZodType<keyof import("../entrypoint/types.js").EntryPointRegistryBase<unknown>, z.ZodTypeDef, keyof import("../entrypoint/types.js").EntryPointRegistryBase<unknown>>>;
|
|
58
|
-
transport: z.ZodType<TTransport, z.ZodTypeDef, TTransport>;
|
|
59
|
-
salt: z.ZodOptional<z.ZodBigInt>;
|
|
60
|
-
}, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
61
|
-
initCode: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
62
|
-
chain: z.ZodType<import("viem").Chain, z.ZodTypeDef, import("viem").Chain>;
|
|
63
|
-
factoryAddress: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
64
|
-
signer: z.ZodType<TSigner, z.ZodTypeDef, TSigner>;
|
|
65
|
-
entryPointAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
66
|
-
accountAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
67
|
-
entryPointVersion: z.ZodOptional<z.ZodType<keyof import("../entrypoint/types.js").EntryPointRegistryBase<unknown>, z.ZodTypeDef, keyof import("../entrypoint/types.js").EntryPointRegistryBase<unknown>>>;
|
|
68
|
-
transport: z.ZodType<TTransport, z.ZodTypeDef, TTransport>;
|
|
69
|
-
salt: z.ZodOptional<z.ZodBigInt>;
|
|
70
|
-
}>, "chain" | "factoryAddress" | (undefined extends TTransport ? never : "transport") | (undefined extends TSigner ? never : "signer")> extends infer T ? { [k in keyof T]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
71
|
-
initCode: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
72
|
-
chain: z.ZodType<import("viem").Chain, z.ZodTypeDef, import("viem").Chain>;
|
|
73
|
-
factoryAddress: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
74
|
-
signer: z.ZodType<TSigner, z.ZodTypeDef, TSigner>;
|
|
75
|
-
entryPointAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
76
|
-
accountAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
77
|
-
entryPointVersion: z.ZodOptional<z.ZodType<keyof import("../entrypoint/types.js").EntryPointRegistryBase<unknown>, z.ZodTypeDef, keyof import("../entrypoint/types.js").EntryPointRegistryBase<unknown>>>;
|
|
78
|
-
transport: z.ZodType<TTransport, z.ZodTypeDef, TTransport>;
|
|
79
|
-
salt: z.ZodOptional<z.ZodBigInt>;
|
|
80
|
-
}>, "chain" | "factoryAddress" | (undefined extends TTransport ? never : "transport") | (undefined extends TSigner ? never : "signer")>[k]; } : never, z.baseObjectInputType<{
|
|
81
|
-
initCode: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
82
|
-
chain: z.ZodType<import("viem").Chain, z.ZodTypeDef, import("viem").Chain>;
|
|
83
|
-
factoryAddress: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
84
|
-
signer: z.ZodType<TSigner, z.ZodTypeDef, TSigner>;
|
|
85
|
-
entryPointAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
86
|
-
accountAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
87
|
-
entryPointVersion: z.ZodOptional<z.ZodType<keyof import("../entrypoint/types.js").EntryPointRegistryBase<unknown>, z.ZodTypeDef, keyof import("../entrypoint/types.js").EntryPointRegistryBase<unknown>>>;
|
|
88
|
-
transport: z.ZodType<TTransport, z.ZodTypeDef, TTransport>;
|
|
89
|
-
salt: z.ZodOptional<z.ZodBigInt>;
|
|
90
|
-
}> extends infer T_1 ? { [k_1 in keyof T_1]: z.baseObjectInputType<{
|
|
91
|
-
initCode: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
92
|
-
chain: z.ZodType<import("viem").Chain, z.ZodTypeDef, import("viem").Chain>;
|
|
93
|
-
factoryAddress: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
94
|
-
signer: z.ZodType<TSigner, z.ZodTypeDef, TSigner>;
|
|
95
|
-
entryPointAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
96
|
-
accountAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
97
|
-
entryPointVersion: z.ZodOptional<z.ZodType<keyof import("../entrypoint/types.js").EntryPointRegistryBase<unknown>, z.ZodTypeDef, keyof import("../entrypoint/types.js").EntryPointRegistryBase<unknown>>>;
|
|
98
|
-
transport: z.ZodType<TTransport, z.ZodTypeDef, TTransport>;
|
|
99
|
-
salt: z.ZodOptional<z.ZodBigInt>;
|
|
100
|
-
}>[k_1]; } : never>;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Address } from "abitype/zod";
|
|
2
|
-
import { isHex } from "viem";
|
|
3
|
-
import z from "zod";
|
|
4
|
-
import { createPublicErc4337ClientSchema } from "../client/schema.js";
|
|
5
|
-
import { isEntryPointVersion } from "../entrypoint/index.js";
|
|
6
|
-
import { isSigner } from "../signer/schema.js";
|
|
7
|
-
import { ChainSchema } from "../utils/index.js";
|
|
8
|
-
export const createBaseSmartAccountParamsSchema = () => z.object({
|
|
9
|
-
rpcClient: z.union([
|
|
10
|
-
z.string(),
|
|
11
|
-
createPublicErc4337ClientSchema(),
|
|
12
|
-
]),
|
|
13
|
-
factoryAddress: Address,
|
|
14
|
-
signer: z.custom(isSigner),
|
|
15
|
-
entryPointAddress: Address.optional(),
|
|
16
|
-
chain: ChainSchema,
|
|
17
|
-
accountAddress: Address.optional().describe("Optional override for the account address."),
|
|
18
|
-
initCode: z
|
|
19
|
-
.string()
|
|
20
|
-
.refine((x) => isHex(x, { strict: true }), "initCode must be a valid hex.")
|
|
21
|
-
.optional()
|
|
22
|
-
.describe("Optional override for the account init code."),
|
|
23
|
-
entryPointVersion: z
|
|
24
|
-
.custom(isEntryPointVersion)
|
|
25
|
-
.optional(),
|
|
26
|
-
});
|
|
27
|
-
export const SimpleSmartAccountParamsSchema = () => createBaseSmartAccountParamsSchema()
|
|
28
|
-
.omit({
|
|
29
|
-
rpcClient: true,
|
|
30
|
-
})
|
|
31
|
-
.extend({
|
|
32
|
-
transport: z.custom(),
|
|
33
|
-
salt: z.bigint().optional(),
|
|
34
|
-
});
|
|
35
|
-
//# sourceMappingURL=schema.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/account/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,KAAK,EAAkB,MAAM,MAAM,CAAC;AAC7C,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,CAAC,MAAM,kCAAkC,GAAG,GAG9C,EAAE,CACJ,CAAC,CAAC,MAAM,CAAC;IACP,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC;QACjB,CAAC,CAAC,MAAM,EAAE;QACV,+BAA+B,EAAc;KAC9C,CAAC;IACF,cAAc,EAAE,OAAO;IACvB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAU,QAAQ,CAAC;IACnC,iBAAiB,EAAE,OAAO,CAAC,QAAQ,EAAE;IACrC,KAAK,EAAE,WAAW;IAClB,cAAc,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,QAAQ,CACzC,4CAA4C,CAC7C;IACD,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,MAAM,CACL,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EACjC,+BAA+B,CAChC;SACA,QAAQ,EAAE;SACV,QAAQ,CAAC,8CAA8C,CAAC;IAC3D,iBAAiB,EAAE,CAAC;SACjB,MAAM,CAAoB,mBAAmB,CAAC;SAC9C,QAAQ,EAAE;CACd,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAG1C,EAAE,CACJ,kCAAkC,EAAuB;KACtD,IAAI,CAAC;IACJ,SAAS,EAAE,IAAI;CAChB,CAAC;KACD,MAAM,CAAC;IACN,SAAS,EAAE,CAAC,CAAC,MAAM,EAAc;IACjC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAC","sourcesContent":["import { Address } from \"abitype/zod\";\nimport { isHex, type Transport } from \"viem\";\nimport z from \"zod\";\nimport { createPublicErc4337ClientSchema } from \"../client/schema.js\";\nimport { isEntryPointVersion } from \"../entrypoint/index.js\";\nimport type { EntryPointVersion } from \"../entrypoint/types.js\";\nimport { isSigner } from \"../signer/schema.js\";\nimport type { SmartAccountSigner } from \"../signer/types.js\";\nimport { ChainSchema } from \"../utils/index.js\";\n\nexport const createBaseSmartAccountParamsSchema = <\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>() =>\n z.object({\n rpcClient: z.union([\n z.string(),\n createPublicErc4337ClientSchema<TTransport>(),\n ]),\n factoryAddress: Address,\n signer: z.custom<TSigner>(isSigner),\n entryPointAddress: Address.optional(),\n chain: ChainSchema,\n accountAddress: Address.optional().describe(\n \"Optional override for the account address.\"\n ),\n initCode: z\n .string()\n .refine(\n (x) => isHex(x, { strict: true }),\n \"initCode must be a valid hex.\"\n )\n .optional()\n .describe(\"Optional override for the account init code.\"),\n entryPointVersion: z\n .custom<EntryPointVersion>(isEntryPointVersion)\n .optional(),\n });\n\nexport const SimpleSmartAccountParamsSchema = <\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>() =>\n createBaseSmartAccountParamsSchema<TTransport, TSigner>()\n .omit({\n rpcClient: true,\n })\n .extend({\n transport: z.custom<TTransport>(),\n salt: z.bigint().optional(),\n });\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Address } from "abitype";
|
|
2
|
-
import { type Chain, type Hex, type Transport } from "viem";
|
|
3
|
-
import type { DefaultEntryPointVersion, EntryPointParameter, EntryPointVersion } from "../entrypoint/types.js";
|
|
4
|
-
import type { SmartAccountSigner } from "../signer/types.js";
|
|
5
|
-
import { type SmartContractAccountWithSigner, type ToSmartContractAccountParams } from "./smartContractAccount.js";
|
|
6
|
-
export type SimpleSmartAccount<TSigner extends SmartAccountSigner = SmartAccountSigner, TEntryPointVersion extends EntryPointVersion = EntryPointVersion> = SmartContractAccountWithSigner<"SimpleAccount", TSigner, TEntryPointVersion>;
|
|
7
|
-
export type CreateSimpleAccountParams<TTransport extends Transport = Transport, TSigner extends SmartAccountSigner = SmartAccountSigner, TEntryPointVersion extends EntryPointVersion = DefaultEntryPointVersion> = Pick<ToSmartContractAccountParams<"SimpleAccount", TTransport, Chain, TEntryPointVersion>, "chain" | "transport"> & {
|
|
8
|
-
signer: TSigner;
|
|
9
|
-
salt?: bigint;
|
|
10
|
-
accountAddress?: Address;
|
|
11
|
-
factoryAddress?: Address;
|
|
12
|
-
initCode?: Hex;
|
|
13
|
-
} & EntryPointParameter<TEntryPointVersion, Chain>;
|
|
14
|
-
export declare function createSimpleSmartAccount<TTransport extends Transport = Transport, TSigner extends SmartAccountSigner = SmartAccountSigner, TEntryPointVersion extends EntryPointVersion = DefaultEntryPointVersion>(config: CreateSimpleAccountParams<TTransport, TSigner, TEntryPointVersion>): Promise<SimpleSmartAccount<TSigner, TEntryPointVersion>>;
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { concatHex, encodeFunctionData, isHex, } from "viem";
|
|
2
|
-
import { SimpleAccountAbi_v6 } from "../abis/SimpleAccountAbi_v6.js";
|
|
3
|
-
import { SimpleAccountAbi_v7 } from "../abis/SimpleAccountAbi_v7.js";
|
|
4
|
-
import { SimpleAccountFactoryAbi } from "../abis/SimpleAccountFactoryAbi.js";
|
|
5
|
-
import { createBundlerClient } from "../client/bundlerClient.js";
|
|
6
|
-
import { defaultEntryPointVersion, getEntryPoint, } from "../entrypoint/index.js";
|
|
7
|
-
import { AccountRequiresOwnerError } from "../errors/account.js";
|
|
8
|
-
import { getDefaultSimpleAccountFactoryAddress } from "../utils/defaults.js";
|
|
9
|
-
import { BaseSmartContractAccount } from "./base.js";
|
|
10
|
-
import { SimpleSmartAccountParamsSchema } from "./schema.js";
|
|
11
|
-
import { toSmartContractAccount, } from "./smartContractAccount.js";
|
|
12
|
-
class SimpleSmartContractAccount extends BaseSmartContractAccount {
|
|
13
|
-
constructor(params) {
|
|
14
|
-
SimpleSmartAccountParamsSchema().parse(params);
|
|
15
|
-
const client = createBundlerClient({
|
|
16
|
-
transport: params.transport,
|
|
17
|
-
chain: params.chain,
|
|
18
|
-
});
|
|
19
|
-
super({ ...params, rpcClient: client });
|
|
20
|
-
Object.defineProperty(this, "index", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
configurable: true,
|
|
23
|
-
writable: true,
|
|
24
|
-
value: void 0
|
|
25
|
-
});
|
|
26
|
-
Object.defineProperty(this, "entryPointVersion", {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
configurable: true,
|
|
29
|
-
writable: true,
|
|
30
|
-
value: void 0
|
|
31
|
-
});
|
|
32
|
-
this.signer = params.signer;
|
|
33
|
-
this.index = params.salt ?? 0n;
|
|
34
|
-
this.entryPointVersion =
|
|
35
|
-
params.entryPointVersion ?? defaultEntryPointVersion;
|
|
36
|
-
}
|
|
37
|
-
getDummySignature() {
|
|
38
|
-
return "0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c";
|
|
39
|
-
}
|
|
40
|
-
async encodeExecute(target, value, data) {
|
|
41
|
-
return encodeFunctionData({
|
|
42
|
-
abi: this.entryPointVersion === "0.6.0"
|
|
43
|
-
? SimpleAccountAbi_v6
|
|
44
|
-
: SimpleAccountAbi_v7,
|
|
45
|
-
functionName: "execute",
|
|
46
|
-
args: [target, value, data],
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
async encodeBatchExecute(txs) {
|
|
50
|
-
const [targets, datas] = txs.reduce((accum, curr) => {
|
|
51
|
-
accum[0].push(curr.target);
|
|
52
|
-
accum[1].push(curr.data);
|
|
53
|
-
return accum;
|
|
54
|
-
}, [[], []]);
|
|
55
|
-
return encodeFunctionData({
|
|
56
|
-
abi: this.entryPointVersion === "0.6.0"
|
|
57
|
-
? SimpleAccountAbi_v6
|
|
58
|
-
: SimpleAccountAbi_v7,
|
|
59
|
-
functionName: "executeBatch",
|
|
60
|
-
args: [targets, datas],
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
signMessage(msg) {
|
|
64
|
-
return this.signer.signMessage(typeof msg === "string" && !isHex(msg) ? msg : { raw: msg });
|
|
65
|
-
}
|
|
66
|
-
async getAccountInitCode() {
|
|
67
|
-
return concatHex([
|
|
68
|
-
this.factoryAddress,
|
|
69
|
-
encodeFunctionData({
|
|
70
|
-
abi: SimpleAccountFactoryAbi,
|
|
71
|
-
functionName: "createAccount",
|
|
72
|
-
args: [await this.signer.getAddress(), this.index],
|
|
73
|
-
}),
|
|
74
|
-
]);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
export async function createSimpleSmartAccount({ chain, entryPoint = getEntryPoint(chain), factoryAddress = getDefaultSimpleAccountFactoryAddress(chain, entryPoint.version), ...params }) {
|
|
78
|
-
if (!params.signer)
|
|
79
|
-
throw new AccountRequiresOwnerError("SimpleAccount");
|
|
80
|
-
const simpleAccount = new SimpleSmartContractAccount(SimpleSmartAccountParamsSchema().parse({
|
|
81
|
-
chain,
|
|
82
|
-
entryPointAddress: entryPoint.address,
|
|
83
|
-
factoryAddress,
|
|
84
|
-
...params,
|
|
85
|
-
}));
|
|
86
|
-
const parsedParams = SimpleSmartAccountParamsSchema().parse({
|
|
87
|
-
chain,
|
|
88
|
-
entryPointAddress: entryPoint.address,
|
|
89
|
-
entryPointVersion: entryPoint.version,
|
|
90
|
-
factoryAddress,
|
|
91
|
-
...params,
|
|
92
|
-
});
|
|
93
|
-
const base = await toSmartContractAccount({
|
|
94
|
-
source: "SimpleAccount",
|
|
95
|
-
transport: params.transport,
|
|
96
|
-
chain,
|
|
97
|
-
encodeBatchExecute: simpleAccount.encodeBatchExecute.bind(simpleAccount),
|
|
98
|
-
encodeExecute: (tx) => simpleAccount.encodeExecute.bind(simpleAccount)(tx.target, tx.value ?? 0n, tx.data),
|
|
99
|
-
entryPoint,
|
|
100
|
-
getAccountInitCode: async () => {
|
|
101
|
-
if (parsedParams.initCode)
|
|
102
|
-
return parsedParams.initCode;
|
|
103
|
-
return simpleAccount.getAccountInitCode();
|
|
104
|
-
},
|
|
105
|
-
getDummySignature: simpleAccount.getDummySignature.bind(simpleAccount),
|
|
106
|
-
signMessage: ({ message }) => simpleAccount.signMessage(typeof message === "string" ? message : message.raw),
|
|
107
|
-
signTypedData: simpleAccount.signTypedData.bind(simpleAccount),
|
|
108
|
-
accountAddress: parsedParams.accountAddress,
|
|
109
|
-
});
|
|
110
|
-
return {
|
|
111
|
-
...base,
|
|
112
|
-
getSigner: () => simpleAccount.getSigner(),
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
//# sourceMappingURL=simple.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"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T,EAAE,CAAC,KAAK,IAAI,EAAE,EACd,EAAE,CAAC,IAAI,CACR;QACH,UAAU;QACV,kBAAkB,EAAE,KAAK,IAAI,EAAE;YAC7B,IAAI,YAAY,CAAC,QAAQ;gBAAE,OAAO,YAAY,CAAC,QAAe,CAAC;YAC/D,OAAO,aAAa,CAAC,kBAAkB,EAAE,CAAC;QAC5C,CAAC;QACD,iBAAiB,EAAE,aAAa,CAAC,iBAAiB,CAAC,IAAI,CAAC,aAAa,CAAC;QACtE,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAC3B,aAAa,CAAC,WAAW,CACvB,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CACpD;QAEH,aAAa,EAAE,aAAa,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC;QAC9D,cAAc,EAAE,YAAY,CAAC,cAAc;KAC5C,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,IAAI;QACP,SAAS,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE;KAC3C,CAAC;AACJ,CAAC","sourcesContent":["import type { Address } from \"abitype\";\nimport {\n concatHex,\n encodeFunctionData,\n isHex,\n type Chain,\n type FallbackTransport,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { SimpleAccountAbi_v6 } from \"../abis/SimpleAccountAbi_v6.js\";\nimport { SimpleAccountAbi_v7 } from \"../abis/SimpleAccountAbi_v7.js\";\nimport { SimpleAccountFactoryAbi } from \"../abis/SimpleAccountFactoryAbi.js\";\nimport { createBundlerClient } from \"../client/bundlerClient.js\";\nimport {\n defaultEntryPointVersion,\n getEntryPoint,\n} from \"../entrypoint/index.js\";\nimport type {\n DefaultEntryPointVersion,\n EntryPointParameter,\n EntryPointVersion,\n} from \"../entrypoint/types.js\";\nimport { AccountRequiresOwnerError } from \"../errors/account.js\";\nimport type { SmartAccountSigner } from \"../signer/types.js\";\nimport type { BatchUserOperationCallData } from \"../types.js\";\nimport { getDefaultSimpleAccountFactoryAddress } from \"../utils/defaults.js\";\nimport { BaseSmartContractAccount } from \"./base.js\";\nimport { SimpleSmartAccountParamsSchema } from \"./schema.js\";\nimport {\n toSmartContractAccount,\n type SmartContractAccountWithSigner,\n type ToSmartContractAccountParams,\n} from \"./smartContractAccount.js\";\nimport type { SimpleSmartAccountParams } from \"./types.js\";\n\nclass SimpleSmartContractAccount<\n TTransport extends Transport | FallbackTransport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> extends BaseSmartContractAccount<TTransport, TSigner> {\n protected index: bigint;\n protected entryPointVersion: EntryPointVersion;\n\n constructor(params: SimpleSmartAccountParams<TTransport, TSigner>) {\n SimpleSmartAccountParamsSchema().parse(params);\n\n // This is a hack for now, we should kill the SimpleSmart Account when we kill Base Account\n const client = createBundlerClient({\n transport: params.transport as TTransport,\n chain: params.chain,\n });\n\n // @ts-expect-error zod custom type not recognized as required params for signers\n super({ ...params, rpcClient: client });\n this.signer = params.signer as TSigner;\n this.index = params.salt ?? 0n;\n this.entryPointVersion =\n params.entryPointVersion ?? defaultEntryPointVersion;\n }\n\n getDummySignature(): `0x${string}` {\n return \"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c\";\n }\n\n async encodeExecute(\n target: Hex,\n value: bigint,\n data: Hex\n ): Promise<`0x${string}`> {\n return encodeFunctionData({\n abi:\n this.entryPointVersion === \"0.6.0\"\n ? SimpleAccountAbi_v6\n : SimpleAccountAbi_v7,\n functionName: \"execute\",\n args: [target, value, data],\n });\n }\n\n override async encodeBatchExecute(\n txs: BatchUserOperationCallData\n ): Promise<`0x${string}`> {\n const [targets, datas] = txs.reduce(\n (accum, curr) => {\n accum[0].push(curr.target);\n accum[1].push(curr.data);\n\n return accum;\n },\n [[], []] as [Address[], Hex[]]\n );\n\n return encodeFunctionData({\n abi:\n this.entryPointVersion === \"0.6.0\"\n ? SimpleAccountAbi_v6\n : SimpleAccountAbi_v7,\n functionName: \"executeBatch\",\n args: [targets, datas],\n });\n }\n\n signMessage(msg: Uint8Array | string): Promise<`0x${string}`> {\n return this.signer.signMessage(\n typeof msg === \"string\" && !isHex(msg) ? msg : { raw: msg }\n );\n }\n\n public async getAccountInitCode(): Promise<`0x${string}`> {\n return concatHex([\n this.factoryAddress,\n encodeFunctionData({\n abi: SimpleAccountFactoryAbi,\n functionName: \"createAccount\",\n args: [await this.signer.getAddress(), this.index],\n }),\n ]);\n }\n}\n\nexport type SimpleSmartAccount<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = SmartContractAccountWithSigner<\n \"SimpleAccount\",\n TSigner,\n TEntryPointVersion\n>;\n\nexport type CreateSimpleAccountParams<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TEntryPointVersion extends EntryPointVersion = DefaultEntryPointVersion\n> = Pick<\n ToSmartContractAccountParams<\n \"SimpleAccount\",\n TTransport,\n Chain,\n TEntryPointVersion\n >,\n \"chain\" | \"transport\"\n> & {\n signer: TSigner;\n salt?: bigint;\n accountAddress?: Address;\n factoryAddress?: Address;\n initCode?: Hex;\n} & EntryPointParameter<TEntryPointVersion, Chain>;\n\nexport async function createSimpleSmartAccount<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TEntryPointVersion extends EntryPointVersion = DefaultEntryPointVersion\n>(\n config: CreateSimpleAccountParams<TTransport, TSigner, TEntryPointVersion>\n): Promise<SimpleSmartAccount<TSigner, TEntryPointVersion>>;\n\n/**\n * Creates a simple smart account using the provided parameters, including chain, entry point, factory address, and additional parameters. This function also ensures that a signer is provided.\n *\n * @param {CreateSimpleAccountParams} config The parameters for creating a simple smart account\n * @returns {Promise<SimpleSmartAccount>} A promise that resolves to a `SimpleSmartAccount` object containing the created account information and methods\n */\nexport async function createSimpleSmartAccount({\n chain,\n entryPoint = getEntryPoint(chain),\n factoryAddress = getDefaultSimpleAccountFactoryAddress(\n chain,\n entryPoint.version\n ),\n ...params\n}: CreateSimpleAccountParams): Promise<SimpleSmartAccount> {\n if (!params.signer) throw new AccountRequiresOwnerError(\"SimpleAccount\");\n const simpleAccount = new SimpleSmartContractAccount(\n SimpleSmartAccountParamsSchema().parse({\n chain,\n entryPointAddress: entryPoint.address,\n factoryAddress,\n ...params,\n })\n );\n\n const parsedParams = SimpleSmartAccountParamsSchema().parse({\n chain,\n entryPointAddress: entryPoint.address,\n entryPointVersion: entryPoint.version,\n factoryAddress,\n ...params,\n });\n\n const base = await toSmartContractAccount({\n source: \"SimpleAccount\",\n transport: params.transport,\n chain,\n encodeBatchExecute: simpleAccount.encodeBatchExecute.bind(simpleAccount),\n encodeExecute: (tx) =>\n simpleAccount.encodeExecute.bind(simpleAccount)(\n tx.target,\n tx.value ?? 0n,\n tx.data\n ),\n entryPoint,\n getAccountInitCode: async () => {\n if (parsedParams.initCode) return parsedParams.initCode as Hex;\n return simpleAccount.getAccountInitCode();\n },\n getDummySignature: simpleAccount.getDummySignature.bind(simpleAccount),\n signMessage: ({ message }) =>\n simpleAccount.signMessage(\n typeof message === \"string\" ? message : message.raw\n ),\n // @ts-expect-error these types still represent the same thing, but they are just a little off in there definitions\n signTypedData: simpleAccount.signTypedData.bind(simpleAccount),\n accountAddress: parsedParams.accountAddress,\n });\n\n return {\n ...base,\n getSigner: () => simpleAccount.getSigner(),\n };\n}\n"]}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Address } from "abitype";
|
|
2
|
-
import type { Hash, Hex, HttpTransport, Transport } from "viem";
|
|
3
|
-
import type { SignTypedDataParameters } from "viem/accounts";
|
|
4
|
-
import type { z } from "zod";
|
|
5
|
-
import type { BundlerClient } from "../client/bundlerClient";
|
|
6
|
-
import type { SmartAccountSigner } from "../signer/types";
|
|
7
|
-
import type { BatchUserOperationCallData } from "../types";
|
|
8
|
-
import type { SimpleSmartAccountParamsSchema, createBaseSmartAccountParamsSchema } from "./schema";
|
|
9
|
-
export type SignTypedDataParams = Omit<SignTypedDataParameters, "privateKey">;
|
|
10
|
-
export type BaseSmartAccountParams<TTransport extends Transport = Transport, TSigner extends SmartAccountSigner = SmartAccountSigner> = z.input<ReturnType<typeof createBaseSmartAccountParamsSchema<TTransport, TSigner>>>;
|
|
11
|
-
export type SimpleSmartAccountParams<TTransport extends Transport = Transport, TSigner extends SmartAccountSigner = SmartAccountSigner> = z.input<ReturnType<typeof SimpleSmartAccountParamsSchema<TTransport, TSigner>>>;
|
|
12
|
-
export interface ISmartContractAccount<TTransport extends Transport = Transport, TSigner extends SmartAccountSigner = SmartAccountSigner> {
|
|
13
|
-
readonly rpcProvider: BundlerClient<TTransport> | BundlerClient<HttpTransport>;
|
|
14
|
-
getInitCode(): Promise<Hex>;
|
|
15
|
-
getDummySignature(): Hex | Promise<Hex>;
|
|
16
|
-
encodeExecute(target: string, value: bigint, data: string): Promise<Hex>;
|
|
17
|
-
encodeBatchExecute(txs: BatchUserOperationCallData): Promise<Hex>;
|
|
18
|
-
getNonce(): Promise<bigint>;
|
|
19
|
-
signUserOperationHash(uoHash: Hash): Promise<Hash>;
|
|
20
|
-
signMessage(msg: string | Uint8Array | Hex): Promise<Hex>;
|
|
21
|
-
signTypedData(params: SignTypedDataParams): Promise<Hash>;
|
|
22
|
-
signMessageWith6492(msg: string | Uint8Array | Hex): Promise<Hex>;
|
|
23
|
-
signTypedDataWith6492(params: SignTypedDataParams): Promise<Hash>;
|
|
24
|
-
getAddress(): Promise<Address>;
|
|
25
|
-
getSigner(): TSigner;
|
|
26
|
-
getFactoryAddress(): Address;
|
|
27
|
-
getEntryPointAddress(): Address;
|
|
28
|
-
extend: <R>(extendFn: (self: this) => R) => this & R;
|
|
29
|
-
encodeUpgradeToAndCall: (upgradeToImplAddress: Address, upgradeToInitData: Hex) => Promise<Hex>;
|
|
30
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/account/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Address } from \"abitype\";\nimport type { Hash, Hex, HttpTransport, Transport } from \"viem\";\nimport type { SignTypedDataParameters } from \"viem/accounts\";\nimport type { z } from \"zod\";\nimport type { BundlerClient } from \"../client/bundlerClient\";\nimport type { SmartAccountSigner } from \"../signer/types\";\nimport type { BatchUserOperationCallData } from \"../types\";\nimport type {\n SimpleSmartAccountParamsSchema,\n createBaseSmartAccountParamsSchema,\n} from \"./schema\";\n\n/** @deprecated */\nexport type SignTypedDataParams = Omit<SignTypedDataParameters, \"privateKey\">;\n\n/**\n * @deprecated don't use base smart account anymore, migrate to using toSmartContractAccount instead\n */\nexport type BaseSmartAccountParams<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = z.input<\n ReturnType<typeof createBaseSmartAccountParamsSchema<TTransport, TSigner>>\n>;\n\nexport type SimpleSmartAccountParams<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = z.input<\n ReturnType<typeof SimpleSmartAccountParamsSchema<TTransport, TSigner>>\n>;\n\n/**\n * @deprecated use `toSmartContractAccount` instead for creating instances of smart accounts\n */\nexport interface ISmartContractAccount<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> {\n /**\n * The RPC provider the account uses to make RPC calls\n */\n readonly rpcProvider:\n | BundlerClient<TTransport>\n | BundlerClient<HttpTransport>;\n\n /**\n * @returns the init code for the account\n */\n getInitCode(): Promise<Hex>;\n\n /**\n * This is useful for estimating gas costs. It should return a signature that doesn't cause the account to revert\n * when validation is run during estimation.\n *\n * @returns a dummy signature that doesn't cause the account to revert during estimation\n */\n getDummySignature(): Hex | Promise<Hex>;\n\n /**\n * Encodes a call to the account's execute function.\n *\n * @param target - the address receiving the call data\n * @param value - optionally the amount of native token to send\n * @param data - the call data or \"0x\" if empty\n */\n encodeExecute(target: string, value: bigint, data: string): Promise<Hex>;\n\n /**\n * Encodes a batch of transactions to the account's batch execute function.\n * NOTE: not all accounts support batching.\n *\n * @param txs - An Array of objects containing the target, value, and data for each transaction\n * @returns the encoded callData for a UserOperation\n */\n encodeBatchExecute(txs: BatchUserOperationCallData): Promise<Hex>;\n\n /**\n * @returns the nonce of the account\n */\n getNonce(): Promise<bigint>;\n\n /**\n * If your account handles 1271 signatures of personal_sign differently\n * than it does UserOperations, you can implement two different approaches to signing\n *\n * @param uoHash -- The hash of the UserOperation to sign\n * @returns the signature of the UserOperation\n */\n signUserOperationHash(uoHash: Hash): Promise<Hash>;\n\n /**\n * Returns a signed and prefixed message.\n *\n * @param msg - the message to sign\n * @returns the signature of the message\n */\n signMessage(msg: string | Uint8Array | Hex): Promise<Hex>;\n\n /**\n * Signs a typed data object as per ERC-712\n *\n * @param params - {@link SignTypedDataParams}\n * @returns the signed hash for the message passed\n */\n signTypedData(params: SignTypedDataParams): Promise<Hash>;\n\n /**\n * If the account is not deployed, it will sign the message and then wrap it in 6492 format\n *\n * @param msg - the message to sign\n * @returns ths signature wrapped in 6492 format\n */\n signMessageWith6492(msg: string | Uint8Array | Hex): Promise<Hex>;\n\n /**\n * If the account is not deployed, it will sign the typed data blob and then wrap it in 6492 format\n *\n * @param params - {@link SignTypedDataParams}\n * @returns the signed hash for the params passed in wrapped in 6492 format\n */\n signTypedDataWith6492(params: SignTypedDataParams): Promise<Hash>;\n\n /**\n * @returns the address of the account\n */\n getAddress(): Promise<Address>;\n\n /**\n * @returns the current account signer instance that the smart account client\n * operations are being signed with.\n *\n * The signer is expected to be the owner or one of the owners of the account\n * for the signatures to be valid for the acting account.\n */\n getSigner(): TSigner;\n\n /**\n * The factory address of the smart account created by the factory\n *\n * @returns the address of the factory contract for the smart account\n */\n getFactoryAddress(): Address;\n\n /**\n * The entrypoint address is the address ERC 4337 entrypoint singleton contract\n * that this smart account and the connected bundler client use\n *\n * @returns the address of the entry point contract for the smart account\n */\n getEntryPointAddress(): Address;\n\n /**\n * Allows you to add additional functionality and utility methods to this account\n * via a decorator pattern.\n *\n * NOTE: this method does not allow you to override existing methods on the account.\n *\n * @example\n * ```ts\n * const account = new BaseSmartCobntractAccount(...).extend((account) => ({\n * readAccountState: async (...args) => {\n * return this.rpcProvider.readContract({\n * address: await this.getAddress(),\n * abi: ThisContractsAbi\n * args: args\n * });\n * }\n * }));\n *\n * account.debugSendUserOperation(...);\n * ```\n *\n * @param extendFn -- this function gives you access to the created account instance and returns an object\n * with the extension methods\n * @returns -- the account with the extension methods added\n */\n extend: <R>(extendFn: (self: this) => R) => this & R;\n\n encodeUpgradeToAndCall: (\n upgradeToImplAddress: Address,\n upgradeToInitData: Hex\n ) => Promise<Hex>;\n}\n"]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type Chain } from "viem";
|
|
2
|
-
export declare const arbitrum: Chain;
|
|
3
|
-
export declare const arbitrumGoerli: Chain;
|
|
4
|
-
export declare const arbitrumSepolia: Chain;
|
|
5
|
-
export declare const goerli: Chain;
|
|
6
|
-
export declare const mainnet: Chain;
|
|
7
|
-
export declare const optimism: Chain;
|
|
8
|
-
export declare const optimismGoerli: Chain;
|
|
9
|
-
export declare const optimismSepolia: Chain;
|
|
10
|
-
export declare const sepolia: Chain;
|
|
11
|
-
export declare const base: Chain;
|
|
12
|
-
export declare const baseGoerli: Chain;
|
|
13
|
-
export declare const baseSepolia: Chain;
|
|
14
|
-
export declare const polygonMumbai: Chain;
|
|
15
|
-
export declare const polygonAmoy: Chain;
|
|
16
|
-
export declare const polygon: Chain;
|
|
17
|
-
export declare const fraxtal: Chain;
|
|
18
|
-
export declare const fraxtalSepolia: Chain;
|
|
19
|
-
export declare const zora: Chain;
|
|
20
|
-
export declare const zoraSepolia: Chain;
|
package/dist/esm/chains/index.js
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { defineChain } from "viem";
|
|
2
|
-
import { arbitrum as vab, arbitrumGoerli as vabg, arbitrumSepolia as vabs, base as vbase, baseGoerli as vbaseg, baseSepolia as vbases, goerli as vgo, mainnet as vmain, optimism as vop, optimismGoerli as vopg, optimismSepolia as vops, polygon as vpg, polygonMumbai as vpgm, polygonAmoy as vpga, sepolia as vsep, fraxtal as vfrax, zora as vzora, zoraSepolia as vzoras, } from "viem/chains";
|
|
3
|
-
export const arbitrum = {
|
|
4
|
-
...vab,
|
|
5
|
-
rpcUrls: {
|
|
6
|
-
...vab.rpcUrls,
|
|
7
|
-
alchemy: {
|
|
8
|
-
http: ["https://arb-mainnet.g.alchemy.com/v2"],
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
export const arbitrumGoerli = {
|
|
13
|
-
...vabg,
|
|
14
|
-
rpcUrls: {
|
|
15
|
-
...vabg.rpcUrls,
|
|
16
|
-
alchemy: {
|
|
17
|
-
http: ["https://arb-goerli.g.alchemy.com/v2"],
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
export const arbitrumSepolia = {
|
|
22
|
-
...vabs,
|
|
23
|
-
rpcUrls: {
|
|
24
|
-
...vabs.rpcUrls,
|
|
25
|
-
alchemy: {
|
|
26
|
-
http: ["https://arb-sepolia.g.alchemy.com/v2"],
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
export const goerli = {
|
|
31
|
-
...vgo,
|
|
32
|
-
rpcUrls: {
|
|
33
|
-
...vgo.rpcUrls,
|
|
34
|
-
alchemy: {
|
|
35
|
-
http: ["https://eth-goerli.g.alchemy.com/v2"],
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
export const mainnet = {
|
|
40
|
-
...vmain,
|
|
41
|
-
rpcUrls: {
|
|
42
|
-
...vmain.rpcUrls,
|
|
43
|
-
alchemy: {
|
|
44
|
-
http: ["https://eth-mainnet.g.alchemy.com/v2"],
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
export const optimism = {
|
|
49
|
-
...vop,
|
|
50
|
-
rpcUrls: {
|
|
51
|
-
...vop.rpcUrls,
|
|
52
|
-
alchemy: {
|
|
53
|
-
http: ["https://opt-mainnet.g.alchemy.com/v2"],
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
export const optimismGoerli = {
|
|
58
|
-
...vopg,
|
|
59
|
-
rpcUrls: {
|
|
60
|
-
...vopg.rpcUrls,
|
|
61
|
-
alchemy: {
|
|
62
|
-
http: ["https://opt-goerli.g.alchemy.com/v2"],
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
export const optimismSepolia = {
|
|
67
|
-
...vops,
|
|
68
|
-
rpcUrls: {
|
|
69
|
-
...vops.rpcUrls,
|
|
70
|
-
alchemy: {
|
|
71
|
-
http: ["https://opt-sepolia.g.alchemy.com/v2"],
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
|
-
export const sepolia = {
|
|
76
|
-
...vsep,
|
|
77
|
-
rpcUrls: {
|
|
78
|
-
...vsep.rpcUrls,
|
|
79
|
-
alchemy: {
|
|
80
|
-
http: ["https://eth-sepolia.g.alchemy.com/v2"],
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
export const base = {
|
|
85
|
-
...vbase,
|
|
86
|
-
rpcUrls: {
|
|
87
|
-
...vbase.rpcUrls,
|
|
88
|
-
alchemy: {
|
|
89
|
-
http: ["https://base-mainnet.g.alchemy.com/v2"],
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
export const baseGoerli = {
|
|
94
|
-
...vbaseg,
|
|
95
|
-
rpcUrls: {
|
|
96
|
-
...vbaseg.rpcUrls,
|
|
97
|
-
alchemy: {
|
|
98
|
-
http: ["https://base-goerli.g.alchemy.com/v2"],
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
};
|
|
102
|
-
export const baseSepolia = {
|
|
103
|
-
...vbases,
|
|
104
|
-
rpcUrls: {
|
|
105
|
-
...vbases.rpcUrls,
|
|
106
|
-
alchemy: {
|
|
107
|
-
http: ["https://base-sepolia.g.alchemy.com/v2"],
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
export const polygonMumbai = {
|
|
112
|
-
...vpgm,
|
|
113
|
-
rpcUrls: {
|
|
114
|
-
...vpgm.rpcUrls,
|
|
115
|
-
alchemy: {
|
|
116
|
-
http: ["https://polygon-mumbai.g.alchemy.com/v2"],
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
};
|
|
120
|
-
export const polygonAmoy = {
|
|
121
|
-
...vpga,
|
|
122
|
-
rpcUrls: {
|
|
123
|
-
...vpga.rpcUrls,
|
|
124
|
-
alchemy: {
|
|
125
|
-
http: ["https://polygon-amoy.g.alchemy.com/v2"],
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
};
|
|
129
|
-
export const polygon = {
|
|
130
|
-
...vpg,
|
|
131
|
-
rpcUrls: {
|
|
132
|
-
...vpg.rpcUrls,
|
|
133
|
-
alchemy: {
|
|
134
|
-
http: ["https://polygon-mainnet.g.alchemy.com/v2"],
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
};
|
|
138
|
-
export const fraxtal = {
|
|
139
|
-
...vfrax,
|
|
140
|
-
rpcUrls: {
|
|
141
|
-
...vfrax.rpcUrls,
|
|
142
|
-
},
|
|
143
|
-
};
|
|
144
|
-
export const fraxtalSepolia = defineChain({
|
|
145
|
-
id: 2523,
|
|
146
|
-
name: "Fraxtal Sepolia",
|
|
147
|
-
nativeCurrency: { name: "Frax Ether", symbol: "frxETH", decimals: 18 },
|
|
148
|
-
rpcUrls: {
|
|
149
|
-
default: {
|
|
150
|
-
http: ["https://rpc.testnet-sepolia.frax.com"],
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
});
|
|
154
|
-
export const zora = {
|
|
155
|
-
...vzora,
|
|
156
|
-
rpcUrls: {
|
|
157
|
-
...vzora.rpcUrls,
|
|
158
|
-
},
|
|
159
|
-
};
|
|
160
|
-
export const zoraSepolia = {
|
|
161
|
-
...vzoras,
|
|
162
|
-
rpcUrls: {
|
|
163
|
-
...vzoras.rpcUrls,
|
|
164
|
-
},
|
|
165
|
-
};
|
|
166
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/chains/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,MAAM,MAAM,CAAC;AAC/C,OAAO,EACL,QAAQ,IAAI,GAAG,EACf,cAAc,IAAI,IAAI,EACtB,eAAe,IAAI,IAAI,EACvB,IAAI,IAAI,KAAK,EACb,UAAU,IAAI,MAAM,EACpB,WAAW,IAAI,MAAM,EACrB,MAAM,IAAI,GAAG,EACb,OAAO,IAAI,KAAK,EAChB,QAAQ,IAAI,GAAG,EACf,cAAc,IAAI,IAAI,EACtB,eAAe,IAAI,IAAI,EACvB,OAAO,IAAI,GAAG,EACd,aAAa,IAAI,IAAI,EACrB,WAAW,IAAI,IAAI,EACnB,OAAO,IAAI,IAAI,EACf,OAAO,IAAI,KAAK,EAChB,IAAI,IAAI,KAAK,EACb,WAAW,IAAI,MAAM,GACtB,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,QAAQ,GAAU;IAC7B,GAAG,GAAG;IACN,OAAO,EAAE;QACP,GAAG,GAAG,CAAC,OAAO;QACd,OAAO,EAAE;YACP,IAAI,EAAE,CAAC,sCAAsC,CAAC;SAC/C;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAU;IACnC,GAAG,IAAI;IACP,OAAO,EAAE;QACP,GAAG,IAAI,CAAC,OAAO;QACf,OAAO,EAAE;YACP,IAAI,EAAE,CAAC,qCAAqC,CAAC;SAC9C;KACF;CACF,C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C;IAC/C,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,iBAAiB;IACvB,cAAc,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE;IACtE,OAAO,EAAE;QACP,OAAO,EAAE;YACP,IAAI,EAAE,CAAC,sCAAsC,CAAC;SAC/C;KACF;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,IAAI,GAAU;IACzB,GAAG,KAAK;IACR,OAAO,EAAE;QACP,GAAG,KAAK,CAAC,OAAO;KACjB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAU;IAChC,GAAG,MAAM;IACT,OAAO,EAAE;QACP,GAAG,MAAM,CAAC,OAAO;KAClB;CACF,CAAC","sourcesContent":["import { defineChain, type Chain } from \"viem\";\nimport {\n arbitrum as vab,\n arbitrumGoerli as vabg,\n arbitrumSepolia as vabs,\n base as vbase,\n baseGoerli as vbaseg,\n baseSepolia as vbases,\n goerli as vgo,\n mainnet as vmain,\n optimism as vop,\n optimismGoerli as vopg,\n optimismSepolia as vops,\n polygon as vpg,\n polygonMumbai as vpgm,\n polygonAmoy as vpga,\n sepolia as vsep,\n fraxtal as vfrax,\n zora as vzora,\n zoraSepolia as vzoras,\n} from \"viem/chains\";\n\nexport const arbitrum: Chain = {\n ...vab,\n rpcUrls: {\n ...vab.rpcUrls,\n alchemy: {\n http: [\"https://arb-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const arbitrumGoerli: Chain = {\n ...vabg,\n rpcUrls: {\n ...vabg.rpcUrls,\n alchemy: {\n http: [\"https://arb-goerli.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const arbitrumSepolia: Chain = {\n ...vabs,\n rpcUrls: {\n ...vabs.rpcUrls,\n alchemy: {\n http: [\"https://arb-sepolia.g.alchemy.com/v2\"],\n },\n },\n};\nexport const goerli: Chain = {\n ...vgo,\n rpcUrls: {\n ...vgo.rpcUrls,\n alchemy: {\n http: [\"https://eth-goerli.g.alchemy.com/v2\"],\n },\n },\n};\nexport const mainnet: Chain = {\n ...vmain,\n rpcUrls: {\n ...vmain.rpcUrls,\n alchemy: {\n http: [\"https://eth-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\nexport const optimism: Chain = {\n ...vop,\n rpcUrls: {\n ...vop.rpcUrls,\n alchemy: {\n http: [\"https://opt-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\nexport const optimismGoerli: Chain = {\n ...vopg,\n rpcUrls: {\n ...vopg.rpcUrls,\n alchemy: {\n http: [\"https://opt-goerli.g.alchemy.com/v2\"],\n },\n },\n};\nexport const optimismSepolia: Chain = {\n ...vops,\n rpcUrls: {\n ...vops.rpcUrls,\n alchemy: {\n http: [\"https://opt-sepolia.g.alchemy.com/v2\"],\n },\n },\n};\nexport const sepolia: Chain = {\n ...vsep,\n rpcUrls: {\n ...vsep.rpcUrls,\n alchemy: {\n http: [\"https://eth-sepolia.g.alchemy.com/v2\"],\n },\n },\n};\nexport const base: Chain = {\n ...vbase,\n rpcUrls: {\n ...vbase.rpcUrls,\n alchemy: {\n http: [\"https://base-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\nexport const baseGoerli: Chain = {\n ...vbaseg,\n rpcUrls: {\n ...vbaseg.rpcUrls,\n alchemy: {\n http: [\"https://base-goerli.g.alchemy.com/v2\"],\n },\n },\n};\nexport const baseSepolia: Chain = {\n ...vbases,\n rpcUrls: {\n ...vbases.rpcUrls,\n alchemy: {\n http: [\"https://base-sepolia.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const polygonMumbai: Chain = {\n ...vpgm,\n rpcUrls: {\n ...vpgm.rpcUrls,\n alchemy: {\n http: [\"https://polygon-mumbai.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const polygonAmoy: Chain = {\n ...vpga,\n rpcUrls: {\n ...vpga.rpcUrls,\n alchemy: {\n http: [\"https://polygon-amoy.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const polygon: Chain = {\n ...vpg,\n rpcUrls: {\n ...vpg.rpcUrls,\n alchemy: {\n http: [\"https://polygon-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const fraxtal: Chain = {\n ...vfrax,\n rpcUrls: {\n ...vfrax.rpcUrls,\n },\n};\n\nexport const fraxtalSepolia: Chain = defineChain({\n id: 2523,\n name: \"Fraxtal Sepolia\",\n nativeCurrency: { name: \"Frax Ether\", symbol: \"frxETH\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://rpc.testnet-sepolia.frax.com\"],\n },\n },\n});\n\nexport const zora: Chain = {\n ...vzora,\n rpcUrls: {\n ...vzora.rpcUrls,\n },\n};\n\nexport const zoraSepolia: Chain = {\n ...vzoras,\n rpcUrls: {\n ...vzoras.rpcUrls,\n },\n};\n"]}
|