algosdk 3.3.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.
@@ -7,7 +7,7 @@ import { BoxesResponse } from './models/types.js';
7
7
  * #### Example
8
8
  * ```typescript
9
9
  * const index = 60553466;
10
- * const boxesResponse = await algodClient.getApplicationBoxes(index).prefix('int:1234').next('b64:A==').values(true).do();
10
+ * const boxesResponse = await algodClient.getApplicationBoxes(index).max(3).do();
11
11
  * const boxNames = boxesResponse.boxes.map(box => box.name);
12
12
  * ```
13
13
  *
@@ -46,63 +46,6 @@ export default class GetApplicationBoxes extends JSONRequest {
46
46
  this.query.max = max;
47
47
  return this;
48
48
  }
49
- /**
50
- * A box name prefix, in the goal app call arg form 'encoding:value'. For ints, use the form 'int:1234'. For raw bytes, use the form 'b64:A=='. For printable strings, use the form 'str:hello'. For addresses, use the form 'addr:XYZ...'.
51
- *
52
- * #### Example
53
- * ```typescript
54
- * const prefix = 'int:1234';
55
- * const boxesResult = await algodClient
56
- * .GetApplicationBoxes(1234)
57
- * .prefix(prefix)
58
- * .do();
59
- * ```
60
- *
61
- * @param prefix - the box name prefix in the form 'encoding:value'
62
- * @category query
63
- */
64
- prefix(prefix) {
65
- this.query.prefix = prefix;
66
- return this;
67
- }
68
- /**
69
- * A box name, in the goal app call arg form 'encoding:value'. When provided, the returned boxes begin (lexographically) with the supplied name. Callers may implement pagination by reinvoking the endpoint with the token from a previous call's next-token.
70
- *
71
- * #### Example
72
- * ```typescript
73
- * const next = 'int:1234';
74
- * const boxesResult = await algodClient
75
- * .GetApplicationBoxes(1234)
76
- * .next(next)
77
- * .do();
78
- * ```
79
- *
80
- * @param next - the next box name for pagination, in the goal app call arg form 'encoding:value'
81
- * @category query
82
- */
83
- next(next) {
84
- this.query.next = next;
85
- return this;
86
- }
87
- /**
88
- * If true, box values will be returned.
89
- *
90
- * #### Example
91
- * ```typescript
92
- * const values = true;
93
- * const boxesResult = await algodClient
94
- * .GetApplicationBoxes(1234)
95
- * .values(values)
96
- * .do();
97
- * ```
98
- *
99
- * @param values - if true, box values will be returned
100
- * @category query
101
- */
102
- values(values) {
103
- this.query.values = values;
104
- return this;
105
- }
106
49
  // eslint-disable-next-line class-methods-use-this
