algosdk 2.9.0 → 2.11.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.
Files changed (52) hide show
  1. package/README.md +4 -4
  2. package/dist/browser/algosdk.min.js +1 -1
  3. package/dist/browser/algosdk.min.js.map +1 -1
  4. package/dist/cjs/client/v2/algod/block.js +21 -0
  5. package/dist/cjs/client/v2/algod/block.js.map +1 -1
  6. package/dist/cjs/client/v2/indexer/indexer.js +15 -0
  7. package/dist/cjs/client/v2/indexer/indexer.js.map +1 -1
  8. package/dist/cjs/client/v2/indexer/models/types.js +168 -3
  9. package/dist/cjs/client/v2/indexer/models/types.js.map +1 -1
  10. package/dist/cjs/client/v2/indexer/searchForBlockHeaders.js +209 -0
  11. package/dist/cjs/client/v2/indexer/searchForBlockHeaders.js.map +1 -0
  12. package/dist/cjs/transaction.js +102 -0
  13. package/dist/cjs/transaction.js.map +1 -1
  14. package/dist/cjs/types/transactions/base.js +6 -1
  15. package/dist/cjs/types/transactions/base.js.map +1 -1
  16. package/dist/cjs/types/transactions/heartbeat.js +3 -0
  17. package/dist/cjs/types/transactions/heartbeat.js.map +1 -0
  18. package/dist/cjs/types/transactions/index.js.map +1 -1
  19. package/dist/esm/client/v2/algod/block.js +21 -0
  20. package/dist/esm/client/v2/algod/block.js.map +1 -1
  21. package/dist/esm/client/v2/indexer/indexer.js +15 -0
  22. package/dist/esm/client/v2/indexer/indexer.js.map +1 -1
  23. package/dist/esm/client/v2/indexer/models/types.js +163 -1
  24. package/dist/esm/client/v2/indexer/models/types.js.map +1 -1
  25. package/dist/esm/client/v2/indexer/searchForBlockHeaders.js +203 -0
  26. package/dist/esm/client/v2/indexer/searchForBlockHeaders.js.map +1 -0
  27. package/dist/esm/transaction.js +102 -0
  28. package/dist/esm/transaction.js.map +1 -1
  29. package/dist/esm/types/transactions/base.js +6 -1
  30. package/dist/esm/types/transactions/base.js.map +1 -1
  31. package/dist/esm/types/transactions/heartbeat.js +2 -0
  32. package/dist/esm/types/transactions/heartbeat.js.map +1 -0
  33. package/dist/esm/types/transactions/index.js.map +1 -1
  34. package/dist/types/client/v2/algod/block.d.ts +18 -0
  35. package/dist/types/client/v2/indexer/indexer.d.ts +13 -0
  36. package/dist/types/client/v2/indexer/models/types.d.ts +134 -1
  37. package/dist/types/client/v2/indexer/searchForBlockHeaders.d.ts +172 -0
  38. package/dist/types/transaction.d.ts +30 -2
  39. package/dist/types/types/transactions/base.d.ts +17 -1
  40. package/dist/types/types/transactions/encoded.d.ts +54 -0
  41. package/dist/types/types/transactions/heartbeat.d.ts +8 -0
  42. package/dist/types/types/transactions/index.d.ts +3 -1
  43. package/package.json +1 -1
  44. package/src/client/v2/algod/block.ts +22 -0
  45. package/src/client/v2/indexer/indexer.ts +16 -0
  46. package/src/client/v2/indexer/models/types.ts +294 -0
  47. package/src/client/v2/indexer/searchForBlockHeaders.ts +212 -0
  48. package/src/transaction.ts +131 -0
  49. package/src/types/transactions/base.ts +20 -1
  50. package/src/types/transactions/encoded.ts +65 -0
  51. package/src/types/transactions/heartbeat.ts +14 -0
  52. package/src/types/transactions/index.ts +4 -1
@@ -1152,6 +1152,34 @@ export declare class Block extends BaseModel {
1152
1152
  });
1153
1153
  static from_obj_for_encoding(data: Record<string, any>): Block;
