@cfxdevkit/core 0.1.0

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 (46) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/LICENSE +72 -0
  3. package/README.md +257 -0
  4. package/dist/clients/index.cjs +2053 -0
  5. package/dist/clients/index.cjs.map +1 -0
  6. package/dist/clients/index.d.cts +7 -0
  7. package/dist/clients/index.d.ts +7 -0
  8. package/dist/clients/index.js +2043 -0
  9. package/dist/clients/index.js.map +1 -0
  10. package/dist/config/index.cjs +423 -0
  11. package/dist/config/index.cjs.map +1 -0
  12. package/dist/config/index.d.cts +99 -0
  13. package/dist/config/index.d.ts +99 -0
  14. package/dist/config/index.js +380 -0
  15. package/dist/config/index.js.map +1 -0
  16. package/dist/config-BMtaWM0X.d.cts +165 -0
  17. package/dist/config-BMtaWM0X.d.ts +165 -0
  18. package/dist/core-C5qe16RS.d.ts +352 -0
  19. package/dist/core-RZA4aKwj.d.cts +352 -0
  20. package/dist/index-BhCpy6Fz.d.cts +165 -0
  21. package/dist/index-Qz84U9Oq.d.ts +165 -0
  22. package/dist/index.cjs +3773 -0
  23. package/dist/index.cjs.map +1 -0
  24. package/dist/index.d.cts +945 -0
  25. package/dist/index.d.ts +945 -0
  26. package/dist/index.js +3730 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/types/index.cjs +44 -0
  29. package/dist/types/index.cjs.map +1 -0
  30. package/dist/types/index.d.cts +5 -0
  31. package/dist/types/index.d.ts +5 -0
  32. package/dist/types/index.js +17 -0
  33. package/dist/types/index.js.map +1 -0
  34. package/dist/utils/index.cjs +83 -0
  35. package/dist/utils/index.cjs.map +1 -0
  36. package/dist/utils/index.d.cts +11 -0
  37. package/dist/utils/index.d.ts +11 -0
  38. package/dist/utils/index.js +56 -0
  39. package/dist/utils/index.js.map +1 -0
  40. package/dist/wallet/index.cjs +852 -0
  41. package/dist/wallet/index.cjs.map +1 -0
  42. package/dist/wallet/index.d.cts +726 -0
  43. package/dist/wallet/index.d.ts +726 -0
  44. package/dist/wallet/index.js +815 -0
  45. package/dist/wallet/index.js.map +1 -0
  46. package/package.json +119 -0