107
50
  prepare(response) {
108
51
  return decodeJSON(response.getJSONText(), BoxesResponse);
@@ -1 +1 @@
1
- {"version":3,"file":"getApplicationBoxes.js","sourceRoot":"","sources":["../../../../../src/client/v2/algod/getApplicationBoxes.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,WAA0B;IAGzE,YAAY,CAAa,EAAE,KAAsB;QAC/C,KAAK,CAAC,CAAC,CAAC,CAAC;QACT,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC3B,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,IAAI;QACF,OAAO,oBAAoB,IAAI,CAAC,KAAK,QAAQ,CAAC;IAChD,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,GAAG,CAAC,GAAW;QACb,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,MAAc;QACnB,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,IAAI,CAAC,IAAY;QACf,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,MAAe;QACpB,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,kDAAkD;IAClD,OAAO,CAAC,QAA4B;QAClC,OAAO,UAAU,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,aAAa,CAAC,CAAC;IAC3D,CAAC;CACF"}
1
+ {"version":3,"file":"getApplicationBoxes.js","sourceRoot":"","sources":["../../../../../src/client/v2/algod/getApplicationBoxes.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,WAA0B;IAGzE,YAAY,CAAa,EAAE,KAAsB;QAC/C,KAAK,CAAC,CAAC,CAAC,CAAC;QACT,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC3B,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,IAAI;QACF,OAAO,oBAAoB,IAAI,CAAC,KAAK,QAAQ,CAAC;IAChD,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,GAAG,CAAC,GAAW;QACb,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,kDAAkD;IAClD,OAAO,CAAC,QAA4B;QAClC,OAAO,UAAU,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,aAAa,CAAC,CAAC;IAC3D,CAAC;CACF"}
@@ -1890,15 +1890,7 @@ export class Box {
1890
1890
  static get encodingSchema() {
1891
1891
  if (!this.encodingSchemaValue) {
1892
1892
  this.encodingSchemaValue = new NamedMapSchema([]);
1893
- this.encodingSchemaValue.pushEntries({ key: 'name', valueSchema: new ByteArraySchema(), omitEmpty: true }, {
1894
- key: 'round',
1895
- valueSchema: new OptionalSchema(new Uint64Schema()),
1896
- omitEmpty: true,
1897
- }, {
1898
- key: 'value',
1899
- valueSchema: new OptionalSchema(new ByteArraySchema()),
1900
- omitEmpty: true,
1901
- });
1893
+ this.encodingSchemaValue.pushEntries({ key: 'name', valueSchema: new ByteArraySchema(), omitEmpty: true }, { key: 'round', valueSchema: new Uint64Schema(), omitEmpty: true }, { key: 'value', valueSchema: new ByteArraySchema(), omitEmpty: true });
1902
1894
  }
1903
1895
  return this.encodingSchemaValue;
1904
1896
  }
@@ -1910,7 +1902,7 @@ export class Box {
1910
1902
  */
1911
1903
  constructor({ name, round, value, }) {
1912
1904
  this.name = typeof name === 'string' ? base64ToBytes(name) : name;
1913
- this.round = typeof round === 'undefined' ? undefined : ensureBigInt(round);
1905
+ this.round = ensureBigInt(round);
1914
1906
  this.value = typeof value === 'string' ? base64ToBytes(value) : value;
1915
1907
  }
1916
1908
  // eslint-disable-next-line class-methods-use-this
@@ -1935,6 +1927,44 @@ export class Box {
1935
1927
  });
1936
1928
  }
1937
1929
  }
1930
+ /**
1931
+ * Box descriptor describes a Box.
1932
+ */
1933
+ export class BoxDescriptor {
1934
+ static get encodingSchema() {
1935
+ if (!this.encodingSchemaValue) {
1936
+ this.encodingSchemaValue = new NamedMapSchema([]);
1937
+ this.encodingSchemaValue.pushEntries({
1938
+ key: 'name',
1939
+ valueSchema: new ByteArraySchema(),
1940
+ omitEmpty: true,
1941
+ });
1942
+ }
1943
+ return this.encodingSchemaValue;
1944
+ }
1945
+ /**
1946
+ * Creates a new `BoxDescriptor` object.
1947
+ * @param name - Base64 encoded box name
1948
+ */
1949
+ constructor({ name }) {
1950
+ this.name = typeof name === 'string' ? base64ToBytes(name) : name;
1951
+ }
1952
+ // eslint-disable-next-line class-methods-use-this
1953
+ getEncodingSchema() {
1954
+ return BoxDescriptor.encodingSchema;
1955
+ }
1956
+ toEncodingData() {
1957
+ return new Map([['name', this.name]]);
1958
+ }
1959
+ static fromEncodingData(data) {
1960
+ if (!(data instanceof Map)) {
1961
+ throw new Error(`Invalid decoded BoxDescriptor: ${data}`);
1962
+ }
1963
+ return new BoxDescriptor({
1964
+ name: data.get('name'),
1965
+ });
1966
+ }
1967
+ }
1938
1968
  /**
1939
1969
  * References a box of an application.
1940
1970
  */
@@ -1976,7 +2006,7 @@ export class BoxReference {
1976
2006
  }
1977
2007
  }
1978
2008
  /**
1979
- * Boxes of an application
2009
+ * * Box names of an application
1980
2010
  */
1981
2011
  export class BoxesResponse {
1982
2012
  static get encodingSchema() {
@@ -1984,11 +2014,7 @@ export class BoxesResponse {
1984
2014
  this.encodingSchemaValue = new NamedMapSchema([]);
1985
2015
  this.encodingSchemaValue.pushEntries({
1986
2016
  key: 'boxes',
1987
- valueSchema: new ArraySchema(Box.encodingSchema),
1988
- omitEmpty: true,
1989
- }, { key: 'round', valueSchema: new Uint64Schema(), omitEmpty: true }, {
1990
- key: 'next-token',
1991
- valueSchema: new OptionalSchema(new StringSchema()),
2017
+ valueSchema: new ArraySchema(BoxDescriptor.encodingSchema),
1992
2018
  omitEmpty: true,
1993
2019
  });
1994
2020
  }
@@ -1997,14 +2023,9 @@ export class BoxesResponse {
1997
2023
  /**
1998
2024
  * Creates a new `BoxesResponse` object.
1999
2025
  * @param boxes -
2000
- * @param round - The round for which this information is relevant.
2001
- * @param nextToken - Used for pagination, when making another request provide this token with the
2002
- * next parameter.
2003
2026
  */
2004
- constructor({ boxes, round, nextToken, }) {
2027
+ constructor({ boxes }) {
2005
2028
  this.boxes = boxes;
2006
- this.round = ensureSafeInteger(round);
2007
- this.nextToken = nextToken;
2008
2029
  }
2009
2030
  // eslint-disable-next-line class-methods-use-this
2010
2031
  getEncodingSchema() {
@@ -2013,8 +2034,6 @@ export class BoxesResponse {
2013
2034
  toEncodingData() {
2014
2035
  return new Map([
2015
2036
  ['boxes', this.boxes.map((v) => v.toEncodingData())],
2016
- ['round', this.round],
2017
- ['next-token', this.nextToken],
2018
2037
  ]);
2019
2038
  }
2020
2039
  static fromEncodingData(data) {
@@ -2022,9 +2041,7 @@ export class BoxesResponse {
2022
2041
  throw new Error(`Invalid decoded BoxesResponse: ${data}`);
2023
2042
  }
2024
2043
  return new BoxesResponse({
2025
- boxes: (data.get('boxes') ?? []).map((v) => Box.fromEncodingData(v)),
2026
- round: data.get('round'),
2027
- nextToken: data.get('next-token'),
2044
+ boxes: (data.get('boxes') ?? []).map((v) => BoxDescriptor.fromEncodingData(v)),
2028
2045
  });
2029
2046
  }
2030
2047
  }