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.
- package/README.md +5 -5
- package/dist/browser/algosdk.min.js +1 -1
- package/dist/browser/algosdk.min.js.map +1 -1
- package/dist/cjs/client/v2/algod/getApplicationBoxes.js +58 -1
- package/dist/cjs/client/v2/algod/getApplicationBoxes.js.map +1 -1
- package/dist/cjs/client/v2/algod/models/types.js +164 -99
- package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
- package/dist/cjs/client/v2/indexer/models/types.js +10 -1
- package/dist/cjs/client/v2/indexer/models/types.js.map +1 -1
- package/dist/cjs/client/v2/indexer/searchAccounts.js +19 -0
- package/dist/cjs/client/v2/indexer/searchAccounts.js.map +1 -1
- package/dist/esm/client/v2/algod/getApplicationBoxes.js +58 -1
- package/dist/esm/client/v2/algod/getApplicationBoxes.js.map +1 -1
- package/dist/esm/client/v2/algod/models/types.js +161 -96
- package/dist/esm/client/v2/algod/models/types.js.map +1 -1
- package/dist/esm/client/v2/indexer/models/types.js +10 -1
- package/dist/esm/client/v2/indexer/models/types.js.map +1 -1
- package/dist/esm/client/v2/indexer/searchAccounts.js +19 -0
- package/dist/esm/client/v2/indexer/searchAccounts.js.map +1 -1
- package/dist/types/client/v2/algod/getApplicationBoxes.d.ts +49 -1
- package/dist/types/client/v2/algod/models/types.d.ts +93 -62
- package/dist/types/client/v2/indexer/models/types.d.ts +7 -1
- package/dist/types/client/v2/indexer/searchAccounts.d.ts +16 -0
- package/package.json +1 -1
- package/src/client/v2/algod/getApplicationBoxes.ts +61 -1
- package/src/client/v2/algod/models/types.ts +285 -145
- package/src/client/v2/indexer/models/types.ts +17 -0
- package/src/client/v2/indexer/searchAccounts.ts +20 -0
|
@@ -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,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,kDAAkD;IAClD,OAAO,CAAC,QAA4B;QAClC,OAAO,IAAA,wBAAU,EAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,2BAAgB,CAAC,CAAC;IAC9D,CAAC;CACF;
|
|
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"}
|
|
@@ -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).
|
|
10
|
+
* const boxesResponse = await algodClient.getApplicationBoxes(index).prefix('int:1234').next('b64:A==').values(true).do();
|
|
11
11
|
* const boxNames = boxesResponse.boxes.map(box => box.name);
|
|
12
12
|
* ```
|
|
13
13
|
*
|
|
@@ -46,6 +46,63 @@ 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
|
+
}
|
|
49
106
|
// eslint-disable-next-line class-methods-use-this
|
|
50
107
|
prepare(response) {
|
|
51
108
|
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,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;;;;;;;;;;;;;;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"}
|
|
@@ -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
|
}
|
|
@@ -1881,19 +1890,27 @@ export class Box {
|
|
|
1881
1890
|
static get encodingSchema() {
|
|
1882
1891
|
if (!this.encodingSchemaValue) {
|
|
1883
1892
|
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
1884
|
-
this.encodingSchemaValue.pushEntries({ key: 'name', valueSchema: new ByteArraySchema(), omitEmpty: true }, {
|
|
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
|
+
});
|
|
1885
1902
|
}
|
|
1886
1903
|
return this.encodingSchemaValue;
|
|
1887
1904
|
}
|
|
1888
1905
|
/**
|
|
1889
1906
|
* Creates a new `Box` object.
|
|
1890
|
-
* @param name -
|
|
1907
|
+
* @param name - The box name, base64 encoded
|
|
1891
1908
|
* @param round - The round for which this information is relevant
|
|
1892
|
-
* @param value -
|
|
1909
|
+
* @param value - The box value, base64 encoded.
|
|
1893
1910
|
*/
|
|
1894
1911
|
constructor({ name, round, value, }) {
|
|
1895
1912
|
this.name = typeof name === 'string' ? base64ToBytes(name) : name;
|
|
1896
|
-
this.round = ensureBigInt(round);
|
|
1913
|
+
this.round = typeof round === 'undefined' ? undefined : ensureBigInt(round);
|
|
1897
1914
|
this.value = typeof value === 'string' ? base64ToBytes(value) : value;
|
|
1898
1915
|
}
|
|
1899
1916
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -1918,44 +1935,6 @@ export class Box {
|
|
|
1918
1935
|
});
|
|
1919
1936
|
}
|
|
1920
1937
|
}
|
|
1921
|
-
/**
|
|
1922
|
-
* Box descriptor describes a Box.
|
|
1923
|
-
*/
|
|
1924
|
-
export class BoxDescriptor {
|
|
1925
|
-
static get encodingSchema() {
|
|
1926
|
-
if (!this.encodingSchemaValue) {
|
|
1927
|
-
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
1928
|
-
this.encodingSchemaValue.pushEntries({
|
|
1929
|
-
key: 'name',
|
|
1930
|
-
valueSchema: new ByteArraySchema(),
|
|
1931
|
-
omitEmpty: true,
|
|
1932
|
-
});
|
|
1933
|
-
}
|
|
1934
|
-
return this.encodingSchemaValue;
|
|
1935
|
-
}
|
|
1936
|
-
/**
|
|
1937
|
-
* Creates a new `BoxDescriptor` object.
|
|
1938
|
-
* @param name - Base64 encoded box name
|
|
1939
|
-
*/
|
|
1940
|
-
constructor({ name }) {
|
|
1941
|
-
this.name = typeof name === 'string' ? base64ToBytes(name) : name;
|
|
1942
|
-
}
|
|
1943
|
-
// eslint-disable-next-line class-methods-use-this
|
|
1944
|
-
getEncodingSchema() {
|
|
1945
|
-
return BoxDescriptor.encodingSchema;
|
|
1946
|
-
}
|
|
1947
|
-
toEncodingData() {
|
|
1948
|
-
return new Map([['name', this.name]]);
|
|
1949
|
-
}
|
|
1950
|
-
static fromEncodingData(data) {
|
|
1951
|
-
if (!(data instanceof Map)) {
|
|
1952
|
-
throw new Error(`Invalid decoded BoxDescriptor: ${data}`);
|
|
1953
|
-
}
|
|
1954
|
-
return new BoxDescriptor({
|
|
1955
|
-
name: data.get('name'),
|
|
1956
|
-
});
|
|
1957
|
-
}
|
|
1958
|
-
}
|
|
1959
1938
|
/**
|
|
1960
1939
|
* References a box of an application.
|
|
1961
1940
|
*/
|
|
@@ -1997,7 +1976,7 @@ export class BoxReference {
|
|
|
1997
1976
|
}
|
|
1998
1977
|
}
|
|
1999
1978
|
/**
|
|
2000
|
-
*
|
|
1979
|
+
* Boxes of an application
|
|
2001
1980
|
*/
|
|
2002
1981
|
export class BoxesResponse {
|
|
2003
1982
|
static get encodingSchema() {
|
|
@@ -2005,7 +1984,11 @@ export class BoxesResponse {
|
|
|
2005
1984
|
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
2006
1985
|
this.encodingSchemaValue.pushEntries({
|
|
2007
1986
|
key: 'boxes',
|
|
2008
|
-
valueSchema: new ArraySchema(
|
|
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()),
|
|
2009
1992
|
omitEmpty: true,
|
|
2010
1993
|
});
|
|
2011
1994
|
}
|
|
@@ -2014,9 +1997,14 @@ export class BoxesResponse {
|
|
|
2014
1997
|
/**
|
|
2015
1998
|
* Creates a new `BoxesResponse` object.
|
|
2016
1999
|
* @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.
|
|
2017
2003
|
*/
|
|
2018
|
-
constructor({ boxes }) {
|
|
2004
|
+
constructor({ boxes, round, nextToken, }) {
|
|
2019
2005
|
this.boxes = boxes;
|
|
2006
|
+
this.round = ensureSafeInteger(round);
|
|
2007
|
+
this.nextToken = nextToken;
|
|
2020
2008
|
}
|
|
2021
2009
|
// eslint-disable-next-line class-methods-use-this
|
|
2022
2010
|
getEncodingSchema() {
|
|
@@ -2025,6 +2013,8 @@ export class BoxesResponse {
|
|
|
2025
2013
|
toEncodingData() {
|
|
2026
2014
|
return new Map([
|
|
2027
2015
|
['boxes', this.boxes.map((v) => v.toEncodingData())],
|
|
2016
|
+
['round', this.round],
|
|
2017
|
+
['next-token', this.nextToken],
|
|
2028
2018
|
]);
|
|
2029
2019
|
}
|
|
2030
2020
|
static fromEncodingData(data) {
|
|
@@ -2032,7 +2022,9 @@ export class BoxesResponse {
|
|
|
2032
2022
|
throw new Error(`Invalid decoded BoxesResponse: ${data}`);
|
|
2033
2023
|
}
|
|
2034
2024
|
return new BoxesResponse({
|
|
2035
|
-
boxes: (data.get('boxes') ?? []).map((v) =>
|
|
2025
|
+
boxes: (data.get('boxes') ?? []).map((v) => Box.fromEncodingData(v)),
|
|
2026
|
+
round: data.get('round'),
|
|
2027
|
+
nextToken: data.get('next-token'),
|
|
2036
2028
|
});
|
|
2037
2029
|
}
|
|
2038
2030
|
}
|
|
@@ -2760,6 +2752,128 @@ export class EvalDeltaKeyValue {
|
|
|
2760
2752
|
});
|
|
2761
2753
|
}
|
|
2762
2754
|
}
|
|
2755
|
+
export class Genesis {
|
|
2756
|
+
static get encodingSchema() {
|
|
2757
|
+
if (!this.encodingSchemaValue) {
|
|
2758
|
+
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
2759
|
+
this.encodingSchemaValue.pushEntries({
|
|
2760
|
+
key: 'alloc',
|
|
2761
|
+
valueSchema: new ArraySchema(GenesisAllocation.encodingSchema),
|
|
2762
|
+
omitEmpty: true,
|
|
2763
|
+
}, { 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 }, {
|
|
2764
|
+
key: 'comment',
|
|
2765
|
+
valueSchema: new OptionalSchema(new StringSchema()),
|
|
2766
|
+
omitEmpty: true,
|
|
2767
|
+
}, {
|
|
2768
|
+
key: 'devmode',
|
|
2769
|
+
valueSchema: new OptionalSchema(new BooleanSchema()),
|
|
2770
|
+
omitEmpty: true,
|
|
2771
|
+
});
|
|
2772
|
+
}
|
|
2773
|
+
return this.encodingSchemaValue;
|
|
2774
|
+
}
|
|
2775
|
+
/**
|
|
2776
|
+
* Creates a new `Genesis` object.
|
|
2777
|
+
* @param alloc -
|
|
2778
|
+
* @param fees -
|
|
2779
|
+
* @param id -
|
|
2780
|
+
* @param network -
|
|
2781
|
+
* @param proto -
|
|
2782
|
+
* @param rwd -
|
|
2783
|
+
* @param timestamp -
|
|
2784
|
+
* @param comment -
|
|
2785
|
+
* @param devmode -
|
|
2786
|
+
*/
|
|
2787
|
+
constructor({ alloc, fees, id, network, proto, rwd, timestamp, comment, devmode, }) {
|
|
2788
|
+
this.alloc = alloc;
|
|
2789
|
+
this.fees = fees;
|
|
2790
|
+
this.id = id;
|
|
2791
|
+
this.network = network;
|
|
2792
|
+
this.proto = proto;
|
|
2793
|
+
this.rwd = rwd;
|
|
2794
|
+
this.timestamp = ensureSafeInteger(timestamp);
|
|
2795
|
+
this.comment = comment;
|
|
2796
|
+
this.devmode = devmode;
|
|
2797
|
+
}
|
|
2798
|
+
// eslint-disable-next-line class-methods-use-this
|
|
2799
|
+
getEncodingSchema() {
|
|
2800
|
+
return Genesis.encodingSchema;
|
|
2801
|
+
}
|
|
2802
|
+
toEncodingData() {
|
|
2803
|
+
return new Map([
|
|
2804
|
+
['alloc', this.alloc.map((v) => v.toEncodingData())],
|
|
2805
|
+
['fees', this.fees],
|
|
2806
|
+
['id', this.id],
|
|
2807
|
+
['network', this.network],
|
|
2808
|
+
['proto', this.proto],
|
|
2809
|
+
['rwd', this.rwd],
|
|
2810
|
+
['timestamp', this.timestamp],
|
|
2811
|
+
['comment', this.comment],
|
|
2812
|
+
['devmode', this.devmode],
|
|
2813
|
+
]);
|
|
2814
|
+
}
|
|
2815
|
+
static fromEncodingData(data) {
|
|
2816
|
+
if (!(data instanceof Map)) {
|
|
2817
|
+
throw new Error(`Invalid decoded Genesis: ${data}`);
|
|
2818
|
+
}
|
|
2819
|
+
return new Genesis({
|
|
2820
|
+
alloc: (data.get('alloc') ?? []).map((v) => GenesisAllocation.fromEncodingData(v)),
|
|
2821
|
+
fees: data.get('fees'),
|
|
2822
|
+
id: data.get('id'),
|
|
2823
|
+
network: data.get('network'),
|
|
2824
|
+
proto: data.get('proto'),
|
|
2825
|
+
rwd: data.get('rwd'),
|
|
2826
|
+
timestamp: data.get('timestamp'),
|
|
2827
|
+
comment: data.get('comment'),
|
|
2828
|
+
devmode: data.get('devmode'),
|
|
2829
|
+
});
|
|
2830
|
+
}
|
|
2831
|
+
}
|
|
2832
|
+
export class GenesisAllocation {
|
|
2833
|
+
static get encodingSchema() {
|
|
2834
|
+
if (!this.encodingSchemaValue) {
|
|
2835
|
+
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
2836
|
+
this.encodingSchemaValue.pushEntries({ key: 'addr', valueSchema: new StringSchema(), omitEmpty: true }, { key: 'comment', valueSchema: new StringSchema(), omitEmpty: true }, {
|
|
2837
|
+
key: 'state',
|
|
2838
|
+
valueSchema: UntypedValue.encodingSchema,
|
|
2839
|
+
omitEmpty: true,
|
|
2840
|
+
});
|
|
2841
|
+
}
|
|
2842
|
+
return this.encodingSchemaValue;
|
|
2843
|
+
}
|
|
2844
|
+
/**
|
|
2845
|
+
* Creates a new `GenesisAllocation` object.
|
|
2846
|
+
* @param addr -
|
|
2847
|
+
* @param comment -
|
|
2848
|
+
* @param state -
|
|
2849
|
+
*/
|
|
2850
|
+
constructor({ addr, comment, state, }) {
|
|
2851
|
+
this.addr = addr;
|
|
2852
|
+
this.comment = comment;
|
|
2853
|
+
this.state = state;
|
|
2854
|
+
}
|
|
2855
|
+
// eslint-disable-next-line class-methods-use-this
|
|
2856
|
+
getEncodingSchema() {
|
|
2857
|
+
return GenesisAllocation.encodingSchema;
|
|
2858
|
+
}
|
|
2859
|
+
toEncodingData() {
|
|
2860
|
+
return new Map([
|
|
2861
|
+
['addr', this.addr],
|
|
2862
|
+
['comment', this.comment],
|
|
2863
|
+
['state', this.state.toEncodingData()],
|
|
2864
|
+
]);
|
|
2865
|
+
}
|
|
2866
|
+
static fromEncodingData(data) {
|
|
2867
|
+
if (!(data instanceof Map)) {
|
|
2868
|
+
throw new Error(`Invalid decoded GenesisAllocation: ${data}`);
|
|
2869
|
+
}
|
|
2870
|
+
return new GenesisAllocation({
|
|
2871
|
+
addr: data.get('addr'),
|
|
2872
|
+
comment: data.get('comment'),
|
|
2873
|
+
state: UntypedValue.fromEncodingData(data.get('state') ?? new Map()),
|
|
2874
|
+
});
|
|
2875
|
+
}
|
|
2876
|
+
}
|
|
2763
2877
|
/**
|
|
2764
2878
|
* Response containing the timestamp offset in seconds
|
|
2765
2879
|
*/
|
|
@@ -2836,55 +2950,6 @@ export class GetSyncRoundResponse {
|
|
|
2836
2950
|
});
|
|
2837
2951
|
}
|
|
2838
2952
|
}
|
|
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
2953
|
/**
|
|
2889
2954
|
* Contains a ledger delta for a single transaction group
|
|
2890
2955
|
*/
|