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.
@@ -262,6 +262,25 @@ class SearchAccounts extends jsonrequest_js_1.default {
262
262
  this.query.exclude = exclude;
263
263
  return this;
264
264
  }
265
+ /**
266
+ * If true, only online accounts will be returned in the response.
267
+ *
268
+ * #### Example
269
+ * ```typescript
270
+ * const onlineOnly = true;
271
+ * const accounts = await indexerClient
272
+ * .searchAccounts
273
+ * .onlineOnly(onlineOnly)
274
+ * .do();
275
+ * ```
276
+ *
277
+ * @param onlineOnly - if true, only online accounts will be returned in the response
278
+ * @category query
279
+ */
280
+ onlineOnly(onlineOnly) {
281
+ this.query['online-only'] = onlineOnly;
282
+ return this;
283
+ }
265
284
  // eslint-disable-next-line class-methods-use-this
266
285
  prepare(response) {
267
286
  return (0, encoding_js_1.decodeJSON)(response.getJSONText(), types_js_1.AccountsResponse);
@@ -1 +1 @@
1
- {"version":3,"file":"searchAccounts.js","sourceRoot":"","sources":["../../../../../src/client/v2/indexer/searchAccounts.ts"],"names":[],"mappings":";;;;;AAAA,uEAA4C;AAE5C,+DAA2D;AAE3D,gDAAqD;AAErD;;;;;;;;;;GAUG;AACH,MAAqB,cAAe,SAAQ,wBAA6B;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,C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kDAAkD;IAClD,OAAO,CAAC,QAA4B;QAClC,OAAO,IAAA,wBAAU,EAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,2BAAgB,CAAC,CAAC;IAC9D,CAAC;CACF;AApQD,iCAoQC"}
1
+ {"version":3,"file":"searchAccounts.js","sourceRoot":"","sources":["../../../../../src/client/v2/indexer/searchAccounts.ts"],"names":[],"mappings":";;;;;AAAA,uEAA4C;AAE5C,+DAA2D;AAE3D,gDAAqD;AAErD;;;;;;;;;;GAUG;AACH,MAAqB,cAAe,SAAQ,wBAA6B;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,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,SAAS,CAAC,SAAiB;QACzB,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,KAAsB;QAC1B,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,QAA0B;QACjC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,QAAQ,EAAE,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,aAAa,CAAC,aAA8B;QAC1C,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,GAAG,aAAa,CAAC;QAC7C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,UAAU,CAAC,KAAK,GAAG,IAAI;QACrB,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,OAAO,CAAC,OAAe;QACrB,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,UAAU,CAAC,UAAmB;QAC5B,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,UAAU,CAAC;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,kDAAkD;IAClD,OAAO,CAAC,QAA4B;QAClC,OAAO,IAAA,wBAAU,EAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,2BAAgB,CAAC,CAAC;IAC9D,CAAC;CACF;AAxRD,iCAwRC"}
@@ -1103,6 +1103,10 @@ export class ApplicationParams {
1103
1103
  key: 'local-state-schema',
1104
1104
  valueSchema: new OptionalSchema(ApplicationStateSchema.encodingSchema),
1105
1105
  omitEmpty: true,
1106
+ }, {
1107
+ key: 'version',
1108
+ valueSchema: new OptionalSchema(new Uint64Schema()),
1109
+ omitEmpty: true,
1106
1110
  });
1107
1111
  }
1108
1112
  return this.encodingSchemaValue;
@@ -1117,8 +1121,9 @@ export class ApplicationParams {
1117
1121
  * @param globalState - (gs) global state
1118
1122
  * @param globalStateSchema - (gsch) global schema
1119
1123
  * @param localStateSchema - (lsch) local schema
1124
+ * @param version - (v) the number of updates to the application programs
1120
1125
  */
1121
- constructor({ approvalProgram, clearStateProgram, creator, extraProgramPages, globalState, globalStateSchema, localStateSchema, }) {
1126
+ constructor({ approvalProgram, clearStateProgram, creator, extraProgramPages, globalState, globalStateSchema, localStateSchema, version, }) {
1122
1127
  this.approvalProgram =
1123
1128
  typeof approvalProgram === 'string'
1124
1129
  ? base64ToBytes(approvalProgram)
@@ -1136,6 +1141,8 @@ export class ApplicationParams {
1136
1141
  this.globalState = globalState;
1137
1142
  this.globalStateSchema = globalStateSchema;
1138
1143
  this.localStateSchema = localStateSchema;
1144
+ this.version =
1145
+ typeof version === 'undefined' ? undefined : ensureSafeInteger(version);
1139
1146
  }
1140
1147
  // eslint-disable-next-line class-methods-use-this
1141
1148
  getEncodingSchema() {
@@ -1165,6 +1172,7 @@ export class ApplicationParams {
1165
1172
  ? this.localStateSchema.toEncodingData()
1166
1173
  : undefined,
1167
1174
  ],
1175
+ ['version', this.version],
1168
1176
  ]);
1169
1177
  }
1170
1178
  static fromEncodingData(data) {
@@ -1187,6 +1195,7 @@ export class ApplicationParams {
1187
1195
  localStateSchema: typeof data.get('local-state-schema') !== 'undefined'
1188
1196
  ? ApplicationStateSchema.fromEncodingData(data.get('local-state-schema'))
1189
1197
  : undefined,
1198
+ version: data.get('version'),
1190
1199
  });
1191
1200
  }
