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
|
@@ -12,7 +12,7 @@ const types_js_1 = require("./models/types.js");
|
|
|
12
12
|
* #### Example
|
|
13
13
|
* ```typescript
|
|
14
14
|
* const index = 60553466;
|
|
15
|
-
* const boxesResponse = await algodClient.getApplicationBoxes(index).
|
|
15
|
+
* const boxesResponse = await algodClient.getApplicationBoxes(index).prefix('int:1234').next('b64:A==').values(true).do();
|
|
16
16
|
* const boxNames = boxesResponse.boxes.map(box => box.name);
|
|
17
17
|
* ```
|
|
18
18
|
*
|
|
@@ -51,6 +51,63 @@ class GetApplicationBoxes extends jsonrequest_js_1.default {
|
|
|
51
51
|
this.query.max = max;
|
|
52
52
|
return this;
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* 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...'.
|
|
56
|
+
*
|
|
57
|
+
* #### Example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const prefix = 'int:1234';
|
|
60
|
+
* const boxesResult = await algodClient
|
|
61
|
+
* .GetApplicationBoxes(1234)
|
|
62
|
+
* .prefix(prefix)
|
|
63
|
+
* .do();
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @param prefix - the box name prefix in the form 'encoding:value'
|
|
67
|
+
* @category query
|
|
68
|
+
*/
|
|
69
|
+
prefix(prefix) {
|
|
70
|
+
this.query.prefix = prefix;
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* 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.
|
|
75
|
+
*
|
|
76
|
+
* #### Example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* const next = 'int:1234';
|
|
79
|
+
* const boxesResult = await algodClient
|
|
80
|
+
* .GetApplicationBoxes(1234)
|
|
81
|
+
* .next(next)
|
|
82
|
+
* .do();
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @param next - the next box name for pagination, in the goal app call arg form 'encoding:value'
|
|
86
|
+
* @category query
|
|
87
|
+
*/
|
|
88
|
+
next(next) {
|
|
89
|
+
this.query.next = next;
|
|
90
|
+
return this;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* If true, box values will be returned.
|
|
94
|
+
*
|
|
95
|
+
* #### Example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* const values = true;
|
|
98
|
+
* const boxesResult = await algodClient
|
|
99
|
+
* .GetApplicationBoxes(1234)
|
|
100
|
+
* .values(values)
|
|
101
|
+
* .do();
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* @param values - if true, box values will be returned
|
|
105
|
+
* @category query
|
|
106
|
+
*/
|
|
107
|
+
values(values) {
|
|
108
|
+
this.query.values = values;
|
|
109
|
+
return this;
|
|
110
|
+
}
|
|
54
111
|
// eslint-disable-next-line class-methods-use-this
|
|
55
112
|
prepare(response) {
|
|
56
113
|
return (0, encoding_js_1.decodeJSON)(response.getJSONText(), types_js_1.BoxesResponse);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getApplicationBoxes.js","sourceRoot":"","sources":["../../../../../src/client/v2/algod/getApplicationBoxes.ts"],"names":[],"mappings":";;;;;AAAA,uEAA4C;AAE5C,+DAA2D;AAC3D,gDAAkD;AAElD;;;;;;;;;;;;;GAaG;AACH,MAAqB,mBAAoB,SAAQ,wBAA0B;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,IAAA,wBAAU,EAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,wBAAa,CAAC,CAAC;IAC3D,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"getApplicationBoxes.js","sourceRoot":"","sources":["../../../../../src/client/v2/algod/getApplicationBoxes.ts"],"names":[],"mappings":";;;;;AAAA,uEAA4C;AAE5C,+DAA2D;AAC3D,gDAAkD;AAElD;;;;;;;;;;;;;GAaG;AACH,MAAqB,mBAAoB,SAAQ,wBAA0B;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,IAAA,wBAAU,EAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,wBAAa,CAAC,CAAC;IAC3D,CAAC;CACF;AApGD,sCAoGC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* NOTICE: This file was generated. Editing this file manually is not recommended.
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.PostTransactionsResponse = exports.PendingTransactionsResponse = exports.PendingTransactionResponse = exports.NodeStatusResponse = exports.LightBlockHeaderProof = exports.LedgerStateDeltaForTransactionGroup = exports.
|
|
6
|
+
exports.PostTransactionsResponse = exports.PendingTransactionsResponse = exports.PendingTransactionResponse = exports.NodeStatusResponse = exports.LightBlockHeaderProof = exports.LedgerStateDeltaForTransactionGroup = exports.GetSyncRoundResponse = exports.GetBlockTimeStampOffsetResponse = exports.GenesisAllocation = exports.Genesis = exports.EvalDeltaKeyValue = exports.EvalDelta = exports.ErrorResponse = exports.DryrunTxnResult = exports.DryrunState = exports.DryrunSource = exports.DryrunResponse = exports.DryrunRequest = exports.DisassembleResponse = exports.CompileResponse = exports.BuildVersion = exports.BoxesResponse = exports.BoxReference = exports.Box = exports.BlockTxidsResponse = exports.BlockResponse = exports.BlockLogsResponse = exports.BlockHashResponse = exports.AvmValue = exports.AvmKeyValue = exports.AssetParams = exports.AssetHoldingReference = exports.AssetHolding = exports.Asset = exports.ApplicationStateSchema = exports.ApplicationStateOperation = exports.ApplicationParams = exports.ApplicationLocalState = exports.ApplicationLocalReference = exports.ApplicationKVStorage = exports.ApplicationInitialStates = exports.Application = exports.AppCallLogs = exports.AccountStateDelta = exports.AccountParticipation = exports.AccountAssetsInformationResponse = exports.AccountAssetResponse = exports.AccountAssetHolding = exports.AccountApplicationResponse = exports.Account = void 0;
|
|
7
7
|
exports.Version = exports.TransactionProofResponse = exports.TransactionParametersResponse = exports.TransactionGroupLedgerStateDeltasForRoundResponse = exports.TealValue = exports.TealKeyValue = exports.SupplyResponse = exports.StateProofMessage = exports.StateProof = exports.SimulationTransactionExecTrace = exports.SimulationOpcodeTraceUnit = exports.SimulationEvalOverrides = exports.SimulateUnnamedResourcesAccessed = exports.SimulateTransactionResult = exports.SimulateTransactionGroupResult = exports.SimulateTraceConfig = exports.SimulateResponse = exports.SimulateRequestTransactionGroup = exports.SimulateRequest = exports.SimulateInitialStates = exports.ScratchChange = void 0;
|
|
8
8
|
/* eslint-disable no-use-before-define */
|
|
9
9
|
const utils_js_1 = require("../../../../utils/utils.js");
|
|
@@ -1120,6 +1120,10 @@ class ApplicationParams {
|
|
|
1120
1120
|
key: 'local-state-schema',
|
|
1121
1121
|
valueSchema: new index_js_1.OptionalSchema(ApplicationStateSchema.encodingSchema),
|
|
1122
1122
|
omitEmpty: true,
|
|
1123
|
+
}, {
|
|
1124
|
+
key: 'version',
|
|
1125
|
+
valueSchema: new index_js_1.OptionalSchema(new index_js_1.Uint64Schema()),
|
|
1126
|
+
omitEmpty: true,
|
|
1123
1127
|
});
|
|
1124
1128
|
}
|
|
1125
1129
|
return this.encodingSchemaValue;
|
|
@@ -1134,8 +1138,9 @@ class ApplicationParams {
|
|
|
1134
1138
|
* @param globalState - (gs) global state
|
|
1135
1139
|
* @param globalStateSchema - (gsch) global schema
|
|
1136
1140
|
* @param localStateSchema - (lsch) local schema
|
|
1141
|
+
* @param version - (v) the number of updates to the application programs
|
|
1137
1142
|
*/
|
|
1138
|
-
constructor({ approvalProgram, clearStateProgram, creator, extraProgramPages, globalState, globalStateSchema, localStateSchema, }) {
|
|
1143
|
+
constructor({ approvalProgram, clearStateProgram, creator, extraProgramPages, globalState, globalStateSchema, localStateSchema, version, }) {
|
|
1139
1144
|
this.approvalProgram =
|
|
1140
1145
|
typeof approvalProgram === 'string'
|
|
1141
1146
|
? (0, binarydata_js_1.base64ToBytes)(approvalProgram)
|
|
@@ -1153,6 +1158,8 @@ class ApplicationParams {
|
|
|
1153
1158
|
this.globalState = globalState;
|
|
1154
1159
|
this.globalStateSchema = globalStateSchema;
|
|
1155
1160
|
this.localStateSchema = localStateSchema;
|
|
1161
|
+
this.version =
|
|
1162
|
+
typeof version === 'undefined' ? undefined : (0, utils_js_1.ensureSafeInteger)(version);
|
|
1156
1163
|
}
|
|
1157
1164
|
// eslint-disable-next-line class-methods-use-this
|
|
1158
1165
|
getEncodingSchema() {
|
|
@@ -1182,6 +1189,7 @@ class ApplicationParams {
|
|
|
1182
1189
|
? this.localStateSchema.toEncodingData()
|
|
1183
1190
|
: undefined,
|
|
1184
1191
|
],
|
|
1192
|
+
['version', this.version],
|
|
1185
1193
|
]);
|
|
1186
1194
|
}
|
|
1187
1195
|
static fromEncodingData(data) {
|
|
@@ -1204,6 +1212,7 @@ class ApplicationParams {
|
|
|
1204
1212
|
localStateSchema: typeof data.get('local-state-schema') !== 'undefined'
|
|
1205
1213
|
? ApplicationStateSchema.fromEncodingData(data.get('local-state-schema'))
|
|
1206
1214
|
: undefined,
|
|
1215
|
+
version: data.get('version'),
|
|
1207
1216
|
});
|
|
1208
1217
|
}
|
|
1209
1218
|
}
|
|
@@ -1911,19 +1920,27 @@ class Box {
|
|
|
1911
1920
|
static get encodingSchema() {
|
|
1912
1921
|
if (!this.encodingSchemaValue) {
|
|
1913
1922
|
this.encodingSchemaValue = new index_js_1.NamedMapSchema([]);
|
|
1914
|
-
this.encodingSchemaValue.pushEntries({ key: 'name', valueSchema: new index_js_1.ByteArraySchema(), omitEmpty: true }, {
|
|
1923
|
+
this.encodingSchemaValue.pushEntries({ key: 'name', valueSchema: new index_js_1.ByteArraySchema(), omitEmpty: true }, {
|
|
1924
|
+
key: 'round',
|
|
1925
|
+
valueSchema: new index_js_1.OptionalSchema(new index_js_1.Uint64Schema()),
|
|
1926
|
+
omitEmpty: true,
|
|
1927
|
+
}, {
|
|
1928
|
+
key: 'value',
|
|
1929
|
+
valueSchema: new index_js_1.OptionalSchema(new index_js_1.ByteArraySchema()),
|
|
1930
|
+
omitEmpty: true,
|
|
1931
|
+
});
|
|
1915
1932
|
}
|
|
1916
1933
|
return this.encodingSchemaValue;
|
|
1917
1934
|
}
|
|
1918
1935
|
/**
|
|
1919
1936
|
* Creates a new `Box` object.
|
|
1920
|
-
* @param name -
|
|
1937
|
+
* @param name - The box name, base64 encoded
|
|
1921
1938
|
* @param round - The round for which this information is relevant
|
|
1922
|
-
* @param value -
|
|
1939
|
+
* @param value - The box value, base64 encoded.
|
|
1923
1940
|
*/
|
|
1924
1941
|
constructor({ name, round, value, }) {
|
|
1925
1942
|
this.name = typeof name === 'string' ? (0, binarydata_js_1.base64ToBytes)(name) : name;
|
|
1926
|
-
this.round = (0, utils_js_1.ensureBigInt)(round);
|
|
1943
|
+
this.round = typeof round === 'undefined' ? undefined : (0, utils_js_1.ensureBigInt)(round);
|
|
1927
1944
|
this.value = typeof value === 'string' ? (0, binarydata_js_1.base64ToBytes)(value) : value;
|
|
1928
1945
|
}
|
|
1929
1946
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -1949,45 +1966,6 @@ class Box {
|
|
|
1949
1966
|
}
|
|
1950
1967
|
}
|
|
1951
1968
|
exports.Box = Box;
|
|
1952
|
-
/**
|
|
1953
|
-
* Box descriptor describes a Box.
|
|
1954
|
-
*/
|
|
1955
|
-
class BoxDescriptor {
|
|
1956
|
-
static get encodingSchema() {
|
|
1957
|
-
if (!this.encodingSchemaValue) {
|
|
1958
|
-
this.encodingSchemaValue = new index_js_1.NamedMapSchema([]);
|
|
1959
|
-
this.encodingSchemaValue.pushEntries({
|
|
1960
|
-
key: 'name',
|
|
1961
|
-
valueSchema: new index_js_1.ByteArraySchema(),
|
|
1962
|
-
omitEmpty: true,
|
|
1963
|
-
});
|
|
1964
|
-
}
|
|
1965
|
-
return this.encodingSchemaValue;
|
|
1966
|
-
}
|
|
1967
|
-
/**
|
|
1968
|
-
* Creates a new `BoxDescriptor` object.
|
|
1969
|
-
* @param name - Base64 encoded box name
|
|
1970
|
-
*/
|
|
1971
|
-
constructor({ name }) {
|
|
1972
|
-
this.name = typeof name === 'string' ? (0, binarydata_js_1.base64ToBytes)(name) : name;
|
|
1973
|
-
}
|
|
1974
|
-
// eslint-disable-next-line class-methods-use-this
|
|
1975
|
-
getEncodingSchema() {
|
|
1976
|
-
return BoxDescriptor.encodingSchema;
|
|
1977
|
-
}
|
|
1978
|
-
toEncodingData() {
|
|
1979
|
-
return new Map([['name', this.name]]);
|
|
1980
|
-
}
|
|
1981
|
-
static fromEncodingData(data) {
|
|
1982
|
-
if (!(data instanceof Map)) {
|
|
1983
|
-
throw new Error(`Invalid decoded BoxDescriptor: ${data}`);
|
|
1984
|
-
}
|
|
1985
|
-
return new BoxDescriptor({
|
|
1986
|
-
name: data.get('name'),
|
|
1987
|
-
});
|
|
1988
|
-
}
|
|
1989
|
-
}
|
|
1990
|
-
exports.BoxDescriptor = BoxDescriptor;
|
|
1991
1969
|
/**
|
|
1992
1970
|
* References a box of an application.
|
|
1993
1971
|
*/
|
|
@@ -2030,7 +2008,7 @@ class BoxReference {
|
|
|
2030
2008
|
}
|
|
2031
2009
|
exports.BoxReference = BoxReference;
|
|
2032
2010
|
/**
|
|
2033
|
-
*
|
|
2011
|
+
* Boxes of an application
|
|
2034
2012
|
*/
|
|
2035
2013
|
class BoxesResponse {
|
|
2036
2014
|
static get encodingSchema() {
|
|
@@ -2038,7 +2016,11 @@ class BoxesResponse {
|
|
|
2038
2016
|
this.encodingSchemaValue = new index_js_1.NamedMapSchema([]);
|
|
2039
2017
|
this.encodingSchemaValue.pushEntries({
|
|
2040
2018
|
key: 'boxes',
|
|
2041
|
-
valueSchema: new index_js_1.ArraySchema(
|
|
2019
|
+
valueSchema: new index_js_1.ArraySchema(Box.encodingSchema),
|
|
2020
|
+
omitEmpty: true,
|
|
2021
|
+
}, { key: 'round', valueSchema: new index_js_1.Uint64Schema(), omitEmpty: true }, {
|
|
2022
|
+
key: 'next-token',
|
|
2023
|
+
valueSchema: new index_js_1.OptionalSchema(new index_js_1.StringSchema()),
|
|
2042
2024
|
omitEmpty: true,
|
|
2043
2025
|
});
|
|
2044
2026
|
}
|
|
@@ -2047,9 +2029,14 @@ class BoxesResponse {
|
|
|
2047
2029
|
/**
|
|
2048
2030
|
* Creates a new `BoxesResponse` object.
|
|
2049
2031
|
* @param boxes -
|
|
2032
|
+
* @param round - The round for which this information is relevant.
|
|
2033
|
+
* @param nextToken - Used for pagination, when making another request provide this token with the
|
|
2034
|
+
* next parameter.
|
|
2050
2035
|
*/
|
|
2051
|
-
constructor({ boxes }) {
|
|
2036
|
+
constructor({ boxes, round, nextToken, }) {
|
|
2052
2037
|
this.boxes = boxes;
|
|
2038
|
+
this.round = (0, utils_js_1.ensureSafeInteger)(round);
|
|
2039
|
+
this.nextToken = nextToken;
|
|
2053
2040
|
}
|
|
2054
2041
|
// eslint-disable-next-line class-methods-use-this
|
|
2055
2042
|
getEncodingSchema() {
|
|
@@ -2058,6 +2045,8 @@ class BoxesResponse {
|
|
|
2058
2045
|
toEncodingData() {
|
|
2059
2046
|
return new Map([
|
|
2060
2047
|
['boxes', this.boxes.map((v) => v.toEncodingData())],
|
|
2048
|
+
['round', this.round],
|
|
2049
|
+
['next-token', this.nextToken],
|
|
2061
2050
|
]);
|
|
2062
2051
|
}
|
|
2063
2052
|
static fromEncodingData(data) {
|
|
@@ -2065,7 +2054,9 @@ class BoxesResponse {
|
|
|
2065
2054
|
throw new Error(`Invalid decoded BoxesResponse: ${data}`);
|
|
2066
2055
|
}
|
|
2067
2056
|
return new BoxesResponse({
|
|
2068
|
-
boxes: (data.get('boxes') ?? []).map((v) =>
|
|
2057
|
+
boxes: (data.get('boxes') ?? []).map((v) => Box.fromEncodingData(v)),
|
|
2058
|
+
round: data.get('round'),
|
|
2059
|
+
nextToken: data.get('next-token'),
|
|
2069
2060
|
});
|
|
2070
2061
|
}
|
|
2071
2062
|
}
|
|
@@ -2805,6 +2796,130 @@ class EvalDeltaKeyValue {
|
|
|
2805
2796
|
}
|
|
2806
2797
|
}
|
|
2807
2798
|
exports.EvalDeltaKeyValue = EvalDeltaKeyValue;
|
|
2799
|
+
class Genesis {
|
|
2800
|
+
static get encodingSchema() {
|
|
2801
|
+
if (!this.encodingSchemaValue) {
|
|
2802
|
+
this.encodingSchemaValue = new index_js_1.NamedMapSchema([]);
|
|
2803
|
+
this.encodingSchemaValue.pushEntries({
|
|
2804
|
+
key: 'alloc',
|
|
2805
|
+
valueSchema: new index_js_1.ArraySchema(GenesisAllocation.encodingSchema),
|
|
2806
|
+
omitEmpty: true,
|
|
2807
|
+
}, { key: 'fees', valueSchema: new index_js_1.StringSchema(), omitEmpty: true }, { key: 'id', valueSchema: new index_js_1.StringSchema(), omitEmpty: true }, { key: 'network', valueSchema: new index_js_1.StringSchema(), omitEmpty: true }, { key: 'proto', valueSchema: new index_js_1.StringSchema(), omitEmpty: true }, { key: 'rwd', valueSchema: new index_js_1.StringSchema(), omitEmpty: true }, { key: 'timestamp', valueSchema: new index_js_1.Uint64Schema(), omitEmpty: true }, {
|
|
2808
|
+
key: 'comment',
|
|
2809
|
+
valueSchema: new index_js_1.OptionalSchema(new index_js_1.StringSchema()),
|
|
2810
|
+
omitEmpty: true,
|
|
2811
|
+
}, {
|
|
2812
|
+
key: 'devmode',
|
|
2813
|
+
valueSchema: new index_js_1.OptionalSchema(new index_js_1.BooleanSchema()),
|
|
2814
|
+
omitEmpty: true,
|
|
2815
|
+
});
|
|
2816
|
+
}
|
|
2817
|
+
return this.encodingSchemaValue;
|
|
2818
|
+
}
|
|
2819
|
+
/**
|
|
2820
|
+
* Creates a new `Genesis` object.
|
|
2821
|
+
* @param alloc -
|
|
2822
|
+
* @param fees -
|
|
2823
|
+
* @param id -
|
|
2824
|
+
* @param network -
|
|
2825
|
+
* @param proto -
|
|
2826
|
+
* @param rwd -
|
|
2827
|
+
* @param timestamp -
|
|
2828
|
+
* @param comment -
|
|
2829
|
+
* @param devmode -
|
|
2830
|
+
*/
|
|
2831
|
+
constructor({ alloc, fees, id, network, proto, rwd, timestamp, comment, devmode, }) {
|
|
2832
|
+
this.alloc = alloc;
|
|
2833
|
+
this.fees = fees;
|
|
2834
|
+
this.id = id;
|
|
2835
|
+
this.network = network;
|
|
2836
|
+
this.proto = proto;
|
|
2837
|
+
this.rwd = rwd;
|
|
2838
|
+
this.timestamp = (0, utils_js_1.ensureSafeInteger)(timestamp);
|
|
2839
|
+
this.comment = comment;
|
|
2840
|
+
this.devmode = devmode;
|
|
2841
|
+
}
|
|
2842
|
+
// eslint-disable-next-line class-methods-use-this
|
|
2843
|
+
getEncodingSchema() {
|
|
2844
|
+
return Genesis.encodingSchema;
|
|
2845
|
+
}
|
|
2846
|
+
toEncodingData() {
|
|
2847
|
+
return new Map([
|
|
2848
|
+
['alloc', this.alloc.map((v) => v.toEncodingData())],
|
|
2849
|
+
['fees', this.fees],
|
|
2850
|
+
['id', this.id],
|
|
2851
|
+
['network', this.network],
|
|
2852
|
+
['proto', this.proto],
|
|
2853
|
+
['rwd', this.rwd],
|
|
2854
|
+
['timestamp', this.timestamp],
|
|
2855
|
+
['comment', this.comment],
|
|
2856
|
+
['devmode', this.devmode],
|
|
2857
|
+
]);
|
|
2858
|
+
}
|
|
2859
|
+
static fromEncodingData(data) {
|
|
2860
|
+
if (!(data instanceof Map)) {
|
|
2861
|
+
throw new Error(`Invalid decoded Genesis: ${data}`);
|
|
2862
|
+
}
|
|
2863
|
+
return new Genesis({
|
|
2864
|
+
alloc: (data.get('alloc') ?? []).map((v) => GenesisAllocation.fromEncodingData(v)),
|
|
2865
|
+
fees: data.get('fees'),
|
|
2866
|
+
id: data.get('id'),
|
|
2867
|
+
network: data.get('network'),
|
|
2868
|
+
proto: data.get('proto'),
|
|
2869
|
+
rwd: data.get('rwd'),
|
|
2870
|
+
timestamp: data.get('timestamp'),
|
|
2871
|
+
comment: data.get('comment'),
|
|
2872
|
+
devmode: data.get('devmode'),
|
|
2873
|
+
});
|
|
2874
|
+
}
|
|
2875
|
+
}
|
|
2876
|
+
exports.Genesis = Genesis;
|
|
2877
|
+
class GenesisAllocation {
|
|
2878
|
+
static get encodingSchema() {
|
|
2879
|
+
if (!this.encodingSchemaValue) {
|
|
2880
|
+
this.encodingSchemaValue = new index_js_1.NamedMapSchema([]);
|
|
2881
|
+
this.encodingSchemaValue.pushEntries({ key: 'addr', valueSchema: new index_js_1.StringSchema(), omitEmpty: true }, { key: 'comment', valueSchema: new index_js_1.StringSchema(), omitEmpty: true }, {
|
|
2882
|
+
key: 'state',
|
|
2883
|
+
valueSchema: untypedmodel_js_1.UntypedValue.encodingSchema,
|
|
2884
|
+
omitEmpty: true,
|
|
2885
|
+
});
|
|
2886
|
+
}
|
|
2887
|
+
return this.encodingSchemaValue;
|
|
2888
|
+
}
|
|
2889
|
+
/**
|
|
2890
|
+
* Creates a new `GenesisAllocation` object.
|
|
2891
|
+
* @param addr -
|
|
2892
|
+
* @param comment -
|
|
2893
|
+
* @param state -
|
|
2894
|
+
*/
|
|
2895
|
+
constructor({ addr, comment, state, }) {
|
|
2896
|
+
this.addr = addr;
|
|
2897
|
+
this.comment = comment;
|
|
2898
|
+
this.state = state;
|
|
2899
|
+
}
|
|
2900
|
+
// eslint-disable-next-line class-methods-use-this
|
|
2901
|
+
getEncodingSchema() {
|
|
2902
|
+
return GenesisAllocation.encodingSchema;
|
|
2903
|
+
}
|
|
2904
|
+
toEncodingData() {
|
|
2905
|
+
return new Map([
|
|
2906
|
+
['addr', this.addr],
|
|
2907
|
+
['comment', this.comment],
|
|
2908
|
+
['state', this.state.toEncodingData()],
|
|
2909
|
+
]);
|
|
2910
|
+
}
|
|
2911
|
+
static fromEncodingData(data) {
|
|
2912
|
+
if (!(data instanceof Map)) {
|
|
2913
|
+
throw new Error(`Invalid decoded GenesisAllocation: ${data}`);
|
|
2914
|
+
}
|
|
2915
|
+
return new GenesisAllocation({
|
|
2916
|
+
addr: data.get('addr'),
|
|
2917
|
+
comment: data.get('comment'),
|
|
2918
|
+
state: untypedmodel_js_1.UntypedValue.fromEncodingData(data.get('state') ?? new Map()),
|
|
2919
|
+
});
|
|
2920
|
+
}
|
|
2921
|
+
}
|
|
2922
|
+
exports.GenesisAllocation = GenesisAllocation;
|
|
2808
2923
|
/**
|
|
2809
2924
|
* Response containing the timestamp offset in seconds
|
|
2810
2925
|
*/
|
|
@@ -2883,56 +2998,6 @@ class GetSyncRoundResponse {
|
|
|
2883
2998
|
}
|
|
2884
2999
|
}
|
|
2885
3000
|
exports.GetSyncRoundResponse = GetSyncRoundResponse;
|
|
2886
|
-
/**
|
|
2887
|
-
* A single Delta containing the key, the previous value and the current value for
|
|
2888
|
-
* a single round.
|
|
2889
|
-
*/
|
|
2890
|
-
class KvDelta {
|
|
2891
|
-
static get encodingSchema() {
|
|
2892
|
-
if (!this.encodingSchemaValue) {
|
|
2893
|
-
this.encodingSchemaValue = new index_js_1.NamedMapSchema([]);
|
|
2894
|
-
this.encodingSchemaValue.pushEntries({
|
|
2895
|
-
key: 'key',
|
|
2896
|
-
valueSchema: new index_js_1.OptionalSchema(new index_js_1.ByteArraySchema()),
|
|
2897
|
-
omitEmpty: true,
|
|
2898
|
-
}, {
|
|
2899
|
-
key: 'value',
|
|
2900
|
-
valueSchema: new index_js_1.OptionalSchema(new index_js_1.ByteArraySchema()),
|
|
2901
|
-
omitEmpty: true,
|
|
2902
|
-
});
|
|
2903
|
-
}
|
|
2904
|
-
return this.encodingSchemaValue;
|
|
2905
|
-
}
|
|
2906
|
-
/**
|
|
2907
|
-
* Creates a new `KvDelta` object.
|
|
2908
|
-
* @param key - The key, base64 encoded.
|
|
2909
|
-
* @param value - The new value of the KV store entry, base64 encoded.
|
|
2910
|
-
*/
|
|
2911
|
-
constructor({ key, value, }) {
|
|
2912
|
-
this.key = typeof key === 'string' ? (0, binarydata_js_1.base64ToBytes)(key) : key;
|
|
2913
|
-
this.value = typeof value === 'string' ? (0, binarydata_js_1.base64ToBytes)(value) : value;
|
|
2914
|
-
}
|
|
2915
|
-
// eslint-disable-next-line class-methods-use-this
|
|
2916
|
-
getEncodingSchema() {
|
|
2917
|
-
return KvDelta.encodingSchema;
|
|
2918
|
-
}
|
|
2919
|
-
toEncodingData() {
|
|
2920
|
-
return new Map([
|
|
2921
|
-
['key', this.key],
|
|
2922
|
-
['value', this.value],
|
|
2923
|
-
]);
|
|
2924
|
-
}
|
|
2925
|
-
static fromEncodingData(data) {
|
|
2926
|
-
if (!(data instanceof Map)) {
|
|
2927
|
-
throw new Error(`Invalid decoded KvDelta: ${data}`);
|
|
2928
|
-
}
|
|
2929
|
-
return new KvDelta({
|
|
2930
|
-
key: data.get('key'),
|
|
2931
|
-
value: data.get('value'),
|
|
2932
|
-
});
|
|
2933
|
-
}
|
|
2934
|
-
}
|
|
2935
|
-
exports.KvDelta = KvDelta;
|
|
2936
3001
|
/**
|
|
2937
3002
|
* Contains a ledger delta for a single transaction group
|
|
2938
3003
|
*/
|