@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
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.erc7677Middleware = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const client_js_1 = require("../errors/client.js");
|
|
6
|
+
const index_js_1 = require("../utils/index.js");
|
|
7
|
+
function erc7677Middleware(params) {
|
|
8
|
+
const dummyPaymasterAndData = async (uo, { client, account, feeOptions, overrides }) => {
|
|
9
|
+
const userOp = (0, index_js_1.deepHexlify)(await (0, index_js_1.resolveProperties)(uo));
|
|
10
|
+
userOp.maxFeePerGas = "0x0";
|
|
11
|
+
userOp.maxPriorityFeePerGas = "0x0";
|
|
12
|
+
userOp.callGasLimit = "0x0";
|
|
13
|
+
userOp.verificationGasLimit = "0x0";
|
|
14
|
+
userOp.preVerificationGas = "0x0";
|
|
15
|
+
const entrypoint = account.getEntryPoint();
|
|
16
|
+
if (entrypoint.version === "0.7.0") {
|
|
17
|
+
userOp.paymasterVerificationGasLimit = "0x0";
|
|
18
|
+
userOp.paymasterPostOpGasLimit = "0x0";
|
|
19
|
+
}
|
|
20
|
+
const context = (typeof params?.context === "function"
|
|
21
|
+
? await params?.context(userOp, { overrides, feeOptions })
|
|
22
|
+
: params?.context) ?? {};
|
|
23
|
+
if (!client.chain) {
|
|
24
|
+
throw new client_js_1.ChainNotFoundError();
|
|
25
|
+
}
|
|
26
|
+
const erc7677client = client;
|
|
27
|
+
const { paymaster, paymasterAndData, paymasterData, paymasterPostOpGasLimit, paymasterVerificationGasLimit, } = await erc7677client.request({
|
|
28
|
+
method: "pm_getPaymasterStubData",
|
|
29
|
+
params: [userOp, entrypoint.address, (0, viem_1.toHex)(client.chain.id), context],
|
|
30
|
+
});
|
|
31
|
+
if (entrypoint.version === "0.6.0") {
|
|
32
|
+
return {
|
|
33
|
+
...uo,
|
|
34
|
+
paymasterAndData,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
...uo,
|
|
39
|
+
paymaster,
|
|
40
|
+
paymasterData,
|
|
41
|
+
paymasterPostOpGasLimit,
|
|
42
|
+
paymasterVerificationGasLimit,
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
const paymasterAndData = async (uo, { client, account, feeOptions, overrides }) => {
|
|
46
|
+
const userOp = (0, index_js_1.deepHexlify)(await (0, index_js_1.resolveProperties)(uo));
|
|
47
|
+
const context = (typeof params?.context === "function"
|
|
48
|
+
? await params?.context(userOp, { overrides, feeOptions })
|
|
49
|
+
: params?.context) ?? {};
|
|
50
|
+
if (!client.chain) {
|
|
51
|
+
throw new client_js_1.ChainNotFoundError();
|
|
52
|
+
}
|
|
53
|
+
const erc7677client = client;
|
|
54
|
+
const entrypoint = account.getEntryPoint();
|
|
55
|
+
const { paymaster, paymasterAndData, paymasterData } = await erc7677client.request({
|
|
56
|
+
method: "pm_getPaymasterData",
|
|
57
|
+
params: [userOp, entrypoint.address, (0, viem_1.toHex)(client.chain.id), context],
|
|
58
|
+
});
|
|
59
|
+
if (entrypoint.version === "0.6.0") {
|
|
60
|
+
return {
|
|
61
|
+
...uo,
|
|
62
|
+
paymasterAndData,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
...uo,
|
|
67
|
+
paymaster,
|
|
68
|
+
paymasterData,
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
return {
|
|
72
|
+
dummyPaymasterAndData,
|
|
73
|
+
paymasterAndData,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
exports.erc7677Middleware = erc7677Middleware;
|
|
77
|
+
//# sourceMappingURL=erc7677middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erc7677middleware.js","sourceRoot":"","sources":["../../../src/middleware/erc7677middleware.ts"],"names":[],"mappings":"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","sourcesContent":["import {\n toHex,\n type Address,\n type Chain,\n type Client,\n type Hex,\n type Transport,\n} from \"viem\";\nimport type { ClientMiddlewareConfig } from \"../client/types\";\nimport type { EntryPointVersion } from \"../entrypoint/types\";\nimport { ChainNotFoundError } from \"../errors/client.js\";\nimport type {\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationRequest,\n UserOperationStruct,\n} from \"../types\";\nimport {\n deepHexlify,\n resolveProperties,\n type Deferrable,\n} from \"../utils/index.js\";\nimport type { ClientMiddlewareFn } from \"./types\";\n\nexport type Erc7677RpcSchema = [\n {\n Method: \"pm_getPaymasterStubData\";\n Parameters: [UserOperationRequest, Address, Hex, Record<string, any>];\n ReturnType: {\n sponsor?: { name: string; icon?: string }; // Sponsor info\n paymaster?: Address; // Paymaster address (entrypoint v0.7)\n paymasterData?: Hex; // Paymaster data (entrypoint v0.7)\n paymasterVerificationGasLimit?: Hex; // Paymaster validation gas (entrypoint v0.7)\n paymasterPostOpGasLimit?: Hex; // Paymaster post-op gas (entrypoint v0.7)\n paymasterAndData?: Hex; // Paymaster and data (entrypoint v0.6)\n isFinal?: boolean; // Indicates that the caller does not need to call pm_getPaymasterData\n };\n },\n {\n Method: \"pm_getPaymasterData\";\n Parameters: [UserOperationRequest, Address, Hex, Record<string, any>];\n ReturnType: {\n paymaster?: Address; // Paymaster address (entrypoint v0.7)\n paymasterData?: Hex; // Paymaster data (entrypoint v0.7)\n paymasterAndData?: Hex; // Paymaster and data (entrypoint v0.6)\n };\n }\n];\n\nexport type Erc7677Client<T extends Transport = Transport> = Client<\n T,\n Chain,\n undefined,\n Erc7677RpcSchema\n>;\n\nexport type Erc7677MiddlewareParams<\n TContext extends Record<string, any> | undefined =\n | Record<string, any>\n | undefined,\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = {\n context?:\n | ((\n struct: Deferrable<UserOperationStruct<TEntryPointVersion>>,\n args: {\n overrides?: UserOperationOverrides<TEntryPointVersion>;\n feeOptions?: UserOperationFeeOptions;\n }\n ) => Promise<TContext>)\n | TContext;\n};\n\n/**\n * Middleware function for interacting with ERC-7677 enabled clients. It supports resolving paymaster and data fields for user operations.\n * This middleware assumes that your RPC provider supports the ERC-7677 methods (pm_getPaymasterStubData and pm_getPaymasterData).\n *\n * @example\n * ```ts\n * import { createSmartAccountClient, erc7677Middleware } from \"@aa-sdk/core\";\n * import { http } from \"viem\";\n * import { sepolia } from \"viem/chains\";\n *\n * const client = createSmartAccountClient({\n * transport: http(\"rpc-url\"),\n * chain: sepolia,\n * // this assumes that your RPC provider supports the ERC-7677 methods AND takes no context\n * ...erc7677Middleware(),\n * })\n * ```\n *\n * @param {Erc7677MiddlewareParams<TContext>} params Middleware parameters including context function or object. Context can be resolved dynamically by passing in a function which takes in the context at the time of sending a user op\n * @returns {Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\">} An object containing middleware functions `dummyPaymasterAndData` and `paymasterAndData` for processing user operations with the paymaster data\n */\nexport function erc7677Middleware<\n TContext extends Record<string, any> | undefined =\n | Record<string, any>\n | undefined\n>(\n params?: Erc7677MiddlewareParams<TContext>\n): Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\"> {\n const dummyPaymasterAndData: ClientMiddlewareFn = async (\n uo,\n { client, account, feeOptions, overrides }\n ) => {\n const userOp = deepHexlify(await resolveProperties(uo));\n\n // Those values will be set after fee estimation.\n userOp.maxFeePerGas = \"0x0\";\n userOp.maxPriorityFeePerGas = \"0x0\";\n userOp.callGasLimit = \"0x0\";\n userOp.verificationGasLimit = \"0x0\";\n userOp.preVerificationGas = \"0x0\";\n\n const entrypoint = account.getEntryPoint();\n\n if (entrypoint.version === \"0.7.0\") {\n userOp.paymasterVerificationGasLimit = \"0x0\";\n userOp.paymasterPostOpGasLimit = \"0x0\";\n }\n\n const context =\n (typeof params?.context === \"function\"\n ? await params?.context(userOp, { overrides, feeOptions })\n : params?.context) ?? {};\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const erc7677client = client as Erc7677Client;\n // TODO: probably need to handle the sponsor and isFinal fields\n const {\n paymaster,\n paymasterAndData,\n paymasterData,\n paymasterPostOpGasLimit,\n paymasterVerificationGasLimit,\n } = await erc7677client.request({\n method: \"pm_getPaymasterStubData\",\n params: [userOp, entrypoint.address, toHex(client.chain.id), context],\n });\n\n if (entrypoint.version === \"0.6.0\") {\n return {\n ...uo,\n paymasterAndData,\n };\n }\n\n return {\n ...uo,\n paymaster,\n paymasterData,\n paymasterPostOpGasLimit,\n paymasterVerificationGasLimit,\n };\n };\n\n const paymasterAndData: ClientMiddlewareFn = async (\n uo,\n { client, account, feeOptions, overrides }\n ) => {\n const userOp = deepHexlify(await resolveProperties(uo));\n const context =\n (typeof params?.context === \"function\"\n ? await params?.context(userOp, { overrides, feeOptions })\n : params?.context) ?? {};\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const erc7677client = client as Erc7677Client;\n\n const entrypoint = account.getEntryPoint();\n const { paymaster, paymasterAndData, paymasterData } =\n await erc7677client.request({\n method: \"pm_getPaymasterData\",\n params: [userOp, entrypoint.address, toHex(client.chain.id), context],\n });\n\n if (entrypoint.version === \"0.6.0\") {\n return {\n ...uo,\n paymasterAndData,\n };\n }\n\n return {\n ...uo,\n paymaster,\n paymasterData,\n };\n };\n\n return {\n dummyPaymasterAndData,\n paymasterAndData,\n };\n}\n"]}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import type { UserOperationContext } from "../actions/smartAccount/types";
|
|
1
2
|
import type { ClientMiddlewareFn } from "./types";
|
|
2
|
-
export declare const noopMiddleware: ClientMiddlewareFn
|
|
3
|
+
export declare const noopMiddleware: ClientMiddlewareFn<UserOperationContext | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noopMiddleware.js","sourceRoot":"","sources":["../../../src/middleware/noopMiddleware.ts"],"names":[],"mappings":";;;AASO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"noopMiddleware.js","sourceRoot":"","sources":["../../../src/middleware/noopMiddleware.ts"],"names":[],"mappings":";;;AASO,MAAM,cAAc,GAEvB,KAAK,EAAE,IAAI,EAAE,EAAE;IACjB,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAJW,QAAA,cAAc,kBAIzB","sourcesContent":["import type { UserOperationContext } from \"../actions/smartAccount/types\";\nimport type { ClientMiddlewareFn } from \"./types\";\n\n/**\n * Noop middleware that does nothing and passes the arguments through\n *\n * @param {Deferrable<UserOperationStruct<TEntryPointVersion>>} args the client middleware arguments passed to the middleware\n * @returns {Promise<Deferrable<UserOperationStruct<TEntryPointVersion>>>} the arguments passed to the middleware and returned as is without modification\n */\nexport const noopMiddleware: ClientMiddlewareFn<\n UserOperationContext | undefined\n> = async (args) => {\n return args;\n};\n"]}
|
|
@@ -3,13 +3,14 @@ import type { UserOperationContext } from "../actions/smartAccount/types";
|
|
|
3
3
|
import type { UserOperationFeeOptions, UserOperationOverrides, UserOperationStruct } from "../types";
|
|
4
4
|
import type { Deferrable } from "../utils";
|
|
5
5
|
import type { MiddlewareClient } from "./actions";
|
|
6
|
-
export type
|
|
6
|
+
export type ClientMiddlewareArgs<TAccount extends SmartContractAccount, C extends MiddlewareClient, TContext extends UserOperationContext | undefined = UserOperationContext | undefined, TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>> = {
|
|
7
7
|
overrides?: UserOperationOverrides<TEntryPointVersion>;
|
|
8
8
|
context?: TContext;
|
|
9
9
|
feeOptions?: UserOperationFeeOptions;
|
|
10
10
|
account: TAccount;
|
|
11
11
|
client: C;
|
|
12
|
-
}
|
|
12
|
+
};
|
|
13
|
+
export type ClientMiddlewareFn<TContext extends UserOperationContext | undefined = UserOperationContext | undefined> = <TAccount extends SmartContractAccount, C extends MiddlewareClient, TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>>(struct: Deferrable<UserOperationStruct<TEntryPointVersion>>, args: ClientMiddlewareArgs<TAccount, C, TContext, TEntryPointVersion>) => Promise<Deferrable<UserOperationStruct<TEntryPointVersion>>>;
|
|
13
14
|
export type ClientMiddleware<TContext extends UserOperationContext | undefined = UserOperationContext | undefined> = {
|
|
14
15
|
dummyPaymasterAndData: ClientMiddlewareFn<TContext>;
|
|
15
16
|
feeEstimator: ClientMiddlewareFn<TContext>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/middleware/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../account/smartContractAccount\";\nimport type { UserOperationContext } from \"../actions/smartAccount/types\";\nimport type {\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationStruct,\n} from \"../types\";\nimport type { Deferrable } from \"../utils\";\nimport type { MiddlewareClient } from \"./actions\";\n\n// [!region ClientMiddlewareFn]\nexport type ClientMiddlewareFn<\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = <\n TAccount extends SmartContractAccount,\n C extends MiddlewareClient,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n>(\n struct: Deferrable<UserOperationStruct<TEntryPointVersion>>,\n args:
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/middleware/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../account/smartContractAccount\";\nimport type { UserOperationContext } from \"../actions/smartAccount/types\";\nimport type {\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationStruct,\n} from \"../types\";\nimport type { Deferrable } from \"../utils\";\nimport type { MiddlewareClient } from \"./actions\";\n\nexport type ClientMiddlewareArgs<\n TAccount extends SmartContractAccount,\n C extends MiddlewareClient,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n overrides?: UserOperationOverrides<TEntryPointVersion>;\n context?: TContext;\n feeOptions?: UserOperationFeeOptions;\n account: TAccount;\n client: C;\n};\n\n// [!region ClientMiddlewareFn]\nexport type ClientMiddlewareFn<\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = <\n TAccount extends SmartContractAccount,\n C extends MiddlewareClient,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n>(\n struct: Deferrable<UserOperationStruct<TEntryPointVersion>>,\n args: ClientMiddlewareArgs<TAccount, C, TContext, TEntryPointVersion>\n) => Promise<Deferrable<UserOperationStruct<TEntryPointVersion>>>;\n// [!endregion ClientMiddlewareFn]\n\n// [!region ClientMiddleware]\nexport type ClientMiddleware<\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = {\n dummyPaymasterAndData: ClientMiddlewareFn<TContext>;\n feeEstimator: ClientMiddlewareFn<TContext>;\n gasEstimator: ClientMiddlewareFn<TContext>;\n customMiddleware: ClientMiddlewareFn<TContext>;\n paymasterAndData: ClientMiddlewareFn<TContext>;\n userOperationSimulator: ClientMiddlewareFn<TContext>;\n signUserOperation: ClientMiddlewareFn<TContext>;\n};\n// [!endregion ClientMiddleware]\n"]}
|
|
@@ -32,31 +32,31 @@ export declare class LocalAccountSigner<T extends HDAccount | PrivateKeyAccount
|
|
|
32
32
|
[x: `bytes9[${string}]`]: undefined;
|
|
33
33
|
[x: `bytes10[${string}]`]: undefined;
|
|
34
34
|
[x: `bytes25[${string}]`]: undefined;
|
|
35
|
+
[x: `bytes31[${string}]`]: undefined;
|
|
36
|
+
[x: `bytes30[${string}]`]: undefined;
|
|
37
|
+
[x: `bytes29[${string}]`]: undefined;
|
|
38
|
+
[x: `bytes28[${string}]`]: undefined;
|
|
39
|
+
[x: `bytes27[${string}]`]: undefined;
|
|
40
|
+
[x: `bytes26[${string}]`]: undefined;
|
|
41
|
+
[x: `bytes24[${string}]`]: undefined;
|
|
42
|
+
[x: `bytes23[${string}]`]: undefined;
|
|
43
|
+
[x: `bytes22[${string}]`]: undefined;
|
|
44
|
+
[x: `bytes21[${string}]`]: undefined;
|
|
45
|
+
[x: `bytes20[${string}]`]: undefined;
|
|
46
|
+
[x: `bytes19[${string}]`]: undefined;
|
|
35
47
|
[x: `bytes18[${string}]`]: undefined;
|
|
36
|
-
[x: `bytes12[${string}]`]: undefined;
|
|
37
|
-
[x: `bytes13[${string}]`]: undefined;
|
|
38
|
-
[x: `bytes14[${string}]`]: undefined;
|
|
39
|
-
[x: `bytes15[${string}]`]: undefined;
|
|
40
|
-
[x: `bytes16[${string}]`]: undefined;
|
|
41
48
|
[x: `bytes17[${string}]`]: undefined;
|
|
42
|
-
[x: `
|
|
43
|
-
[x: `
|
|
44
|
-
[x: `
|
|
45
|
-
[x: `
|
|
46
|
-
[x: `
|
|
47
|
-
[x: `bytes24[${string}]`]: undefined;
|
|
48
|
-
[x: `bytes26[${string}]`]: undefined;
|
|
49
|
-
[x: `bytes27[${string}]`]: undefined;
|
|
50
|
-
[x: `bytes28[${string}]`]: undefined;
|
|
51
|
-
[x: `bytes29[${string}]`]: undefined;
|
|
52
|
-
[x: `bytes30[${string}]`]: undefined;
|
|
53
|
-
[x: `bytes31[${string}]`]: undefined;
|
|
49
|
+
[x: `bytes16[${string}]`]: undefined;
|
|
50
|
+
[x: `bytes15[${string}]`]: undefined;
|
|
51
|
+
[x: `bytes14[${string}]`]: undefined;
|
|
52
|
+
[x: `bytes13[${string}]`]: undefined;
|
|
53
|
+
[x: `bytes12[${string}]`]: undefined;
|
|
54
54
|
[x: `int[${string}]`]: undefined;
|
|
55
55
|
[x: `int8[${string}]`]: undefined;
|
|
56
|
-
[x: `int16[${string}]`]: undefined;
|
|
57
|
-
[x: `int24[${string}]`]: undefined;
|
|
58
|
-
[x: `int32[${string}]`]: undefined;
|
|
59
56
|
[x: `int40[${string}]`]: undefined;
|
|
57
|
+
[x: `int32[${string}]`]: undefined;
|
|
58
|
+
[x: `int24[${string}]`]: undefined;
|
|
59
|
+
[x: `int16[${string}]`]: undefined;
|
|
60
60
|
[x: `int48[${string}]`]: undefined;
|
|
61
61
|
[x: `int56[${string}]`]: undefined;
|
|
62
62
|
[x: `int64[${string}]`]: undefined;
|
|
@@ -85,9 +85,9 @@ export declare class LocalAccountSigner<T extends HDAccount | PrivateKeyAccount
|
|
|
85
85
|
[x: `int248[${string}]`]: undefined;
|
|
86
86
|
[x: `int256[${string}]`]: undefined;
|
|
87
87
|
[x: `uint[${string}]`]: undefined;
|
|
88
|
-
[x: `uint16[${string}]`]: undefined;
|
|
89
|
-
[x: `uint24[${string}]`]: undefined;
|
|
90
88
|
[x: `uint40[${string}]`]: undefined;
|
|
89
|
+
[x: `uint24[${string}]`]: undefined;
|
|
90
|
+
[x: `uint16[${string}]`]: undefined;
|
|
91
91
|
[x: `uint56[${string}]`]: undefined;
|
|
92
92
|
[x: `uint72[${string}]`]: undefined;
|
|
93
93
|
[x: `uint80[${string}]`]: undefined;
|
|
@@ -134,30 +134,30 @@ export declare class LocalAccountSigner<T extends HDAccount | PrivateKeyAccount
|
|
|
134
134
|
bytes9?: undefined;
|
|
135
135
|
bytes10?: undefined;
|
|
136
136
|
bytes25?: undefined;
|
|
137
|
+
bytes31?: undefined;
|
|
138
|
+
bytes30?: undefined;
|
|
139
|
+
bytes29?: undefined;
|
|
140
|
+
bytes28?: undefined;
|
|
141
|
+
bytes27?: undefined;
|
|
142
|
+
bytes26?: undefined;
|
|
143
|
+
bytes24?: undefined;
|
|
144
|
+
bytes23?: undefined;
|
|
145
|
+
bytes22?: undefined;
|
|
146
|
+
bytes21?: undefined;
|
|
147
|
+
bytes20?: undefined;
|
|
148
|
+
bytes19?: undefined;
|
|
137
149
|
bytes18?: undefined;
|
|
138
|
-
bytes12?: undefined;
|
|
139
|
-
bytes13?: undefined;
|
|
140
|
-
bytes14?: undefined;
|
|
141
|
-
bytes15?: undefined;
|
|
142
|
-
bytes16?: undefined;
|
|
143
150
|
bytes17?: undefined;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
bytes24?: undefined;
|
|
150
|
-
bytes26?: undefined;
|
|
151
|
-
bytes27?: undefined;
|
|
152
|
-
bytes28?: undefined;
|
|
153
|
-
bytes29?: undefined;
|
|
154
|
-
bytes30?: undefined;
|
|
155
|
-
bytes31?: undefined;
|
|
151
|
+
bytes16?: undefined;
|
|
152
|
+
bytes15?: undefined;
|
|
153
|
+
bytes14?: undefined;
|
|
154
|
+
bytes13?: undefined;
|
|
155
|
+
bytes12?: undefined;
|
|
156
156
|
int8?: undefined;
|
|
157
|
-
int16?: undefined;
|
|
158
|
-
int24?: undefined;
|
|
159
|
-
int32?: undefined;
|
|
160
157
|
int40?: undefined;
|
|
158
|
+
int32?: undefined;
|
|
159
|
+
int24?: undefined;
|
|
160
|
+
int16?: undefined;
|
|
161
161
|
int48?: undefined;
|
|
162
162
|
int56?: undefined;
|
|
163
163
|
int64?: undefined;
|
|
@@ -185,9 +185,9 @@ export declare class LocalAccountSigner<T extends HDAccount | PrivateKeyAccount
|
|
|
185
185
|
int240?: undefined;
|
|
186
186
|
int248?: undefined;
|
|
187
187
|
int256?: undefined;
|
|
188
|
-
uint16?: undefined;
|
|
189
|
-
uint24?: undefined;
|
|
190
188
|
uint40?: undefined;
|
|
189
|
+
uint24?: undefined;
|
|
190
|
+
uint16?: undefined;
|
|
191
191
|
uint56?: undefined;
|
|
192
192
|
uint72?: undefined;
|
|
193
193
|
uint80?: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-account.js","sourceRoot":"","sources":["../../../src/signer/local-account.ts"],"names":[],"mappings":";;;AAUA,4CAAuE;AAMvE,MAAa,kBAAkB;
|
|
1
|
+
{"version":3,"file":"local-account.js","sourceRoot":"","sources":["../../../src/signer/local-account.ts"],"names":[],"mappings":";;;AAUA,4CAAuE;AAMvE,MAAa,kBAAkB;IAsB7B,YAAY,KAAQ;QAlBpB;;;;;WAAS;QACT;;;;;WAAmB;QAqCV;;;;mBAAoE,CAC3E,OAAO,EACP,EAAE;gBACF,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;YAC7C,CAAC;WAAC;QAsBO;;;;mBAAgB,KAAK,EAI5B,MAAqD,EACvC,EAAE;gBAChB,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAC1C,CAAC;WAAC;QAgBO;;;;mBAAa,KAAK,IAA4B,EAAE;gBACvD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;YAC5B,CAAC;WAAC;QAtEA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC;IAC/B,CAAC;IAqFD,MAAM,CAAC,uBAAuB,CAC5B,GAAW,EACX,IAAgB;QAEhB,MAAM,MAAM,GAAG,IAAA,4BAAiB,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC5C,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAeG,MAAM,CAAC,yBAAyB,CAClC,GAAQ;QAER,MAAM,MAAM,GAAG,IAAA,8BAAmB,EAAC,GAAG,CAAC,CAAC;QACxC,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;CACF;AAzID,gDAyIC","sourcesContent":["import {\n type HDAccount,\n type HDOptions,\n type Hex,\n type LocalAccount,\n type PrivateKeyAccount,\n type SignableMessage,\n type TypedData,\n type TypedDataDefinition,\n} from \"viem\";\nimport { mnemonicToAccount, privateKeyToAccount } from \"viem/accounts\";\nimport type { SmartAccountSigner } from \"./types.js\";\n\n/**\n * Represents a local account signer and provides methods to sign messages and transactions, as well as static methods to create the signer from mnemonic or private key.\n */\nexport class LocalAccountSigner<\n T extends HDAccount | PrivateKeyAccount | LocalAccount\n> implements SmartAccountSigner<T>\n{\n inner: T;\n signerType: string;\n\n /**\n * A function to initialize an object with an inner parameter and derive a signerType from it.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { privateKeyToAccount, generatePrivateKey } from \"viem\";\n *\n * const signer = new LocalAccountSigner(\n * privateKeyToAccount(generatePrivateKey()),\n * );\n * ```\n *\n * @param {T} inner The inner parameter containing the necessary data\n */\n constructor(inner: T) {\n this.inner = inner;\n this.signerType = inner.type; // type: \"local\"\n }\n\n /**\n * Signs the provided message using the inner signMessage function.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\";\n *\n * const signer = LocalAccountSigner.mnemonicToAccountSigner(generatePrivateKey());\n * const signature = await signer.signMessage(\"Hello, world!\");\n * ```\n *\n * @param {string} message The message to be signed\n * @returns {Promise<any>} A promise that resolves to the signed message\n */\n readonly signMessage: (message: SignableMessage) => Promise<`0x${string}`> = (\n message\n ) => {\n return this.inner.signMessage({ message });\n };\n\n /**\n * Signs typed data using the given parameters.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\";\n *\n * const signer = LocalAccountSigner.mnemonicToAccountSigner(generatePrivateKey());\n * const signature = await signer.signTypedData({\n * domain: {},\n * types: {},\n * primaryType: \"\",\n * message: {},\n * });\n * ```\n *\n * @param {TypedDataDefinition<TTypedData, TPrimaryType>} params The parameters defining the typed data and primary type\n * @returns {Promise<Hex>} A promise that resolves to the signed data in hexadecimal format\n */\n readonly signTypedData = async <\n const TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string\n >(\n params: TypedDataDefinition<TTypedData, TPrimaryType>\n ): Promise<Hex> => {\n return this.inner.signTypedData(params);\n };\n\n /**\n * Returns the address of the inner object in a specific hexadecimal format.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\";\n *\n * const signer = LocalAccountSigner.mnemonicToAccountSigner(generatePrivateKey());\n * const address = await signer.getAddress();\n * ```\n *\n * @returns {Promise<Hex>} A promise that resolves to the address in the format `0x{string}`\n */\n readonly getAddress = async (): Promise<`0x${string}`> => {\n return this.inner.address;\n };\n\n /**\n * Creates a LocalAccountSigner using the provided mnemonic key and optional HD options.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generateMnemonic } from \"viem\";\n *\n * const signer = LocalAccountSigner.mnemonicToAccountSigner(generateMnemonic());\n * ```\n *\n * @param {string} key The mnemonic key to derive the account from.\n * @param {HDOptions} [opts] Optional HD options for deriving the account.\n * @returns {LocalAccountSigner<HDAccount>} A LocalAccountSigner object for the derived account.\n */\n static mnemonicToAccountSigner(\n key: string,\n opts?: HDOptions\n ): LocalAccountSigner<HDAccount> {\n const signer = mnemonicToAccount(key, opts);\n return new LocalAccountSigner(signer);\n }\n\n /**\n * Creates a `LocalAccountSigner` instance using the provided private key.\n *\n * @example\n * ```ts\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\";\n *\n * const signer = LocalAccountSigner.mnemonicToAccountSigner(generatePrivateKey());\n * ```\n *\n * @param {Hex} key The private key in hexadecimal format\n * @returns {LocalAccountSigner<PrivateKeyAccount>} An instance of `LocalAccountSigner` initialized with the provided private key\n */ static privateKeyToAccountSigner(\n key: Hex\n ): LocalAccountSigner<PrivateKeyAccount> {\n const signer = privateKeyToAccount(key);\n return new LocalAccountSigner(signer);\n }\n}\n"]}
|
|
@@ -33,31 +33,31 @@ export declare class WalletClientSigner implements SmartAccountSigner<WalletClie
|
|
|
33
33
|
[x: `bytes9[${string}]`]: undefined;
|
|
34
34
|
[x: `bytes10[${string}]`]: undefined;
|
|
35
35
|
[x: `bytes25[${string}]`]: undefined;
|
|
36
|
+
[x: `bytes31[${string}]`]: undefined;
|
|
37
|
+
[x: `bytes30[${string}]`]: undefined;
|
|
38
|
+
[x: `bytes29[${string}]`]: undefined;
|
|
39
|
+
[x: `bytes28[${string}]`]: undefined;
|
|
40
|
+
[x: `bytes27[${string}]`]: undefined;
|
|
41
|
+
[x: `bytes26[${string}]`]: undefined;
|
|
42
|
+
[x: `bytes24[${string}]`]: undefined;
|
|
43
|
+
[x: `bytes23[${string}]`]: undefined;
|
|
44
|
+
[x: `bytes22[${string}]`]: undefined;
|
|
45
|
+
[x: `bytes21[${string}]`]: undefined;
|
|
46
|
+
[x: `bytes20[${string}]`]: undefined;
|
|
47
|
+
[x: `bytes19[${string}]`]: undefined;
|
|
36
48
|
[x: `bytes18[${string}]`]: undefined;
|
|
37
|
-
[x: `bytes12[${string}]`]: undefined;
|
|
38
|
-
[x: `bytes13[${string}]`]: undefined;
|
|
39
|
-
[x: `bytes14[${string}]`]: undefined;
|
|
40
|
-
[x: `bytes15[${string}]`]: undefined;
|
|
41
|
-
[x: `bytes16[${string}]`]: undefined;
|
|
42
49
|
[x: `bytes17[${string}]`]: undefined;
|
|
43
|
-
[x: `
|
|
44
|
-
[x: `
|
|
45
|
-
[x: `
|
|
46
|
-
[x: `
|
|
47
|
-
[x: `
|
|
48
|
-
[x: `bytes24[${string}]`]: undefined;
|
|
49
|
-
[x: `bytes26[${string}]`]: undefined;
|
|
50
|
-
[x: `bytes27[${string}]`]: undefined;
|
|
51
|
-
[x: `bytes28[${string}]`]: undefined;
|
|
52
|
-
[x: `bytes29[${string}]`]: undefined;
|
|
53
|
-
[x: `bytes30[${string}]`]: undefined;
|
|
54
|
-
[x: `bytes31[${string}]`]: undefined;
|
|
50
|
+
[x: `bytes16[${string}]`]: undefined;
|
|
51
|
+
[x: `bytes15[${string}]`]: undefined;
|
|
52
|
+
[x: `bytes14[${string}]`]: undefined;
|
|
53
|
+
[x: `bytes13[${string}]`]: undefined;
|
|
54
|
+
[x: `bytes12[${string}]`]: undefined;
|
|
55
55
|
[x: `int[${string}]`]: undefined;
|
|
56
56
|
[x: `int8[${string}]`]: undefined;
|
|
57
|
-
[x: `int16[${string}]`]: undefined;
|
|
58
|
-
[x: `int24[${string}]`]: undefined;
|
|
59
|
-
[x: `int32[${string}]`]: undefined;
|
|
60
57
|
[x: `int40[${string}]`]: undefined;
|
|
58
|
+
[x: `int32[${string}]`]: undefined;
|
|
59
|
+
[x: `int24[${string}]`]: undefined;
|
|
60
|
+
[x: `int16[${string}]`]: undefined;
|
|
61
61
|
[x: `int48[${string}]`]: undefined;
|
|
62
62
|
[x: `int56[${string}]`]: undefined;
|
|
63
63
|
[x: `int64[${string}]`]: undefined;
|
|
@@ -86,9 +86,9 @@ export declare class WalletClientSigner implements SmartAccountSigner<WalletClie
|
|
|
86
86
|
[x: `int248[${string}]`]: undefined;
|
|
87
87
|
[x: `int256[${string}]`]: undefined;
|
|
88
88
|
[x: `uint[${string}]`]: undefined;
|
|
89
|
-
[x: `uint16[${string}]`]: undefined;
|
|
90
|
-
[x: `uint24[${string}]`]: undefined;
|
|
91
89
|
[x: `uint40[${string}]`]: undefined;
|
|
90
|
+
[x: `uint24[${string}]`]: undefined;
|
|
91
|
+
[x: `uint16[${string}]`]: undefined;
|
|
92
92
|
[x: `uint56[${string}]`]: undefined;
|
|
93
93
|
[x: `uint72[${string}]`]: undefined;
|
|
94
94
|
[x: `uint80[${string}]`]: undefined;
|
|
@@ -135,30 +135,30 @@ export declare class WalletClientSigner implements SmartAccountSigner<WalletClie
|
|
|
135
135
|
bytes9?: undefined;
|
|
136
136
|
bytes10?: undefined;
|
|
137
137
|
bytes25?: undefined;
|
|
138
|
+
bytes31?: undefined;
|
|
139
|
+
bytes30?: undefined;
|
|
140
|
+
bytes29?: undefined;
|
|
141
|
+
bytes28?: undefined;
|
|
142
|
+
bytes27?: undefined;
|
|
143
|
+
bytes26?: undefined;
|
|
144
|
+
bytes24?: undefined;
|
|
145
|
+
bytes23?: undefined;
|
|
146
|
+
bytes22?: undefined;
|
|
147
|
+
bytes21?: undefined;
|
|
148
|
+
bytes20?: undefined;
|
|
149
|
+
bytes19?: undefined;
|
|
138
150
|
bytes18?: undefined;
|
|
139
|
-
bytes12?: undefined;
|
|
140
|
-
bytes13?: undefined;
|
|
141
|
-
bytes14?: undefined;
|
|
142
|
-
bytes15?: undefined;
|
|
143
|
-
bytes16?: undefined;
|
|
144
151
|
bytes17?: undefined;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
bytes24?: undefined;
|
|
151
|
-
bytes26?: undefined;
|
|
152
|
-
bytes27?: undefined;
|
|
153
|
-
bytes28?: undefined;
|
|
154
|
-
bytes29?: undefined;
|
|
155
|
-
bytes30?: undefined;
|
|
156
|
-
bytes31?: undefined;
|
|
152
|
+
bytes16?: undefined;
|
|
153
|
+
bytes15?: undefined;
|
|
154
|
+
bytes14?: undefined;
|
|
155
|
+
bytes13?: undefined;
|
|
156
|
+
bytes12?: undefined;
|
|
157
157
|
int8?: undefined;
|
|
158
|
-
int16?: undefined;
|
|
159
|
-
int24?: undefined;
|
|
160
|
-
int32?: undefined;
|
|
161
158
|
int40?: undefined;
|
|
159
|
+
int32?: undefined;
|
|
160
|
+
int24?: undefined;
|
|
161
|
+
int16?: undefined;
|
|
162
162
|
int48?: undefined;
|
|
163
163
|
int56?: undefined;
|
|
164
164
|
int64?: undefined;
|
|
@@ -186,9 +186,9 @@ export declare class WalletClientSigner implements SmartAccountSigner<WalletClie
|
|
|
186
186
|
int240?: undefined;
|
|
187
187
|
int248?: undefined;
|
|
188
188
|
int256?: undefined;
|
|
189
|
-
uint16?: undefined;
|
|
190
|
-
uint24?: undefined;
|
|
191
189
|
uint40?: undefined;
|
|
190
|
+
uint24?: undefined;
|
|
191
|
+
uint16?: undefined;
|
|
192
192
|
uint56?: undefined;
|
|
193
193
|
uint72?: undefined;
|
|
194
194
|
uint80?: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet-client.js","sourceRoot":"","sources":["../../../src/signer/wallet-client.ts"],"names":[],"mappings":";;;AAAA,+BAOc;AACd,mDAA6D;AAM7D,MAAa,kBAAkB;
|
|
1
|
+
{"version":3,"file":"wallet-client.js","sourceRoot":"","sources":["../../../src/signer/wallet-client.ts"],"names":[],"mappings":";;;AAAA,+BAOc;AACd,mDAA6D;AAM7D,MAAa,kBAAkB;IAyB7B,YAAY,MAAoB,EAAE,UAAkB;QAxBpD;;;;;WAAmB;QACnB;;;;;WAAoB;QAmDpB;;;;mBAA2C,KAAK,IAAI,EAAE;gBACpD,IAAI,SAAS,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;gBAChD,OAAO,IAAA,iBAAU,EAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;YAClC,CAAC;WAAC;QAuBO;;;;mBACP,KAAK,EAAE,OAAO,EAAE,EAAE;gBAChB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;gBAEhE,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;YACtD,CAAC;WAAC;QA6BJ;;;;mBAAgB,KAAK,EAInB,SAAwD,EAC1C,EAAE;gBAChB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;gBAEhE,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;oBAC9B,OAAO;oBACP,GAAG,SAAS;iBACb,CAAC,CAAC;YACL,CAAC;WAAC;QAnGA,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;QACpB,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,kCAAsB,CAAC,UAAU,CAAC,CAAC;QAC/C,CAAC;QACD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CA+FF;AA9HD,gDA8HC","sourcesContent":["import {\n getAddress,\n type Hex,\n type SignableMessage,\n type TypedData,\n type TypedDataDefinition,\n type WalletClient,\n} from \"viem\";\nimport { InvalidSignerTypeError } from \"../errors/signer.js\";\nimport type { SmartAccountSigner } from \"./types\";\n\n/**\n * Represents a wallet client signer for smart accounts, providing methods to get the address, sign messages, and sign typed data.\n */\nexport class WalletClientSigner implements SmartAccountSigner<WalletClient> {\n signerType: string;\n inner: WalletClient;\n\n /**\n * Initializes a signer with a given wallet client and signer type.\n *\n * @example\n * ```ts\n * import { WalletClientSigner } from \"@aa-sdk/core\";\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum!)\n * });\n *\n * const signer = new WalletClientSigner(client, 'wallet');\n * ```\n *\n * @param {WalletClient} client The wallet client to interact with\n * @param {string} signerType The type of signer; must be a valid signer type, otherwise an error will be thrown\n * @throws {InvalidSignerTypeError} If the signer type is invalid\n */\n constructor(client: WalletClient, signerType: string) {\n this.inner = client;\n if (!signerType) {\n throw new InvalidSignerTypeError(signerType);\n }\n this.signerType = signerType;\n }\n\n /**\n * Asynchronously retrieves addresses from the inner object and returns the first address after applying the `getAddress` function.\n *\n * @example\n * ```ts\n * import { WalletClientSigner } from \"@aa-sdk/core\";\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum!)\n * });\n *\n * const signer = new WalletClientSigner(client, 'wallet');\n * console.log(await signer.getAddress());\n * ```\n *\n * @returns {Promise<string>} A promise that resolves to the first address after being processed by the `getAddress` function.\n */\n getAddress: () => Promise<`0x${string}`> = async () => {\n let addresses = await this.inner.getAddresses();\n return getAddress(addresses[0]);\n };\n\n /**\n * Signs a message using the account's signing method.\n *\n * @example\n * ```ts\n * import { WalletClientSigner } from \"@aa-sdk/core\";\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum!)\n * });\n *\n * const signer = new WalletClientSigner(client, 'wallet');\n * console.log(await signer.signMessage(\"hello\"));\n * ```\n *\n * @param {string} message the message string that needs to be signed\n * @returns {Promise<string>} a promise that resolves to the signed message\n */\n readonly signMessage: (message: SignableMessage) => Promise<`0x${string}`> =\n async (message) => {\n const account = this.inner.account ?? (await this.getAddress());\n\n return this.inner.signMessage({ message, account });\n };\n\n /**\n * Signs the provided typed data using the account's private key.\n *\n * @example\n * ```ts\n * import { WalletClientSigner } from \"@aa-sdk/core\";\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum!)\n * });\n *\n * const signer = new WalletClientSigner(client, 'wallet');\n * console.log(await signer.signTypedData({\n * types: {\n * \"Message\": [{ name: \"content\", type: \"string\" }]\n * },\n * primaryType: \"Message\",\n * message: { content: \"Hello\" },\n * }));\n * ```\n *\n * @param {TypedDataDefinition<TTypedData, TPrimaryType>} typedData The typed data to be signed\n * @returns {Promise<Hex>} A promise that resolves to a hex string representing the signed data\n */\n signTypedData = async <\n const TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string\n >(\n typedData: TypedDataDefinition<TTypedData, TPrimaryType>\n ): Promise<Hex> => {\n const account = this.inner.account ?? (await this.getAddress());\n\n return this.inner.signTypedData({\n account,\n ...typedData,\n });\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split.js","sourceRoot":"","sources":["../../../src/transport/split.ts"],"names":[],"mappings":";;;AAAA,+BAAoE;AA0C7D,MAAM,KAAK,GAAG,CAAC,MAA4B,EAAmB,EAAE;IACrE,MAAM,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAC1D,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YAC9B,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC;gBAC9D,MAAM,IAAI,KAAK,CACb,uDAAuD,CACxD,CAAC;YACJ,CAAC;YAED,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,IAAI,GAAG,EAAqB,CAAC,CAAC;IAEjC,OAAO,CAAC,IAAI,EAAE,EAAE,CACd,IAAA,aAAM,EAAC;QACL,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,iBAAiB,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACvD,IAAI,iBAAiB,IAAI,IAAI,EAAE,CAAC;gBAC9B,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC/C,CAAC;YAED,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7C,CAAC;KACF,CAAC,CAAC,IAAI,CAAC,CAAC;AACb,CAAC,CAAC;AA1BW,QAAA,KAAK,SA0BhB","sourcesContent":["import { custom, type CustomTransport, type Transport } from \"viem\";\n\nexport interface SplitTransportParams {\n overrides: {\n methods: string[];\n transport: Transport;\n }[];\n fallback: Transport;\n}\n\n/**\n * The Split Transport allows you to split RPC traffic for specific methods across\n * different RPC providers. This is done by specifying the methods you want handled\n * specially as overrides and providing a fallback transport for all other methods.\n *\n * @example\n * ```ts\n * import { createPublicClient, http } from \"viem\";\n * import { split } from \"@aa-sdk/core\";\n *\n * const bundlerMethods = [\n * \"eth_sendUserOperation\",\n * \"eth_estimateUserOperationGas\",\n * \"eth_getUserOperationReceipt\",\n * \"eth_getUserOperationByHash\",\n * \"eth_supportedEntryPoints\"\n * ];\n *\n * const clientWithSplit = createPublicClient({\n * transport: split({\n * overrides: [{\n * methods: bundlerMethods,\n * transport: http(BUNDLER_RPC_URL)\n * }]\n * fallback: http(OTHER_RPC_URL)\n * }),\n * });\n * ```\n *\n * @param
|
|
1
|
+
{"version":3,"file":"split.js","sourceRoot":"","sources":["../../../src/transport/split.ts"],"names":[],"mappings":";;;AAAA,+BAAoE;AA0C7D,MAAM,KAAK,GAAG,CAAC,MAA4B,EAAmB,EAAE;IACrE,MAAM,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAC1D,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YAC9B,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC;gBAC9D,MAAM,IAAI,KAAK,CACb,uDAAuD,CACxD,CAAC;YACJ,CAAC;YAED,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,IAAI,GAAG,EAAqB,CAAC,CAAC;IAEjC,OAAO,CAAC,IAAI,EAAE,EAAE,CACd,IAAA,aAAM,EAAC;QACL,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,iBAAiB,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACvD,IAAI,iBAAiB,IAAI,IAAI,EAAE,CAAC;gBAC9B,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC/C,CAAC;YAED,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7C,CAAC;KACF,CAAC,CAAC,IAAI,CAAC,CAAC;AACb,CAAC,CAAC;AA1BW,QAAA,KAAK,SA0BhB","sourcesContent":["import { custom, type CustomTransport, type Transport } from \"viem\";\n\nexport interface SplitTransportParams {\n overrides: {\n methods: string[];\n transport: Transport;\n }[];\n fallback: Transport;\n}\n\n/**\n * The Split Transport allows you to split RPC traffic for specific methods across\n * different RPC providers. This is done by specifying the methods you want handled\n * specially as overrides and providing a fallback transport for all other methods.\n *\n * @example\n * ```ts\n * import { createPublicClient, http } from \"viem\";\n * import { split } from \"@aa-sdk/core\";\n *\n * const bundlerMethods = [\n * \"eth_sendUserOperation\",\n * \"eth_estimateUserOperationGas\",\n * \"eth_getUserOperationReceipt\",\n * \"eth_getUserOperationByHash\",\n * \"eth_supportedEntryPoints\"\n * ];\n *\n * const clientWithSplit = createPublicClient({\n * transport: split({\n * overrides: [{\n * methods: bundlerMethods,\n * transport: http(BUNDLER_RPC_URL)\n * }]\n * fallback: http(OTHER_RPC_URL)\n * }),\n * });\n * ```\n *\n * @param {SplitTransportParams} params split transport configuration containing the methods overrides and fallback transport\n * @returns {CustomTransport} a viem Transport that splits traffic\n */\nexport const split = (params: SplitTransportParams): CustomTransport => {\n const overrideMap = params.overrides.reduce((accum, curr) => {\n curr.methods.forEach((method) => {\n if (accum.has(method) && accum.get(method) !== curr.transport) {\n throw new Error(\n \"A method cannot be handled by more than one transport\"\n );\n }\n\n accum.set(method, curr.transport);\n });\n\n return accum;\n }, new Map<string, Transport>());\n\n return (opts) =>\n custom({\n request: async (args) => {\n const transportOverride = overrideMap.get(args.method);\n if (transportOverride != null) {\n return transportOverride(opts).request(args);\n }\n\n return params.fallback(opts).request(args);\n },\n })(opts);\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bigint.js","sourceRoot":"","sources":["../../../src/utils/bigint.ts"],"names":[],"mappings":";;;AAAA,+BAAwC;AAExC,2CAA2C;AAQpC,MAAM,SAAS,GAAG,CAAC,GAAG,IAAc,EAAU,EAAE;IACrD,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC,CAAC;AANW,QAAA,SAAS,aAMpB;AAQK,MAAM,SAAS,GAAG,CAAC,GAAG,IAAc,EAAU,EAAE;IACrD,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC,CAAC;AANW,QAAA,SAAS,aAMpB;AAUK,MAAM,WAAW,GAAG,CACzB,KAAmB,EACnB,KAAsC,EACtC,KAAsC,
|
|
1
|
+
{"version":3,"file":"bigint.js","sourceRoot":"","sources":["../../../src/utils/bigint.ts"],"names":[],"mappings":"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","sourcesContent":["import { keccak256, toHex } from \"viem\";\nimport type { BigNumberish, Multiplier } from \"../types\";\nimport { isMultiplier } from \"./schema.js\";\n\n/**\n * Returns the max bigint in a list of bigints\n *\n * @param {bigint[]} args a list of bigints to get the max of\n * @returns {bigint} the max bigint in the list\n */\nexport const bigIntMax = (...args: bigint[]): bigint => {\n if (!args.length) {\n throw new Error(\"bigIntMax requires at least one argument\");\n }\n\n return args.reduce((m, c) => (m > c ? m : c));\n};\n\n/**\n * Returns the min bigint in a list of bigints\n *\n * @param {bigint[]} args a list of bigints to get the max of\n * @returns {bigint} the min bigint in the list\n */\nexport const bigIntMin = (...args: bigint[]): bigint => {\n if (!args.length) {\n throw new Error(\"bigIntMin requires at least one argument\");\n }\n\n return args.reduce((m, c) => (m < c ? m : c));\n};\n\n/**\n * Given a bigint and a min-max range, returns the min-max clamped bigint value\n *\n * @param {BigNumberish} value a bigint value to clamp\n * @param {BigNumberish | undefined} lower lower bound min max tuple value\n * @param {BigNumberish | undefined} upper upper bound min max tuple value\n * @returns {bigint} the clamped bigint value per given range\n */\nexport const bigIntClamp = (\n value: BigNumberish,\n lower: BigNumberish | null | undefined,\n upper: BigNumberish | null | undefined\n): bigint => {\n lower = lower != null ? BigInt(lower) : null;\n upper = upper != null ? BigInt(upper) : null;\n\n if (upper != null && lower != null && upper < lower) {\n throw new Error(\n `invalid range: upper bound ${upper} is less than lower bound ${lower}`\n );\n }\n\n let ret = BigInt(value);\n if (lower != null && lower > ret) {\n ret = lower;\n }\n if (upper != null && upper < ret) {\n ret = upper;\n }\n return ret;\n};\n\nexport enum RoundingMode {\n ROUND_DOWN = 0,\n ROUND_UP = 1,\n}\n\n/**\n * Given a bigint and a number (which can be a float), returns the bigint value.\n * Note: this function has loss and will round down to the nearest integer.\n *\n * @param {BigNumberish} base - the number to be multiplied\n * @param {number} multiplier - the amount to multiply by\n * @param {RoundingMode} roundingMode - the rounding mode to use when calculating the percent. defaults to ROUND_UP\n * @returns {bigint} the bigint value of the multiplication with the number rounded by the rounding mode\n */\nexport const bigIntMultiply = (\n base: BigNumberish,\n multiplier: Multiplier[\"multiplier\"],\n roundingMode: RoundingMode = RoundingMode.ROUND_UP\n) => {\n if (!isMultiplier({ multiplier })) {\n throw new Error(\n \"bigIntMultiply requires a multiplier validated number as the second argument\"\n );\n }\n\n // Get decimal places of b. Max decimal places is defined by the MultiplerSchema.\n const decimalPlaces = multiplier.toString().split(\".\")[1]?.length ?? 0;\n const val =\n roundingMode === RoundingMode.ROUND_UP\n ? BigInt(base) * BigInt(multiplier * 10 ** decimalPlaces) +\n BigInt(10 ** decimalPlaces - 1)\n : BigInt(base) * BigInt(multiplier * 10 ** decimalPlaces);\n\n return val / BigInt(10 ** decimalPlaces);\n};\n\n/**\n * Useful if you want to use a string, such as a user's email address, as salt to generate a unique SmartAccount per user.\n *\n * example:\n * ```\n * const salt = stringToIndex(\"alice@example.com\");\n *\n * export const account = new SimpleSmartContractAccount({\n * index: salt,\n * // other args omitted...\n * });\n * ```\n *\n * @param {string} phrase -- any string value.\n * @returns {bigint} the bigint value of the hashed string\n */\nexport const stringToIndex = (phrase: string): bigint =>\n BigInt(keccak256(toHex(phrase)));\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../../src/utils/bytes.ts"],"names":[],"mappings":";;;AAgBO,MAAM,SAAS,GAAG,CAAC,KAAU,EAAE,OAAsB,EAAE,EAAO,EAAE;IACrE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IAC/B,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAElD,OAAO,KAAK,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;AACxC,CAAC,CAAC;AANW,QAAA,SAAS,aAMpB","sourcesContent":["import type { Hex } from \"viem\";\n\ntype TakeBytesOpts = {\n count?: number;\n offset?: number;\n};\n\n/**\n * Given a bytes string, returns a slice of the bytes\n *\n * @param bytes - the hex string representing bytes\n * @param opts - optional parameters for slicing the bytes\n * @param opts.offset - the offset in bytes to start slicing from\n * @param opts.count - the number of bytes to slice\n * @returns the sliced bytes\n */\nexport const takeBytes = (bytes: Hex, opts: TakeBytesOpts = {}): Hex => {\n const { offset, count } = opts;\n const start = (offset ? offset * 2 : 0) + 2; // add 2 to skip the 0x prefix\n const end = count ? start + count * 2 : undefined;\n\n return `0x${bytes.slice(start, end)}`;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../../src/utils/bytes.ts"],"names":[],"mappings":";;;AAgBO,MAAM,SAAS,GAAG,CAAC,KAAU,EAAE,OAAsB,EAAE,EAAO,EAAE;IACrE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IAC/B,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAElD,OAAO,KAAK,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;AACxC,CAAC,CAAC;AANW,QAAA,SAAS,aAMpB","sourcesContent":["import type { Hex } from \"viem\";\n\ntype TakeBytesOpts = {\n count?: number;\n offset?: number;\n};\n\n/**\n * Given a bytes string, returns a slice of the bytes\n *\n * @param {Hex} bytes - the hex string representing bytes\n * @param {TakeBytesOpts} opts - optional parameters for slicing the bytes\n * @param {number} opts.offset - the offset in bytes to start slicing from\n * @param {number} opts.count - the number of bytes to slice\n * @returns {Hex} the sliced bytes\n */\nexport const takeBytes = (bytes: Hex, opts: TakeBytesOpts = {}): Hex => {\n const { offset, count } = opts;\n const start = (offset ? offset * 2 : 0) + 2; // add 2 to skip the 0x prefix\n const end = count ? start + count * 2 : undefined;\n\n return `0x${bytes.slice(start, end)}`;\n};\n"]}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type {
|
|
3
|
-
import type { UserOperationFeeOptions } from "../types";
|
|
4
|
-
export declare const getDefaultSimpleAccountFactoryAddress: (chain: Chain, version?: EntryPointVersion) => Address;
|
|
1
|
+
import { type Chain } from "viem";
|
|
2
|
+
import type { UserOperationFeeOptions } from "../types.js";
|
|
5
3
|
export declare const minPriorityFeePerBidDefaults: Map<number, bigint>;
|
|
6
4
|
export declare const getDefaultUserOperationFeeOptions: (chain: Chain) => UserOperationFeeOptions;
|
|
@@ -1,51 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDefaultUserOperationFeeOptions = exports.minPriorityFeePerBidDefaults =
|
|
4
|
-
const
|
|
5
|
-
const index_js_2 = require("../entrypoint/index.js");
|
|
6
|
-
const account_js_1 = require("../errors/account.js");
|
|
7
|
-
const getDefaultSimpleAccountFactoryAddress = (chain, version = index_js_2.defaultEntryPointVersion) => {
|
|
8
|
-
switch (version) {
|
|
9
|
-
case "0.6.0":
|
|
10
|
-
switch (chain.id) {
|
|
11
|
-
case index_js_1.mainnet.id:
|
|
12
|
-
case index_js_1.polygon.id:
|
|
13
|
-
case index_js_1.polygonAmoy.id:
|
|
14
|
-
case index_js_1.optimism.id:
|
|
15
|
-
case index_js_1.optimismSepolia.id:
|
|
16
|
-
case index_js_1.arbitrum.id:
|
|
17
|
-
case index_js_1.arbitrumSepolia.id:
|
|
18
|
-
case index_js_1.base.id:
|
|
19
|
-
case index_js_1.baseGoerli.id:
|
|
20
|
-
case index_js_1.baseSepolia.id:
|
|
21
|
-
case index_js_1.fraxtal.id:
|
|
22
|
-
case index_js_1.fraxtalSepolia.id:
|
|
23
|
-
case index_js_1.zora.id:
|
|
24
|
-
case index_js_1.zoraSepolia.id:
|
|
25
|
-
return "0x15Ba39375ee2Ab563E8873C8390be6f2E2F50232";
|
|
26
|
-
case index_js_1.sepolia.id:
|
|
27
|
-
case index_js_1.goerli.id:
|
|
28
|
-
case index_js_1.polygonMumbai.id:
|
|
29
|
-
case index_js_1.optimismGoerli.id:
|
|
30
|
-
case index_js_1.arbitrumGoerli.id:
|
|
31
|
-
return "0x9406Cc6185a346906296840746125a0E44976454";
|
|
32
|
-
default:
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
break;
|
|
36
|
-
case "0.7.0":
|
|
37
|
-
switch (chain.id) {
|
|
38
|
-
default:
|
|
39
|
-
return "0x91E60e0613810449d098b0b5Ec8b51A0FE8c8985";
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
throw new account_js_1.DefaultFactoryNotDefinedError("SimpleAccount", chain, version);
|
|
43
|
-
};
|
|
44
|
-
exports.getDefaultSimpleAccountFactoryAddress = getDefaultSimpleAccountFactoryAddress;
|
|
3
|
+
exports.getDefaultUserOperationFeeOptions = exports.minPriorityFeePerBidDefaults = void 0;
|
|
4
|
+
const chains_1 = require("viem/chains");
|
|
45
5
|
exports.minPriorityFeePerBidDefaults = new Map([
|
|
46
|
-
[
|
|
47
|
-
[
|
|
48
|
-
[
|
|
6
|
+
[chains_1.arbitrum.id, 10000000n],
|
|
7
|
+
[chains_1.arbitrumGoerli.id, 10000000n],
|
|
8
|
+
[chains_1.arbitrumSepolia.id, 10000000n],
|
|
49
9
|
]);
|
|
50
10
|
const getDefaultUserOperationFeeOptions = (chain) => {
|
|
51
11
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../src/utils/defaults.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../src/utils/defaults.ts"],"names":[],"mappings":";;;AACA,wCAAwE;AAG3D,QAAA,4BAA4B,GAAG,IAAI,GAAG,CAAiB;IAClE,CAAC,iBAAQ,CAAC,EAAE,EAAE,SAAW,CAAC;IAC1B,CAAC,uBAAc,CAAC,EAAE,EAAE,SAAW,CAAC;IAChC,CAAC,wBAAe,CAAC,EAAE,EAAE,SAAW,CAAC;CAClC,CAAC,CAAC;AAEI,MAAM,iCAAiC,GAAG,CAC/C,KAAY,EACa,EAAE;IAC3B,OAAO;QACL,oBAAoB,EAAE;YACpB,GAAG,EAAE,oCAA4B,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,UAAY;YAC/D,UAAU,EAAE,IAAI;SACjB;KACF,CAAC;AACJ,CAAC,CAAC;AATW,QAAA,iCAAiC,qCAS5C","sourcesContent":["import { type Chain } from \"viem\";\nimport { arbitrum, arbitrumGoerli, arbitrumSepolia } from \"viem/chains\";\nimport type { UserOperationFeeOptions } from \"../types.js\";\n\nexport const minPriorityFeePerBidDefaults = new Map<number, bigint>([\n [arbitrum.id, 10_000_000n],\n [arbitrumGoerli.id, 10_000_000n],\n [arbitrumSepolia.id, 10_000_000n],\n]);\n\nexport const getDefaultUserOperationFeeOptions = (\n chain: Chain\n): UserOperationFeeOptions => {\n return {\n maxPriorityFeePerGas: {\n min: minPriorityFeePerBidDefaults.get(chain.id) ?? 100_000_000n,\n multiplier: 1.33,\n },\n };\n};\n"]}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import type { Chain } from "viem";
|
|
2
1
|
import type { PromiseOrValue } from "../types.js";
|
|
3
2
|
import type { RecordableKeys } from "./types.js";
|
|
4
|
-
export declare const AlchemyChainMap: Map<number, Chain>;
|
|
5
|
-
export declare const getChain: (chainId: number) => Chain;
|
|
6
3
|
export declare const asyncPipe: <S, O, F>(...fns: ((s: S, o?: O | undefined, f?: F | undefined) => Promise<S>)[]) => (s: S, o?: O | undefined, f?: F | undefined) => Promise<S>;
|
|
7
4
|
export type Deferrable<T> = {
|
|
8
5
|
[K in keyof T]: PromiseOrValue<T[K]>;
|