@dag-kit/kit 1.0.2 → 1.0.4-alpha.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.
Files changed (54) hide show
  1. package/dist/index.cjs +564 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.cts +209 -0
  4. package/dist/index.d.ts +209 -0
  5. package/dist/index.js +544 -0
  6. package/dist/index.js.map +1 -0
  7. package/package.json +16 -11
  8. package/src/clients/actions/contract.ts +1 -1
  9. package/src/clients/actions/example.ts +252 -252
  10. package/src/clients/actions/example2.ts +60 -60
  11. package/src/clients/actions/index.ts +145 -0
  12. package/src/clients/actions/main.ts +34 -17
  13. package/src/clients/actions/test.ts +210 -210
  14. package/src/clients/types.ts +2 -1
  15. package/src/exports/index.ts +7 -4
  16. package/src/exports/public-types.ts +6 -0
  17. package/src/index.ts +17 -0
  18. package/src/signers/PrivateKeySigner.ts +41 -0
  19. package/src/signers/PrivySigner.ts +93 -0
  20. package/src/signers/types.ts +45 -0
  21. package/src/version.ts +1 -1
  22. package/dist/esm/clients/actions/contract.js +0 -42
  23. package/dist/esm/clients/actions/example.js +0 -211
  24. package/dist/esm/clients/actions/example2.js +0 -50
  25. package/dist/esm/clients/actions/index.js +0 -1
  26. package/dist/esm/clients/actions/main.js +0 -415
  27. package/dist/esm/clients/actions/test.js +0 -1
  28. package/dist/esm/clients/actions/testPaymasterService.js +0 -88
  29. package/dist/esm/clients/chains.js +0 -19
  30. package/dist/esm/clients/types.js +0 -1
  31. package/dist/esm/exports/index.js +0 -2
  32. package/dist/esm/version.js +0 -3
  33. package/dist/types/clients/actions/contract.d.ts +0 -12
  34. package/dist/types/clients/actions/contract.d.ts.map +0 -1
  35. package/dist/types/clients/actions/example.d.ts +0 -2
  36. package/dist/types/clients/actions/example.d.ts.map +0 -1
  37. package/dist/types/clients/actions/example2.d.ts +0 -2
  38. package/dist/types/clients/actions/example2.d.ts.map +0 -1
  39. package/dist/types/clients/actions/index.d.ts +0 -1
  40. package/dist/types/clients/actions/index.d.ts.map +0 -1
  41. package/dist/types/clients/actions/main.d.ts +0 -40
  42. package/dist/types/clients/actions/main.d.ts.map +0 -1
  43. package/dist/types/clients/actions/test.d.ts +0 -1
  44. package/dist/types/clients/actions/test.d.ts.map +0 -1
  45. package/dist/types/clients/actions/testPaymasterService.d.ts +0 -2
  46. package/dist/types/clients/actions/testPaymasterService.d.ts.map +0 -1
  47. package/dist/types/clients/chains.d.ts +0 -81
  48. package/dist/types/clients/chains.d.ts.map +0 -1
  49. package/dist/types/clients/types.d.ts +0 -31
  50. package/dist/types/clients/types.d.ts.map +0 -1
  51. package/dist/types/exports/index.d.ts +0 -4
  52. package/dist/types/exports/index.d.ts.map +0 -1
  53. package/dist/types/version.d.ts +0 -2
  54. package/dist/types/version.d.ts.map +0 -1
