algosdk 3.2.0 → 3.3.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 (28) hide show
  1. package/README.md +5 -5
  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/getApplicationBoxes.js +58 -1
  5. package/dist/cjs/client/v2/algod/getApplicationBoxes.js.map +1 -1
  6. package/dist/cjs/client/v2/algod/models/types.js +164 -99
  7. package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
  8. package/dist/cjs/client/v2/indexer/models/types.js +10 -1
  9. package/dist/cjs/client/v2/indexer/models/types.js.map +1 -1
  10. package/dist/cjs/client/v2/indexer/searchAccounts.js +19 -0
  11. package/dist/cjs/client/v2/indexer/searchAccounts.js.map +1 -1
  12. package/dist/esm/client/v2/algod/getApplicationBoxes.js +58 -1
  13. package/dist/esm/client/v2/algod/getApplicationBoxes.js.map +1 -1
  14. package/dist/esm/client/v2/algod/models/types.js +161 -96
  15. package/dist/esm/client/v2/algod/models/types.js.map +1 -1
  16. package/dist/esm/client/v2/indexer/models/types.js +10 -1
  17. package/dist/esm/client/v2/indexer/models/types.js.map +1 -1
  18. package/dist/esm/client/v2/indexer/searchAccounts.js +19 -0
  19. package/dist/esm/client/v2/indexer/searchAccounts.js.map +1 -1
  20. package/dist/types/client/v2/algod/getApplicationBoxes.d.ts +49 -1
  21. package/dist/types/client/v2/algod/models/types.d.ts +93 -62
  22. package/dist/types/client/v2/indexer/models/types.d.ts +7 -1
  23. package/dist/types/client/v2/indexer/searchAccounts.d.ts +16 -0
  24. package/package.json +1 -1
  25. package/src/client/v2/algod/getApplicationBoxes.ts +61 -1
  26. package/src/client/v2/algod/models/types.ts +285 -145
  27. package/src/client/v2/indexer/models/types.ts +17 -0
  28. package/src/client/v2/indexer/searchAccounts.ts +20 -0
@@ -1832,6 +1832,11 @@ export class ApplicationParams implements Encodable {
1832
1832
  ApplicationStateSchema.encodingSchema
1833
1833
  ),
1834
1834
  omitEmpty: true,
1835
+ },
1836
+ {
1837
+ key: 'version',
1838
+ valueSchema: new OptionalSchema(new Uint64Schema()),
1839
+ omitEmpty: true,
1835
1840
  }
1836
1841
  );
1837
1842
  }
@@ -1874,6 +1879,11 @@ export class ApplicationParams implements Encodable {
1874
1879
  */
1875
1880
  public localStateSchema?: ApplicationStateSchema;
1876
1881
 
1882
+ /**
1883
+ * (v) the number of updates to the application programs
1884
+ */
1885
+ public version?: number;
1886
+
1877
1887
  /**
1878
1888
  * Creates a new `ApplicationParams` object.
1879
1889
  * @param approvalProgram - (approv) approval program.
@@ -1884,6 +1894,7 @@ export class ApplicationParams implements Encodable {
1884
1894
  * @param globalState - (gs) global state
1885
1895
  * @param globalStateSchema - (gsch) global schema
1886
1896
  * @param localStateSchema - (lsch) local schema
1897
+ * @param version - (v) the number of updates to the application programs
1887
1898
  */
1888
1899
  constructor({
1889
1900
  approvalProgram,
@@ -1893,6 +1904,7 @@ export class ApplicationParams implements Encodable {
1893
1904
  globalState,
1894
1905
  globalStateSchema,
1895
1906
  localStateSchema,
1907
+ version,
1896
1908
  }: {
1897
1909
  approvalProgram: string | Uint8Array;
1898
1910
  clearStateProgram: string | Uint8Array;
@@ -1901,6 +1913,7 @@ export class ApplicationParams implements Encodable {
1901
1913
  globalState?: TealKeyValue[];
1902
1914
  globalStateSchema?: ApplicationStateSchema;
1903
1915
  localStateSchema?: ApplicationStateSchema;
1916
+ version?: number | bigint;
1904
1917
  }) {
1905
1918
  this.approvalProgram =
1906
1919
  typeof approvalProgram === 'string'
@@ -1919,6 +1932,8 @@ export class ApplicationParams implements Encodable {
1919
1932
  this.globalState = globalState;
1920
1933
  this.globalStateSchema = globalStateSchema;
1921
1934
  this.localStateSchema = localStateSchema;
1935
+ this.version =
1936
+ typeof version === 'undefined' ? undefined : ensureSafeInteger(version);
1922
1937
  }
1923
1938
 
1924
1939
  // eslint-disable-next-line class-methods-use-this
@@ -1950,6 +1965,7 @@ export class ApplicationParams implements Encodable {
1950
1965
  ? this.localStateSchema.toEncodingData()
1951
1966
  : undefined,
1952
1967
  ],
1968
+ ['version', this.version],
1953
1969
  ]);
1954
1970
  }
1955
1971
 
@@ -1980,6 +1996,7 @@ export class ApplicationParams implements Encodable {
1980
1996
  data.get('local-state-schema')
1981
1997
  )
1982
1998
  : undefined,
1999
+ version: data.get('version'),
1983
2000
  });
