@alephium/web3 0.1.0-rc.3 → 0.2.0-rc.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.
- package/contracts/{add.ral → add/add.ral} +1 -1
- package/contracts/{greeter.ral → greeter/greeter.ral} +0 -0
- package/contracts/{greeter_interface.ral → greeter/greeter_interface.ral} +0 -0
- package/contracts/greeter_main.ral +1 -1
- package/contracts/main.ral +1 -1
- package/contracts/{sub.ral → sub/sub.ral} +0 -0
- package/dev/user.conf +1 -0
- package/dist/alephium-web3.min.js +1 -1
- package/dist/alephium-web3.min.js.map +1 -1
- package/dist/src/api/api-alephium.d.ts +85 -4
- package/dist/src/api/api-alephium.js +1 -1
- package/dist/src/api/api-explorer.d.ts +33 -6
- package/dist/src/contract/contract.d.ts +18 -10
- package/dist/src/contract/contract.js +95 -56
- package/dist/src/contract/events.d.ts +7 -25
- package/dist/src/contract/events.js +18 -31
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/transaction/index.d.ts +2 -0
- package/dist/src/transaction/index.js +31 -0
- package/dist/src/{utils/transaction.d.ts → transaction/sign-verify.d.ts} +0 -0
- package/dist/src/{utils/transaction.js → transaction/sign-verify.js} +1 -1
- package/dist/src/transaction/status.d.ts +10 -0
- package/dist/src/transaction/status.js +48 -0
- package/dist/src/utils/index.d.ts +1 -1
- package/dist/src/utils/index.js +1 -1
- package/dist/src/utils/subscription.d.ts +24 -0
- package/dist/src/utils/subscription.js +52 -0
- package/dist/src/utils/utils.d.ts +2 -0
- package/dist/src/utils/utils.js +9 -1
- package/package.json +3 -3
- package/src/api/api-alephium.ts +126 -4
- package/src/api/api-explorer.ts +50 -6
- package/src/contract/contract.ts +112 -66
- package/src/contract/events.ts +21 -48
- package/src/index.ts +1 -0
- package/src/signer/signer.ts +1 -1
- package/src/transaction/index.ts +20 -0
- package/src/{utils/transaction.test.ts → transaction/sign-verify.test.ts} +1 -1
- package/src/{utils/transaction.ts → transaction/sign-verify.ts} +1 -1
- package/src/transaction/status.ts +58 -0
- package/src/utils/index.ts +1 -1
- package/src/utils/subscription.ts +72 -0
- package/src/utils/utils.test.ts +2 -1
- package/src/utils/utils.ts +8 -0
- package/templates/base/package.json +2 -2
- package/templates/react/package.json +2 -2
- package/test/contract.test.ts +24 -7
- package/test/events.test.ts +18 -19
- package/test/transaction.test.ts +72 -0
|
@@ -31,6 +31,7 @@ export interface AssetInput {
|
|
|
31
31
|
unlockScript: string;
|
|
32
32
|
}
|
|
33
33
|
export interface AssetOutput {
|
|
34
|
+
/** @format int32 */
|
|
34
35
|
hint: number;
|
|
35
36
|
/** @format 32-byte-hash */
|
|
36
37
|
key: string;
|
|
@@ -62,6 +63,9 @@ export interface Balance {
|
|
|
62
63
|
lockedBalance: string;
|
|
63
64
|
/** @format x.x ALPH */
|
|
64
65
|
lockedBalanceHint: string;
|
|
66
|
+
tokenBalances?: Token[];
|
|
67
|
+
lockedTokenBalances?: Token[];
|
|
68
|
+
/** @format int32 */
|
|
65
69
|
utxoNum: number;
|
|
66
70
|
warning?: string;
|
|
67
71
|
}
|
|
@@ -86,8 +90,11 @@ export interface BlockEntry {
|
|
|
86
90
|
hash: string;
|
|
87
91
|
/** @format int64 */
|
|
88
92
|
timestamp: number;
|
|
93
|
+
/** @format int32 */
|
|
89
94
|
chainFrom: number;
|
|
95
|
+
/** @format int32 */
|
|
90
96
|
chainTo: number;
|
|
97
|
+
/** @format int32 */
|
|
91
98
|
height: number;
|
|
92
99
|
deps: string[];
|
|
93
100
|
transactions: Transaction[];
|
|
@@ -106,18 +113,26 @@ export interface BlockHeaderEntry {
|
|
|
106
113
|
hash: string;
|
|
107
114
|
/** @format int64 */
|
|
108
115
|
timestamp: number;
|
|
116
|
+
/** @format int32 */
|
|
109
117
|
chainFrom: number;
|
|
118
|
+
/** @format int32 */
|
|
110
119
|
chainTo: number;
|
|
120
|
+
/** @format int32 */
|
|
111
121
|
height: number;
|
|
112
122
|
deps: string[];
|
|
113
123
|
}
|
|
114
124
|
export interface BrokerInfo {
|
|
115
125
|
/** @format clique-id */
|
|
116
126
|
cliqueId: string;
|
|
127
|
+
/** @format int32 */
|
|
117
128
|
brokerId: number;
|
|
129
|
+
/** @format int32 */
|
|
118
130
|
brokerNum: number;
|
|
119
131
|
/** @format inet-socket-address */
|
|
120
|
-
address:
|
|
132
|
+
address: {
|
|
133
|
+
addr: string;
|
|
134
|
+
port: number;
|
|
135
|
+
};
|
|
121
136
|
}
|
|
122
137
|
export interface BuildDeployContractTx {
|
|
123
138
|
/** @format public-key */
|
|
@@ -133,9 +148,13 @@ export interface BuildDeployContractTx {
|
|
|
133
148
|
gasAmount?: number;
|
|
134
149
|
/** @format uint256 */
|
|
135
150
|
gasPrice?: string;
|
|
151
|
+
/** @format block-hash */
|
|
152
|
+
targetBlockHash?: string;
|
|
136
153
|
}
|
|
137
154
|
export interface BuildDeployContractTxResult {
|
|
155
|
+
/** @format int32 */
|
|
138
156
|
fromGroup: number;
|
|
157
|
+
/** @format int32 */
|
|
139
158
|
toGroup: number;
|
|
140
159
|
unsignedTx: string;
|
|
141
160
|
/** @format gas */
|
|
@@ -159,9 +178,13 @@ export interface BuildExecuteScriptTx {
|
|
|
159
178
|
gasAmount?: number;
|
|
160
179
|
/** @format uint256 */
|
|
161
180
|
gasPrice?: string;
|
|
181
|
+
/** @format block-hash */
|
|
182
|
+
targetBlockHash?: string;
|
|
162
183
|
}
|
|
163
184
|
export interface BuildExecuteScriptTxResult {
|
|
185
|
+
/** @format int32 */
|
|
164
186
|
fromGroup: number;
|
|
187
|
+
/** @format int32 */
|
|
165
188
|
toGroup: number;
|
|
166
189
|
unsignedTx: string;
|
|
167
190
|
/** @format gas */
|
|
@@ -187,6 +210,7 @@ export interface BuildMultisig {
|
|
|
187
210
|
}
|
|
188
211
|
export interface BuildMultisigAddress {
|
|
189
212
|
keys: string[];
|
|
213
|
+
/** @format int32 */
|
|
190
214
|
mrequired: number;
|
|
191
215
|
}
|
|
192
216
|
export interface BuildMultisigAddressResult {
|
|
@@ -204,10 +228,14 @@ export interface BuildSweepAddressTransactions {
|
|
|
204
228
|
gasAmount?: number;
|
|
205
229
|
/** @format uint256 */
|
|
206
230
|
gasPrice?: string;
|
|
231
|
+
/** @format block-hash */
|
|
232
|
+
targetBlockHash?: string;
|
|
207
233
|
}
|
|
208
234
|
export interface BuildSweepAddressTransactionsResult {
|
|
209
235
|
unsignedTxs: SweepAddressTransaction[];
|
|
236
|
+
/** @format int32 */
|
|
210
237
|
fromGroup: number;
|
|
238
|
+
/** @format int32 */
|
|
211
239
|
toGroup: number;
|
|
212
240
|
}
|
|
213
241
|
export interface BuildTransaction {
|
|
@@ -219,6 +247,8 @@ export interface BuildTransaction {
|
|
|
219
247
|
gasAmount?: number;
|
|
220
248
|
/** @format uint256 */
|
|
221
249
|
gasPrice?: string;
|
|
250
|
+
/** @format block-hash */
|
|
251
|
+
targetBlockHash?: string;
|
|
222
252
|
}
|
|
223
253
|
export interface BuildTransactionResult {
|
|
224
254
|
unsignedTx: string;
|
|
@@ -228,10 +258,13 @@ export interface BuildTransactionResult {
|
|
|
228
258
|
gasPrice: string;
|
|
229
259
|
/** @format 32-byte-hash */
|
|
230
260
|
txId: string;
|
|
261
|
+
/** @format int32 */
|
|
231
262
|
fromGroup: number;
|
|
263
|
+
/** @format int32 */
|
|
232
264
|
toGroup: number;
|
|
233
265
|
}
|
|
234
266
|
export interface CallContract {
|
|
267
|
+
/** @format int32 */
|
|
235
268
|
group: number;
|
|
236
269
|
/** @format block-hash */
|
|
237
270
|
worldStateBlockHash?: string;
|
|
@@ -239,6 +272,7 @@ export interface CallContract {
|
|
|
239
272
|
txId?: string;
|
|
240
273
|
/** @format address */
|
|
241
274
|
address: string;
|
|
275
|
+
/** @format int32 */
|
|
242
276
|
methodIndex: number;
|
|
243
277
|
args?: Val[];
|
|
244
278
|
existingContracts?: string[];
|
|
@@ -246,6 +280,7 @@ export interface CallContract {
|
|
|
246
280
|
}
|
|
247
281
|
export interface CallContractResult {
|
|
248
282
|
returns: Val[];
|
|
283
|
+
/** @format int32 */
|
|
249
284
|
gasUsed: number;
|
|
250
285
|
contracts: ContractState[];
|
|
251
286
|
txInputs: string[];
|
|
@@ -253,12 +288,16 @@ export interface CallContractResult {
|
|
|
253
288
|
events: ContractEventByTxId[];
|
|
254
289
|
}
|
|
255
290
|
export interface ChainInfo {
|
|
291
|
+
/** @format int32 */
|
|
256
292
|
currentHeight: number;
|
|
257
293
|
}
|
|
258
294
|
export interface ChainParams {
|
|
259
295
|
networkId: number;
|
|
296
|
+
/** @format int32 */
|
|
260
297
|
numZerosAtLeastInHash: number;
|
|
298
|
+
/** @format int32 */
|
|
261
299
|
groupNumPerBroker: number;
|
|
300
|
+
/** @format int32 */
|
|
262
301
|
groups: number;
|
|
263
302
|
}
|
|
264
303
|
export interface ChangeActiveAddress {
|
|
@@ -281,9 +320,13 @@ export interface CompileScriptResult {
|
|
|
281
320
|
export interface Confirmed {
|
|
282
321
|
/** @format block-hash */
|
|
283
322
|
blockHash: string;
|
|
323
|
+
/** @format int32 */
|
|
284
324
|
txIndex: number;
|
|
325
|
+
/** @format int32 */
|
|
285
326
|
chainConfirmations: number;
|
|
327
|
+
/** @format int32 */
|
|
286
328
|
fromGroupConfirmations: number;
|
|
329
|
+
/** @format int32 */
|
|
287
330
|
toGroupConfirmations: number;
|
|
288
331
|
type: string;
|
|
289
332
|
}
|
|
@@ -295,6 +338,7 @@ export interface ContractEvent {
|
|
|
295
338
|
blockHash: string;
|
|
296
339
|
/** @format 32-byte-hash */
|
|
297
340
|
txId: string;
|
|
341
|
+
/** @format int32 */
|
|
298
342
|
eventIndex: number;
|
|
299
343
|
fields: Val[];
|
|
300
344
|
}
|
|
@@ -303,18 +347,22 @@ export interface ContractEventByTxId {
|
|
|
303
347
|
blockHash: string;
|
|
304
348
|
/** @format address */
|
|
305
349
|
contractAddress: string;
|
|
350
|
+
/** @format int32 */
|
|
306
351
|
eventIndex: number;
|
|
307
352
|
fields: Val[];
|
|
308
353
|
}
|
|
309
354
|
export interface ContractEvents {
|
|
310
355
|
events: ContractEvent[];
|
|
356
|
+
/** @format int32 */
|
|
311
357
|
nextStart: number;
|
|
312
358
|
}
|
|
313
359
|
export interface ContractEventsByTxId {
|
|
314
360
|
events: ContractEventByTxId[];
|
|
361
|
+
/** @format int32 */
|
|
315
362
|
nextStart: number;
|
|
316
363
|
}
|
|
317
364
|
export interface ContractOutput {
|
|
365
|
+
/** @format int32 */
|
|
318
366
|
hint: number;
|
|
319
367
|
/** @format 32-byte-hash */
|
|
320
368
|
key: string;
|
|
@@ -341,7 +389,9 @@ export interface DecodeUnsignedTx {
|
|
|
341
389
|
unsignedTx: string;
|
|
342
390
|
}
|
|
343
391
|
export interface DecodeUnsignedTxResult {
|
|
392
|
+
/** @format int32 */
|
|
344
393
|
fromGroup: number;
|
|
394
|
+
/** @format int32 */
|
|
345
395
|
toGroup: number;
|
|
346
396
|
unsignedTx: UnsignedTx;
|
|
347
397
|
}
|
|
@@ -372,6 +422,7 @@ export interface FieldsSig {
|
|
|
372
422
|
types: string[];
|
|
373
423
|
}
|
|
374
424
|
export interface FixedAssetOutput {
|
|
425
|
+
/** @format int32 */
|
|
375
426
|
hint: number;
|
|
376
427
|
/** @format 32-byte-hash */
|
|
377
428
|
key: string;
|
|
@@ -393,6 +444,7 @@ export interface FunctionSig {
|
|
|
393
444
|
returnTypes: string[];
|
|
394
445
|
}
|
|
395
446
|
export interface Group {
|
|
447
|
+
/** @format int32 */
|
|
396
448
|
group: number;
|
|
397
449
|
}
|
|
398
450
|
export interface HashesAtHeight {
|
|
@@ -401,10 +453,15 @@ export interface HashesAtHeight {
|
|
|
401
453
|
export interface InterCliquePeerInfo {
|
|
402
454
|
/** @format clique-id */
|
|
403
455
|
cliqueId: string;
|
|
456
|
+
/** @format int32 */
|
|
404
457
|
brokerId: number;
|
|
458
|
+
/** @format int32 */
|
|
405
459
|
groupNumPerBroker: number;
|
|
406
460
|
/** @format inet-socket-address */
|
|
407
|
-
address:
|
|
461
|
+
address: {
|
|
462
|
+
addr: string;
|
|
463
|
+
port: number;
|
|
464
|
+
};
|
|
408
465
|
isSynced: boolean;
|
|
409
466
|
clientVersion: string;
|
|
410
467
|
}
|
|
@@ -425,7 +482,10 @@ export interface NodeInfo {
|
|
|
425
482
|
buildInfo: BuildInfo;
|
|
426
483
|
upnp: boolean;
|
|
427
484
|
/** @format inet-socket-address */
|
|
428
|
-
externalAddress?:
|
|
485
|
+
externalAddress?: {
|
|
486
|
+
addr: string;
|
|
487
|
+
port: number;
|
|
488
|
+
};
|
|
429
489
|
}
|
|
430
490
|
export interface NodeVersion {
|
|
431
491
|
version: ReleaseVersion;
|
|
@@ -436,6 +496,7 @@ export interface NotFound {
|
|
|
436
496
|
}
|
|
437
497
|
export declare type Output = AssetOutput | ContractOutput;
|
|
438
498
|
export interface OutputRef {
|
|
499
|
+
/** @format int32 */
|
|
439
500
|
hint: number;
|
|
440
501
|
/** @format 32-byte-hash */
|
|
441
502
|
key: string;
|
|
@@ -443,8 +504,11 @@ export interface OutputRef {
|
|
|
443
504
|
export interface PeerAddress {
|
|
444
505
|
/** @format inet-address */
|
|
445
506
|
address: string;
|
|
507
|
+
/** @format int32 */
|
|
446
508
|
restPort: number;
|
|
509
|
+
/** @format int32 */
|
|
447
510
|
wsPort: number;
|
|
511
|
+
/** @format int32 */
|
|
448
512
|
minerApiPort: number;
|
|
449
513
|
}
|
|
450
514
|
export interface PeerMisbehavior {
|
|
@@ -454,6 +518,7 @@ export interface PeerMisbehavior {
|
|
|
454
518
|
}
|
|
455
519
|
export declare type PeerStatus = Banned | Penalty;
|
|
456
520
|
export interface Penalty {
|
|
521
|
+
/** @format int32 */
|
|
457
522
|
value: number;
|
|
458
523
|
type: string;
|
|
459
524
|
}
|
|
@@ -462,8 +527,11 @@ export interface Reachable {
|
|
|
462
527
|
type: string;
|
|
463
528
|
}
|
|
464
529
|
export interface ReleaseVersion {
|
|
530
|
+
/** @format int32 */
|
|
465
531
|
major: number;
|
|
532
|
+
/** @format int32 */
|
|
466
533
|
minor: number;
|
|
534
|
+
/** @format int32 */
|
|
467
535
|
patch: number;
|
|
468
536
|
}
|
|
469
537
|
export interface RevealMnemonic {
|
|
@@ -504,7 +572,9 @@ export interface SubmitTransaction {
|
|
|
504
572
|
export interface SubmitTxResult {
|
|
505
573
|
/** @format 32-byte-hash */
|
|
506
574
|
txId: string;
|
|
575
|
+
/** @format int32 */
|
|
507
576
|
fromGroup: number;
|
|
577
|
+
/** @format int32 */
|
|
508
578
|
toGroup: number;
|
|
509
579
|
}
|
|
510
580
|
export interface Sweep {
|
|
@@ -516,7 +586,10 @@ export interface Sweep {
|
|
|
516
586
|
gasAmount?: number;
|
|
517
587
|
/** @format uint256 */
|
|
518
588
|
gasPrice?: string;
|
|
589
|
+
/** @format int32 */
|
|
519
590
|
utxosLimit?: number;
|
|
591
|
+
/** @format block-hash */
|
|
592
|
+
targetBlockHash?: string;
|
|
520
593
|
}
|
|
521
594
|
export interface SweepAddressTransaction {
|
|
522
595
|
/** @format 32-byte-hash */
|
|
@@ -528,6 +601,7 @@ export interface SweepAddressTransaction {
|
|
|
528
601
|
gasPrice: string;
|
|
529
602
|
}
|
|
530
603
|
export interface TestContract {
|
|
604
|
+
/** @format int32 */
|
|
531
605
|
group?: number;
|
|
532
606
|
/** @format block-hash */
|
|
533
607
|
blockHash?: string;
|
|
@@ -539,6 +613,7 @@ export interface TestContract {
|
|
|
539
613
|
bytecode: string;
|
|
540
614
|
initialFields?: Val[];
|
|
541
615
|
initialAsset?: AssetState;
|
|
616
|
+
/** @format int32 */
|
|
542
617
|
methodIndex?: number;
|
|
543
618
|
args?: Val[];
|
|
544
619
|
existingContracts?: ContractState[];
|
|
@@ -550,6 +625,7 @@ export interface TestContractResult {
|
|
|
550
625
|
/** @format 32-byte-hash */
|
|
551
626
|
codeHash: string;
|
|
552
627
|
returns: Val[];
|
|
628
|
+
/** @format int32 */
|
|
553
629
|
gasUsed: number;
|
|
554
630
|
contracts: ContractState[];
|
|
555
631
|
txInputs: string[];
|
|
@@ -586,6 +662,7 @@ export interface Transfer {
|
|
|
586
662
|
gas?: number;
|
|
587
663
|
/** @format uint256 */
|
|
588
664
|
gasPrice?: string;
|
|
665
|
+
/** @format int32 */
|
|
589
666
|
utxosLimit?: number;
|
|
590
667
|
}
|
|
591
668
|
export interface TransferResult {
|
|
@@ -625,7 +702,9 @@ export interface Unban {
|
|
|
625
702
|
type: string;
|
|
626
703
|
}
|
|
627
704
|
export interface UnconfirmedTransactions {
|
|
705
|
+
/** @format int32 */
|
|
628
706
|
fromGroup: number;
|
|
707
|
+
/** @format int32 */
|
|
629
708
|
toGroup: number;
|
|
630
709
|
unconfirmedTransactions: TransactionTemplate[];
|
|
631
710
|
}
|
|
@@ -640,6 +719,7 @@ export interface UnsignedTx {
|
|
|
640
719
|
networkId: number;
|
|
641
720
|
/** @format script */
|
|
642
721
|
scriptOpt?: string;
|
|
722
|
+
/** @format int32 */
|
|
643
723
|
gasAmount: number;
|
|
644
724
|
/** @format uint256 */
|
|
645
725
|
gasPrice: string;
|
|
@@ -666,6 +746,7 @@ export interface ValByteVec {
|
|
|
666
746
|
type: string;
|
|
667
747
|
}
|
|
668
748
|
export interface ValI256 {
|
|
749
|
+
/** @format bigint */
|
|
669
750
|
value: string;
|
|
670
751
|
type: string;
|
|
671
752
|
}
|
|
@@ -774,7 +855,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
|
|
|
774
855
|
}
|
|
775
856
|
/**
|
|
776
857
|
* @title Alephium API
|
|
777
|
-
* @version 1.
|
|
858
|
+
* @version 1.5.0-rc0
|
|
778
859
|
* @baseUrl {protocol}://{host}:{port}
|
|
779
860
|
*/
|
|
780
861
|
export declare class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
|
|
@@ -9,30 +9,39 @@ export interface AddressInfo {
|
|
|
9
9
|
balance: string;
|
|
10
10
|
/** @format uint256 */
|
|
11
11
|
lockedBalance: string;
|
|
12
|
+
/** @format int32 */
|
|
12
13
|
txNumber: number;
|
|
13
14
|
}
|
|
14
15
|
export interface BadRequest {
|
|
15
16
|
detail: string;
|
|
16
17
|
}
|
|
17
18
|
export interface BlockEntryLite {
|
|
19
|
+
/** @format block-hash */
|
|
18
20
|
hash: string;
|
|
19
21
|
/** @format int64 */
|
|
20
22
|
timestamp: number;
|
|
23
|
+
/** @format int32 */
|
|
21
24
|
chainFrom: number;
|
|
25
|
+
/** @format int32 */
|
|
22
26
|
chainTo: number;
|
|
27
|
+
/** @format int32 */
|
|
23
28
|
height: number;
|
|
29
|
+
/** @format int32 */
|
|
24
30
|
txNumber: number;
|
|
25
31
|
mainChain: boolean;
|
|
26
32
|
/** @format bigint */
|
|
27
33
|
hashRate: string;
|
|
28
34
|
}
|
|
29
35
|
export interface ConfirmedTransaction {
|
|
36
|
+
/** @format 32-byte-hash */
|
|
30
37
|
hash: string;
|
|
38
|
+
/** @format block-hash */
|
|
31
39
|
blockHash: string;
|
|
32
40
|
/** @format int64 */
|
|
33
41
|
timestamp: number;
|
|
34
42
|
inputs?: Input[];
|
|
35
43
|
outputs?: Output[];
|
|
44
|
+
/** @format int32 */
|
|
36
45
|
gasAmount: number;
|
|
37
46
|
/** @format uint256 */
|
|
38
47
|
gasPrice: string;
|
|
@@ -45,12 +54,13 @@ export interface ExplorerInfo {
|
|
|
45
54
|
export interface Hashrate {
|
|
46
55
|
/** @format int64 */
|
|
47
56
|
timestamp: number;
|
|
48
|
-
hashrate:
|
|
49
|
-
value:
|
|
57
|
+
hashrate: number;
|
|
58
|
+
value: number;
|
|
50
59
|
}
|
|
51
60
|
export interface Input {
|
|
52
61
|
outputRef: OutputRef;
|
|
53
62
|
unlockScript?: string;
|
|
63
|
+
/** @format 32-byte-hash */
|
|
54
64
|
txHashRef: string;
|
|
55
65
|
address: string;
|
|
56
66
|
/** @format uint256 */
|
|
@@ -60,6 +70,7 @@ export interface InternalServerError {
|
|
|
60
70
|
detail: string;
|
|
61
71
|
}
|
|
62
72
|
export interface ListBlocks {
|
|
73
|
+
/** @format int32 */
|
|
63
74
|
total: number;
|
|
64
75
|
blocks?: BlockEntryLite[];
|
|
65
76
|
}
|
|
@@ -68,6 +79,7 @@ export interface NotFound {
|
|
|
68
79
|
resource: string;
|
|
69
80
|
}
|
|
70
81
|
export interface Output {
|
|
82
|
+
/** @format int32 */
|
|
71
83
|
hint: number;
|
|
72
84
|
/** @format 32-byte-hash */
|
|
73
85
|
key: string;
|
|
@@ -76,21 +88,27 @@ export interface Output {
|
|
|
76
88
|
address: string;
|
|
77
89
|
/** @format int64 */
|
|
78
90
|
lockTime?: number;
|
|
91
|
+
/** @format 32-byte-hash */
|
|
79
92
|
spent?: string;
|
|
80
93
|
}
|
|
81
94
|
export interface OutputRef {
|
|
95
|
+
/** @format int32 */
|
|
82
96
|
hint: number;
|
|
83
97
|
/** @format 32-byte-hash */
|
|
84
98
|
key: string;
|
|
85
99
|
}
|
|
86
100
|
export interface PerChainCount {
|
|
101
|
+
/** @format int32 */
|
|
87
102
|
chainFrom: number;
|
|
103
|
+
/** @format int32 */
|
|
88
104
|
chainTo: number;
|
|
89
105
|
/** @format int64 */
|
|
90
106
|
count: number;
|
|
91
107
|
}
|
|
92
108
|
export interface PerChainDuration {
|
|
109
|
+
/** @format int32 */
|
|
93
110
|
chainFrom: number;
|
|
111
|
+
/** @format int32 */
|
|
94
112
|
chainTo: number;
|
|
95
113
|
/** @format int64 */
|
|
96
114
|
duration: number;
|
|
@@ -98,7 +116,9 @@ export interface PerChainDuration {
|
|
|
98
116
|
value: number;
|
|
99
117
|
}
|
|
100
118
|
export interface PerChainHeight {
|
|
119
|
+
/** @format int32 */
|
|
101
120
|
chainFrom: number;
|
|
121
|
+
/** @format int32 */
|
|
102
122
|
chainTo: number;
|
|
103
123
|
/** @format int64 */
|
|
104
124
|
height: number;
|
|
@@ -134,12 +154,15 @@ export interface TokenSupply {
|
|
|
134
154
|
maximum: string;
|
|
135
155
|
}
|
|
136
156
|
export interface Transaction {
|
|
157
|
+
/** @format 32-byte-hash */
|
|
137
158
|
hash: string;
|
|
159
|
+
/** @format block-hash */
|
|
138
160
|
blockHash: string;
|
|
139
161
|
/** @format int64 */
|
|
140
162
|
timestamp: number;
|
|
141
163
|
inputs?: Input[];
|
|
142
164
|
outputs?: Output[];
|
|
165
|
+
/** @format int32 */
|
|
143
166
|
gasAmount: number;
|
|
144
167
|
/** @format uint256 */
|
|
145
168
|
gasPrice: string;
|
|
@@ -160,11 +183,15 @@ export interface Unauthorized {
|
|
|
160
183
|
detail: string;
|
|
161
184
|
}
|
|
162
185
|
export interface UnconfirmedTransaction {
|
|
186
|
+
/** @format 32-byte-hash */
|
|
163
187
|
hash: string;
|
|
188
|
+
/** @format int32 */
|
|
164
189
|
chainFrom: number;
|
|
190
|
+
/** @format int32 */
|
|
165
191
|
chainTo: number;
|
|
166
192
|
inputs?: UInput[];
|
|
167
193
|
outputs?: UOutput[];
|
|
194
|
+
/** @format int32 */
|
|
168
195
|
gasAmount: number;
|
|
169
196
|
/** @format uint256 */
|
|
170
197
|
gasPrice: string;
|
|
@@ -351,7 +378,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
351
378
|
* @name GetInfosSupplyTotalAlph
|
|
352
379
|
* @request GET:/infos/supply/total-alph
|
|
353
380
|
*/
|
|
354
|
-
getInfosSupplyTotalAlph: (params?: RequestParams) => Promise<
|
|
381
|
+
getInfosSupplyTotalAlph: (params?: RequestParams) => Promise<number>;
|
|
355
382
|
/**
|
|
356
383
|
* @description Get the ALPH circulating supply
|
|
357
384
|
*
|
|
@@ -359,7 +386,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
359
386
|
* @name GetInfosSupplyCirculatingAlph
|
|
360
387
|
* @request GET:/infos/supply/circulating-alph
|
|
361
388
|
*/
|
|
362
|
-
getInfosSupplyCirculatingAlph: (params?: RequestParams) => Promise<
|
|
389
|
+
getInfosSupplyCirculatingAlph: (params?: RequestParams) => Promise<number>;
|
|
363
390
|
/**
|
|
364
391
|
* @description Get the ALPH reserved supply
|
|
365
392
|
*
|
|
@@ -367,7 +394,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
367
394
|
* @name GetInfosSupplyReservedAlph
|
|
368
395
|
* @request GET:/infos/supply/reserved-alph
|
|
369
396
|
*/
|
|
370
|
-
getInfosSupplyReservedAlph: (params?: RequestParams) => Promise<
|
|
397
|
+
getInfosSupplyReservedAlph: (params?: RequestParams) => Promise<number>;
|
|
371
398
|
/**
|
|
372
399
|
* @description Get the ALPH locked supply
|
|
373
400
|
*
|
|
@@ -375,7 +402,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
375
402
|
* @name GetInfosSupplyLockedAlph
|
|
376
403
|
* @request GET:/infos/supply/locked-alph
|
|
377
404
|
*/
|
|
378
|
-
getInfosSupplyLockedAlph: (params?: RequestParams) => Promise<
|
|
405
|
+
getInfosSupplyLockedAlph: (params?: RequestParams) => Promise<number>;
|
|
379
406
|
/**
|
|
380
407
|
* @description Get the total number of transactions
|
|
381
408
|
*
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { NodeProvider } from '../api';
|
|
2
2
|
import { node } from '../api';
|
|
3
3
|
import { SignDeployContractTxParams, SignExecuteScriptTxParams, SignerWithNodeProvider } from '../signer';
|
|
4
|
+
declare class SourceFile {
|
|
5
|
+
readonly dirs: string[];
|
|
6
|
+
readonly dirPath: string;
|
|
7
|
+
readonly contractPath: string;
|
|
8
|
+
readonly artifactPath: string;
|
|
9
|
+
constructor(dirs: string[], fileName: string);
|
|
10
|
+
}
|
|
4
11
|
export declare abstract class Common {
|
|
5
12
|
readonly sourceCodeSha256: string;
|
|
6
13
|
readonly functions: node.FunctionSig[];
|
|
@@ -13,16 +20,15 @@ export declare abstract class Common {
|
|
|
13
20
|
protected static _getArtifactFromCache(codeHash: string): Contract | Script | undefined;
|
|
14
21
|
protected static _putArtifactToCache(contract: Contract): void;
|
|
15
22
|
constructor(sourceCodeSha256: string, functions: node.FunctionSig[]);
|
|
16
|
-
protected static _contractPath(fileName: string): string;
|
|
17
|
-
protected static _artifactPath(fileName: string): string;
|
|
18
23
|
protected static _artifactsFolder(): string;
|
|
19
|
-
|
|
20
|
-
protected static
|
|
24
|
+
static getSourceFile(path: string, _dirs: string[]): SourceFile;
|
|
25
|
+
protected static _handleImports(pathes: string[], contractStr: string, importsCache: string[]): Promise<string>;
|
|
26
|
+
protected static _loadContractStr(sourceFile: SourceFile, importsCache: string[], validate: (code: string) => void): Promise<string>;
|
|
21
27
|
static checkFileNameExtension(fileName: string): void;
|
|
22
28
|
protected static _from<T extends {
|
|
23
29
|
sourceCodeSha256: string;
|
|
24
|
-
}>(provider: NodeProvider,
|
|
25
|
-
protected _saveToFile(
|
|
30
|
+
}>(provider: NodeProvider, sourceFile: SourceFile, loadContractStr: (sourceFile: SourceFile, importsCache: string[]) => Promise<string>, compile: (provider: NodeProvider, sourceFile: SourceFile, contractStr: string, contractHash: string) => Promise<T>): Promise<T>;
|
|
31
|
+
protected _saveToFile(sourceFile: SourceFile): Promise<void>;
|
|
26
32
|
abstract buildByteCodeToDeploy(initialFields?: Fields): string;
|
|
27
33
|
}
|
|
28
34
|
export declare class Contract extends Common {
|
|
@@ -33,10 +39,11 @@ export declare class Contract extends Common {
|
|
|
33
39
|
constructor(sourceCodeSha256: string, bytecode: string, codeHash: string, fieldsSig: node.FieldsSig, eventsSig: node.EventSig[], functions: node.FunctionSig[]);
|
|
34
40
|
static checkCodeType(fileName: string, contractStr: string): void;
|
|
35
41
|
private static loadContractStr;
|
|
36
|
-
static fromSource(provider: NodeProvider,
|
|
42
|
+
static fromSource(provider: NodeProvider, path: string): Promise<Contract>;
|
|
37
43
|
private static compile;
|
|
38
44
|
static fromJson(artifact: any): Contract;
|
|
39
|
-
static fromArtifactFile(
|
|
45
|
+
static fromArtifactFile(path: string): Promise<Contract>;
|
|
46
|
+
fetchState(provider: NodeProvider, address: string, group: number): Promise<ContractState>;
|
|
40
47
|
toString(): string;
|
|
41
48
|
toState(fields: Fields, asset: Asset, address?: string): ContractState;
|
|
42
49
|
static randomAddress(): string;
|
|
@@ -65,10 +72,10 @@ export declare class Script extends Common {
|
|
|
65
72
|
constructor(sourceCodeSha256: string, bytecodeTemplate: string, fieldsSig: node.FieldsSig, functions: node.FunctionSig[]);
|
|
66
73
|
static checkCodeType(fileName: string, contractStr: string): void;
|
|
67
74
|
private static loadContractStr;
|
|
68
|
-
static fromSource(provider: NodeProvider,
|
|
75
|
+
static fromSource(provider: NodeProvider, path: string): Promise<Script>;
|
|
69
76
|
private static compile;
|
|
70
77
|
static fromJson(artifact: any): Script;
|
|
71
|
-
static fromArtifactFile(
|
|
78
|
+
static fromArtifactFile(path: string): Promise<Script>;
|
|
72
79
|
toString(): string;
|
|
73
80
|
paramsForDeployment(params: BuildExecuteScriptTx): Promise<SignExecuteScriptTxParams>;
|
|
74
81
|
transactionForDeployment(signer: SignerWithNodeProvider, params: Omit<BuildExecuteScriptTx, 'signerAddress'>): Promise<BuildScriptTxResult>;
|
|
@@ -180,3 +187,4 @@ export interface BuildScriptTxResult {
|
|
|
180
187
|
unsignedTx: string;
|
|
181
188
|
txId: string;
|
|
182
189
|
}
|
|
190
|
+
export {};
|