@@ -1,252 +1,252 @@
1
- import { defineChain } from "viem";
2
- import { createDagAAClient, parseDAG } from "./main";
3
- import { type Hash } from "viem";
4
- import { abi } from "./contract";
5
- import { config as dotenvConfig } from "dotenv";
6
- dotenvConfig();
7
- // ==============================================================================
8
- // Configuration
9
- // ==============================================================================
10
-
11
- const awakening = defineChain({
12
- id: 1043,
13
- name: "Awakening Testnet",
14
- nativeCurrency: { decimals: 18, name: "Dag", symbol: "DAG" },
15
- rpcUrls: { default: { http: ["https://relay.awakening.bdagscan.com"] } },
16
- blockExplorers: {
17
- default: { name: "Explorer", url: "https://awakening.bdagscan.com/" },
18
- },
19
- });
20
-
21
- // Your contract ABI
22
- const counterAbi = [
23
- {
24
- name: "increment",
25
- type: "function",
26
- stateMutability: "nonpayable",
27
- inputs: [],
28
- outputs: [],
29
- },
30
- {
31
- name: "counter",
32
- type: "function",
33
- stateMutability: "view",
34
- inputs: [],
35
- outputs: [{ name: "", type: "uint256" }],
36
- },
37
- ];
38
-
39
- // ==============================================================================
40
- // Example 1: Basic Usage
41
- // ==============================================================================
42
- const PRIVATE_KEY_1 = process.env.PRIVATE_KEY_2 as `0x${string}`;
43
-
44
- async function basicExample() {
45
- console.log("\nšŸ“¦ Example 1: Basic Usage");
46
- console.log("═══════════════════════════\n");
47
-
48
- // Create the client
49
- const client = createDagAAClient({
50
- chain: awakening,
51
- rpcUrl: "https://relay.awakening.bdagscan.com",
52
- bundlerUrl: "http://0.0.0.0:3000",
53
- factoryAddress: "0x8FaB6DF00085eb05D5F2C1FA46a6E539587ae3f3",
54
- });
55
- // Connect to your existing smart account
56
- await client.connectSmartAccount({
57
- owner: PRIVATE_KEY_1,
58
- accountAddress: "0x7fd5385efcB7B2898933288948a9496CDc0fA8ee",
59
- });
60
-
61
- // Get account info
62
- const address = client.getAddress();
63
- const balance = await client.getBalance();
64
- const isDeployed = await client.isDeployed();
65
- const nonce = await client.getNonce();
66
-
67
- console.log(`Address: ${address}`);
68
- console.log(`Balance: ${Number(balance) / 1e18} DAG`);
69
- console.log(`Deployed: ${isDeployed ? "Yes" : "No"}`);
70
- console.log(`Nonce: ${nonce}`);
71
- }
72
-
73
- // ==============================================================================
74
- // Example 2: Send Simple Transfer
75
- // ==============================================================================
76
-
77
- async function transferExample() {
78
- console.log("\nšŸ’ø Example 2: Send Transfer");
79
- console.log("═══════════════════════════\n");
80
-
81
- const client = createDagAAClient({
82
- chain: awakening,
83
- rpcUrl: "https://relay.awakening.bdagscan.com",
84
- bundlerUrl: "http://0.0.0.0:3000",
85
- factoryAddress: "0x8FaB6DF00085eb05D5F2C1FA46a6E539587ae3f3",
86
- });
87
-
88
- await client.connectSmartAccount({
89
- owner: PRIVATE_KEY_1,
90
- accountAddress: "0x7fd5385efcB7B2898933288948a9496CDc0fA8ee",
91
- });
92
-
93
- // Send 0.01 DAG to an address
94
- const txHash = await client.sendUserOperation({
95
- target: "0x1749be926ef79a63a285b01263f7ddc350d435e6",
96
- value: parseDAG("1"), // 0.01 DAG
97
- maxFeePerGas: 50000000000n,
98
- maxPriorityFeePerGas: 50000000000n,
99
- });
100
-
101
- console.log(`Transaction: ${txHash}`);
102
- }
103
-
104
- // ==============================================================================
105
- // Example 3: Call Smart Contract (Write)
106
- // ==============================================================================
107
-
108
- async function contractWriteExample() {
109
- console.log("\nšŸ“ Example 3: Contract Write");
110
- console.log("═══════════════════════════\n");
111
-
112
- const client = createDagAAClient({
113
- chain: awakening,
114
- rpcUrl: "https://relay.awakening.bdagscan.com",
115
- bundlerUrl: "http://0.0.0.0:3000",
116
- factoryAddress: "0x8FaB6DF00085eb05D5F2C1FA46a6E539587ae3f3",
117
- });
118
-
119
- await client.connectSmartAccount({
120
- owner: PRIVATE_KEY_1,
121
- accountAddress: "0x7fd5385efcB7B2898933288948a9496CDc0fA8ee",
122
- });
123
-
124
- // Call increment() on counter contract
125
- const txHash = await client.writeContract({
126
- address: "0x692e69cA1Fe89eF72ca94B0E3a32A92835501a08",
127
- abi,
128
- functionName: "increment",
129
- maxFeePerGas: 50000000000n,
130
- maxPriorityFeePerGas: 50000000000n,
131
- });
132
-
133
- console.log(`Transaction: ${txHash}`);
134
- console.log(`https://awakening.bdagscan.com/tx/${txHash}`);
135
- }
136
-
137
- // ==============================================================================
138
- // Example 4: Read Contract Data
139
- // ==============================================================================
140
-
141
- async function contractReadExample() {
142
- console.log("\nšŸ” Example 4: Contract Read");
143
- console.log("═══════════════════════════\n");
144
-
145
- const client = createDagAAClient({
146
- chain: awakening,
147
- rpcUrl: "https://relay.awakening.bdagscan.com",
148
- bundlerUrl: "http://0.0.0.0:3000",
149
- factoryAddress: "0x8FaB6DF00085eb05D5F2C1FA46a6E539587ae3f3",
150
- });
151
-
152
- await client.connectSmartAccount({
153
- owner: PRIVATE_KEY_1,
154
- accountAddress: "0x7fd5385efcB7B2898933288948a9496CDc0fA8ee",
155
- });
156
-
157
- // Read counter value
158
- const counterValue = await client.readContract({
159
- address: "0x692e69cA1Fe89eF72ca94B0E3a32A92835501a08",
160
- abi,
161
- functionName: "getNum",
162
- });
163
-
164
- console.log(`Counter value: ${counterValue}`);
165
- }
166
-
167
- // ==============================================================================
168
- // Example 5: Batch Operations
169
- // ==============================================================================
170
-
171
- async function batchExample() {
172
- console.log("\nšŸ“¦ Example 5: Batch Operations");
173
- console.log("═══════════════════════════\n");
174
-
175
- const client = createDagAAClient({
176
- chain: awakening,
177
- rpcUrl: "https://relay.awakening.bdagscan.com",
178
- bundlerUrl: "http://0.0.0.0:3000",
179
- factoryAddress: "0x8FaB6DF00085eb05D5F2C1FA46a6E539587ae3f3",
180
- });
181
-
182
- await client.connectSmartAccount({
183
- owner: PRIVATE_KEY_1,
184
- accountAddress: "0x7fd5385efcB7B2898933288948a9496CDc0fA8ee",
185
- });
186
-
187
- // Send multiple operations
188
- const hashes = await client.sendBatchUserOperations([
189
- {
190
- target: "0x1749be926ef79a63a285b01263f7ddc350d435e6",
191
- value: parseDAG("0.5"),
192
- },
193
- {
194
- target: "0x8371e519177f81b93287f750dcd06ce894c12cc5",
195
- value: parseDAG("0.5"),
196
- },
197
- ]);
198
-
199
- console.log(`Sent ${hashes.length} operations`);
200
- hashes.forEach((hash, i) => {
201
- console.log(` ${i + 1}. ${hash}`);
202
- });
203
- }
204
-
205
- // ==============================================================================
206
- // Example 6: Fund Account
207
- // ==============================================================================
208
-
209
- async function fundingExample() {
210
- console.log("\nšŸ’° Example 6: Fund Account");
211
- console.log("═══════════════════════════\n");
212
-
213
- const client = createDagAAClient({
214
- chain: awakening,
215
- rpcUrl: "https://relay.awakening.bdagscan.com",
216
- bundlerUrl: "http://0.0.0.0:3000",
217
- factoryAddress: "0x8FaB6DF00085eb05D5F2C1FA46a6E539587ae3f3",
218
- });
219
-
220
- await client.connectSmartAccount({
221
- owner: PRIVATE_KEY_1,
222
- accountAddress: "0x7fd5385efcB7B2898933288948a9496CDc0fA8ee",
223
- });
224
-
225
- // Fund from EOA
226
- const txHash = await client.fundAccount(
227
- parseDAG("1"), // 1 DAG
228
- "0x5810098e367422376897bb2645c5ada5850a99aeec0505a58d38853ebd7f9f31" // From this private key
229
- );
230
-
231
- console.log(`Funded: ${txHash}`);
232
- }
233
-
234
- // ==============================================================================
235
- // Run Examples
236
- // ==============================================================================
237
-
238
- async function main() {
239
- try {
240
- // Run the example you want
241
- // await basicExample();
242
- // await transferExample();
243
- // await contractWriteExample();
244
- await contractReadExample();
245
- // await batchExample();
246
- // await fundingExample();
247
- } catch (error) {
248
- console.error("Error:", error);
249
- }
250
- }
251
-
252
- main();
1
+ // import { defineChain } from "viem";
2
+ // import { createDagAAClient, parseDAG } from "./main";
3
+ // import { type Hash } from "viem";
4
+ // import { abi } from "./contract";
5
+ // import { config as dotenvConfig } from "dotenv";
6
+ // dotenvConfig();
7
+ // // ==============================================================================
8
+ // // Configuration
9
+ // // ==============================================================================
10
+
11
+ // const awakening = defineChain({
12
+ // id: 1043,
13
+ // name: "Awakening Testnet",
14
+ // nativeCurrency: { decimals: 18, name: "Dag", symbol: "DAG" },
15
+ // rpcUrls: { default: { http: ["https://relay.awakening.bdagscan.com"] } },
16
+ // blockExplorers: {
17
+ // default: { name: "Explorer", url: "https://awakening.bdagscan.com/" },
18
+ // },
19
+ // });
20
+
21
+ // // Your contract ABI
22
+ // const counterAbi = [
23
+ // {
24
+ // name: "increment",
25
+ // type: "function",
26
+ // stateMutability: "nonpayable",
27
+ // inputs: [],
28
+ // outputs: [],
29
+ // },
30
+ // {
31
+ // name: "counter",
32
+ // type: "function",
33
+ // stateMutability: "view",
34
+ // inputs: [],
35
+ // outputs: [{ name: "", type: "uint256" }],
36
+ // },
37
+ // ];
38
+
39
+ // // ==============================================================================
40
+ // // Example 1: Basic Usage
41
+ // // ==============================================================================
42
+ // const PRIVATE_KEY_1 = process.env.PRIVATE_KEY_2 as `0x${string}`;
43
+
44
+ // async function basicExample() {
45
+ // console.log("\nšŸ“¦ Example 1: Basic Usage");
46
+ // console.log("═══════════════════════════\n");
47
+
48
+ // // Create the client
49
+ // const client = createDagAAClient({
50
+ // chain: awakening,
51
+ // rpcUrl: "https://relay.awakening.bdagscan.com",
52
+ // bundlerUrl: "http://0.0.0.0:3000",
53
+ // factoryAddress: "0x8FaB6DF00085eb05D5F2C1FA46a6E539587ae3f3",
54
+ // });
55
+ // // Connect to your existing smart account
56
+ // await client.connectSmartAccount({
57
+ // owner: PRIVATE_KEY_1,
58
+ // accountAddress: "0x7fd5385efcB7B2898933288948a9496CDc0fA8ee",
59
+ // });
60
+
61
+ // // Get account info
62
+ // const address = client.getAddress();
63
+ // const balance = await client.getBalance();
64
+ // const isDeployed = await client.isDeployed();
65
+ // const nonce = await client.getNonce();
66
+
67
+ // console.log(`Address: ${address}`);
68
+ // console.log(`Balance: ${Number(balance) / 1e18} DAG`);
69
+ // console.log(`Deployed: ${isDeployed ? "Yes" : "No"}`);
70
+ // console.log(`Nonce: ${nonce}`);
71
+ // }
72
+
73
+ // // ==============================================================================
74
+ // // Example 2: Send Simple Transfer
75
+ // // ==============================================================================
76
+
77
+ // async function transferExample() {
78
+ // console.log("\nšŸ’ø Example 2: Send Transfer");
79
+ // console.log("═══════════════════════════\n");
80
+
81
+ // const client = createDagAAClient({
82
+ // chain: awakening,
83
+ // rpcUrl: "https://relay.awakening.bdagscan.com",
84
+ // bundlerUrl: "http://0.0.0.0:3000",
85
+ // factoryAddress: "0x8FaB6DF00085eb05D5F2C1FA46a6E539587ae3f3",
86
+ // });
87
+
88
+ // await client.connectSmartAccount({
89
+ // owner: PRIVATE_KEY_1,
90
+ // accountAddress: "0x7fd5385efcB7B2898933288948a9496CDc0fA8ee",
91
+ // });
92
+
93
+ // // Send 0.01 DAG to an address
94
+ // const txHash = await client.sendUserOperation({
95
+ // target: "0x1749be926ef79a63a285b01263f7ddc350d435e6",
96
+ // value: parseDAG("1"), // 0.01 DAG
97
+ // maxFeePerGas: 50000000000n,
98
+ // maxPriorityFeePerGas: 50000000000n,
99
+ // });
100
+
101
+ // console.log(`Transaction: ${txHash}`);
102
+ // }
103
+
104
+ // // ==============================================================================
105
+ // // Example 3: Call Smart Contract (Write)
106
+ // // ==============================================================================
107
+
108
+ // async function contractWriteExample() {
109
+ // console.log("\nšŸ“ Example 3: Contract Write");
110
+ // console.log("═══════════════════════════\n");
111
+
112
+ // const client = createDagAAClient({
113
+ // chain: awakening,
114
+ // rpcUrl: "https://relay.awakening.bdagscan.com",
115
+ // bundlerUrl: "http://0.0.0.0:3000",
116
+ // factoryAddress: "0x8FaB6DF00085eb05D5F2C1FA46a6E539587ae3f3",
117
+ // });
118
+
119
+ // await client.connectSmartAccount({
120
+ // owner: PRIVATE_KEY_1,
121
+ // accountAddress: "0x7fd5385efcB7B2898933288948a9496CDc0fA8ee",
122
+ // });
123
+
124
+ // // Call increment() on counter contract
125
+ // const txHash = await client.writeContract({
126
+ // address: "0x692e69cA1Fe89eF72ca94B0E3a32A92835501a08",
127
+ // abi,
128
+ // functionName: "increment",
129
+ // maxFeePerGas: 50000000000n,
130
+ // maxPriorityFeePerGas: 50000000000n,
131
+ // });
132
+
133
+ // console.log(`Transaction: ${txHash}`);
134
+ // console.log(`https://awakening.bdagscan.com/tx/${txHash}`);
135
+ // }
136
+
137
+ // // ==============================================================================
138
+ // // Example 4: Read Contract Data
139
+ // // ==============================================================================
140
+
141
+ // async function contractReadExample() {
142
+ // console.log("\nšŸ” Example 4: Contract Read");
143
+ // console.log("═══════════════════════════\n");
144
+
145
+ // const client = createDagAAClient({
146
+ // chain: awakening,
147
+ // rpcUrl: "https://relay.awakening.bdagscan.com",
148
+ // bundlerUrl: "http://0.0.0.0:3000",
149
+ // factoryAddress: "0x8FaB6DF00085eb05D5F2C1FA46a6E539587ae3f3",
150
+ // });
151
+
152
+ // await client.connectSmartAccount({
153
+ // owner: PRIVATE_KEY_1,
154
+ // accountAddress: "0x7fd5385efcB7B2898933288948a9496CDc0fA8ee",
155
+ // });
156
+
157
+ // // Read counter value
158
+ // const counterValue = await client.readContract({
159
+ // address: "0x692e69cA1Fe89eF72ca94B0E3a32A92835501a08",
160
+ // abi,
161
+ // functionName: "getNum",
162
+ // });
163
+
164
+ // console.log(`Counter value: ${counterValue}`);
165
+ // }
166
+
167
+ // // ==============================================================================
168
+ // // Example 5: Batch Operations
169
+ // // ==============================================================================
170
+
171
+ // async function batchExample() {
172
+ // console.log("\nšŸ“¦ Example 5: Batch Operations");
173
+ // console.log("═══════════════════════════\n");
174
+
175
+ // const client = createDagAAClient({
176
+ // chain: awakening,
177
+ // rpcUrl: "https://relay.awakening.bdagscan.com",
178
+ // bundlerUrl: "http://0.0.0.0:3000",
179
+ // factoryAddress: "0x8FaB6DF00085eb05D5F2C1FA46a6E539587ae3f3",
180
+ // });
181
+
182
+ // await client.connectSmartAccount({
183
+ // owner: PRIVATE_KEY_1,
184
+ // accountAddress: "0x7fd5385efcB7B2898933288948a9496CDc0fA8ee",
185
+ // });
186
+
187
+ // // Send multiple operations
188
+ // const hashes = await client.sendBatchUserOperations([
189
+ // {
190
+ // target: "0x1749be926ef79a63a285b01263f7ddc350d435e6",
191
+ // value: parseDAG("0.5"),
192
+ // },
193
+ // {
194
+ // target: "0x8371e519177f81b93287f750dcd06ce894c12cc5",
195
+ // value: parseDAG("0.5"),
196
+ // },
197
+ // ]);
198
+
199
+ // console.log(`Sent ${hashes.length} operations`);
200
+ // hashes.forEach((hash, i) => {
201
+ // console.log(` ${i + 1}. ${hash}`);
202
+ // });
203
+ // }
204
+
205
+ // // ==============================================================================
206
+ // // Example 6: Fund Account
207
+ // // ==============================================================================
208
+
209
+ // async function fundingExample() {
210
+ // console.log("\nšŸ’° Example 6: Fund Account");
211
+ // console.log("═══════════════════════════\n");
212
+
213
+ // const client = createDagAAClient({
214
+ // chain: awakening,
215
+ // rpcUrl: "https://relay.awakening.bdagscan.com",
216
+ // bundlerUrl: "http://0.0.0.0:3000",
217
+ // factoryAddress: "0x8FaB6DF00085eb05D5F2C1FA46a6E539587ae3f3",
218
+ // });
219
+
220
+ // await client.connectSmartAccount({
221
+ // owner: PRIVATE_KEY_1,
222
+ // accountAddress: "0x7fd5385efcB7B2898933288948a9496CDc0fA8ee",
223
+ // });
224
+
225
+ // // Fund from EOA
226
+ // const txHash = await client.fundAccount(
227
+ // parseDAG("1"), // 1 DAG
228
+ // "0x5810098e367422376897bb2645c5ada5850a99aeec0505a58d38853ebd7f9f31" // From this private key
229
+ // );
230
+
231
+ // console.log(`Funded: ${txHash}`);
232
+ // }
233
+
234
+ // // ==============================================================================
235
+ // // Run Examples
236
+ // // ==============================================================================
237
+
238
+ // async function main() {
239
+ // try {
240
+ // // Run the example you want
241
+ // // await basicExample();
242
+ // // await transferExample();
243
+ // // await contractWriteExample();
244
+ // await contractReadExample();
245
+ // // await batchExample();
246
+ // // await fundingExample();
247
+ // } catch (error) {
248
+ // console.error("Error:", error);
249
+ // }
250
+ // }
251
+
252
+ // main();
@@ -1,60 +1,60 @@
1
- import { awakening } from "../chains";
2
- import { createDagAAClient, parseDAG } from "./main";
3
- import { generatePrivateKey } from "viem/accounts";
4
- import { config as dotenvConfig } from "dotenv";
5
- dotenvConfig();
6
-
7
- const PRIVATE_KEY_2 = process.env.PRIVATE_KEY_1 as `0x${string}`;
8
- const ownerPrivy = generatePrivateKey();
9
-
10
- (async () => {
11
- console.log("Sending Simple Transaction");
12
-
13
- const client = createDagAAClient({
14
- chain: awakening.chain_config,
15
- rpcUrl: "https://rpc.awakening.bdagscan.com",
16
- bundlerUrl: awakening.bundler_rpc,
17
- factoryAddress: "0x8FaB6DF00085eb05D5F2C1FA46a6E539587ae3f3",
18
- paymasterUrl: "http://localhost:3001/rpc",
19
- });
20
-
21
- await client.connectSmartAccount({
22
- owner: "0x6b0f66a03b67d7b9eaa6c31123ffe5bf2ee58eb40ab86c8a14d6f1294838b0c8",
23
- // accountAddress: "0xDe10aaC59f659fA154C063153AB3f7Cca1fb23A5",
24
- });
25
-
26
- // Send 0.01 DAG to an address
27
- const txHash = await client.sendUserOperation({
28
- target: "0x1749be926ef79a63a285b01263f7ddc350d435e6",
29
- value: parseDAG("0"), // 0.01 DAG
30
- maxFeePerGas: 50000000000n,
31
- maxPriorityFeePerGas: 50000000000n,
32
- });
33
-
34
- console.log(`Transaction: ${txHash}`);
35
-
36
- console.log("\nšŸ“¦ Example : Batch Operations");
37
- console.log("═══════════════════════════\n");
38
-
39
- // await client.connectSmartAccount({
40
- // owner: PRIVATE_KEY_2,
41
- // accountAddress: "0x7fd5385efcB7B2898933288948a9496CDc0fA8ee",
42
- // });
43
-
44
- // // Send multiple operations
45
- // const hashes = await client.sendBatchUserOperations([
46
- // {
47
- // target: "0x1749be926ef79a63a285b01263f7ddc350d435e6",
48
- // value: parseDAG("0.5"),
49
- // },
50
- // {
51
- // target: "0x8371e519177f81b93287f750dcd06ce894c12cc5",
52
- // value: parseDAG("0.5"),
53
- // },
54
- // ]);
55
-
56
- // console.log(`Sent ${hashes.length} operations`);
57
- // hashes.forEach((hash, i) => {
58
- // console.log(` ${i + 1}. ${hash}`);
59
- // });
60
- })();
1
+ // import { awakening } from "../chains";
2
+ // import { createDagAAClient, parseDAG } from "./main";
3
+ // import { generatePrivateKey } from "viem/accounts";
4
+ // import { config as dotenvConfig } from "dotenv";
5
+ // dotenvConfig();
6
+
7
+ // const PRIVATE_KEY_2 = process.env.PRIVATE_KEY_1 as `0x${string}`;
8
+ // const ownerPrivy = generatePrivateKey();
9
+
10
+ // (async () => {
11
+ // console.log("Sending Simple Transaction");
12
+
13
+ // const client = createDagAAClient({
14
+ // chain: awakening.chain_config,
15
+ // rpcUrl: "https://rpc.awakening.bdagscan.com",
16
+ // bundlerUrl: awakening.bundler_rpc,
17
+ // factoryAddress: "0x8FaB6DF00085eb05D5F2C1FA46a6E539587ae3f3",
18
+ // paymasterUrl: "http://localhost:3001/rpc",
19
+ // });
20
+
21
+ // await client.connectSmartAccount({
22
+ // owner: "0x6b0f66a03b67d7b9eaa6c31123ffe5bf2ee58eb40ab86c8a14d6f1294838b0c8",
23
+ // // accountAddress: "0xDe10aaC59f659fA154C063153AB3f7Cca1fb23A5",
24
+ // });
25
+
26
+ // // Send 0.01 DAG to an address
27
+ // const txHash = await client.sendUserOperation({
28
+ // target: "0x1749be926ef79a63a285b01263f7ddc350d435e6",
29
+ // value: parseDAG("0"), // 0.01 DAG
30
+ // maxFeePerGas: 50000000000n,
31
+ // maxPriorityFeePerGas: 50000000000n,
32
+ // });
33
+
34
+ // console.log(`Transaction: ${txHash}`);
35
+
36
+ // console.log("\nšŸ“¦ Example : Batch Operations");
37
+ // console.log("═══════════════════════════\n");
38
+
39
+ // // await client.connectSmartAccount({
40
+ // // owner: PRIVATE_KEY_2,
41
+ // // accountAddress: "0x7fd5385efcB7B2898933288948a9496CDc0fA8ee",
42
+ // // });
43
+
44
+ // // // Send multiple operations
45
+ // // const hashes = await client.sendBatchUserOperations([
46
+ // // {
47
+ // // target: "0x1749be926ef79a63a285b01263f7ddc350d435e6",
48
+ // // value: parseDAG("0.5"),
49
+ // // },
50
+ // // {
51
+ // // target: "0x8371e519177f81b93287f750dcd06ce894c12cc5",
52
+ // // value: parseDAG("0.5"),
53
+ // // },
54
+ // // ]);
55
+
56
+ // // console.log(`Sent ${hashes.length} operations`);
57
+ // // hashes.forEach((hash, i) => {
58
+ // // console.log(` ${i + 1}. ${hash}`);
59
+ // // });
60
+ // })();