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.
- package/README.md +4 -4
- 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 +1 -58
- package/dist/cjs/client/v2/algod/getApplicationBoxes.js.map +1 -1
- package/dist/cjs/client/v2/algod/models/types.js +47 -29
- package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
- package/dist/esm/client/v2/algod/getApplicationBoxes.js +1 -58
- package/dist/esm/client/v2/algod/getApplicationBoxes.js.map +1 -1
- package/dist/esm/client/v2/algod/models/types.js +44 -27
- package/dist/esm/client/v2/algod/models/types.js.map +1 -1
- package/dist/types/client/v2/algod/getApplicationBoxes.d.ts +1 -49
- package/dist/types/client/v2/algod/models/types.d.ts +29 -22
- package/package.json +1 -1
- package/src/client/v2/algod/getApplicationBoxes.ts +1 -61
- package/src/client/v2/algod/models/types.ts +66 -60
|
@@ -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).max(3).do();
|
|
11
11
|
* const boxNames = boxesResponse.boxes.map(box => box.name);
|
|
12
12
|
* ```
|
|
13
13
|
*
|
|
@@ -38,53 +38,5 @@ export default class GetApplicationBoxes extends JSONRequest<BoxesResponse> {
|
|
|
38
38
|
* @category query
|
|
39
39
|
*/
|
|
40
40
|
max(max: number): this;
|
|
41
|
-
/**
|
|
42
|
-
* 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...'.
|
|
43
|
-
*
|
|
44
|
-
* #### Example
|
|
45
|
-
* ```typescript
|
|
46
|
-
* const prefix = 'int:1234';
|
|
47
|
-
* const boxesResult = await algodClient
|
|
48
|
-
* .GetApplicationBoxes(1234)
|
|
49
|
-
* .prefix(prefix)
|
|
50
|
-
* .do();
|
|
51
|
-
* ```
|
|
52
|
-
*
|
|
53
|
-
* @param prefix - the box name prefix in the form 'encoding:value'
|
|
54
|
-
* @category query
|
|
55
|
-
*/
|
|
56
|
-
prefix(prefix: string): this;
|
|
57
|
-
/**
|
|
58
|
-
* 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.
|
|
59
|
-
*
|
|
60
|
-
* #### Example
|
|
61
|
-
* ```typescript
|
|
62
|
-
* const next = 'int:1234';
|
|
63
|
-
* const boxesResult = await algodClient
|
|
64
|
-
* .GetApplicationBoxes(1234)
|
|
65
|
-
* .next(next)
|
|
66
|
-
* .do();
|
|
67
|
-
* ```
|
|
68
|
-
*
|
|
69
|
-
* @param next - the next box name for pagination, in the goal app call arg form 'encoding:value'
|
|
70
|
-
* @category query
|
|
71
|
-
*/
|
|
72
|
-
next(next: string): this;
|
|
73
|
-
/**
|
|
74
|
-
* If true, box values will be returned.
|
|
75
|
-
*
|
|
76
|
-
* #### Example
|
|
77
|
-
* ```typescript
|
|
78
|
-
* const values = true;
|
|
79
|
-
* const boxesResult = await algodClient
|
|
80
|
-
* .GetApplicationBoxes(1234)
|
|
81
|
-
* .values(values)
|
|
82
|
-
* .do();
|
|
83
|
-
* ```
|
|
84
|
-
*
|
|
85
|
-
* @param values - if true, box values will be returned
|
|
86
|
-
* @category query
|
|
87
|
-
*/
|
|
88
|
-
values(values: boolean): this;
|
|
89
41
|
prepare(response: HTTPClientResponse): BoxesResponse;
|
|
90
42
|
}
|
|
@@ -1180,11 +1180,11 @@ export declare class Box implements Encodable {
|
|
|
1180
1180
|
/**
|
|
1181
1181
|
* The round for which this information is relevant
|
|
1182
1182
|
*/
|
|
1183
|
-
round
|
|
1183
|
+
round: bigint;
|
|
1184
1184
|
/**
|
|
1185
1185
|
* The box value, base64 encoded.
|
|
1186
1186
|
*/
|
|
1187
|
-
value
|
|
1187
|
+
value: Uint8Array;
|
|
1188
1188
|
/**
|
|
1189
1189
|
* Creates a new `Box` object.
|
|
1190
1190
|
* @param name - The box name, base64 encoded
|
|
@@ -1193,13 +1193,34 @@ export declare class Box implements Encodable {
|
|
|
1193
1193
|
*/
|
|
1194
1194
|
constructor({ name, round, value, }: {
|
|
1195
1195
|
name: string | Uint8Array;
|
|
1196
|
-
round
|
|
1197
|
-
value
|
|
1196
|
+
round: number | bigint;
|
|
1197
|
+
value: string | Uint8Array;
|
|
1198
1198
|
});
|
|
1199
1199
|
getEncodingSchema(): Schema;
|
|
1200
1200
|
toEncodingData(): Map<string, unknown>;
|
|
1201
1201
|
static fromEncodingData(data: unknown): Box;
|
|
1202
1202
|
}
|
|
1203
|
+
/**
|
|
1204
|
+
* Box descriptor describes a Box.
|
|
1205
|
+
*/
|
|
1206
|
+
export declare class BoxDescriptor implements Encodable {
|
|
1207
|
+
private static encodingSchemaValue;
|
|
1208
|
+
static get encodingSchema(): Schema;
|
|
1209
|
+
/**
|
|
1210
|
+
* Base64 encoded box name
|
|
1211
|
+
*/
|
|
1212
|
+
name: Uint8Array;
|
|
1213
|
+
/**
|
|
1214
|
+
* Creates a new `BoxDescriptor` object.
|
|
1215
|
+
* @param name - Base64 encoded box name
|
|
1216
|
+
*/
|
|
1217
|
+
constructor({ name }: {
|
|
1218
|
+
name: string | Uint8Array;
|
|
1219
|
+
});
|
|
1220
|
+
getEncodingSchema(): Schema;
|
|
1221
|
+
toEncodingData(): Map<string, unknown>;
|
|
1222
|
+
static fromEncodingData(data: unknown): BoxDescriptor;
|
|
1223
|
+
}
|
|
1203
1224
|
/**
|
|
1204
1225
|
* References a box of an application.
|
|
1205
1226
|
*/
|
|
@@ -1228,32 +1249,18 @@ export declare class BoxReference implements Encodable {
|
|
|
1228
1249
|
static fromEncodingData(data: unknown): BoxReference;
|
|
1229
1250
|
}
|
|
1230
1251
|
/**
|
|
1231
|
-
*
|
|
1252
|
+
* * Box names of an application
|
|
1232
1253
|
*/
|
|
1233
1254
|
export declare class BoxesResponse implements Encodable {
|
|
1234
1255
|
private static encodingSchemaValue;
|
|
1235
1256
|
static get encodingSchema(): Schema;
|
|
1236
|
-
boxes:
|
|
1237
|
-
/**
|
|
1238
|
-
* The round for which this information is relevant.
|
|
1239
|
-
*/
|
|
1240
|
-
round: number;
|
|
1241
|
-
/**
|
|
1242
|
-
* Used for pagination, when making another request provide this token with the
|
|
1243
|
-
* next parameter.
|
|
1244
|
-
*/
|
|
1245
|
-
nextToken?: string;
|
|
1257
|
+
boxes: BoxDescriptor[];
|
|
1246
1258
|
/**
|
|
1247
1259
|
* Creates a new `BoxesResponse` object.
|
|
1248
1260
|
* @param boxes -
|
|
1249
|
-
* @param round - The round for which this information is relevant.
|
|
1250
|
-
* @param nextToken - Used for pagination, when making another request provide this token with the
|
|
1251
|
-
* next parameter.
|
|
1252
1261
|
*/
|
|
1253
|
-
constructor({ boxes
|
|
1254
|
-
boxes:
|
|
1255
|
-
round: number | bigint;
|
|
1256
|
-
nextToken?: string;
|
|
1262
|
+
constructor({ boxes }: {
|
|
1263
|
+
boxes: BoxDescriptor[];
|
|
1257
1264
|
});
|
|
1258
1265
|
getEncodingSchema(): Schema;
|
|
1259
1266
|
toEncodingData(): Map<string, unknown>;
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@ import { BoxesResponse } from './models/types.js';
|
|
|
9
9
|
* #### Example
|
|
10
10
|
* ```typescript
|
|
11
11
|
* const index = 60553466;
|
|
12
|
-
* const boxesResponse = await algodClient.getApplicationBoxes(index).
|
|
12
|
+
* const boxesResponse = await algodClient.getApplicationBoxes(index).max(3).do();
|
|
13
13
|
* const boxNames = boxesResponse.boxes.map(box => box.name);
|
|
14
14
|
* ```
|
|
15
15
|
*
|
|
@@ -53,66 +53,6 @@ export default class GetApplicationBoxes extends JSONRequest<BoxesResponse> {
|
|
|
53
53
|
return this;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
/**
|
|
57
|
-
* 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...'.
|
|
58
|
-
*
|
|
59
|
-
* #### Example
|
|
60
|
-
* ```typescript
|
|
61
|
-
* const prefix = 'int:1234';
|
|
62
|
-
* const boxesResult = await algodClient
|
|
63
|
-
* .GetApplicationBoxes(1234)
|
|
64
|
-
* .prefix(prefix)
|
|
65
|
-
* .do();
|
|
66
|
-
* ```
|
|
67
|
-
*
|
|
68
|
-
* @param prefix - the box name prefix in the form 'encoding:value'
|
|
69
|
-
* @category query
|
|
70
|
-
*/
|
|
71
|
-
prefix(prefix: string) {
|
|
72
|
-
this.query.prefix = prefix;
|
|
73
|
-
return this;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* 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.
|
|
78
|
-
*
|
|
79
|
-
* #### Example
|
|
80
|
-
* ```typescript
|
|
81
|
-
* const next = 'int:1234';
|
|
82
|
-
* const boxesResult = await algodClient
|
|
83
|
-
* .GetApplicationBoxes(1234)
|
|
84
|
-
* .next(next)
|
|
85
|
-
* .do();
|
|
86
|
-
* ```
|
|
87
|
-
*
|
|
88
|
-
* @param next - the next box name for pagination, in the goal app call arg form 'encoding:value'
|
|
89
|
-
* @category query
|
|
90
|
-
*/
|
|
91
|
-
next(next: string) {
|
|
92
|
-
this.query.next = next;
|
|
93
|
-
return this;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* If true, box values will be returned.
|
|
98
|
-
*
|
|
99
|
-
* #### Example
|
|
100
|
-
* ```typescript
|
|
101
|
-
* const values = true;
|
|
102
|
-
* const boxesResult = await algodClient
|
|
103
|
-
* .GetApplicationBoxes(1234)
|
|
104
|
-
* .values(values)
|
|
105
|
-
* .do();
|
|
106
|
-
* ```
|
|
107
|
-
*
|
|
108
|
-
* @param values - if true, box values will be returned
|
|
109
|
-
* @category query
|
|
110
|
-
*/
|
|
111
|
-
values(values: boolean) {
|
|
112
|
-
this.query.values = values;
|
|
113
|
-
return this;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
56
|
// eslint-disable-next-line class-methods-use-this
|
|
117
57
|
prepare(response: HTTPClientResponse): BoxesResponse {
|
|
118
58
|
return decodeJSON(response.getJSONText(), BoxesResponse);
|
|
@@ -3113,16 +3113,8 @@ export class Box implements Encodable {
|
|
|
3113
3113
|
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
3114
3114
|
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
3115
3115
|
{ key: 'name', valueSchema: new ByteArraySchema(), omitEmpty: true },
|
|
3116
|
-
{
|
|
3117
|
-
|
|
3118
|
-
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
3119
|
-
omitEmpty: true,
|
|
3120
|
-
},
|
|
3121
|
-
{
|
|
3122
|
-
key: 'value',
|
|
3123
|
-
valueSchema: new OptionalSchema(new ByteArraySchema()),
|
|
3124
|
-
omitEmpty: true,
|
|
3125
|
-
}
|
|
3116
|
+
{ key: 'round', valueSchema: new Uint64Schema(), omitEmpty: true },
|
|
3117
|
+
{ key: 'value', valueSchema: new ByteArraySchema(), omitEmpty: true }
|
|
3126
3118
|
);
|
|
3127
3119
|
}
|
|
3128
3120
|
return this.encodingSchemaValue;
|
|
@@ -3136,12 +3128,12 @@ export class Box implements Encodable {
|
|
|
3136
3128
|
/**
|
|
3137
3129
|
* The round for which this information is relevant
|
|
3138
3130
|
*/
|
|
3139
|
-
public round
|
|
3131
|
+
public round: bigint;
|
|
3140
3132
|
|
|
3141
3133
|
/**
|
|
3142
3134
|
* The box value, base64 encoded.
|
|
3143
3135
|
*/
|
|
3144
|
-
public value
|
|
3136
|
+
public value: Uint8Array;
|
|
3145
3137
|
|
|
3146
3138
|
/**
|
|
3147
3139
|
* Creates a new `Box` object.
|
|
@@ -3155,11 +3147,11 @@ export class Box implements Encodable {
|
|
|
3155
3147
|
value,
|
|
3156
3148
|
}: {
|
|
3157
3149
|
name: string | Uint8Array;
|
|
3158
|
-
round
|
|
3159
|
-
value
|
|
3150
|
+
round: number | bigint;
|
|
3151
|
+
value: string | Uint8Array;
|
|
3160
3152
|
}) {
|
|
3161
3153
|
this.name = typeof name === 'string' ? base64ToBytes(name) : name;
|
|
3162
|
-
this.round =
|
|
3154
|
+
this.round = ensureBigInt(round);
|
|
3163
3155
|
this.value = typeof value === 'string' ? base64ToBytes(value) : value;
|
|
3164
3156
|
}
|
|
3165
3157
|
|
|
@@ -3188,6 +3180,56 @@ export class Box implements Encodable {
|
|
|
3188
3180
|
}
|
|
3189
3181
|
}
|
|
3190
3182
|
|
|
3183
|
+
/**
|
|
3184
|
+
* Box descriptor describes a Box.
|
|
3185
|
+
*/
|
|
3186
|
+
export class BoxDescriptor implements Encodable {
|
|
3187
|
+
private static encodingSchemaValue: Schema | undefined;
|
|
3188
|
+
|
|
3189
|
+
static get encodingSchema(): Schema {
|
|
3190
|
+
if (!this.encodingSchemaValue) {
|
|
3191
|
+
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
3192
|
+
(this.encodingSchemaValue as NamedMapSchema).pushEntries({
|
|
3193
|
+
key: 'name',
|
|
3194
|
+
valueSchema: new ByteArraySchema(),
|
|
3195
|
+
omitEmpty: true,
|
|
3196
|
+
});
|
|
3197
|
+
}
|
|
3198
|
+
return this.encodingSchemaValue;
|
|
3199
|
+
}
|
|
3200
|
+
|
|
3201
|
+
/**
|
|
3202
|
+
* Base64 encoded box name
|
|
3203
|
+
*/
|
|
3204
|
+
public name: Uint8Array;
|
|
3205
|
+
|
|
3206
|
+
/**
|
|
3207
|
+
* Creates a new `BoxDescriptor` object.
|
|
3208
|
+
* @param name - Base64 encoded box name
|
|
3209
|
+
*/
|
|
3210
|
+
constructor({ name }: { name: string | Uint8Array }) {
|
|
3211
|
+
this.name = typeof name === 'string' ? base64ToBytes(name) : name;
|
|
3212
|
+
}
|
|
3213
|
+
|
|
3214
|
+
// eslint-disable-next-line class-methods-use-this
|
|
3215
|
+
getEncodingSchema(): Schema {
|
|
3216
|
+
return BoxDescriptor.encodingSchema;
|
|
3217
|
+
}
|
|
3218
|
+
|
|
3219
|
+
toEncodingData(): Map<string, unknown> {
|
|
3220
|
+
return new Map<string, unknown>([['name', this.name]]);
|
|
3221
|
+
}
|
|
3222
|
+
|
|
3223
|
+
static fromEncodingData(data: unknown): BoxDescriptor {
|
|
3224
|
+
if (!(data instanceof Map)) {
|
|
3225
|
+
throw new Error(`Invalid decoded BoxDescriptor: ${data}`);
|
|
3226
|
+
}
|
|
3227
|
+
return new BoxDescriptor({
|
|
3228
|
+
name: data.get('name'),
|
|
3229
|
+
});
|
|
3230
|
+
}
|
|
3231
|
+
}
|
|
3232
|
+
|
|
3191
3233
|
/**
|
|
3192
3234
|
* References a box of an application.
|
|
3193
3235
|
*/
|
|
@@ -3255,7 +3297,7 @@ export class BoxReference implements Encodable {
|
|
|
3255
3297
|
}
|
|
3256
3298
|
|
|
3257
3299
|
/**
|
|
3258
|
-
*
|
|
3300
|
+
* * Box names of an application
|
|
3259
3301
|
*/
|
|
3260
3302
|
export class BoxesResponse implements Encodable {
|
|
3261
3303
|
private static encodingSchemaValue: Schema | undefined;
|
|
@@ -3263,55 +3305,23 @@ export class BoxesResponse implements Encodable {
|
|
|
3263
3305
|
static get encodingSchema(): Schema {
|
|
3264
3306
|
if (!this.encodingSchemaValue) {
|
|
3265
3307
|
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
3266
|
-
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
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
|
-
);
|
|
3308
|
+
(this.encodingSchemaValue as NamedMapSchema).pushEntries({
|
|
3309
|
+
key: 'boxes',
|
|
3310
|
+
valueSchema: new ArraySchema(BoxDescriptor.encodingSchema),
|
|
3311
|
+
omitEmpty: true,
|
|
3312
|
+
});
|
|
3279
3313
|
}
|
|
3280
3314
|
return this.encodingSchemaValue;
|
|
3281
3315
|
}
|
|
3282
3316
|
|
|
3283
|
-
public boxes:
|
|
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;
|
|
3317
|
+
public boxes: BoxDescriptor[];
|
|
3295
3318
|
|
|
3296
3319
|
/**
|
|
3297
3320
|
* Creates a new `BoxesResponse` object.
|
|
3298
3321
|
* @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.
|
|
3302
3322
|
*/
|
|
3303
|
-
constructor({
|
|
3304
|
-
boxes,
|
|
3305
|
-
round,
|
|
3306
|
-
nextToken,
|
|
3307
|
-
}: {
|
|
3308
|
-
boxes: Box[];
|
|
3309
|
-
round: number | bigint;
|
|
3310
|
-
nextToken?: string;
|
|
3311
|
-
}) {
|
|
3323
|
+
constructor({ boxes }: { boxes: BoxDescriptor[] }) {
|
|
3312
3324
|
this.boxes = boxes;
|
|
3313
|
-
this.round = ensureSafeInteger(round);
|
|
3314
|
-
this.nextToken = nextToken;
|
|
3315
3325
|
}
|
|
3316
3326
|
|
|
3317
3327
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -3322,8 +3332,6 @@ export class BoxesResponse implements Encodable {
|
|
|
3322
3332
|
toEncodingData(): Map<string, unknown> {
|
|
3323
3333
|
return new Map<string, unknown>([
|
|
3324
3334
|
['boxes', this.boxes.map((v) => v.toEncodingData())],
|
|
3325
|
-
['round', this.round],
|
|
3326
|
-
['next-token', this.nextToken],
|
|
3327
3335
|
]);
|
|
3328
3336
|
}
|
|
3329
3337
|
|
|
@@ -3333,10 +3341,8 @@ export class BoxesResponse implements Encodable {
|
|
|
3333
3341
|
}
|
|
3334
3342
|
return new BoxesResponse({
|
|
3335
3343
|
boxes: (data.get('boxes') ?? []).map((v: unknown) =>
|
|
3336
|
-
|
|
3344
|
+
BoxDescriptor.fromEncodingData(v)
|
|
3337
3345
|
),
|
|
3338
|
-
round: data.get('round'),
|
|
3339
|
-
nextToken: data.get('next-token'),
|
|
3340
3346
|
});
|
|
3341
3347
|
}
|
|
3342
3348
|
}
|