algosdk 2.8.0 → 2.10.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 (64) 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/abi/contract.js +2 -0
  5. package/dist/cjs/abi/contract.js.map +1 -1
  6. package/dist/cjs/abi/event.js +3 -0
  7. package/dist/cjs/abi/event.js.map +1 -0
  8. package/dist/cjs/abi/method.js +4 -0
  9. package/dist/cjs/abi/method.js.map +1 -1
  10. package/dist/cjs/client/v2/algod/models/types.js +45 -5
  11. package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
  12. package/dist/cjs/client/v2/indexer/models/types.js +168 -3
  13. package/dist/cjs/client/v2/indexer/models/types.js.map +1 -1
  14. package/dist/cjs/makeTxn.js +26 -0
  15. package/dist/cjs/makeTxn.js.map +1 -1
  16. package/dist/cjs/transaction.js +102 -0
  17. package/dist/cjs/transaction.js.map +1 -1
  18. package/dist/cjs/types/transactions/base.js +6 -1
  19. package/dist/cjs/types/transactions/base.js.map +1 -1
  20. package/dist/cjs/types/transactions/heartbeat.js +3 -0
  21. package/dist/cjs/types/transactions/heartbeat.js.map +1 -0
  22. package/dist/cjs/types/transactions/index.js.map +1 -1
  23. package/dist/esm/abi/contract.js +2 -0
  24. package/dist/esm/abi/contract.js.map +1 -1
  25. package/dist/esm/abi/event.js +2 -0
  26. package/dist/esm/abi/event.js.map +1 -0
  27. package/dist/esm/abi/method.js +4 -0
  28. package/dist/esm/abi/method.js.map +1 -1
  29. package/dist/esm/client/v2/algod/models/types.js +42 -3
  30. package/dist/esm/client/v2/algod/models/types.js.map +1 -1
  31. package/dist/esm/client/v2/indexer/models/types.js +163 -1
  32. package/dist/esm/client/v2/indexer/models/types.js.map +1 -1
  33. package/dist/esm/makeTxn.js +26 -0
  34. package/dist/esm/makeTxn.js.map +1 -1
  35. package/dist/esm/transaction.js +102 -0
  36. package/dist/esm/transaction.js.map +1 -1
  37. package/dist/esm/types/transactions/base.js +6 -1
  38. package/dist/esm/types/transactions/base.js.map +1 -1
  39. package/dist/esm/types/transactions/heartbeat.js +2 -0
  40. package/dist/esm/types/transactions/heartbeat.js.map +1 -0
  41. package/dist/esm/types/transactions/index.js.map +1 -1
  42. package/dist/types/abi/contract.d.ts +4 -0
  43. package/dist/types/abi/event.d.ts +16 -0
  44. package/dist/types/abi/method.d.ts +7 -0
  45. package/dist/types/client/v2/algod/models/types.d.ts +44 -3
  46. package/dist/types/client/v2/indexer/models/types.d.ts +134 -1
  47. package/dist/types/makeTxn.d.ts +28 -0
  48. package/dist/types/transaction.d.ts +30 -2
  49. package/dist/types/types/transactions/base.d.ts +17 -1
  50. package/dist/types/types/transactions/encoded.d.ts +54 -0
  51. package/dist/types/types/transactions/heartbeat.d.ts +8 -0
  52. package/dist/types/types/transactions/index.d.ts +3 -1
  53. package/package.json +1 -1
  54. package/src/abi/contract.ts +6 -0
  55. package/src/abi/event.ts +16 -0
  56. package/src/abi/method.ts +12 -0
  57. package/src/client/v2/algod/models/types.ts +71 -0
  58. package/src/client/v2/indexer/models/types.ts +294 -0
  59. package/src/makeTxn.ts +28 -0
  60. package/src/transaction.ts +131 -0
  61. package/src/types/transactions/base.ts +20 -1
  62. package/src/types/transactions/encoded.ts +65 -0
  63. package/src/types/transactions/heartbeat.ts +14 -0
  64. package/src/types/transactions/index.ts +4 -1
@@ -1,4 +1,5 @@
1
1
  import { ABIMethod, ABIMethodParams, getMethodByName } from './method';
2
+ import { ARC28Event } from './event';
2
3
 