1984
2001
  }
1985
2002
  }
@@ -3096,33 +3113,41 @@ export class Box implements Encodable {
3096
3113
  this.encodingSchemaValue = new NamedMapSchema([]);
3097
3114
  (this.encodingSchemaValue as NamedMapSchema).pushEntries(
3098
3115
  { key: 'name', valueSchema: new ByteArraySchema(), omitEmpty: true },
3099
- { key: 'round', valueSchema: new Uint64Schema(), omitEmpty: true },
3100
- { key: 'value', valueSchema: new ByteArraySchema(), omitEmpty: true }
3116
+ {
3117
+ key: 'round',
3118
+ valueSchema: new OptionalSchema(new Uint64Schema()),
3119
+ omitEmpty: true,
3120
+ },
3121
+ {
3122
+ key: 'value',
3123
+ valueSchema: new OptionalSchema(new ByteArraySchema()),
3124
+ omitEmpty: true,
3125
+ }
3101
3126
  );
3102
3127
  }
3103
3128
  return this.encodingSchemaValue;
3104
3129
  }
3105
3130
 
3106
3131
  /**
3107
- * (name) box name, base64 encoded
3132
+ * The box name, base64 encoded
3108
3133
  */
3109
3134
  public name: Uint8Array;
3110
3135
 
3111
3136
  /**
3112
3137
  * The round for which this information is relevant
3113
3138
  */
3114
- public round: bigint;
3139
+ public round?: bigint;
3115
3140
 
3116
3141
  /**
3117
- * (value) box value, base64 encoded.
3142
+ * The box value, base64 encoded.
3118
3143
  */
3119
- public value: Uint8Array;
3144
+ public value?: Uint8Array;
3120
3145
 
3121
3146
  /**
3122
3147
  * Creates a new `Box` object.
3123
- * @param name - (name) box name, base64 encoded
3148
+ * @param name - The box name, base64 encoded
3124
3149
  * @param round - The round for which this information is relevant
3125
- * @param value - (value) box value, base64 encoded.
3150
+ * @param value - The box value, base64 encoded.
3126
3151
  */
3127
3152
  constructor({
3128
3153
  name,
@@ -3130,11 +3155,11 @@ export class Box implements Encodable {
3130
3155
  value,
3131
3156
  }: {
3132
3157
  name: string | Uint8Array;
3133
- round: number | bigint;
3134
- value: string | Uint8Array;
3158
+ round?: number | bigint;
3159
+ value?: string | Uint8Array;
3135
3160
  }) {
3136
3161
  this.name = typeof name === 'string' ? base64ToBytes(name) : name;
3137
- this.round = ensureBigInt(round);
3162
+ this.round = typeof round === 'undefined' ? undefined : ensureBigInt(round);
3138
3163
  this.value = typeof value === 'string' ? base64ToBytes(value) : value;
3139
3164
  }
3140
3165
 
@@ -3163,56 +3188,6 @@ export class Box implements Encodable {
3163
3188
  }
3164
3189
  }
