@deserialize/multi-vm-wallet 1.3.1 → 1.3.3
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/.claude/settings.local.json +7 -1
- package/dist/IChainWallet.d.ts +3 -3
- package/dist/constant.js +60 -16
- package/dist/constant.js.map +1 -1
- package/dist/evm/aa-service/index.d.ts +2 -2
- package/dist/evm/aa-service/index.js +1 -3
- package/dist/evm/aa-service/index.js.map +1 -1
- package/dist/evm/aa-service/lib/kernel-account.d.ts +2 -44
- package/dist/evm/aa-service/lib/kernel-account.js +42 -93
- package/dist/evm/aa-service/lib/kernel-account.js.map +1 -1
- package/dist/evm/aa-service/lib/session-keys.d.ts +14 -17
- package/dist/evm/aa-service/lib/session-keys.js +40 -58
- package/dist/evm/aa-service/lib/session-keys.js.map +1 -1
- package/dist/evm/aa-service/lib/type.d.ts +18 -1
- package/dist/evm/aa-service/lib/type.js.map +1 -1
- package/dist/evm/aa-service/services/account-abstraction.d.ts +7 -29
- package/dist/evm/aa-service/services/account-abstraction.js +12 -68
- package/dist/evm/aa-service/services/account-abstraction.js.map +1 -1
- package/dist/evm/aa-service/services/bundler.d.ts +4 -1
- package/dist/evm/aa-service/services/bundler.js +41 -7
- package/dist/evm/aa-service/services/bundler.js.map +1 -1
- package/dist/evm/evm.d.ts +164 -14
- package/dist/evm/evm.js +259 -80
- package/dist/evm/evm.js.map +1 -1
- package/dist/evm/smartWallet.d.ts +12 -61
- package/dist/evm/smartWallet.js +143 -184
- package/dist/evm/smartWallet.js.map +1 -1
- package/dist/evm/utils.js +1 -1
- package/dist/evm/utils.js.map +1 -1
- package/dist/helpers/index.d.ts +6 -1
- package/dist/helpers/index.js +116 -0
- package/dist/helpers/index.js.map +1 -1
- package/dist/privacy/artifact-manager.d.ts +117 -0
- package/dist/privacy/artifact-manager.js +251 -0
- package/dist/privacy/artifact-manager.js.map +1 -0
- package/dist/privacy/broadcaster-client.d.ts +166 -0
- package/dist/privacy/broadcaster-client.js +261 -0
- package/dist/privacy/broadcaster-client.js.map +1 -0
- package/dist/privacy/index.d.ts +34 -0
- package/dist/privacy/index.js +56 -0
- package/dist/privacy/index.js.map +1 -0
- package/dist/privacy/network-config.d.ts +57 -0
- package/dist/privacy/network-config.js +118 -0
- package/dist/privacy/network-config.js.map +1 -0
- package/dist/privacy/poi-helper.d.ts +161 -0
- package/dist/privacy/poi-helper.js +249 -0
- package/dist/privacy/poi-helper.js.map +1 -0
- package/dist/privacy/railgun-engine.d.ts +135 -0
- package/dist/privacy/railgun-engine.js +205 -0
- package/dist/privacy/railgun-engine.js.map +1 -0
- package/dist/privacy/railgun-privacy-wallet.d.ts +288 -0
- package/dist/privacy/railgun-privacy-wallet.js +539 -0
- package/dist/privacy/railgun-privacy-wallet.js.map +1 -0
- package/dist/privacy/types.d.ts +229 -0
- package/dist/privacy/types.js +26 -0
- package/dist/privacy/types.js.map +1 -0
- package/dist/savings/savings-manager.d.ts +126 -0
- package/dist/savings/savings-manager.js +234 -0
- package/dist/savings/savings-manager.js.map +1 -0
- package/dist/savings/smart-savings.d.ts +74 -0
- package/dist/savings/smart-savings.js +152 -0
- package/dist/savings/smart-savings.js.map +1 -0
- package/dist/savings/types.d.ts +125 -0
- package/dist/savings/types.js +9 -0
- package/dist/savings/types.js.map +1 -0
- package/dist/svm/svm.d.ts +19 -3
- package/dist/svm/svm.js +29 -17
- package/dist/svm/svm.js.map +1 -1
- package/dist/svm/utils.d.ts +2 -2
- package/dist/svm/utils.js +4 -4
- package/dist/svm/utils.js.map +1 -1
- package/dist/test.js +81 -22
- package/dist/test.js.map +1 -1
- package/dist/types.d.ts +14 -16
- package/dist/types.js.map +1 -1
- package/dist/vm.d.ts +14 -0
- package/dist/vm.js.map +1 -1
- package/package.json +6 -1
- package/utils/IChainWallet.ts +3 -3
- package/utils/constant.ts +63 -16
- package/utils/evm/aa-service/index.ts +1 -3
- package/utils/evm/aa-service/lib/kernel-account.ts +45 -136
- package/utils/evm/aa-service/lib/session-keys.ts +58 -60
- package/utils/evm/aa-service/lib/type.ts +19 -1
- package/utils/evm/aa-service/services/account-abstraction.ts +24 -76
- package/utils/evm/aa-service/services/bundler.ts +54 -11
- package/utils/evm/evm.ts +313 -110
- package/utils/evm/smartWallet.ts +124 -214
- package/utils/evm/utils.ts +2 -1
- package/utils/helpers/index.ts +138 -1
- package/utils/savings/savings-manager.ts +271 -0
- package/utils/savings/smart-savings.ts +184 -0
- package/utils/savings/types.ts +135 -0
- package/utils/svm/svm.ts +34 -25
- package/utils/svm/utils.ts +4 -10
- package/utils/test.ts +112 -24
- package/utils/types.ts +15 -17
- package/utils/vm.ts +10 -0
|
@@ -6,7 +6,13 @@
|
|
|
6
6
|
"Bash(npm run build:*)",
|
|
7
7
|
"Bash(timeout 60 npm run build:*)",
|
|
8
8
|
"Bash(npx ts-node:*)",
|
|
9
|
-
"Bash(npm install:*)"
|
|
9
|
+
"Bash(npm install:*)",
|
|
10
|
+
"Bash(timeout 60 npm run build:test:*)",
|
|
11
|
+
"Bash(npm run build:test:*)",
|
|
12
|
+
"Bash(wait)",
|
|
13
|
+
"WebSearch",
|
|
14
|
+
"WebFetch(domain:docs.pimlico.io)",
|
|
15
|
+
"WebFetch(domain:docs.railgun.org)"
|
|
10
16
|
],
|
|
11
17
|
"deny": [],
|
|
12
18
|
"ask": []
|
package/dist/IChainWallet.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EVMTransactionHistoryItem } from "./evm/transactionParsing";
|
|
2
2
|
import { SVMTransactionHistoryItem } from "./svm/transactionParsing";
|
|
3
|
-
import { Balance, ChainWalletConfig, TokenInfo, TransactionResult, UserTokenBalance, NFT
|
|
3
|
+
import { Balance, ChainWalletConfig, TokenInfo, TransactionResult, UserTokenBalance, NFT } from "./types";
|
|
4
4
|
export declare abstract class ChainWallet<AddressType, PrivateKeyType, ConnectionType> {
|
|
5
5
|
protected privateKey: PrivateKeyType;
|
|
6
6
|
config: ChainWalletConfig;
|
|
@@ -11,8 +11,8 @@ export declare abstract class ChainWallet<AddressType, PrivateKeyType, Connectio
|
|
|
11
11
|
abstract generateAddress(privateKey: PrivateKeyType): AddressType;
|
|
12
12
|
abstract getNativeBalance(): Promise<Balance>;
|
|
13
13
|
abstract getTokenBalance(tokenAddress: AddressType): Promise<Balance>;
|
|
14
|
-
abstract transferNative(to: AddressType, amount: number
|
|
15
|
-
abstract transferToken(tokenAddress: TokenInfo, to: AddressType, amount: number
|
|
14
|
+
abstract transferNative(to: AddressType, amount: number): Promise<TransactionResult>;
|
|
15
|
+
abstract transferToken(tokenAddress: TokenInfo, to: AddressType, amount: number): Promise<TransactionResult>;
|
|
16
16
|
abstract swap(tokenAddress: TokenInfo, to: AddressType, amount: number, slippage?: number): Promise<TransactionResult>;
|
|
17
17
|
abstract discoverToken(): Promise<UserTokenBalance<AddressType>[]>;
|
|
18
18
|
abstract discoverNFT(): Promise<NFT[]>;
|
package/dist/constant.js
CHANGED
|
@@ -31,7 +31,7 @@ exports.DefaultChains = [{
|
|
|
31
31
|
}, {
|
|
32
32
|
chainId: 123456789,
|
|
33
33
|
name: "Solana",
|
|
34
|
-
rpcUrl: "https://solana-mainnet.g.alchemy.com/v2/
|
|
34
|
+
rpcUrl: "https://solana-mainnet.g.alchemy.com/v2/TFdA4BilCnKIwaqtypk0d",
|
|
35
35
|
explorerUrl: "https://explorer.solana.com",
|
|
36
36
|
nativeToken: {
|
|
37
37
|
name: "Solana",
|
|
@@ -45,7 +45,7 @@ exports.DefaultChains = [{
|
|
|
45
45
|
{
|
|
46
46
|
chainId: 1,
|
|
47
47
|
name: "Ethereum",
|
|
48
|
-
rpcUrl: "https://eth-mainnet.g.alchemy.com/v2/
|
|
48
|
+
rpcUrl: "https://eth-mainnet.g.alchemy.com/v2/TFdA4BilCnKIwaqtypk0d",
|
|
49
49
|
explorerUrl: "https://etherscan.io",
|
|
50
50
|
nativeToken: {
|
|
51
51
|
name: "Ether",
|
|
@@ -68,24 +68,25 @@ exports.DefaultChains = [{
|
|
|
68
68
|
testnet: false,
|
|
69
69
|
logoUrl: "https://bscscan.com/assets/bsc/images/svg/logos/token-light.svg?v=25.10.5.0",
|
|
70
70
|
vmType: "EVM"
|
|
71
|
-
}, {
|
|
72
|
-
chainId: 123456791,
|
|
73
|
-
name: "Eclipse",
|
|
74
|
-
rpcUrl: "https://mainnetbeta-rpc.eclipse.xyz",
|
|
75
|
-
explorerUrl: "https://explorer.eclipse.xyz/",
|
|
76
|
-
nativeToken: {
|
|
77
|
-
name: "Eclipse",
|
|
78
|
-
symbol: "ETH",
|
|
79
|
-
decimals: 9,
|
|
80
|
-
},
|
|
81
|
-
testnet: false,
|
|
82
|
-
logoUrl: "https://raw.githubusercontent.com/hyperlane-xyz/hyperlane-registry/a86c3b432b6f9ad7272ae09859f20eb3ade3bd6e/deployments/warp_routes/ES/logo.svg",
|
|
83
|
-
vmType: "SVM"
|
|
84
71
|
},
|
|
72
|
+
// {
|
|
73
|
+
// chainId: 123456791,
|
|
74
|
+
// name: "Eclipse",
|
|
75
|
+
// rpcUrl: "https://mainnetbeta-rpc.eclipse.xyz",
|
|
76
|
+
// explorerUrl: "https://explorer.eclipse.xyz/",
|
|
77
|
+
// nativeToken: {
|
|
78
|
+
// name: "Eclipse",
|
|
79
|
+
// symbol: "ETH",
|
|
80
|
+
// decimals: 9,
|
|
81
|
+
// },
|
|
82
|
+
// testnet: false,
|
|
83
|
+
// logoUrl: "https://raw.githubusercontent.com/hyperlane-xyz/hyperlane-registry/a86c3b432b6f9ad7272ae09859f20eb3ade3bd6e/deployments/warp_routes/ES/logo.svg",
|
|
84
|
+
// vmType: "SVM"
|
|
85
|
+
// },
|
|
85
86
|
{
|
|
86
87
|
chainId: chains_1.base.id,
|
|
87
88
|
name: chains_1.base.name,
|
|
88
|
-
rpcUrl:
|
|
89
|
+
rpcUrl: "https://base-mainnet.g.alchemy.com/v2/TFdA4BilCnKIwaqtypk0d",
|
|
89
90
|
explorerUrl: chains_1.base.blockExplorers?.default.url || "",
|
|
90
91
|
nativeToken: {
|
|
91
92
|
name: chains_1.base.nativeCurrency.name,
|
|
@@ -95,6 +96,49 @@ exports.DefaultChains = [{
|
|
|
95
96
|
testnet: chains_1.base.testnet,
|
|
96
97
|
logoUrl: "https://avatars.githubusercontent.com/u/108554348?s=200&v=4",
|
|
97
98
|
vmType: "EVM"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
chainId: 42161,
|
|
102
|
+
name: "Arbitrum One",
|
|
103
|
+
rpcUrl: "https://arbitrum-mainnet.g.alchemy.com/v2/TFdA4BilCnKIwaqtypk0d",
|
|
104
|
+
explorerUrl: "https://arbiscan.io",
|
|
105
|
+
nativeToken: {
|
|
106
|
+
name: "Ether",
|
|
107
|
+
symbol: "ETH",
|
|
108
|
+
decimals: 18,
|
|
109
|
+
},
|
|
110
|
+
testnet: false,
|
|
111
|
+
logoUrl: "https://arbiscan.io/images/svg/brands/arbitrum-light.svg?v=0.0.36",
|
|
112
|
+
vmType: "EVM"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
chainId: 10,
|
|
116
|
+
name: "Optimism",
|
|
117
|
+
rpcUrl: "https://optimism-mainnet.g.alchemy.com/v2/TFdA4BilCnKIwaqtypk0d",
|
|
118
|
+
explorerUrl: "https://optimistic.etherscan.io",
|
|
119
|
+
nativeToken: {
|
|
120
|
+
name: "Ether",
|
|
121
|
+
symbol: "ETH",
|
|
122
|
+
decimals: 18,
|
|
123
|
+
},
|
|
124
|
+
testnet: false,
|
|
125
|
+
logoUrl: "https://optimism.io/images/optimism-logo-light.svg",
|
|
126
|
+
vmType: "EVM"
|
|
127
|
+
},
|
|
128
|
+
//add for polygon
|
|
129
|
+
{
|
|
130
|
+
chainId: 137,
|
|
131
|
+
name: "Polygon",
|
|
132
|
+
rpcUrl: "https://polygon-mainnet.g.alchemy.com/v2/TFdA4BilCnKIwaqtypk0d",
|
|
133
|
+
explorerUrl: "https://polygonscan.com",
|
|
134
|
+
nativeToken: {
|
|
135
|
+
name: "MATIC",
|
|
136
|
+
symbol: "MATIC",
|
|
137
|
+
decimals: 18,
|
|
138
|
+
},
|
|
139
|
+
testnet: false,
|
|
140
|
+
logoUrl: "https://polygonscan.com/images/svg/brands/polygon-light.svg?v=0.0.36",
|
|
141
|
+
vmType: "EVM"
|
|
98
142
|
}
|
|
99
143
|
];
|
|
100
144
|
exports.TRANSACTION_TYPE = {
|
package/dist/constant.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constant.js","sourceRoot":"","sources":["../utils/constant.ts"],"names":[],"mappings":";;;AAAA,wCAAmC;AAGtB,QAAA,aAAa,GAAwB,CAAC;QAE/C,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,yBAAyB;QACjC,WAAW,EAAE,8BAA8B;QAC3C,WAAW,EAAE;YACT,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,MAAM;YACd,QAAQ,EAAE,EAAE;SACf;QACD,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,4EAA4E;QACrF,MAAM,EAAE,KAAK;KAChB,EAAE;QAEC,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,sBAAsB;QAC9B,WAAW,EAAE,0BAA0B;QACvC,WAAW,EAAE;YACT,IAAI,EAAE,YAAY;YAClB,MAAM,EAAE,IAAI;YACZ,QAAQ,EAAE,EAAE;SACf;QACD,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,uFAAuF;QAChG,MAAM,EAAE,KAAK;KAChB,EAAE;QACC,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,+DAA+D;QACvE,WAAW,EAAE,6BAA6B;QAC1C,WAAW,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,CAAC;SACd;QACD,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,wDAAwD;QACj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B,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,YAAY;IACxB,oBAAoB,EAAE,sBAAsB;IAC5C,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,kBAAkB,EAAE,oBAAoB;IACxC,iBAAiB,EAAE,mBAAmB;IACtC,mBAAmB,EAAE,qBAAqB;IAC1C,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;CAEZ,CAAA"}
|
|
@@ -8,9 +8,9 @@ export type { AAServiceConfig, CreateAccountOptions, SendTransactionOptions, Sen
|
|
|
8
8
|
export * from './lib/type';
|
|
9
9
|
export { BundlerManager, createBundlerManager, createBundlerService } from './services/bundler';
|
|
10
10
|
export type { BundlerConfig, BundlerService } from './services/bundler';
|
|
11
|
-
export { createKernel7702Account, createKernelAuthorization, sendKernelTransaction, sendBatchTransaction, waitForKernelReceipt
|
|
11
|
+
export { createKernel7702Account, createKernelAuthorization, sendKernelTransaction, sendBatchTransaction, waitForKernelReceipt } from './lib/kernel-account';
|
|
12
12
|
export { prepareInstallModule, prepareUninstallModule, prepareInstallSessionKey, prepareRevokeSessionKey, prepareInstallMultiSigValidator, installModule, uninstallModule, isModuleInstalled, createSessionKey, revokeSessionKey, installMultiSigValidator, MODULE_TYPE_IDS } from './lib/kernel-modules';
|
|
13
13
|
export type { ModuleType, InstallModuleConfig, UninstallModuleConfig, ModuleStatus, SessionKeyPermission, CreateSessionKeyConfig } from './lib/kernel-modules';
|
|
14
|
-
export { generateSessionKey,
|
|
14
|
+
export { generateSessionKey, createSessionKeyApproval, deserializeSessionKey, createSessionKeyClient, createUSDCTransferPermission, createETHTransferPermission } from './lib/session-keys';
|
|
15
15
|
export type { SessionKeyInfo, SessionKeyPermissionRule, CreateSessionKeyApprovalOptions, DeserializedSessionKey } from './lib/session-keys';
|
|
16
16
|
export { adaptZeroDevAccount, adaptSessionKeyAccount } from './lib/account-adapter';
|
|
@@ -19,7 +19,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
19
19
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.adaptSessionKeyAccount = exports.adaptZeroDevAccount = exports.createETHTransferPermission = exports.createUSDCTransferPermission = exports.createSessionKeyClient = exports.deserializeSessionKey = exports.createSessionKeyApproval = exports.
|
|
22
|
+
exports.adaptSessionKeyAccount = exports.adaptZeroDevAccount = exports.createETHTransferPermission = exports.createUSDCTransferPermission = exports.createSessionKeyClient = exports.deserializeSessionKey = exports.createSessionKeyApproval = exports.generateSessionKey = exports.MODULE_TYPE_IDS = exports.installMultiSigValidator = exports.revokeSessionKey = exports.createSessionKey = exports.isModuleInstalled = exports.uninstallModule = exports.installModule = exports.prepareInstallMultiSigValidator = exports.prepareRevokeSessionKey = exports.prepareInstallSessionKey = exports.prepareUninstallModule = exports.prepareInstallModule = exports.waitForKernelReceipt = exports.sendBatchTransaction = exports.sendKernelTransaction = exports.createKernelAuthorization = exports.createKernel7702Account = exports.createBundlerService = exports.createBundlerManager = exports.BundlerManager = exports.AccountAbstractionService = void 0;
|
|
23
23
|
// Singleton Service (Primary Interface)
|
|
24
24
|
var account_abstraction_1 = require("./services/account-abstraction");
|
|
25
25
|
Object.defineProperty(exports, "AccountAbstractionService", { enumerable: true, get: function () { return account_abstraction_1.AccountAbstractionService; } });
|
|
@@ -36,7 +36,6 @@ Object.defineProperty(exports, "createKernelAuthorization", { enumerable: true,
|
|
|
36
36
|
Object.defineProperty(exports, "sendKernelTransaction", { enumerable: true, get: function () { return kernel_account_1.sendKernelTransaction; } });
|
|
37
37
|
Object.defineProperty(exports, "sendBatchTransaction", { enumerable: true, get: function () { return kernel_account_1.sendBatchTransaction; } });
|
|
38
38
|
Object.defineProperty(exports, "waitForKernelReceipt", { enumerable: true, get: function () { return kernel_account_1.waitForKernelReceipt; } });
|
|
39
|
-
Object.defineProperty(exports, "sendSponsoredBatchTransaction", { enumerable: true, get: function () { return kernel_account_1.sendSponsoredBatchTransaction; } });
|
|
40
39
|
// Module Management (ERC-7579)
|
|
41
40
|
var kernel_modules_1 = require("./lib/kernel-modules");
|
|
42
41
|
// Prepare functions (for batching)
|
|
@@ -56,7 +55,6 @@ Object.defineProperty(exports, "MODULE_TYPE_IDS", { enumerable: true, get: funct
|
|
|
56
55
|
// EIP-7702 Session Keys (NEW Pattern)
|
|
57
56
|
var session_keys_1 = require("./lib/session-keys");
|
|
58
57
|
Object.defineProperty(exports, "generateSessionKey", { enumerable: true, get: function () { return session_keys_1.generateSessionKey; } });
|
|
59
|
-
Object.defineProperty(exports, "recreateSessionKey", { enumerable: true, get: function () { return session_keys_1.recreateSessionKey; } });
|
|
60
58
|
Object.defineProperty(exports, "createSessionKeyApproval", { enumerable: true, get: function () { return session_keys_1.createSessionKeyApproval; } });
|
|
61
59
|
Object.defineProperty(exports, "deserializeSessionKey", { enumerable: true, get: function () { return session_keys_1.deserializeSessionKey; } });
|
|
62
60
|
Object.defineProperty(exports, "createSessionKeyClient", { enumerable: true, get: function () { return session_keys_1.createSessionKeyClient; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../utils/evm/aa-service/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;AAEH,wCAAwC;AACxC,sEAA2E;AAAlE,gIAAA,yBAAyB,OAAA;AASlC,6CAA0B;AAE1B,oCAAoC;AACpC,8CAI4B;AAHxB,yGAAA,cAAc,OAAA;AACd,+GAAA,oBAAoB,OAAA;AACpB,+GAAA,oBAAoB,OAAA;AAIxB,4CAA4C;AAC5C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../utils/evm/aa-service/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;AAEH,wCAAwC;AACxC,sEAA2E;AAAlE,gIAAA,yBAAyB,OAAA;AASlC,6CAA0B;AAE1B,oCAAoC;AACpC,8CAI4B;AAHxB,yGAAA,cAAc,OAAA;AACd,+GAAA,oBAAoB,OAAA;AACpB,+GAAA,oBAAoB,OAAA;AAIxB,4CAA4C;AAC5C,uDAM8B;AAL1B,yHAAA,uBAAuB,OAAA;AACvB,2HAAA,yBAAyB,OAAA;AACzB,uHAAA,qBAAqB,OAAA;AACrB,sHAAA,oBAAoB,OAAA;AACpB,sHAAA,oBAAoB,OAAA;AAIxB,+BAA+B;AAC/B,uDAe8B;AAd1B,mCAAmC;AACnC,sHAAA,oBAAoB,OAAA;AACpB,wHAAA,sBAAsB,OAAA;AACtB,0HAAA,wBAAwB,OAAA;AACxB,yHAAA,uBAAuB,OAAA;AACvB,iIAAA,+BAA+B,OAAA;AAC/B,0CAA0C;AAC1C,+GAAA,aAAa,OAAA;AACb,iHAAA,eAAe,OAAA;AACf,mHAAA,iBAAiB,OAAA;AACjB,kHAAA,gBAAgB,OAAA;AAChB,kHAAA,gBAAgB,OAAA;AAChB,0HAAA,wBAAwB,OAAA;AACxB,iHAAA,eAAe,OAAA;AAWnB,sCAAsC;AACtC,mDAO4B;AANxB,kHAAA,kBAAkB,OAAA;AAClB,wHAAA,wBAAwB,OAAA;AACxB,qHAAA,qBAAqB,OAAA;AACrB,sHAAA,sBAAsB,OAAA;AACtB,4HAAA,4BAA4B,OAAA;AAC5B,2HAAA,2BAA2B,OAAA;AAS/B,yCAAyC;AACzC,yDAG+B;AAF3B,sHAAA,mBAAmB,OAAA;AACnB,yHAAA,sBAAsB,OAAA"}
|
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
import { Chain, Hex, SignAuthorizationReturnType } from 'viem';
|
|
8
8
|
import { PrivateKeyAccount } from 'viem/accounts';
|
|
9
9
|
import { BundlerManager } from '../services/bundler';
|
|
10
|
-
import { BatchTransactionConfig,
|
|
10
|
+
import { BatchTransactionConfig, KernelAccountConfig, KernelAccountInstance, KernelVersion, SingleTransactionConfig } from './type';
|
|
11
11
|
export type { Call, KernelAccountInstance, EntryPointVersion, KernelVersion, KernelAccountConfig, BatchTransactionConfig, SingleTransactionConfig } from './type';
|
|
12
12
|
export declare function createKernel7702Account(config: KernelAccountConfig): Promise<KernelAccountInstance>;
|
|
13
13
|
export declare function createKernelAuthorization(config: {
|
|
14
14
|
owner: PrivateKeyAccount;
|
|
15
15
|
chain: Chain;
|
|
16
|
-
bundlerManager: BundlerManager;
|
|
17
16
|
kernelVersion?: KernelVersion;
|
|
17
|
+
aaConfig?: import('./type').AA_SupportConfig;
|
|
18
18
|
}): Promise<SignAuthorizationReturnType | undefined>;
|
|
19
19
|
/**
|
|
20
20
|
* Send batch transaction (RECOMMENDED for smart accounts)
|
|
@@ -47,45 +47,3 @@ export declare function waitForKernelReceipt(config: {
|
|
|
47
47
|
chain: Chain;
|
|
48
48
|
bundlerManager: BundlerManager;
|
|
49
49
|
}): Promise<any>;
|
|
50
|
-
/**
|
|
51
|
-
* Configuration for sponsored batch transaction
|
|
52
|
-
*/
|
|
53
|
-
export interface SponsoredBatchTransactionConfig {
|
|
54
|
-
ownerAuthorization: SignAuthorizationReturnType;
|
|
55
|
-
calls: Call[];
|
|
56
|
-
feePayerPrivateKey: Hex;
|
|
57
|
-
bundlerUrl: string;
|
|
58
|
-
paymasterUrl?: string;
|
|
59
|
-
chain: Chain;
|
|
60
|
-
entryPointVersion?: EntryPointVersion;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Send sponsored batch transaction using EIP-7702
|
|
64
|
-
*
|
|
65
|
-
* Allows a feePayer wallet to pay gas fees for another wallet's transaction.
|
|
66
|
-
* The transaction executes from the owner's address, but gas is paid by the feePayer.
|
|
67
|
-
*
|
|
68
|
-
* @param config - Sponsored transaction configuration
|
|
69
|
-
* @returns UserOperation hash and transaction hash
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
* // Owner creates authorization
|
|
73
|
-
* const authorization = await createKernelAuthorization({
|
|
74
|
-
* owner: ownerAccount,
|
|
75
|
-
* chain,
|
|
76
|
-
* bundlerManager
|
|
77
|
-
* });
|
|
78
|
-
*
|
|
79
|
-
* // FeePayer sends transaction
|
|
80
|
-
* const result = await sendSponsoredBatchTransaction({
|
|
81
|
-
* ownerAuthorization: authorization,
|
|
82
|
-
* calls: [{ to: recipient, value: parseEther('0.1') }],
|
|
83
|
-
* feePayerPrivateKey: sponsorPrivateKey,
|
|
84
|
-
* bundlerUrl,
|
|
85
|
-
* chain
|
|
86
|
-
* });
|
|
87
|
-
*/
|
|
88
|
-
export declare function sendSponsoredBatchTransaction(config: SponsoredBatchTransactionConfig): Promise<{
|
|
89
|
-
userOpHash: Hex;
|
|
90
|
-
transactionHash?: string;
|
|
91
|
-
}>;
|
|
@@ -11,13 +11,10 @@ exports.createKernelAuthorization = createKernelAuthorization;
|
|
|
11
11
|
exports.sendBatchTransaction = sendBatchTransaction;
|
|
12
12
|
exports.sendKernelTransaction = sendKernelTransaction;
|
|
13
13
|
exports.waitForKernelReceipt = waitForKernelReceipt;
|
|
14
|
-
exports.sendSponsoredBatchTransaction = sendSponsoredBatchTransaction;
|
|
15
14
|
const viem_1 = require("viem");
|
|
16
|
-
const accounts_1 = require("viem/accounts");
|
|
17
15
|
const sdk_1 = require("@zerodev/sdk");
|
|
18
16
|
const constants_1 = require("@zerodev/sdk/constants");
|
|
19
17
|
const account_abstraction_1 = require("viem/account-abstraction");
|
|
20
|
-
const bundler_1 = require("../services/bundler");
|
|
21
18
|
// ============================================
|
|
22
19
|
// EntryPoint Mapping
|
|
23
20
|
// ============================================
|
|
@@ -29,17 +26,33 @@ const ENTRYPOINT_MAP = {
|
|
|
29
26
|
// Kernel Account Factory
|
|
30
27
|
// ============================================
|
|
31
28
|
async function createKernel7702Account(config) {
|
|
32
|
-
const { chain, owner,
|
|
29
|
+
const { chain, owner, entryPointVersion = '0.7', kernelVersion = '0.3.3', aaConfig } = config;
|
|
33
30
|
// Create public client for standard RPC calls
|
|
34
31
|
// (Bundler clients don't support standard eth_* methods)
|
|
35
32
|
const publicClient = (0, viem_1.createPublicClient)({
|
|
36
33
|
chain,
|
|
37
34
|
transport: (0, viem_1.http)()
|
|
38
35
|
});
|
|
39
|
-
// Get EntryPoint address
|
|
40
|
-
|
|
41
|
-
if (
|
|
42
|
-
|
|
36
|
+
// Get EntryPoint address from aaConfig or fallback to default
|
|
37
|
+
let entryPointAddress;
|
|
38
|
+
if (aaConfig && aaConfig.entryPoints.length > 0) {
|
|
39
|
+
// Find matching entry point from config
|
|
40
|
+
const entryPoint = aaConfig.entryPoints.find(ep => ep.version === entryPointVersion);
|
|
41
|
+
if (entryPoint) {
|
|
42
|
+
entryPointAddress = entryPoint.address;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
// Fallback to first entry point if version not found
|
|
46
|
+
console.warn(`EntryPoint version ${entryPointVersion} not found in aaConfig, using first available`);
|
|
47
|
+
entryPointAddress = aaConfig.entryPoints[0].address;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
// Fallback to hardcoded map if no config
|
|
52
|
+
entryPointAddress = ENTRYPOINT_MAP[entryPointVersion];
|
|
53
|
+
if (!entryPointAddress) {
|
|
54
|
+
throw new Error(`Unsupported EntryPoint version: ${entryPointVersion}`);
|
|
55
|
+
}
|
|
43
56
|
}
|
|
44
57
|
// Create Kernel account with EIP-7702
|
|
45
58
|
// Use public client for account creation (needs eth_call, eth_getCode, etc.)
|
|
@@ -66,15 +79,31 @@ async function createKernel7702Account(config) {
|
|
|
66
79
|
// EIP-7702 Authorization Helper
|
|
67
80
|
// ============================================
|
|
68
81
|
async function createKernelAuthorization(config) {
|
|
69
|
-
const { owner, chain,
|
|
70
|
-
const bundlerClient = bundlerManager.getClient(chain);
|
|
82
|
+
const { owner, chain, kernelVersion = '0.3.3', aaConfig } = config;
|
|
71
83
|
// Create public client for eth_getCode (bundler clients don't support it)
|
|
72
84
|
const publicClient = (0, viem_1.createPublicClient)({
|
|
73
85
|
chain,
|
|
74
|
-
transport: (0, viem_1.http)()
|
|
86
|
+
transport: (0, viem_1.http)(chain.rpcUrls.default.http[0])
|
|
75
87
|
});
|
|
76
|
-
// Get Kernel implementation address
|
|
77
|
-
|
|
88
|
+
// Get Kernel implementation address from aaConfig or fallback to default
|
|
89
|
+
let delegateAddress;
|
|
90
|
+
if (aaConfig && aaConfig.kernelImplementations.length > 0) {
|
|
91
|
+
// Try to find matching kernel version (currently only 0.3.3 / version 3 is supported)
|
|
92
|
+
const versionNumber = 3; // kernel version 0.3.3 maps to version 3
|
|
93
|
+
const kernelImpl = aaConfig.kernelImplementations.find(impl => impl.version === versionNumber);
|
|
94
|
+
if (kernelImpl) {
|
|
95
|
+
delegateAddress = kernelImpl.address;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
// Fallback to first implementation if version not found
|
|
99
|
+
console.warn(`Kernel version ${kernelVersion} (v${versionNumber}) not found in aaConfig, using first available`);
|
|
100
|
+
delegateAddress = aaConfig.kernelImplementations[0].address;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
// Fallback to hardcoded map if no config
|
|
105
|
+
delegateAddress = constants_1.KernelVersionToAddressesMap[constants_1.KERNEL_V3_3].accountImplementationAddress;
|
|
106
|
+
}
|
|
78
107
|
// Check if already delegated
|
|
79
108
|
const code = await publicClient.getCode({ address: owner.address });
|
|
80
109
|
const expectedCode = `0xef0100${delegateAddress.toLowerCase().substring(2)}`;
|
|
@@ -168,84 +197,4 @@ async function waitForKernelReceipt(config) {
|
|
|
168
197
|
});
|
|
169
198
|
return receipt;
|
|
170
199
|
}
|
|
171
|
-
/**
|
|
172
|
-
* Send sponsored batch transaction using EIP-7702
|
|
173
|
-
*
|
|
174
|
-
* Allows a feePayer wallet to pay gas fees for another wallet's transaction.
|
|
175
|
-
* The transaction executes from the owner's address, but gas is paid by the feePayer.
|
|
176
|
-
*
|
|
177
|
-
* @param config - Sponsored transaction configuration
|
|
178
|
-
* @returns UserOperation hash and transaction hash
|
|
179
|
-
*
|
|
180
|
-
* @example
|
|
181
|
-
* // Owner creates authorization
|
|
182
|
-
* const authorization = await createKernelAuthorization({
|
|
183
|
-
* owner: ownerAccount,
|
|
184
|
-
* chain,
|
|
185
|
-
* bundlerManager
|
|
186
|
-
* });
|
|
187
|
-
*
|
|
188
|
-
* // FeePayer sends transaction
|
|
189
|
-
* const result = await sendSponsoredBatchTransaction({
|
|
190
|
-
* ownerAuthorization: authorization,
|
|
191
|
-
* calls: [{ to: recipient, value: parseEther('0.1') }],
|
|
192
|
-
* feePayerPrivateKey: sponsorPrivateKey,
|
|
193
|
-
* bundlerUrl,
|
|
194
|
-
* chain
|
|
195
|
-
* });
|
|
196
|
-
*/
|
|
197
|
-
async function sendSponsoredBatchTransaction(config) {
|
|
198
|
-
const { ownerAuthorization, calls, feePayerPrivateKey, bundlerUrl, paymasterUrl, chain, entryPointVersion = '0.7' } = config;
|
|
199
|
-
if (calls.length === 0) {
|
|
200
|
-
throw new Error('Sponsored transaction must have at least one call');
|
|
201
|
-
}
|
|
202
|
-
// Create feePayer account
|
|
203
|
-
const feePayerAccount = (0, accounts_1.privateKeyToAccount)(feePayerPrivateKey);
|
|
204
|
-
// Create bundler service for feePayer
|
|
205
|
-
const feePayerBundlerService = (0, bundler_1.createBundlerService)({
|
|
206
|
-
provider: "custom",
|
|
207
|
-
customUrl: bundlerUrl,
|
|
208
|
-
chain
|
|
209
|
-
});
|
|
210
|
-
// Get bundler client (uses feePayer account internally)
|
|
211
|
-
const bundlerClient = feePayerBundlerService.getClient(chain);
|
|
212
|
-
// Create kernel account for feePayer (needed for sendUserOperation)
|
|
213
|
-
const publicClient = (0, viem_1.createPublicClient)({
|
|
214
|
-
chain,
|
|
215
|
-
transport: (0, viem_1.http)(chain.rpcUrls.default.http[0])
|
|
216
|
-
});
|
|
217
|
-
const entryPointAddress = ENTRYPOINT_MAP[entryPointVersion];
|
|
218
|
-
if (!entryPointAddress) {
|
|
219
|
-
throw new Error(`Unsupported EntryPoint version: ${entryPointVersion}`);
|
|
220
|
-
}
|
|
221
|
-
const feePayerKernelAccount = await (0, sdk_1.createKernelAccount)(publicClient, {
|
|
222
|
-
entryPoint: {
|
|
223
|
-
address: entryPointAddress,
|
|
224
|
-
version: entryPointVersion
|
|
225
|
-
},
|
|
226
|
-
kernelVersion: constants_1.KERNEL_V3_3,
|
|
227
|
-
eip7702Account: feePayerAccount
|
|
228
|
-
});
|
|
229
|
-
// Normalize calls
|
|
230
|
-
const normalizedCalls = calls.map(call => ({
|
|
231
|
-
to: call.to,
|
|
232
|
-
value: call.value ?? 0n,
|
|
233
|
-
data: call.data ?? '0x'
|
|
234
|
-
}));
|
|
235
|
-
// Send UserOperation with owner's authorization
|
|
236
|
-
// The transaction executes from owner's address, but feePayer pays gas
|
|
237
|
-
const userOpHash = await bundlerClient.sendUserOperation({
|
|
238
|
-
account: feePayerKernelAccount,
|
|
239
|
-
authorization: ownerAuthorization,
|
|
240
|
-
calls: normalizedCalls
|
|
241
|
-
});
|
|
242
|
-
// Wait for receipt
|
|
243
|
-
const receipt = await bundlerClient.waitForUserOperationReceipt({
|
|
244
|
-
hash: userOpHash
|
|
245
|
-
});
|
|
246
|
-
return {
|
|
247
|
-
userOpHash: userOpHash,
|
|
248
|
-
transactionHash: receipt?.receipt?.transactionHash
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
200
|
//# sourceMappingURL=kernel-account.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel-account.js","sourceRoot":"","sources":["../../../../utils/evm/aa-service/lib/kernel-account.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAoCH,
|
|
1
|
+
{"version":3,"file":"kernel-account.js","sourceRoot":"","sources":["../../../../utils/evm/aa-service/lib/kernel-account.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAoCH,0DA+DC;AAMD,8DA8DC;AAwBD,oDA6BC;AAQD,sDAqBC;AAMD,oDAcC;A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CAAC;IAErD,MAAM,aAAa,GAAG,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAEtD,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,2BAA2B,CAAC;QAC5D,IAAI,EAAE,UAAU;KACnB,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACnB,CAAC"}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import { Hex, Address } from 'viem';
|
|
14
14
|
import { Chain } from 'viem/chains';
|
|
15
15
|
import { PrivateKeyAccount } from 'viem/accounts';
|
|
16
|
+
import { CreateKernelAccountReturnType } from '@zerodev/sdk';
|
|
16
17
|
import { ModularSigner } from '@zerodev/permissions';
|
|
17
18
|
export interface SessionKeyPermissionRule {
|
|
18
19
|
target: Hex;
|
|
@@ -22,6 +23,7 @@ export interface SessionKeyPermissionRule {
|
|
|
22
23
|
}
|
|
23
24
|
export interface CreateSessionKeyApprovalOptions {
|
|
24
25
|
sessionKeyAddress: Address;
|
|
26
|
+
sessionKeyPrivateKey: Hex;
|
|
25
27
|
owner: PrivateKeyAccount;
|
|
26
28
|
chain: Chain;
|
|
27
29
|
entryPointVersion?: '0.6' | '0.7';
|
|
@@ -40,30 +42,21 @@ export interface DeserializedSessionKey {
|
|
|
40
42
|
/**
|
|
41
43
|
* Generate a new session key
|
|
42
44
|
*
|
|
43
|
-
* Creates a new keypair for use as a session key.
|
|
45
|
+
* Creates a new keypair for use as a session key or use the one that was passed if available.
|
|
44
46
|
* The private key should be stored securely and shared with the agent.
|
|
45
47
|
* The address should be shared with the owner for approval.
|
|
46
48
|
*
|
|
47
49
|
* @returns Session key info including private key, address, and signer
|
|
48
50
|
*
|
|
49
51
|
* @example
|
|
50
|
-
* const sessionKey = await generateSessionKey();
|
|
52
|
+
* const sessionKey = await generateSessionKey(); or
|
|
53
|
+
* const privateKey = '0x...'; // Existing private key
|
|
54
|
+
* const sessionKey = await generateSessionKey(privateKey);
|
|
55
|
+
*
|
|
51
56
|
* console.log("Share this address with owner:", sessionKey.address);
|
|
52
57
|
* console.log("Keep this private key secure:", sessionKey.privateKey);
|
|
53
58
|
*/
|
|
54
|
-
export declare function generateSessionKey(): Promise<SessionKeyInfo>;
|
|
55
|
-
/**
|
|
56
|
-
* Recreate session key from private key
|
|
57
|
-
*
|
|
58
|
-
* Recreates a session key signer from a stored private key.
|
|
59
|
-
*
|
|
60
|
-
* @param privateKey - The session key private key
|
|
61
|
-
* @returns Session key info
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* const sessionKey = await recreateSessionKey(storedPrivateKey);
|
|
65
|
-
*/
|
|
66
|
-
export declare function recreateSessionKey(privateKey: Hex): Promise<SessionKeyInfo>;
|
|
59
|
+
export declare function generateSessionKey(privateKey?: Hex): Promise<SessionKeyInfo>;
|
|
67
60
|
/**
|
|
68
61
|
* Create session key approval (Owner side)
|
|
69
62
|
*
|
|
@@ -115,7 +108,7 @@ export declare function deserializeSessionKey(options: {
|
|
|
115
108
|
sessionKeySigner: ModularSigner;
|
|
116
109
|
chain: Chain;
|
|
117
110
|
entryPointVersion?: '0.6' | '0.7';
|
|
118
|
-
}): Promise<
|
|
111
|
+
}): Promise<CreateKernelAccountReturnType<"0.6" | "0.7">>;
|
|
119
112
|
/**
|
|
120
113
|
* Create kernel client for session key
|
|
121
114
|
*
|
|
@@ -139,6 +132,10 @@ export declare function createSessionKeyClient(options: {
|
|
|
139
132
|
chain: Chain;
|
|
140
133
|
bundlerUrl: string;
|
|
141
134
|
paymasterUrl?: string;
|
|
135
|
+
entryPoint?: {
|
|
136
|
+
address: Hex;
|
|
137
|
+
version: '0.6' | '0.7';
|
|
138
|
+
};
|
|
142
139
|
}): any;
|
|
143
140
|
/**
|
|
144
141
|
* Create USDC transfer permission rule
|
|
@@ -155,7 +152,7 @@ export declare function createSessionKeyClient(options: {
|
|
|
155
152
|
* '10' // Max 10 USDC
|
|
156
153
|
* );
|
|
157
154
|
*/
|
|
158
|
-
export declare function createUSDCTransferPermission(usdcAddress: Hex, maxAmount: string): SessionKeyPermissionRule;
|
|
155
|
+
export declare function createUSDCTransferPermission(usdcAddress: Hex, maxAmount: string, destinationAddress: Hex): SessionKeyPermissionRule;
|
|
159
156
|
/**
|
|
160
157
|
* Create ETH transfer permission rule
|
|
161
158
|
*
|