algosdk 3.0.0 → 3.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/README.md +4 -4
- package/dist/browser/algosdk.min.js +1 -1
- package/dist/browser/algosdk.min.js.map +1 -1
- package/dist/cjs/abi/abi_type.js +9 -7
- package/dist/cjs/abi/abi_type.js.map +1 -1
- package/dist/cjs/client/v2/algod/block.js +21 -0
- package/dist/cjs/client/v2/algod/block.js.map +1 -1
- package/dist/cjs/client/v2/indexer/indexer.js +15 -0
- package/dist/cjs/client/v2/indexer/indexer.js.map +1 -1
- package/dist/cjs/client/v2/indexer/models/types.js +227 -3
- package/dist/cjs/client/v2/indexer/models/types.js.map +1 -1
- package/dist/cjs/client/v2/indexer/searchForBlockHeaders.js +217 -0
- package/dist/cjs/client/v2/indexer/searchForBlockHeaders.js.map +1 -0
- package/dist/cjs/heartbeat.js +119 -0
- package/dist/cjs/heartbeat.js.map +1 -0
- package/dist/cjs/transaction.js +36 -0
- package/dist/cjs/transaction.js.map +1 -1
- package/dist/cjs/types/transactions/base.js +6 -1
- package/dist/cjs/types/transactions/base.js.map +1 -1
- package/dist/esm/abi/abi_type.js +10 -8
- package/dist/esm/abi/abi_type.js.map +1 -1
- package/dist/esm/client/v2/algod/block.js +21 -0
- package/dist/esm/client/v2/algod/block.js.map +1 -1
- package/dist/esm/client/v2/indexer/indexer.js +15 -0
- package/dist/esm/client/v2/indexer/indexer.js.map +1 -1
- package/dist/esm/client/v2/indexer/models/types.js +222 -1
- package/dist/esm/client/v2/indexer/models/types.js.map +1 -1
- package/dist/esm/client/v2/indexer/searchForBlockHeaders.js +211 -0
- package/dist/esm/client/v2/indexer/searchForBlockHeaders.js.map +1 -0
- package/dist/esm/heartbeat.js +114 -0
- package/dist/esm/heartbeat.js.map +1 -0
- package/dist/esm/transaction.js +36 -0
- package/dist/esm/transaction.js.map +1 -1
- package/dist/esm/types/transactions/base.js +6 -1
- package/dist/esm/types/transactions/base.js.map +1 -1
- package/dist/types/abi/abi_type.d.ts +13 -1
- package/dist/types/client/v2/algod/block.d.ts +18 -0
- package/dist/types/client/v2/indexer/indexer.d.ts +13 -0
- package/dist/types/client/v2/indexer/models/types.d.ts +146 -1
- package/dist/types/client/v2/indexer/searchForBlockHeaders.d.ts +176 -0
- package/dist/types/heartbeat.d.ts +39 -0
- package/dist/types/transaction.d.ts +9 -0
- package/dist/types/types/transactions/base.d.ts +32 -1
- package/package.json +2 -2
- package/src/abi/abi_type.ts +16 -9
- package/src/client/v2/algod/block.ts +22 -0
- package/src/client/v2/indexer/indexer.ts +16 -0
- package/src/client/v2/indexer/models/types.ts +375 -0
- package/src/client/v2/indexer/searchForBlockHeaders.ts +223 -0
- package/src/heartbeat.ts +168 -0
- package/src/transaction.ts +46 -0
- package/src/types/transactions/base.ts +43 -1
|
@@ -15,6 +15,7 @@ import LookupApplications from './lookupApplications.js';
|
|
|
15
15
|
import LookupApplicationLogs from './lookupApplicationLogs.js';
|
|
16
16
|
import LookupApplicationBoxByIDandName from './lookupApplicationBoxByIDandName.js';
|
|
17
17
|
import SearchAccounts from './searchAccounts.js';
|
|
18
|
+
import SearchForBlockHeaders from './searchForBlockHeaders.js';
|
|
18
19
|
import SearchForTransactions from './searchForTransactions.js';
|
|
19
20
|
import SearchForAssets from './searchForAssets.js';
|
|
20
21
|
import SearchForApplications from './searchForApplications.js';
|
|
@@ -266,6 +267,18 @@ export declare class IndexerClient extends ServiceClient {
|
|
|
266
267
|
* @category GET
|
|
267
268
|
*/
|
|
268
269
|
searchAccounts(): SearchAccounts;
|
|
270
|
+
/**
|
|
271
|
+
* Returns information about indexed block headers.
|
|
272
|
+
*
|
|
273
|
+
* #### Example
|
|
274
|
+
* ```typescript
|
|
275
|
+
* const bhs = await indexerClient.searchForBlockHeaders().do();
|
|
276
|
+
* ```
|
|
277
|
+
*
|
|
278
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2block-headers)
|
|
279
|
+
* @category GET
|
|
280
|
+
*/
|
|
281
|
+
searchForBlockHeaders(): SearchForBlockHeaders;
|
|
269
282
|
/**
|
|
270
283
|
* Returns information about indexed transactions.
|
|
271
284
|
*
|
|
@@ -1242,6 +1242,38 @@ export declare class Block implements Encodable {
|
|
|
1242
1242
|
toEncodingData(): Map<string, unknown>;
|
|
1243
1243
|
static fromEncodingData(data: unknown): Block;
|
|
1244
1244
|
}
|
|
1245
|
+
/**
|
|
1246
|
+
*
|
|
1247
|
+
*/
|
|
1248
|
+
export declare class BlockHeadersResponse implements Encodable {
|
|
1249
|
+
private static encodingSchemaValue;
|
|
1250
|
+
static get encodingSchema(): Schema;
|
|
1251
|
+
blocks: Block[];
|
|
1252
|
+
/**
|
|
1253
|
+
* Round at which the results were computed.
|
|
1254
|
+
*/
|
|
1255
|
+
currentRound: bigint;
|
|
1256
|
+
/**
|
|
1257
|
+
* Used for pagination, when making another request provide this token with the
|
|
1258
|
+
* next parameter.
|
|
1259
|
+
*/
|
|
1260
|
+
nextToken?: string;
|
|
1261
|
+
/**
|
|
1262
|
+
* Creates a new `BlockHeadersResponse` object.
|
|
1263
|
+
* @param blocks -
|
|
1264
|
+
* @param currentRound - Round at which the results were computed.
|
|
1265
|
+
* @param nextToken - Used for pagination, when making another request provide this token with the
|
|
1266
|
+
* next parameter.
|
|
1267
|
+
*/
|
|
1268
|
+
constructor({ blocks, currentRound, nextToken, }: {
|
|
1269
|
+
blocks: Block[];
|
|
1270
|
+
currentRound: number | bigint;
|
|
1271
|
+
nextToken?: string;
|
|
1272
|
+
});
|
|
1273
|
+
getEncodingSchema(): Schema;
|
|
1274
|
+
toEncodingData(): Map<string, unknown>;
|
|
1275
|
+
static fromEncodingData(data: unknown): BlockHeadersResponse;
|
|
1276
|
+
}
|
|
1245
1277
|
/**
|
|
1246
1278
|
* Fields relating to rewards,
|
|
1247
1279
|
*/
|
|
@@ -1565,6 +1597,56 @@ export declare class HashFactory implements Encodable {
|
|
|
1565
1597
|
toEncodingData(): Map<string, unknown>;
|
|
1566
1598
|
static fromEncodingData(data: unknown): HashFactory;
|
|
1567
1599
|
}
|
|
1600
|
+
/**
|
|
1601
|
+
* (hbprf) HbProof is a signature using HeartbeatAddress's partkey, thereby showing
|
|
1602
|
+
* it is online.
|
|
1603
|
+
*/
|
|
1604
|
+
export declare class HbProofFields implements Encodable {
|
|
1605
|
+
private static encodingSchemaValue;
|
|
1606
|
+
static get encodingSchema(): Schema;
|
|
1607
|
+
/**
|
|
1608
|
+
* (p) Public key of the heartbeat message.
|
|
1609
|
+
*/
|
|
1610
|
+
hbPk?: Uint8Array;
|
|
1611
|
+
/**
|
|
1612
|
+
* (p1s) Signature of OneTimeSignatureSubkeyOffsetID(PK, Batch, Offset) under the
|
|
1613
|
+
* key PK2.
|
|
1614
|
+
*/
|
|
1615
|
+
hbPk1sig?: Uint8Array;
|
|
1616
|
+
/**
|
|
1617
|
+
* (p2) Key for new-style two-level ephemeral signature.
|
|
1618
|
+
*/
|
|
1619
|
+
hbPk2?: Uint8Array;
|
|
1620
|
+
/**
|
|
1621
|
+
* (p2s) Signature of OneTimeSignatureSubkeyBatchID(PK2, Batch) under the master
|
|
1622
|
+
* key (OneTimeSignatureVerifier).
|
|
1623
|
+
*/
|
|
1624
|
+
hbPk2sig?: Uint8Array;
|
|
1625
|
+
/**
|
|
1626
|
+
* (s) Signature of the heartbeat message.
|
|
1627
|
+
*/
|
|
1628
|
+
hbSig?: Uint8Array;
|
|
1629
|
+
/**
|
|
1630
|
+
* Creates a new `HbProofFields` object.
|
|
1631
|
+
* @param hbPk - (p) Public key of the heartbeat message.
|
|
1632
|
+
* @param hbPk1sig - (p1s) Signature of OneTimeSignatureSubkeyOffsetID(PK, Batch, Offset) under the
|
|
1633
|
+
* key PK2.
|
|
1634
|
+
* @param hbPk2 - (p2) Key for new-style two-level ephemeral signature.
|
|
1635
|
+
* @param hbPk2sig - (p2s) Signature of OneTimeSignatureSubkeyBatchID(PK2, Batch) under the master
|
|
1636
|
+
* key (OneTimeSignatureVerifier).
|
|
1637
|
+
* @param hbSig - (s) Signature of the heartbeat message.
|
|
1638
|
+
*/
|
|
1639
|
+
constructor({ hbPk, hbPk1sig, hbPk2, hbPk2sig, hbSig, }: {
|
|
1640
|
+
hbPk?: string | Uint8Array;
|
|
1641
|
+
hbPk1sig?: string | Uint8Array;
|
|
1642
|
+
hbPk2?: string | Uint8Array;
|
|
1643
|
+
hbPk2sig?: string | Uint8Array;
|
|
1644
|
+
hbSig?: string | Uint8Array;
|
|
1645
|
+
});
|
|
1646
|
+
getEncodingSchema(): Schema;
|
|
1647
|
+
toEncodingData(): Map<string, unknown>;
|
|
1648
|
+
static fromEncodingData(data: unknown): HbProofFields;
|
|
1649
|
+
}
|
|
1568
1650
|
/**
|
|
1569
1651
|
* A health check response.
|
|
1570
1652
|
*/
|
|
@@ -2158,6 +2240,12 @@ export declare class Transaction implements Encodable {
|
|
|
2158
2240
|
* sha512/256 hash of the transactions in that group.
|
|
2159
2241
|
*/
|
|
2160
2242
|
group?: Uint8Array;
|
|
2243
|
+
/**
|
|
2244
|
+
* Fields for a heartbeat transaction.
|
|
2245
|
+
* Definition:
|
|
2246
|
+
* data/transactions/heartbeat.go : HeartbeatTxnFields
|
|
2247
|
+
*/
|
|
2248
|
+
heartbeatTransaction?: TransactionHeartbeat;
|
|
2161
2249
|
/**
|
|
2162
2250
|
* Transaction ID
|
|
2163
2251
|
*/
|
|
@@ -2243,6 +2331,7 @@ export declare class Transaction implements Encodable {
|
|
|
2243
2331
|
* * (afrz) asset-freeze-transaction
|
|
2244
2332
|
* * (appl) application-transaction
|
|
2245
2333
|
* * (stpf) state-proof-transaction
|
|
2334
|
+
* * (hb) heartbeat-transaction
|
|
2246
2335
|
*/
|
|
2247
2336
|
txType?: string;
|
|
2248
2337
|
/**
|
|
@@ -2281,6 +2370,9 @@ export declare class Transaction implements Encodable {
|
|
|
2281
2370
|
* @param group - (grp) Base64 encoded byte array of a sha512/256 digest. When present indicates
|
|
2282
2371
|
* that this transaction is part of a transaction group and the value is the
|
|
2283
2372
|
* sha512/256 hash of the transactions in that group.
|
|
2373
|
+
* @param heartbeatTransaction - Fields for a heartbeat transaction.
|
|
2374
|
+
* Definition:
|
|
2375
|
+
* data/transactions/heartbeat.go : HeartbeatTxnFields
|
|
2284
2376
|
* @param id - Transaction ID
|
|
2285
2377
|
* @param innerTxns - Inner transactions produced by application execution.
|
|
2286
2378
|
* @param intraRoundOffset - Offset into the round where this transaction was confirmed.
|
|
@@ -2320,8 +2412,9 @@ export declare class Transaction implements Encodable {
|
|
|
2320
2412
|
* * (afrz) asset-freeze-transaction
|
|
2321
2413
|
* * (appl) application-transaction
|
|
2322
2414
|
* * (stpf) state-proof-transaction
|
|
2415
|
+
* * (hb) heartbeat-transaction
|
|
2323
2416
|
*/
|
|
2324
|
-
constructor({ fee, firstValid, lastValid, sender, applicationTransaction, assetConfigTransaction, assetFreezeTransaction, assetTransferTransaction, authAddr, closeRewards, closingAmount, confirmedRound, createdApplicationIndex, createdAssetIndex, genesisHash, genesisId, globalStateDelta, group, id, innerTxns, intraRoundOffset, keyregTransaction, lease, localStateDelta, logs, note, paymentTransaction, receiverRewards, rekeyTo, roundTime, senderRewards, signature, stateProofTransaction, txType, }: {
|
|
2417
|
+
constructor({ fee, firstValid, lastValid, sender, applicationTransaction, assetConfigTransaction, assetFreezeTransaction, assetTransferTransaction, authAddr, closeRewards, closingAmount, confirmedRound, createdApplicationIndex, createdAssetIndex, genesisHash, genesisId, globalStateDelta, group, heartbeatTransaction, id, innerTxns, intraRoundOffset, keyregTransaction, lease, localStateDelta, logs, note, paymentTransaction, receiverRewards, rekeyTo, roundTime, senderRewards, signature, stateProofTransaction, txType, }: {
|
|
2325
2418
|
fee: number | bigint;
|
|
2326
2419
|
firstValid: number | bigint;
|
|
2327
2420
|
lastValid: number | bigint;
|
|
@@ -2340,6 +2433,7 @@ export declare class Transaction implements Encodable {
|
|
|
2340
2433
|
genesisId?: string;
|
|
2341
2434
|
globalStateDelta?: EvalDeltaKeyValue[];
|
|
2342
2435
|
group?: string | Uint8Array;
|
|
2436
|
+
heartbeatTransaction?: TransactionHeartbeat;
|
|
2343
2437
|
id?: string;
|
|
2344
2438
|
innerTxns?: Transaction[];
|
|
2345
2439
|
intraRoundOffset?: number | bigint;
|
|
@@ -2629,6 +2723,57 @@ export declare class TransactionAssetTransfer implements Encodable {
|
|
|
2629
2723
|
toEncodingData(): Map<string, unknown>;
|
|
2630
2724
|
static fromEncodingData(data: unknown): TransactionAssetTransfer;
|
|
2631
2725
|
}
|
|
2726
|
+
/**
|
|
2727
|
+
* Fields for a heartbeat transaction.
|
|
2728
|
+
* Definition:
|
|
2729
|
+
* data/transactions/heartbeat.go : HeartbeatTxnFields
|
|
2730
|
+
*/
|
|
2731
|
+
export declare class TransactionHeartbeat implements Encodable {
|
|
2732
|
+
private static encodingSchemaValue;
|
|
2733
|
+
static get encodingSchema(): Schema;
|
|
2734
|
+
/**
|
|
2735
|
+
* (hbad) HbAddress is the account this txn is proving onlineness for.
|
|
2736
|
+
*/
|
|
2737
|
+
hbAddress: string;
|
|
2738
|
+
/**
|
|
2739
|
+
* (hbkd) HbKeyDilution must match HbAddress account's current KeyDilution.
|
|
2740
|
+
*/
|
|
2741
|
+
hbKeyDilution: bigint;
|
|
2742
|
+
/**
|
|
2743
|
+
* (hbprf) HbProof is a signature using HeartbeatAddress's partkey, thereby showing
|
|
2744
|
+
* it is online.
|
|
2745
|
+
*/
|
|
2746
|
+
hbProof: HbProofFields;
|
|
2747
|
+
/**
|
|
2748
|
+
* (hbsd) HbSeed must be the block seed for the this transaction's firstValid
|
|
2749
|
+
* block.
|
|
2750
|
+
*/
|
|
2751
|
+
hbSeed: Uint8Array;
|
|
2752
|
+
/**
|
|
2753
|
+
* (hbvid) HbVoteID must match the HbAddress account's current VoteID.
|
|
2754
|
+
*/
|
|
2755
|
+
hbVoteId: Uint8Array;
|
|
2756
|
+
/**
|
|
2757
|
+
* Creates a new `TransactionHeartbeat` object.
|
|
2758
|
+
* @param hbAddress - (hbad) HbAddress is the account this txn is proving onlineness for.
|
|
2759
|
+
* @param hbKeyDilution - (hbkd) HbKeyDilution must match HbAddress account's current KeyDilution.
|
|
2760
|
+
* @param hbProof - (hbprf) HbProof is a signature using HeartbeatAddress's partkey, thereby showing
|
|
2761
|
+
* it is online.
|
|
2762
|
+
* @param hbSeed - (hbsd) HbSeed must be the block seed for the this transaction's firstValid
|
|
2763
|
+
* block.
|
|
2764
|
+
* @param hbVoteId - (hbvid) HbVoteID must match the HbAddress account's current VoteID.
|
|
2765
|
+
*/
|
|
2766
|
+
constructor({ hbAddress, hbKeyDilution, hbProof, hbSeed, hbVoteId, }: {
|
|
2767
|
+
hbAddress: string;
|
|
2768
|
+
hbKeyDilution: number | bigint;
|
|
2769
|
+
hbProof: HbProofFields;
|
|
2770
|
+
hbSeed: string | Uint8Array;
|
|
2771
|
+
hbVoteId: string | Uint8Array;
|
|
2772
|
+
});
|
|
2773
|
+
getEncodingSchema(): Schema;
|
|
2774
|
+
toEncodingData(): Map<string, unknown>;
|
|
2775
|
+
static fromEncodingData(data: unknown): TransactionHeartbeat;
|
|
2776
|
+
}
|
|
2632
2777
|
/**
|
|
2633
2778
|
* Fields for a keyreg transaction.
|
|
2634
2779
|
* Definition:
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import JSONRequest from '../jsonrequest.js';
|
|
2
|
+
import { HTTPClientResponse } from '../../client.js';
|
|
3
|
+
import { Address } from '../../../encoding/address.js';
|
|
4
|
+
import { BlockHeadersResponse } from './models/types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Returns information about indexed block headers.
|
|
7
|
+
*
|
|
8
|
+
* #### Example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const bhs = await indexerClient.searchForBlockHeaders().do();
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2block-headers)
|
|
14
|
+
* @category GET
|
|
15
|
+
*/
|
|
16
|
+
export default class SearchForBlockHeaders extends JSONRequest<BlockHeadersResponse> {
|
|
17
|
+
/**
|
|
18
|
+
* @returns `/v2/block-headers`
|
|
19
|
+
*/
|
|
20
|
+
path(): string;
|
|
21
|
+
/**
|
|
22
|
+
* Accounts marked as absent in the block header's participation updates.
|
|
23
|
+
*
|
|
24
|
+
* #### Example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const address1 = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
27
|
+
* const address2 = "4H5UNRBJ2Q6JENAXQ6HNTGKLKINP4J4VTQBEPK5F3I6RDICMZBPGNH6KD4";
|
|
28
|
+
* const bhs = await indexerClient
|
|
29
|
+
* .searchForBlockHeaders()
|
|
30
|
+
* .absent([address1,address2])
|
|
31
|
+
* .do();
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @param absent - a comma separated list of addresses
|
|
35
|
+
* @category query
|
|
36
|
+
*/
|
|
37
|
+
absent(absent: (string | Address)[]): this;
|
|
38
|
+
/**
|
|
39
|
+
* Include results after the given time.
|
|
40
|
+
*
|
|
41
|
+
* #### Example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* const afterTime = "2022-10-21T00:00:11.55Z";
|
|
44
|
+
* const bhs = await indexerClient
|
|
45
|
+
* .searchForBlockHeaders()
|
|
46
|
+
* .afterTime(afterTime)
|
|
47
|
+
* .do();
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @param after - rfc3339 string or Date object
|
|
51
|
+
* @category query
|
|
52
|
+
*/
|
|
53
|
+
afterTime(after: string | Date): this;
|
|
54
|
+
/**
|
|
55
|
+
* Include results before the given time.
|
|
56
|
+
*
|
|
57
|
+
* #### Example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const beforeTime = "2022-02-02T20:20:22.02Z";
|
|
60
|
+
* const bhs = await indexerClient
|
|
61
|
+
* .searchForBlockHeaders()
|
|
62
|
+
* .beforeTime(beforeTime)
|
|
63
|
+
* .do();
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @param before - rfc3339 string or Date object
|
|
67
|
+
* @category query
|
|
68
|
+
*/
|
|
69
|
+
beforeTime(before: string | Date): this;
|
|
70
|
+
/**
|
|
71
|
+
* Accounts marked as expired in the block header's participation updates.
|
|
72
|
+
*
|
|
73
|
+
* #### Example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const address1 = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
76
|
+
* const address2 = "4H5UNRBJ2Q6JENAXQ6HNTGKLKINP4J4VTQBEPK5F3I6RDICMZBPGNH6KD4";
|
|
77
|
+
* const bhs = await indexerClient
|
|
78
|
+
* .searchForBlockHeaders()
|
|
79
|
+
* .expired([address1,address2])
|
|
80
|
+
* .do();
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* @param expired - - a comma separated list of addresses
|
|
84
|
+
* @category query
|
|
85
|
+
*/
|
|
86
|
+
expired(expired: (string | Address)[]): this;
|
|
87
|
+
/**
|
|
88
|
+
* Maximum number of results to return.
|
|
89
|
+
*
|
|
90
|
+
* #### Example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* const maxResults = 25;
|
|
93
|
+
* const bhs = await indexerClient
|
|
94
|
+
* .searchForBlockHeaders()
|
|
95
|
+
* .limit(maxResults)
|
|
96
|
+
* .do();
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* @param limit
|
|
100
|
+
* @category query
|
|
101
|
+
*/
|
|
102
|
+
limit(limit: number): this;
|
|
103
|
+
/**
|
|
104
|
+
* Include results at or before the specified max-round.
|
|
105
|
+
*
|
|
106
|
+
* #### Example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* const maxRound = 18309917;
|
|
109
|
+
* const bhs = await indexerClient
|
|
110
|
+
* .searchForBlockHeaders()
|
|
111
|
+
* .maxRound(maxRound)
|
|
112
|
+
* .do();
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* @param round
|
|
116
|
+
* @category query
|
|
117
|
+
*/
|
|
118
|
+
maxRound(round: number | bigint): this;
|
|
119
|
+
/**
|
|
120
|
+
* Include results at or after the specified min-round.
|
|
121
|
+
*
|
|
122
|
+
* #### Example
|
|
123
|
+
* ```typescript
|
|
124
|
+
* const minRound = 18309917;
|
|
125
|
+
* const bhs = await indexerClient
|
|
126
|
+
* .searchForBlockHeaders()
|
|
127
|
+
* .minRound(minRound)
|
|
128
|
+
* .do();
|
|
129
|
+
* ```
|
|
130
|
+
*
|
|
131
|
+
* @param round
|
|
132
|
+
* @category query
|
|
133
|
+
*/
|
|
134
|
+
minRound(round: number | bigint): this;
|
|
135
|
+
/**
|
|
136
|
+
* The next page of results.
|
|
137
|
+
*
|
|
138
|
+
* #### Example
|
|
139
|
+
* ```typescript
|
|
140
|
+
* const maxResults = 25;
|
|
141
|
+
*
|
|
142
|
+
* const bh1 = await indexerClient
|
|
143
|
+
* .searchForBlockHeaders()
|
|
144
|
+
* .limit(maxResults)
|
|
145
|
+
* .do();
|
|
146
|
+
*
|
|
147
|
+
* const bh2 = await indexerClient
|
|
148
|
+
* .searchForBlockHeaders()
|
|
149
|
+
* .limit(maxResults)
|
|
150
|
+
* .nextToken(bh1["next-token"])
|
|
151
|
+
* .do();
|
|
152
|
+
* ```
|
|
153
|
+
*
|
|
154
|
+
* @param nextToken - provided by the previous results
|
|
155
|
+
* @category query
|
|
156
|
+
*/
|
|
157
|
+
nextToken(nextToken: string): this;
|
|
158
|
+
/**
|
|
159
|
+
* Accounts marked as proposer in the block header's participation updates.
|
|
160
|
+
*
|
|
161
|
+
* #### Example
|
|
162
|
+
* ```typescript
|
|
163
|
+
* const address1 = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
164
|
+
* const address2 = "4H5UNRBJ2Q6JENAXQ6HNTGKLKINP4J4VTQBEPK5F3I6RDICMZBPGNH6KD4";
|
|
165
|
+
* const bhs = await indexerClient
|
|
166
|
+
* .searchForBlockHeaders()
|
|
167
|
+
* .proposers([address1,address2])
|
|
168
|
+
* .do();
|
|
169
|
+
* ```
|
|
170
|
+
*
|
|
171
|
+
* @param proposers - a comma separated list of addresses
|
|
172
|
+
* @category query
|
|
173
|
+
*/
|
|
174
|
+
proposers(proposers: (string | Address)[]): this;
|
|
175
|
+
prepare(response: HTTPClientResponse): BlockHeadersResponse;
|
|
176
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Address } from './encoding/address.js';
|
|
2
|
+
import { Encodable, Schema } from './encoding/encoding.js';
|
|
3
|
+
import { NamedMapSchema } from './encoding/schema/index.js';
|
|
4
|
+
export declare class HeartbeatProof implements Encodable {
|
|
5
|
+
static readonly encodingSchema: NamedMapSchema;
|
|
6
|
+
sig: Uint8Array;
|
|
7
|
+
pk: Uint8Array;
|
|
8
|
+
pk2: Uint8Array;
|
|
9
|
+
pk1Sig: Uint8Array;
|
|
10
|
+
pk2Sig: Uint8Array;
|
|
11
|
+
constructor(params: {
|
|
12
|
+
sig: Uint8Array;
|
|
13
|
+
pk: Uint8Array;
|
|
14
|
+
pk2: Uint8Array;
|
|
15
|
+
pk1Sig: Uint8Array;
|
|
16
|
+
pk2Sig: Uint8Array;
|
|
17
|
+
});
|
|
18
|
+
getEncodingSchema(): Schema;
|
|
19
|
+
toEncodingData(): Map<string, unknown>;
|
|
20
|
+
static fromEncodingData(data: unknown): HeartbeatProof;
|
|
21
|
+
}
|
|
22
|
+
export declare class Heartbeat implements Encodable {
|
|
23
|
+
static readonly encodingSchema: NamedMapSchema;
|
|
24
|
+
address: Address;
|
|
25
|
+
proof: HeartbeatProof;
|
|
26
|
+
seed: Uint8Array;
|
|
27
|
+
voteID: Uint8Array;
|
|
28
|
+
keyDilution: bigint;
|
|
29
|
+
constructor(params: {
|
|
30
|
+
address: Address;
|
|
31
|
+
proof: HeartbeatProof;
|
|
32
|
+
seed: Uint8Array;
|
|
33
|
+
voteID: Uint8Array;
|
|
34
|
+
keyDilution: bigint;
|
|
35
|
+
});
|
|
36
|
+
getEncodingSchema(): Schema;
|
|
37
|
+
toEncodingData(): Map<string, unknown>;
|
|
38
|
+
static fromEncodingData(data: unknown): Heartbeat;
|
|
39
|
+
}
|
|
@@ -3,6 +3,7 @@ import * as encoding from './encoding/encoding.js';
|
|
|
3
3
|
import { NamedMapSchema } from './encoding/schema/index.js';
|
|
4
4
|
import { OnApplicationComplete, TransactionParams, TransactionType } from './types/transactions/base.js';
|
|
5
5
|
import { StateProof, StateProofMessage } from './stateproof.js';
|
|
6
|
+
import { HeartbeatProof } from './heartbeat.js';
|
|
6
7
|
export interface TransactionBoxReference {
|
|
7
8
|
readonly appIndex: bigint;
|
|
8
9
|
readonly name: Uint8Array;
|
|
@@ -68,6 +69,13 @@ export interface StateProofTransactionFields {
|
|
|
68
69
|
readonly stateProof?: StateProof;
|
|
69
70
|
readonly message?: StateProofMessage;
|
|
70
71
|
}
|
|
72
|
+
export interface HeartbeatTransactionFields {
|
|
73
|
+
readonly address: Address;
|
|
74
|
+
readonly proof: HeartbeatProof;
|
|
75
|
+
readonly seed: Uint8Array;
|
|
76
|
+
readonly voteID: Uint8Array;
|
|
77
|
+
readonly keyDilution: bigint;
|
|
78
|
+
}
|
|
71
79
|
/**
|
|
72
80
|
* Transaction enables construction of Algorand transactions
|
|
73
81
|
* */
|
|
@@ -95,6 +103,7 @@ export declare class Transaction implements encoding.Encodable {
|
|
|
95
103
|
readonly assetFreeze?: AssetFreezeTransactionFields;
|
|
96
104
|
readonly applicationCall?: ApplicationTransactionFields;
|
|
97
105
|
readonly stateProof?: StateProofTransactionFields;
|
|
106
|
+
readonly heartbeat?: HeartbeatTransactionFields;
|
|
98
107
|
constructor(params: TransactionParams);
|
|
99
108
|
getEncodingSchema(): encoding.Schema;
|
|
100
109
|
toEncodingData(): Map<string, unknown>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Address } from '../../encoding/address.js';
|
|
2
2
|
import { StateProof, StateProofMessage } from '../../stateproof.js';
|
|
3
|
+
import { HeartbeatProof } from '../../heartbeat.js';
|
|
3
4
|
/**
|
|
4
5
|
* Enum for application transaction types.
|
|
5
6
|
*/
|
|
@@ -31,7 +32,11 @@ export declare enum TransactionType {
|
|
|
31
32
|
/**
|
|
32
33
|
* State proof transaction
|
|
33
34
|
*/
|
|
34
|
-
stpf = "stpf"
|
|
35
|
+
stpf = "stpf",
|
|
36
|
+
/**
|
|
37
|
+
* Heartbeat transaction
|
|
38
|
+
*/
|
|
39
|
+
hb = "hb"
|
|
35
40
|
}
|
|
36
41
|
/**
|
|
37
42
|
* Check if a string is a valid transaction type
|
|
@@ -371,6 +376,28 @@ export interface StateProofTransactionParams {
|
|
|
371
376
|
*/
|
|
372
377
|
message?: StateProofMessage;
|
|
373
378
|
}
|
|
379
|
+
/**
|
|
380
|
+
* Contains heartbeat transaction parameters.
|
|
381
|
+
*/
|
|
382
|
+
export interface HeartbeatTransactionParams {
|
|
383
|
+
address: Address;
|
|
384
|
+
/**
|
|
385
|
+
* Signature using HeartbeatAddress's partkey, thereby showing it is online.
|
|
386
|
+
*/
|
|
387
|
+
proof: HeartbeatProof;
|
|
388
|
+
/**
|
|
389
|
+
* The block seed for the this transaction's firstValid block.
|
|
390
|
+
*/
|
|
391
|
+
seed: Uint8Array;
|
|
392
|
+
/**
|
|
393
|
+
* Must match the hbAddress account's current VoteID
|
|
394
|
+
*/
|
|
395
|
+
voteID: Uint8Array;
|
|
396
|
+
/**
|
|
397
|
+
* Must match hbAddress account's current KeyDilution.
|
|
398
|
+
*/
|
|
399
|
+
keyDilution: bigint;
|
|
400
|
+
}
|
|
374
401
|
/**
|
|
375
402
|
* A full list of all available transaction parameters
|
|
376
403
|
*
|
|
@@ -433,4 +460,8 @@ export interface TransactionParams {
|
|
|
433
460
|
* State proof transaction parameters. Only set if type is TransactionType.stpf
|
|
434
461
|
*/
|
|
435
462
|
stateProofParams?: StateProofTransactionParams;
|
|
463
|
+
/**
|
|
464
|
+
* Heartbeat transaction parameters. Only set if type is TransactionType.hb
|
|
465
|
+
*/
|
|
466
|
+
heartbeatParams?: HeartbeatTransactionParams;
|
|
436
467
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "algosdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "The official JavaScript SDK for Algorand",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"geckodriver": "^4.3.0",
|
|
79
79
|
"husky": "^4.3.8",
|
|
80
80
|
"lint-staged": "^10.5.4",
|
|
81
|
-
"mocha": "^
|
|
81
|
+
"mocha": "^11.1.0",
|
|
82
82
|
"mock-http-server": "^1.4.3",
|
|
83
83
|
"prettier": "^3.2.1",
|
|
84
84
|
"selenium-webdriver": "^4.10.0",
|
package/src/abi/abi_type.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// | string
|
|
14
14
|
// | (T1, ..., Tn)
|
|
15
15
|
*/
|
|
16
|
-
import { encodeAddress, decodeAddress } from '../encoding/address.js';
|
|
16
|
+
import { encodeAddress, decodeAddress, Address } from '../encoding/address.js';
|
|
17
17
|
import { bigIntToBytes, bytesToBigInt } from '../encoding/bigint.js';
|
|
18
18
|
import { concatArrays } from '../utils/utils.js';
|
|
19
19
|
|
|
@@ -37,7 +37,8 @@ export type ABIValue =
|
|
|
37
37
|
| bigint
|
|
38
38
|
| string
|
|
39
39
|
| Uint8Array
|
|
40
|
-
| ABIValue[]
|
|
40
|
+
| ABIValue[]
|
|
41
|
+
| Address;
|
|
41
42
|
|
|
42
43
|
export abstract class ABIType {
|
|
43
44
|
// Converts a ABIType object to a string
|
|
@@ -255,18 +256,24 @@ export class ABIAddressType extends ABIType {
|
|
|
255
256
|
}
|
|
256
257
|
|
|
257
258
|
encode(value: ABIValue) {
|
|
258
|
-
if (typeof value !== 'string' && !(value instanceof Uint8Array)) {
|
|
259
|
-
throw new Error(`Cannot encode value as ${this.toString()}: ${value}`);
|
|
260
|
-
}
|
|
261
259
|
if (typeof value === 'string') {
|
|
262
260
|
const decodedAddress = decodeAddress(value);
|
|
263
261
|
return decodedAddress.publicKey;
|
|
264
262
|
}
|
|
265
|
-
|
|
266
|
-
if (value
|
|
267
|
-
|
|
263
|
+
|
|
264
|
+
if (value instanceof Address) {
|
|
265
|
+
return value.publicKey;
|
|
268
266
|
}
|
|
269
|
-
|
|
267
|
+
|
|
268
|
+
if (value instanceof Uint8Array) {
|
|
269
|
+
if (value.byteLength !== 32) {
|
|
270
|
+
throw new Error(`byte string must be 32 bytes long for an address`);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return value;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
throw new Error(`Cannot encode value as ${this.toString()}: ${value}`);
|
|
270
277
|
}
|
|
271
278
|
|
|
272
279
|
decode(byteString: Uint8Array): string {
|
|
@@ -19,6 +19,28 @@ export default class Block extends JSONRequest<BlockResponse> {
|
|
|
19
19
|
return `/v2/blocks/${this.round}`;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* If true, only the block header (exclusive of payset or certificate) may be included in response.
|
|
24
|
+
*
|
|
25
|
+
* #### Example
|
|
26
|
+
* ```typescript
|
|
27
|
+
*
|
|
28
|
+
* const roundNumber = 41000000;
|
|
29
|
+
*
|
|
30
|
+
* const blockResponse = await algodClient
|
|
31
|
+
* .block(roundNumber)
|
|
32
|
+
* .headerOnly(true)
|
|
33
|
+
* .do();
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @param headerOnly - the flag indicating whether exclusively return header in response
|
|
37
|
+
* @category query
|
|
38
|
+
*/
|
|
39
|
+
headerOnly(headerOnly: boolean) {
|
|
40
|
+
this.query['header-only'] = headerOnly;
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
|
|
22
44
|
// eslint-disable-next-line class-methods-use-this
|
|
23
45
|
prepare(response: HTTPClientResponse): BlockResponse {
|
|
24
46
|
return decodeMsgpack(response.body, BlockResponse);
|
|
@@ -15,6 +15,7 @@ import LookupApplications from './lookupApplications.js';
|
|
|
15
15
|
import LookupApplicationLogs from './lookupApplicationLogs.js';
|
|
16
16
|
import LookupApplicationBoxByIDandName from './lookupApplicationBoxByIDandName.js';
|
|
17
17
|
import SearchAccounts from './searchAccounts.js';
|
|
18
|
+
import SearchForBlockHeaders from './searchForBlockHeaders.js';
|
|
18
19
|
import SearchForTransactions from './searchForTransactions.js';
|
|
19
20
|
import SearchForAssets from './searchForAssets.js';
|
|
20
21
|
import SearchForApplications from './searchForApplications.js';
|
|
@@ -327,6 +328,21 @@ export class IndexerClient extends ServiceClient {
|
|
|
327
328
|
return new SearchAccounts(this.c);
|
|
328
329
|
}
|
|
329
330
|
|
|
331
|
+
/**
|
|
332
|
+
* Returns information about indexed block headers.
|
|
333
|
+
*
|
|
334
|
+
* #### Example
|
|
335
|
+
* ```typescript
|
|
336
|
+
* const bhs = await indexerClient.searchForBlockHeaders().do();
|
|
337
|
+
* ```
|
|
338
|
+
*
|
|
339
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2block-headers)
|
|
340
|
+
* @category GET
|
|
341
|
+
*/
|
|
342
|
+
searchForBlockHeaders() {
|
|
343
|
+
return new SearchForBlockHeaders(this.c);
|
|
344
|
+
}
|
|
345
|
+
|
|
330
346
|
/**
|
|
331
347
|
* Returns information about indexed transactions.
|
|
332
348
|
*
|