3165
3190
 
3166
- /**
3167
- * Box descriptor describes a Box.
3168
- */
3169
- export class BoxDescriptor implements Encodable {
3170
- private static encodingSchemaValue: Schema | undefined;
3171
-
3172
- static get encodingSchema(): Schema {
3173
- if (!this.encodingSchemaValue) {
3174
- this.encodingSchemaValue = new NamedMapSchema([]);
3175
- (this.encodingSchemaValue as NamedMapSchema).pushEntries({
3176
- key: 'name',
3177
- valueSchema: new ByteArraySchema(),
3178
- omitEmpty: true,
3179
- });
3180
- }
3181
- return this.encodingSchemaValue;
3182
- }
3183
-
3184
- /**
3185
- * Base64 encoded box name
3186
- */
3187
- public name: Uint8Array;
3188
-
3189
- /**
3190
- * Creates a new `BoxDescriptor` object.
3191
- * @param name - Base64 encoded box name
3192
- */
3193
- constructor({ name }: { name: string | Uint8Array }) {
3194
- this.name = typeof name === 'string' ? base64ToBytes(name) : name;
3195
- }
3196
-
3197
- // eslint-disable-next-line class-methods-use-this
3198
- getEncodingSchema(): Schema {
3199
- return BoxDescriptor.encodingSchema;
3200
- }
3201
-
3202
- toEncodingData(): Map<string, unknown> {
3203
- return new Map<string, unknown>([['name', this.name]]);
3204
- }
3205
-
3206
- static fromEncodingData(data: unknown): BoxDescriptor {
3207
- if (!(data instanceof Map)) {
3208
- throw new Error(`Invalid decoded BoxDescriptor: ${data}`);
3209
- }
3210
- return new BoxDescriptor({
3211
- name: data.get('name'),
3212
- });
3213
- }
3214
- }
3215
-
3216
3191
  /**
3217
3192
  * References a box of an application.
3218
3193
  */
@@ -3280,7 +3255,7 @@ export class BoxReference implements Encodable {
3280
3255
  }
3281
3256
 
3282
3257
  /**
3283
- * Box names of an application
3258
+ * Boxes of an application
3284
3259
  */
