@agirails/sdk 2.3.0 → 2.3.1
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/README.md +45 -8
- package/dist/ACTPClient.d.ts +35 -1
- package/dist/ACTPClient.d.ts.map +1 -1
- package/dist/ACTPClient.js +156 -26
- package/dist/ACTPClient.js.map +1 -1
- package/dist/adapters/AdapterRouter.d.ts.map +1 -1
- package/dist/adapters/AdapterRouter.js.map +1 -1
- package/dist/adapters/BasicAdapter.d.ts +10 -1
- package/dist/adapters/BasicAdapter.d.ts.map +1 -1
- package/dist/adapters/BasicAdapter.js +36 -1
- package/dist/adapters/BasicAdapter.js.map +1 -1
- package/dist/cli/commands/init.d.ts +1 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +210 -18
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/publish.d.ts.map +1 -1
- package/dist/cli/commands/publish.js.map +1 -1
- package/dist/cli/commands/register.d.ts +16 -0
- package/dist/cli/commands/register.d.ts.map +1 -0
- package/dist/cli/commands/register.js +211 -0
- package/dist/cli/commands/register.js.map +1 -0
- package/dist/cli/index.js +3 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/utils/config.d.ts +6 -0
- package/dist/cli/utils/config.d.ts.map +1 -1
- package/dist/cli/utils/config.js.map +1 -1
- package/dist/config/networks.d.ts +20 -4
- package/dist/config/networks.d.ts.map +1 -1
- package/dist/config/networks.js +59 -27
- package/dist/config/networks.js.map +1 -1
- package/dist/config/publishPipeline.d.ts +14 -0
- package/dist/config/publishPipeline.d.ts.map +1 -1
- package/dist/config/publishPipeline.js +2 -1
- package/dist/config/publishPipeline.js.map +1 -1
- package/dist/erc8004/ERC8004Bridge.d.ts.map +1 -1
- package/dist/erc8004/ERC8004Bridge.js +6 -5
- package/dist/erc8004/ERC8004Bridge.js.map +1 -1
- package/dist/erc8004/ReputationReporter.d.ts.map +1 -1
- package/dist/erc8004/ReputationReporter.js +9 -12
- package/dist/erc8004/ReputationReporter.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/level1/Agent.js +4 -4
- package/dist/level1/Agent.js.map +1 -1
- package/dist/protocol/ACTPKernel.d.ts +7 -1
- package/dist/protocol/ACTPKernel.d.ts.map +1 -1
- package/dist/protocol/ACTPKernel.js +13 -10
- package/dist/protocol/ACTPKernel.js.map +1 -1
- package/dist/protocol/EventMonitor.d.ts +14 -0
- package/dist/protocol/EventMonitor.d.ts.map +1 -1
- package/dist/protocol/EventMonitor.js +14 -0
- package/dist/protocol/EventMonitor.js.map +1 -1
- package/dist/runtime/BlockchainRuntime.d.ts +5 -0
- package/dist/runtime/BlockchainRuntime.d.ts.map +1 -1
- package/dist/runtime/BlockchainRuntime.js +1 -1
- package/dist/runtime/BlockchainRuntime.js.map +1 -1
- package/dist/storage/ArchiveBundleBuilder.d.ts.map +1 -1
- package/dist/storage/ArchiveBundleBuilder.js.map +1 -1
- package/dist/storage/ArweaveClient.d.ts.map +1 -1
- package/dist/storage/ArweaveClient.js +2 -0
- package/dist/storage/ArweaveClient.js.map +1 -1
- package/dist/storage/FilebaseClient.d.ts.map +1 -1
- package/dist/storage/FilebaseClient.js +2 -0
- package/dist/storage/FilebaseClient.js.map +1 -1
- package/dist/utils/ErrorRecoveryGuide.d.ts.map +1 -1
- package/dist/utils/ErrorRecoveryGuide.js +3 -2
- package/dist/utils/ErrorRecoveryGuide.js.map +1 -1
- package/dist/utils/IPFSClient.d.ts +3 -2
- package/dist/utils/IPFSClient.d.ts.map +1 -1
- package/dist/utils/IPFSClient.js +7 -5
- package/dist/utils/IPFSClient.js.map +1 -1
- package/dist/utils/computeTypeHash.js +1 -3
- package/dist/utils/computeTypeHash.js.map +1 -1
- package/dist/utils/retry.d.ts.map +1 -1
- package/dist/utils/retry.js +0 -1
- package/dist/utils/retry.js.map +1 -1
- package/dist/utils/validation.d.ts +2 -2
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +2 -2
- package/dist/utils/validation.js.map +1 -1
- package/dist/wallet/AutoWalletProvider.d.ts +77 -0
- package/dist/wallet/AutoWalletProvider.d.ts.map +1 -0
- package/dist/wallet/AutoWalletProvider.js +197 -0
- package/dist/wallet/AutoWalletProvider.js.map +1 -0
- package/dist/wallet/EOAWalletProvider.d.ts +21 -0
- package/dist/wallet/EOAWalletProvider.d.ts.map +1 -0
- package/dist/wallet/EOAWalletProvider.js +57 -0
- package/dist/wallet/EOAWalletProvider.js.map +1 -0
- package/dist/wallet/IWalletProvider.d.ts +115 -0
- package/dist/wallet/IWalletProvider.d.ts.map +1 -0
- package/dist/wallet/IWalletProvider.js +12 -0
- package/dist/wallet/IWalletProvider.js.map +1 -0
- package/dist/wallet/aa/BundlerClient.d.ts +70 -0
- package/dist/wallet/aa/BundlerClient.d.ts.map +1 -0
- package/dist/wallet/aa/BundlerClient.js +183 -0
- package/dist/wallet/aa/BundlerClient.js.map +1 -0
- package/dist/wallet/aa/DualNonceManager.d.ts +55 -0
- package/dist/wallet/aa/DualNonceManager.d.ts.map +1 -0
- package/dist/wallet/aa/DualNonceManager.js +131 -0
- package/dist/wallet/aa/DualNonceManager.js.map +1 -0
- package/dist/wallet/aa/PaymasterClient.d.ts +52 -0
- package/dist/wallet/aa/PaymasterClient.d.ts.map +1 -0
- package/dist/wallet/aa/PaymasterClient.js +115 -0
- package/dist/wallet/aa/PaymasterClient.js.map +1 -0
- package/dist/wallet/aa/TransactionBatcher.d.ts +87 -0
- package/dist/wallet/aa/TransactionBatcher.d.ts.map +1 -0
- package/dist/wallet/aa/TransactionBatcher.js +148 -0
- package/dist/wallet/aa/TransactionBatcher.js.map +1 -0
- package/dist/wallet/aa/UserOpBuilder.d.ts +71 -0
- package/dist/wallet/aa/UserOpBuilder.d.ts.map +1 -0
- package/dist/wallet/aa/UserOpBuilder.js +196 -0
- package/dist/wallet/aa/UserOpBuilder.js.map +1 -0
- package/dist/wallet/aa/constants.d.ts +54 -0
- package/dist/wallet/aa/constants.d.ts.map +1 -0
- package/dist/wallet/aa/constants.js +18 -0
- package/dist/wallet/aa/constants.js.map +1 -0
- package/package.json +4 -2
- package/src/ACTPClient.ts +217 -31
- package/src/adapters/AdapterRouter.ts +0 -1
- package/src/adapters/BasicAdapter.ts +41 -1
- package/src/cli/commands/init.ts +247 -19
- package/src/cli/commands/publish.ts +1 -2
- package/src/cli/commands/register.ts +233 -0
- package/src/cli/index.ts +4 -0
- package/src/cli/utils/config.ts +9 -0
- package/src/config/networks.ts +82 -27
- package/src/config/publishPipeline.ts +2 -2
- package/src/erc8004/ERC8004Bridge.ts +6 -5
- package/src/erc8004/ReputationReporter.ts +14 -18
- package/src/index.ts +12 -0
- package/src/level1/Agent.ts +5 -5
- package/src/protocol/ACTPKernel.ts +20 -10
- package/src/protocol/EventMonitor.ts +14 -0
- package/src/runtime/BlockchainRuntime.ts +7 -1
- package/src/storage/ArchiveBundleBuilder.ts +0 -2
- package/src/storage/ArweaveClient.ts +2 -1
- package/src/storage/FilebaseClient.ts +3 -3
- package/src/utils/ErrorRecoveryGuide.ts +4 -2
- package/src/utils/IPFSClient.ts +9 -7
- package/src/utils/computeTypeHash.ts +1 -3
- package/src/utils/retry.ts +0 -1
- package/src/utils/validation.ts +2 -2
- package/src/wallet/AutoWalletProvider.ts +294 -0
- package/src/wallet/EOAWalletProvider.ts +69 -0
- package/src/wallet/IWalletProvider.ts +133 -0
- package/src/wallet/aa/BundlerClient.ts +273 -0
- package/src/wallet/aa/DualNonceManager.ts +163 -0
- package/src/wallet/aa/PaymasterClient.ts +173 -0
- package/src/wallet/aa/TransactionBatcher.ts +240 -0
- package/src/wallet/aa/UserOpBuilder.ts +246 -0
- package/src/wallet/aa/constants.ts +60 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* UserOpBuilder — Constructs ERC-4337 v0.6 UserOperations.
|
|
4
|
+
*
|
|
5
|
+
* Builds UserOps for CoinbaseSmartWallet:
|
|
6
|
+
* - Encodes executeBatch(Call[]) as callData
|
|
7
|
+
* - Adds initCode for first-time wallet deployment
|
|
8
|
+
* - Signs with owner's private key (EIP-191 over UserOp hash)
|
|
9
|
+
*
|
|
10
|
+
* Uses ethers v6 for ABI encoding (no viem dependency yet — see Phase 2 note).
|
|
11
|
+
* viem+permissionless will be added if needed for paymaster integration.
|
|
12
|
+
*
|
|
13
|
+
* @module wallet/aa/UserOpBuilder
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.serializeUserOp = exports.signUserOp = exports.getUserOpHash = exports.buildUserOp = exports.encodeExecuteBatch = exports.buildInitCode = exports.computeSmartWalletAddress = void 0;
|
|
17
|
+
const ethers_1 = require("ethers");
|
|
18
|
+
const constants_1 = require("./constants");
|
|
19
|
+
const abiCoder = ethers_1.ethers.AbiCoder.defaultAbiCoder();
|
|
20
|
+
// ============================================================================
|
|
21
|
+
// ABI fragments
|
|
22
|
+
// ============================================================================
|
|
23
|
+
/** CoinbaseSmartWallet.executeBatch(Call[]) */
|
|
24
|
+
const EXECUTE_BATCH_ABI = [
|
|
25
|
+
'function executeBatch((address target, uint256 value, bytes data)[] calls)',
|
|
26
|
+
];
|
|
27
|
+
/** CoinbaseSmartWalletFactory.createAccount(bytes[],uint256) */
|
|
28
|
+
const FACTORY_CREATE_ABI = [
|
|
29
|
+
'function createAccount(bytes[] owners, uint256 nonce)',
|
|
30
|
+
];
|
|
31
|
+
/** CoinbaseSmartWalletFactory.getAddress(bytes[],uint256) */
|
|
32
|
+
const FACTORY_GET_ADDRESS_ABI = [
|
|
33
|
+
'function getAddress(bytes[] owners, uint256 nonce) view returns (address)',
|
|
34
|
+
];
|
|
35
|
+
// Typed factory interface to avoid ethers v6 getAddress() collision
|
|
36
|
+
const FACTORY_ABI = [
|
|
37
|
+
...FACTORY_CREATE_ABI,
|
|
38
|
+
...FACTORY_GET_ADDRESS_ABI,
|
|
39
|
+
];
|
|
40
|
+
// ============================================================================
|
|
41
|
+
// Public API
|
|
42
|
+
// ============================================================================
|
|
43
|
+
/**
|
|
44
|
+
* Compute the counterfactual Smart Wallet address for a given signer.
|
|
45
|
+
*
|
|
46
|
+
* This address is deterministic (CREATE2) and can be computed off-chain
|
|
47
|
+
* without deploying the wallet.
|
|
48
|
+
*/
|
|
49
|
+
async function computeSmartWalletAddress(signerAddress, provider, nonce = constants_1.DEFAULT_WALLET_NONCE) {
|
|
50
|
+
const factory = new ethers_1.ethers.Contract(constants_1.SMART_WALLET_FACTORY, FACTORY_ABI, provider);
|
|
51
|
+
// CoinbaseSmartWallet encodes owners as bytes[] — EOA address is abi.encode(address)
|
|
52
|
+
const ownerBytes = abiCoder.encode(['address'], [signerAddress]);
|
|
53
|
+
// Use getFunction to avoid collision with ethers v6 BaseContract.getAddress()
|
|
54
|
+
const fn = factory.getFunction('getAddress');
|
|
55
|
+
return await fn([ownerBytes], nonce);
|
|
56
|
+
}
|
|
57
|
+
exports.computeSmartWalletAddress = computeSmartWalletAddress;
|
|
58
|
+
/**
|
|
59
|
+
* Build initCode for first-time wallet deployment.
|
|
60
|
+
*
|
|
61
|
+
* initCode = factory address + createAccount calldata
|
|
62
|
+
* When the wallet already exists, pass '0x' as initCode.
|
|
63
|
+
*/
|
|
64
|
+
function buildInitCode(signerAddress, nonce = constants_1.DEFAULT_WALLET_NONCE) {
|
|
65
|
+
const iface = new ethers_1.ethers.Interface(FACTORY_CREATE_ABI);
|
|
66
|
+
const ownerBytes = abiCoder.encode(['address'], [signerAddress]);
|
|
67
|
+
const calldata = iface.encodeFunctionData('createAccount', [
|
|
68
|
+
[ownerBytes],
|
|
69
|
+
nonce,
|
|
70
|
+
]);
|
|
71
|
+
// initCode = factory address (20 bytes) + calldata
|
|
72
|
+
return constants_1.SMART_WALLET_FACTORY + calldata.slice(2);
|
|
73
|
+
}
|
|
74
|
+
exports.buildInitCode = buildInitCode;
|
|
75
|
+
/**
|
|
76
|
+
* Encode executeBatch calldata from an array of calls.
|
|
77
|
+
*/
|
|
78
|
+
function encodeExecuteBatch(calls) {
|
|
79
|
+
const iface = new ethers_1.ethers.Interface(EXECUTE_BATCH_ABI);
|
|
80
|
+
return iface.encodeFunctionData('executeBatch', [
|
|
81
|
+
calls.map((c) => ({
|
|
82
|
+
target: c.target,
|
|
83
|
+
value: c.value,
|
|
84
|
+
data: c.data,
|
|
85
|
+
})),
|
|
86
|
+
]);
|
|
87
|
+
}
|
|
88
|
+
exports.encodeExecuteBatch = encodeExecuteBatch;
|
|
89
|
+
/**
|
|
90
|
+
* Build a full UserOperation (unsigned).
|
|
91
|
+
*
|
|
92
|
+
* Gas limits and paymasterAndData must be filled by the caller
|
|
93
|
+
* (via BundlerClient.estimateGas and PaymasterClient.sponsor).
|
|
94
|
+
*/
|
|
95
|
+
function buildUserOp(params) {
|
|
96
|
+
const callData = encodeExecuteBatch(params.calls);
|
|
97
|
+
const initCode = params.isFirstDeploy
|
|
98
|
+
? buildInitCode(params.signerAddress)
|
|
99
|
+
: '0x';
|
|
100
|
+
return {
|
|
101
|
+
sender: params.sender,
|
|
102
|
+
nonce: params.nonce,
|
|
103
|
+
initCode,
|
|
104
|
+
callData,
|
|
105
|
+
// Placeholder values — filled by gas estimation
|
|
106
|
+
callGasLimit: 0n,
|
|
107
|
+
verificationGasLimit: 0n,
|
|
108
|
+
preVerificationGas: 0n,
|
|
109
|
+
maxFeePerGas: 0n,
|
|
110
|
+
maxPriorityFeePerGas: 0n,
|
|
111
|
+
paymasterAndData: '0x',
|
|
112
|
+
signature: '0x',
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
exports.buildUserOp = buildUserOp;
|
|
116
|
+
/**
|
|
117
|
+
* Compute the UserOperation hash for signing (v0.6).
|
|
118
|
+
*
|
|
119
|
+
* hash = keccak256(abi.encode(
|
|
120
|
+
* keccak256(pack(userOp)),
|
|
121
|
+
* entryPoint,
|
|
122
|
+
* chainId
|
|
123
|
+
* ))
|
|
124
|
+
*/
|
|
125
|
+
function getUserOpHash(userOp, chainId) {
|
|
126
|
+
// Pack all fields except signature
|
|
127
|
+
const packed = abiCoder.encode([
|
|
128
|
+
'address', // sender
|
|
129
|
+
'uint256', // nonce
|
|
130
|
+
'bytes32', // keccak256(initCode)
|
|
131
|
+
'bytes32', // keccak256(callData)
|
|
132
|
+
'uint256', // callGasLimit
|
|
133
|
+
'uint256', // verificationGasLimit
|
|
134
|
+
'uint256', // preVerificationGas
|
|
135
|
+
'uint256', // maxFeePerGas
|
|
136
|
+
'uint256', // maxPriorityFeePerGas
|
|
137
|
+
'bytes32', // keccak256(paymasterAndData)
|
|
138
|
+
], [
|
|
139
|
+
userOp.sender,
|
|
140
|
+
userOp.nonce,
|
|
141
|
+
ethers_1.ethers.keccak256(userOp.initCode),
|
|
142
|
+
ethers_1.ethers.keccak256(userOp.callData),
|
|
143
|
+
userOp.callGasLimit,
|
|
144
|
+
userOp.verificationGasLimit,
|
|
145
|
+
userOp.preVerificationGas,
|
|
146
|
+
userOp.maxFeePerGas,
|
|
147
|
+
userOp.maxPriorityFeePerGas,
|
|
148
|
+
ethers_1.ethers.keccak256(userOp.paymasterAndData),
|
|
149
|
+
]);
|
|
150
|
+
const packedHash = ethers_1.ethers.keccak256(packed);
|
|
151
|
+
return ethers_1.ethers.keccak256(abiCoder.encode(['bytes32', 'address', 'uint256'], [packedHash, constants_1.ENTRYPOINT_V06, chainId]));
|
|
152
|
+
}
|
|
153
|
+
exports.getUserOpHash = getUserOpHash;
|
|
154
|
+
/**
|
|
155
|
+
* Sign a UserOperation with the owner's private key.
|
|
156
|
+
*
|
|
157
|
+
* CoinbaseSmartWallet expects the signature to be:
|
|
158
|
+
* abi.encode(SignatureWrapper(0, abi.encodePacked(r,s,v)))
|
|
159
|
+
*
|
|
160
|
+
* where ownerIndex=0 for single-owner wallets.
|
|
161
|
+
*/
|
|
162
|
+
async function signUserOp(userOp, signer, chainId) {
|
|
163
|
+
const hash = getUserOpHash(userOp, chainId);
|
|
164
|
+
// ethers signMessage adds EIP-191 prefix. CoinbaseSmartWallet expects raw ECDSA.
|
|
165
|
+
// We use signingKey.sign() for raw signature over the hash bytes.
|
|
166
|
+
const sig = signer.signingKey.sign(hash);
|
|
167
|
+
// Pack r + s + v
|
|
168
|
+
const rawSig = ethers_1.ethers.concat([sig.r, sig.s, new Uint8Array([sig.v])]);
|
|
169
|
+
// CoinbaseSmartWallet SignatureWrapper: abi.encode(uint256 ownerIndex, bytes signatureData)
|
|
170
|
+
return abiCoder.encode(['uint256', 'bytes'], [0, rawSig]);
|
|
171
|
+
}
|
|
172
|
+
exports.signUserOp = signUserOp;
|
|
173
|
+
/**
|
|
174
|
+
* Serialize UserOp for JSON-RPC (bundler API).
|
|
175
|
+
* Converts bigints to hex strings.
|
|
176
|
+
*/
|
|
177
|
+
function serializeUserOp(userOp) {
|
|
178
|
+
return {
|
|
179
|
+
sender: userOp.sender,
|
|
180
|
+
nonce: toHex(userOp.nonce),
|
|
181
|
+
initCode: userOp.initCode,
|
|
182
|
+
callData: userOp.callData,
|
|
183
|
+
callGasLimit: toHex(userOp.callGasLimit),
|
|
184
|
+
verificationGasLimit: toHex(userOp.verificationGasLimit),
|
|
185
|
+
preVerificationGas: toHex(userOp.preVerificationGas),
|
|
186
|
+
maxFeePerGas: toHex(userOp.maxFeePerGas),
|
|
187
|
+
maxPriorityFeePerGas: toHex(userOp.maxPriorityFeePerGas),
|
|
188
|
+
paymasterAndData: userOp.paymasterAndData,
|
|
189
|
+
signature: userOp.signature,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
exports.serializeUserOp = serializeUserOp;
|
|
193
|
+
function toHex(n) {
|
|
194
|
+
return '0x' + n.toString(16);
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=UserOpBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserOpBuilder.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
|
2
|
+
* Account Abstraction constants for CoinbaseSmartWallet on Base.
|
|
3
|
+
*
|
|
4
|
+
* EntryPoint v0.6 — CoinbaseSmartWallet hardcodes this version.
|
|
5
|
+
* Factory address is canonical across all Base networks.
|
|
6
|
+
*
|
|
7
|
+
* @module wallet/aa/constants
|
|
8
|
+
*/
|
|
9
|
+
/** ERC-4337 EntryPoint v0.6 (canonical, all EVM chains) */
|
|
10
|
+
export declare const ENTRYPOINT_V06 = "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";
|
|
11
|
+
/** CoinbaseSmartWallet factory (canonical, all Base networks) */
|
|
12
|
+
export declare const SMART_WALLET_FACTORY = "0xBA5ED110eFDBa3D005bfC882d75358ACBbB85842";
|
|
13
|
+
/** Default nonce for first Smart Wallet per owner */
|
|
14
|
+
export declare const DEFAULT_WALLET_NONCE = 0n;
|
|
15
|
+
/**
|
|
16
|
+
* UserOperation v0.6 struct — 11 unpacked fields.
|
|
17
|
+
* CoinbaseSmartWallet does NOT support v0.7 packed format.
|
|
18
|
+
*/
|
|
19
|
+
export interface UserOperationV06 {
|
|
20
|
+
sender: string;
|
|
21
|
+
nonce: bigint;
|
|
22
|
+
initCode: string;
|
|
23
|
+
callData: string;
|
|
24
|
+
callGasLimit: bigint;
|
|
25
|
+
verificationGasLimit: bigint;
|
|
26
|
+
preVerificationGas: bigint;
|
|
27
|
+
maxFeePerGas: bigint;
|
|
28
|
+
maxPriorityFeePerGas: bigint;
|
|
29
|
+
paymasterAndData: string;
|
|
30
|
+
signature: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* CoinbaseSmartWallet Call struct for executeBatch.
|
|
34
|
+
*/
|
|
35
|
+
export interface SmartWalletCall {
|
|
36
|
+
target: string;
|
|
37
|
+
value: bigint;
|
|
38
|
+
data: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Gas estimation result from bundler.
|
|
42
|
+
*/
|
|
43
|
+
export interface GasEstimate {
|
|
44
|
+
callGasLimit: bigint;
|
|
45
|
+
verificationGasLimit: bigint;
|
|
46
|
+
preVerificationGas: bigint;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Paymaster sponsorship response.
|
|
50
|
+
*/
|
|
51
|
+
export interface PaymasterResponse {
|
|
52
|
+
paymasterAndData: string;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/wallet/aa/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,2DAA2D;AAC3D,eAAO,MAAM,cAAc,+CAA+C,CAAC;AAE3E,iEAAiE;AACjE,eAAO,MAAM,oBAAoB,+CAA+C,CAAC;AAEjF,qDAAqD;AACrD,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,gBAAgB,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Account Abstraction constants for CoinbaseSmartWallet on Base.
|
|
4
|
+
*
|
|
5
|
+
* EntryPoint v0.6 — CoinbaseSmartWallet hardcodes this version.
|
|
6
|
+
* Factory address is canonical across all Base networks.
|
|
7
|
+
*
|
|
8
|
+
* @module wallet/aa/constants
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.DEFAULT_WALLET_NONCE = exports.SMART_WALLET_FACTORY = exports.ENTRYPOINT_V06 = void 0;
|
|
12
|
+
/** ERC-4337 EntryPoint v0.6 (canonical, all EVM chains) */
|
|
13
|
+
exports.ENTRYPOINT_V06 = '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789';
|
|
14
|
+
/** CoinbaseSmartWallet factory (canonical, all Base networks) */
|
|
15
|
+
exports.SMART_WALLET_FACTORY = '0xBA5ED110eFDBa3D005bfC882d75358ACBbB85842';
|
|
16
|
+
/** Default nonce for first Smart Wallet per owner */
|
|
17
|
+
exports.DEFAULT_WALLET_NONCE = 0n;
|
|
18
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/wallet/aa/constants.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,2DAA2D;AAC9C,QAAA,cAAc,GAAG,4CAA4C,CAAC;AAE3E,iEAAiE;AACpD,QAAA,oBAAoB,GAAG,4CAA4C,CAAC;AAEjF,qDAAqD;AACxC,QAAA,oBAAoB,GAAG,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agirails/sdk",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "AGIRAILS SDK for the ACTP (Agent Commerce Transaction Protocol) - Unified mock + blockchain support",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
|
+
"require": "./dist/index.js",
|
|
10
11
|
"default": "./dist/index.js"
|
|
11
12
|
},
|
|
12
13
|
"./storage": {
|
|
13
14
|
"types": "./dist/storage/index.d.ts",
|
|
15
|
+
"require": "./dist/storage/index.js",
|
|
14
16
|
"default": "./dist/storage/index.js"
|
|
15
17
|
}
|
|
16
18
|
},
|
|
@@ -103,6 +105,6 @@
|
|
|
103
105
|
"typescript": "5.3.3"
|
|
104
106
|
},
|
|
105
107
|
"engines": {
|
|
106
|
-
"node": ">=
|
|
108
|
+
"node": ">=18.0.0"
|
|
107
109
|
}
|
|
108
110
|
}
|