1192
1201
  }
@@ -1887,9 +1896,9 @@ export class Box {
1887
1896
  }
1888
1897
  /**
1889
1898
  * Creates a new `Box` object.
1890
- * @param name - (name) box name, base64 encoded
1899
+ * @param name - The box name, base64 encoded
1891
1900
  * @param round - The round for which this information is relevant
1892
- * @param value - (value) box value, base64 encoded.
1901
+ * @param value - The box value, base64 encoded.
1893
1902
  */
1894
1903
  constructor({ name, round, value, }) {
1895
1904
  this.name = typeof name === 'string' ? base64ToBytes(name) : name;
@@ -1997,7 +2006,7 @@ export class BoxReference {
1997
2006
  }
1998
2007
  }
1999
2008
  /**
2000
- * Box names of an application
2009
+ * * Box names of an application
2001
2010
  */
2002
2011
  export class BoxesResponse {
2003
2012
  static get encodingSchema() {
@@ -2760,6 +2769,128 @@ export class EvalDeltaKeyValue {
2760
2769
  });
2761
2770
  }
2762
2771
  }
2772
+ export class Genesis {
2773
+ static get encodingSchema() {
2774
+ if (!this.encodingSchemaValue) {
2775
+ this.encodingSchemaValue = new NamedMapSchema([]);
2776
+ this.encodingSchemaValue.pushEntries({
2777
+ key: 'alloc',
2778
+ valueSchema: new ArraySchema(GenesisAllocation.encodingSchema),
2779
+ omitEmpty: true,
2780
+ }, { key: 'fees', valueSchema: new StringSchema(), omitEmpty: true }, { key: 'id', valueSchema: new StringSchema(), omitEmpty: true }, { key: 'network', valueSchema: new StringSchema(), omitEmpty: true }, { key: 'proto', valueSchema: new StringSchema(), omitEmpty: true }, { key: 'rwd', valueSchema: new StringSchema(), omitEmpty: true }, { key: 'timestamp', valueSchema: new Uint64Schema(), omitEmpty: true }, {
2781
+ key: 'comment',
2782
+ valueSchema: new OptionalSchema(new StringSchema()),
2783
+ omitEmpty: true,
2784
+ }, {
2785
+ key: 'devmode',
2786
+ valueSchema: new OptionalSchema(new BooleanSchema()),
2787
+ omitEmpty: true,
2788
+ });
2789
+ }
2790
+ return this.encodingSchemaValue;
2791
+ }
2792
+ /**
2793
+ * Creates a new `Genesis` object.
2794
+ * @param alloc -
2795
+ * @param fees -
2796
+ * @param id -
2797
+ * @param network -
2798
+ * @param proto -
2799
+ * @param rwd -
2800
+ * @param timestamp -
2801
+ * @param comment -
2802
+ * @param devmode -
2803
+ */
2804
+ constructor({ alloc, fees, id, network, proto, rwd, timestamp, comment, devmode, }) {
2805
+ this.alloc = alloc;
2806
+ this.fees = fees;
2807
+ this.id = id;
2808
+ this.network = network;
2809
+ this.proto = proto;
2810
+ this.rwd = rwd;
2811
+ this.timestamp = ensureSafeInteger(timestamp);
2812
+ this.comment = comment;
2813
+ this.devmode = devmode;
2814
+ }
2815
+ // eslint-disable-next-line class-methods-use-this
2816
+ getEncodingSchema() {
2817
+ return Genesis.encodingSchema;
2818
+ }
2819
+ toEncodingData() {
2820
+ return new Map([
2821
+ ['alloc', this.alloc.map((v) => v.toEncodingData())],
2822
+ ['fees', this.fees],
2823
+ ['id', this.id],
2824
+ ['network', this.network],
2825
+ ['proto', this.proto],
2826
+ ['rwd', this.rwd],
2827
+ ['timestamp', this.timestamp],
2828
+ ['comment', this.comment],
2829
+ ['devmode', this.devmode],
2830
+ ]);
2831
+ }
2832
+ static fromEncodingData(data) {
2833
+ if (!(data instanceof Map)) {
2834
+ throw new Error(`Invalid decoded Genesis: ${data}`);
2835
+ }
2836
+ return new Genesis({
2837
+ alloc: (data.get('alloc') ?? []).map((v) => GenesisAllocation.fromEncodingData(v)),
2838
+ fees: data.get('fees'),
2839
+ id: data.get('id'),
2840
+ network: data.get('network'),
2841
+ proto: data.get('proto'),
2842
+ rwd: data.get('rwd'),
2843
+ timestamp: data.get('timestamp'),
2844
+ comment: data.get('comment'),
2845
+ devmode: data.get('devmode'),
2846
+ });
2847
+ }
2848
+ }
2849
+ export class GenesisAllocation {
2850
+ static get encodingSchema() {
2851
+ if (!this.encodingSchemaValue) {
2852
+ this.encodingSchemaValue = new NamedMapSchema([]);
2853
+ this.encodingSchemaValue.pushEntries({ key: 'addr', valueSchema: new StringSchema(), omitEmpty: true }, { key: 'comment', valueSchema: new StringSchema(), omitEmpty: true }, {
2854
+ key: 'state',
2855
+ valueSchema: UntypedValue.encodingSchema,
2856
+ omitEmpty: true,
2857
+ });
2858
+ }
2859
+ return this.encodingSchemaValue;
2860
+ }
2861
+ /**
2862
+ * Creates a new `GenesisAllocation` object.
2863
+ * @param addr -
2864
+ * @param comment -
2865
+ * @param state -
2866
+ */
2867
+ constructor({ addr, comment, state, }) {
2868
+ this.addr = addr;
2869
+ this.comment = comment;
2870
+ this.state = state;
2871
+ }
2872
+ // eslint-disable-next-line class-methods-use-this
2873
+ getEncodingSchema() {
2874
+ return GenesisAllocation.encodingSchema;
2875
+ }
2876
+ toEncodingData() {
2877
+ return new Map([
2878
+ ['addr', this.addr],
2879
+ ['comment', this.comment],
2880
+ ['state', this.state.toEncodingData()],
2881
+ ]);
2882
+ }
2883
+ static fromEncodingData(data) {
2884
+ if (!(data instanceof Map)) {
2885
+ throw new Error(`Invalid decoded GenesisAllocation: ${data}`);
2886
+ }
2887
+ return new GenesisAllocation({
2888
+ addr: data.get('addr'),
2889
+ comment: data.get('comment'),
2890
+ state: UntypedValue.fromEncodingData(data.get('state') ?? new Map()),
2891
+ });
2892
+ }
2893
+ }
2763
2894
  /**
2764
2895
  * Response containing the timestamp offset in seconds
2765
2896
  */