1154
1154
  }
1155
+ /**
1156
+ *
1157
+ */
1158
+ export declare class BlockHeadersResponse extends BaseModel {
1159
+ blocks?: Block[];
1160
+ /**
1161
+ * Round at which the results were computed.
1162
+ */
1163
+ currentRound?: number | bigint;
1164
+ /**
1165
+ * Used for pagination, when making another request provide this token with the
1166
+ * next parameter.
1167
+ */
1168
+ nextToken?: string;
1169
+ /**
1170
+ * Creates a new `BlockHeadersResponse` object.
1171
+ * @param blocks -
1172
+ * @param currentRound - Round at which the results were computed.
1173
+ * @param nextToken - Used for pagination, when making another request provide this token with the
1174
+ * next parameter.
1175
+ */
1176
+ constructor({ blocks, currentRound, nextToken, }: {
1177
+ blocks?: Block[];
1178
+ currentRound?: number | bigint;
1179
+ nextToken?: string;
1180
+ });
1181
+ static from_obj_for_encoding(data: Record<string, any>): BlockHeadersResponse;
1182
+ }
1155
1183
  /**
1156
1184
  * Fields relating to rewards,
1157
1185
  */
@@ -1435,6 +1463,52 @@ export declare class HashFactory extends BaseModel {
1435
1463
  });
1436
1464
  static from_obj_for_encoding(data: Record<string, any>): HashFactory;
1437
1465
  }
1466
+ /**
1467
+ * (hbprf) HbProof is a signature using HeartbeatAddress's partkey, thereby showing
1468
+ * it is online.
1469
+ */
1470
+ export declare class HbProofFields extends BaseModel {
1471
+ /**
1472
+ * (p) Public key of the heartbeat message.
1473
+ */
1474
+ hbPk?: Uint8Array;
1475
+ /**
1476
+ * (p1s) Signature of OneTimeSignatureSubkeyOffsetID(PK, Batch, Offset) under the
1477
+ * key PK2.
1478
+ */
1479
+ hbPk1sig?: Uint8Array;
1480
+ /**
1481
+ * (p2) Key for new-style two-level ephemeral signature.
1482
+ */
1483
+ hbPk2?: Uint8Array;
1484
+ /**
1485
+ * (p2s) Signature of OneTimeSignatureSubkeyBatchID(PK2, Batch) under the master
1486
+ * key (OneTimeSignatureVerifier).
1487
+ */
1488
+ hbPk2sig?: Uint8Array;
1489
+ /**
1490
+ * (s) Signature of the heartbeat message.
1491
+ */
1492
+ hbSig?: Uint8Array;
1493
+ /**
1494
+ * Creates a new `HbProofFields` object.
1495
+ * @param hbPk - (p) Public key of the heartbeat message.
1496
+ * @param hbPk1sig - (p1s) Signature of OneTimeSignatureSubkeyOffsetID(PK, Batch, Offset) under the
1497
+ * key PK2.
1498
+ * @param hbPk2 - (p2) Key for new-style two-level ephemeral signature.
1499
+ * @param hbPk2sig - (p2s) Signature of OneTimeSignatureSubkeyBatchID(PK2, Batch) under the master
1500
+ * key (OneTimeSignatureVerifier).
1501
+ * @param hbSig - (s) Signature of the heartbeat message.
1502
+ */
1503
+ constructor({ hbPk, hbPk1sig, hbPk2, hbPk2sig, hbSig, }: {
1504
+ hbPk?: string | Uint8Array;
1505
+ hbPk1sig?: string | Uint8Array;
1506
+ hbPk2?: string | Uint8Array;
1507
+ hbPk2sig?: string | Uint8Array;
1508
+ hbSig?: string | Uint8Array;
1509
+ });
1510
+ static from_obj_for_encoding(data: Record<string, any>): HbProofFields;
1511
+ }
1438
1512
  /**
1439
1513
  * A health check response.
1440
1514
  */