3285
3260
  export class BoxesResponse implements Encodable {
3286
3261
  private static encodingSchemaValue: Schema | undefined;
@@ -3288,23 +3263,55 @@ export class BoxesResponse implements Encodable {
3288
3263
  static get encodingSchema(): Schema {
3289
3264
  if (!this.encodingSchemaValue) {
3290
3265
  this.encodingSchemaValue = new NamedMapSchema([]);
3291
- (this.encodingSchemaValue as NamedMapSchema).pushEntries({
3292
- key: 'boxes',
3293
- valueSchema: new ArraySchema(BoxDescriptor.encodingSchema),
3294
- omitEmpty: true,
3295
- });
3266
+ (this.encodingSchemaValue as NamedMapSchema).pushEntries(
3267
+ {
3268
+ key: 'boxes',
3269
+ valueSchema: new ArraySchema(Box.encodingSchema),
3270
+ omitEmpty: true,
3271
+ },
3272
+ { key: 'round', valueSchema: new Uint64Schema(), omitEmpty: true },
3273
+ {
3274
+ key: 'next-token',
3275
+ valueSchema: new OptionalSchema(new StringSchema()),
3276
+ omitEmpty: true,
3277
+ }
3278
+ );
3296
3279
  }
3297
3280
  return this.encodingSchemaValue;
3298
3281
  }
3299
3282
 
3300
- public boxes: BoxDescriptor[];
3283
+ public boxes: Box[];
3284
+
3285
+ /**
3286
+ * The round for which this information is relevant.
3287
+ */
3288
+ public round: number;
3289
+
3290
+ /**
3291
+ * Used for pagination, when making another request provide this token with the
3292
+ * next parameter.
3293
+ */
3294
+ public nextToken?: string;
3301
3295
 
3302
3296
  /**
3303
3297
  * Creates a new `BoxesResponse` object.
3304
3298
  * @param boxes -
3299
+ * @param round - The round for which this information is relevant.
3300
+ * @param nextToken - Used for pagination, when making another request provide this token with the
3301
+ * next parameter.
3305
3302
  */
3306
- constructor({ boxes }: { boxes: BoxDescriptor[] }) {
3303
+ constructor({
3304
+ boxes,
3305
+ round,
3306
+ nextToken,
3307
+ }: {
3308
+ boxes: Box[];
3309
+ round: number | bigint;
3310
+ nextToken?: string;
3311
+ }) {
3307
3312
  this.boxes = boxes;
3313
+ this.round = ensureSafeInteger(round);
3314
+ this.nextToken = nextToken;
3308
3315
  }
3309
3316
 
3310
3317
  // eslint-disable-next-line class-methods-use-this
@@ -3315,6 +3322,8 @@ export class BoxesResponse implements Encodable {
3315
3322
  toEncodingData(): Map<string, unknown> {
3316
3323
  return new Map<string, unknown>([
3317
3324
  ['boxes', this.boxes.map((v) => v.toEncodingData())],
3325
+ ['round', this.round],
3326
+ ['next-token', this.nextToken],
3318
3327
  ]);
3319
3328
  }
3320
3329
 
@@ -3324,8 +3333,10 @@ export class BoxesResponse implements Encodable {
3324
3333
  }
3325
3334
  return new BoxesResponse({
3326
3335
  boxes: (data.get('boxes') ?? []).map((v: unknown) =>
3327
- BoxDescriptor.fromEncodingData(v)
3336
+ Box.fromEncodingData(v)
3328
3337
  ),
3338
+ round: data.get('round'),
3339
+ nextToken: data.get('next-token'),
3329
3340
  });
3330
3341
  }
3331
3342
  }
@@ -4480,6 +4491,210 @@ export class EvalDeltaKeyValue implements Encodable {
4480
4491
  }
4481
4492
  }
4482
4493
 
4494
+ export class Genesis implements Encodable {
4495
+ private static encodingSchemaValue: Schema | undefined;
4496
+
4497
+ static get encodingSchema(): Schema {
4498
+ if (!this.encodingSchemaValue) {
4499
+ this.encodingSchemaValue = new NamedMapSchema([]);
4500
+ (this.encodingSchemaValue as NamedMapSchema).pushEntries(
4501
+ {
4502
+ key: 'alloc',
4503
+ valueSchema: new ArraySchema(GenesisAllocation.encodingSchema),
4504
+ omitEmpty: true,
4505
+ },
4506
+ { key: 'fees', valueSchema: new StringSchema(), omitEmpty: true },
4507
+ { key: 'id', valueSchema: new StringSchema(), omitEmpty: true },
4508
+ { key: 'network', valueSchema: new StringSchema(), omitEmpty: true },
4509
+ { key: 'proto', valueSchema: new StringSchema(), omitEmpty: true },
4510
+ { key: 'rwd', valueSchema: new StringSchema(), omitEmpty: true },
4511
+ { key: 'timestamp', valueSchema: new Uint64Schema(), omitEmpty: true },
4512
+ {
4513
+ key: 'comment',
4514
+ valueSchema: new OptionalSchema(new StringSchema()),
4515
+ omitEmpty: true,
4516
+ },
4517
+ {
4518
+ key: 'devmode',
4519
+ valueSchema: new OptionalSchema(new BooleanSchema()),
4520
+ omitEmpty: true,
4521
+ }
4522
+ );
4523
+ }
4524
+ return this.encodingSchemaValue;
4525
+ }
4526
+
4527
+ public alloc: GenesisAllocation[];
4528
+
4529
+ public fees: string;
4530
+
4531
+ public id: string;
4532
+
4533
+ public network: string;
4534
+
4535
+ public proto: string;
4536
+
4537
+ public rwd: string;
4538
+
4539
+ public timestamp: number;
4540
+
4541
+ public comment?: string;
4542
+
4543
+ public devmode?: boolean;
4544
+
4545
+ /**
4546
+ * Creates a new `Genesis` object.
4547
+ * @param alloc -
4548
+ * @param fees -
4549
+ * @param id -
4550
+ * @param network -
4551
+ * @param proto -
4552
+ * @param rwd -
4553
+ * @param timestamp -
4554
+ * @param comment -
4555
+ * @param devmode -
4556
+ */
4557
+ constructor({
4558
+ alloc,
4559
+ fees,
4560
+ id,
4561
+ network,
4562
+ proto,
4563
+ rwd,
4564
+ timestamp,
4565
+ comment,
4566
+ devmode,
4567
+ }: {
4568
+ alloc: GenesisAllocation[];
4569
+ fees: string;
4570
+ id: string;
4571
+ network: string;
4572
+ proto: string;
4573
+ rwd: string;
4574
+ timestamp: number | bigint;
4575
+ comment?: string;
4576
+ devmode?: boolean;
4577
+ }) {
4578
+ this.alloc = alloc;
4579
+ this.fees = fees;
4580
+ this.id = id;
4581
+ this.network = network;
4582
+ this.proto = proto;
4583
+ this.rwd = rwd;
4584
+ this.timestamp = ensureSafeInteger(timestamp);
4585
+ this.comment = comment;
4586
+ this.devmode = devmode;
4587
+ }
4588
+
4589
+ // eslint-disable-next-line class-methods-use-this
4590
+ getEncodingSchema(): Schema {
4591
+ return Genesis.encodingSchema;
4592
+ }
4593
+
4594
+ toEncodingData(): Map<string, unknown> {
4595
+ return new Map<string, unknown>([
4596
+ ['alloc', this.alloc.map((v) => v.toEncodingData())],
4597
+ ['fees', this.fees],
4598
+ ['id', this.id],
4599
+ ['network', this.network],
4600
+ ['proto', this.proto],
4601
+ ['rwd', this.rwd],
4602
+ ['timestamp', this.timestamp],
4603
+ ['comment', this.comment],
4604
+ ['devmode', this.devmode],
4605
+ ]);
4606
+ }
4607
+
4608
+ static fromEncodingData(data: unknown): Genesis {
4609
+ if (!(data instanceof Map)) {
4610
+ throw new Error(`Invalid decoded Genesis: ${data}`);
4611
+ }
4612
+ return new Genesis({
4613
+ alloc: (data.get('alloc') ?? []).map((v: unknown) =>
4614
+ GenesisAllocation.fromEncodingData(v)
4615
+ ),
4616
+ fees: data.get('fees'),
4617
+ id: data.get('id'),
4618
+ network: data.get('network'),
4619
+ proto: data.get('proto'),
4620
+ rwd: data.get('rwd'),
4621
+ timestamp: data.get('timestamp'),
4622
+ comment: data.get('comment'),
4623
+ devmode: data.get('devmode'),
4624
+ });
4625
+ }
4626
+ }
4627
+
4628
+ export class GenesisAllocation implements Encodable {
4629
+ private static encodingSchemaValue: Schema | undefined;
4630
+
4631
+ static get encodingSchema(): Schema {
4632
+ if (!this.encodingSchemaValue) {
4633
+ this.encodingSchemaValue = new NamedMapSchema([]);
4634
+ (this.encodingSchemaValue as NamedMapSchema).pushEntries(
4635
+ { key: 'addr', valueSchema: new StringSchema(), omitEmpty: true },
4636
+ { key: 'comment', valueSchema: new StringSchema(), omitEmpty: true },
4637
+ {
4638
+ key: 'state',
4639
+ valueSchema: UntypedValue.encodingSchema,
4640
+ omitEmpty: true,
4641
+ }
4642
+ );
4643
+ }
4644
+ return this.encodingSchemaValue;
4645
+ }
4646
+
4647
+ public addr: string;
4648
+
4649
+ public comment: string;
4650
+
4651
+ public state: UntypedValue;
4652
+
4653
+ /**
4654
+ * Creates a new `GenesisAllocation` object.
4655
+ * @param addr -
4656
+ * @param comment -
4657
+ * @param state -
4658
+ */
4659
+ constructor({
4660
+ addr,
4661
+ comment,
4662
+ state,
4663
+ }: {
4664
+ addr: string;
4665
+ comment: string;
4666
+ state: UntypedValue;
4667
+ }) {
4668
+ this.addr = addr;
4669
+ this.comment = comment;
4670
+ this.state = state;
4671
+ }
4672
+
4673
+ // eslint-disable-next-line class-methods-use-this
4674
+ getEncodingSchema(): Schema {
4675
+ return GenesisAllocation.encodingSchema;
4676
+ }
4677
+
4678
+ toEncodingData(): Map<string, unknown> {
4679
+ return new Map<string, unknown>([
4680
+ ['addr', this.addr],
4681
+ ['comment', this.comment],
4682
+ ['state', this.state.toEncodingData()],
4683
+ ]);
4684
+ }
4685
+
4686
+ static fromEncodingData(data: unknown): GenesisAllocation {
4687
+ if (!(data instanceof Map)) {
4688
+ throw new Error(`Invalid decoded GenesisAllocation: ${data}`);
4689
+ }
4690
+ return new GenesisAllocation({
4691
+ addr: data.get('addr'),
4692
+ comment: data.get('comment'),
4693
+ state: UntypedValue.fromEncodingData(data.get('state') ?? new Map()),
4694
+ });
4695
+ }
4696
+ }
4697
+
4483
4698
  /**
4484
4699
  * Response containing the timestamp offset in seconds
4485
4700
  */
@@ -4582,81 +4797,6 @@ export class GetSyncRoundResponse implements Encodable {
4582
4797
  }
4583
4798
  }
