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
|
@@ -3,8 +3,8 @@
|
|
|
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.PendingTransactionsResponse = exports.PendingTransactionResponse = exports.NodeStatusResponse = exports.LightBlockHeaderProof = exports.LedgerStateDeltaForTransactionGroup = exports.
|
|
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 =
|
|
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
|
+
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");
|
|
10
10
|
const index_js_1 = require("../../../../encoding/schema/index.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
|
}
|
|
@@ -1765,47 +1774,6 @@ class BlockHashResponse {
|
|
|
1765
1774
|
}
|
|
1766
1775
|
}
|
|
1767
1776
|
exports.BlockHashResponse = BlockHashResponse;
|
|
1768
|
-
/**
|
|
1769
|
-
* Block header.
|
|
1770
|
-
*/
|
|
1771
|
-
class BlockHeaderResponse {
|
|
1772
|
-
static get encodingSchema() {
|
|
1773
|
-
if (!this.encodingSchemaValue) {
|
|
1774
|
-
this.encodingSchemaValue = new index_js_1.NamedMapSchema([]);
|
|
1775
|
-
this.encodingSchemaValue.pushEntries({
|
|
1776
|
-
key: 'blockHeader',
|
|
1777
|
-
valueSchema: block_js_1.Block.encodingSchema,
|
|
1778
|
-
omitEmpty: true,
|
|
1779
|
-
});
|
|
1780
|
-
}
|
|
1781
|
-
return this.encodingSchemaValue;
|
|
1782
|
-
}
|
|
1783
|
-
/**
|
|
1784
|
-
* Creates a new `BlockHeaderResponse` object.
|
|
1785
|
-
* @param blockheader - Block header data.
|
|
1786
|
-
*/
|
|
1787
|
-
constructor({ blockheader }) {
|
|
1788
|
-
this.blockheader = blockheader;
|
|
1789
|
-
}
|
|
1790
|
-
// eslint-disable-next-line class-methods-use-this
|
|
1791
|
-
getEncodingSchema() {
|
|
1792
|
-
return BlockHeaderResponse.encodingSchema;
|
|
1793
|
-
}
|
|
1794
|
-
toEncodingData() {
|
|
1795
|
-
return new Map([
|
|
1796
|
-
['blockHeader', this.blockheader.toEncodingData()],
|
|
1797
|
-
]);
|
|
1798
|
-
}
|
|
1799
|
-
static fromEncodingData(data) {
|
|
1800
|
-
if (!(data instanceof Map)) {
|
|
1801
|
-
throw new Error(`Invalid decoded BlockHeaderResponse: ${data}`);
|
|
1802
|
-
}
|
|
1803
|
-
return new BlockHeaderResponse({
|
|
1804
|
-
blockheader: block_js_1.Block.fromEncodingData(data.get('blockHeader') ?? new Map()),
|
|
1805
|
-
});
|
|
1806
|
-
}
|
|
1807
|
-
}
|
|
1808
|
-
exports.BlockHeaderResponse = BlockHeaderResponse;
|
|
1809
1777
|
/**
|
|
1810
1778
|
* All logs emitted in the given round. Each app call, whether top-level or inner,
|
|
1811
1779
|
* that contains logs results in a separate AppCallLogs object. Therefore there may
|
|
@@ -1952,19 +1920,27 @@ class Box {
|
|
|
1952
1920
|
static get encodingSchema() {
|
|
1953
1921
|
if (!this.encodingSchemaValue) {
|
|
1954
1922
|
this.encodingSchemaValue = new index_js_1.NamedMapSchema([]);
|
|
1955
|
-
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
|
+
});
|
|
1956
1932
|
}
|
|
1957
1933
|
return this.encodingSchemaValue;
|
|
1958
1934
|
}
|
|
1959
1935
|
/**
|
|
1960
1936
|
* Creates a new `Box` object.
|
|
1961
|
-
* @param name -
|
|
1937
|
+
* @param name - The box name, base64 encoded
|
|
1962
1938
|
* @param round - The round for which this information is relevant
|
|
1963
|
-
* @param value -
|
|
1939
|
+
* @param value - The box value, base64 encoded.
|
|
1964
1940
|
*/
|
|
1965
1941
|
constructor({ name, round, value, }) {
|
|
1966
1942
|
this.name = typeof name === 'string' ? (0, binarydata_js_1.base64ToBytes)(name) : name;
|
|
1967
|
-
this.round = (0, utils_js_1.ensureBigInt)(round);
|
|
1943
|
+
this.round = typeof round === 'undefined' ? undefined : (0, utils_js_1.ensureBigInt)(round);
|
|
1968
1944
|
this.value = typeof value === 'string' ? (0, binarydata_js_1.base64ToBytes)(value) : value;
|
|
1969
1945
|
}
|
|
1970
1946
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -1990,45 +1966,6 @@ class Box {
|
|
|
1990
1966
|
}
|
|
1991
1967
|
}
|
|
1992
1968
|
exports.Box = Box;
|
|
1993
|
-
/**
|
|
1994
|
-
* Box descriptor describes a Box.
|
|
1995
|
-
*/
|
|
1996
|
-
class BoxDescriptor {
|
|
1997
|
-
static get encodingSchema() {
|
|
1998
|
-
if (!this.encodingSchemaValue) {
|
|
1999
|
-
this.encodingSchemaValue = new index_js_1.NamedMapSchema([]);
|
|
2000
|
-
this.encodingSchemaValue.pushEntries({
|
|
2001
|
-
key: 'name',
|
|
2002
|
-
valueSchema: new index_js_1.ByteArraySchema(),
|
|
2003
|
-
omitEmpty: true,
|
|
2004
|
-
});
|
|
2005
|
-
}
|
|
2006
|
-
return this.encodingSchemaValue;
|
|
2007
|
-
}
|
|
2008
|
-
/**
|
|
2009
|
-
* Creates a new `BoxDescriptor` object.
|
|
2010
|
-
* @param name - Base64 encoded box name
|
|
2011
|
-
*/
|
|
2012
|
-
constructor({ name }) {
|
|
2013
|
-
this.name = typeof name === 'string' ? (0, binarydata_js_1.base64ToBytes)(name) : name;
|
|
2014
|
-
}
|
|
2015
|
-
// eslint-disable-next-line class-methods-use-this
|
|
2016
|
-
getEncodingSchema() {
|
|
2017
|
-
return BoxDescriptor.encodingSchema;
|
|
2018
|
-
}
|
|
2019
|
-
toEncodingData() {
|
|
2020
|
-
return new Map([['name', this.name]]);
|
|
2021
|
-
}
|
|
2022
|
-
static fromEncodingData(data) {
|
|
2023
|
-
if (!(data instanceof Map)) {
|
|
2024
|
-
throw new Error(`Invalid decoded BoxDescriptor: ${data}`);
|
|
2025
|
-
}
|
|
2026
|
-
return new BoxDescriptor({
|
|
2027
|
-
name: data.get('name'),
|
|
2028
|
-
});
|
|
2029
|
-
}
|
|
2030
|
-
}
|
|
2031
|
-
exports.BoxDescriptor = BoxDescriptor;
|
|
2032
1969
|
/**
|
|
2033
1970
|
* References a box of an application.
|
|
2034
1971
|
*/
|
|
@@ -2071,7 +2008,7 @@ class BoxReference {
|
|
|
2071
2008
|
}
|
|
2072
2009
|
exports.BoxReference = BoxReference;
|
|
2073
2010
|
/**
|
|
2074
|
-
*
|
|
2011
|
+
* Boxes of an application
|
|
2075
2012
|
*/
|
|
2076
2013
|
class BoxesResponse {
|
|
2077
2014
|
static get encodingSchema() {
|
|
@@ -2079,7 +2016,11 @@ class BoxesResponse {
|
|
|
2079
2016
|
this.encodingSchemaValue = new index_js_1.NamedMapSchema([]);
|
|
2080
2017
|
this.encodingSchemaValue.pushEntries({
|
|
2081
2018
|
key: 'boxes',
|
|
2082
|
-
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()),
|
|
2083
2024
|
omitEmpty: true,
|
|
2084
2025
|
});
|
|
2085
2026
|
}
|
|
@@ -2088,9 +2029,14 @@ class BoxesResponse {
|
|
|
2088
2029
|
/**
|
|
2089
2030
|
* Creates a new `BoxesResponse` object.
|
|
2090
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.
|
|
2091
2035
|
*/
|
|
2092
|
-
constructor({ boxes }) {
|
|
2036
|
+
constructor({ boxes, round, nextToken, }) {
|
|
2093
2037
|
this.boxes = boxes;
|
|
2038
|
+
this.round = (0, utils_js_1.ensureSafeInteger)(round);
|
|
2039
|
+
this.nextToken = nextToken;
|
|
2094
2040
|
}
|
|
2095
2041
|
// eslint-disable-next-line class-methods-use-this
|
|
2096
2042
|
getEncodingSchema() {
|
|
@@ -2099,6 +2045,8 @@ class BoxesResponse {
|
|
|
2099
2045
|
toEncodingData() {
|
|
2100
2046
|
return new Map([
|
|
2101
2047
|
['boxes', this.boxes.map((v) => v.toEncodingData())],
|
|
2048
|
+
['round', this.round],
|
|
2049
|
+
['next-token', this.nextToken],
|
|
2102
2050
|
]);
|
|
2103
2051
|
}
|
|
2104
2052
|
static fromEncodingData(data) {
|
|
@@ -2106,7 +2054,9 @@ class BoxesResponse {
|
|
|
2106
2054
|
throw new Error(`Invalid decoded BoxesResponse: ${data}`);
|
|
2107
2055
|
}
|
|
2108
2056
|
return new BoxesResponse({
|
|
2109
|
-
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'),
|
|
2110
2060
|
});
|
|
2111
2061
|
}
|
|
2112
2062
|
}
|
|
@@ -2846,6 +2796,130 @@ class EvalDeltaKeyValue {
|
|
|
2846
2796
|
}
|
|
2847
2797
|
}
|
|
2848
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;
|
|
2849
2923
|
/**
|
|
2850
2924
|
* Response containing the timestamp offset in seconds
|
|
2851
2925
|
*/
|
|
@@ -2924,56 +2998,6 @@ class GetSyncRoundResponse {
|
|
|
2924
2998
|
}
|
|
2925
2999
|
}
|
|
2926
3000
|
exports.GetSyncRoundResponse = GetSyncRoundResponse;
|
|
2927
|
-
/**
|
|
2928
|
-
* A single Delta containing the key, the previous value and the current value for
|
|
2929
|
-
* a single round.
|
|
2930
|
-
*/
|
|
2931
|
-
class KvDelta {
|
|
2932
|
-
static get encodingSchema() {
|
|
2933
|
-
if (!this.encodingSchemaValue) {
|
|
2934
|
-
this.encodingSchemaValue = new index_js_1.NamedMapSchema([]);
|
|
2935
|
-
this.encodingSchemaValue.pushEntries({
|
|
2936
|
-
key: 'key',
|
|
2937
|
-
valueSchema: new index_js_1.OptionalSchema(new index_js_1.ByteArraySchema()),
|
|
2938
|
-
omitEmpty: true,
|
|
2939
|
-
}, {
|
|
2940
|
-
key: 'value',
|
|
2941
|
-
valueSchema: new index_js_1.OptionalSchema(new index_js_1.ByteArraySchema()),
|
|
2942
|
-
omitEmpty: true,
|
|
2943
|
-
});
|
|
2944
|
-
}
|
|
2945
|
-
return this.encodingSchemaValue;
|
|
2946
|
-
}
|
|
2947
|
-
/**
|
|
2948
|
-
* Creates a new `KvDelta` object.
|
|
2949
|
-
* @param key - The key, base64 encoded.
|
|
2950
|
-
* @param value - The new value of the KV store entry, base64 encoded.
|
|
2951
|
-
*/
|
|
2952
|
-
constructor({ key, value, }) {
|
|
2953
|
-
this.key = typeof key === 'string' ? (0, binarydata_js_1.base64ToBytes)(key) : key;
|
|
2954
|
-
this.value = typeof value === 'string' ? (0, binarydata_js_1.base64ToBytes)(value) : value;
|
|
2955
|
-
}
|
|
2956
|
-
// eslint-disable-next-line class-methods-use-this
|
|
2957
|
-
getEncodingSchema() {
|
|
2958
|
-
return KvDelta.encodingSchema;
|
|
2959
|
-
}
|
|
2960
|
-
toEncodingData() {
|
|
2961
|
-
return new Map([
|
|
2962
|
-
['key', this.key],
|
|
2963
|
-
['value', this.value],
|
|
2964
|
-
]);
|
|
2965
|
-
}
|
|
2966
|
-
static fromEncodingData(data) {
|
|
2967
|
-
if (!(data instanceof Map)) {
|
|
2968
|
-
throw new Error(`Invalid decoded KvDelta: ${data}`);
|
|
2969
|
-
}
|
|
2970
|
-
return new KvDelta({
|
|
2971
|
-
key: data.get('key'),
|
|
2972
|
-
value: data.get('value'),
|
|
2973
|
-
});
|
|
2974
|
-
}
|
|
2975
|
-
}
|
|
2976
|
-
exports.KvDelta = KvDelta;
|
|
2977
3001
|
/**
|
|
2978
3002
|
* Contains a ledger delta for a single transaction group
|
|
2979
3003
|
*/
|