@@ -1966,6 +2040,12 @@ export declare class Transaction extends BaseModel {
1966
2040
  * sha512/256 hash of the transactions in that group.
1967
2041
  */
1968
2042
  group?: Uint8Array;
2043
+ /**
2044
+ * Fields for a heartbeat transaction.
2045
+ * Definition:
2046
+ * data/transactions/heartbeat.go : HeartbeatTxnFields
2047
+ */
2048
+ heartbeatTransaction?: TransactionHeartbeat;
1969
2049
  /**
1970
2050
  * Transaction ID
1971
2051
  */
@@ -2051,6 +2131,7 @@ export declare class Transaction extends BaseModel {
2051
2131
  * * (afrz) asset-freeze-transaction
2052
2132
  * * (appl) application-transaction
2053
2133
  * * (stpf) state-proof-transaction
2134
+ * * (hb) heartbeat-transaction
2054
2135
  */
2055
2136
  txType?: string;
2056
2137
  /**
@@ -2089,6 +2170,9 @@ export declare class Transaction extends BaseModel {
2089
2170
  * @param group - (grp) Base64 encoded byte array of a sha512/256 digest. When present indicates
2090
2171
  * that this transaction is part of a transaction group and the value is the
2091
2172
  * sha512/256 hash of the transactions in that group.
2173
+ * @param heartbeatTransaction - Fields for a heartbeat transaction.
2174
+ * Definition:
2175
+ * data/transactions/heartbeat.go : HeartbeatTxnFields
2092
2176
  * @param id - Transaction ID
2093
2177
  * @param innerTxns - Inner transactions produced by application execution.
2094
2178
  * @param intraRoundOffset - Offset into the round where this transaction was confirmed.
@@ -2128,8 +2212,9 @@ export declare class Transaction extends BaseModel {
2128
2212
  * * (afrz) asset-freeze-transaction
2129
2213
  * * (appl) application-transaction
2130
2214
  * * (stpf) state-proof-transaction
2215
+ * * (hb) heartbeat-transaction
2131
2216
  */
2132
- 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, }: {
2217
+ 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, }: {
2133
2218
  fee: number | bigint;
2134
2219
  firstValid: number | bigint;
2135
2220
  lastValid: number | bigint;
@@ -2148,6 +2233,7 @@ export declare class Transaction extends BaseModel {
2148
2233
  genesisId?: string;
2149
2234
  globalStateDelta?: EvalDeltaKeyValue[];
2150
2235
  group?: string | Uint8Array;
2236
+ heartbeatTransaction?: TransactionHeartbeat;
2151
2237
  id?: string;
2152
2238
  innerTxns?: Transaction[];
2153
2239
  intraRoundOffset?: number | bigint;
@@ -2419,6 +2505,53 @@ export declare class TransactionAssetTransfer extends BaseModel {
2419
2505
  });
2420
2506
  static from_obj_for_encoding(data: Record<string, any>): TransactionAssetTransfer;
2421
2507
  }
2508
+ /**
2509
+ * Fields for a heartbeat transaction.
2510
+ * Definition:
2511
+ * data/transactions/heartbeat.go : HeartbeatTxnFields
2512
+ */
2513
+ export declare class TransactionHeartbeat extends BaseModel {
2514
+ /**
2515
+ * (hbad) HbAddress is the account this txn is proving onlineness for.
2516
+ */
2517
+ hbAddress: string;
2518
+ /**
2519
+ * (hbkd) HbKeyDilution must match HbAddress account's current KeyDilution.
2520
+ */
2521
+ hbKeyDilution: number | bigint;
2522
+ /**
2523
+ * (hbprf) HbProof is a signature using HeartbeatAddress's partkey, thereby showing
2524
+ * it is online.
2525
+ */
2526
+ hbProof: HbProofFields;
2527
+ /**
2528
+ * (hbsd) HbSeed must be the block seed for the this transaction's firstValid
2529
+ * block.
2530
+ */
2531
+ hbSeed: Uint8Array;
2532
+ /**
2533
+ * (hbvid) HbVoteID must match the HbAddress account's current VoteID.
2534
+ */
2535
+ hbVoteId: Uint8Array;
2536
+ /**
2537
+ * Creates a new `TransactionHeartbeat` object.
2538
+ * @param hbAddress - (hbad) HbAddress is the account this txn is proving onlineness for.
2539
+ * @param hbKeyDilution - (hbkd) HbKeyDilution must match HbAddress account's current KeyDilution.
2540
+ * @param hbProof - (hbprf) HbProof is a signature using HeartbeatAddress's partkey, thereby showing
2541
+ * it is online.
2542
+ * @param hbSeed - (hbsd) HbSeed must be the block seed for the this transaction's firstValid
2543
+ * block.
2544
+ * @param hbVoteId - (hbvid) HbVoteID must match the HbAddress account's current VoteID.
2545
+ */
2546
+ constructor({ hbAddress, hbKeyDilution, hbProof, hbSeed, hbVoteId, }: {
2547
+ hbAddress: string;
2548
+ hbKeyDilution: number | bigint;
2549
+ hbProof: HbProofFields;
2550
+ hbSeed: string | Uint8Array;
2551
+ hbVoteId: string | Uint8Array;
2552
+ });
2553
+ static from_obj_for_encoding(data: Record<string, any>): TransactionHeartbeat;
2554
+ }
2422
2555
  /**
2423
2556
  * Fields for a keyreg transaction.
2424
2557
  * Definition:
@@ -0,0 +1,172 @@
1
+ import JSONRequest from '../jsonrequest';
2
+ /**
3
+ * Returns information about indexed block headers.
4
+ *
5
+ * #### Example
6
+ * ```typescript
7
+ * const bhs = await indexerClient.searchForBlockHeaders().do();
8
+ * ```
9
+ *
10
+ * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2block-headers)
11
+ * @category GET
12
+ */
13
+ export default class SearchForBlockHeaders extends JSONRequest {
14
+ /**
15
+ * @returns `/v2/block-headers`
16
+ */
17
+ path(): string;
18
+ /**
19
+ * Accounts marked as absent in the block header's participation updates.
20
+ *
21
+ * #### Example
22
+ * ```typescript
23
+ * const address1 = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
24
+ * const address2 = "4H5UNRBJ2Q6JENAXQ6HNTGKLKINP4J4VTQBEPK5F3I6RDICMZBPGNH6KD4";
25
+ * const bhs = await indexerClient
26
+ * .searchForBlockHeaders()
27
+ * .absent([address1,address2])
28
+ * .do();
29
+ * ```
30
+ *
31
+ * @param absent - a comma separated list of addresses
32
+ * @category query
33
+ */
34
+ absent(absent: string[]): this;
35
+ /**
36
+ * Include results after the given time.
37
+ *
38
+ * #### Example
39
+ * ```typescript
40
+ * const afterTime = "2022-10-21T00:00:11.55Z";
41
+ * const bhs = await indexerClient
42
+ * .searchForBlockHeaders()
43
+ * .afterTime(afterTime)
44
+ * .do();
45
+ * ```
46
+ *
47
+ * @param after - rfc3339 string
48
+ * @category query
49
+ */
50
+ afterTime(after: string): this;
51
+ /**
52
+ * Include results before the given time.
53
+ *
54
+ * #### Example
55
+ * ```typescript
56
+ * const beforeTime = "2022-02-02T20:20:22.02Z";
57
+ * const bhs = await indexerClient
58
+ * .searchForBlockHeaders()
59
+ * .beforeTime(beforeTime)
60
+ * .do();
61
+ * ```
62
+ *
63
+ * @param before - rfc3339 string
64
+ * @category query
65
+ */
66
+ beforeTime(before: string): this;
67
+ /**
68
+ * Accounts marked as expired in the block header's participation updates.
69
+ *
70
+ * #### Example
71
+ * ```typescript
72
+ * const address1 = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
73
+ * const address2 = "4H5UNRBJ2Q6JENAXQ6HNTGKLKINP4J4VTQBEPK5F3I6RDICMZBPGNH6KD4";
74
+ * const bhs = await indexerClient
75
+ * .searchForBlockHeaders()
76
+ * .expired([address1,address2])
77
+ * .do();
78
+ * ```
79
+ *
80
+ * @param expired - - a comma separated list of addresses
81
+ * @category query
82
+ */
83
+ expired(expired: string[]): this;
84
+ /**
85
+ * Maximum number of results to return.
86
+ *
87
+ * #### Example
88
+ * ```typescript
89
+ * const maxResults = 25;
90
+ * const bhs = await indexerClient
91
+ * .searchForBlockHeaders()
92
+ * .limit(maxResults)
93
+ * .do();
94
+ * ```
95
+ *
96
+ * @param limit
97
+ * @category query
98
+ */
99
+ limit(limit: number): this;
100
+ /**
101
+ * Include results at or before the specified max-round.
102
+ *
103
+ * #### Example
104
+ * ```typescript
105
+ * const maxRound = 18309917;
106
+ * const bhs = await indexerClient
107
+ * .searchForBlockHeaders()
108
+ * .maxRound(maxRound)
109
+ * .do();
110
+ * ```
111
+ *
112
+ * @param round
113
+ * @category query
114
+ */
115
+ maxRound(round: number): this;
116
+ /**
117
+ * Include results at or after the specified min-round.
118
+ *
119
+ * #### Example
120
+ * ```typescript
121
+ * const minRound = 18309917;
122
+ * const bhs = await indexerClient
123
+ * .searchForBlockHeaders()
124
+ * .minRound(minRound)
125
+ * .do();
126
+ * ```
127
+ *
128
+ * @param round
129
+ * @category query
130
+ */
131
+ minRound(round: number): this;
132
+ /**
133
+ * The next page of results.
134
+ *
135
+ * #### Example
136
+ * ```typescript
137
+ * const maxResults = 25;
138
+ *
139
+ * const bh1 = await indexerClient
140
+ * .searchForBlockHeaders()
141
+ * .limit(maxResults)
142
+ * .do();
143
+ *
144
+ * const bh2 = await indexerClient
145
+ * .searchForBlockHeaders()
146
+ * .limit(maxResults)
147
+ * .nextToken(bh1["next-token"])
148
+ * .do();
149
+ * ```
150
+ *
151
+ * @param nextToken - provided by the previous results
152
+ * @category query
153
+ */
154
+ nextToken(nextToken: string): this;
155
+ /**
156
+ * Accounts marked as proposer in the block header's participation updates.
157
+ *
158
+ * #### Example
159
+ * ```typescript
160
+ * const address1 = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
161
+ * const address2 = "4H5UNRBJ2Q6JENAXQ6HNTGKLKINP4J4VTQBEPK5F3I6RDICMZBPGNH6KD4";
162
+ * const bhs = await indexerClient
163
+ * .searchForBlockHeaders()
164
+ * .proposers([address1,address2])
165
+ * .do();
166
+ * ```
167
+ *
168
+ * @param proposers - a comma separated list of addresses
169
+ * @category query
170
+ */
171
+ proposers(proposers: string[]): this;
172
+ }
@@ -1,13 +1,39 @@
1
1
  /// <reference types="node" />
2
2
  import { OnApplicationComplete, TransactionParams, TransactionType, BoxReference } from './types/transactions/base';
3
- import AnyTransaction, { EncodedTransaction, EncodedMultisig, EncodedLogicSig } from './types/transactions';
3
+ import AnyTransaction, { EncodedTransaction, EncodedMultisig, EncodedLogicSig, EncodedHeartbeatFields, EncodedHeartbeatProof } from './types/transactions';
4
4
  import { Address } from './types/address';
5
5
  export declare const ALGORAND_MIN_TX_FEE = 1000;
6
+ /**
7
+ * Object representing a heartbeat proof
8
+ */
9
+ declare class HeartbeatProof {
10
+ s: Buffer;
11
+ p: Buffer;
12
+ p2: Buffer;
13
+ p1s: Buffer;
14
+ p2s: Buffer;
15
+ constructor(sig: Buffer, pk: Buffer, pk2: Buffer, p1s: Buffer, p2s: Buffer);
16
+ static from_obj_for_encoding(encHbFields: EncodedHeartbeatProof): HeartbeatProof;
17
+ get_obj_for_encoding(): EncodedHeartbeatProof;
18
+ }
19
+ /**
20
+ * Object representing a heartbeat transaction
21
+ */
22
+ declare class HeartbeatFields {
23
+ a: string | Address;
24
+ prf: HeartbeatProof;
25
+ sd: Buffer;
26
+ vid: Buffer;
27
+ kd: number;
28
+ constructor(addr: string | Address, proof: EncodedHeartbeatProof, seed: Buffer, voteID: Buffer, kd: number);
29
+ static from_obj_for_encoding(encHbFields: EncodedHeartbeatFields): HeartbeatFields;
30
+ get_obj_for_encoding(): EncodedHeartbeatFields;
31
+ }
6
32
  /**
7
33
  * A modified version of the transaction params. Represents the internal structure that the Transaction class uses
8
34
  * to store inputted transaction objects.
9
35
  */
10
- interface TransactionStorageStructure extends Omit<TransactionParams, 'from' | 'to' | 'genesisHash' | 'closeRemainderTo' | 'voteKey' | 'selectionKey' | 'stateProofKey' | 'assetManager' | 'assetReserve' | 'assetFreeze' | 'assetClawback' | 'assetRevocationTarget' | 'freezeAccount' | 'appAccounts' | 'suggestedParams' | 'reKeyTo'> {
36
+ interface TransactionStorageStructure extends Omit<TransactionParams, 'from' | 'to' | 'genesisHash' | 'closeRemainderTo' | 'voteKey' | 'selectionKey' | 'stateProofKey' | 'assetManager' | 'assetReserve' | 'assetFreeze' | 'assetClawback' | 'assetRevocationTarget' | 'freezeAccount' | 'appAccounts' | 'suggestedParams' | 'reKeyTo' | 'heartbeatFields'> {
11
37
  from: string | Address;
12
38
  to: string | Address;
13
39
  fee: number;
@@ -62,6 +88,7 @@ interface TransactionStorageStructure extends Omit<TransactionParams, 'from' | '
62
88
  stateProofType?: number | bigint;
63
89
  stateProof?: Uint8Array;
64
90
  stateProofMessage?: Uint8Array;
91
+ heartbeatFields?: HeartbeatFields;
65
92
  }
66
93
  /**
67
94
  * Transaction enables construction of Algorand transactions
@@ -123,6 +150,7 @@ export declare class Transaction implements TransactionStorageStructure {
123
150
  stateProofType?: number | bigint;
124
151
  stateProof?: Uint8Array;
125
152
  stateProofMessage?: Uint8Array;
153
+ heartbeatFields?: HeartbeatFields;
126
154
  constructor({ ...transaction }: AnyTransaction);
127
155
  get_obj_for_encoding(): EncodedTransaction;
128
156
  static from_obj_for_encoding(txnForEnc: EncodedTransaction): Transaction;
@@ -31,7 +31,11 @@ export declare enum TransactionType {
31
31
  /**
32
32
  * State proof transaction
33
33
  */
34
- stpf = "stpf"
34
+ stpf = "stpf",
35
+ /**
36
+ * Heartbeat transaction
37
+ */
38
+ hb = "hb"
35
39
  }
36
40
  export declare function isTransactionType(s: string): s is TransactionType;
37
41
  /**
@@ -120,6 +124,13 @@ export interface BoxReference {
120
124
  */
121
125
  name: Uint8Array;
122
126
  }