3
4
  export interface ABIContractNetworkInfo {
4
5
  appID: number;
@@ -13,6 +14,7 @@ export interface ABIContractParams {
13
14
  desc?: string;
14
15
  networks?: ABIContractNetworks;
15
16
  methods: ABIMethodParams[];
17
+ events?: ARC28Event[];
16
18
  }
17
19
 
18
20
  export class ABIContract {
@@ -20,6 +22,8 @@ export class ABIContract {
20
22
  public readonly description?: string;
21
23
  public readonly networks: ABIContractNetworks;
22
24
  public readonly methods: ABIMethod[];
25
+ /** [ARC-28](https://arc.algorand.foundation/ARCs/arc-0028) events that MAY be emitted by this contract */
26
+ public readonly events?: ARC28Event[];
23
27
 
24
28
  constructor(params: ABIContractParams) {
25
29
  if (
@@ -34,6 +38,7 @@ export class ABIContract {
34
38
  this.description = params.desc;
35
39
  this.networks = params.networks ? { ...params.networks } : {};
36
40
  this.methods = params.methods.map((method) => new ABIMethod(method));
41
+ this.events = params.events;
37
42
  }
38
43
 
39
44
  toJSON(): ABIContractParams {
@@ -42,6 +47,7 @@ export class ABIContract {
42
47
  desc: this.description,
43
48
  networks: this.networks,
44
49
  methods: this.methods.map((method) => method.toJSON()),
50
+ events: this.events,
45
51
  };
46
52
  }
47
53
 
@@ -0,0 +1,16 @@
1
+ /** [ARC-28](https://arc.algorand.foundation/ARCs/arc-0028) event description */
2
+ export interface ARC28Event {
3
+ /** The name of the event */
4
+ name: string;
5
+ /** Optional, user-friendly description for the event */
6
+ desc?: string;
7
+ /** The arguments of the event, in order */
8
+ args: Array<{
9
+ /** The type of the argument */
10
+ type: string;
11
+ /** Optional, user-friendly name for the argument */
12
+ name?: string;
13
+ /** Optional, user-friendly description for the argument */
14
+ desc?: string;
15
+ }>;
16
+ }
package/src/abi/method.ts CHANGED
@@ -2,6 +2,7 @@ import { genericHash } from '../nacl/naclWrappers';
2
2
  import { ABIType, ABITupleType } from './abi_type';
3
3
  import { ABITransactionType, abiTypeIsTransaction } from './transaction';
4
4
  import { ABIReferenceType, abiTypeIsReference } from './reference';
5
+ import { ARC28Event } from './event';
5
6
 
6
7
  function parseMethodSignature(
7
8
  signature: string
@@ -61,6 +62,10 @@ export interface ABIMethodParams {
61
62
  desc?: string;
62
63
  args: ABIMethodArgParams[];
63
64
  returns: ABIMethodReturnParams;
65
+ /** Optional, is it a read-only method (according to [ARC-22](https://arc.algorand.foundation/ARCs/arc-0022)) */
66
+ readonly?: boolean;
67
+ /** [ARC-28](https://arc.algorand.foundation/ARCs/arc-0028) events that MAY be emitted by this method */
68
+ events?: ARC28Event[];
64
69
  }
65
70
 
66
71
  export type ABIArgumentType = ABIType | ABITransactionType | ABIReferenceType;
@@ -77,6 +82,8 @@ export class ABIMethod {
77
82
  }>;
78
83
 
79
84
  public readonly returns: { type: ABIReturnType; description?: string };
85
+ public readonly events?: ARC28Event[];
86
+ public readonly readonly?: boolean;
80
87
 
81
88
  constructor(params: ABIMethodParams) {
82
89
  if (
@@ -111,6 +118,9 @@ export class ABIMethod {
111
118
  : ABIType.from(params.returns.type),
112
119
  description: params.returns.desc,
113
120
  };
121
+
122
+ this.events = params.events;
123
+ this.readonly = params.readonly;
114
124
  }
115
125
 
116
126
  getSignature(): string {
@@ -147,6 +157,8 @@ export class ABIMethod {
147
157
  type: this.returns.type.toString(),
148
158
  desc: this.returns.description,
149
159
  },
160
+ events: this.events,
161
+ readonly: this.readonly,
150
162
  };
151
163
  }
152
164
 
@@ -2098,6 +2098,38 @@ export class BlockHashResponse extends BaseModel {
2098
2098
  }
2099
2099
  }
2100
2100
 
2101
+ /**
2102
+ * Block header.
2103
+ */
2104
+ export class BlockHeaderResponse extends BaseModel {
2105
+ /**
2106
+ * Block header data.
2107
+ */
2108
+ public blockheader?: BlockHeader;
2109
+
2110
+ /**
2111
+ * Creates a new `BlockHeaderResponse` object.
2112
+ * @param blockheader - Block header data.
2113
+ */
2114
+ constructor({ blockheader }: { blockheader?: BlockHeader }) {
2115
+ super();
2116
+ this.blockheader = blockheader;
2117
+
2118
+ this.attribute_map = {
2119
+ blockheader: 'blockHeader',
2120
+ };
2121
+ }
2122
+
2123
+ // eslint-disable-next-line camelcase
2124
+ static from_obj_for_encoding(data: Record<string, any>): BlockHeaderResponse {
2125
+ /* eslint-disable dot-notation */
2126
+ return new BlockHeaderResponse({
2127
+ blockheader: data['blockHeader'],
2128
+ });
2129
+ /* eslint-enable dot-notation */
2130
+ }
2131
+ }
2132
+
2101
2133
  /**
2102
2134
  * All logs emitted in the given round. Each app call, whether top-level or inner,
2103
2135
  * that contains logs results in a separate AppCallLogs object. Therefore there may
@@ -4284,6 +4316,12 @@ export class SimulateRequest extends BaseModel {
4284
4316
  */
4285
4317
  public extraOpcodeBudget?: number | bigint;
4286
4318
 
4319
+ /**
4320
+ * If true, signers for transactions that are missing signatures will be fixed
4321
+ * during evaluation.
4322
+ */
4323
+ public fixSigners?: boolean;
4324
+
4287
4325
  /**
4288
4326
  * If provided, specifies the round preceding the simulation. State changes through
4289
4327
  * this round will be used to run this simulation. Usually only the 4 most recent
@@ -4301,6 +4339,8 @@ export class SimulateRequest extends BaseModel {
4301
4339
  * @param allowUnnamedResources - Allows access to unnamed resources during simulation.
4302
4340
  * @param execTraceConfig - An object that configures simulation execution trace.
4303
4341
  * @param extraOpcodeBudget - Applies extra opcode budget during simulation for each transaction group.
4342
+ * @param fixSigners - If true, signers for transactions that are missing signatures will be fixed
4343
+ * during evaluation.
4304
4344
  * @param round - If provided, specifies the round preceding the simulation. State changes through
4305
4345
  * this round will be used to run this simulation. Usually only the 4 most recent
4306
4346
  * rounds will be available (controlled by the node config value MaxAcctLookback).
@@ -4313,6 +4353,7 @@ export class SimulateRequest extends BaseModel {
4313
4353
  allowUnnamedResources,
4314
4354
  execTraceConfig,
4315
4355
  extraOpcodeBudget,
4356
+ fixSigners,
4316
4357
  round,
4317
4358
  }: {
4318
4359
  txnGroups: SimulateRequestTransactionGroup[];
@@ -4321,6 +4362,7 @@ export class SimulateRequest extends BaseModel {
4321
4362
  allowUnnamedResources?: boolean;
4322
4363
  execTraceConfig?: SimulateTraceConfig;
4323
4364
  extraOpcodeBudget?: number | bigint;
4365
+ fixSigners?: boolean;
4324
4366
  round?: number | bigint;
4325
4367
  }) {
4326
4368
  super();
@@ -4330,6 +4372,7 @@ export class SimulateRequest extends BaseModel {
4330
4372
  this.allowUnnamedResources = allowUnnamedResources;
4331
4373
  this.execTraceConfig = execTraceConfig;
4332
4374
  this.extraOpcodeBudget = extraOpcodeBudget;
4375
+ this.fixSigners = fixSigners;
4333
4376
  this.round = round;
4334
4377
 
4335
4378
  this.attribute_map = {
@@ -4339,6 +4382,7 @@ export class SimulateRequest extends BaseModel {
4339
4382
  allowUnnamedResources: 'allow-unnamed-resources',
4340
4383
  execTraceConfig: 'exec-trace-config',
4341
4384
  extraOpcodeBudget: 'extra-opcode-budget',
4385
+ fixSigners: 'fix-signers',
4342
4386
  round: 'round',
4343
4387
  };
4344
4388
  }
@@ -4362,6 +4406,7 @@ export class SimulateRequest extends BaseModel {
4362
4406
  ? SimulateTraceConfig.from_obj_for_encoding(data['exec-trace-config'])
4363
4407
  : undefined,
4364
4408
  extraOpcodeBudget: data['extra-opcode-budget'],
4409
+ fixSigners: data['fix-signers'],
4365
4410
  round: data['round'],
4366
4411
  });
4367
4412
  /* eslint-enable dot-notation */
@@ -4751,6 +4796,12 @@ export class SimulateTransactionResult extends BaseModel {
4751
4796
  */
4752
4797
  public execTrace?: SimulationTransactionExecTrace;
4753
4798
 
4799
+ /**
4800
+ * The account that needed to sign this transaction when no signature was provided
4801
+ * and the provided signer was incorrect.
4802
+ */
4803
+ public fixedSigner?: string;
4804
+
4754
4805
  /**
4755
4806
  * Budget used during execution of a logic sig transaction.
4756
4807
  */
@@ -4777,6 +4828,8 @@ export class SimulateTransactionResult extends BaseModel {
4777
4828
  * budged used by inner app calls spawned by this transaction.
4778
4829
  * @param execTrace - The execution trace of calling an app or a logic sig, containing the inner app
4779
4830
  * call trace in a recursive way.
4831
+ * @param fixedSigner - The account that needed to sign this transaction when no signature was provided
4832
+ * and the provided signer was incorrect.
4780
4833
  * @param logicSigBudgetConsumed - Budget used during execution of a logic sig transaction.
4781
4834
  * @param unnamedResourcesAccessed - These are resources that were accessed by this group that would normally have
4782
4835
  * caused failure, but were allowed in simulation. Depending on where this object
@@ -4792,12 +4845,14 @@ export class SimulateTransactionResult extends BaseModel {
4792
4845
  txnResult,
4793
4846
  appBudgetConsumed,
4794
4847
  execTrace,
4848
+ fixedSigner,
4795
4849
  logicSigBudgetConsumed,
4796
4850
  unnamedResourcesAccessed,
4797
4851
  }: {
4798
4852
  txnResult: PendingTransactionResponse;
4799
4853
  appBudgetConsumed?: number | bigint;
4800
4854
  execTrace?: SimulationTransactionExecTrace;
4855
+ fixedSigner?: string;
4801
4856
  logicSigBudgetConsumed?: number | bigint;
4802
4857
  unnamedResourcesAccessed?: SimulateUnnamedResourcesAccessed;
4803
4858
  }) {
@@ -4805,6 +4860,7 @@ export class SimulateTransactionResult extends BaseModel {
4805
4860
  this.txnResult = txnResult;
4806
4861
  this.appBudgetConsumed = appBudgetConsumed;
4807
4862
  this.execTrace = execTrace;
4863
+ this.fixedSigner = fixedSigner;
4808
4864
  this.logicSigBudgetConsumed = logicSigBudgetConsumed;
4809
4865
  this.unnamedResourcesAccessed = unnamedResourcesAccessed;
4810
4866
 
@@ -4812,6 +4868,7 @@ export class SimulateTransactionResult extends BaseModel {
4812
4868
  txnResult: 'txn-result',
4813
4869
  appBudgetConsumed: 'app-budget-consumed',
4814
4870
  execTrace: 'exec-trace',
4871
+ fixedSigner: 'fixed-signer',
4815
4872
  logicSigBudgetConsumed: 'logic-sig-budget-consumed',
4816
4873
  unnamedResourcesAccessed: 'unnamed-resources-accessed',
4817
4874
  };
@@ -4837,6 +4894,7 @@ export class SimulateTransactionResult extends BaseModel {
4837
4894
  data['exec-trace']
4838
4895
  )
4839
4896
  : undefined,
4897
+ fixedSigner: data['fixed-signer'],
4840
4898
  logicSigBudgetConsumed: data['logic-sig-budget-consumed'],
4841
4899
  unnamedResourcesAccessed:
4842
4900
  typeof data['unnamed-resources-accessed'] !== 'undefined'
@@ -5006,6 +5064,12 @@ export class SimulationEvalOverrides extends BaseModel {
5006
5064
  */
5007
5065
  public extraOpcodeBudget?: number | bigint;
5008
5066
 
5067
+ /**
5068
+ * If true, signers for transactions that are missing signatures will be fixed
5069
+ * during evaluation.
5070
+ */
5071
+ public fixSigners?: boolean;
5072
+
5009
5073
  /**
5010
5074
  * The maximum log calls one can make during simulation
5011
5075
  */
@@ -5022,6 +5086,8 @@ export class SimulationEvalOverrides extends BaseModel {
5022
5086
  * were properly signed.
5023
5087
  * @param allowUnnamedResources - If true, allows access to unnamed resources during simulation.
5024
5088
  * @param extraOpcodeBudget - The extra opcode budget added to each transaction group during simulation
5089
+ * @param fixSigners - If true, signers for transactions that are missing signatures will be fixed
5090
+ * during evaluation.
5025
5091
  * @param maxLogCalls - The maximum log calls one can make during simulation
5026
5092
  * @param maxLogSize - The maximum byte number to log during simulation
5027
5093
  */
@@ -5029,12 +5095,14 @@ export class SimulationEvalOverrides extends BaseModel {
5029
5095
  allowEmptySignatures,
5030
5096
  allowUnnamedResources,
5031
5097
  extraOpcodeBudget,
5098
+ fixSigners,
5032
5099
  maxLogCalls,
5033
5100
  maxLogSize,
5034
5101
  }: {
5035
5102
  allowEmptySignatures?: boolean;
5036
5103
  allowUnnamedResources?: boolean;
5037
5104
  extraOpcodeBudget?: number | bigint;
5105
+ fixSigners?: boolean;
5038
5106
  maxLogCalls?: number | bigint;
5039
5107
  maxLogSize?: number | bigint;
5040
5108
  }) {
@@ -5042,6 +5110,7 @@ export class SimulationEvalOverrides extends BaseModel {
5042
5110
  this.allowEmptySignatures = allowEmptySignatures;
5043
5111
  this.allowUnnamedResources = allowUnnamedResources;
5044
5112
  this.extraOpcodeBudget = extraOpcodeBudget;
5113
+ this.fixSigners = fixSigners;
5045
5114
  this.maxLogCalls = maxLogCalls;
5046
5115
  this.maxLogSize = maxLogSize;
5047
5116
 
@@ -5049,6 +5118,7 @@ export class SimulationEvalOverrides extends BaseModel {
5049
5118
  allowEmptySignatures: 'allow-empty-signatures',
5050
5119
  allowUnnamedResources: 'allow-unnamed-resources',
5051
5120
  extraOpcodeBudget: 'extra-opcode-budget',
5121
+ fixSigners: 'fix-signers',
5052
5122
  maxLogCalls: 'max-log-calls',
5053
5123
  maxLogSize: 'max-log-size',
5054
5124
  };
@@ -5063,6 +5133,7 @@ export class SimulationEvalOverrides extends BaseModel {
5063
5133
  allowEmptySignatures: data['allow-empty-signatures'],
5064
5134
  allowUnnamedResources: data['allow-unnamed-resources'],
5065
5135
  extraOpcodeBudget: data['extra-opcode-budget'],
5136
+ fixSigners: data['fix-signers'],
5066
5137
  maxLogCalls: data['max-log-calls'],
5067
5138
  maxLogSize: data['max-log-size'],
5068
5139
  });
@@ -2467,6 +2467,68 @@ export class Block extends BaseModel {
2467
2467
  }
2468
2468
  }
2469
2469
 
2470
+ /**
2471
+ *
2472
+ */
2473
+ export class BlockHeadersResponse extends BaseModel {
2474
+ public blocks?: Block[];
2475
+
2476
+ /**
2477
+ * Round at which the results were computed.
2478
+ */
2479
+ public currentRound?: number | bigint;
2480
+
2481
+ /**
2482
+ * Used for pagination, when making another request provide this token with the
2483
+ * next parameter.
2484
+ */
2485
+ public nextToken?: string;
2486
+
2487
+ /**
2488
+ * Creates a new `BlockHeadersResponse` object.
2489
+ * @param blocks -
2490
+ * @param currentRound - Round at which the results were computed.
2491
+ * @param nextToken - Used for pagination, when making another request provide this token with the
2492
+ * next parameter.
2493
+ */
2494
+ constructor({
2495
+ blocks,
2496
+ currentRound,
2497
+ nextToken,
2498
+ }: {
2499
+ blocks?: Block[];
2500
+ currentRound?: number | bigint;
2501
+ nextToken?: string;
2502
+ }) {
2503
+ super();
2504
+ this.blocks = blocks;
2505
+ this.currentRound = currentRound;
2506
+ this.nextToken = nextToken;
2507
+
2508
+ this.attribute_map = {
2509
+ blocks: 'blocks',
2510
+ currentRound: 'current-round',
2511
+ nextToken: 'next-token',
2512
+ };
2513
+ }
2514
+
2515
+ // eslint-disable-next-line camelcase
2516
+ static from_obj_for_encoding(
2517
+ data: Record<string, any>
2518
+ ): BlockHeadersResponse {
2519
+ /* eslint-disable dot-notation */
2520
+ return new BlockHeadersResponse({
2521
+ blocks:
2522
+ typeof data['blocks'] !== 'undefined'
2523
+ ? data['blocks'].map(Block.from_obj_for_encoding)
2524
+ : undefined,
2525
+ currentRound: data['current-round'],
2526
+ nextToken: data['next-token'],
2527
+ });
2528
+ /* eslint-enable dot-notation */
2529
+ }
2530
+ }
2531
+
2470
2532
  /**
2471
2533
  * Fields relating to rewards,
2472
2534
  */
@@ -3080,6 +3142,106 @@ export class HashFactory extends BaseModel {
3080
3142
  }
3081
3143
  }
3082
3144
 
3145
+ /**
3146
+ * (hbprf) HbProof is a signature using HeartbeatAddress's partkey, thereby showing
3147
+ * it is online.
3148
+ */
3149
+ export class HbProofFields extends BaseModel {
3150
+ /**
3151
+ * (p) Public key of the heartbeat message.
3152
+ */
3153
+ public hbPk?: Uint8Array;
3154
+
3155
+ /**
3156
+ * (p1s) Signature of OneTimeSignatureSubkeyOffsetID(PK, Batch, Offset) under the
3157
+ * key PK2.
3158
+ */
3159
+ public hbPk1sig?: Uint8Array;
3160
+
3161
+ /**
3162
+ * (p2) Key for new-style two-level ephemeral signature.
3163
+ */
3164
+ public hbPk2?: Uint8Array;
3165
+
3166
+ /**
3167
+ * (p2s) Signature of OneTimeSignatureSubkeyBatchID(PK2, Batch) under the master
3168
+ * key (OneTimeSignatureVerifier).
3169
+ */
3170
+ public hbPk2sig?: Uint8Array;
3171
+
3172
+ /**
3173
+ * (s) Signature of the heartbeat message.
3174
+ */
3175
+ public hbSig?: Uint8Array;
3176
+
3177
+ /**
3178
+ * Creates a new `HbProofFields` object.
3179
+ * @param hbPk - (p) Public key of the heartbeat message.
3180
+ * @param hbPk1sig - (p1s) Signature of OneTimeSignatureSubkeyOffsetID(PK, Batch, Offset) under the
3181
+ * key PK2.
3182
+ * @param hbPk2 - (p2) Key for new-style two-level ephemeral signature.
3183
+ * @param hbPk2sig - (p2s) Signature of OneTimeSignatureSubkeyBatchID(PK2, Batch) under the master
3184
+ * key (OneTimeSignatureVerifier).
3185
+ * @param hbSig - (s) Signature of the heartbeat message.
3186
+ */
3187
+ constructor({
3188
+ hbPk,
3189
+ hbPk1sig,
3190
+ hbPk2,
3191
+ hbPk2sig,
3192
+ hbSig,
3193
+ }: {
3194
+ hbPk?: string | Uint8Array;
3195
+ hbPk1sig?: string | Uint8Array;
3196
+ hbPk2?: string | Uint8Array;
3197
+ hbPk2sig?: string | Uint8Array;
3198
+ hbSig?: string | Uint8Array;
3199
+ }) {
3200
+ super();
3201
+ this.hbPk =
3202
+ typeof hbPk === 'string'
3203
+ ? new Uint8Array(Buffer.from(hbPk, 'base64'))
3204
+ : hbPk;
3205
+ this.hbPk1sig =
3206
+ typeof hbPk1sig === 'string'
3207
+ ? new Uint8Array(Buffer.from(hbPk1sig, 'base64'))
3208
+ : hbPk1sig;
3209
+ this.hbPk2 =
3210
+ typeof hbPk2 === 'string'
3211
+ ? new Uint8Array(Buffer.from(hbPk2, 'base64'))
3212
+ : hbPk2;
3213
+ this.hbPk2sig =
3214
+ typeof hbPk2sig === 'string'
3215
+ ? new Uint8Array(Buffer.from(hbPk2sig, 'base64'))
3216
+ : hbPk2sig;
3217
+ this.hbSig =
3218
+ typeof hbSig === 'string'
3219
+ ? new Uint8Array(Buffer.from(hbSig, 'base64'))
3220
+ : hbSig;
3221
+
3222
+ this.attribute_map = {
3223
+ hbPk: 'hb-pk',
3224
+ hbPk1sig: 'hb-pk1sig',
3225
+ hbPk2: 'hb-pk2',
3226
+ hbPk2sig: 'hb-pk2sig',
3227
+ hbSig: 'hb-sig',
3228
+ };
3229
+ }
3230
+
3231
+ // eslint-disable-next-line camelcase
3232
+ static from_obj_for_encoding(data: Record<string, any>): HbProofFields {
3233
+ /* eslint-disable dot-notation */
3234
+ return new HbProofFields({
3235
+ hbPk: data['hb-pk'],
3236
+ hbPk1sig: data['hb-pk1sig'],
3237
+ hbPk2: data['hb-pk2'],
3238
+ hbPk2sig: data['hb-pk2sig'],
3239
+ hbSig: data['hb-sig'],
3240
+ });
3241
+ /* eslint-enable dot-notation */
3242
+ }
3243
+ }
3244
+
3083
3245
  /**
3084
3246
  * A health check response.
3085
3247
  */
@@ -4195,6 +4357,13 @@ export class Transaction extends BaseModel {
4195
4357
  */
4196
4358
  public group?: Uint8Array;
4197
4359
 
4360
+ /**
4361
+ * Fields for a heartbeat transaction.
4362
+ * Definition:
4363
+ * data/transactions/heartbeat.go : HeartbeatTxnFields
4364
+ */
4365
+ public heartbeatTransaction?: TransactionHeartbeat;
4366
+
4198
4367
  /**
4199
4368
  * Transaction ID
4200
4369
  */
@@ -4295,6 +4464,7 @@ export class Transaction extends BaseModel {
4295
4464
  * * (afrz) asset-freeze-transaction
4296
4465
  * * (appl) application-transaction
4297
4466
  * * (stpf) state-proof-transaction
4467
+ * * (hb) heartbeat-transaction
4298
4468
  */
4299
4469
  public txType?: string;
4300
4470
 
@@ -4334,6 +4504,9 @@ export class Transaction extends BaseModel {
4334
4504
  * @param group - (grp) Base64 encoded byte array of a sha512/256 digest. When present indicates
4335
4505
  * that this transaction is part of a transaction group and the value is the
4336
4506
  * sha512/256 hash of the transactions in that group.
4507
+ * @param heartbeatTransaction - Fields for a heartbeat transaction.
4508
+ * Definition:
4509
+ * data/transactions/heartbeat.go : HeartbeatTxnFields
4337
4510
  * @param id - Transaction ID
4338
4511
  * @param innerTxns - Inner transactions produced by application execution.
4339
4512
  * @param intraRoundOffset - Offset into the round where this transaction was confirmed.
@@ -4373,6 +4546,7 @@ export class Transaction extends BaseModel {
4373
4546
  * * (afrz) asset-freeze-transaction
4374
4547
  * * (appl) application-transaction
4375
4548
  * * (stpf) state-proof-transaction
4549
+ * * (hb) heartbeat-transaction
4376
4550
  */
4377
4551
  constructor({
4378
4552
  fee,
@@ -4393,6 +4567,7 @@ export class Transaction extends BaseModel {
4393
4567
  genesisId,
4394
4568
  globalStateDelta,
4395
4569
  group,
4570
+ heartbeatTransaction,
4396
4571
  id,
4397
4572
  innerTxns,
4398
4573
  intraRoundOffset,
@@ -4428,6 +4603,7 @@ export class Transaction extends BaseModel {
4428
4603
  genesisId?: string;
4429
4604
  globalStateDelta?: EvalDeltaKeyValue[];
4430
4605
  group?: string | Uint8Array;
4606
+ heartbeatTransaction?: TransactionHeartbeat;
4431
4607
  id?: string;
4432
4608
  innerTxns?: Transaction[];
4433
4609
  intraRoundOffset?: number | bigint;
@@ -4470,6 +4646,7 @@ export class Transaction extends BaseModel {
4470
4646
  typeof group === 'string'
4471
4647
  ? new Uint8Array(Buffer.from(group, 'base64'))
4472
4648
  : group;
4649
+ this.heartbeatTransaction = heartbeatTransaction;
4473
4650
  this.id = id;
4474
4651
  this.innerTxns = innerTxns;
4475
4652
  this.intraRoundOffset = intraRoundOffset;
@@ -4512,6 +4689,7 @@ export class Transaction extends BaseModel {
4512
4689
  genesisId: 'genesis-id',
4513
4690
  globalStateDelta: 'global-state-delta',
4514
4691
  group: 'group',
4692
+ heartbeatTransaction: 'heartbeat-transaction',
4515
4693
  id: 'id',
4516
4694
  innerTxns: 'inner-txns',
4517
4695
  intraRoundOffset: 'intra-round-offset',
@@ -4590,6 +4768,12 @@ export class Transaction extends BaseModel {
4590
4768
  )
4591
4769
  : undefined,
4592
4770
  group: data['group'],
4771
+ heartbeatTransaction:
4772
+ typeof data['heartbeat-transaction'] !== 'undefined'
4773
+ ? TransactionHeartbeat.from_obj_for_encoding(
4774
+ data['heartbeat-transaction']
4775
+ )
4776
+ : undefined,
4593
4777
  id: data['id'],
4594
4778
  innerTxns:
4595
4779
  typeof data['inner-txns'] !== 'undefined'
@@ -5094,6 +5278,116 @@ export class TransactionAssetTransfer extends BaseModel {
5094
5278
  }
5095
5279
  }
5096
5280
 
5281
+ /**
5282
+ * Fields for a heartbeat transaction.
5283
+ * Definition:
5284
+ * data/transactions/heartbeat.go : HeartbeatTxnFields
5285
+ */
5286
+ export class TransactionHeartbeat extends BaseModel {
5287
+ /**
5288
+ * (hbad) HbAddress is the account this txn is proving onlineness for.
5289
+ */
5290
+ public hbAddress: string;
5291
+
5292
+ /**
5293
+ * (hbkd) HbKeyDilution must match HbAddress account's current KeyDilution.
5294
+ */
5295
+ public hbKeyDilution: number | bigint;
5296
+
5297
+ /**
5298
+ * (hbprf) HbProof is a signature using HeartbeatAddress's partkey, thereby showing
5299
+ * it is online.
5300
+ */
5301
+ public hbProof: HbProofFields;
5302
+
5303
+ /**
5304
+ * (hbsd) HbSeed must be the block seed for the this transaction's firstValid
5305
+ * block.
5306
+ */
5307
+ public hbSeed: Uint8Array;
5308
+
5309
+ /**
5310
+ * (hbvid) HbVoteID must match the HbAddress account's current VoteID.
5311
+ */
5312
+ public hbVoteId: Uint8Array;
5313
+
5314
+ /**
5315
+ * Creates a new `TransactionHeartbeat` object.
5316
+ * @param hbAddress - (hbad) HbAddress is the account this txn is proving onlineness for.
5317
+ * @param hbKeyDilution - (hbkd) HbKeyDilution must match HbAddress account's current KeyDilution.
5318
+ * @param hbProof - (hbprf) HbProof is a signature using HeartbeatAddress's partkey, thereby showing
5319
+ * it is online.
5320
+ * @param hbSeed - (hbsd) HbSeed must be the block seed for the this transaction's firstValid
5321
+ * block.
5322
+ * @param hbVoteId - (hbvid) HbVoteID must match the HbAddress account's current VoteID.
5323
+ */
5324
+ constructor({
5325
+ hbAddress,
5326
+ hbKeyDilution,
5327
+ hbProof,
5328
+ hbSeed,
5329
+ hbVoteId,
5330
+ }: {
5331
+ hbAddress: string;
5332
+ hbKeyDilution: number | bigint;
5333
+ hbProof: HbProofFields;
5334
+ hbSeed: string | Uint8Array;
5335
+ hbVoteId: string | Uint8Array;
5336
+ }) {
5337
+ super();
5338
+ this.hbAddress = hbAddress;
5339
+ this.hbKeyDilution = hbKeyDilution;
5340
+ this.hbProof = hbProof;
5341
+ this.hbSeed =
5342
+ typeof hbSeed === 'string'
5343
+ ? new Uint8Array(Buffer.from(hbSeed, 'base64'))
5344
+ : hbSeed;
5345
+ this.hbVoteId =
5346
+ typeof hbVoteId === 'string'
5347
+ ? new Uint8Array(Buffer.from(hbVoteId, 'base64'))
5348
+ : hbVoteId;
5349
+
5350
+ this.attribute_map = {
5351
+ hbAddress: 'hb-address',
5352
+ hbKeyDilution: 'hb-key-dilution',
5353
+ hbProof: 'hb-proof',
5354
+ hbSeed: 'hb-seed',
5355
+ hbVoteId: 'hb-vote-id',
5356
+ };
5357
+ }
5358
+
5359
+ // eslint-disable-next-line camelcase
5360
+ static from_obj_for_encoding(
5361
+ data: Record<string, any>
5362
+ ): TransactionHeartbeat {
5363
+ /* eslint-disable dot-notation */
5364
+ if (typeof data['hb-address'] === 'undefined')
5365
+ throw new Error(
5366
+ `Response is missing required field 'hb-address': ${data}`
5367
+ );
5368
+ if (typeof data['hb-key-dilution'] === 'undefined')
5369
+ throw new Error(
5370
+ `Response is missing required field 'hb-key-dilution': ${data}`
5371
+ );
5372
+ if (typeof data['hb-proof'] === 'undefined')
5373
+ throw new Error(`Response is missing required field 'hb-proof': ${data}`);
5374
+ if (typeof data['hb-seed'] === 'undefined')
5375
+ throw new Error(`Response is missing required field 'hb-seed': ${data}`);
5376
+ if (typeof data['hb-vote-id'] === 'undefined')
5377
+ throw new Error(
5378
+ `Response is missing required field 'hb-vote-id': ${data}`
5379
+ );
5380
+ return new TransactionHeartbeat({
5381
+ hbAddress: data['hb-address'],
5382
+ hbKeyDilution: data['hb-key-dilution'],
5383
+ hbProof: HbProofFields.from_obj_for_encoding(data['hb-proof']),
5384
+ hbSeed: data['hb-seed'],
5385
+ hbVoteId: data['hb-vote-id'],
5386
+ });
5387
+ /* eslint-enable dot-notation */
5388
+ }
5389
+ }
5390
+
5097
5391
  /**
5098
5392
  * Fields for a keyreg transaction.
5099
5393
  * Definition: