algosdk 3.2.0 → 3.3.1

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.
@@ -257,6 +257,25 @@ export default class SearchAccounts extends JSONRequest {
257
257
  this.query.exclude = exclude;
258
258
  return this;
259
259
  }
260
+ /**
261
+ * If true, only online accounts will be returned in the response.
262
+ *
263
+ * #### Example
264
+ * ```typescript
265
+ * const onlineOnly = true;
266
+ * const accounts = await indexerClient
267
+ * .searchAccounts
268
+ * .onlineOnly(onlineOnly)
269
+ * .do();
270
+ * ```
271
+ *
272
+ * @param onlineOnly - if true, only online accounts will be returned in the response
273
+ * @category query
274
+ */
275
+ onlineOnly(onlineOnly) {
276
+ this.query['online-only'] = onlineOnly;
277
+ return this;
278
+ }
260
279
  // eslint-disable-next-line class-methods-use-this
261
280
  prepare(response) {
262
281
  return decodeJSON(response.getJSONText(), AccountsResponse);
@@ -1 +1 @@
1
- {"version":3,"file":"searchAccounts.js","sourceRoot":"","sources":["../../../../../src/client/v2/indexer/searchAccounts.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,WAA6B;IACvE;;OAEG;IACH,kDAAkD;IAClD,IAAI;QACF,OAAO,cAAc,CAAC;IACxB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,mBAAmB,CAAC,OAAwB;QAC1C,uGAAuG;QACvG,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;QACzD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,gBAAgB,CAAC,MAAuB;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CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,kDAAkD;IAClD,OAAO,CAAC,QAA4B;QAClC,OAAO,UAAU,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,gBAAgB,CAAC,CAAC;IAC9D,CAAC;CACF"}
1
+ {"version":3,"file":"searchAccounts.js","sourceRoot":"","sources":["../../../../../src/client/v2/indexer/searchAccounts.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,WAA6B;IACvE;;OAEG;IACH,kDAAkD;IAClD,IAAI;QACF,OAAO,cAAc,CAAC;IACxB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,mBAAmB,CAAC,OAAwB;QAC1C,uGAAuG;QACvG,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;QACzD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,gBAAgB,CAAC,MAAuB;QACtC,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,GAAG,MAAM,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,KAAa;QACjB,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,EAAmB;QACzB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;QAC5B,OAAO,IAAI,CAA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684,10 @@ export declare class ApplicationParams implements Encodable {
684
684
  * (lsch) local schema
685
685
  */
686
686
  localStateSchema?: ApplicationStateSchema;
687
+ /**
688
+ * (v) the number of updates to the application programs
689
+ */
690
+ version?: number;
687
691
  /**
688
692
  * Creates a new `ApplicationParams` object.
689
693
  * @param approvalProgram - (approv) approval program.
@@ -694,8 +698,9 @@ export declare class ApplicationParams implements Encodable {
694
698
  * @param globalState - (gs) global state
695
699
  * @param globalStateSchema - (gsch) global schema
696
700
  * @param localStateSchema - (lsch) local schema
701
+ * @param version - (v) the number of updates to the application programs
697
702
  */
698
- constructor({ approvalProgram, clearStateProgram, creator, extraProgramPages, globalState, globalStateSchema, localStateSchema, }: {
703
+ constructor({ approvalProgram, clearStateProgram, creator, extraProgramPages, globalState, globalStateSchema, localStateSchema, version, }: {
699
704
  approvalProgram: string | Uint8Array;
700
705
  clearStateProgram: string | Uint8Array;
701
706
  creator: Address | string;
@@ -703,6 +708,7 @@ export declare class ApplicationParams implements Encodable {
703
708
  globalState?: TealKeyValue[];
704
709
  globalStateSchema?: ApplicationStateSchema;
705
710
  localStateSchema?: ApplicationStateSchema;
711
+ version?: number | bigint;
706
712
  });
707
713
  getEncodingSchema(): Schema;
708
714
  toEncodingData(): Map<string, unknown>;
@@ -1168,7 +1174,7 @@ export declare class Box implements Encodable {
1168
1174
  private static encodingSchemaValue;
1169
1175
  static get encodingSchema(): Schema;
1170
1176
  /**
1171
- * (name) box name, base64 encoded
1177
+ * The box name, base64 encoded
1172
1178
  */
1173
1179
  name: Uint8Array;
1174
1180
  /**
@@ -1176,14 +1182,14 @@ export declare class Box implements Encodable {
1176
1182
  */
1177
1183
  round: bigint;
1178
1184
  /**
1179
- * (value) box value, base64 encoded.
1185
+ * The box value, base64 encoded.
1180
1186
  */
1181
1187
  value: Uint8Array;
1182
1188
  /**
1183
1189
  * Creates a new `Box` object.
1184
- * @param name - (name) box name, base64 encoded
1190
+ * @param name - The box name, base64 encoded
1185
1191
  * @param round - The round for which this information is relevant
1186
- * @param value - (value) box value, base64 encoded.
1192
+ * @param value - The box value, base64 encoded.
1187
1193
  */
1188
1194
  constructor({ name, round, value, }: {
1189
1195
  name: string | Uint8Array;
@@ -1243,7 +1249,7 @@ export declare class BoxReference implements Encodable {
1243
1249
  static fromEncodingData(data: unknown): BoxReference;
1244
1250
  }
1245
1251
  /**
1246
- * Box names of an application
1252
+ * * Box names of an application
1247
1253
  */
1248
1254
  export declare class BoxesResponse implements Encodable {
1249
1255
  private static encodingSchemaValue;
@@ -1639,6 +1645,66 @@ export declare class EvalDeltaKeyValue implements Encodable {
1639
1645
  toEncodingData(): Map<string, unknown>;
1640
1646
  static fromEncodingData(data: unknown): EvalDeltaKeyValue;
1641
1647
  }
1648
+ export declare class Genesis implements Encodable {
1649
+ private static encodingSchemaValue;
1650
+ static get encodingSchema(): Schema;
1651
+ alloc: GenesisAllocation[];
1652
+ fees: string;
1653
+ id: string;
1654
+ network: string;
1655
+ proto: string;
1656
+ rwd: string;
1657
+ timestamp: number;
1658
+ comment?: string;
1659
+ devmode?: boolean;
1660
+ /**
1661
+ * Creates a new `Genesis` object.
1662
+ * @param alloc -
1663
+ * @param fees -
1664
+ * @param id -
1665
+ * @param network -
1666
+ * @param proto -
1667
+ * @param rwd -
1668
+ * @param timestamp -
1669
+ * @param comment -
1670
+ * @param devmode -
1671
+ */
1672
+ constructor({ alloc, fees, id, network, proto, rwd, timestamp, comment, devmode, }: {
1673
+ alloc: GenesisAllocation[];
1674
+ fees: string;
1675
+ id: string;
1676
+ network: string;
1677
+ proto: string;
1678
+ rwd: string;
1679
+ timestamp: number | bigint;
1680
+ comment?: string;
1681
+ devmode?: boolean;
1682
+ });
1683
+ getEncodingSchema(): Schema;
1684
+ toEncodingData(): Map<string, unknown>;
1685
+ static fromEncodingData(data: unknown): Genesis;
1686
+ }
1687
+ export declare class GenesisAllocation implements Encodable {
1688
+ private static encodingSchemaValue;
1689
+ static get encodingSchema(): Schema;
1690
+ addr: string;
1691
+ comment: string;
1692
+ state: UntypedValue;
1693
+ /**
1694
+ * Creates a new `GenesisAllocation` object.
1695
+ * @param addr -
1696
+ * @param comment -
1697
+ * @param state -
1698
+ */
1699
+ constructor({ addr, comment, state, }: {
1700
+ addr: string;
1701
+ comment: string;
1702
+ state: UntypedValue;
1703
+ });
1704
+ getEncodingSchema(): Schema;
1705
+ toEncodingData(): Map<string, unknown>;
1706
+ static fromEncodingData(data: unknown): GenesisAllocation;
1707
+ }
1642
1708
  /**
1643
1709
  * Response containing the timestamp offset in seconds
1644
1710
  */
@@ -1681,34 +1747,6 @@ export declare class GetSyncRoundResponse implements Encodable {
1681
1747
  toEncodingData(): Map<string, unknown>;
1682
1748
  static fromEncodingData(data: unknown): GetSyncRoundResponse;
1683
1749
  }
1684
- /**
1685
- * A single Delta containing the key, the previous value and the current value for
1686
- * a single round.
1687
- */
1688
- export declare class KvDelta implements Encodable {
1689
- private static encodingSchemaValue;
1690
- static get encodingSchema(): Schema;
1691
- /**
1692
- * The key, base64 encoded.
1693
- */
1694
- key?: Uint8Array;
1695
- /**
1696
- * The new value of the KV store entry, base64 encoded.
1697
- */
1698
- value?: Uint8Array;
1699
- /**
1700
- * Creates a new `KvDelta` object.
1701
- * @param key - The key, base64 encoded.
1702
- * @param value - The new value of the KV store entry, base64 encoded.
1703
- */
1704
- constructor({ key, value, }: {
1705
- key?: string | Uint8Array;
1706
- value?: string | Uint8Array;
1707
- });
1708
- getEncodingSchema(): Schema;
1709
- toEncodingData(): Map<string, unknown>;
1710
- static fromEncodingData(data: unknown): KvDelta;
1711
- }
1712
1750
  /**
1713
1751
  * Contains a ledger delta for a single transaction group
1714
1752
  */
@@ -620,6 +620,10 @@ export declare class ApplicationParams implements Encodable {
620
620
  * local schema
621
621
  */
622
622
  localStateSchema?: ApplicationStateSchema;
623
+ /**
624
+ * the number of updates to the application programs
625
+ */
626
+ version?: number;
623
627
  /**
624
628
  * Creates a new `ApplicationParams` object.
625
629
  * @param approvalProgram - approval program.
@@ -630,8 +634,9 @@ export declare class ApplicationParams implements Encodable {
630
634
  * @param globalState - global state
631
635
  * @param globalStateSchema - global schema
632
636
  * @param localStateSchema - local schema
637
+ * @param version - the number of updates to the application programs
633
638
  */
634
- constructor({ approvalProgram, clearStateProgram, creator, extraProgramPages, globalState, globalStateSchema, localStateSchema, }: {
639
+ constructor({ approvalProgram, clearStateProgram, creator, extraProgramPages, globalState, globalStateSchema, localStateSchema, version, }: {
635
640
  approvalProgram: string | Uint8Array;
636
641
  clearStateProgram: string | Uint8Array;
637
642
  creator?: Address | string;
@@ -639,6 +644,7 @@ export declare class ApplicationParams implements Encodable {
639
644
  globalState?: TealKeyValue[];
640
645
  globalStateSchema?: ApplicationStateSchema;
641
646
  localStateSchema?: ApplicationStateSchema;
647
+ version?: number | bigint;
642
648
  });
643
649
  getEncodingSchema(): Schema;
644
650
  toEncodingData(): Map<string, unknown>;
@@ -224,5 +224,21 @@ export default class SearchAccounts extends JSONRequest<AccountsResponse> {
224
224
  * @category query
225
225
  */
226
226
  exclude(exclude: string): this;
227
+ /**
228
+ * If true, only online accounts will be returned in the response.
229
+ *
230
+ * #### Example
231
+ * ```typescript
232
+ * const onlineOnly = true;
233
+ * const accounts = await indexerClient
234
+ * .searchAccounts
235
+ * .onlineOnly(onlineOnly)
236
+ * .do();
237
+ * ```
238
+ *
239
+ * @param onlineOnly - if true, only online accounts will be returned in the response
240
+ * @category query
241
+ */
242
+ onlineOnly(onlineOnly: boolean): this;
227
243
  prepare(response: HTTPClientResponse): AccountsResponse;
228
244
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "algosdk",
3
- "version": "3.2.0",
3
+ "version": "3.3.1",
4
4
  "description": "The official JavaScript SDK for Algorand",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -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
  }
@@ -3104,7 +3121,7 @@ export class Box implements Encodable {
3104
3121
  }
3105
3122
 
3106
3123
  /**
3107
- * (name) box name, base64 encoded
3124
+ * The box name, base64 encoded
3108
3125
  */
3109
3126
  public name: Uint8Array;
3110
3127
 
@@ -3114,15 +3131,15 @@ export class Box implements Encodable {
3114
3131
  public round: bigint;
3115
3132
 
3116
3133
  /**
3117
- * (value) box value, base64 encoded.
3134
+ * The box value, base64 encoded.
3118
3135
  */
3119
3136
  public value: Uint8Array;
3120
3137
 
3121
3138
  /**
3122
3139
  * Creates a new `Box` object.
3123
- * @param name - (name) box name, base64 encoded
3140
+ * @param name - The box name, base64 encoded
3124
3141
  * @param round - The round for which this information is relevant
3125
- * @param value - (value) box value, base64 encoded.
3142
+ * @param value - The box value, base64 encoded.
3126
3143
  */
3127
3144
  constructor({
3128
3145
  name,
@@ -3280,7 +3297,7 @@ export class BoxReference implements Encodable {
3280
3297
  }
3281
3298
 
3282
3299
  /**
3283
- * Box names of an application
3300
+ * * Box names of an application
3284
3301
  */
3285
3302
  export class BoxesResponse implements Encodable {
3286
3303
  private static encodingSchemaValue: Schema | undefined;
@@ -4480,6 +4497,210 @@ export class EvalDeltaKeyValue implements Encodable {
4480
4497
  }
4481
4498
  }
4482
4499
 
4500
+ export class Genesis implements Encodable {
4501
+ private static encodingSchemaValue: Schema | undefined;
4502
+
4503
+ static get encodingSchema(): Schema {
4504
+ if (!this.encodingSchemaValue) {
4505
+ this.encodingSchemaValue = new NamedMapSchema([]);
4506
+ (this.encodingSchemaValue as NamedMapSchema).pushEntries(
4507
+ {
4508
+ key: 'alloc',
4509
+ valueSchema: new ArraySchema(GenesisAllocation.encodingSchema),
4510
+ omitEmpty: true,
4511
+ },
4512
+ { key: 'fees', valueSchema: new StringSchema(), omitEmpty: true },
4513
+ { key: 'id', valueSchema: new StringSchema(), omitEmpty: true },
4514
+ { key: 'network', valueSchema: new StringSchema(), omitEmpty: true },
4515
+ { key: 'proto', valueSchema: new StringSchema(), omitEmpty: true },
4516
+ { key: 'rwd', valueSchema: new StringSchema(), omitEmpty: true },
4517
+ { key: 'timestamp', valueSchema: new Uint64Schema(), omitEmpty: true },
4518
+ {
4519
+ key: 'comment',
4520
+ valueSchema: new OptionalSchema(new StringSchema()),
4521
+ omitEmpty: true,
4522
+ },
4523
+ {
4524
+ key: 'devmode',
4525
+ valueSchema: new OptionalSchema(new BooleanSchema()),
4526
+ omitEmpty: true,
4527
+ }
4528
+ );
4529
+ }
4530
+ return this.encodingSchemaValue;
4531
+ }
4532
+
4533
+ public alloc: GenesisAllocation[];
4534
+
4535
+ public fees: string;
4536
+
4537
+ public id: string;
4538
+
4539
+ public network: string;
4540
+
4541
+ public proto: string;
4542
+
4543
+ public rwd: string;
4544
+
4545
+ public timestamp: number;
4546
+
4547
+ public comment?: string;
4548
+
4549
+ public devmode?: boolean;
4550
+
4551
+ /**
4552
+ * Creates a new `Genesis` object.
4553
+ * @param alloc -
4554
+ * @param fees -
4555
+ * @param id -
4556
+ * @param network -
4557
+ * @param proto -
4558
+ * @param rwd -
4559
+ * @param timestamp -
4560
+ * @param comment -
4561
+ * @param devmode -
4562
+ */
4563
+ constructor({
4564
+ alloc,
4565
+ fees,
4566
+ id,
4567
+ network,
4568
+ proto,
4569
+ rwd,
4570
+ timestamp,
4571
+ comment,
4572
+ devmode,
4573
+ }: {
4574
+ alloc: GenesisAllocation[];
4575
+ fees: string;
4576
+ id: string;
4577
+ network: string;
4578
+ proto: string;
4579
+ rwd: string;
4580
+ timestamp: number | bigint;
4581
+ comment?: string;
4582
+ devmode?: boolean;
4583
+ }) {
4584
+ this.alloc = alloc;
4585
+ this.fees = fees;
4586
+ this.id = id;
4587
+ this.network = network;
4588
+ this.proto = proto;
4589
+ this.rwd = rwd;
4590
+ this.timestamp = ensureSafeInteger(timestamp);
4591
+ this.comment = comment;
4592
+ this.devmode = devmode;
4593
+ }
4594
+
4595
+ // eslint-disable-next-line class-methods-use-this
4596
+ getEncodingSchema(): Schema {
4597
+ return Genesis.encodingSchema;
4598
+ }
4599
+
4600
+ toEncodingData(): Map<string, unknown> {
4601
+ return new Map<string, unknown>([
4602
+ ['alloc', this.alloc.map((v) => v.toEncodingData())],
4603
+ ['fees', this.fees],
4604
+ ['id', this.id],
4605
+ ['network', this.network],
4606
+ ['proto', this.proto],
4607
+ ['rwd', this.rwd],
4608
+ ['timestamp', this.timestamp],
4609
+ ['comment', this.comment],
4610
+ ['devmode', this.devmode],
4611
+ ]);
4612
+ }
4613
+
4614
+ static fromEncodingData(data: unknown): Genesis {
4615
+ if (!(data instanceof Map)) {
4616
+ throw new Error(`Invalid decoded Genesis: ${data}`);
4617
+ }
4618
+ return new Genesis({
4619
+ alloc: (data.get('alloc') ?? []).map((v: unknown) =>
4620
+ GenesisAllocation.fromEncodingData(v)
4621
+ ),
4622
+ fees: data.get('fees'),
4623
+ id: data.get('id'),
4624
+ network: data.get('network'),
4625
+ proto: data.get('proto'),
4626
+ rwd: data.get('rwd'),
4627
+ timestamp: data.get('timestamp'),
4628
+ comment: data.get('comment'),
4629
+ devmode: data.get('devmode'),
4630
+ });
4631
+ }
4632
+ }
4633
+
4634
+ export class GenesisAllocation implements Encodable {
4635
+ private static encodingSchemaValue: Schema | undefined;
4636
+
4637
+ static get encodingSchema(): Schema {
4638
+ if (!this.encodingSchemaValue) {
4639
+ this.encodingSchemaValue = new NamedMapSchema([]);
4640
+ (this.encodingSchemaValue as NamedMapSchema).pushEntries(
4641
+ { key: 'addr', valueSchema: new StringSchema(), omitEmpty: true },
4642
+ { key: 'comment', valueSchema: new StringSchema(), omitEmpty: true },
4643
+ {
4644
+ key: 'state',
4645
+ valueSchema: UntypedValue.encodingSchema,
4646
+ omitEmpty: true,
4647
+ }
4648
+ );
4649
+ }
4650
+ return this.encodingSchemaValue;
4651
+ }
4652
+
4653
+ public addr: string;
4654
+
4655
+ public comment: string;
4656
+
4657
+ public state: UntypedValue;
4658
+
4659
+ /**
4660
+ * Creates a new `GenesisAllocation` object.
4661
+ * @param addr -
4662
+ * @param comment -
4663
+ * @param state -
4664
+ */
4665
+ constructor({
4666
+ addr,
4667
+ comment,
4668
+ state,
4669
+ }: {
4670
+ addr: string;
4671
+ comment: string;
4672
+ state: UntypedValue;
4673
+ }) {
4674
+ this.addr = addr;
4675
+ this.comment = comment;
4676
+ this.state = state;
4677
+ }
4678
+
4679
+ // eslint-disable-next-line class-methods-use-this
4680
+ getEncodingSchema(): Schema {
4681
+ return GenesisAllocation.encodingSchema;
4682
+ }
4683
+
4684
+ toEncodingData(): Map<string, unknown> {
4685
+ return new Map<string, unknown>([
4686
+ ['addr', this.addr],
4687
+ ['comment', this.comment],
4688
+ ['state', this.state.toEncodingData()],
4689
+ ]);
4690
+ }
4691
+
4692
+ static fromEncodingData(data: unknown): GenesisAllocation {
4693
+ if (!(data instanceof Map)) {
4694
+ throw new Error(`Invalid decoded GenesisAllocation: ${data}`);
4695
+ }
4696
+ return new GenesisAllocation({
4697
+ addr: data.get('addr'),
4698
+ comment: data.get('comment'),
4699
+ state: UntypedValue.fromEncodingData(data.get('state') ?? new Map()),
4700
+ });
4701
+ }
4702
+ }
4703
+
4483
4704
  /**
4484
4705
  * Response containing the timestamp offset in seconds
4485
4706
  */
@@ -4582,81 +4803,6 @@ export class GetSyncRoundResponse implements Encodable {
4582
4803
  }
4583
4804
  }
4584
4805
 
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
4806
  /**
4661
4807
  * Contains a ledger delta for a single transaction group
4662
4808
  */