@@ -2836,55 +2967,6 @@ export class GetSyncRoundResponse {
2836
2967
  });
2837
2968
  }
2838
2969
  }
2839
- /**
2840
- * A single Delta containing the key, the previous value and the current value for
2841
- * a single round.
2842
- */
2843
- export class KvDelta {
2844
- static get encodingSchema() {
2845
- if (!this.encodingSchemaValue) {
2846
- this.encodingSchemaValue = new NamedMapSchema([]);
2847
- this.encodingSchemaValue.pushEntries({
2848
- key: 'key',
2849
- valueSchema: new OptionalSchema(new ByteArraySchema()),
2850
- omitEmpty: true,
2851
- }, {
2852
- key: 'value',
2853
- valueSchema: new OptionalSchema(new ByteArraySchema()),
2854
- omitEmpty: true,
2855
- });
2856
- }
2857
- return this.encodingSchemaValue;
2858
- }
2859
- /**
2860
- * Creates a new `KvDelta` object.
2861
- * @param key - The key, base64 encoded.
2862
- * @param value - The new value of the KV store entry, base64 encoded.
2863
- */
2864
- constructor({ key, value, }) {
2865
- this.key = typeof key === 'string' ? base64ToBytes(key) : key;
2866
- this.value = typeof value === 'string' ? base64ToBytes(value) : value;
2867
- }
2868
- // eslint-disable-next-line class-methods-use-this
2869
- getEncodingSchema() {
2870
- return KvDelta.encodingSchema;
2871
- }
2872
- toEncodingData() {
2873
- return new Map([
2874
- ['key', this.key],
2875
- ['value', this.value],
2876
- ]);
2877
- }
2878
- static fromEncodingData(data) {
2879
- if (!(data instanceof Map)) {
2880
- throw new Error(`Invalid decoded KvDelta: ${data}`);
2881
- }
2882
- return new KvDelta({
2883
- key: data.get('key'),
2884
- value: data.get('value'),
2885
- });
2886
- }
2887
- }
2888
2970
  /**
2889
2971
  * Contains a ledger delta for a single transaction group
2890
2972
  */