4584
4799
 
4585
- /**
4586
- * A single Delta containing the key, the previous value and the current value for
4587
- * a single round.
4588
- */
4589
- export class KvDelta implements Encodable {
4590
- private static encodingSchemaValue: Schema | undefined;
4591
-
4592
- static get encodingSchema(): Schema {
4593
- if (!this.encodingSchemaValue) {
4594
- this.encodingSchemaValue = new NamedMapSchema([]);
4595
- (this.encodingSchemaValue as NamedMapSchema).pushEntries(
4596
- {
4597
- key: 'key',
4598
- valueSchema: new OptionalSchema(new ByteArraySchema()),
4599
- omitEmpty: true,
4600
- },
4601
- {
4602
- key: 'value',
4603
- valueSchema: new OptionalSchema(new ByteArraySchema()),
4604
- omitEmpty: true,
4605
- }
4606
- );
4607
- }
4608
- return this.encodingSchemaValue;
4609
- }
4610
-
4611
- /**
4612
- * The key, base64 encoded.
4613
- */
4614
- public key?: Uint8Array;
4615
-
4616
- /**
4617
- * The new value of the KV store entry, base64 encoded.
4618
- */
4619
- public value?: Uint8Array;
4620
-
4621
- /**
4622
- * Creates a new `KvDelta` object.
4623
- * @param key - The key, base64 encoded.
4624
- * @param value - The new value of the KV store entry, base64 encoded.
4625
- */
4626
- constructor({
4627
- key,
4628
- value,
4629
- }: {
4630
- key?: string | Uint8Array;
4631
- value?: string | Uint8Array;
4632
- }) {
4633
- this.key = typeof key === 'string' ? base64ToBytes(key) : key;
4634
- this.value = typeof value === 'string' ? base64ToBytes(value) : value;
4635
- }
4636
-
4637
- // eslint-disable-next-line class-methods-use-this
4638
- getEncodingSchema(): Schema {
4639
- return KvDelta.encodingSchema;
4640
- }
4641
-
4642
- toEncodingData(): Map<string, unknown> {
4643
- return new Map<string, unknown>([
4644
- ['key', this.key],
4645
- ['value', this.value],
4646
- ]);
4647
- }
4648
-
4649
- static fromEncodingData(data: unknown): KvDelta {
4650
- if (!(data instanceof Map)) {
4651
- throw new Error(`Invalid decoded KvDelta: ${data}`);
4652
- }
4653
- return new KvDelta({
4654
- key: data.get('key'),
4655
- value: data.get('value'),
4656
- });
4657
- }
4658
- }
4659
-
4660
4800
  /**
4661
4801
  * Contains a ledger delta for a single transaction group
4662
4802
  */