127
+ interface heartbeatFields {
128
+ a: string;
129
+ prf: Uint8Array;
130
+ sd: Uint8Array;
131
+ vid: Uint8Array;
132
+ kd: number;
133
+ }
123
134
  /**
124
135
  * A full list of all available transaction parameters
125
136
  *
@@ -345,4 +356,9 @@ export interface TransactionParams {
345
356
  * Byte array containing the state proof message.
346
357
  */
347
358
  stateProofMessage?: Uint8Array;
359
+ /**
360
+ * HeartbeatFields fields
361
+ */
362
+ heartbeatFields?: heartbeatFields;
348
363
  }
364
+ export {};
@@ -78,6 +78,56 @@ export interface EncodedBoxReference {
78
78
  */
79
79
  n: Uint8Array;
80
80
  }
81
+ /**
82
+ * A structure for an encoded heartbeat proof fields object
83
+ */
84
+ export interface EncodedHeartbeatProof {
85
+ /**
86
+ * Sig
87
+ */
88
+ s: Buffer;
89
+ /**
90
+ * PK
91
+ */
92
+ p: Buffer;
93
+ /**
94
+ * PK2
95
+ */
96
+ p2: Buffer;
97
+ /**
98
+ * PK1Sig
99
+ */
100
+ p1s: Buffer;
101
+ /**
102
+ * PK2Sig
103
+ */
104
+ p2s: Buffer;
105
+ }
106
+ /**
107
+ * A structure for an encoded heartbeat fields object
108
+ */
109
+ export interface EncodedHeartbeatFields {
110
+ /**
111
+ * HbAddress
112
+ */
113
+ a: Buffer;
114
+ /**
115
+ * HbProof
116
+ */
117
+ prf: EncodedHeartbeatProof;
118
+ /**
119
+ * HbSeed
120
+ */
121
+ sd: Buffer;
122
+ /**
123
+ * HbVoteID
124
+ */
125
+ vid: Buffer;
126
+ /**
127
+ * HbKeyDilution
128
+ */
129
+ kd: number;
130
+ }
81
131
  /**
82
132
  * A rough structure for the encoded transaction object. Every property is labelled with its associated Transaction type property
83
133
  */
