@alephium/web3 0.2.0-rc.2 → 0.2.0-rc.21
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/.eslintignore +2 -2
- package/README.md +2 -135
- package/dist/alephium-web3.min.js +1 -1
- package/dist/alephium-web3.min.js.LICENSE.txt +0 -17
- package/dist/alephium-web3.min.js.map +1 -1
- package/dist/src/api/api-alephium.d.ts +126 -22
- package/dist/src/api/api-alephium.js +145 -79
- package/dist/src/api/api-explorer.d.ts +163 -48
- package/dist/src/api/api-explorer.js +157 -34
- package/dist/src/api/index.d.ts +3 -2
- package/dist/src/api/index.js +22 -3
- package/dist/src/api/types.d.ts +23 -0
- package/dist/src/api/types.js +240 -0
- package/dist/src/api/utils.d.ts +6 -0
- package/dist/{scripts/rename-gitignore.js → src/api/utils.js} +11 -6
- package/dist/src/contract/contract.d.ts +117 -69
- package/dist/src/contract/contract.js +401 -435
- package/dist/src/contract/events.d.ts +4 -4
- package/dist/src/contract/index.js +5 -1
- package/dist/src/contract/ralph.d.ts +5 -4
- package/dist/src/contract/ralph.js +27 -1
- package/dist/src/global.d.ts +4 -0
- package/dist/{scripts/stop-devnet.js → src/global.js} +17 -11
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +23 -1
- package/dist/src/signer/index.d.ts +0 -1
- package/dist/src/signer/index.js +5 -2
- package/dist/src/signer/signer.d.ts +21 -11
- package/dist/src/signer/signer.js +46 -9
- package/dist/src/transaction/index.d.ts +0 -1
- package/dist/src/transaction/index.js +5 -2
- package/dist/src/transaction/status.d.ts +2 -1
- package/dist/src/utils/bs58.d.ts +1 -0
- package/dist/src/utils/bs58.js +13 -1
- package/dist/src/utils/index.d.ts +0 -1
- package/dist/src/utils/index.js +5 -2
- package/dist/src/utils/subscription.d.ts +0 -1
- package/dist/src/utils/subscription.js +2 -1
- package/dist/src/utils/utils.d.ts +6 -11
- package/dist/src/utils/utils.js +21 -25
- package/jest-config.json +11 -0
- package/package.json +11 -47
- package/src/api/api-alephium.ts +178 -30
- package/src/api/api-explorer.ts +234 -51
- package/src/api/index.ts +14 -3
- package/src/api/types.ts +233 -0
- package/{scripts/rename-gitignore.js → src/api/utils.ts} +7 -6
- package/src/contract/contract.ts +602 -527
- package/src/contract/events.ts +6 -6
- package/src/contract/ralph.ts +29 -4
- package/src/{transaction/sign-verify.ts → global.ts} +14 -15
- package/src/index.ts +7 -0
- package/src/signer/index.ts +0 -1
- package/src/signer/signer.ts +70 -19
- package/src/transaction/index.ts +0 -1
- package/src/transaction/status.ts +4 -2
- package/src/utils/bs58.ts +11 -0
- package/src/utils/index.ts +0 -1
- package/src/utils/subscription.ts +3 -3
- package/src/utils/utils.ts +14 -22
- package/.eslintrc.json +0 -21
- package/LICENSE +0 -165
- package/contracts/add/add.ral +0 -16
- package/contracts/greeter/greeter.ral +0 -7
- package/contracts/greeter/greeter_interface.ral +0 -3
- package/contracts/greeter_main.ral +0 -9
- package/contracts/main.ral +0 -6
- package/contracts/sub/sub.ral +0 -9
- package/dev/user.conf +0 -29
- package/dist/scripts/create-project.d.ts +0 -2
- package/dist/scripts/create-project.js +0 -125
- package/dist/scripts/rename-gitignore.d.ts +0 -1
- package/dist/scripts/start-devnet.d.ts +0 -1
- package/dist/scripts/start-devnet.js +0 -131
- package/dist/scripts/stop-devnet.d.ts +0 -1
- package/dist/src/signer/node-wallet.d.ts +0 -13
- package/dist/src/signer/node-wallet.js +0 -60
- package/dist/src/test/index.d.ts +0 -7
- package/dist/src/test/index.js +0 -41
- package/dist/src/test/privatekey-wallet.d.ts +0 -12
- package/dist/src/test/privatekey-wallet.js +0 -68
- package/dist/src/transaction/sign-verify.d.ts +0 -2
- package/dist/src/transaction/sign-verify.js +0 -58
- package/dist/src/utils/password-crypto.d.ts +0 -2
- package/dist/src/utils/password-crypto.js +0 -69
- package/gitignore +0 -10
- package/scripts/create-project.ts +0 -137
- package/scripts/start-devnet.js +0 -141
- package/scripts/stop-devnet.js +0 -32
- package/src/contract/ralph.test.ts +0 -178
- package/src/fixtures/address.json +0 -36
- package/src/fixtures/balance.json +0 -9
- package/src/fixtures/self-clique.json +0 -19
- package/src/fixtures/transaction.json +0 -13
- package/src/fixtures/transactions.json +0 -179
- package/src/signer/fixtures/genesis.json +0 -26
- package/src/signer/fixtures/wallets.json +0 -26
- package/src/signer/node-wallet.ts +0 -74
- package/src/test/index.ts +0 -32
- package/src/test/privatekey-wallet.ts +0 -58
- package/src/transaction/sign-verify.test.ts +0 -50
- package/src/utils/address.test.ts +0 -47
- package/src/utils/djb2.test.ts +0 -35
- package/src/utils/password-crypto.test.ts +0 -27
- package/src/utils/password-crypto.ts +0 -77
- package/src/utils/utils.test.ts +0 -161
- package/templates/base/README.md +0 -34
- package/templates/base/package.json +0 -35
- package/templates/base/src/greeter.ts +0 -41
- package/templates/base/tsconfig.json +0 -19
- package/templates/react/README.md +0 -34
- package/templates/react/config-overrides.js +0 -18
- package/templates/react/package.json +0 -66
- package/templates/react/src/App.tsx +0 -42
- package/templates/react/src/artifacts/greeter.ral.json +0 -26
- package/templates/react/src/artifacts/greeter_main.ral.json +0 -22
- package/templates/shared/.eslintrc.json +0 -12
- package/templates/shared/scripts/header.js +0 -0
- package/test/contract.test.ts +0 -178
- package/test/events.test.ts +0 -138
- package/test/transaction.test.ts +0 -72
|
@@ -85,6 +85,10 @@ export interface Banned {
|
|
|
85
85
|
until: number;
|
|
86
86
|
type: string;
|
|
87
87
|
}
|
|
88
|
+
export interface BlockAndEvents {
|
|
89
|
+
block: BlockEntry;
|
|
90
|
+
events: ContractEventByBlockHash[];
|
|
91
|
+
}
|
|
88
92
|
export interface BlockEntry {
|
|
89
93
|
/** @format block-hash */
|
|
90
94
|
hash: string;
|
|
@@ -121,6 +125,12 @@ export interface BlockHeaderEntry {
|
|
|
121
125
|
height: number;
|
|
122
126
|
deps: string[];
|
|
123
127
|
}
|
|
128
|
+
export interface BlocksAndEventsPerTimeStampRange {
|
|
129
|
+
blocksAndEvents: BlockAndEvents[][];
|
|
130
|
+
}
|
|
131
|
+
export interface BlocksPerTimeStampRange {
|
|
132
|
+
blocks: BlockEntry[][];
|
|
133
|
+
}
|
|
124
134
|
export interface BrokerInfo {
|
|
125
135
|
/** @format clique-id */
|
|
126
136
|
cliqueId: string;
|
|
@@ -305,17 +315,37 @@ export interface ChangeActiveAddress {
|
|
|
305
315
|
address: string;
|
|
306
316
|
}
|
|
307
317
|
export interface CompileContractResult {
|
|
318
|
+
name: string;
|
|
308
319
|
bytecode: string;
|
|
320
|
+
bytecodeDebugPatch: string;
|
|
309
321
|
/** @format 32-byte-hash */
|
|
310
322
|
codeHash: string;
|
|
323
|
+
/** @format 32-byte-hash */
|
|
324
|
+
codeHashDebug: string;
|
|
311
325
|
fields: FieldsSig;
|
|
312
326
|
functions: FunctionSig[];
|
|
313
327
|
events: EventSig[];
|
|
328
|
+
warnings: string[];
|
|
329
|
+
}
|
|
330
|
+
export interface CompileProjectResult {
|
|
331
|
+
contracts: CompileContractResult[];
|
|
332
|
+
scripts: CompileScriptResult[];
|
|
314
333
|
}
|
|
315
334
|
export interface CompileScriptResult {
|
|
335
|
+
name: string;
|
|
316
336
|
bytecodeTemplate: string;
|
|
337
|
+
bytecodeDebugPatch: string;
|
|
317
338
|
fields: FieldsSig;
|
|
318
339
|
functions: FunctionSig[];
|
|
340
|
+
warnings: string[];
|
|
341
|
+
}
|
|
342
|
+
export interface CompilerOptions {
|
|
343
|
+
ignoreUnusedConstantsWarnings?: boolean;
|
|
344
|
+
ignoreUnusedVariablesWarnings?: boolean;
|
|
345
|
+
ignoreUnusedFieldsWarnings?: boolean;
|
|
346
|
+
ignoreUnusedPrivateFunctionsWarnings?: boolean;
|
|
347
|
+
ignoreReadonlyCheckWarnings?: boolean;
|
|
348
|
+
ignoreExternalCallCheckWarnings?: boolean;
|
|
319
349
|
}
|
|
320
350
|
export interface Confirmed {
|
|
321
351
|
/** @format block-hash */
|
|
@@ -332,6 +362,7 @@ export interface Confirmed {
|
|
|
332
362
|
}
|
|
333
363
|
export interface Contract {
|
|
334
364
|
code: string;
|
|
365
|
+
compilerOptions?: CompilerOptions;
|
|
335
366
|
}
|
|
336
367
|
export interface ContractEvent {
|
|
337
368
|
/** @format block-hash */
|
|
@@ -342,6 +373,15 @@ export interface ContractEvent {
|
|
|
342
373
|
eventIndex: number;
|
|
343
374
|
fields: Val[];
|
|
344
375
|
}
|
|
376
|
+
export interface ContractEventByBlockHash {
|
|
377
|
+
/** @format 32-byte-hash */
|
|
378
|
+
txId: string;
|
|
379
|
+
/** @format address */
|
|
380
|
+
contractAddress: string;
|
|
381
|
+
/** @format int32 */
|
|
382
|
+
eventIndex: number;
|
|
383
|
+
fields: Val[];
|
|
384
|
+
}
|
|
345
385
|
export interface ContractEventByTxId {
|
|
346
386
|
/** @format block-hash */
|
|
347
387
|
blockHash: string;
|
|
@@ -356,10 +396,11 @@ export interface ContractEvents {
|
|
|
356
396
|
/** @format int32 */
|
|
357
397
|
nextStart: number;
|
|
358
398
|
}
|
|
399
|
+
export interface ContractEventsByBlockHash {
|
|
400
|
+
events: ContractEventByBlockHash[];
|
|
401
|
+
}
|
|
359
402
|
export interface ContractEventsByTxId {
|
|
360
403
|
events: ContractEventByTxId[];
|
|
361
|
-
/** @format int32 */
|
|
362
|
-
nextStart: number;
|
|
363
404
|
}
|
|
364
405
|
export interface ContractOutput {
|
|
365
406
|
/** @format int32 */
|
|
@@ -385,6 +426,11 @@ export interface ContractState {
|
|
|
385
426
|
fields: Val[];
|
|
386
427
|
asset: AssetState;
|
|
387
428
|
}
|
|
429
|
+
export interface DebugMessage {
|
|
430
|
+
/** @format address */
|
|
431
|
+
contractAddress: string;
|
|
432
|
+
message: string;
|
|
433
|
+
}
|
|
388
434
|
export interface DecodeUnsignedTx {
|
|
389
435
|
unsignedTx: string;
|
|
390
436
|
}
|
|
@@ -409,17 +455,13 @@ export interface Destination {
|
|
|
409
455
|
export declare type DiscoveryAction = Reachable | Unreachable;
|
|
410
456
|
export interface EventSig {
|
|
411
457
|
name: string;
|
|
412
|
-
signature: string;
|
|
413
458
|
fieldNames: string[];
|
|
414
459
|
fieldTypes: string[];
|
|
415
460
|
}
|
|
416
|
-
export interface FetchResponse {
|
|
417
|
-
blocks: BlockEntry[][];
|
|
418
|
-
}
|
|
419
461
|
export interface FieldsSig {
|
|
420
|
-
signature: string;
|
|
421
462
|
names: string[];
|
|
422
463
|
types: string[];
|
|
464
|
+
isMutable: boolean[];
|
|
423
465
|
}
|
|
424
466
|
export interface FixedAssetOutput {
|
|
425
467
|
/** @format int32 */
|
|
@@ -438,9 +480,12 @@ export interface FixedAssetOutput {
|
|
|
438
480
|
}
|
|
439
481
|
export interface FunctionSig {
|
|
440
482
|
name: string;
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
483
|
+
usePreapprovedAssets: boolean;
|
|
484
|
+
useAssetsInContract: boolean;
|
|
485
|
+
isPublic: boolean;
|
|
486
|
+
paramNames: string[];
|
|
487
|
+
paramTypes: string[];
|
|
488
|
+
paramIsMutable: boolean[];
|
|
444
489
|
returnTypes: string[];
|
|
445
490
|
}
|
|
446
491
|
export interface Group {
|
|
@@ -522,6 +567,10 @@ export interface Penalty {
|
|
|
522
567
|
value: number;
|
|
523
568
|
type: string;
|
|
524
569
|
}
|
|
570
|
+
export interface Project {
|
|
571
|
+
code: string;
|
|
572
|
+
compilerOptions?: CompilerOptions;
|
|
573
|
+
}
|
|
525
574
|
export interface Reachable {
|
|
526
575
|
peers: string[];
|
|
527
576
|
type: string;
|
|
@@ -542,6 +591,7 @@ export interface RevealMnemonicResult {
|
|
|
542
591
|
}
|
|
543
592
|
export interface Script {
|
|
544
593
|
code: string;
|
|
594
|
+
compilerOptions?: CompilerOptions;
|
|
545
595
|
}
|
|
546
596
|
export interface SelfClique {
|
|
547
597
|
/** @format clique-id */
|
|
@@ -631,6 +681,7 @@ export interface TestContractResult {
|
|
|
631
681
|
txInputs: string[];
|
|
632
682
|
txOutputs: Output[];
|
|
633
683
|
events: ContractEventByTxId[];
|
|
684
|
+
debugMessages: DebugMessage[];
|
|
634
685
|
}
|
|
635
686
|
export interface TestInputAsset {
|
|
636
687
|
/** @format address */
|
|
@@ -1013,8 +1064,8 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1013
1064
|
* @request POST:/wallets/{wallet_name}/derive-next-address
|
|
1014
1065
|
*/
|
|
1015
1066
|
postWalletsWalletNameDeriveNextAddress: (walletName: string, query?: {
|
|
1016
|
-
group?: number
|
|
1017
|
-
}
|
|
1067
|
+
group?: number;
|
|
1068
|
+
}, params?: RequestParams) => Promise<AddressInfo>;
|
|
1018
1069
|
/**
|
|
1019
1070
|
* @description Your wallet need to have been created with the miner flag set to true
|
|
1020
1071
|
*
|
|
@@ -1146,22 +1197,34 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1146
1197
|
* @request GET:/infos/current-hashrate
|
|
1147
1198
|
*/
|
|
1148
1199
|
getInfosCurrentHashrate: (query?: {
|
|
1149
|
-
timespan?: number
|
|
1150
|
-
}
|
|
1200
|
+
timespan?: number;
|
|
1201
|
+
}, params?: RequestParams) => Promise<string>;
|
|
1151
1202
|
};
|
|
1152
1203
|
blockflow: {
|
|
1153
1204
|
/**
|
|
1154
1205
|
* No description
|
|
1155
1206
|
*
|
|
1156
1207
|
* @tags Blockflow
|
|
1157
|
-
* @name
|
|
1208
|
+
* @name GetBlockflowBlocks
|
|
1158
1209
|
* @summary List blocks on the given time interval
|
|
1159
|
-
* @request GET:/blockflow
|
|
1210
|
+
* @request GET:/blockflow/blocks
|
|
1160
1211
|
*/
|
|
1161
|
-
|
|
1212
|
+
getBlockflowBlocks: (query: {
|
|
1162
1213
|
fromTs: number;
|
|
1163
1214
|
toTs?: number;
|
|
1164
|
-
}, params?: RequestParams) => Promise<
|
|
1215
|
+
}, params?: RequestParams) => Promise<BlocksPerTimeStampRange>;
|
|
1216
|
+
/**
|
|
1217
|
+
* No description
|
|
1218
|
+
*
|
|
1219
|
+
* @tags Blockflow
|
|
1220
|
+
* @name GetBlockflowBlocksWithEvents
|
|
1221
|
+
* @summary List blocks with events on the given time interval
|
|
1222
|
+
* @request GET:/blockflow/blocks-with-events
|
|
1223
|
+
*/
|
|
1224
|
+
getBlockflowBlocksWithEvents: (query: {
|
|
1225
|
+
fromTs: number;
|
|
1226
|
+
toTs?: number;
|
|
1227
|
+
}, params?: RequestParams) => Promise<BlocksAndEventsPerTimeStampRange>;
|
|
1165
1228
|
/**
|
|
1166
1229
|
* No description
|
|
1167
1230
|
*
|
|
@@ -1171,6 +1234,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1171
1234
|
* @request GET:/blockflow/blocks/{block_hash}
|
|
1172
1235
|
*/
|
|
1173
1236
|
getBlockflowBlocksBlockHash: (blockHash: string, params?: RequestParams) => Promise<BlockEntry>;
|
|
1237
|
+
/**
|
|
1238
|
+
* No description
|
|
1239
|
+
*
|
|
1240
|
+
* @tags Blockflow
|
|
1241
|
+
* @name GetBlockflowBlocksWithEventsBlockHash
|
|
1242
|
+
* @summary Get a block and events with hash
|
|
1243
|
+
* @request GET:/blockflow/blocks-with-events/{block_hash}
|
|
1244
|
+
*/
|
|
1245
|
+
getBlockflowBlocksWithEventsBlockHash: (blockHash: string, params?: RequestParams) => Promise<BlockAndEvents>;
|
|
1174
1246
|
/**
|
|
1175
1247
|
* No description
|
|
1176
1248
|
*
|
|
@@ -1334,6 +1406,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1334
1406
|
* @request POST:/contracts/compile-contract
|
|
1335
1407
|
*/
|
|
1336
1408
|
postContractsCompileContract: (data: Contract, params?: RequestParams) => Promise<CompileContractResult>;
|
|
1409
|
+
/**
|
|
1410
|
+
* No description
|
|
1411
|
+
*
|
|
1412
|
+
* @tags Contracts
|
|
1413
|
+
* @name PostContractsCompileProject
|
|
1414
|
+
* @summary Compile a project
|
|
1415
|
+
* @request POST:/contracts/compile-project
|
|
1416
|
+
*/
|
|
1417
|
+
postContractsCompileProject: (data: Project, params?: RequestParams) => Promise<CompileProjectResult>;
|
|
1337
1418
|
/**
|
|
1338
1419
|
* No description
|
|
1339
1420
|
*
|
|
@@ -1434,6 +1515,18 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1434
1515
|
postMinersCpuMining: (query: {
|
|
1435
1516
|
action: string;
|
|
1436
1517
|
}, params?: RequestParams) => Promise<boolean>;
|
|
1518
|
+
/**
|
|
1519
|
+
* No description
|
|
1520
|
+
*
|
|
1521
|
+
* @tags Miners
|
|
1522
|
+
* @name PostMinersCpuMiningMineOneBlock
|
|
1523
|
+
* @summary Mine a block on CPU miner. !!! for test only !!!
|
|
1524
|
+
* @request POST:/miners/cpu-mining/mine-one-block
|
|
1525
|
+
*/
|
|
1526
|
+
postMinersCpuMiningMineOneBlock: (query: {
|
|
1527
|
+
fromGroup: number;
|
|
1528
|
+
toGroup: number;
|
|
1529
|
+
}, params?: RequestParams) => Promise<boolean>;
|
|
1437
1530
|
/**
|
|
1438
1531
|
* No description
|
|
1439
1532
|
*
|
|
@@ -1464,7 +1557,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1464
1557
|
*/
|
|
1465
1558
|
getEventsContractContractaddress: (contractAddress: string, query: {
|
|
1466
1559
|
start: number;
|
|
1467
|
-
|
|
1560
|
+
limit?: number;
|
|
1468
1561
|
group?: number;
|
|
1469
1562
|
}, params?: RequestParams) => Promise<ContractEvents>;
|
|
1470
1563
|
/**
|
|
@@ -1481,12 +1574,23 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1481
1574
|
*
|
|
1482
1575
|
* @tags Events
|
|
1483
1576
|
* @name GetEventsTxIdTxid
|
|
1484
|
-
* @summary Get events for a
|
|
1577
|
+
* @summary Get contract events for a transaction
|
|
1485
1578
|
* @request GET:/events/tx-id/{txId}
|
|
1486
1579
|
*/
|
|
1487
1580
|
getEventsTxIdTxid: (txId: string, query?: {
|
|
1488
|
-
group?: number
|
|
1489
|
-
}
|
|
1581
|
+
group?: number;
|
|
1582
|
+
}, params?: RequestParams) => Promise<ContractEventsByTxId>;
|
|
1583
|
+
/**
|
|
1584
|
+
* No description
|
|
1585
|
+
*
|
|
1586
|
+
* @tags Events
|
|
1587
|
+
* @name GetEventsBlockHashBlockhash
|
|
1588
|
+
* @summary Get contract events for a block
|
|
1589
|
+
* @request GET:/events/block-hash/{blockHash}
|
|
1590
|
+
*/
|
|
1591
|
+
getEventsBlockHashBlockhash: (blockHash: string, query?: {
|
|
1592
|
+
group?: number;
|
|
1593
|
+
}, params?: RequestParams) => Promise<ContractEventsByBlockHash>;
|
|
1490
1594
|
};
|
|
1491
1595
|
}
|
|
1492
1596
|
export {};
|