@@ -1659,6 +1659,11 @@ export class ApplicationParams implements Encodable {
1659
1659
  ApplicationStateSchema.encodingSchema
1660
1660
  ),
1661
1661
  omitEmpty: true,
1662
+ },
1663
+ {
1664
+ key: 'version',
1665
+ valueSchema: new OptionalSchema(new Uint64Schema()),
1666
+ omitEmpty: true,
1662
1667
  }
1663
1668
  );
1664
1669
  }
@@ -1701,6 +1706,11 @@ export class ApplicationParams implements Encodable {
1701
1706
  */
1702
1707
  public localStateSchema?: ApplicationStateSchema;
1703
1708
 
1709
+ /**
1710
+ * the number of updates to the application programs
1711
+ */
1712
+ public version?: number;
1713
+
1704
1714
  /**
1705
1715
  * Creates a new `ApplicationParams` object.
1706
1716
  * @param approvalProgram - approval program.
@@ -1711,6 +1721,7 @@ export class ApplicationParams implements Encodable {
1711
1721
  * @param globalState - global state
1712
1722
  * @param globalStateSchema - global schema
1713
1723
  * @param localStateSchema - local schema
1724
+ * @param version - the number of updates to the application programs
1714
1725
  */
1715
1726
  constructor({
1716
1727
  approvalProgram,
@@ -1720,6 +1731,7 @@ export class ApplicationParams implements Encodable {
1720
1731
  globalState,
1721
1732
  globalStateSchema,
1722
1733
  localStateSchema,
1734
+ version,
1723
1735
  }: {
1724
1736
  approvalProgram: string | Uint8Array;
1725
1737
  clearStateProgram: string | Uint8Array;
@@ -1728,6 +1740,7 @@ export class ApplicationParams implements Encodable {
1728
1740
  globalState?: TealKeyValue[];
1729
1741
  globalStateSchema?: ApplicationStateSchema;
1730
1742
  localStateSchema?: ApplicationStateSchema;
1743
+ version?: number | bigint;
1731
1744
  }) {
1732
1745
  this.approvalProgram =
1733
1746
  typeof approvalProgram === 'string'
@@ -1746,6 +1759,8 @@ export class ApplicationParams implements Encodable {
1746
1759
  this.globalState = globalState;
1747
1760
  this.globalStateSchema = globalStateSchema;
1748
1761
  this.localStateSchema = localStateSchema;
1762
+ this.version =
1763
+ typeof version === 'undefined' ? undefined : ensureSafeInteger(version);
1749
1764
  }
1750
1765
 
1751
1766
  // eslint-disable-next-line class-methods-use-this
@@ -1782,6 +1797,7 @@ export class ApplicationParams implements Encodable {
1782
1797
  ? this.localStateSchema.toEncodingData()
1783
1798
  : undefined,
1784
1799
  ],
1800
+ ['version', this.version],
1785
1801
  ]);
1786
1802
  }
1787
1803
 
@@ -1812,6 +1828,7 @@ export class ApplicationParams implements Encodable {
1812
1828
  data.get('local-state-schema')
1813
1829
  )
1814
1830
  : undefined,
1831
+ version: data.get('version'),
1815
1832
  });
1816
1833
  }
1817
1834
  }
@@ -271,6 +271,26 @@ export default class SearchAccounts extends JSONRequest<AccountsResponse> {
271
271
  return this;
272
272
  }
273
273
 
274
+ /**
275
+ * If true, only online accounts will be returned in the response.
276
+ *
277
+ * #### Example
278
+ * ```typescript
279
+ * const onlineOnly = true;
280
+ * const accounts = await indexerClient
281
+ * .searchAccounts
282
+ * .onlineOnly(onlineOnly)
283
+ * .do();
284
+ * ```
285
+ *
286
+ * @param onlineOnly - if true, only online accounts will be returned in the response
287
+ * @category query
288
+ */
289
+ onlineOnly(onlineOnly: boolean) {
290
+ this.query['online-only'] = onlineOnly;
291
+ return this;
292
+ }
293
+
274
294
  // eslint-disable-next-line class-methods-use-this
275
295
  prepare(response: HTTPClientResponse): AccountsResponse {
276
296
  return decodeJSON(response.getJSONText(), AccountsResponse);