@alephium/web3 0.2.0-rc.3 → 0.2.0-rc.31
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 +117 -17
- 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 +14 -2
- package/dist/src/api/index.js +46 -4
- 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 +110 -73
- package/dist/src/contract/contract.js +395 -451
- package/dist/src/contract/events.d.ts +4 -4
- package/dist/src/contract/events.js +2 -1
- 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 +35 -28
- package/dist/src/signer/signer.js +79 -47
- 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/transaction/status.js +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 -3
- package/dist/src/utils/subscription.js +0 -1
- package/dist/src/utils/utils.d.ts +4 -9
- package/dist/src/utils/utils.js +20 -24
- package/jest-config.json +11 -0
- package/package.json +11 -47
- package/src/api/api-alephium.ts +169 -25
- package/src/api/api-explorer.ts +234 -51
- package/src/api/index.ts +53 -3
- package/src/api/types.ts +233 -0
- package/{scripts/rename-gitignore.js → src/api/utils.ts} +7 -6
- package/src/contract/contract.ts +582 -550
- package/src/contract/events.ts +6 -5
- 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 +122 -85
- package/src/transaction/index.ts +0 -1
- package/src/transaction/status.ts +5 -2
- package/src/utils/bs58.ts +11 -0
- package/src/utils/index.ts +0 -1
- package/src/utils/subscription.ts +0 -4
- package/src/utils/utils.ts +11 -19
- 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/contracts/test/metadata.ral +0 -17
- package/contracts/test/warnings.ral +0 -5
- 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 -197
- 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,20 +315,38 @@ 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[];
|
|
314
328
|
warnings: string[];
|
|
315
329
|
}
|
|
330
|
+
export interface CompileProjectResult {
|
|
331
|
+
contracts: CompileContractResult[];
|
|
332
|
+
scripts: CompileScriptResult[];
|
|
333
|
+
}
|
|
316
334
|
export interface CompileScriptResult {
|
|
335
|
+
name: string;
|
|
317
336
|
bytecodeTemplate: string;
|
|
337
|
+
bytecodeDebugPatch: string;
|
|
318
338
|
fields: FieldsSig;
|
|
319
339
|
functions: FunctionSig[];
|
|
320
340
|
warnings: string[];
|
|
321
341
|
}
|
|
342
|
+
export interface CompilerOptions {
|
|
343
|
+
ignoreUnusedConstantsWarnings?: boolean;
|
|
344
|
+
ignoreUnusedVariablesWarnings?: boolean;
|
|
345
|
+
ignoreUnusedFieldsWarnings?: boolean;
|
|
346
|
+
ignoreUnusedPrivateFunctionsWarnings?: boolean;
|
|
347
|
+
ignoreReadonlyCheckWarnings?: boolean;
|
|
348
|
+
ignoreExternalCallCheckWarnings?: boolean;
|
|
349
|
+
}
|
|
322
350
|
export interface Confirmed {
|
|
323
351
|
/** @format block-hash */
|
|
324
352
|
blockHash: string;
|
|
@@ -334,6 +362,7 @@ export interface Confirmed {
|
|
|
334
362
|
}
|
|
335
363
|
export interface Contract {
|
|
336
364
|
code: string;
|
|
365
|
+
compilerOptions?: CompilerOptions;
|
|
337
366
|
}
|
|
338
367
|
export interface ContractEvent {
|
|
339
368
|
/** @format block-hash */
|
|
@@ -344,6 +373,15 @@ export interface ContractEvent {
|
|
|
344
373
|
eventIndex: number;
|
|
345
374
|
fields: Val[];
|
|
346
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
|
+
}
|
|
347
385
|
export interface ContractEventByTxId {
|
|
348
386
|
/** @format block-hash */
|
|
349
387
|
blockHash: string;
|
|
@@ -358,10 +396,11 @@ export interface ContractEvents {
|
|
|
358
396
|
/** @format int32 */
|
|
359
397
|
nextStart: number;
|
|
360
398
|
}
|
|
399
|
+
export interface ContractEventsByBlockHash {
|
|
400
|
+
events: ContractEventByBlockHash[];
|
|
401
|
+
}
|
|
361
402
|
export interface ContractEventsByTxId {
|
|
362
403
|
events: ContractEventByTxId[];
|
|
363
|
-
/** @format int32 */
|
|
364
|
-
nextStart: number;
|
|
365
404
|
}
|
|
366
405
|
export interface ContractOutput {
|
|
367
406
|
/** @format int32 */
|
|
@@ -387,6 +426,11 @@ export interface ContractState {
|
|
|
387
426
|
fields: Val[];
|
|
388
427
|
asset: AssetState;
|
|
389
428
|
}
|
|
429
|
+
export interface DebugMessage {
|
|
430
|
+
/** @format address */
|
|
431
|
+
contractAddress: string;
|
|
432
|
+
message: string;
|
|
433
|
+
}
|
|
390
434
|
export interface DecodeUnsignedTx {
|
|
391
435
|
unsignedTx: string;
|
|
392
436
|
}
|
|
@@ -414,9 +458,6 @@ export interface EventSig {
|
|
|
414
458
|
fieldNames: string[];
|
|
415
459
|
fieldTypes: string[];
|
|
416
460
|
}
|
|
417
|
-
export interface FetchResponse {
|
|
418
|
-
blocks: BlockEntry[][];
|
|
419
|
-
}
|
|
420
461
|
export interface FieldsSig {
|
|
421
462
|
names: string[];
|
|
422
463
|
types: string[];
|
|
@@ -526,6 +567,10 @@ export interface Penalty {
|
|
|
526
567
|
value: number;
|
|
527
568
|
type: string;
|
|
528
569
|
}
|
|
570
|
+
export interface Project {
|
|
571
|
+
code: string;
|
|
572
|
+
compilerOptions?: CompilerOptions;
|
|
573
|
+
}
|
|
529
574
|
export interface Reachable {
|
|
530
575
|
peers: string[];
|
|
531
576
|
type: string;
|
|
@@ -546,6 +591,7 @@ export interface RevealMnemonicResult {
|
|
|
546
591
|
}
|
|
547
592
|
export interface Script {
|
|
548
593
|
code: string;
|
|
594
|
+
compilerOptions?: CompilerOptions;
|
|
549
595
|
}
|
|
550
596
|
export interface SelfClique {
|
|
551
597
|
/** @format clique-id */
|
|
@@ -635,6 +681,7 @@ export interface TestContractResult {
|
|
|
635
681
|
txInputs: string[];
|
|
636
682
|
txOutputs: Output[];
|
|
637
683
|
events: ContractEventByTxId[];
|
|
684
|
+
debugMessages: DebugMessage[];
|
|
638
685
|
}
|
|
639
686
|
export interface TestInputAsset {
|
|
640
687
|
/** @format address */
|
|
@@ -1017,8 +1064,8 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1017
1064
|
* @request POST:/wallets/{wallet_name}/derive-next-address
|
|
1018
1065
|
*/
|
|
1019
1066
|
postWalletsWalletNameDeriveNextAddress: (walletName: string, query?: {
|
|
1020
|
-
group?: number
|
|
1021
|
-
}
|
|
1067
|
+
group?: number;
|
|
1068
|
+
}, params?: RequestParams) => Promise<AddressInfo>;
|
|
1022
1069
|
/**
|
|
1023
1070
|
* @description Your wallet need to have been created with the miner flag set to true
|
|
1024
1071
|
*
|
|
@@ -1150,22 +1197,34 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1150
1197
|
* @request GET:/infos/current-hashrate
|
|
1151
1198
|
*/
|
|
1152
1199
|
getInfosCurrentHashrate: (query?: {
|
|
1153
|
-
timespan?: number
|
|
1154
|
-
}
|
|
1200
|
+
timespan?: number;
|
|
1201
|
+
}, params?: RequestParams) => Promise<string>;
|
|
1155
1202
|
};
|
|
1156
1203
|
blockflow: {
|
|
1157
1204
|
/**
|
|
1158
1205
|
* No description
|
|
1159
1206
|
*
|
|
1160
1207
|
* @tags Blockflow
|
|
1161
|
-
* @name
|
|
1208
|
+
* @name GetBlockflowBlocks
|
|
1162
1209
|
* @summary List blocks on the given time interval
|
|
1163
|
-
* @request GET:/blockflow
|
|
1210
|
+
* @request GET:/blockflow/blocks
|
|
1211
|
+
*/
|
|
1212
|
+
getBlockflowBlocks: (query: {
|
|
1213
|
+
fromTs: number;
|
|
1214
|
+
toTs?: number;
|
|
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
|
|
1164
1223
|
*/
|
|
1165
|
-
|
|
1224
|
+
getBlockflowBlocksWithEvents: (query: {
|
|
1166
1225
|
fromTs: number;
|
|
1167
1226
|
toTs?: number;
|
|
1168
|
-
}, params?: RequestParams) => Promise<
|
|
1227
|
+
}, params?: RequestParams) => Promise<BlocksAndEventsPerTimeStampRange>;
|
|
1169
1228
|
/**
|
|
1170
1229
|
* No description
|
|
1171
1230
|
*
|
|
@@ -1175,6 +1234,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1175
1234
|
* @request GET:/blockflow/blocks/{block_hash}
|
|
1176
1235
|
*/
|
|
1177
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>;
|
|
1178
1246
|
/**
|
|
1179
1247
|
* No description
|
|
1180
1248
|
*
|
|
@@ -1338,6 +1406,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1338
1406
|
* @request POST:/contracts/compile-contract
|
|
1339
1407
|
*/
|
|
1340
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>;
|
|
1341
1418
|
/**
|
|
1342
1419
|
* No description
|
|
1343
1420
|
*
|
|
@@ -1438,6 +1515,18 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1438
1515
|
postMinersCpuMining: (query: {
|
|
1439
1516
|
action: string;
|
|
1440
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>;
|
|
1441
1530
|
/**
|
|
1442
1531
|
* No description
|
|
1443
1532
|
*
|
|
@@ -1468,7 +1557,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1468
1557
|
*/
|
|
1469
1558
|
getEventsContractContractaddress: (contractAddress: string, query: {
|
|
1470
1559
|
start: number;
|
|
1471
|
-
|
|
1560
|
+
limit?: number;
|
|
1472
1561
|
group?: number;
|
|
1473
1562
|
}, params?: RequestParams) => Promise<ContractEvents>;
|
|
1474
1563
|
/**
|
|
@@ -1485,12 +1574,23 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1485
1574
|
*
|
|
1486
1575
|
* @tags Events
|
|
1487
1576
|
* @name GetEventsTxIdTxid
|
|
1488
|
-
* @summary Get events for a
|
|
1577
|
+
* @summary Get contract events for a transaction
|
|
1489
1578
|
* @request GET:/events/tx-id/{txId}
|
|
1490
1579
|
*/
|
|
1491
1580
|
getEventsTxIdTxid: (txId: string, query?: {
|
|
1492
|
-
group?: number
|
|
1493
|
-
}
|
|
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>;
|
|
1494
1594
|
};
|
|
1495
1595
|
}
|
|
1496
1596
|
export {};
|