algosdk 3.1.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/abi/abi_type.js +9 -7
- package/dist/cjs/abi/abi_type.js.map +1 -1
- package/dist/cjs/client/v2/algod/block.js +21 -0
- package/dist/cjs/client/v2/algod/block.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 +165 -141
- package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
- package/dist/cjs/client/v2/indexer/indexer.js +15 -0
- package/dist/cjs/client/v2/indexer/indexer.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/cjs/client/v2/indexer/searchForBlockHeaders.js +217 -0
- package/dist/cjs/client/v2/indexer/searchForBlockHeaders.js.map +1 -0
- package/dist/esm/abi/abi_type.js +10 -8
- package/dist/esm/abi/abi_type.js.map +1 -1
- package/dist/esm/client/v2/algod/block.js +21 -0
- package/dist/esm/client/v2/algod/block.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 -136
- package/dist/esm/client/v2/algod/models/types.js.map +1 -1
- package/dist/esm/client/v2/indexer/indexer.js +15 -0
- package/dist/esm/client/v2/indexer/indexer.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/esm/client/v2/indexer/searchForBlockHeaders.js +211 -0
- package/dist/esm/client/v2/indexer/searchForBlockHeaders.js.map +1 -0
- package/dist/types/abi/abi_type.d.ts +13 -1
- package/dist/types/client/v2/algod/block.d.ts +18 -0
- package/dist/types/client/v2/algod/getApplicationBoxes.d.ts +49 -1
- package/dist/types/client/v2/algod/models/types.d.ts +93 -83
- package/dist/types/client/v2/indexer/indexer.d.ts +13 -0
- package/dist/types/client/v2/indexer/models/types.d.ts +7 -1
- package/dist/types/client/v2/indexer/searchAccounts.d.ts +16 -0
- package/dist/types/client/v2/indexer/searchForBlockHeaders.d.ts +176 -0
- package/package.json +2 -2
- package/src/abi/abi_type.ts +16 -9
- package/src/client/v2/algod/block.ts +22 -0
- package/src/client/v2/algod/getApplicationBoxes.ts +61 -1
- package/src/client/v2/algod/models/types.ts +285 -197
- package/src/client/v2/indexer/indexer.ts +16 -0
- package/src/client/v2/indexer/models/types.ts +17 -0
- package/src/client/v2/indexer/searchAccounts.ts +20 -0
- package/src/client/v2/indexer/searchForBlockHeaders.ts +223 -0
|
@@ -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
|
}
|
|
@@ -2904,58 +2921,6 @@ export class BlockHashResponse implements Encodable {
|
|
|
2904
2921
|
}
|
|
2905
2922
|
}
|
|
2906
2923
|
|
|
2907
|
-
/**
|
|
2908
|
-
* Block header.
|
|
2909
|
-
*/
|
|
2910
|
-
export class BlockHeaderResponse implements Encodable {
|
|
2911
|
-
private static encodingSchemaValue: Schema | undefined;
|
|
2912
|
-
|
|
2913
|
-
static get encodingSchema(): Schema {
|
|
2914
|
-
if (!this.encodingSchemaValue) {
|
|
2915
|
-
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
2916
|
-
(this.encodingSchemaValue as NamedMapSchema).pushEntries({
|
|
2917
|
-
key: 'blockHeader',
|
|
2918
|
-
valueSchema: Block.encodingSchema,
|
|
2919
|
-
omitEmpty: true,
|
|
2920
|
-
});
|
|
2921
|
-
}
|
|
2922
|
-
return this.encodingSchemaValue;
|
|
2923
|
-
}
|
|
2924
|
-
|
|
2925
|
-
/**
|
|
2926
|
-
* Block header data.
|
|
2927
|
-
*/
|
|
2928
|
-
public blockheader: Block;
|
|
2929
|
-
|
|
2930
|
-
/**
|
|
2931
|
-
* Creates a new `BlockHeaderResponse` object.
|
|
2932
|
-
* @param blockheader - Block header data.
|
|
2933
|
-
*/
|
|
2934
|
-
constructor({ blockheader }: { blockheader: Block }) {
|
|
2935
|
-
this.blockheader = blockheader;
|
|
2936
|
-
}
|
|
2937
|
-
|
|
2938
|
-
// eslint-disable-next-line class-methods-use-this
|
|
2939
|
-
getEncodingSchema(): Schema {
|
|
2940
|
-
return BlockHeaderResponse.encodingSchema;
|
|
2941
|
-
}
|
|
2942
|
-
|
|
2943
|
-
toEncodingData(): Map<string, unknown> {
|
|
2944
|
-
return new Map<string, unknown>([
|
|
2945
|
-
['blockHeader', this.blockheader.toEncodingData()],
|
|
2946
|
-
]);
|
|
2947
|
-
}
|
|
2948
|
-
|
|
2949
|
-
static fromEncodingData(data: unknown): BlockHeaderResponse {
|
|
2950
|
-
if (!(data instanceof Map)) {
|
|
2951
|
-
throw new Error(`Invalid decoded BlockHeaderResponse: ${data}`);
|
|
2952
|
-
}
|
|
2953
|
-
return new BlockHeaderResponse({
|
|
2954
|
-
blockheader: Block.fromEncodingData(data.get('blockHeader') ?? new Map()),
|
|
2955
|
-
});
|
|
2956
|
-
}
|
|
2957
|
-
}
|
|
2958
|
-
|
|
2959
2924
|
/**
|
|
2960
2925
|
* All logs emitted in the given round. Each app call, whether top-level or inner,
|
|
2961
2926
|
* that contains logs results in a separate AppCallLogs object. Therefore there may
|
|
@@ -3148,33 +3113,41 @@ export class Box implements Encodable {
|
|
|
3148
3113
|
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
3149
3114
|
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
3150
3115
|
{ key: 'name', valueSchema: new ByteArraySchema(), omitEmpty: true },
|
|
3151
|
-
{
|
|
3152
|
-
|
|
3116
|
+
{
|
|
3117
|
+
key: 'round',
|
|
3118
|
+
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
3119
|
+
omitEmpty: true,
|
|
3120
|
+
},
|
|
3121
|
+
{
|
|
3122
|
+
key: 'value',
|
|
3123
|
+
valueSchema: new OptionalSchema(new ByteArraySchema()),
|
|
3124
|
+
omitEmpty: true,
|
|
3125
|
+
}
|
|
3153
3126
|
);
|
|
3154
3127
|
}
|
|
3155
3128
|
return this.encodingSchemaValue;
|
|
3156
3129
|
}
|
|
3157
3130
|
|
|
3158
3131
|
/**
|
|
3159
|
-
*
|
|
3132
|
+
* The box name, base64 encoded
|
|
3160
3133
|
*/
|
|
3161
3134
|
public name: Uint8Array;
|
|
3162
3135
|
|
|
3163
3136
|
/**
|
|
3164
3137
|
* The round for which this information is relevant
|
|
3165
3138
|
*/
|
|
3166
|
-
public round
|
|
3139
|
+
public round?: bigint;
|
|
3167
3140
|
|
|
3168
3141
|
/**
|
|
3169
|
-
*
|
|
3142
|
+
* The box value, base64 encoded.
|
|
3170
3143
|
*/
|
|
3171
|
-
public value
|
|
3144
|
+
public value?: Uint8Array;
|
|
3172
3145
|
|
|
3173
3146
|
/**
|
|
3174
3147
|
* Creates a new `Box` object.
|
|
3175
|
-
* @param name -
|
|
3148
|
+
* @param name - The box name, base64 encoded
|
|
3176
3149
|
* @param round - The round for which this information is relevant
|
|
3177
|
-
* @param value -
|
|
3150
|
+
* @param value - The box value, base64 encoded.
|
|
3178
3151
|
*/
|
|
3179
3152
|
constructor({
|
|
3180
3153
|
name,
|
|
@@ -3182,11 +3155,11 @@ export class Box implements Encodable {
|
|
|
3182
3155
|
value,
|
|
3183
3156
|
}: {
|
|
3184
3157
|
name: string | Uint8Array;
|
|
3185
|
-
round
|
|
3186
|
-
value
|
|
3158
|
+
round?: number | bigint;
|
|
3159
|
+
value?: string | Uint8Array;
|
|
3187
3160
|
}) {
|
|
3188
3161
|
this.name = typeof name === 'string' ? base64ToBytes(name) : name;
|
|
3189
|
-
this.round = ensureBigInt(round);
|
|
3162
|
+
this.round = typeof round === 'undefined' ? undefined : ensureBigInt(round);
|
|
3190
3163
|
this.value = typeof value === 'string' ? base64ToBytes(value) : value;
|
|
3191
3164
|
}
|
|
3192
3165
|
|
|
@@ -3215,56 +3188,6 @@ export class Box implements Encodable {
|
|
|
3215
3188
|
}
|
|
3216
3189
|
}
|
|
3217
3190
|
|
|
3218
|
-
/**
|
|
3219
|
-
* Box descriptor describes a Box.
|
|
3220
|
-
*/
|
|
3221
|
-
export class BoxDescriptor implements Encodable {
|
|
3222
|
-
private static encodingSchemaValue: Schema | undefined;
|
|
3223
|
-
|
|
3224
|
-
static get encodingSchema(): Schema {
|
|
3225
|
-
if (!this.encodingSchemaValue) {
|
|
3226
|
-
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
3227
|
-
(this.encodingSchemaValue as NamedMapSchema).pushEntries({
|
|
3228
|
-
key: 'name',
|
|
3229
|
-
valueSchema: new ByteArraySchema(),
|
|
3230
|
-
omitEmpty: true,
|
|
3231
|
-
});
|
|
3232
|
-
}
|
|
3233
|
-
return this.encodingSchemaValue;
|
|
3234
|
-
}
|
|
3235
|
-
|
|
3236
|
-
/**
|
|
3237
|
-
* Base64 encoded box name
|
|
3238
|
-
*/
|
|
3239
|
-
public name: Uint8Array;
|
|
3240
|
-
|
|
3241
|
-
/**
|
|
3242
|
-
* Creates a new `BoxDescriptor` object.
|
|
3243
|
-
* @param name - Base64 encoded box name
|
|
3244
|
-
*/
|
|
3245
|
-
constructor({ name }: { name: string | Uint8Array }) {
|
|
3246
|
-
this.name = typeof name === 'string' ? base64ToBytes(name) : name;
|
|
3247
|
-
}
|
|
3248
|
-
|
|
3249
|
-
// eslint-disable-next-line class-methods-use-this
|
|
3250
|
-
getEncodingSchema(): Schema {
|
|
3251
|
-
return BoxDescriptor.encodingSchema;
|
|
3252
|
-
}
|
|
3253
|
-
|
|
3254
|
-
toEncodingData(): Map<string, unknown> {
|
|
3255
|
-
return new Map<string, unknown>([['name', this.name]]);
|
|
3256
|
-
}
|
|
3257
|
-
|
|
3258
|
-
static fromEncodingData(data: unknown): BoxDescriptor {
|
|
3259
|
-
if (!(data instanceof Map)) {
|
|
3260
|
-
throw new Error(`Invalid decoded BoxDescriptor: ${data}`);
|
|
3261
|
-
}
|
|
3262
|
-
return new BoxDescriptor({
|
|
3263
|
-
name: data.get('name'),
|
|
3264
|
-
});
|
|
3265
|
-
}
|
|
3266
|
-
}
|
|
3267
|
-
|
|
3268
3191
|
/**
|
|
3269
3192
|
* References a box of an application.
|
|
3270
3193
|
*/
|
|
@@ -3332,7 +3255,7 @@ export class BoxReference implements Encodable {
|
|
|
3332
3255
|
}
|
|
3333
3256
|
|
|
3334
3257
|
/**
|
|
3335
|
-
*
|
|
3258
|
+
* Boxes of an application
|
|
3336
3259
|
*/
|
|
3337
3260
|
export class BoxesResponse implements Encodable {
|
|
3338
3261
|
private static encodingSchemaValue: Schema | undefined;
|
|
@@ -3340,23 +3263,55 @@ export class BoxesResponse implements Encodable {
|
|
|
3340
3263
|
static get encodingSchema(): Schema {
|
|
3341
3264
|
if (!this.encodingSchemaValue) {
|
|
3342
3265
|
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
3343
|
-
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3266
|
+
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
3267
|
+
{
|
|
3268
|
+
key: 'boxes',
|
|
3269
|
+
valueSchema: new ArraySchema(Box.encodingSchema),
|
|
3270
|
+
omitEmpty: true,
|
|
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
|
+
);
|
|
3348
3279
|
}
|
|
3349
3280
|
return this.encodingSchemaValue;
|
|
3350
3281
|
}
|
|
3351
3282
|
|
|
3352
|
-
public boxes:
|
|
3283
|
+
public boxes: Box[];
|
|
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;
|
|
3353
3295
|
|
|
3354
3296
|
/**
|
|
3355
3297
|
* Creates a new `BoxesResponse` object.
|
|
3356
3298
|
* @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.
|
|
3357
3302
|
*/
|
|
3358
|
-
constructor({
|
|
3303
|
+
constructor({
|
|
3304
|
+
boxes,
|
|
3305
|
+
round,
|
|
3306
|
+
nextToken,
|
|
3307
|
+
}: {
|
|
3308
|
+
boxes: Box[];
|
|
3309
|
+
round: number | bigint;
|
|
3310
|
+
nextToken?: string;
|
|
3311
|
+
}) {
|
|
3359
3312
|
this.boxes = boxes;
|
|
3313
|
+
this.round = ensureSafeInteger(round);
|
|
3314
|
+
this.nextToken = nextToken;
|
|
3360
3315
|
}
|
|
3361
3316
|
|
|
3362
3317
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -3367,6 +3322,8 @@ export class BoxesResponse implements Encodable {
|
|
|
3367
3322
|
toEncodingData(): Map<string, unknown> {
|
|
3368
3323
|
return new Map<string, unknown>([
|
|
3369
3324
|
['boxes', this.boxes.map((v) => v.toEncodingData())],
|
|
3325
|
+
['round', this.round],
|
|
3326
|
+
['next-token', this.nextToken],
|
|
3370
3327
|
]);
|
|
3371
3328
|
}
|
|
3372
3329
|
|
|
@@ -3376,8 +3333,10 @@ export class BoxesResponse implements Encodable {
|
|
|
3376
3333
|
}
|
|
3377
3334
|
return new BoxesResponse({
|
|
3378
3335
|
boxes: (data.get('boxes') ?? []).map((v: unknown) =>
|
|
3379
|
-
|
|
3336
|
+
Box.fromEncodingData(v)
|
|
3380
3337
|
),
|
|
3338
|
+
round: data.get('round'),
|
|
3339
|
+
nextToken: data.get('next-token'),
|
|
3381
3340
|
});
|
|
3382
3341
|
}
|
|
3383
3342
|
}
|
|
@@ -4532,6 +4491,210 @@ export class EvalDeltaKeyValue implements Encodable {
|
|
|
4532
4491
|
}
|
|
4533
4492
|
}
|
|
4534
4493
|
|
|
4494
|
+
export class Genesis implements Encodable {
|
|
4495
|
+
private static encodingSchemaValue: Schema | undefined;
|
|
4496
|
+
|
|
4497
|
+
static get encodingSchema(): Schema {
|
|
4498
|
+
if (!this.encodingSchemaValue) {
|
|
4499
|
+
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
4500
|
+
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
4501
|
+
{
|
|
4502
|
+
key: 'alloc',
|
|
4503
|
+
valueSchema: new ArraySchema(GenesisAllocation.encodingSchema),
|
|
4504
|
+
omitEmpty: true,
|
|
4505
|
+
},
|
|
4506
|
+
{ key: 'fees', valueSchema: new StringSchema(), omitEmpty: true },
|
|
4507
|
+
{ key: 'id', valueSchema: new StringSchema(), omitEmpty: true },
|
|
4508
|
+
{ key: 'network', valueSchema: new StringSchema(), omitEmpty: true },
|
|
4509
|
+
{ key: 'proto', valueSchema: new StringSchema(), omitEmpty: true },
|
|
4510
|
+
{ key: 'rwd', valueSchema: new StringSchema(), omitEmpty: true },
|
|
4511
|
+
{ key: 'timestamp', valueSchema: new Uint64Schema(), omitEmpty: true },
|
|
4512
|
+
{
|
|
4513
|
+
key: 'comment',
|
|
4514
|
+
valueSchema: new OptionalSchema(new StringSchema()),
|
|
4515
|
+
omitEmpty: true,
|
|
4516
|
+
},
|
|
4517
|
+
{
|
|
4518
|
+
key: 'devmode',
|
|
4519
|
+
valueSchema: new OptionalSchema(new BooleanSchema()),
|
|
4520
|
+
omitEmpty: true,
|
|
4521
|
+
}
|
|
4522
|
+
);
|
|
4523
|
+
}
|
|
4524
|
+
return this.encodingSchemaValue;
|
|
4525
|
+
}
|
|
4526
|
+
|
|
4527
|
+
public alloc: GenesisAllocation[];
|
|
4528
|
+
|
|
4529
|
+
public fees: string;
|
|
4530
|
+
|
|
4531
|
+
public id: string;
|
|
4532
|
+
|
|
4533
|
+
public network: string;
|
|
4534
|
+
|
|
4535
|
+
public proto: string;
|
|
4536
|
+
|
|
4537
|
+
public rwd: string;
|
|
4538
|
+
|
|
4539
|
+
public timestamp: number;
|
|
4540
|
+
|
|
4541
|
+
public comment?: string;
|
|
4542
|
+
|
|
4543
|
+
public devmode?: boolean;
|
|
4544
|
+
|
|
4545
|
+
/**
|
|
4546
|
+
* Creates a new `Genesis` object.
|
|
4547
|
+
* @param alloc -
|
|
4548
|
+
* @param fees -
|
|
4549
|
+
* @param id -
|
|
4550
|
+
* @param network -
|
|
4551
|
+
* @param proto -
|
|
4552
|
+
* @param rwd -
|
|
4553
|
+
* @param timestamp -
|
|
4554
|
+
* @param comment -
|
|
4555
|
+
* @param devmode -
|
|
4556
|
+
*/
|
|
4557
|
+
constructor({
|
|
4558
|
+
alloc,
|
|
4559
|
+
fees,
|
|
4560
|
+
id,
|
|
4561
|
+
network,
|
|
4562
|
+
proto,
|
|
4563
|
+
rwd,
|
|
4564
|
+
timestamp,
|
|
4565
|
+
comment,
|
|
4566
|
+
devmode,
|
|
4567
|
+
}: {
|
|
4568
|
+
alloc: GenesisAllocation[];
|
|
4569
|
+
fees: string;
|
|
4570
|
+
id: string;
|
|
4571
|
+
network: string;
|
|
4572
|
+
proto: string;
|
|
4573
|
+
rwd: string;
|
|
4574
|
+
timestamp: number | bigint;
|
|
4575
|
+
comment?: string;
|
|
4576
|
+
devmode?: boolean;
|
|
4577
|
+
}) {
|
|
4578
|
+
this.alloc = alloc;
|
|
4579
|
+
this.fees = fees;
|
|
4580
|
+
this.id = id;
|
|
4581
|
+
this.network = network;
|
|
4582
|
+
this.proto = proto;
|
|
4583
|
+
this.rwd = rwd;
|
|
4584
|
+
this.timestamp = ensureSafeInteger(timestamp);
|
|
4585
|
+
this.comment = comment;
|
|
4586
|
+
this.devmode = devmode;
|
|
4587
|
+
}
|
|
4588
|
+
|
|
4589
|
+
// eslint-disable-next-line class-methods-use-this
|
|
4590
|
+
getEncodingSchema(): Schema {
|
|
4591
|
+
return Genesis.encodingSchema;
|
|
4592
|
+
}
|
|
4593
|
+
|
|
4594
|
+
toEncodingData(): Map<string, unknown> {
|
|
4595
|
+
return new Map<string, unknown>([
|
|
4596
|
+
['alloc', this.alloc.map((v) => v.toEncodingData())],
|
|
4597
|
+
['fees', this.fees],
|
|
4598
|
+
['id', this.id],
|
|
4599
|
+
['network', this.network],
|
|
4600
|
+
['proto', this.proto],
|
|
4601
|
+
['rwd', this.rwd],
|
|
4602
|
+
['timestamp', this.timestamp],
|
|
4603
|
+
['comment', this.comment],
|
|
4604
|
+
['devmode', this.devmode],
|
|
4605
|
+
]);
|
|
4606
|
+
}
|
|
4607
|
+
|
|
4608
|
+
static fromEncodingData(data: unknown): Genesis {
|
|
4609
|
+
if (!(data instanceof Map)) {
|
|
4610
|
+
throw new Error(`Invalid decoded Genesis: ${data}`);
|
|
4611
|
+
}
|
|
4612
|
+
return new Genesis({
|
|
4613
|
+
alloc: (data.get('alloc') ?? []).map((v: unknown) =>
|
|
4614
|
+
GenesisAllocation.fromEncodingData(v)
|
|
4615
|
+
),
|
|
4616
|
+
fees: data.get('fees'),
|
|
4617
|
+
id: data.get('id'),
|
|
4618
|
+
network: data.get('network'),
|
|
4619
|
+
proto: data.get('proto'),
|
|
4620
|
+
rwd: data.get('rwd'),
|
|
4621
|
+
timestamp: data.get('timestamp'),
|
|
4622
|
+
comment: data.get('comment'),
|
|
4623
|
+
devmode: data.get('devmode'),
|
|
4624
|
+
});
|
|
4625
|
+
}
|
|
4626
|
+
}
|
|
4627
|
+
|
|
4628
|
+
export class GenesisAllocation implements Encodable {
|
|
4629
|
+
private static encodingSchemaValue: Schema | undefined;
|
|
4630
|
+
|
|
4631
|
+
static get encodingSchema(): Schema {
|
|
4632
|
+
if (!this.encodingSchemaValue) {
|
|
4633
|
+
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
4634
|
+
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
4635
|
+
{ key: 'addr', valueSchema: new StringSchema(), omitEmpty: true },
|
|
4636
|
+
{ key: 'comment', valueSchema: new StringSchema(), omitEmpty: true },
|
|
4637
|
+
{
|
|
4638
|
+
key: 'state',
|
|
4639
|
+
valueSchema: UntypedValue.encodingSchema,
|
|
4640
|
+
omitEmpty: true,
|
|
4641
|
+
}
|
|
4642
|
+
);
|
|
4643
|
+
}
|
|
4644
|
+
return this.encodingSchemaValue;
|
|
4645
|
+
}
|
|
4646
|
+
|
|
4647
|
+
public addr: string;
|
|
4648
|
+
|
|
4649
|
+
public comment: string;
|
|
4650
|
+
|
|
4651
|
+
public state: UntypedValue;
|
|
4652
|
+
|
|
4653
|
+
/**
|
|
4654
|
+
* Creates a new `GenesisAllocation` object.
|
|
4655
|
+
* @param addr -
|
|
4656
|
+
* @param comment -
|
|
4657
|
+
* @param state -
|
|
4658
|
+
*/
|
|
4659
|
+
constructor({
|
|
4660
|
+
addr,
|
|
4661
|
+
comment,
|
|
4662
|
+
state,
|
|
4663
|
+
}: {
|
|
4664
|
+
addr: string;
|
|
4665
|
+
comment: string;
|
|
4666
|
+
state: UntypedValue;
|
|
4667
|
+
}) {
|
|
4668
|
+
this.addr = addr;
|
|
4669
|
+
this.comment = comment;
|
|
4670
|
+
this.state = state;
|
|
4671
|
+
}
|
|
4672
|
+
|
|
4673
|
+
// eslint-disable-next-line class-methods-use-this
|
|
4674
|
+
getEncodingSchema(): Schema {
|
|
4675
|
+
return GenesisAllocation.encodingSchema;
|
|
4676
|
+
}
|
|
4677
|
+
|
|
4678
|
+
toEncodingData(): Map<string, unknown> {
|
|
4679
|
+
return new Map<string, unknown>([
|
|
4680
|
+
['addr', this.addr],
|
|
4681
|
+
['comment', this.comment],
|
|
4682
|
+
['state', this.state.toEncodingData()],
|
|
4683
|
+
]);
|
|
4684
|
+
}
|
|
4685
|
+
|
|
4686
|
+
static fromEncodingData(data: unknown): GenesisAllocation {
|
|
4687
|
+
if (!(data instanceof Map)) {
|
|
4688
|
+
throw new Error(`Invalid decoded GenesisAllocation: ${data}`);
|
|
4689
|
+
}
|
|
4690
|
+
return new GenesisAllocation({
|
|
4691
|
+
addr: data.get('addr'),
|
|
4692
|
+
comment: data.get('comment'),
|
|
4693
|
+
state: UntypedValue.fromEncodingData(data.get('state') ?? new Map()),
|
|
4694
|
+
});
|
|
4695
|
+
}
|
|
4696
|
+
}
|
|
4697
|
+
|
|
4535
4698
|
/**
|
|
4536
4699
|
* Response containing the timestamp offset in seconds
|
|
4537
4700
|
*/
|
|
@@ -4634,81 +4797,6 @@ export class GetSyncRoundResponse implements Encodable {
|
|
|
4634
4797
|
}
|
|
4635
4798
|
}
|
|
4636
4799
|
|
|
4637
|
-
/**
|
|
4638
|
-
* A single Delta containing the key, the previous value and the current value for
|
|
4639
|
-
* a single round.
|
|
4640
|
-
*/
|
|
4641
|
-
export class KvDelta implements Encodable {
|
|
4642
|
-
private static encodingSchemaValue: Schema | undefined;
|
|
4643
|
-
|
|
4644
|
-
static get encodingSchema(): Schema {
|
|
4645
|
-
if (!this.encodingSchemaValue) {
|
|
4646
|
-
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
4647
|
-
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
4648
|
-
{
|
|
4649
|
-
key: 'key',
|
|
4650
|
-
valueSchema: new OptionalSchema(new ByteArraySchema()),
|
|
4651
|
-
omitEmpty: true,
|
|
4652
|
-
},
|
|
4653
|
-
{
|
|
4654
|
-
key: 'value',
|
|
4655
|
-
valueSchema: new OptionalSchema(new ByteArraySchema()),
|
|
4656
|
-
omitEmpty: true,
|
|
4657
|
-
}
|
|
4658
|
-
);
|
|
4659
|
-
}
|
|
4660
|
-
return this.encodingSchemaValue;
|
|
4661
|
-
}
|
|
4662
|
-
|
|
4663
|
-
/**
|
|
4664
|
-
* The key, base64 encoded.
|
|
4665
|
-
*/
|
|
4666
|
-
public key?: Uint8Array;
|
|
4667
|
-
|
|
4668
|
-
/**
|
|
4669
|
-
* The new value of the KV store entry, base64 encoded.
|
|
4670
|
-
*/
|
|
4671
|
-
public value?: Uint8Array;
|
|
4672
|
-
|
|
4673
|
-
/**
|
|
4674
|
-
* Creates a new `KvDelta` object.
|
|
4675
|
-
* @param key - The key, base64 encoded.
|
|
4676
|
-
* @param value - The new value of the KV store entry, base64 encoded.
|
|
4677
|
-
*/
|
|
4678
|
-
constructor({
|
|
4679
|
-
key,
|
|
4680
|
-
value,
|
|
4681
|
-
}: {
|
|
4682
|
-
key?: string | Uint8Array;
|
|
4683
|
-
value?: string | Uint8Array;
|
|
4684
|
-
}) {
|
|
4685
|
-
this.key = typeof key === 'string' ? base64ToBytes(key) : key;
|
|
4686
|
-
this.value = typeof value === 'string' ? base64ToBytes(value) : value;
|
|
4687
|
-
}
|
|
4688
|
-
|
|
4689
|
-
// eslint-disable-next-line class-methods-use-this
|
|
4690
|
-
getEncodingSchema(): Schema {
|
|
4691
|
-
return KvDelta.encodingSchema;
|
|
4692
|
-
}
|
|
4693
|
-
|
|
4694
|
-
toEncodingData(): Map<string, unknown> {
|
|
4695
|
-
return new Map<string, unknown>([
|
|
4696
|
-
['key', this.key],
|
|
4697
|
-
['value', this.value],
|
|
4698
|
-
]);
|
|
4699
|
-
}
|
|
4700
|
-
|
|
4701
|
-
static fromEncodingData(data: unknown): KvDelta {
|
|
4702
|
-
if (!(data instanceof Map)) {
|
|
4703
|
-
throw new Error(`Invalid decoded KvDelta: ${data}`);
|
|
4704
|
-
}
|
|
4705
|
-
return new KvDelta({
|
|
4706
|
-
key: data.get('key'),
|
|
4707
|
-
value: data.get('value'),
|
|
4708
|
-
});
|
|
4709
|
-
}
|
|
4710
|
-
}
|
|
4711
|
-
|
|
4712
4800
|
/**
|
|
4713
4801
|
* Contains a ledger delta for a single transaction group
|
|
4714
4802
|
*/
|
|
@@ -15,6 +15,7 @@ import LookupApplications from './lookupApplications.js';
|
|
|
15
15
|
import LookupApplicationLogs from './lookupApplicationLogs.js';
|
|
16
16
|
import LookupApplicationBoxByIDandName from './lookupApplicationBoxByIDandName.js';
|
|
17
17
|
import SearchAccounts from './searchAccounts.js';
|
|
18
|
+
import SearchForBlockHeaders from './searchForBlockHeaders.js';
|
|
18
19
|
import SearchForTransactions from './searchForTransactions.js';
|
|
19
20
|
import SearchForAssets from './searchForAssets.js';
|
|
20
21
|
import SearchForApplications from './searchForApplications.js';
|
|
@@ -327,6 +328,21 @@ export class IndexerClient extends ServiceClient {
|
|
|
327
328
|
return new SearchAccounts(this.c);
|
|
328
329
|
}
|
|
329
330
|
|
|
331
|
+
/**
|
|
332
|
+
* Returns information about indexed block headers.
|
|
333
|
+
*
|
|
334
|
+
* #### Example
|
|
335
|
+
* ```typescript
|
|
336
|
+
* const bhs = await indexerClient.searchForBlockHeaders().do();
|
|
337
|
+
* ```
|
|
338
|
+
*
|
|
339
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2block-headers)
|
|
340
|
+
* @category GET
|
|
341
|
+
*/
|
|
342
|
+
searchForBlockHeaders() {
|
|
343
|
+
return new SearchForBlockHeaders(this.c);
|
|
344
|
+
}
|
|
345
|
+
|
|
330
346
|
/**
|
|
331
347
|
* Returns information about indexed transactions.
|
|
332
348
|
*
|