@@ -0,0 +1,945 @@
1
+ export { formatCFX, parseCFX } from 'cive';
2
+ export { isAddress as isCoreAddress } from 'cive/utils';
3
+ export { formatUnits, isAddress as isEspaceAddress, parseUnits } from 'viem';
4
+ export { C as CoreClient, a as CoreTestClient, b as CoreWalletClient, E as EspaceClient, c as EspaceTestClient, d as EspaceWalletClient } from './core-RZA4aKwj.cjs';
5
+ import { C as ClientManager } from './index-BhCpy6Fz.cjs';
6
+ export { a as ClientManagerConfig, b as ClientManagerEvents, c as ClientManagerStatus } from './index-BhCpy6Fz.cjs';
7
+ export { CORE_LOCAL, CORE_MAINNET, CORE_TESTNET, ChainConfig, EVM_LOCAL, EVM_MAINNET, EVM_TESTNET, defaultNetworkSelector, getChainConfig, getCoreChains, getEvmChains, getMainnetChains } from './config/index.cjs';
8
+ import { C as ChainType } from './config-BMtaWM0X.cjs';
9
+ export { A as Address, e as CoreAddress, f as EvmAddress, H as Hash, k as UnifiedAccount } from './config-BMtaWM0X.cjs';
10
+ export { logger } from './utils/index.cjs';
11
+ export { BatchResult, BatchTransaction, BatcherError, BatcherOptions, EmbeddedWallet, EmbeddedWalletError, EmbeddedWalletManager, EmbeddedWalletOptions, SessionKey, SessionKeyError, SessionKeyManager, SessionKeyOptions, SessionKeyPermissions, SignTransactionRequest, SignedTransaction, TransactionBatcher, WalletError, WalletExport, WalletManagerOptions, deriveAccount, deriveAccounts, deriveFaucetAccount, generateMnemonic, validateMnemonic } from './wallet/index.cjs';
12
+ import 'node:events';
13
+
14
+ /**
15
+ * Standard ERC20 Token ABI
16
+ */
17
+ declare const ERC20_ABI: readonly [{
18
+ readonly inputs: readonly [];
19
+ readonly name: "name";
20
+ readonly outputs: readonly [{
21
+ readonly name: "";
22
+ readonly type: "string";
23
+ }];
24
+ readonly stateMutability: "view";
25
+ readonly type: "function";
26
+ }, {
27
+ readonly inputs: readonly [];
28
+ readonly name: "symbol";
29
+ readonly outputs: readonly [{
30
+ readonly name: "";
31
+ readonly type: "string";
32
+ }];
33
+ readonly stateMutability: "view";
34
+ readonly type: "function";
35
+ }, {
36
+ readonly inputs: readonly [];
37
+ readonly name: "decimals";
38
+ readonly outputs: readonly [{
39
+ readonly name: "";
40
+ readonly type: "uint8";
41
+ }];
42
+ readonly stateMutability: "view";
43
+ readonly type: "function";
44
+ }, {
45
+ readonly inputs: readonly [];
46
+ readonly name: "totalSupply";
47
+ readonly outputs: readonly [{
48
+ readonly name: "";
49
+ readonly type: "uint256";
50
+ }];
51
+ readonly stateMutability: "view";
52
+ readonly type: "function";
53
+ }, {
54
+ readonly inputs: readonly [{
55
+ readonly name: "account";
56
+ readonly type: "address";
57
+ }];
58
+ readonly name: "balanceOf";
59
+ readonly outputs: readonly [{
60
+ readonly name: "";
61
+ readonly type: "uint256";
62
+ }];
63
+ readonly stateMutability: "view";
64
+ readonly type: "function";
65
+ }, {
66
+ readonly inputs: readonly [{
67
+ readonly name: "owner";
68
+ readonly type: "address";
69
+ }, {
70
+ readonly name: "spender";
71
+ readonly type: "address";
72
+ }];
73
+ readonly name: "allowance";
74
+ readonly outputs: readonly [{
75
+ readonly name: "";
76
+ readonly type: "uint256";
77
+ }];
78
+ readonly stateMutability: "view";
79
+ readonly type: "function";
80
+ }, {
81
+ readonly inputs: readonly [{
82
+ readonly name: "to";
83
+ readonly type: "address";
84
+ }, {
85
+ readonly name: "amount";
86
+ readonly type: "uint256";
87
+ }];
88
+ readonly name: "transfer";
89
+ readonly outputs: readonly [{
90
+ readonly name: "";
91
+ readonly type: "bool";
92
+ }];
93
+ readonly stateMutability: "nonpayable";
94
+ readonly type: "function";
95
+ }, {
96
+ readonly inputs: readonly [{
97
+ readonly name: "spender";
98
+ readonly type: "address";
99
+ }, {
100
+ readonly name: "amount";
101
+ readonly type: "uint256";
102
+ }];
103
+ readonly name: "approve";
104
+ readonly outputs: readonly [{
105
+ readonly name: "";
106
+ readonly type: "bool";
107
+ }];
108
+ readonly stateMutability: "nonpayable";
109
+ readonly type: "function";
110
+ }, {
111
+ readonly inputs: readonly [{
112
+ readonly name: "from";
113
+ readonly type: "address";
114
+ }, {
115
+ readonly name: "to";
116
+ readonly type: "address";
117
+ }, {
118
+ readonly name: "amount";
119
+ readonly type: "uint256";
120
+ }];
121
+ readonly name: "transferFrom";
122
+ readonly outputs: readonly [{
123
+ readonly name: "";
124
+ readonly type: "bool";
125
+ }];
126
+ readonly stateMutability: "nonpayable";
127
+ readonly type: "function";
128
+ }, {
129
+ readonly anonymous: false;
130
+ readonly inputs: readonly [{
131
+ readonly indexed: true;
132
+ readonly name: "from";
133
+ readonly type: "address";
134
+ }, {
135
+ readonly indexed: true;
136
+ readonly name: "to";
137
+ readonly type: "address";
138
+ }, {
139
+ readonly indexed: false;
140
+ readonly name: "value";
141
+ readonly type: "uint256";
142
+ }];
143
+ readonly name: "Transfer";
144
+ readonly type: "event";
145
+ }, {
146
+ readonly anonymous: false;
147
+ readonly inputs: readonly [{
148
+ readonly indexed: true;
149
+ readonly name: "owner";
150
+ readonly type: "address";
151
+ }, {
152
+ readonly indexed: true;
153
+ readonly name: "spender";
154
+ readonly type: "address";
155
+ }, {
156
+ readonly indexed: false;
157
+ readonly name: "value";
158
+ readonly type: "uint256";
159
+ }];
160
+ readonly name: "Approval";
161
+ readonly type: "event";
162
+ }];
163
+
164
+ /**
165
+ * Standard ERC721 NFT ABI
166
+ */
167
+ declare const ERC721_ABI: readonly [{
168
+ readonly inputs: readonly [];
169
+ readonly name: "name";
170
+ readonly outputs: readonly [{
171
+ readonly name: "";
172
+ readonly type: "string";
173
+ }];
174
+ readonly stateMutability: "view";
175
+ readonly type: "function";
176
+ }, {
177
+ readonly inputs: readonly [];
178
+ readonly name: "symbol";
179
+ readonly outputs: readonly [{
180
+ readonly name: "";
181
+ readonly type: "string";
182
+ }];
183
+ readonly stateMutability: "view";
184
+ readonly type: "function";
185
+ }, {
186
+ readonly inputs: readonly [{
187
+ readonly name: "tokenId";
188
+ readonly type: "uint256";
189
+ }];
190
+ readonly name: "tokenURI";
191
+ readonly outputs: readonly [{
192
+ readonly name: "";
193
+ readonly type: "string";
194
+ }];
195
+ readonly stateMutability: "view";
196
+ readonly type: "function";
197
+ }, {
198
+ readonly inputs: readonly [{
199
+ readonly name: "owner";
200
+ readonly type: "address";
201
+ }];
202
+ readonly name: "balanceOf";
203
+ readonly outputs: readonly [{
204
+ readonly name: "";
205
+ readonly type: "uint256";
206
+ }];
207
+ readonly stateMutability: "view";
208
+ readonly type: "function";
209
+ }, {
210
+ readonly inputs: readonly [{
211
+ readonly name: "tokenId";
212
+ readonly type: "uint256";
213
+ }];
214
+ readonly name: "ownerOf";
215
+ readonly outputs: readonly [{
216
+ readonly name: "";
217
+ readonly type: "address";
218
+ }];
219
+ readonly stateMutability: "view";
220
+ readonly type: "function";
221
+ }, {
222
+ readonly inputs: readonly [{
223
+ readonly name: "owner";
224
+ readonly type: "address";
225
+ }, {
226
+ readonly name: "operator";
227
+ readonly type: "address";
228
+ }];
229
+ readonly name: "isApprovedForAll";
230
+ readonly outputs: readonly [{
231
+ readonly name: "";
232
+ readonly type: "bool";
233
+ }];
234
+ readonly stateMutability: "view";
235
+ readonly type: "function";
236
+ }, {
237
+ readonly inputs: readonly [{
238
+ readonly name: "tokenId";
239
+ readonly type: "uint256";
240
+ }];
241
+ readonly name: "getApproved";
242
+ readonly outputs: readonly [{
243
+ readonly name: "";
244
+ readonly type: "address";
245
+ }];
246
+ readonly stateMutability: "view";
247
+ readonly type: "function";
248
+ }, {
249
+ readonly inputs: readonly [{
250
+ readonly name: "interfaceId";
251
+ readonly type: "bytes4";
252
+ }];
253
+ readonly name: "supportsInterface";
254
+ readonly outputs: readonly [{
255
+ readonly name: "";
256
+ readonly type: "bool";
257
+ }];
258
+ readonly stateMutability: "view";
259
+ readonly type: "function";
260
+ }, {
261
+ readonly inputs: readonly [{
262
+ readonly name: "from";
263
+ readonly type: "address";
264
+ }, {
265
+ readonly name: "to";
266
+ readonly type: "address";
267
+ }, {
268
+ readonly name: "tokenId";
269
+ readonly type: "uint256";
270
+ }];
271
+ readonly name: "transferFrom";
272
+ readonly outputs: readonly [];
273
+ readonly stateMutability: "nonpayable";
274
+ readonly type: "function";
275
+ }, {
276
+ readonly inputs: readonly [{
277
+ readonly name: "from";
278
+ readonly type: "address";
279
+ }, {
280
+ readonly name: "to";
281
+ readonly type: "address";
282
+ }, {
283
+ readonly name: "tokenId";
284
+ readonly type: "uint256";
285
+ }];
286
+ readonly name: "safeTransferFrom";
287
+ readonly outputs: readonly [];
288
+ readonly stateMutability: "nonpayable";
289
+ readonly type: "function";
290
+ }, {
291
+ readonly inputs: readonly [{
292
+ readonly name: "from";
293
+ readonly type: "address";
294
+ }, {
295
+ readonly name: "to";
296
+ readonly type: "address";
297
+ }, {
298
+ readonly name: "tokenId";
299
+ readonly type: "uint256";
300
+ }, {
301
+ readonly name: "data";
302
+ readonly type: "bytes";
303
+ }];
304
+ readonly name: "safeTransferFrom";
305
+ readonly outputs: readonly [];
306
+ readonly stateMutability: "nonpayable";
307
+ readonly type: "function";
308
+ }, {
309
+ readonly inputs: readonly [{
310
+ readonly name: "to";
311
+ readonly type: "address";
312
+ }, {
313
+ readonly name: "tokenId";
314
+ readonly type: "uint256";
315
+ }];
316
+ readonly name: "approve";
317
+ readonly outputs: readonly [];
318
+ readonly stateMutability: "nonpayable";
319
+ readonly type: "function";
320
+ }, {
321
+ readonly inputs: readonly [{
322
+ readonly name: "operator";
323
+ readonly type: "address";
324
+ }, {
325
+ readonly name: "approved";
326
+ readonly type: "bool";
327
+ }];
328
+ readonly name: "setApprovalForAll";
329
+ readonly outputs: readonly [];
330
+ readonly stateMutability: "nonpayable";
331
+ readonly type: "function";
332
+ }, {
333
+ readonly anonymous: false;
334
+ readonly inputs: readonly [{
335
+ readonly indexed: true;
336
+ readonly name: "from";
337
+ readonly type: "address";
338
+ }, {
339
+ readonly indexed: true;
340
+ readonly name: "to";
341
+ readonly type: "address";
342
+ }, {
343
+ readonly indexed: true;
344
+ readonly name: "tokenId";
345
+ readonly type: "uint256";
346
+ }];
347
+ readonly name: "Transfer";
348
+ readonly type: "event";
349
+ }, {
350
+ readonly anonymous: false;
351
+ readonly inputs: readonly [{
352
+ readonly indexed: true;
353
+ readonly name: "owner";
354
+ readonly type: "address";
355
+ }, {
356
+ readonly indexed: true;
357
+ readonly name: "approved";
358
+ readonly type: "address";
359
+ }, {
360
+ readonly indexed: true;
361
+ readonly name: "tokenId";
362
+ readonly type: "uint256";
363
+ }];
364
+ readonly name: "Approval";
365
+ readonly type: "event";
366
+ }, {
367
+ readonly anonymous: false;
368
+ readonly inputs: readonly [{
369
+ readonly indexed: true;
370
+ readonly name: "owner";
371
+ readonly type: "address";
372
+ }, {
373
+ readonly indexed: true;
374
+ readonly name: "operator";
375
+ readonly type: "address";
376
+ }, {
377
+ readonly indexed: false;
378
+ readonly name: "approved";
379
+ readonly type: "bool";
380
+ }];
381
+ readonly name: "ApprovalForAll";
382
+ readonly type: "event";
383
+ }];
384
+
385
+ /**
386
+ * Standard ERC1155 Multi-Token ABI
387
+ */
388
+ declare const ERC1155_ABI: readonly [{
389
+ readonly inputs: readonly [{
390
+ readonly name: "id";
391
+ readonly type: "uint256";
392
+ }];
393
+ readonly name: "uri";
394
+ readonly outputs: readonly [{
395
+ readonly name: "";
396
+ readonly type: "string";
397
+ }];
398
+ readonly stateMutability: "view";
399
+ readonly type: "function";
400
+ }, {
401
+ readonly inputs: readonly [{
402
+ readonly name: "account";
403
+ readonly type: "address";
404
+ }, {
405
+ readonly name: "id";
406
+ readonly type: "uint256";
407
+ }];
408
+ readonly name: "balanceOf";
409
+ readonly outputs: readonly [{
410
+ readonly name: "";
411
+ readonly type: "uint256";
412
+ }];
413
+ readonly stateMutability: "view";
414
+ readonly type: "function";
415
+ }, {
416
+ readonly inputs: readonly [{
417
+ readonly name: "accounts";
418
+ readonly type: "address[]";
419
+ }, {
420
+ readonly name: "ids";
421
+ readonly type: "uint256[]";
422
+ }];
423
+ readonly name: "balanceOfBatch";
424
+ readonly outputs: readonly [{
425
+ readonly name: "";
426
+ readonly type: "uint256[]";
427
+ }];
428
+ readonly stateMutability: "view";
429
+ readonly type: "function";
430
+ }, {
431
+ readonly inputs: readonly [{
432
+ readonly name: "account";
433
+ readonly type: "address";
434
+ }, {
435
+ readonly name: "operator";
436
+ readonly type: "address";
437
+ }];
438
+ readonly name: "isApprovedForAll";
439
+ readonly outputs: readonly [{
440
+ readonly name: "";
441
+ readonly type: "bool";
442
+ }];
443
+ readonly stateMutability: "view";
444
+ readonly type: "function";
445
+ }, {
446
+ readonly inputs: readonly [{
447
+ readonly name: "interfaceId";
448
+ readonly type: "bytes4";
449
+ }];
450
+ readonly name: "supportsInterface";
451
+ readonly outputs: readonly [{
452
+ readonly name: "";
453
+ readonly type: "bool";
454
+ }];
455
+ readonly stateMutability: "view";
456
+ readonly type: "function";
457
+ }, {
458
+ readonly inputs: readonly [{
459
+ readonly name: "operator";
460
+ readonly type: "address";
461
+ }, {
462
+ readonly name: "approved";
463
+ readonly type: "bool";
464
+ }];
465
+ readonly name: "setApprovalForAll";
466
+ readonly outputs: readonly [];
467
+ readonly stateMutability: "nonpayable";
468
+ readonly type: "function";
469
+ }, {
470
+ readonly inputs: readonly [{
471
+ readonly name: "from";
472
+ readonly type: "address";
473
+ }, {
474
+ readonly name: "to";
475
+ readonly type: "address";
476
+ }, {
477
+ readonly name: "id";
478
+ readonly type: "uint256";
479
+ }, {
480
+ readonly name: "amount";
481
+ readonly type: "uint256";
482
+ }, {
483
+ readonly name: "data";
484
+ readonly type: "bytes";
485
+ }];
486
+ readonly name: "safeTransferFrom";
487
+ readonly outputs: readonly [];
488
+ readonly stateMutability: "nonpayable";
489
+ readonly type: "function";
490
+ }, {
491
+ readonly inputs: readonly [{
492
+ readonly name: "from";
493
+ readonly type: "address";
494
+ }, {
495
+ readonly name: "to";
496
+ readonly type: "address";
497
+ }, {
498
+ readonly name: "ids";
499
+ readonly type: "uint256[]";
500
+ }, {
501
+ readonly name: "amounts";
502
+ readonly type: "uint256[]";
503
+ }, {
504
+ readonly name: "data";
505
+ readonly type: "bytes";
506
+ }];
507
+ readonly name: "safeBatchTransferFrom";
508
+ readonly outputs: readonly [];
509
+ readonly stateMutability: "nonpayable";
510
+ readonly type: "function";
511
+ }, {
512
+ readonly anonymous: false;
513
+ readonly inputs: readonly [{
514
+ readonly indexed: true;
515
+ readonly name: "operator";
516
+ readonly type: "address";
517
+ }, {
518
+ readonly indexed: true;
519
+ readonly name: "from";
520
+ readonly type: "address";
521
+ }, {
522
+ readonly indexed: true;
523
+ readonly name: "to";
524
+ readonly type: "address";
525
+ }, {
526
+ readonly indexed: false;
527
+ readonly name: "id";
528
+ readonly type: "uint256";
529
+ }, {
530
+ readonly indexed: false;
531
+ readonly name: "value";
532
+ readonly type: "uint256";
533
+ }];
534
+ readonly name: "TransferSingle";
535
+ readonly type: "event";
536
+ }, {
537
+ readonly anonymous: false;
538
+ readonly inputs: readonly [{
539
+ readonly indexed: true;
540
+ readonly name: "operator";
541
+ readonly type: "address";
542
+ }, {
543
+ readonly indexed: true;
544
+ readonly name: "from";
545
+ readonly type: "address";
546
+ }, {
547
+ readonly indexed: true;
548
+ readonly name: "to";
549
+ readonly type: "address";
550
+ }, {
551
+ readonly indexed: false;
552
+ readonly name: "ids";
553
+ readonly type: "uint256[]";
554
+ }, {
555
+ readonly indexed: false;
556
+ readonly name: "values";
557
+ readonly type: "uint256[]";
558
+ }];
559
+ readonly name: "TransferBatch";
560
+ readonly type: "event";
561
+ }, {
562
+ readonly anonymous: false;
563
+ readonly inputs: readonly [{
564
+ readonly indexed: true;
565
+ readonly name: "account";
566
+ readonly type: "address";
567
+ }, {
568
+ readonly indexed: true;
569
+ readonly name: "operator";
570
+ readonly type: "address";
571
+ }, {
572
+ readonly indexed: false;
573
+ readonly name: "approved";
574
+ readonly type: "bool";
575
+ }];
576
+ readonly name: "ApprovalForAll";
577
+ readonly type: "event";
578
+ }, {
579
+ readonly anonymous: false;
580
+ readonly inputs: readonly [{
581
+ readonly indexed: false;
582
+ readonly name: "value";
583
+ readonly type: "string";
584
+ }, {
585
+ readonly indexed: true;
586
+ readonly name: "id";
587
+ readonly type: "uint256";
588
+ }];
589
+ readonly name: "URI";
590
+ readonly type: "event";
591
+ }];
592
+
593
+ /**
594
+ * Contract Deployment Types
595
+ */
596
+ interface DeploymentOptions {
597
+ /** Contract bytecode */
598
+ bytecode: string;
599
+ /** Contract ABI */
600
+ abi: unknown[];
601
+ /** Constructor arguments */
602
+ args?: unknown[];
603
+ /** Chain to deploy on */
604
+ chain: ChainType;
605
+ /** Value to send with deployment (in wei) */
606
+ value?: bigint;
607
+ /** Gas limit */
608
+ gasLimit?: bigint;
609
+ /** Gas price (in wei) */
610
+ gasPrice?: bigint;
611
+ }
612
+ interface DeploymentResult {
613
+ /** Deployed contract address */
614
+ address: string;
615
+ /** Deployment transaction hash */
616
+ transactionHash: string;
617
+ /** Block number of deployment */
618
+ blockNumber: bigint;
619
+ /** Deployer address */
620
+ deployer: string;
621
+ /** Chain deployed on */
622
+ chain: ChainType;
623
+ /** Deployment timestamp */
624
+ deployedAt: Date;
625
+ /** Gas used for deployment */
626
+ gasUsed: bigint;
627
+ }
628
+ /**
629
+ * Contract Interaction Types
630
+ */
631
+ interface ReadOptions {
632
+ /** Contract address */
633
+ address: string;
634
+ /** Contract ABI */
635
+ abi: unknown[];
636
+ /** Function name to call */
637
+ functionName: string;
638
+ /** Function arguments */
639
+ args?: unknown[];
640
+ /** Chain to read from */
641
+ chain: ChainType;
642
+ /** Block number to read at (optional) */
643
+ blockNumber?: bigint;
644
+ }
645
+ interface WriteOptions {
646
+ /** Contract address */
647
+ address: string;
648
+ /** Contract ABI */
649
+ abi: unknown[];
650
+ /** Function name to call */
651
+ functionName: string;
652
+ /** Function arguments */
653
+ args?: unknown[];
654
+ /** Chain to write to */
655
+ chain: ChainType;
656
+ /** Value to send (in wei) */
657
+ value?: bigint;
658
+ /** Gas limit */
659
+ gasLimit?: bigint;
660
+ /** Gas price (in wei) */
661
+ gasPrice?: bigint;
662
+ /** Wait for transaction confirmation */
663
+ waitForConfirmation?: boolean;
664
+ }
665
+ interface WriteResult {
666
+ /** Transaction hash */
667
+ hash: string;
668
+ /** From address */
669
+ from: string;
670
+ /** To address (contract) */
671
+ to: string;
672
+ /** Chain */
673
+ chain: ChainType;
674
+ /** Block number (if confirmed) */
675
+ blockNumber?: bigint;
676
+ /** Gas used (if confirmed) */
677
+ gasUsed?: bigint;
678
+ /** Transaction status */
679
+ status?: 'success' | 'reverted';
680
+ }
681
+ /**
682
+ * Contract Verification Types
683
+ */
684
+ interface ContractInfo {
685
+ /** Contract address */
686
+ address: string;
687
+ /** Contract name */
688
+ name?: string;
689
+ /** Contract bytecode */
690
+ bytecode: string;
691
+ /** Contract ABI */
692
+ abi?: unknown[];
693
+ /** Deployment block */
694
+ deploymentBlock?: bigint;
695
+ /** Chain */
696
+ chain: ChainType;
697
+ /** Is verified */
698
+ isVerified: boolean;
699
+ }
700
+ /**
701
+ * Multi-Chain Deployment Types
702
+ */
703
+ interface MultiChainDeploymentOptions {
704
+ /** Contract bytecode */
705
+ bytecode: string;
706
+ /** Contract ABI */
707
+ abi: unknown[];
708
+ /** Constructor arguments */
709
+ args?: unknown[];
710
+ /** Chains to deploy on */
711
+ chains: ChainType[];
712
+ /** Value per deployment (in wei) */
713
+ value?: bigint;
714
+ }
715
+ interface MultiChainDeploymentResult {
716
+ /** Core Space deployment */
717
+ core?: DeploymentResult;
718
+ /** eSpace deployment */
719
+ evm?: DeploymentResult;
720
+ /** Number of successful deployments */
721
+ successCount: number;
722
+ /** Number of failed deployments */
723
+ failureCount: number;
724
+ }
725
+ /**
726
+ * Error Types
727
+ */
728
+ declare class ContractError extends Error {
729
+ code: string;
730
+ context?: Record<string, unknown> | undefined;
731
+ constructor(message: string, code: string, context?: Record<string, unknown> | undefined);
732
+ }
733
+ declare class DeploymentError extends ContractError {
734
+ constructor(message: string, context?: Record<string, unknown>);
735
+ }
736
+ declare class InteractionError extends ContractError {
737
+ constructor(message: string, context?: Record<string, unknown>);
738
+ }
739
+
740
+ /**
741
+ * Contract Deployer
742
+ *
743
+ * Handles contract deployment to Conflux blockchains.
744
+ * Supports both Core Space (CFX native) and eSpace (EVM-compatible).
745
+ *
746
+ * @example
747
+ * ```typescript
748
+ * const deployer = new ContractDeployer(clientManager);
749
+ *
750
+ * // Deploy to eSpace
751
+ * const result = await deployer.deploy({
752
+ * bytecode: '0x6080604052...',
753
+ * abi: [...],
754
+ * args: ['Token Name', 'SYMBOL'],
755
+ * chain: 'evm'
756
+ * });
757
+ *
758
+ * console.log(`Deployed to: ${result.address}`);
759
+ * ```
760
+ */
761
+ declare class ContractDeployer {
762
+ private readonly clientManager;
763
+ constructor(clientManager: ClientManager);
764
+ /**
765
+ * Deploy contract to a single chain
766
+ *
767
+ * @param options - Deployment configuration
768
+ * @returns Deployment result
769
+ */
770
+ deploy(options: DeploymentOptions): Promise<DeploymentResult>;
771
+ /**
772
+ * Deploy contract to multiple chains
773
+ *
774
+ * @param options - Multi-chain deployment configuration
775
+ * @returns Multi-chain deployment results
776
+ */
777
+ deployToMultipleChains(options: MultiChainDeploymentOptions): Promise<MultiChainDeploymentResult>;
778
+ /**
779
+ * Deploy contract to Core Space (Conflux native)
780
+ */
781
+ private deployToCore;
782
+ /**
783
+ * Deploy contract to eSpace (EVM-compatible)
784
+ */
785
+ private deployToEvm;
786
+ /**
787
+ * Estimate deployment gas
788
+ *
789
+ * @param options - Deployment configuration
790
+ * @returns Estimated gas
791
+ */
792
+ estimateDeploymentGas(options: DeploymentOptions): Promise<bigint>;
793
+ /**
794
+ * Verify contract bytecode matches deployed contract
795
+ *
796
+ * @param address - Contract address
797
+ * @param expectedBytecode - Expected bytecode
798
+ * @param chain - Chain type
799
+ * @returns true if verified
800
+ */
801
+ verifyBytecode(_address: string, _expectedBytecode: string, _chain: 'core' | 'evm'): Promise<boolean>;
802
+ }
803
+
804
+ /**
805
+ * Contract Reader
806
+ *
807
+ * Reads data from deployed contracts without modifying state.
808
+ * Supports both Core Space and eSpace contracts.
809
+ *
810
+ * @example
811
+ * ```typescript
812
+ * const reader = new ContractReader(clientManager);
813
+ *
814
+ * // Read ERC20 balance
815
+ * const balance = await reader.read({
816
+ * address: '0xToken...',
817
+ * abi: ERC20_ABI,
818
+ * functionName: 'balanceOf',
819
+ * args: ['0xUser...'],
820
+ * chain: 'evm'
821
+ * });
822
+ * ```
823
+ */
824
+ declare class ContractReader {
825
+ private clientManager;
826
+ constructor(clientManager: ClientManager);
827
+ /**
828
+ * Read data from contract
829
+ *
830
+ * @param options - Read configuration
831
+ * @returns Function return value
832
+ */
833
+ read<T = unknown>(options: ReadOptions): Promise<T>;
834
+ /**
835
+ * Batch read multiple values from same contract
836
+ *
837
+ * @param address - Contract address
838
+ * @param abi - Contract ABI
839
+ * @param calls - Array of function calls
840
+ * @param chain - Chain type
841
+ * @returns Array of results
842
+ */
843
+ batchRead<T = unknown>(address: string, abi: unknown[], calls: Array<{
844
+ functionName: string;
845
+ args?: unknown[];
846
+ }>, chain: 'core' | 'evm'): Promise<T[]>;
847
+ /**
848
+ * Get contract information
849
+ *
850
+ * @param address - Contract address
851
+ * @param chain - Chain type
852
+ * @returns Contract info
853
+ */
854
+ getContractInfo(address: string, chain: 'core' | 'evm'): Promise<ContractInfo>;
855
+ /**
856
+ * Check if address is a contract
857
+ *
858
+ * @param address - Address to check
859
+ * @param chain - Chain type
860
+ * @returns true if contract exists
861
+ */
862
+ isContract(_address: string, _chain: 'core' | 'evm'): Promise<boolean>;
863
+ /**
864
+ * Read from Core Space contract
865
+ */
866
+ private readFromCore;
867
+ /**
868
+ * Read from eSpace contract
869
+ */
870
+ private readFromEvm;
871
+ }
872
+
873
+ /**
874
+ * Contract Writer
875
+ *
876
+ * Writes data to deployed contracts (state-changing operations).
877
+ * Supports both Core Space and eSpace contracts.
878
+ *
879
+ * @example
880
+ * ```typescript
881
+ * const writer = new ContractWriter(clientManager);
882
+ *
883
+ * // Transfer ERC20 tokens
884
+ * const result = await writer.write({
885
+ * address: '0xToken...',
886
+ * abi: ERC20_ABI,
887
+ * functionName: 'transfer',
888
+ * args: ['0xRecipient...', parseEther('10')],
889
+ * chain: 'evm',
890
+ * waitForConfirmation: true
891
+ * });
892
+ *
893
+ * console.log(`Transaction hash: ${result.hash}`);
894
+ * ```
895
+ */
896
+ declare class ContractWriter {
897
+ private clientManager;
898
+ constructor(clientManager: ClientManager);
899
+ /**
900
+ * Write to contract (state-changing operation)
901
+ *
902
+ * @param options - Write configuration
903
+ * @returns Write result with transaction info
904
+ */
905
+ write(options: WriteOptions): Promise<WriteResult>;
906
+ /**
907
+ * Estimate gas for contract write
908
+ *
909
+ * @param options - Write configuration
910
+ * @returns Estimated gas
911
+ */
912
+ estimateGas(options: WriteOptions): Promise<bigint>;
913
+ /**
914
+ * Simulate contract write without sending transaction
915
+ *
916
+ * @param options - Write configuration
917
+ * @returns Simulation result
918
+ */
919
+ simulate<T = unknown>(options: WriteOptions): Promise<T>;
920
+ /**
921
+ * Write to Core Space contract
922
+ */
923
+ private writeToCore;
924
+ /**
925
+ * Write to eSpace contract
926
+ */
927
+ private writeToEvm;
928
+ /**
929
+ * Simulate Core Space contract write
930
+ */
931
+ private simulateCore;
932
+ /**
933
+ * Simulate eSpace contract write
934
+ */
935
+ private simulateEvm;
936
+ /**
937
+ * Batch write multiple transactions
938
+ *
939
+ * @param writes - Array of write operations
940
+ * @returns Array of write results
941
+ */
942
+ batchWrite(writes: WriteOptions[]): Promise<WriteResult[]>;
943
+ }
944
+
945
+ export { ChainType, ClientManager, ContractDeployer, ContractError, ContractReader, ContractWriter, DeploymentError, ERC1155_ABI, ERC20_ABI, ERC721_ABI, InteractionError };