@@ -263,6 +313,10 @@ export interface EncodedTransaction {
263
313
  * stateProofMessage
264
314
  */
265
315
  spmsg?: Buffer;
316
+ /**
317
+ * heartbeat fields
318
+ */
319
+ hb?: EncodedHeartbeatFields;
266
320
  }
267
321
  export interface EncodedSubsig {
268
322
  /**
@@ -0,0 +1,8 @@
1
+ import { TransactionType, TransactionParams } from './base';
2
+ import { ConstructTransaction } from './builder';
3
+ declare type SpecificParameters = Pick<TransactionParams, 'heartbeatFields'>;
4
+ interface Overwrites {
5
+ type?: TransactionType.hb;
6
+ }
7
+ declare type HeartbeatTransaction = ConstructTransaction<SpecificParameters, Overwrites>;
8
+ export default HeartbeatTransaction;
@@ -3,6 +3,7 @@ import KeyRegistrationTxn from './keyreg';
3
3
  import { AssetCreateTransaction as AssetCreateTxn, AssetConfigurationTransaction as AssetConfigTxn, AssetDestroyTransaction as AssetDestroyTxn, AssetFreezeTransaction as AssetFreezeTxn, AssetTransferTransaction as AssetTransferTxn } from './asset';
4
4
  import { ApplicationCreateTransaction as AppCreateTxn, ApplicationUpdateTransaction as AppUpdateTxn, ApplicationDeleteTransaction as AppDeleteTxn, ApplicationOptInTransaction as AppOptInTxn, ApplicationCloseOutTransaction as AppCloseOutTxn, ApplicationClearStateTransaction as AppClearStateTxn, ApplicationNoOpTransaction as AppNoOpTxn } from './application';
5
5
  import StateProofTxn from './stateproof';
6
+ import HeartbeatTxn from './heartbeat';
6
7
  export { TransactionParams, TransactionType, SuggestedParams, BoxReference, } from './base';
7
8
  export { MustHaveSuggestedParams, MustHaveSuggestedParamsInline, } from './builder';
8
9
  export * from './encoded';
@@ -11,5 +12,6 @@ export { default as KeyRegistrationTxn } from './keyreg';
11
12
  export { AssetCreateTransaction as AssetCreateTxn, AssetConfigurationTransaction as AssetConfigTxn, AssetDestroyTransaction as AssetDestroyTxn, AssetFreezeTransaction as AssetFreezeTxn, AssetTransferTransaction as AssetTransferTxn, } from './asset';
12
13
  export { ApplicationCreateTransaction as AppCreateTxn, ApplicationUpdateTransaction as AppUpdateTxn, ApplicationDeleteTransaction as AppDeleteTxn, ApplicationOptInTransaction as AppOptInTxn, ApplicationCloseOutTransaction as AppCloseOutTxn, ApplicationClearStateTransaction as AppClearStateTxn, ApplicationNoOpTransaction as AppNoOpTxn, } from './application';
13
14
  export { default as StateProofTxn } from './stateproof';
14
- declare type AnyTransaction = PaymentTxn | KeyRegistrationTxn | AssetCreateTxn | AssetConfigTxn | AssetDestroyTxn | AssetFreezeTxn | AssetTransferTxn | AppCreateTxn | AppUpdateTxn | AppDeleteTxn | AppOptInTxn | AppCloseOutTxn | AppClearStateTxn | AppNoOpTxn | StateProofTxn;
15
+ export { default as HeartbeatTransaction } from './heartbeat';
16
+ declare type AnyTransaction = PaymentTxn | KeyRegistrationTxn | AssetCreateTxn | AssetConfigTxn | AssetDestroyTxn | AssetFreezeTxn | AssetTransferTxn | AppCreateTxn | AppUpdateTxn | AppDeleteTxn | AppOptInTxn | AppCloseOutTxn | AppClearStateTxn | AppNoOpTxn | StateProofTxn | HeartbeatTxn;
15
17
  export default AnyTransaction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "algosdk",
3
- "version": "2.9.0",
3
+ "version": "2.11.0",
4
4
  "description": "The official JavaScript SDK for Algorand",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -20,6 +20,28 @@ export default class Block extends JSONRequest {
20
20
  return `/v2/blocks/${this.round}`;
21
21
  }
22
22
 
23
+ /**
24
+ * If true, only the block header (exclusive of payset or certificate) may be included in response.
25
+ *
26
+ * #### Example
27
+ * ```typescript
28
+ *
29
+ * const roundNumber = 41000000;
30
+ *
31
+ * const blockResponse = await algodClient
32
+ * .block(roundNumber)
33
+ * .headerOnly(true)
34
+ * .do();
35
+ * ```
36
+ *
37
+ * @param headerOnly - the flag indicating whether exclusively return header in response
38
+ * @category query
39
+ */
40
+ headerOnly(headerOnly: boolean) {
41
+ this.query['header-only'] = headerOnly;
42
+ return this;
43
+ }
44
+
23
45
  // eslint-disable-next-line class-methods-use-this
24
46
  prepare(body: Uint8Array) {
25
47
  if (body && body.byteLength > 0) {
@@ -15,6 +15,7 @@ import LookupApplications from './lookupApplications';
15
15
  import LookupApplicationLogs from './lookupApplicationLogs';
16
16
  import LookupApplicationBoxByIDandName from './lookupApplicationBoxByIDandName';
17
17
  import SearchAccounts from './searchAccounts';
18
+ import SearchForBlockHeaders from './searchForBlockHeaders';
18
19
  import SearchForTransactions from './searchForTransactions';
19
20
  import SearchForAssets from './searchForAssets';
20
21
  import SearchForApplications from './searchForApplications';
@@ -345,6 +346,21 @@ export default class IndexerClient extends ServiceClient {
345
346
  return new SearchForTransactions(this.c, this.intDecoding);
346
347
  }
347
348
 
349
+ /**
350
+ * Returns information about indexed block headers.
351
+ *
352
+ * #### Example
353
+ * ```typescript
354
+ * const txns = await indexerClient.searchForBlockHeaders().do();
355
+ * ```
356
+ *
357
+ * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2block-headers)
358
+ * @category GET
359
+ */
360
+ searchForBlockHeaders() {
361
+ return new SearchForBlockHeaders(this.c, this.intDecoding);
362
+ }
363
+
348
364
  /**
349
365
  * Returns information about indexed assets.
350
366
  *