lumina-node-wasm 0.10.3 → 0.12.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/lumina_node_wasm.d.ts +437 -398
- package/lumina_node_wasm_bg.js +1495 -1391
- package/lumina_node_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/lumina_node_wasm.d.ts
CHANGED
|
@@ -384,10 +384,14 @@ export enum TxStatus {
|
|
|
384
384
|
* The transaction was evicted from the mempool.
|
|
385
385
|
*/
|
|
386
386
|
Evicted = 2,
|
|
387
|
+
/**
|
|
388
|
+
* The transaction was rejected
|
|
389
|
+
*/
|
|
390
|
+
Rejected = 3,
|
|
387
391
|
/**
|
|
388
392
|
* The transaction was committed into the block.
|
|
389
393
|
*/
|
|
390
|
-
Committed =
|
|
394
|
+
Committed = 4,
|
|
391
395
|
}
|
|
392
396
|
/**
|
|
393
397
|
* Types of votes
|
|
@@ -419,6 +423,16 @@ type ReadableStreamType = "bytes";
|
|
|
419
423
|
|
|
420
424
|
|
|
421
425
|
|
|
426
|
+
/**
|
|
427
|
+
* Coin
|
|
428
|
+
*/
|
|
429
|
+
export interface Coin {
|
|
430
|
+
denom: string,
|
|
431
|
+
amount: bigint
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
|
|
422
436
|
/**
|
|
423
437
|
* Public key
|
|
424
438
|
*/
|
|
@@ -450,16 +464,6 @@ type ReadableStreamType = "bytes";
|
|
|
450
464
|
|
|
451
465
|
|
|
452
466
|
|
|
453
|
-
/**
|
|
454
|
-
* Coin
|
|
455
|
-
*/
|
|
456
|
-
export interface Coin {
|
|
457
|
-
denom: string,
|
|
458
|
-
amount: bigint
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
467
|
/**
|
|
464
468
|
* Transaction info
|
|
465
469
|
*/
|
|
@@ -500,21 +504,21 @@ type ReadableStreamType = "bytes";
|
|
|
500
504
|
|
|
501
505
|
|
|
502
506
|
|
|
503
|
-
/**
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
export interface SignDoc {
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
/**
|
|
514
|
-
* A function that produces a signature of a payload
|
|
515
|
-
*/
|
|
516
|
-
export type SignerFn = ((arg: SignDoc) => Uint8Array) | ((arg: SignDoc) => Promise<Uint8Array>);
|
|
507
|
+
/**
|
|
508
|
+
* A payload to be signed
|
|
509
|
+
*/
|
|
510
|
+
export interface SignDoc {
|
|
511
|
+
bodyBytes: Uint8Array;
|
|
512
|
+
authInfoBytes: Uint8Array;
|
|
513
|
+
chainId: string;
|
|
514
|
+
accountNumber: bigint;
|
|
515
|
+
}
|
|
517
516
|
|
|
517
|
+
/**
|
|
518
|
+
* A function that produces a signature of a payload
|
|
519
|
+
*/
|
|
520
|
+
export type SignerFn = ((arg: SignDoc) => Uint8Array) | ((arg: SignDoc) => Promise<Uint8Array>);
|
|
521
|
+
|
|
518
522
|
|
|
519
523
|
/**
|
|
520
524
|
* ABCIMessageLog defines a structure containing an indexed tx ABCI message log.
|
|
@@ -536,6 +540,13 @@ export class AbciMessageLog {
|
|
|
536
540
|
export class AbciQueryResponse {
|
|
537
541
|
private constructor();
|
|
538
542
|
free(): void;
|
|
543
|
+
/**
|
|
544
|
+
* The block height from which data was derived.
|
|
545
|
+
*
|
|
546
|
+
* Note that this is the height of the block containing the application's Merkle root hash,
|
|
547
|
+
* which represents the state as it was after committing the block at height - 1.
|
|
548
|
+
*/
|
|
549
|
+
readonly height: bigint;
|
|
539
550
|
/**
|
|
540
551
|
* Response code.
|
|
541
552
|
*/
|
|
@@ -579,13 +590,6 @@ export class AbciQueryResponse {
|
|
|
579
590
|
* Additional information. May be non-deterministic.
|
|
580
591
|
*/
|
|
581
592
|
info: string;
|
|
582
|
-
/**
|
|
583
|
-
* The block height from which data was derived.
|
|
584
|
-
*
|
|
585
|
-
* Note that this is the height of the block containing the application's Merkle root hash,
|
|
586
|
-
* which represents the state as it was after committing the block at height - 1.
|
|
587
|
-
*/
|
|
588
|
-
readonly height: bigint;
|
|
589
593
|
}
|
|
590
594
|
/**
|
|
591
595
|
* Address of an account.
|
|
@@ -840,16 +844,16 @@ export class BroadcastMode {
|
|
|
840
844
|
* zero-value for mode ordering
|
|
841
845
|
*/
|
|
842
846
|
static readonly Unspecified: BroadcastMode;
|
|
843
|
-
/**
|
|
844
|
-
* DEPRECATED: use `BroadcastMode` `Sync` instead,
|
|
845
|
-
* `BroadcastMode` `Block` is not supported by the SDK from v0.47.x onwards.
|
|
846
|
-
*/
|
|
847
|
-
static readonly Block: BroadcastMode;
|
|
848
847
|
/**
|
|
849
848
|
* `BroadcastMode` `Sync` defines a tx broadcasting mode where the client waits for
|
|
850
849
|
* a CheckTx execution response only.
|
|
851
850
|
*/
|
|
852
851
|
static readonly Sync: BroadcastMode;
|
|
852
|
+
/**
|
|
853
|
+
* DEPRECATED: use `BroadcastMode` `Sync` instead,
|
|
854
|
+
* `BroadcastMode` `Block` is not supported by the SDK from v0.47.x onwards.
|
|
855
|
+
*/
|
|
856
|
+
static readonly Block: BroadcastMode;
|
|
853
857
|
/**
|
|
854
858
|
* `BroadcastMode` `Async` defines a tx broadcasting mode where the client returns
|
|
855
859
|
* immediately.
|
|
@@ -1026,6 +1030,9 @@ export class ConflictingBlock {
|
|
|
1026
1030
|
*/
|
|
1027
1031
|
validator_set: ValidatorSet;
|
|
1028
1032
|
}
|
|
1033
|
+
/**
|
|
1034
|
+
* Network connection information
|
|
1035
|
+
*/
|
|
1029
1036
|
export class ConnectionCountersSnapshot {
|
|
1030
1037
|
private constructor();
|
|
1031
1038
|
/**
|
|
@@ -1151,32 +1158,32 @@ export class DataAvailabilityHeader {
|
|
|
1151
1158
|
*/
|
|
1152
1159
|
toString(): string;
|
|
1153
1160
|
free(): void;
|
|
1161
|
+
/**
|
|
1162
|
+
* Get a root of the row with the given index.
|
|
1163
|
+
*/
|
|
1164
|
+
rowRoot(row: number): any;
|
|
1154
1165
|
/**
|
|
1155
1166
|
* Merkle roots of the [`ExtendedDataSquare`] rows.
|
|
1156
1167
|
*/
|
|
1157
1168
|
rowRoots(): Array<any>;
|
|
1158
1169
|
/**
|
|
1159
|
-
*
|
|
1170
|
+
* Get the a root of the column with the given index.
|
|
1160
1171
|
*/
|
|
1161
|
-
|
|
1172
|
+
columnRoot(column: number): any;
|
|
1162
1173
|
/**
|
|
1163
|
-
*
|
|
1174
|
+
* Merkle roots of the [`ExtendedDataSquare`] columns.
|
|
1164
1175
|
*/
|
|
1165
|
-
|
|
1176
|
+
columnRoots(): Array<any>;
|
|
1166
1177
|
/**
|
|
1167
|
-
* Get the
|
|
1178
|
+
* Get the size of the [`ExtendedDataSquare`] for which this header was built.
|
|
1168
1179
|
*/
|
|
1169
|
-
|
|
1180
|
+
squareWidth(): number;
|
|
1170
1181
|
/**
|
|
1171
1182
|
* Compute the combined hash of all rows and columns.
|
|
1172
1183
|
*
|
|
1173
1184
|
* This is the data commitment for the block.
|
|
1174
1185
|
*/
|
|
1175
1186
|
hash(): any;
|
|
1176
|
-
/**
|
|
1177
|
-
* Get the size of the [`ExtendedDataSquare`] for which this header was built.
|
|
1178
|
-
*/
|
|
1179
|
-
squareWidth(): number;
|
|
1180
1187
|
}
|
|
1181
1188
|
/**
|
|
1182
1189
|
* Duplicate vote evidence
|
|
@@ -1252,40 +1259,10 @@ export class ExtendedHeader {
|
|
|
1252
1259
|
*/
|
|
1253
1260
|
toString(): string;
|
|
1254
1261
|
free(): void;
|
|
1255
|
-
/**
|
|
1256
|
-
* Clone a header producing a deep copy of it.
|
|
1257
|
-
*/
|
|
1258
|
-
clone(): ExtendedHeader;
|
|
1259
|
-
/**
|
|
1260
|
-
* Get the block height.
|
|
1261
|
-
*/
|
|
1262
|
-
height(): bigint;
|
|
1263
|
-
/**
|
|
1264
|
-
* Get the block time.
|
|
1265
|
-
*/
|
|
1266
|
-
time(): number;
|
|
1267
|
-
/**
|
|
1268
|
-
* Get the block hash.
|
|
1269
|
-
*/
|
|
1270
|
-
hash(): string;
|
|
1271
|
-
/**
|
|
1272
|
-
* Get the hash of the previous header.
|
|
1273
|
-
*/
|
|
1274
|
-
previousHeaderHash(): string;
|
|
1275
1262
|
/**
|
|
1276
1263
|
* Decode protobuf encoded header and then validate it.
|
|
1277
1264
|
*/
|
|
1278
1265
|
validate(): void;
|
|
1279
|
-
/**
|
|
1280
|
-
* Verify a chain of adjacent untrusted headers and make sure
|
|
1281
|
-
* they are adjacent to `self`.
|
|
1282
|
-
*
|
|
1283
|
-
* # Errors
|
|
1284
|
-
*
|
|
1285
|
-
* If verification fails, this function will return an error with a reason of failure.
|
|
1286
|
-
* This function will also return an error if untrusted headers and `self` don't form contiguous range
|
|
1287
|
-
*/
|
|
1288
|
-
verify(untrusted: ExtendedHeader): void;
|
|
1289
1266
|
/**
|
|
1290
1267
|
* Verify a chain of adjacent untrusted headers.
|
|
1291
1268
|
*
|
|
@@ -1308,6 +1285,10 @@ export class ExtendedHeader {
|
|
|
1308
1285
|
* to each other.
|
|
1309
1286
|
*/
|
|
1310
1287
|
verifyRange(untrusted: ExtendedHeader[]): void;
|
|
1288
|
+
/**
|
|
1289
|
+
* Get the hash of the previous header.
|
|
1290
|
+
*/
|
|
1291
|
+
previousHeaderHash(): string;
|
|
1311
1292
|
/**
|
|
1312
1293
|
* Verify a chain of adjacent untrusted headers and make sure
|
|
1313
1294
|
* they are adjacent to `self`.
|
|
@@ -1331,21 +1312,47 @@ export class ExtendedHeader {
|
|
|
1331
1312
|
*/
|
|
1332
1313
|
verifyAdjacentRange(untrusted: ExtendedHeader[]): void;
|
|
1333
1314
|
/**
|
|
1334
|
-
*
|
|
1315
|
+
* Get the block hash.
|
|
1335
1316
|
*/
|
|
1336
|
-
|
|
1317
|
+
hash(): string;
|
|
1337
1318
|
/**
|
|
1338
|
-
*
|
|
1319
|
+
* Get the block time.
|
|
1339
1320
|
*/
|
|
1340
|
-
|
|
1321
|
+
time(): number;
|
|
1341
1322
|
/**
|
|
1342
|
-
*
|
|
1323
|
+
* Clone a header producing a deep copy of it.
|
|
1343
1324
|
*/
|
|
1344
|
-
|
|
1325
|
+
clone(): ExtendedHeader;
|
|
1326
|
+
/**
|
|
1327
|
+
* Get the block height.
|
|
1328
|
+
*/
|
|
1329
|
+
height(): bigint;
|
|
1330
|
+
/**
|
|
1331
|
+
* Verify a chain of adjacent untrusted headers and make sure
|
|
1332
|
+
* they are adjacent to `self`.
|
|
1333
|
+
*
|
|
1334
|
+
* # Errors
|
|
1335
|
+
*
|
|
1336
|
+
* If verification fails, this function will return an error with a reason of failure.
|
|
1337
|
+
* This function will also return an error if untrusted headers and `self` don't form contiguous range
|
|
1338
|
+
*/
|
|
1339
|
+
verify(untrusted: ExtendedHeader): void;
|
|
1345
1340
|
/**
|
|
1346
1341
|
* Information about the set of validators commiting the block.
|
|
1347
1342
|
*/
|
|
1348
1343
|
readonly validatorSet: any;
|
|
1344
|
+
/**
|
|
1345
|
+
* Commit metadata and signatures from validators committing the block.
|
|
1346
|
+
*/
|
|
1347
|
+
readonly commit: any;
|
|
1348
|
+
/**
|
|
1349
|
+
* Tendermint block header.
|
|
1350
|
+
*/
|
|
1351
|
+
readonly header: any;
|
|
1352
|
+
/**
|
|
1353
|
+
* Header of the block data availability.
|
|
1354
|
+
*/
|
|
1355
|
+
dah: DataAvailabilityHeader;
|
|
1349
1356
|
}
|
|
1350
1357
|
/**
|
|
1351
1358
|
* Fee includes the amount of coins paid in fees and the maximum
|
|
@@ -1423,113 +1430,266 @@ export class GetTxResponse {
|
|
|
1423
1430
|
tx_response: TxResponse;
|
|
1424
1431
|
}
|
|
1425
1432
|
/**
|
|
1426
|
-
* Celestia
|
|
1433
|
+
* Celestia gRPC client, for builder see [`GrpcClientBuilder`]
|
|
1427
1434
|
*/
|
|
1428
1435
|
export class GrpcClient {
|
|
1429
1436
|
private constructor();
|
|
1430
1437
|
free(): void;
|
|
1431
1438
|
/**
|
|
1432
|
-
*
|
|
1439
|
+
* Issue a direct ABCI query to the application
|
|
1433
1440
|
*/
|
|
1434
|
-
|
|
1441
|
+
abciQuery(data: Uint8Array, path: string, height: bigint, prove: boolean): Promise<AbciQueryResponse>;
|
|
1435
1442
|
/**
|
|
1436
|
-
* Get
|
|
1443
|
+
* Get account
|
|
1437
1444
|
*/
|
|
1438
|
-
|
|
1445
|
+
getAccount(account: string): Promise<BaseAccount>;
|
|
1439
1446
|
/**
|
|
1440
|
-
*
|
|
1447
|
+
* Retrieves the Celestia coin balance for the given address.
|
|
1441
1448
|
*/
|
|
1442
|
-
|
|
1449
|
+
getBalance(address: string, denom: string): Promise<Coin>;
|
|
1443
1450
|
/**
|
|
1444
|
-
*
|
|
1451
|
+
* Broadcast prepared and serialised transaction
|
|
1445
1452
|
*/
|
|
1446
|
-
|
|
1453
|
+
broadcastTx(tx_bytes: Uint8Array, mode: BroadcastMode): Promise<TxResponse>;
|
|
1447
1454
|
/**
|
|
1448
|
-
* Get
|
|
1449
|
-
* and verify the returned balance against the corresponding block's app hash.
|
|
1450
|
-
*
|
|
1451
|
-
* NOTE: the balance returned is the balance reported by the parent block of
|
|
1452
|
-
* the provided header. This is due to the fact that for block N, the block's
|
|
1453
|
-
* app hash is the result of applying the previous block's transaction list.
|
|
1455
|
+
* Get accounts
|
|
1454
1456
|
*/
|
|
1455
|
-
|
|
1457
|
+
getAccounts(): Promise<BaseAccount[]>;
|
|
1456
1458
|
/**
|
|
1457
|
-
*
|
|
1459
|
+
* Submit blobs to the celestia network.
|
|
1460
|
+
*
|
|
1461
|
+
* # Example
|
|
1462
|
+
* ```js
|
|
1463
|
+
* const ns = Namespace.newV0(new Uint8Array([97, 98, 99]));
|
|
1464
|
+
* const data = new Uint8Array([100, 97, 116, 97]);
|
|
1465
|
+
* const blob = new Blob(ns, data, AppVersion.latest());
|
|
1466
|
+
*
|
|
1467
|
+
* const txInfo = await txClient.submitBlobs([blob]);
|
|
1468
|
+
* await txClient.submitBlobs([blob], { gasLimit: 100000n, gasPrice: 0.02, memo: "foo" });
|
|
1469
|
+
* ```
|
|
1470
|
+
*
|
|
1471
|
+
* # Note
|
|
1472
|
+
*
|
|
1473
|
+
* Provided blobs will be consumed by this method, meaning
|
|
1474
|
+
* they will no longer be accessible. If this behavior is not desired,
|
|
1475
|
+
* consider using `Blob.clone()`.
|
|
1476
|
+
*
|
|
1477
|
+
* ```js
|
|
1478
|
+
* const blobs = [blob1, blob2, blob3];
|
|
1479
|
+
* await txClient.submitBlobs(blobs.map(b => b.clone()));
|
|
1480
|
+
* ```
|
|
1458
1481
|
*/
|
|
1459
|
-
|
|
1482
|
+
submitBlobs(blobs: Blob[], tx_config?: TxConfig | null): Promise<TxInfo>;
|
|
1460
1483
|
/**
|
|
1461
|
-
*
|
|
1484
|
+
* Submit message to the celestia network.
|
|
1485
|
+
*
|
|
1486
|
+
* # Example
|
|
1487
|
+
* ```js
|
|
1488
|
+
* import { Registry } from "@cosmjs/proto-signing";
|
|
1489
|
+
*
|
|
1490
|
+
* const registry = new Registry();
|
|
1491
|
+
* const sendMsg = {
|
|
1492
|
+
* typeUrl: "/cosmos.bank.v1beta1.MsgSend",
|
|
1493
|
+
* value: {
|
|
1494
|
+
* fromAddress: "celestia169s50psyj2f4la9a2235329xz7rk6c53zhw9mm",
|
|
1495
|
+
* toAddress: "celestia1t52q7uqgnjfzdh3wx5m5phvma3umrq8k6tq2p9",
|
|
1496
|
+
* amount: [{ denom: "utia", amount: "10000" }],
|
|
1497
|
+
* },
|
|
1498
|
+
* };
|
|
1499
|
+
* const sendMsgAny = registry.encodeAsAny(sendMsg);
|
|
1500
|
+
*
|
|
1501
|
+
* const txInfo = await txClient.submitMessage(sendMsgAny);
|
|
1502
|
+
* ```
|
|
1462
1503
|
*/
|
|
1463
|
-
|
|
1504
|
+
submitMessage(message: ProtoAny, tx_config?: TxConfig | null): Promise<TxInfo>;
|
|
1464
1505
|
/**
|
|
1465
|
-
* Get
|
|
1506
|
+
* Get auth params
|
|
1466
1507
|
*/
|
|
1467
|
-
|
|
1508
|
+
getAuthParams(): Promise<AuthParams>;
|
|
1468
1509
|
/**
|
|
1469
|
-
* Get
|
|
1510
|
+
* Get blob params
|
|
1470
1511
|
*/
|
|
1471
|
-
|
|
1512
|
+
getBlobParams(): Promise<BlobParams>;
|
|
1472
1513
|
/**
|
|
1473
1514
|
* Get node configuration
|
|
1474
1515
|
*/
|
|
1475
1516
|
get_node_config(): Promise<ConfigResponse>;
|
|
1517
|
+
/**
|
|
1518
|
+
* Get balance of all coins
|
|
1519
|
+
*/
|
|
1520
|
+
getAllBalances(address: string): Promise<Coin[]>;
|
|
1476
1521
|
/**
|
|
1477
1522
|
* Get latest block
|
|
1478
1523
|
*/
|
|
1479
|
-
|
|
1524
|
+
getLatestBlock(): Promise<Block>;
|
|
1525
|
+
/**
|
|
1526
|
+
* Get total supply
|
|
1527
|
+
*/
|
|
1528
|
+
getTotalSupply(): Promise<Coin[]>;
|
|
1529
|
+
/**
|
|
1530
|
+
* Estimate gas price for given transaction priority based
|
|
1531
|
+
* on the gas prices of the transactions in the last five blocks.
|
|
1532
|
+
*
|
|
1533
|
+
* If no transaction is found in the last five blocks, return the network
|
|
1534
|
+
* min gas price.
|
|
1535
|
+
*/
|
|
1536
|
+
estimateGasPrice(priority: TxPriority): Promise<number>;
|
|
1480
1537
|
/**
|
|
1481
1538
|
* Get block by height
|
|
1482
1539
|
*/
|
|
1483
|
-
|
|
1540
|
+
getBlockByHeight(height: bigint): Promise<Block>;
|
|
1484
1541
|
/**
|
|
1485
|
-
*
|
|
1542
|
+
* Retrieves the verified Celestia coin balance for the address.
|
|
1543
|
+
*
|
|
1544
|
+
* # Notes
|
|
1545
|
+
*
|
|
1546
|
+
* This returns the verified balance which is the one that was reported by
|
|
1547
|
+
* the previous network block. In other words, if you transfer some coins,
|
|
1548
|
+
* you need to wait 1 more block in order to see the new balance. If you want
|
|
1549
|
+
* something more immediate then use [`GrpcClient::get_balance`].
|
|
1486
1550
|
*/
|
|
1487
|
-
|
|
1551
|
+
getVerifiedBalance(address: string, header: ExtendedHeader): Promise<Coin>;
|
|
1488
1552
|
/**
|
|
1489
|
-
*
|
|
1553
|
+
* Get balance of all spendable coins
|
|
1490
1554
|
*/
|
|
1491
|
-
|
|
1555
|
+
getSpendableBalances(address: string): Promise<Coin[]>;
|
|
1492
1556
|
/**
|
|
1493
1557
|
* Get Tx
|
|
1494
1558
|
*/
|
|
1495
|
-
|
|
1559
|
+
getTx(hash: string): Promise<GetTxResponse>;
|
|
1496
1560
|
/**
|
|
1497
1561
|
* Simulate prepared and serialised transaction, returning simulated gas usage
|
|
1498
1562
|
*/
|
|
1499
1563
|
simulate(tx_bytes: Uint8Array): Promise<GasInfo>;
|
|
1500
1564
|
/**
|
|
1501
|
-
*
|
|
1565
|
+
* Create a builder for [`GrpcClient`] connected to `url`
|
|
1502
1566
|
*/
|
|
1503
|
-
|
|
1567
|
+
static withUrl(url: string): GrpcClientBuilder;
|
|
1504
1568
|
/**
|
|
1505
1569
|
* Get status of the transaction
|
|
1506
1570
|
*/
|
|
1507
|
-
|
|
1508
|
-
}
|
|
1509
|
-
/**
|
|
1510
|
-
* Block Header values contain metadata about the block and about the consensus,
|
|
1511
|
-
* as well as commitments to the data in the current block, the previous block,
|
|
1512
|
-
* and the results returned by the application.
|
|
1513
|
-
*/
|
|
1514
|
-
export class Header {
|
|
1515
|
-
private constructor();
|
|
1516
|
-
free(): void;
|
|
1517
|
-
/**
|
|
1518
|
-
* Header version
|
|
1519
|
-
*/
|
|
1520
|
-
version: ProtocolVersion;
|
|
1521
|
-
/**
|
|
1522
|
-
* Chain ID
|
|
1523
|
-
*/
|
|
1524
|
-
chain_id: string;
|
|
1571
|
+
txStatus(hash: string): Promise<TxStatusResponse>;
|
|
1525
1572
|
/**
|
|
1526
|
-
*
|
|
1573
|
+
* AppVersion of the client
|
|
1527
1574
|
*/
|
|
1528
|
-
|
|
1575
|
+
readonly appVersion: Promise<AppVersion>;
|
|
1529
1576
|
/**
|
|
1530
|
-
*
|
|
1577
|
+
* Chain id of the client
|
|
1531
1578
|
*/
|
|
1532
|
-
|
|
1579
|
+
readonly chainId: Promise<string>;
|
|
1580
|
+
}
|
|
1581
|
+
/**
|
|
1582
|
+
* Builder for [`GrpcClient`] and [`TxClient`].
|
|
1583
|
+
*
|
|
1584
|
+
* Url must point to a [grpc-web proxy](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB.md).
|
|
1585
|
+
*
|
|
1586
|
+
* # Keyless client example
|
|
1587
|
+
*
|
|
1588
|
+
* ```js
|
|
1589
|
+
* const client = await GrpcClient
|
|
1590
|
+
* .withUrl("http://127.0.0.1:18080")
|
|
1591
|
+
* .build()
|
|
1592
|
+
* ```
|
|
1593
|
+
*
|
|
1594
|
+
* # Transaction client examples
|
|
1595
|
+
*
|
|
1596
|
+
* ## Example with noble/curves
|
|
1597
|
+
* ```js
|
|
1598
|
+
* import { secp256k1 } from "@noble/curves/secp256k1";
|
|
1599
|
+
*
|
|
1600
|
+
* const privKey = "fdc8ac75dfa1c142dbcba77938a14dd03078052ce0b49a529dcf72a9885a3abb";
|
|
1601
|
+
* const pubKey = secp256k1.getPublicKey(privKey);
|
|
1602
|
+
*
|
|
1603
|
+
* const signer = (signDoc) => {
|
|
1604
|
+
* const bytes = protoEncodeSignDoc(signDoc);
|
|
1605
|
+
* const sig = secp256k1.sign(bytes, privKey, { prehash: true });
|
|
1606
|
+
* return sig.toCompactRawBytes();
|
|
1607
|
+
* };
|
|
1608
|
+
*
|
|
1609
|
+
* const client = await GrpcClient
|
|
1610
|
+
* .withUrl("http://127.0.0.1:18080")
|
|
1611
|
+
* .withPubkeyAndSigner(pubKey, signer)
|
|
1612
|
+
* .build();
|
|
1613
|
+
* ```
|
|
1614
|
+
*
|
|
1615
|
+
* ## Example with leap wallet
|
|
1616
|
+
* ```js
|
|
1617
|
+
* await window.leap.enable("mocha-4")
|
|
1618
|
+
* const keys = await window.leap.getKey("mocha-4")
|
|
1619
|
+
*
|
|
1620
|
+
* const signer = (signDoc) => {
|
|
1621
|
+
* return window.leap.signDirect("mocha-4", keys.bech32Address, signDoc, { preferNoSetFee: true })
|
|
1622
|
+
* .then(sig => Uint8Array.from(atob(sig.signature.signature), c => c.charCodeAt(0)))
|
|
1623
|
+
* }
|
|
1624
|
+
*
|
|
1625
|
+
* const client = await GrpcClient
|
|
1626
|
+
* .withUrl("http://127.0.0.1:18080")
|
|
1627
|
+
* .withPubkeyAndSigner(keys.pubKey, signer)
|
|
1628
|
+
* .build()
|
|
1629
|
+
* ```
|
|
1630
|
+
*/
|
|
1631
|
+
export class GrpcClientBuilder {
|
|
1632
|
+
private constructor();
|
|
1633
|
+
free(): void;
|
|
1634
|
+
/**
|
|
1635
|
+
* Appends ascii metadata to all requests made by the client.
|
|
1636
|
+
*
|
|
1637
|
+
* Note that this method **consumes** builder and returns updated instance of it.
|
|
1638
|
+
* Make sure to re-assign it if you keep builder in a variable.
|
|
1639
|
+
*/
|
|
1640
|
+
withMetadata(key: string, value: string): GrpcClientBuilder;
|
|
1641
|
+
/**
|
|
1642
|
+
* Appends binary metadata to all requests made by the client.
|
|
1643
|
+
*
|
|
1644
|
+
* Keys for binary metadata must have `-bin` suffix.
|
|
1645
|
+
*
|
|
1646
|
+
* Note that this method **consumes** builder and returns updated instance of it.
|
|
1647
|
+
* Make sure to re-assign it if you keep builder in a variable.
|
|
1648
|
+
*/
|
|
1649
|
+
withMetadataBin(key: string, value: Uint8Array): GrpcClientBuilder;
|
|
1650
|
+
/**
|
|
1651
|
+
* Add public key and signer to the client being built
|
|
1652
|
+
*
|
|
1653
|
+
* Note that this method **consumes** builder and returns updated instance of it.
|
|
1654
|
+
* Make sure to re-assign it if you keep builder in a variable.
|
|
1655
|
+
*/
|
|
1656
|
+
withPubkeyAndSigner(account_pubkey: Uint8Array, signer_fn: SignerFn): GrpcClientBuilder;
|
|
1657
|
+
/**
|
|
1658
|
+
* build gRPC client
|
|
1659
|
+
*/
|
|
1660
|
+
build(): GrpcClient;
|
|
1661
|
+
/**
|
|
1662
|
+
* Set the `url` of the grpc-web server to connect to
|
|
1663
|
+
*
|
|
1664
|
+
* Note that this method **consumes** builder and returns updated instance of it.
|
|
1665
|
+
* Make sure to re-assign it if you keep builder in a variable.
|
|
1666
|
+
*/
|
|
1667
|
+
withUrl(url: string): GrpcClientBuilder;
|
|
1668
|
+
}
|
|
1669
|
+
/**
|
|
1670
|
+
* Block Header values contain metadata about the block and about the consensus,
|
|
1671
|
+
* as well as commitments to the data in the current block, the previous block,
|
|
1672
|
+
* and the results returned by the application.
|
|
1673
|
+
*/
|
|
1674
|
+
export class Header {
|
|
1675
|
+
private constructor();
|
|
1676
|
+
free(): void;
|
|
1677
|
+
/**
|
|
1678
|
+
* Header version
|
|
1679
|
+
*/
|
|
1680
|
+
version: ProtocolVersion;
|
|
1681
|
+
/**
|
|
1682
|
+
* Chain ID
|
|
1683
|
+
*/
|
|
1684
|
+
chain_id: string;
|
|
1685
|
+
/**
|
|
1686
|
+
* Current block height
|
|
1687
|
+
*/
|
|
1688
|
+
height: bigint;
|
|
1689
|
+
/**
|
|
1690
|
+
* Current timestamp encoded as rfc3339
|
|
1691
|
+
*/
|
|
1692
|
+
time: string;
|
|
1533
1693
|
/**
|
|
1534
1694
|
* Previous block info
|
|
1535
1695
|
*/
|
|
@@ -1594,18 +1754,18 @@ export class Header {
|
|
|
1594
1754
|
export class IntoUnderlyingByteSource {
|
|
1595
1755
|
private constructor();
|
|
1596
1756
|
free(): void;
|
|
1597
|
-
start(controller: ReadableByteStreamController): void;
|
|
1598
1757
|
pull(controller: ReadableByteStreamController): Promise<any>;
|
|
1758
|
+
start(controller: ReadableByteStreamController): void;
|
|
1599
1759
|
cancel(): void;
|
|
1600
|
-
readonly type: ReadableStreamType;
|
|
1601
1760
|
readonly autoAllocateChunkSize: number;
|
|
1761
|
+
readonly type: ReadableStreamType;
|
|
1602
1762
|
}
|
|
1603
1763
|
export class IntoUnderlyingSink {
|
|
1604
1764
|
private constructor();
|
|
1605
1765
|
free(): void;
|
|
1606
|
-
write(chunk: any): Promise<any>;
|
|
1607
|
-
close(): Promise<any>;
|
|
1608
1766
|
abort(reason: any): Promise<any>;
|
|
1767
|
+
close(): Promise<any>;
|
|
1768
|
+
write(chunk: any): Promise<any>;
|
|
1609
1769
|
}
|
|
1610
1770
|
export class IntoUnderlyingSource {
|
|
1611
1771
|
private constructor();
|
|
@@ -1707,6 +1867,12 @@ export class ModeInfo {
|
|
|
1707
1867
|
* Return signature mode for the stored signature(s)
|
|
1708
1868
|
*/
|
|
1709
1869
|
signature_mode(): SignatureMode;
|
|
1870
|
+
/**
|
|
1871
|
+
* Multi is the mode info for a multisig public key
|
|
1872
|
+
* mode_infos is the corresponding modes of the signers of the multisig
|
|
1873
|
+
* which could include nested multisig public keys
|
|
1874
|
+
*/
|
|
1875
|
+
readonly mode_infos: ModeInfo[] | undefined;
|
|
1710
1876
|
/**
|
|
1711
1877
|
* Single is the mode info for a single signer. It is structured as a message
|
|
1712
1878
|
* to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the
|
|
@@ -1718,12 +1884,6 @@ export class ModeInfo {
|
|
|
1718
1884
|
* bitarray specifies which keys within the multisig are signing
|
|
1719
1885
|
*/
|
|
1720
1886
|
readonly bitarray: JsBitVector | undefined;
|
|
1721
|
-
/**
|
|
1722
|
-
* Multi is the mode info for a multisig public key
|
|
1723
|
-
* mode_infos is the corresponding modes of the signers of the multisig
|
|
1724
|
-
* which could include nested multisig public keys
|
|
1725
|
-
*/
|
|
1726
|
-
readonly mode_infos: ModeInfo[] | undefined;
|
|
1727
1887
|
}
|
|
1728
1888
|
/**
|
|
1729
1889
|
* Namespace of the data published to the celestia network.
|
|
@@ -1758,13 +1918,9 @@ export class Namespace {
|
|
|
1758
1918
|
toString(): string;
|
|
1759
1919
|
free(): void;
|
|
1760
1920
|
/**
|
|
1761
|
-
*
|
|
1762
|
-
*
|
|
1763
|
-
* Check [`Namespace::new_v0`] for more details.
|
|
1764
|
-
*
|
|
1765
|
-
* [`Namespace::new_v0`]: https://docs.rs/celestia-types/latest/celestia_types/nmt/struct.Namespace.html#method.new_v0
|
|
1921
|
+
* Converts the [`Namespace`] to a byte slice.
|
|
1766
1922
|
*/
|
|
1767
|
-
|
|
1923
|
+
asBytes(): Uint8Array;
|
|
1768
1924
|
/**
|
|
1769
1925
|
* Create a new [`Namespace`] from the raw bytes.
|
|
1770
1926
|
*
|
|
@@ -1776,28 +1932,44 @@ export class Namespace {
|
|
|
1776
1932
|
*/
|
|
1777
1933
|
static fromRaw(raw: Uint8Array): Namespace;
|
|
1778
1934
|
/**
|
|
1779
|
-
*
|
|
1935
|
+
* Create a new [`Namespace`] version `0` with given id.
|
|
1936
|
+
*
|
|
1937
|
+
* Check [`Namespace::new_v0`] for more details.
|
|
1938
|
+
*
|
|
1939
|
+
* [`Namespace::new_v0`]: https://docs.rs/celestia-types/latest/celestia_types/nmt/struct.Namespace.html#method.new_v0
|
|
1780
1940
|
*/
|
|
1781
|
-
|
|
1941
|
+
static newV0(id: Uint8Array): Namespace;
|
|
1782
1942
|
/**
|
|
1783
1943
|
* Namespace size in bytes.
|
|
1784
1944
|
*/
|
|
1785
1945
|
static readonly NS_SIZE: number;
|
|
1946
|
+
/**
|
|
1947
|
+
* Returns the first byte indicating the version of the [`Namespace`].
|
|
1948
|
+
*/
|
|
1949
|
+
readonly version: number;
|
|
1786
1950
|
/**
|
|
1787
1951
|
* Primary reserved [`Namespace`] for the compact `Share`s with `cosmos SDK` transactions.
|
|
1788
1952
|
*/
|
|
1789
1953
|
static readonly TRANSACTION: Namespace;
|
|
1954
|
+
/**
|
|
1955
|
+
* The [`Namespace`] for `parity shares`.
|
|
1956
|
+
*
|
|
1957
|
+
* It is the namespace with which all the `parity shares` from
|
|
1958
|
+
* `ExtendedDataSquare` are inserted to the `Nmt` when computing
|
|
1959
|
+
* merkle roots.
|
|
1960
|
+
*/
|
|
1961
|
+
static readonly PARITY_SHARE: Namespace;
|
|
1790
1962
|
/**
|
|
1791
1963
|
* Primary reserved [`Namespace`] for the compact Shares with MsgPayForBlobs transactions.
|
|
1792
1964
|
*/
|
|
1793
1965
|
static readonly PAY_FOR_BLOB: Namespace;
|
|
1794
1966
|
/**
|
|
1795
|
-
*
|
|
1967
|
+
* Secondary reserved [`Namespace`] used for padding after the blobs.
|
|
1796
1968
|
*
|
|
1797
|
-
*
|
|
1798
|
-
*
|
|
1969
|
+
* It is used to fill up the `original data square` after all user-submitted
|
|
1970
|
+
* blobs before the parity data is generated for the `ExtendedDataSquare`.
|
|
1799
1971
|
*/
|
|
1800
|
-
static readonly
|
|
1972
|
+
static readonly TAIL_PADDING: Namespace;
|
|
1801
1973
|
/**
|
|
1802
1974
|
* Maximal primary reserved [`Namespace`].
|
|
1803
1975
|
*
|
|
@@ -1811,24 +1983,12 @@ export class Namespace {
|
|
|
1811
1983
|
*/
|
|
1812
1984
|
static readonly MIN_SECONDARY_RESERVED: Namespace;
|
|
1813
1985
|
/**
|
|
1814
|
-
*
|
|
1815
|
-
*
|
|
1816
|
-
* It is used to fill up the `original data square` after all user-submitted
|
|
1817
|
-
* blobs before the parity data is generated for the `ExtendedDataSquare`.
|
|
1818
|
-
*/
|
|
1819
|
-
static readonly TAIL_PADDING: Namespace;
|
|
1820
|
-
/**
|
|
1821
|
-
* The [`Namespace`] for `parity shares`.
|
|
1986
|
+
* Primary reserved [`Namespace`] for the `Share`s used for padding.
|
|
1822
1987
|
*
|
|
1823
|
-
*
|
|
1824
|
-
*
|
|
1825
|
-
* merkle roots.
|
|
1826
|
-
*/
|
|
1827
|
-
static readonly PARITY_SHARE: Namespace;
|
|
1828
|
-
/**
|
|
1829
|
-
* Returns the first byte indicating the version of the [`Namespace`].
|
|
1988
|
+
* `Share`s with this namespace are inserted after other shares from primary reserved namespace
|
|
1989
|
+
* so that user-defined namespaces are correctly aligned in `ExtendedDataSquare`
|
|
1830
1990
|
*/
|
|
1831
|
-
readonly
|
|
1991
|
+
static readonly PRIMARY_RESERVED_PADDING: Namespace;
|
|
1832
1992
|
/**
|
|
1833
1993
|
* Returns the trailing 28 bytes indicating the id of the [`Namespace`].
|
|
1834
1994
|
*/
|
|
@@ -1866,118 +2026,121 @@ export class NetworkInfoSnapshot {
|
|
|
1866
2026
|
export class NodeClient {
|
|
1867
2027
|
free(): void;
|
|
1868
2028
|
/**
|
|
1869
|
-
*
|
|
1870
|
-
* expected to have `MessagePort`-like interface for sending and receiving messages.
|
|
2029
|
+
* Check whether Lumina is currently running
|
|
1871
2030
|
*/
|
|
1872
|
-
|
|
2031
|
+
isRunning(): Promise<boolean>;
|
|
1873
2032
|
/**
|
|
1874
|
-
*
|
|
2033
|
+
* Get synced headers from the given heights range.
|
|
2034
|
+
*
|
|
2035
|
+
* If start of the range is undefined (None), the first returned header will be of height 1.
|
|
2036
|
+
* If end of the range is undefined (None), the last returned header will be the last header in the
|
|
2037
|
+
* store.
|
|
2038
|
+
*
|
|
2039
|
+
* # Errors
|
|
2040
|
+
*
|
|
2041
|
+
* If range contains a height of a header that is not found in the store.
|
|
1875
2042
|
*/
|
|
1876
|
-
|
|
2043
|
+
getHeaders(start_height?: bigint | null, end_height?: bigint | null): Promise<ExtendedHeader[]>;
|
|
1877
2044
|
/**
|
|
1878
|
-
*
|
|
2045
|
+
* Get current header syncing info.
|
|
1879
2046
|
*/
|
|
1880
|
-
|
|
2047
|
+
syncerInfo(): Promise<SyncingInfoSnapshot>;
|
|
1881
2048
|
/**
|
|
1882
|
-
*
|
|
2049
|
+
* Get current network info.
|
|
1883
2050
|
*/
|
|
1884
|
-
|
|
1885
|
-
stop(): Promise<void>;
|
|
2051
|
+
networkInfo(): Promise<NetworkInfoSnapshot>;
|
|
1886
2052
|
/**
|
|
1887
2053
|
* Get node's local peer ID.
|
|
1888
2054
|
*/
|
|
1889
2055
|
localPeerId(): Promise<string>;
|
|
1890
2056
|
/**
|
|
1891
|
-
*
|
|
2057
|
+
* Returns a [`BroadcastChannel`] for events generated by [`Node`].
|
|
1892
2058
|
*/
|
|
1893
|
-
|
|
2059
|
+
eventsChannel(): Promise<BroadcastChannel>;
|
|
1894
2060
|
/**
|
|
1895
|
-
*
|
|
2061
|
+
* Trust or untrust the peer with a given ID.
|
|
1896
2062
|
*/
|
|
1897
|
-
|
|
2063
|
+
setPeerTrust(peer_id: string, is_trusted: boolean): Promise<void>;
|
|
1898
2064
|
/**
|
|
1899
|
-
* Wait until the node is connected to at least 1
|
|
2065
|
+
* Wait until the node is connected to at least 1 peer.
|
|
1900
2066
|
*/
|
|
1901
|
-
|
|
2067
|
+
waitConnected(): Promise<void>;
|
|
1902
2068
|
/**
|
|
1903
|
-
* Get
|
|
2069
|
+
* Get all the peers that node is connected to.
|
|
1904
2070
|
*/
|
|
1905
|
-
|
|
2071
|
+
connectedPeers(): Promise<Array<any>>;
|
|
1906
2072
|
/**
|
|
1907
|
-
* Get
|
|
2073
|
+
* Get current [`PeerTracker`] info.
|
|
1908
2074
|
*/
|
|
1909
|
-
|
|
2075
|
+
peerTrackerInfo(): Promise<PeerTrackerInfoSnapshot>;
|
|
1910
2076
|
/**
|
|
1911
|
-
*
|
|
2077
|
+
* Request all blobs with provided namespace in the block corresponding to this header
|
|
2078
|
+
* using bitswap protocol.
|
|
1912
2079
|
*/
|
|
1913
|
-
|
|
2080
|
+
requestAllBlobs(namespace: Namespace, block_height: bigint, timeout_secs?: number | null): Promise<Blob[]>;
|
|
1914
2081
|
/**
|
|
1915
|
-
*
|
|
2082
|
+
* Get a synced header for the block with a given hash.
|
|
1916
2083
|
*/
|
|
1917
|
-
|
|
2084
|
+
getHeaderByHash(hash: string): Promise<ExtendedHeader>;
|
|
1918
2085
|
/**
|
|
1919
2086
|
* Request the head header from the network.
|
|
1920
2087
|
*/
|
|
1921
2088
|
requestHeadHeader(): Promise<ExtendedHeader>;
|
|
1922
2089
|
/**
|
|
1923
|
-
*
|
|
2090
|
+
* Get a synced header for the block with a given height.
|
|
1924
2091
|
*/
|
|
1925
|
-
|
|
2092
|
+
getHeaderByHeight(height: bigint): Promise<ExtendedHeader>;
|
|
1926
2093
|
/**
|
|
1927
|
-
*
|
|
2094
|
+
* Get the latest locally synced header.
|
|
1928
2095
|
*/
|
|
1929
|
-
|
|
2096
|
+
getLocalHeadHeader(): Promise<ExtendedHeader>;
|
|
1930
2097
|
/**
|
|
1931
|
-
*
|
|
1932
|
-
*
|
|
1933
|
-
* The headers will be verified with the `from` header.
|
|
2098
|
+
* Get data sampling metadata of an already sampled height.
|
|
1934
2099
|
*/
|
|
1935
|
-
|
|
2100
|
+
getSamplingMetadata(height: bigint): Promise<SamplingMetadata | undefined>;
|
|
1936
2101
|
/**
|
|
1937
|
-
* Request
|
|
1938
|
-
* using bitswap protocol.
|
|
2102
|
+
* Request a header for the block with a given hash from the network.
|
|
1939
2103
|
*/
|
|
1940
|
-
|
|
2104
|
+
requestHeaderByHash(hash: string): Promise<ExtendedHeader>;
|
|
1941
2105
|
/**
|
|
1942
|
-
*
|
|
2106
|
+
* Wait until the node is connected to at least 1 trusted peer.
|
|
1943
2107
|
*/
|
|
1944
|
-
|
|
2108
|
+
waitConnectedTrusted(): Promise<void>;
|
|
1945
2109
|
/**
|
|
1946
2110
|
* Get the latest header announced in the network.
|
|
1947
2111
|
*/
|
|
1948
2112
|
getNetworkHeadHeader(): Promise<ExtendedHeader | undefined>;
|
|
1949
2113
|
/**
|
|
1950
|
-
*
|
|
2114
|
+
* Establish a new connection to the existing worker over provided port
|
|
1951
2115
|
*/
|
|
1952
|
-
|
|
2116
|
+
addConnectionToWorker(port: any): Promise<void>;
|
|
1953
2117
|
/**
|
|
1954
|
-
*
|
|
2118
|
+
* Request a header for the block with a given height from the network.
|
|
1955
2119
|
*/
|
|
1956
|
-
|
|
2120
|
+
requestHeaderByHeight(height: bigint): Promise<ExtendedHeader>;
|
|
1957
2121
|
/**
|
|
1958
|
-
*
|
|
2122
|
+
* Request headers in range (from, from + amount] from the network.
|
|
2123
|
+
*
|
|
2124
|
+
* The headers will be verified with the `from` header.
|
|
1959
2125
|
*/
|
|
1960
|
-
|
|
2126
|
+
requestVerifiedHeaders(from: ExtendedHeader, amount: bigint): Promise<ExtendedHeader[]>;
|
|
1961
2127
|
/**
|
|
1962
|
-
*
|
|
1963
|
-
*
|
|
1964
|
-
* If start of the range is undefined (None), the first returned header will be of height 1.
|
|
1965
|
-
* If end of the range is undefined (None), the last returned header will be the last header in the
|
|
1966
|
-
* store.
|
|
1967
|
-
*
|
|
1968
|
-
* # Errors
|
|
1969
|
-
*
|
|
1970
|
-
* If range contains a height of a header that is not found in the store.
|
|
2128
|
+
* Create a new connection to a Lumina node running in [`NodeWorker`]. Provided `port` is
|
|
2129
|
+
* expected to have `MessagePort`-like interface for sending and receiving messages.
|
|
1971
2130
|
*/
|
|
1972
|
-
|
|
2131
|
+
constructor(port: any);
|
|
1973
2132
|
/**
|
|
1974
|
-
*
|
|
2133
|
+
* Stop the node.
|
|
1975
2134
|
*/
|
|
1976
|
-
|
|
2135
|
+
stop(): Promise<void>;
|
|
1977
2136
|
/**
|
|
1978
|
-
*
|
|
2137
|
+
* Start the node with the provided config, if it's not running
|
|
1979
2138
|
*/
|
|
1980
|
-
|
|
2139
|
+
start(config: NodeConfig): Promise<void>;
|
|
2140
|
+
/**
|
|
2141
|
+
* Get all the multiaddresses on which the node listens.
|
|
2142
|
+
*/
|
|
2143
|
+
listeners(): Promise<Array<any>>;
|
|
1981
2144
|
}
|
|
1982
2145
|
/**
|
|
1983
2146
|
* Config for the lumina wasm node.
|
|
@@ -2005,6 +2168,16 @@ export class NodeConfig {
|
|
|
2005
2168
|
* A list of bootstrap peers to connect to.
|
|
2006
2169
|
*/
|
|
2007
2170
|
bootnodes: string[];
|
|
2171
|
+
/**
|
|
2172
|
+
* Optionally start with a provided private key used as libp2p identity. Expects 32 bytes
|
|
2173
|
+
* containing ed25519 secret key.
|
|
2174
|
+
*/
|
|
2175
|
+
get identity_key(): Uint8Array | undefined;
|
|
2176
|
+
/**
|
|
2177
|
+
* Optionally start with a provided private key used as libp2p identity. Expects 32 bytes
|
|
2178
|
+
* containing ed25519 secret key.
|
|
2179
|
+
*/
|
|
2180
|
+
set identity_key(value: Uint8Array | null | undefined);
|
|
2008
2181
|
/**
|
|
2009
2182
|
* Whether to store data in persistent memory or not.
|
|
2010
2183
|
*
|
|
@@ -2046,7 +2219,13 @@ export class NodeConfig {
|
|
|
2046
2219
|
*/
|
|
2047
2220
|
export class NodeWorker {
|
|
2048
2221
|
free(): void;
|
|
2222
|
+
/**
|
|
2223
|
+
* Create a new `NodeWorker` with a port-like JS object.
|
|
2224
|
+
*/
|
|
2049
2225
|
constructor(port_like_object: any);
|
|
2226
|
+
/**
|
|
2227
|
+
* Run `NodeWorker` main loop.
|
|
2228
|
+
*/
|
|
2050
2229
|
run(): Promise<void>;
|
|
2051
2230
|
}
|
|
2052
2231
|
/**
|
|
@@ -2247,17 +2426,6 @@ export class Tx {
|
|
|
2247
2426
|
export class TxBody {
|
|
2248
2427
|
private constructor();
|
|
2249
2428
|
free(): void;
|
|
2250
|
-
/**
|
|
2251
|
-
* `messages` is a list of messages to be executed. The required signers of
|
|
2252
|
-
* those messages define the number and order of elements in `AuthInfo`'s
|
|
2253
|
-
* signer_infos and Tx's signatures. Each required signer address is added to
|
|
2254
|
-
* the list only the first time it occurs.
|
|
2255
|
-
*
|
|
2256
|
-
* By convention, the first required signer (usually from the first message)
|
|
2257
|
-
* is referred to as the primary signer and pays the fee for the whole
|
|
2258
|
-
* transaction.
|
|
2259
|
-
*/
|
|
2260
|
-
messages(): ProtoAny[];
|
|
2261
2429
|
/**
|
|
2262
2430
|
* `extension_options` are arbitrary options that can be added by chains
|
|
2263
2431
|
* when the default options are not sufficient. If any of these are present
|
|
@@ -2270,6 +2438,17 @@ export class TxBody {
|
|
|
2270
2438
|
* and can't be handled, they will be ignored
|
|
2271
2439
|
*/
|
|
2272
2440
|
non_critical_extension_options(): ProtoAny[];
|
|
2441
|
+
/**
|
|
2442
|
+
* `messages` is a list of messages to be executed. The required signers of
|
|
2443
|
+
* those messages define the number and order of elements in `AuthInfo`'s
|
|
2444
|
+
* signer_infos and Tx's signatures. Each required signer address is added to
|
|
2445
|
+
* the list only the first time it occurs.
|
|
2446
|
+
*
|
|
2447
|
+
* By convention, the first required signer (usually from the first message)
|
|
2448
|
+
* is referred to as the primary signer and pays the fee for the whole
|
|
2449
|
+
* transaction.
|
|
2450
|
+
*/
|
|
2451
|
+
messages(): ProtoAny[];
|
|
2273
2452
|
/**
|
|
2274
2453
|
* `memo` is any arbitrary memo to be added to the transaction.
|
|
2275
2454
|
*/
|
|
@@ -2281,151 +2460,22 @@ export class TxBody {
|
|
|
2281
2460
|
readonly timeout_height: bigint;
|
|
2282
2461
|
}
|
|
2283
2462
|
/**
|
|
2284
|
-
*
|
|
2463
|
+
* Response to a tx query
|
|
2285
2464
|
*/
|
|
2286
|
-
export class
|
|
2465
|
+
export class TxResponse {
|
|
2466
|
+
private constructor();
|
|
2287
2467
|
free(): void;
|
|
2288
2468
|
/**
|
|
2289
|
-
*
|
|
2290
|
-
*
|
|
2291
|
-
*
|
|
2292
|
-
*
|
|
2293
|
-
* # Example with noble/curves
|
|
2294
|
-
* ```js
|
|
2295
|
-
* import { secp256k1 } from "@noble/curves/secp256k1";
|
|
2296
|
-
*
|
|
2297
|
-
* const privKey = "fdc8ac75dfa1c142dbcba77938a14dd03078052ce0b49a529dcf72a9885a3abb";
|
|
2298
|
-
* const pubKey = secp256k1.getPublicKey(privKey);
|
|
2299
|
-
*
|
|
2300
|
-
* const signer = (signDoc) => {
|
|
2301
|
-
* const bytes = protoEncodeSignDoc(signDoc);
|
|
2302
|
-
* const sig = secp256k1.sign(bytes, privKey, { prehash: true });
|
|
2303
|
-
* return sig.toCompactRawBytes();
|
|
2304
|
-
* };
|
|
2305
|
-
*
|
|
2306
|
-
* const txClient = await new TxClient("http://127.0.0.1:18080", pubKey, signer);
|
|
2307
|
-
* ```
|
|
2308
|
-
*
|
|
2309
|
-
* # Example with leap wallet
|
|
2310
|
-
* ```js
|
|
2311
|
-
* await window.leap.enable("mocha-4")
|
|
2312
|
-
* const keys = await window.leap.getKey("mocha-4")
|
|
2313
|
-
*
|
|
2314
|
-
* const signer = (signDoc) => {
|
|
2315
|
-
* return window.leap.signDirect("mocha-4", keys.bech32Address, signDoc, { preferNoSetFee: true })
|
|
2316
|
-
* .then(sig => Uint8Array.from(atob(sig.signature.signature), c => c.charCodeAt(0)))
|
|
2317
|
-
* }
|
|
2318
|
-
*
|
|
2319
|
-
* const tx_client = await new TxClient("http://127.0.0.1:18080", keys.pubKey, signer)
|
|
2320
|
-
* ```
|
|
2321
|
-
*/
|
|
2322
|
-
constructor(url: string, pubkey: Uint8Array, signer_fn: SignerFn);
|
|
2323
|
-
/**
|
|
2324
|
-
* estimate_gas_price takes a transaction priority and estimates the gas price based
|
|
2325
|
-
* on the gas prices of the transactions in the last five blocks.
|
|
2326
|
-
*
|
|
2327
|
-
* If no transaction is found in the last five blocks, return the network
|
|
2328
|
-
* min gas price.
|
|
2329
|
-
*/
|
|
2330
|
-
getEstimateGasPrice(priority: TxPriority): Promise<number>;
|
|
2331
|
-
/**
|
|
2332
|
-
* Submit blobs to the celestia network.
|
|
2333
|
-
*
|
|
2334
|
-
* When no `TxConfig` is provided, client will automatically calculate needed
|
|
2335
|
-
* gas and update the `gasPrice`, if network agreed on a new minimal value.
|
|
2336
|
-
* To enforce specific values use a `TxConfig`.
|
|
2337
|
-
*
|
|
2338
|
-
* # Example
|
|
2339
|
-
* ```js
|
|
2340
|
-
* const ns = Namespace.newV0(new Uint8Array([97, 98, 99]));
|
|
2341
|
-
* const data = new Uint8Array([100, 97, 116, 97]);
|
|
2342
|
-
* const blob = new Blob(ns, data, AppVersion.latest());
|
|
2343
|
-
*
|
|
2344
|
-
* const txInfo = await txClient.submitBlobs([blob]);
|
|
2345
|
-
* await txClient.submitBlobs([blob], { gasLimit: 100000n, gasPrice: 0.02, memo: "foo" });
|
|
2346
|
-
* ```
|
|
2347
|
-
*
|
|
2348
|
-
* # Note
|
|
2349
|
-
*
|
|
2350
|
-
* Provided blobs will be consumed by this method, meaning
|
|
2351
|
-
* they will no longer be accessible. If this behavior is not desired,
|
|
2352
|
-
* consider using `Blob.clone()`.
|
|
2353
|
-
*
|
|
2354
|
-
* ```js
|
|
2355
|
-
* const blobs = [blob1, blob2, blob3];
|
|
2356
|
-
* await txClient.submitBlobs(blobs.map(b => b.clone()));
|
|
2357
|
-
* ```
|
|
2358
|
-
*/
|
|
2359
|
-
submitBlobs(blobs: Blob[], tx_config?: TxConfig | null): Promise<TxInfo>;
|
|
2360
|
-
/**
|
|
2361
|
-
* Submit message to the celestia network.
|
|
2362
|
-
*
|
|
2363
|
-
* When no `TxConfig` is provided, client will automatically calculate needed
|
|
2364
|
-
* gas and update the `gasPrice`, if network agreed on a new minimal value.
|
|
2365
|
-
* To enforce specific values use a `TxConfig`.
|
|
2366
|
-
*
|
|
2367
|
-
* # Example
|
|
2368
|
-
* ```js
|
|
2369
|
-
* import { Registry } from "@cosmjs/proto-signing";
|
|
2370
|
-
*
|
|
2371
|
-
* const registry = new Registry();
|
|
2372
|
-
* const sendMsg = {
|
|
2373
|
-
* typeUrl: "/cosmos.bank.v1beta1.MsgSend",
|
|
2374
|
-
* value: {
|
|
2375
|
-
* fromAddress: "celestia169s50psyj2f4la9a2235329xz7rk6c53zhw9mm",
|
|
2376
|
-
* toAddress: "celestia1t52q7uqgnjfzdh3wx5m5phvma3umrq8k6tq2p9",
|
|
2377
|
-
* amount: [{ denom: "utia", amount: "10000" }],
|
|
2378
|
-
* },
|
|
2379
|
-
* };
|
|
2380
|
-
* const sendMsgAny = registry.encodeAsAny(sendMsg);
|
|
2381
|
-
*
|
|
2382
|
-
* const txInfo = await txClient.submitMessage(sendMsgAny);
|
|
2383
|
-
* ```
|
|
2384
|
-
*/
|
|
2385
|
-
submitMessage(message: ProtoAny, tx_config?: TxConfig | null): Promise<TxInfo>;
|
|
2386
|
-
/**
|
|
2387
|
-
* Get auth params
|
|
2388
|
-
*/
|
|
2389
|
-
getAuthParams(): Promise<AuthParams>;
|
|
2390
|
-
/**
|
|
2391
|
-
* Get account
|
|
2392
|
-
*/
|
|
2393
|
-
getAccount(account: string): Promise<BaseAccount>;
|
|
2394
|
-
/**
|
|
2395
|
-
* Get accounts
|
|
2396
|
-
*/
|
|
2397
|
-
getAccounts(): Promise<BaseAccount[]>;
|
|
2398
|
-
/**
|
|
2399
|
-
* Get balance of coins with given denom
|
|
2400
|
-
*/
|
|
2401
|
-
getBalance(address: string, denom: string): Promise<Coin>;
|
|
2402
|
-
/**
|
|
2403
|
-
* Get balance of all coins
|
|
2404
|
-
*/
|
|
2405
|
-
getAllBalances(address: string): Promise<Coin[]>;
|
|
2406
|
-
/**
|
|
2407
|
-
* Get balance of all spendable coins
|
|
2408
|
-
*/
|
|
2409
|
-
getSpendableBalances(address: string): Promise<Coin[]>;
|
|
2410
|
-
/**
|
|
2411
|
-
* Get total supply
|
|
2412
|
-
*/
|
|
2413
|
-
getTotalSupply(): Promise<Coin[]>;
|
|
2414
|
-
/**
|
|
2415
|
-
* Chain id of the client
|
|
2469
|
+
* Events defines all the events emitted by processing a transaction. Note,
|
|
2470
|
+
* these events include those emitted by processing all the messages and those
|
|
2471
|
+
* emitted from the ante. Whereas Logs contains the events, with
|
|
2472
|
+
* additional metadata, emitted only by processing the messages.
|
|
2416
2473
|
*/
|
|
2417
|
-
readonly
|
|
2474
|
+
readonly events: JsEvent[];
|
|
2418
2475
|
/**
|
|
2419
|
-
*
|
|
2476
|
+
* The block height
|
|
2420
2477
|
*/
|
|
2421
|
-
readonly
|
|
2422
|
-
}
|
|
2423
|
-
/**
|
|
2424
|
-
* Response to a tx query
|
|
2425
|
-
*/
|
|
2426
|
-
export class TxResponse {
|
|
2427
|
-
private constructor();
|
|
2428
|
-
free(): void;
|
|
2478
|
+
readonly height: bigint;
|
|
2429
2479
|
/**
|
|
2430
2480
|
* Namespace for the Code
|
|
2431
2481
|
*/
|
|
@@ -2465,17 +2515,6 @@ export class TxResponse {
|
|
|
2465
2515
|
* it's genesis time.
|
|
2466
2516
|
*/
|
|
2467
2517
|
timestamp: string;
|
|
2468
|
-
/**
|
|
2469
|
-
* The block height
|
|
2470
|
-
*/
|
|
2471
|
-
readonly height: bigint;
|
|
2472
|
-
/**
|
|
2473
|
-
* Events defines all the events emitted by processing a transaction. Note,
|
|
2474
|
-
* these events include those emitted by processing all the messages and those
|
|
2475
|
-
* emitted from the ante. Whereas Logs contains the events, with
|
|
2476
|
-
* additional metadata, emitted only by processing the messages.
|
|
2477
|
-
*/
|
|
2478
|
-
readonly events: JsEvent[];
|
|
2479
2518
|
}
|
|
2480
2519
|
/**
|
|
2481
2520
|
* Response to a tx status query
|
|
@@ -2483,6 +2522,10 @@ export class TxResponse {
|
|
|
2483
2522
|
export class TxStatusResponse {
|
|
2484
2523
|
private constructor();
|
|
2485
2524
|
free(): void;
|
|
2525
|
+
/**
|
|
2526
|
+
* Height of the block in which the transaction was committed.
|
|
2527
|
+
*/
|
|
2528
|
+
readonly height: bigint;
|
|
2486
2529
|
/**
|
|
2487
2530
|
* Index of the transaction in block.
|
|
2488
2531
|
*/
|
|
@@ -2501,10 +2544,6 @@ export class TxStatusResponse {
|
|
|
2501
2544
|
* Status of the transaction.
|
|
2502
2545
|
*/
|
|
2503
2546
|
status: TxStatus;
|
|
2504
|
-
/**
|
|
2505
|
-
* Height of the block in which the transaction was committed.
|
|
2506
|
-
*/
|
|
2507
|
-
readonly height: bigint;
|
|
2508
2547
|
}
|
|
2509
2548
|
/**
|
|
2510
2549
|
* Address of a validator.
|