@alephium/web3 0.2.0-test.1 → 0.2.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/.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 +115 -17
- package/dist/src/api/api-alephium.js +145 -80
- package/dist/src/api/api-explorer.d.ts +178 -51
- package/dist/src/api/api-explorer.js +172 -37
- package/dist/src/api/index.d.ts +40 -5
- package/dist/src/api/index.js +115 -7
- package/dist/src/api/types.d.ts +23 -0
- package/dist/src/api/types.js +235 -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 +68 -55
- package/dist/src/contract/contract.js +235 -384
- 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 +6 -2
- package/dist/src/global.js +19 -3
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.js +23 -2
- package/dist/src/signer/index.d.ts +0 -1
- package/dist/src/signer/index.js +5 -2
- package/dist/src/signer/signer.d.ts +59 -60
- package/dist/src/signer/signer.js +99 -70
- 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 -2
- package/dist/src/utils/subscription.js +0 -2
- 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 -45
- package/src/api/api-alephium.ts +162 -25
- package/src/api/api-explorer.ts +247 -54
- package/src/api/index.ts +140 -6
- package/src/api/types.ts +229 -0
- package/{scripts/rename-gitignore.js → src/api/utils.ts} +7 -6
- package/src/contract/contract.ts +398 -429
- package/src/contract/events.ts +6 -5
- package/src/contract/ralph.ts +29 -4
- package/src/global.ts +23 -3
- package/src/index.ts +7 -1
- package/src/signer/index.ts +0 -1
- package/src/signer/signer.ts +165 -135
- 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/webpack.config.js +3 -0
- package/.eslintrc.json +0 -21
- package/LICENSE +0 -165
- package/contracts/add/add.ral +0 -13
- package/contracts/greeter/greeter.ral +0 -7
- package/contracts/greeter/greeter_interface.ral +0 -4
- package/contracts/greeter_main.ral +0 -7
- package/contracts/main.ral +0 -4
- package/contracts/sub/sub.ral +0 -10
- package/contracts/test/metadata.ral +0 -18
- package/contracts/test/warnings.ral +0 -8
- 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/scripts/stop-devnet.js +0 -32
- package/dist/src/signer/node-wallet.d.ts +0 -11
- package/dist/src/signer/node-wallet.js +0 -57
- package/dist/src/test/index.d.ts +0 -6
- package/dist/src/test/index.js +0 -41
- package/dist/src/test/privatekey-wallet.d.ts +0 -11
- 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 -9
- 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 -65
- package/src/test/index.ts +0 -31
- package/src/test/privatekey-wallet.ts +0 -57
- package/src/transaction/sign-verify.test.ts +0 -50
- package/src/transaction/sign-verify.ts +0 -39
- 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 -42
- 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 -213
- package/test/events.test.ts +0 -141
- package/test/transaction.test.ts +0 -73
|
@@ -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,9 +315,14 @@ export interface ChangeActiveAddress {
|
|
|
305
315
|
address: string;
|
|
306
316
|
}
|
|
307
317
|
export interface CompileContractResult {
|
|
318
|
+
version: string;
|
|
319
|
+
name: string;
|
|
308
320
|
bytecode: string;
|
|
321
|
+
bytecodeDebugPatch: string;
|
|
309
322
|
/** @format 32-byte-hash */
|
|
310
323
|
codeHash: string;
|
|
324
|
+
/** @format 32-byte-hash */
|
|
325
|
+
codeHashDebug: string;
|
|
311
326
|
fields: FieldsSig;
|
|
312
327
|
functions: FunctionSig[];
|
|
313
328
|
events: EventSig[];
|
|
@@ -318,11 +333,22 @@ export interface CompileProjectResult {
|
|
|
318
333
|
scripts: CompileScriptResult[];
|
|
319
334
|
}
|
|
320
335
|
export interface CompileScriptResult {
|
|
336
|
+
version: string;
|
|
337
|
+
name: string;
|
|
321
338
|
bytecodeTemplate: string;
|
|
339
|
+
bytecodeDebugPatch: string;
|
|
322
340
|
fields: FieldsSig;
|
|
323
341
|
functions: FunctionSig[];
|
|
324
342
|
warnings: string[];
|
|
325
343
|
}
|
|
344
|
+
export interface CompilerOptions {
|
|
345
|
+
ignoreUnusedConstantsWarnings?: boolean;
|
|
346
|
+
ignoreUnusedVariablesWarnings?: boolean;
|
|
347
|
+
ignoreUnusedFieldsWarnings?: boolean;
|
|
348
|
+
ignoreUnusedPrivateFunctionsWarnings?: boolean;
|
|
349
|
+
ignoreReadonlyCheckWarnings?: boolean;
|
|
350
|
+
ignoreExternalCallCheckWarnings?: boolean;
|
|
351
|
+
}
|
|
326
352
|
export interface Confirmed {
|
|
327
353
|
/** @format block-hash */
|
|
328
354
|
blockHash: string;
|
|
@@ -338,6 +364,7 @@ export interface Confirmed {
|
|
|
338
364
|
}
|
|
339
365
|
export interface Contract {
|
|
340
366
|
code: string;
|
|
367
|
+
compilerOptions?: CompilerOptions;
|
|
341
368
|
}
|
|
342
369
|
export interface ContractEvent {
|
|
343
370
|
/** @format block-hash */
|
|
@@ -348,6 +375,15 @@ export interface ContractEvent {
|
|
|
348
375
|
eventIndex: number;
|
|
349
376
|
fields: Val[];
|
|
350
377
|
}
|
|
378
|
+
export interface ContractEventByBlockHash {
|
|
379
|
+
/** @format 32-byte-hash */
|
|
380
|
+
txId: string;
|
|
381
|
+
/** @format address */
|
|
382
|
+
contractAddress: string;
|
|
383
|
+
/** @format int32 */
|
|
384
|
+
eventIndex: number;
|
|
385
|
+
fields: Val[];
|
|
386
|
+
}
|
|
351
387
|
export interface ContractEventByTxId {
|
|
352
388
|
/** @format block-hash */
|
|
353
389
|
blockHash: string;
|
|
@@ -362,10 +398,11 @@ export interface ContractEvents {
|
|
|
362
398
|
/** @format int32 */
|
|
363
399
|
nextStart: number;
|
|
364
400
|
}
|
|
401
|
+
export interface ContractEventsByBlockHash {
|
|
402
|
+
events: ContractEventByBlockHash[];
|
|
403
|
+
}
|
|
365
404
|
export interface ContractEventsByTxId {
|
|
366
405
|
events: ContractEventByTxId[];
|
|
367
|
-
/** @format int32 */
|
|
368
|
-
nextStart: number;
|
|
369
406
|
}
|
|
370
407
|
export interface ContractOutput {
|
|
371
408
|
/** @format int32 */
|
|
@@ -391,6 +428,11 @@ export interface ContractState {
|
|
|
391
428
|
fields: Val[];
|
|
392
429
|
asset: AssetState;
|
|
393
430
|
}
|
|
431
|
+
export interface DebugMessage {
|
|
432
|
+
/** @format address */
|
|
433
|
+
contractAddress: string;
|
|
434
|
+
message: string;
|
|
435
|
+
}
|
|
394
436
|
export interface DecodeUnsignedTx {
|
|
395
437
|
unsignedTx: string;
|
|
396
438
|
}
|
|
@@ -418,9 +460,6 @@ export interface EventSig {
|
|
|
418
460
|
fieldNames: string[];
|
|
419
461
|
fieldTypes: string[];
|
|
420
462
|
}
|
|
421
|
-
export interface FetchResponse {
|
|
422
|
-
blocks: BlockEntry[][];
|
|
423
|
-
}
|
|
424
463
|
export interface FieldsSig {
|
|
425
464
|
names: string[];
|
|
426
465
|
types: string[];
|
|
@@ -532,6 +571,7 @@ export interface Penalty {
|
|
|
532
571
|
}
|
|
533
572
|
export interface Project {
|
|
534
573
|
code: string;
|
|
574
|
+
compilerOptions?: CompilerOptions;
|
|
535
575
|
}
|
|
536
576
|
export interface Reachable {
|
|
537
577
|
peers: string[];
|
|
@@ -553,6 +593,7 @@ export interface RevealMnemonicResult {
|
|
|
553
593
|
}
|
|
554
594
|
export interface Script {
|
|
555
595
|
code: string;
|
|
596
|
+
compilerOptions?: CompilerOptions;
|
|
556
597
|
}
|
|
557
598
|
export interface SelfClique {
|
|
558
599
|
/** @format clique-id */
|
|
@@ -642,6 +683,7 @@ export interface TestContractResult {
|
|
|
642
683
|
txInputs: string[];
|
|
643
684
|
txOutputs: Output[];
|
|
644
685
|
events: ContractEventByTxId[];
|
|
686
|
+
debugMessages: DebugMessage[];
|
|
645
687
|
}
|
|
646
688
|
export interface TestInputAsset {
|
|
647
689
|
/** @format address */
|
|
@@ -1024,8 +1066,8 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1024
1066
|
* @request POST:/wallets/{wallet_name}/derive-next-address
|
|
1025
1067
|
*/
|
|
1026
1068
|
postWalletsWalletNameDeriveNextAddress: (walletName: string, query?: {
|
|
1027
|
-
group?: number
|
|
1028
|
-
}
|
|
1069
|
+
group?: number;
|
|
1070
|
+
}, params?: RequestParams) => Promise<AddressInfo>;
|
|
1029
1071
|
/**
|
|
1030
1072
|
* @description Your wallet need to have been created with the miner flag set to true
|
|
1031
1073
|
*
|
|
@@ -1157,22 +1199,34 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1157
1199
|
* @request GET:/infos/current-hashrate
|
|
1158
1200
|
*/
|
|
1159
1201
|
getInfosCurrentHashrate: (query?: {
|
|
1160
|
-
timespan?: number
|
|
1161
|
-
}
|
|
1202
|
+
timespan?: number;
|
|
1203
|
+
}, params?: RequestParams) => Promise<string>;
|
|
1162
1204
|
};
|
|
1163
1205
|
blockflow: {
|
|
1164
1206
|
/**
|
|
1165
1207
|
* No description
|
|
1166
1208
|
*
|
|
1167
1209
|
* @tags Blockflow
|
|
1168
|
-
* @name
|
|
1210
|
+
* @name GetBlockflowBlocks
|
|
1169
1211
|
* @summary List blocks on the given time interval
|
|
1170
|
-
* @request GET:/blockflow
|
|
1212
|
+
* @request GET:/blockflow/blocks
|
|
1171
1213
|
*/
|
|
1172
|
-
|
|
1214
|
+
getBlockflowBlocks: (query: {
|
|
1173
1215
|
fromTs: number;
|
|
1174
1216
|
toTs?: number;
|
|
1175
|
-
}, params?: RequestParams) => Promise<
|
|
1217
|
+
}, params?: RequestParams) => Promise<BlocksPerTimeStampRange>;
|
|
1218
|
+
/**
|
|
1219
|
+
* No description
|
|
1220
|
+
*
|
|
1221
|
+
* @tags Blockflow
|
|
1222
|
+
* @name GetBlockflowBlocksWithEvents
|
|
1223
|
+
* @summary List blocks with events on the given time interval
|
|
1224
|
+
* @request GET:/blockflow/blocks-with-events
|
|
1225
|
+
*/
|
|
1226
|
+
getBlockflowBlocksWithEvents: (query: {
|
|
1227
|
+
fromTs: number;
|
|
1228
|
+
toTs?: number;
|
|
1229
|
+
}, params?: RequestParams) => Promise<BlocksAndEventsPerTimeStampRange>;
|
|
1176
1230
|
/**
|
|
1177
1231
|
* No description
|
|
1178
1232
|
*
|
|
@@ -1182,6 +1236,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1182
1236
|
* @request GET:/blockflow/blocks/{block_hash}
|
|
1183
1237
|
*/
|
|
1184
1238
|
getBlockflowBlocksBlockHash: (blockHash: string, params?: RequestParams) => Promise<BlockEntry>;
|
|
1239
|
+
/**
|
|
1240
|
+
* No description
|
|
1241
|
+
*
|
|
1242
|
+
* @tags Blockflow
|
|
1243
|
+
* @name GetBlockflowBlocksWithEventsBlockHash
|
|
1244
|
+
* @summary Get a block and events with hash
|
|
1245
|
+
* @request GET:/blockflow/blocks-with-events/{block_hash}
|
|
1246
|
+
*/
|
|
1247
|
+
getBlockflowBlocksWithEventsBlockHash: (blockHash: string, params?: RequestParams) => Promise<BlockAndEvents>;
|
|
1185
1248
|
/**
|
|
1186
1249
|
* No description
|
|
1187
1250
|
*
|
|
@@ -1303,6 +1366,18 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1303
1366
|
* @request POST:/transactions/decode-unsigned-tx
|
|
1304
1367
|
*/
|
|
1305
1368
|
postTransactionsDecodeUnsignedTx: (data: DecodeUnsignedTx, params?: RequestParams) => Promise<DecodeUnsignedTxResult>;
|
|
1369
|
+
/**
|
|
1370
|
+
* No description
|
|
1371
|
+
*
|
|
1372
|
+
* @tags Transactions
|
|
1373
|
+
* @name GetTransactionsDetailsTxid
|
|
1374
|
+
* @summary Get transaction details
|
|
1375
|
+
* @request GET:/transactions/details/{txId}
|
|
1376
|
+
*/
|
|
1377
|
+
getTransactionsDetailsTxid: (txId: string, query?: {
|
|
1378
|
+
fromGroup?: number;
|
|
1379
|
+
toGroup?: number;
|
|
1380
|
+
}, params?: RequestParams) => Promise<Transaction>;
|
|
1306
1381
|
/**
|
|
1307
1382
|
* No description
|
|
1308
1383
|
*
|
|
@@ -1454,6 +1529,18 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1454
1529
|
postMinersCpuMining: (query: {
|
|
1455
1530
|
action: string;
|
|
1456
1531
|
}, params?: RequestParams) => Promise<boolean>;
|
|
1532
|
+
/**
|
|
1533
|
+
* No description
|
|
1534
|
+
*
|
|
1535
|
+
* @tags Miners
|
|
1536
|
+
* @name PostMinersCpuMiningMineOneBlock
|
|
1537
|
+
* @summary Mine a block on CPU miner. !!! for test only !!!
|
|
1538
|
+
* @request POST:/miners/cpu-mining/mine-one-block
|
|
1539
|
+
*/
|
|
1540
|
+
postMinersCpuMiningMineOneBlock: (query: {
|
|
1541
|
+
fromGroup: number;
|
|
1542
|
+
toGroup: number;
|
|
1543
|
+
}, params?: RequestParams) => Promise<boolean>;
|
|
1457
1544
|
/**
|
|
1458
1545
|
* No description
|
|
1459
1546
|
*
|
|
@@ -1484,7 +1571,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1484
1571
|
*/
|
|
1485
1572
|
getEventsContractContractaddress: (contractAddress: string, query: {
|
|
1486
1573
|
start: number;
|
|
1487
|
-
|
|
1574
|
+
limit?: number;
|
|
1488
1575
|
group?: number;
|
|
1489
1576
|
}, params?: RequestParams) => Promise<ContractEvents>;
|
|
1490
1577
|
/**
|
|
@@ -1501,12 +1588,23 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1501
1588
|
*
|
|
1502
1589
|
* @tags Events
|
|
1503
1590
|
* @name GetEventsTxIdTxid
|
|
1504
|
-
* @summary Get events for a
|
|
1591
|
+
* @summary Get contract events for a transaction
|
|
1505
1592
|
* @request GET:/events/tx-id/{txId}
|
|
1506
1593
|
*/
|
|
1507
1594
|
getEventsTxIdTxid: (txId: string, query?: {
|
|
1508
|
-
group?: number
|
|
1509
|
-
}
|
|
1595
|
+
group?: number;
|
|
1596
|
+
}, params?: RequestParams) => Promise<ContractEventsByTxId>;
|
|
1597
|
+
/**
|
|
1598
|
+
* No description
|
|
1599
|
+
*
|
|
1600
|
+
* @tags Events
|
|
1601
|
+
* @name GetEventsBlockHashBlockhash
|
|
1602
|
+
* @summary Get contract events for a block
|
|
1603
|
+
* @request GET:/events/block-hash/{blockHash}
|
|
1604
|
+
*/
|
|
1605
|
+
getEventsBlockHashBlockhash: (blockHash: string, query?: {
|
|
1606
|
+
group?: number;
|
|
1607
|
+
}, params?: RequestParams) => Promise<ContractEventsByBlockHash>;
|
|
1510
1608
|
};
|
|
1511
1609
|
}
|
|
1512
1610
|
export {};
|