@dag-kit/kit 1.0.0 ā 1.0.2
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/esm/clients/actions/example2.js +24 -21
- package/dist/esm/clients/actions/main.js +167 -18
- package/dist/esm/clients/actions/testPaymasterService.js +88 -0
- package/dist/esm/clients/chains.js +5 -0
- package/dist/esm/exports/index.js +1 -0
- package/dist/esm/version.js +3 -0
- package/dist/types/clients/actions/contract.d.ts +12 -0
- package/dist/types/clients/actions/contract.d.ts.map +1 -0
- package/dist/types/clients/actions/example.d.ts +2 -0
- package/dist/types/clients/actions/example.d.ts.map +1 -0
- package/dist/types/clients/actions/example2.d.ts +2 -0
- package/dist/types/clients/actions/example2.d.ts.map +1 -0
- package/dist/types/clients/actions/index.d.ts +1 -0
- package/dist/types/clients/actions/index.d.ts.map +1 -0
- package/dist/types/clients/actions/main.d.ts +40 -0
- package/dist/types/clients/actions/main.d.ts.map +1 -0
- package/dist/types/clients/actions/test.d.ts +1 -0
- package/dist/types/clients/actions/test.d.ts.map +1 -0
- package/dist/types/clients/actions/testPaymasterService.d.ts +2 -0
- package/dist/types/clients/actions/testPaymasterService.d.ts.map +1 -0
- package/dist/types/clients/chains.d.ts +81 -0
- package/dist/types/clients/chains.d.ts.map +1 -0
- package/dist/types/clients/types.d.ts +31 -0
- package/dist/types/clients/types.d.ts.map +1 -0
- package/dist/types/exports/index.d.ts +4 -0
- package/dist/types/exports/index.d.ts.map +1 -0
- package/dist/types/version.d.ts +2 -0
- package/dist/types/version.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/clients/actions/example2.ts +26 -23
- package/src/clients/actions/main.ts +194 -22
- package/src/clients/actions/test.ts +210 -0
- package/src/clients/actions/testPaymasterService.ts +94 -0
- package/src/clients/chains.ts +6 -1
- package/src/clients/types.ts +1 -0
- package/src/exports/index.ts +2 -0
- package/src/version.ts +3 -0
- package/dist/esm/script.js +0 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { awakening } from "../chains";
|
|
2
2
|
import { createDagAAClient, parseDAG } from "./main";
|
|
3
|
+
import { generatePrivateKey } from "viem/accounts";
|
|
3
4
|
import { config as dotenvConfig } from "dotenv";
|
|
4
5
|
dotenvConfig();
|
|
5
6
|
const PRIVATE_KEY_2 = process.env.PRIVATE_KEY_1;
|
|
7
|
+
const ownerPrivy = generatePrivateKey();
|
|
6
8
|
(async () => {
|
|
7
9
|
console.log("Sending Simple Transaction");
|
|
8
10
|
const client = createDagAAClient({
|
|
@@ -10,38 +12,39 @@ const PRIVATE_KEY_2 = process.env.PRIVATE_KEY_1;
|
|
|
10
12
|
rpcUrl: "https://rpc.awakening.bdagscan.com",
|
|
11
13
|
bundlerUrl: awakening.bundler_rpc,
|
|
12
14
|
factoryAddress: "0x8FaB6DF00085eb05D5F2C1FA46a6E539587ae3f3",
|
|
15
|
+
paymasterUrl: "http://localhost:3001/rpc",
|
|
13
16
|
});
|
|
14
17
|
await client.connectSmartAccount({
|
|
15
18
|
owner: "0x6b0f66a03b67d7b9eaa6c31123ffe5bf2ee58eb40ab86c8a14d6f1294838b0c8",
|
|
16
|
-
accountAddress: "0xDe10aaC59f659fA154C063153AB3f7Cca1fb23A5",
|
|
19
|
+
// accountAddress: "0xDe10aaC59f659fA154C063153AB3f7Cca1fb23A5",
|
|
17
20
|
});
|
|
18
21
|
// Send 0.01 DAG to an address
|
|
19
22
|
const txHash = await client.sendUserOperation({
|
|
20
23
|
target: "0x1749be926ef79a63a285b01263f7ddc350d435e6",
|
|
21
|
-
value: parseDAG("
|
|
24
|
+
value: parseDAG("0"), // 0.01 DAG
|
|
22
25
|
maxFeePerGas: 50000000000n,
|
|
23
26
|
maxPriorityFeePerGas: 50000000000n,
|
|
24
27
|
});
|
|
25
28
|
console.log(`Transaction: ${txHash}`);
|
|
26
29
|
console.log("\nš¦ Example : Batch Operations");
|
|
27
30
|
console.log("āāāāāāāāāāāāāāāāāāāāāāāāāāā\n");
|
|
28
|
-
await client.connectSmartAccount({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
32
|
-
// Send multiple operations
|
|
33
|
-
const hashes = await client.sendBatchUserOperations([
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
]);
|
|
43
|
-
console.log(`Sent ${hashes.length} operations`);
|
|
44
|
-
hashes.forEach((hash, i) => {
|
|
45
|
-
|
|
46
|
-
});
|
|
31
|
+
// await client.connectSmartAccount({
|
|
32
|
+
// owner: PRIVATE_KEY_2,
|
|
33
|
+
// accountAddress: "0x7fd5385efcB7B2898933288948a9496CDc0fA8ee",
|
|
34
|
+
// });
|
|
35
|
+
// // Send multiple operations
|
|
36
|
+
// const hashes = await client.sendBatchUserOperations([
|
|
37
|
+
// {
|
|
38
|
+
// target: "0x1749be926ef79a63a285b01263f7ddc350d435e6",
|
|
39
|
+
// value: parseDAG("0.5"),
|
|
40
|
+
// },
|
|
41
|
+
// {
|
|
42
|
+
// target: "0x8371e519177f81b93287f750dcd06ce894c12cc5",
|
|
43
|
+
// value: parseDAG("0.5"),
|
|
44
|
+
// },
|
|
45
|
+
// ]);
|
|
46
|
+
// console.log(`Sent ${hashes.length} operations`);
|
|
47
|
+
// hashes.forEach((hash, i) => {
|
|
48
|
+
// console.log(` ${i + 1}. ${hash}`);
|
|
49
|
+
// });
|
|
47
50
|
})();
|
|
@@ -17,6 +17,7 @@ export class DagAAClient {
|
|
|
17
17
|
walletClient;
|
|
18
18
|
bundlerClient = null;
|
|
19
19
|
smartAccount = null;
|
|
20
|
+
paymasterClient = null;
|
|
20
21
|
smartAccountClient = null;
|
|
21
22
|
constructor(config) {
|
|
22
23
|
this.config = {
|
|
@@ -31,6 +32,98 @@ export class DagAAClient {
|
|
|
31
32
|
chain: config.chain,
|
|
32
33
|
transport: http(config.rpcUrl),
|
|
33
34
|
});
|
|
35
|
+
// Initialize paymaster client if URL provided
|
|
36
|
+
if (config.paymasterUrl) {
|
|
37
|
+
this.paymasterClient = this.createPaymasterClient(config.paymasterUrl);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// ==============================================================================
|
|
41
|
+
// Paymaster Client (Fixed Serialization)
|
|
42
|
+
// ==============================================================================
|
|
43
|
+
createPaymasterClient(paymasterUrl) {
|
|
44
|
+
// 1. Define a robust serializer that handles nested BigInts automatically
|
|
45
|
+
const stringify = (data) => {
|
|
46
|
+
return JSON.stringify(data, (_, value) => typeof value === "bigint" ? `0x${value.toString(16)}` : value);
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
/**
|
|
50
|
+
* Get paymaster stub data for gas estimation
|
|
51
|
+
*/
|
|
52
|
+
async getPaymasterStubData(userOp, entryPoint) {
|
|
53
|
+
try {
|
|
54
|
+
const response = await fetch(paymasterUrl, {
|
|
55
|
+
method: "POST",
|
|
56
|
+
headers: { "Content-Type": "application/json" },
|
|
57
|
+
// š Use the robust stringify helper
|
|
58
|
+
body: stringify({
|
|
59
|
+
jsonrpc: "2.0",
|
|
60
|
+
id: 1,
|
|
61
|
+
method: "pm_getPaymasterStubData",
|
|
62
|
+
params: [userOp, entryPoint, {}],
|
|
63
|
+
}),
|
|
64
|
+
});
|
|
65
|
+
const data = await response.json();
|
|
66
|
+
if (data.error)
|
|
67
|
+
throw new Error(data.error.message);
|
|
68
|
+
return data.result;
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
console.warn("Failed to get paymaster stub data:", error);
|
|
72
|
+
// ā ļø If this fails, the UserOp usually fails with AA21
|
|
73
|
+
return { paymasterAndData: "0x" };
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* Get paymaster data for actual transaction
|
|
78
|
+
*/
|
|
79
|
+
async getPaymasterData(userOp, entryPoint) {
|
|
80
|
+
try {
|
|
81
|
+
const response = await fetch(paymasterUrl, {
|
|
82
|
+
method: "POST",
|
|
83
|
+
headers: { "Content-Type": "application/json" },
|
|
84
|
+
body: stringify({
|
|
85
|
+
jsonrpc: "2.0",
|
|
86
|
+
id: 1,
|
|
87
|
+
method: "pm_getPaymasterData",
|
|
88
|
+
params: [userOp, entryPoint, {}],
|
|
89
|
+
}),
|
|
90
|
+
});
|
|
91
|
+
const data = await response.json();
|
|
92
|
+
if (data.error)
|
|
93
|
+
throw new Error(data.error.message);
|
|
94
|
+
return data.result;
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
console.warn("Failed to get paymaster data:", error);
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
/**
|
|
102
|
+
* Sponsor user operation
|
|
103
|
+
*/
|
|
104
|
+
async sponsorUserOperation(userOp, entryPoint) {
|
|
105
|
+
try {
|
|
106
|
+
const response = await fetch(paymasterUrl, {
|
|
107
|
+
method: "POST",
|
|
108
|
+
headers: { "Content-Type": "application/json" },
|
|
109
|
+
body: stringify({
|
|
110
|
+
jsonrpc: "2.0",
|
|
111
|
+
id: 1,
|
|
112
|
+
method: "pm_sponsorUserOperation",
|
|
113
|
+
params: [userOp, entryPoint, {}],
|
|
114
|
+
}),
|
|
115
|
+
});
|
|
116
|
+
const data = await response.json();
|
|
117
|
+
if (data.error)
|
|
118
|
+
throw new Error(data.error.message);
|
|
119
|
+
return data.result;
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
console.warn("Failed to sponsor user operation:", error);
|
|
123
|
+
throw error;
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
};
|
|
34
127
|
}
|
|
35
128
|
// ==============================================================================
|
|
36
129
|
// Smart Account Management
|
|
@@ -75,12 +168,71 @@ export class DagAAClient {
|
|
|
75
168
|
version: "0.6",
|
|
76
169
|
},
|
|
77
170
|
});
|
|
78
|
-
// Create smart account client
|
|
79
|
-
|
|
171
|
+
// Create smart account client with optional paymaster
|
|
172
|
+
const clientConfig = {
|
|
80
173
|
bundlerTransport: http(this.config.bundlerUrl),
|
|
81
174
|
chain: this.config.chain,
|
|
82
175
|
account: this.smartAccount,
|
|
83
|
-
}
|
|
176
|
+
};
|
|
177
|
+
// Add paymaster if configured
|
|
178
|
+
if (this.paymasterClient) {
|
|
179
|
+
clientConfig.paymaster = {
|
|
180
|
+
getPaymasterData: async (userOperation) => {
|
|
181
|
+
console.log("š« Requesting paymaster sponsorship...");
|
|
182
|
+
console.log("UserOp sender:", userOperation.sender);
|
|
183
|
+
try {
|
|
184
|
+
const result = await this.paymasterClient.sponsorUserOperation(userOperation, this.config.entryPointAddress);
|
|
185
|
+
console.log("Paymaster result:", result);
|
|
186
|
+
if (result && result.paymasterAndData) {
|
|
187
|
+
console.log("ā
Paymaster sponsorship approved!");
|
|
188
|
+
console.log("PaymasterAndData:", result.paymasterAndData);
|
|
189
|
+
return {
|
|
190
|
+
paymasterAndData: result.paymasterAndData,
|
|
191
|
+
...(result.preVerificationGas && {
|
|
192
|
+
preVerificationGas: BigInt(result.preVerificationGas),
|
|
193
|
+
}),
|
|
194
|
+
...(result.verificationGasLimit && {
|
|
195
|
+
verificationGasLimit: BigInt(result.verificationGasLimit),
|
|
196
|
+
}),
|
|
197
|
+
...(result.callGasLimit && {
|
|
198
|
+
callGasLimit: BigInt(result.callGasLimit),
|
|
199
|
+
}),
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
console.error("ā No paymasterAndData in response:", result);
|
|
204
|
+
throw new Error("No paymaster data returned");
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
console.error("ā Paymaster sponsorship failed:", error);
|
|
209
|
+
throw error;
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
getPaymasterStubData: async (userOperation) => {
|
|
213
|
+
console.log("š Getting paymaster stub data for gas estimation...");
|
|
214
|
+
try {
|
|
215
|
+
const result = await this.paymasterClient.getPaymasterStubData(userOperation, this.config.entryPointAddress);
|
|
216
|
+
console.log("Stub data result:", result);
|
|
217
|
+
if (result && result.paymasterAndData) {
|
|
218
|
+
console.log("ā
Got paymaster stub data");
|
|
219
|
+
return {
|
|
220
|
+
paymasterAndData: result.paymasterAndData,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
console.warn("ā ļø Failed to get paymaster stub data:", error);
|
|
226
|
+
}
|
|
227
|
+
// Return default stub if fails
|
|
228
|
+
console.log("ā ļø Using default stub data");
|
|
229
|
+
return {
|
|
230
|
+
paymasterAndData: "0x",
|
|
231
|
+
};
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
this.smartAccountClient = createSmartAccountClient(clientConfig);
|
|
84
236
|
console.log(`ā
Connected to smart account: ${this.smartAccount.address}`);
|
|
85
237
|
return this.smartAccount.address;
|
|
86
238
|
}
|
|
@@ -139,7 +291,7 @@ export class DagAAClient {
|
|
|
139
291
|
if (!this.smartAccountClient) {
|
|
140
292
|
throw new Error("Smart account not connected");
|
|
141
293
|
}
|
|
142
|
-
const { target, data = "0x", value = 0n, maxFeePerGas, maxPriorityFeePerGas, callGasLimit
|
|
294
|
+
const { target, data = "0x", value = 0n, maxFeePerGas, maxPriorityFeePerGas, callGasLimit, verificationGasLimit, preVerificationGas, } = params;
|
|
143
295
|
// Get gas prices if not provided
|
|
144
296
|
let gasPrices = {
|
|
145
297
|
maxFeePerGas: maxFeePerGas,
|
|
@@ -156,7 +308,7 @@ export class DagAAClient {
|
|
|
156
308
|
console.log(` Target: ${target}`);
|
|
157
309
|
console.log(` Value: ${value}`);
|
|
158
310
|
console.log(` Gas: ${gasPrices.maxFeePerGas} / ${gasPrices.maxPriorityFeePerGas}`);
|
|
159
|
-
const
|
|
311
|
+
const txOptions = {
|
|
160
312
|
calls: [
|
|
161
313
|
{
|
|
162
314
|
to: target,
|
|
@@ -166,10 +318,16 @@ export class DagAAClient {
|
|
|
166
318
|
],
|
|
167
319
|
maxFeePerGas: gasPrices.maxFeePerGas,
|
|
168
320
|
maxPriorityFeePerGas: gasPrices.maxPriorityFeePerGas,
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
321
|
+
};
|
|
322
|
+
// Add optional gas limits if provided
|
|
323
|
+
if (callGasLimit)
|
|
324
|
+
txOptions.callGasLimit = callGasLimit;
|
|
325
|
+
if (verificationGasLimit)
|
|
326
|
+
txOptions.verificationGasLimit = verificationGasLimit;
|
|
327
|
+
if (preVerificationGas)
|
|
328
|
+
txOptions.preVerificationGas = preVerificationGas;
|
|
329
|
+
// Send transaction - paymaster is automatically called if configured
|
|
330
|
+
const userOpHash = await this.smartAccountClient.sendTransaction(txOptions);
|
|
173
331
|
console.log(`ā
UserOperation sent: ${userOpHash}`);
|
|
174
332
|
return userOpHash;
|
|
175
333
|
}
|
|
@@ -255,12 +413,3 @@ export function createDagAAClient(config) {
|
|
|
255
413
|
export function parseDAG(amount) {
|
|
256
414
|
return parseEther(amount);
|
|
257
415
|
}
|
|
258
|
-
// ==============================================================================
|
|
259
|
-
// Export Types
|
|
260
|
-
// ==============================================================================
|
|
261
|
-
// export type {
|
|
262
|
-
// DagAAConfig,
|
|
263
|
-
// SmartAccountConfig,
|
|
264
|
-
// SendUserOperationParams,
|
|
265
|
-
// UserOperationReceipt,
|
|
266
|
-
// };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Test if paymaster service is working
|
|
3
|
+
async function testPaymasterService() {
|
|
4
|
+
const PAYMASTER_URL = "http://localhost:3001/rpc";
|
|
5
|
+
console.log("Testing paymaster service...");
|
|
6
|
+
// Test 1: Health check
|
|
7
|
+
try {
|
|
8
|
+
const healthResponse = await fetch("http://localhost:3001/health");
|
|
9
|
+
const health = await healthResponse.json();
|
|
10
|
+
console.log("ā
Health check passed:", health);
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
console.error("ā Health check failed:", error);
|
|
14
|
+
console.error("Is the paymaster service running? Run: pnpm start");
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
// Test 2: Get paymaster info
|
|
18
|
+
try {
|
|
19
|
+
const infoResponse = await fetch("http://localhost:3001/info");
|
|
20
|
+
const info = await infoResponse.json();
|
|
21
|
+
console.log("ā
Paymaster info:", info);
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
console.error("ā Failed to get paymaster info:", error);
|
|
25
|
+
}
|
|
26
|
+
// Test 3: Test pm_getPaymasterStubData
|
|
27
|
+
const mockUserOp = {
|
|
28
|
+
sender: "0xCa28afE1e9Fb8B9AF996c97F3dc291bE54EAEe4E",
|
|
29
|
+
nonce: "0x0",
|
|
30
|
+
initCode: "0x",
|
|
31
|
+
callData: "0x",
|
|
32
|
+
callGasLimit: "0x30d40",
|
|
33
|
+
verificationGasLimit: "0x30d40",
|
|
34
|
+
preVerificationGas: "0x30d40",
|
|
35
|
+
maxFeePerGas: "0xba43b7400",
|
|
36
|
+
maxPriorityFeePerGas: "0xba43b7400",
|
|
37
|
+
paymasterAndData: "0x",
|
|
38
|
+
signature: "0x",
|
|
39
|
+
};
|
|
40
|
+
try {
|
|
41
|
+
const response = await fetch(PAYMASTER_URL, {
|
|
42
|
+
method: "POST",
|
|
43
|
+
headers: { "Content-Type": "application/json" },
|
|
44
|
+
body: JSON.stringify({
|
|
45
|
+
jsonrpc: "2.0",
|
|
46
|
+
id: 1,
|
|
47
|
+
method: "pm_getPaymasterStubData",
|
|
48
|
+
params: [mockUserOp, "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", {}],
|
|
49
|
+
}),
|
|
50
|
+
});
|
|
51
|
+
const data = await response.json();
|
|
52
|
+
if (data.error) {
|
|
53
|
+
console.error("ā pm_getPaymasterStubData failed:", data.error);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
console.log("ā
pm_getPaymasterStubData success:", data.result);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
console.error("ā pm_getPaymasterStubData request failed:", error);
|
|
61
|
+
}
|
|
62
|
+
// Test 4: Test pm_sponsorUserOperation
|
|
63
|
+
try {
|
|
64
|
+
const response = await fetch(PAYMASTER_URL, {
|
|
65
|
+
method: "POST",
|
|
66
|
+
headers: { "Content-Type": "application/json" },
|
|
67
|
+
body: JSON.stringify({
|
|
68
|
+
jsonrpc: "2.0",
|
|
69
|
+
id: 1,
|
|
70
|
+
method: "pm_sponsorUserOperation",
|
|
71
|
+
params: [mockUserOp, "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", {}],
|
|
72
|
+
}),
|
|
73
|
+
});
|
|
74
|
+
const data = await response.json();
|
|
75
|
+
if (data.error) {
|
|
76
|
+
console.error("ā pm_sponsorUserOperation failed:", data.error);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
console.log("ā
pm_sponsorUserOperation success:");
|
|
80
|
+
console.log(" paymasterAndData:", data.result.paymasterAndData);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
console.error("ā pm_sponsorUserOperation request failed:", error);
|
|
85
|
+
}
|
|
86
|
+
console.log("\nā
Paymaster tests complete!");
|
|
87
|
+
}
|
|
88
|
+
testPaymasterService().catch(console.error);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineChain } from "viem";
|
|
2
|
+
import { arbitrumSepolia } from "viem/chains";
|
|
2
3
|
const awakening_ = defineChain({
|
|
3
4
|
id: 1043,
|
|
4
5
|
name: "Awakening Testnet",
|
|
@@ -12,3 +13,7 @@ export const awakening = {
|
|
|
12
13
|
bundler_rpc: "http://0.0.0.0:3000/",
|
|
13
14
|
chain_config: awakening_,
|
|
14
15
|
};
|
|
16
|
+
export const arbitrumSep = {
|
|
17
|
+
bundler_rpc: "http://0.0.0.0:3001/",
|
|
18
|
+
chain_config: arbitrumSepolia,
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/clients/actions/contract.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,GAAG;;;;;;;;;;GAyCf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../../../../src/clients/actions/example.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example2.d.ts","sourceRoot":"","sources":["../../../../src/clients/actions/example2.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/clients/actions/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type Hash, type Address } from "viem";
|
|
2
|
+
import { DagAAConfig, SmartAccountConfig, SendUserOperationParams, UserOperationReceipt } from "../types";
|
|
3
|
+
export declare class DagAAClient {
|
|
4
|
+
private config;
|
|
5
|
+
private publicClient;
|
|
6
|
+
private walletClient;
|
|
7
|
+
private bundlerClient;
|
|
8
|
+
private smartAccount;
|
|
9
|
+
private paymasterClient;
|
|
10
|
+
private smartAccountClient;
|
|
11
|
+
constructor(config: DagAAConfig);
|
|
12
|
+
private createPaymasterClient;
|
|
13
|
+
connectSmartAccount(accountConfig: SmartAccountConfig): Promise<Address>;
|
|
14
|
+
getAddress(): Address;
|
|
15
|
+
getBalance(): Promise<bigint>;
|
|
16
|
+
isDeployed(): Promise<boolean>;
|
|
17
|
+
getNonce(): Promise<bigint>;
|
|
18
|
+
sendUserOperation(params: SendUserOperationParams): Promise<Hash>;
|
|
19
|
+
writeContract(params: {
|
|
20
|
+
address: Address;
|
|
21
|
+
abi: any[];
|
|
22
|
+
functionName: string;
|
|
23
|
+
args?: any[];
|
|
24
|
+
value?: bigint;
|
|
25
|
+
maxFeePerGas?: bigint;
|
|
26
|
+
maxPriorityFeePerGas?: bigint;
|
|
27
|
+
}): Promise<Hash>;
|
|
28
|
+
readContract(params: {
|
|
29
|
+
address: Address;
|
|
30
|
+
abi: any[];
|
|
31
|
+
functionName: string;
|
|
32
|
+
args?: any[];
|
|
33
|
+
}): Promise<any>;
|
|
34
|
+
waitForUserOperationReceipt(userOpHash: Hash, timeout?: number): Promise<UserOperationReceipt>;
|
|
35
|
+
fundAccount(amount: bigint, fromPrivateKey: `0x${string}`): Promise<Hash>;
|
|
36
|
+
sendBatchUserOperations(operations: SendUserOperationParams[]): Promise<Hash[]>;
|
|
37
|
+
}
|
|
38
|
+
export declare function createDagAAClient(config: DagAAConfig): DagAAClient;
|
|
39
|
+
export declare function parseDAG(amount: string): bigint;
|
|
40
|
+
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../src/clients/actions/main.ts"],"names":[],"mappings":"AAKA,OAAO,EAOL,KAAK,IAAI,EACT,KAAK,OAAO,EAGb,MAAM,MAAM,CAAC;AAMd,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAMlB,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,YAAY,CAAwC;IAC5D,OAAO,CAAC,YAAY,CAAwC;IAC5D,OAAO,CAAC,aAAa,CAAuD;IAC5E,OAAO,CAAC,YAAY,CAAoB;IACxC,OAAO,CAAC,eAAe,CAAoB;IAC3C,OAAO,CAAC,kBAAkB,CAEV;gBAEJ,MAAM,EAAE,WAAW;IAyB/B,OAAO,CAAC,qBAAqB;IAoGvB,mBAAmB,CACvB,aAAa,EAAE,kBAAkB,GAChC,OAAO,CAAC,OAAO,CAAC;IAkInB,UAAU,IAAI,OAAO;IASf,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAU7B,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAY9B,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC;IA4B3B,iBAAiB,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmEjE,aAAa,CAAC,MAAM,EAAE;QAC1B,OAAO,EAAE,OAAO,CAAC;QACjB,GAAG,EAAE,GAAG,EAAE,CAAC;QACX,YAAY,EAAE,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;KAC/B,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBX,YAAY,CAAC,MAAM,EAAE;QACzB,OAAO,EAAE,OAAO,CAAC;QACjB,GAAG,EAAE,GAAG,EAAE,CAAC;QACX,YAAY,EAAE,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;KACd,GAAG,OAAO,CAAC,GAAG,CAAC;IAaV,2BAA2B,CAC/B,UAAU,EAAE,IAAI,EAChB,OAAO,GAAE,MAAc,GACtB,OAAO,CAAC,oBAAoB,CAAC;IAmB1B,WAAW,CACf,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,KAAK,MAAM,EAAE,GAC5B,OAAO,CAAC,IAAI,CAAC;IA2BV,uBAAuB,CAC3B,UAAU,EAAE,uBAAuB,EAAE,GACpC,OAAO,CAAC,IAAI,EAAE,CAAC;CAUnB;AAMD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAElE;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../../src/clients/actions/test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testPaymasterService.d.ts","sourceRoot":"","sources":["../../../../src/clients/actions/testPaymasterService.ts"],"names":[],"mappings":"AAEA,iBAAe,oBAAoB,kBAyFlC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export declare const awakening: {
|
|
2
|
+
bundler_rpc: string;
|
|
3
|
+
chain_config: {
|
|
4
|
+
blockExplorers: {
|
|
5
|
+
readonly default: {
|
|
6
|
+
readonly name: "Explorer";
|
|
7
|
+
readonly url: "https://awakening.bdagscan.com/";
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
blockTime?: number | undefined | undefined;
|
|
11
|
+
contracts?: {
|
|
12
|
+
[x: string]: import("viem").ChainContract | {
|
|
13
|
+
[sourceId: number]: import("viem").ChainContract | undefined;
|
|
14
|
+
} | undefined;
|
|
15
|
+
ensRegistry?: import("viem").ChainContract | undefined;
|
|
16
|
+
ensUniversalResolver?: import("viem").ChainContract | undefined;
|
|
17
|
+
multicall3?: import("viem").ChainContract | undefined;
|
|
18
|
+
universalSignatureVerifier?: import("viem").ChainContract | undefined;
|
|
19
|
+
} | undefined;
|
|
20
|
+
ensTlds?: readonly string[] | undefined;
|
|
21
|
+
id: 1043;
|
|
22
|
+
name: "Awakening Testnet";
|
|
23
|
+
nativeCurrency: {
|
|
24
|
+
readonly decimals: 18;
|
|
25
|
+
readonly name: "Dag";
|
|
26
|
+
readonly symbol: "DAG";
|
|
27
|
+
};
|
|
28
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
29
|
+
rpcUrls: {
|
|
30
|
+
readonly default: {
|
|
31
|
+
readonly http: readonly ["https://public-bdag.nownodes.io"];
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
sourceId?: number | undefined | undefined;
|
|
35
|
+
testnet?: boolean | undefined | undefined;
|
|
36
|
+
custom?: Record<string, unknown> | undefined;
|
|
37
|
+
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
38
|
+
formatters?: undefined;
|
|
39
|
+
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export declare const arbitrumSep: {
|
|
43
|
+
bundler_rpc: string;
|
|
44
|
+
chain_config: {
|
|
45
|
+
blockExplorers: {
|
|
46
|
+
readonly default: {
|
|
47
|
+
readonly name: "Arbiscan";
|
|
48
|
+
readonly url: "https://sepolia.arbiscan.io";
|
|
49
|
+
readonly apiUrl: "https://api-sepolia.arbiscan.io/api";
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
blockTime: 250;
|
|
53
|
+
contracts: {
|
|
54
|
+
readonly multicall3: {
|
|
55
|
+
readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
|
|
56
|
+
readonly blockCreated: 81930;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
ensTlds?: readonly string[] | undefined;
|
|
60
|
+
id: 421614;
|
|
61
|
+
name: "Arbitrum Sepolia";
|
|
62
|
+
nativeCurrency: {
|
|
63
|
+
readonly name: "Arbitrum Sepolia Ether";
|
|
64
|
+
readonly symbol: "ETH";
|
|
65
|
+
readonly decimals: 18;
|
|
66
|
+
};
|
|
67
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
68
|
+
rpcUrls: {
|
|
69
|
+
readonly default: {
|
|
70
|
+
readonly http: readonly ["https://sepolia-rollup.arbitrum.io/rpc"];
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
sourceId?: number | undefined | undefined;
|
|
74
|
+
testnet: true;
|
|
75
|
+
custom?: Record<string, unknown> | undefined;
|
|
76
|
+
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
77
|
+
formatters?: undefined;
|
|
78
|
+
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=chains.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../../../src/clients/chains.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGrB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGvB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type Chain, type Hash, type Address } from "viem";
|
|
2
|
+
export interface DagAAConfig {
|
|
3
|
+
chain: Chain;
|
|
4
|
+
rpcUrl: string;
|
|
5
|
+
bundlerUrl: string;
|
|
6
|
+
factoryAddress: Address;
|
|
7
|
+
entryPointAddress?: Address;
|
|
8
|
+
paymasterUrl?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface SmartAccountConfig {
|
|
11
|
+
owner: `0x${string}`;
|
|
12
|
+
accountAddress?: Address;
|
|
13
|
+
}
|
|
14
|
+
export interface SendUserOperationParams {
|
|
15
|
+
target: Address;
|
|
16
|
+
data?: `0x${string}`;
|
|
17
|
+
value?: bigint;
|
|
18
|
+
maxFeePerGas?: bigint;
|
|
19
|
+
maxPriorityFeePerGas?: bigint;
|
|
20
|
+
callGasLimit?: bigint;
|
|
21
|
+
verificationGasLimit?: bigint;
|
|
22
|
+
preVerificationGas?: bigint;
|
|
23
|
+
}
|
|
24
|
+
export interface UserOperationReceipt {
|
|
25
|
+
userOpHash: Hash;
|
|
26
|
+
transactionHash?: Hash;
|
|
27
|
+
success: boolean;
|
|
28
|
+
blockNumber?: bigint;
|
|
29
|
+
blockHash?: Hash;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/clients/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,KAAK,EAGV,KAAK,IAAI,EACT,KAAK,OAAO,EAGb,MAAM,MAAM,CAAC;AAEd,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,KAAK,MAAM,EAAE,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,KAAK,MAAM,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,IAAI,CAAC;IACjB,eAAe,CAAC,EAAE,IAAI,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { createDagAAClient, parseDAG } from "../clients/actions/main";
|
|
2
|
+
export { DagAAConfig, SmartAccountConfig, SendUserOperationParams, UserOperationReceipt, } from "../clients/types";
|
|
3
|
+
export { awakening, arbitrumSep } from "../clients/chains";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEtE,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,UAAU,CAAC"}
|