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
|
@@ -1103,6 +1103,10 @@ export class ApplicationParams {
|
|
|
1103
1103
|
key: 'local-state-schema',
|
|
1104
1104
|
valueSchema: new OptionalSchema(ApplicationStateSchema.encodingSchema),
|
|
1105
1105
|
omitEmpty: true,
|
|
1106
|
+
}, {
|
|
1107
|
+
key: 'version',
|
|
1108
|
+
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
1109
|
+
omitEmpty: true,
|
|
1106
1110
|
});
|
|
1107
1111
|
}
|
|
1108
1112
|
return this.encodingSchemaValue;
|
|
@@ -1117,8 +1121,9 @@ export class ApplicationParams {
|
|
|
1117
1121
|
* @param globalState - (gs) global state
|
|
1118
1122
|
* @param globalStateSchema - (gsch) global schema
|
|
1119
1123
|
* @param localStateSchema - (lsch) local schema
|
|
1124
|
+
* @param version - (v) the number of updates to the application programs
|
|
1120
1125
|
*/
|
|
1121
|
-
constructor({ approvalProgram, clearStateProgram, creator, extraProgramPages, globalState, globalStateSchema, localStateSchema, }) {
|
|
1126
|
+
constructor({ approvalProgram, clearStateProgram, creator, extraProgramPages, globalState, globalStateSchema, localStateSchema, version, }) {
|
|
1122
1127
|
this.approvalProgram =
|
|
1123
1128
|
typeof approvalProgram === 'string'
|
|
1124
1129
|
? base64ToBytes(approvalProgram)
|
|
@@ -1136,6 +1141,8 @@ export class ApplicationParams {
|
|
|
1136
1141
|
this.globalState = globalState;
|
|
1137
1142
|
this.globalStateSchema = globalStateSchema;
|
|
1138
1143
|
this.localStateSchema = localStateSchema;
|
|
1144
|
+
this.version =
|
|
1145
|
+
typeof version === 'undefined' ? undefined : ensureSafeInteger(version);
|
|
1139
1146
|
}
|
|
1140
1147
|
// eslint-disable-next-line class-methods-use-this
|
|
1141
1148
|
getEncodingSchema() {
|
|
@@ -1165,6 +1172,7 @@ export class ApplicationParams {
|
|
|
1165
1172
|
? this.localStateSchema.toEncodingData()
|
|
1166
1173
|
: undefined,
|
|
1167
1174
|
],
|
|
1175
|
+
['version', this.version],
|
|
1168
1176
|
]);
|
|
1169
1177
|
}
|
|
1170
1178
|
static fromEncodingData(data) {
|
|
@@ -1187,6 +1195,7 @@ export class ApplicationParams {
|
|
|
1187
1195
|
localStateSchema: typeof data.get('local-state-schema') !== 'undefined'
|
|
1188
1196
|
? ApplicationStateSchema.fromEncodingData(data.get('local-state-schema'))
|
|
1189
1197
|
: undefined,
|
|
1198
|
+
version: data.get('version'),
|
|
1190
1199
|
});
|
|
1191
1200
|
}
|
|
1192
1201
|
}
|
|
@@ -1738,46 +1747,6 @@ export class BlockHashResponse {
|
|
|
1738
1747
|
});
|
|
1739
1748
|
}
|
|
1740
1749
|
}
|
|
1741
|
-
/**
|
|
1742
|
-
* Block header.
|
|
1743
|
-
*/
|
|
1744
|
-
export class BlockHeaderResponse {
|
|
1745
|
-
static get encodingSchema() {
|
|
1746
|
-
if (!this.encodingSchemaValue) {
|
|
1747
|
-
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
1748
|
-
this.encodingSchemaValue.pushEntries({
|
|
1749
|
-
key: 'blockHeader',
|
|
1750
|
-
valueSchema: Block.encodingSchema,
|
|
1751
|
-
omitEmpty: true,
|
|
1752
|
-
});
|
|
1753
|
-
}
|
|
1754
|
-
return this.encodingSchemaValue;
|
|
1755
|
-
}
|
|
1756
|
-
/**
|
|
1757
|
-
* Creates a new `BlockHeaderResponse` object.
|
|
1758
|
-
* @param blockheader - Block header data.
|
|
1759
|
-
*/
|
|
1760
|
-
constructor({ blockheader }) {
|
|
1761
|
-
this.blockheader = blockheader;
|
|
1762
|
-
}
|
|
1763
|
-
// eslint-disable-next-line class-methods-use-this
|
|
1764
|
-
getEncodingSchema() {
|
|
1765
|
-
return BlockHeaderResponse.encodingSchema;
|
|
1766
|
-
}
|
|
1767
|
-
toEncodingData() {
|
|
1768
|
-
return new Map([
|
|
1769
|
-
['blockHeader', this.blockheader.toEncodingData()],
|
|
1770
|
-
]);
|
|
1771
|
-
}
|
|
1772
|
-
static fromEncodingData(data) {
|
|
1773
|
-
if (!(data instanceof Map)) {
|
|
1774
|
-
throw new Error(`Invalid decoded BlockHeaderResponse: ${data}`);
|
|
1775
|
-
}
|
|
1776
|
-
return new BlockHeaderResponse({
|
|
1777
|
-
blockheader: Block.fromEncodingData(data.get('blockHeader') ?? new Map()),
|
|
1778
|
-
});
|
|
1779
|
-
}
|
|
1780
|
-
}
|
|
1781
1750
|
/**
|
|
1782
1751
|
* All logs emitted in the given round. Each app call, whether top-level or inner,
|
|
1783
1752
|
* that contains logs results in a separate AppCallLogs object. Therefore there may
|
|
@@ -1921,19 +1890,27 @@ export class Box {
|
|
|
1921
1890
|
static get encodingSchema() {
|
|
1922
1891
|
if (!this.encodingSchemaValue) {
|
|
1923
1892
|
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
1924
|
-
this.encodingSchemaValue.pushEntries({ key: 'name', valueSchema: new ByteArraySchema(), omitEmpty: true }, {
|
|
1893
|
+
this.encodingSchemaValue.pushEntries({ key: 'name', valueSchema: new ByteArraySchema(), omitEmpty: true }, {
|
|
1894
|
+
key: 'round',
|
|
1895
|
+
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
1896
|
+
omitEmpty: true,
|
|
1897
|
+
}, {
|
|
1898
|
+
key: 'value',
|
|
1899
|
+
valueSchema: new OptionalSchema(new ByteArraySchema()),
|
|
1900
|
+
omitEmpty: true,
|
|
1901
|
+
});
|
|
1925
1902
|
}
|
|
1926
1903
|
return this.encodingSchemaValue;
|
|
1927
1904
|
}
|
|
1928
1905
|
/**
|
|
1929
1906
|
* Creates a new `Box` object.
|
|
1930
|
-
* @param name -
|
|
1907
|
+
* @param name - The box name, base64 encoded
|
|
1931
1908
|
* @param round - The round for which this information is relevant
|
|
1932
|
-
* @param value -
|
|
1909
|
+
* @param value - The box value, base64 encoded.
|
|
1933
1910
|
*/
|
|
1934
1911
|
constructor({ name, round, value, }) {
|
|
1935
1912
|
this.name = typeof name === 'string' ? base64ToBytes(name) : name;
|
|
1936
|
-
this.round = ensureBigInt(round);
|
|
1913
|
+
this.round = typeof round === 'undefined' ? undefined : ensureBigInt(round);
|
|
1937
1914
|
this.value = typeof value === 'string' ? base64ToBytes(value) : value;
|
|
1938
1915
|
}
|
|
1939
1916
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -1958,44 +1935,6 @@ export class Box {
|
|
|
1958
1935
|
});
|
|
1959
1936
|
}
|
|
1960
1937
|
}
|
|
1961
|
-
/**
|
|
1962
|
-
* Box descriptor describes a Box.
|
|
1963
|
-
*/
|
|
1964
|
-
export class BoxDescriptor {
|
|
1965
|
-
static get encodingSchema() {
|
|
1966
|
-
if (!this.encodingSchemaValue) {
|
|
1967
|
-
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
1968
|
-
this.encodingSchemaValue.pushEntries({
|
|
1969
|
-
key: 'name',
|
|
1970
|
-
valueSchema: new ByteArraySchema(),
|
|
1971
|
-
omitEmpty: true,
|
|
1972
|
-
});
|
|
1973
|
-
}
|
|
1974
|
-
return this.encodingSchemaValue;
|
|
1975
|
-
}
|
|
1976
|
-
/**
|
|
1977
|
-
* Creates a new `BoxDescriptor` object.
|
|
1978
|
-
* @param name - Base64 encoded box name
|
|
1979
|
-
*/
|
|
1980
|
-
constructor({ name }) {
|
|
1981
|
-
this.name = typeof name === 'string' ? base64ToBytes(name) : name;
|
|
1982
|
-
}
|
|
1983
|
-
// eslint-disable-next-line class-methods-use-this
|
|
1984
|
-
getEncodingSchema() {
|
|
1985
|
-
return BoxDescriptor.encodingSchema;
|
|
1986
|
-
}
|
|
1987
|
-
toEncodingData() {
|
|
1988
|
-
return new Map([['name', this.name]]);
|
|
1989
|
-
}
|
|
1990
|
-
static fromEncodingData(data) {
|
|
1991
|
-
if (!(data instanceof Map)) {
|
|
1992
|
-
throw new Error(`Invalid decoded BoxDescriptor: ${data}`);
|
|
1993
|
-
}
|
|
1994
|
-
return new BoxDescriptor({
|
|
1995
|
-
name: data.get('name'),
|
|
1996
|
-
});
|
|
1997
|
-
}
|
|
1998
|
-
}
|
|
1999
1938
|
/**
|
|
2000
1939
|
* References a box of an application.
|
|
2001
1940
|
*/
|
|
@@ -2037,7 +1976,7 @@ export class BoxReference {
|
|
|
2037
1976
|
}
|
|
2038
1977
|
}
|
|
2039
1978
|
/**
|
|
2040
|
-
*
|
|
1979
|
+
* Boxes of an application
|
|
2041
1980
|
*/
|
|
2042
1981
|
export class BoxesResponse {
|
|
2043
1982
|
static get encodingSchema() {
|
|
@@ -2045,7 +1984,11 @@ export class BoxesResponse {
|
|
|
2045
1984
|
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
2046
1985
|
this.encodingSchemaValue.pushEntries({
|
|
2047
1986
|
key: 'boxes',
|
|
2048
|
-
valueSchema: new ArraySchema(
|
|
1987
|
+
valueSchema: new ArraySchema(Box.encodingSchema),
|
|
1988
|
+
omitEmpty: true,
|
|
1989
|
+
}, { key: 'round', valueSchema: new Uint64Schema(), omitEmpty: true }, {
|
|
1990
|
+
key: 'next-token',
|
|
1991
|
+
valueSchema: new OptionalSchema(new StringSchema()),
|
|
2049
1992
|
omitEmpty: true,
|
|
2050
1993
|
});
|
|
2051
1994
|
}
|
|
@@ -2054,9 +1997,14 @@ export class BoxesResponse {
|
|
|
2054
1997
|
/**
|
|
2055
1998
|
* Creates a new `BoxesResponse` object.
|
|
2056
1999
|
* @param boxes -
|
|
2000
|
+
* @param round - The round for which this information is relevant.
|
|
2001
|
+
* @param nextToken - Used for pagination, when making another request provide this token with the
|
|
2002
|
+
* next parameter.
|
|
2057
2003
|
*/
|
|
2058
|
-
constructor({ boxes }) {
|
|
2004
|
+
constructor({ boxes, round, nextToken, }) {
|
|
2059
2005
|
this.boxes = boxes;
|
|
2006
|
+
this.round = ensureSafeInteger(round);
|
|
2007
|
+
this.nextToken = nextToken;
|
|
2060
2008
|
}
|
|
2061
2009
|
// eslint-disable-next-line class-methods-use-this
|
|
2062
2010
|
getEncodingSchema() {
|
|
@@ -2065,6 +2013,8 @@ export class BoxesResponse {
|
|
|
2065
2013
|
toEncodingData() {
|
|
2066
2014
|
return new Map([
|
|
2067
2015
|
['boxes', this.boxes.map((v) => v.toEncodingData())],
|
|
2016
|
+
['round', this.round],
|
|
2017
|
+
['next-token', this.nextToken],
|
|
2068
2018
|
]);
|
|
2069
2019
|
}
|
|
2070
2020
|
static fromEncodingData(data) {
|
|
@@ -2072,7 +2022,9 @@ export class BoxesResponse {
|
|
|
2072
2022
|
throw new Error(`Invalid decoded BoxesResponse: ${data}`);
|
|
2073
2023
|
}
|
|
2074
2024
|
return new BoxesResponse({
|
|
2075
|
-
boxes: (data.get('boxes') ?? []).map((v) =>
|
|
2025
|
+
boxes: (data.get('boxes') ?? []).map((v) => Box.fromEncodingData(v)),
|
|
2026
|
+
round: data.get('round'),
|
|
2027
|
+
nextToken: data.get('next-token'),
|
|
2076
2028
|
});
|
|
2077
2029
|
}
|
|
2078
2030
|
}
|
|
@@ -2800,6 +2752,128 @@ export class EvalDeltaKeyValue {
|
|
|
2800
2752
|
});
|
|
2801
2753
|
}
|
|
2802
2754
|
}
|
|
2755
|
+
export class Genesis {
|
|
2756
|
+
static get encodingSchema() {
|
|
2757
|
+
if (!this.encodingSchemaValue) {
|
|
2758
|
+
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
2759
|
+
this.encodingSchemaValue.pushEntries({
|
|
2760
|
+
key: 'alloc',
|
|
2761
|
+
valueSchema: new ArraySchema(GenesisAllocation.encodingSchema),
|
|
2762
|
+
omitEmpty: true,
|
|
2763
|
+
}, { key: 'fees', valueSchema: new StringSchema(), omitEmpty: true }, { key: 'id', valueSchema: new StringSchema(), omitEmpty: true }, { key: 'network', valueSchema: new StringSchema(), omitEmpty: true }, { key: 'proto', valueSchema: new StringSchema(), omitEmpty: true }, { key: 'rwd', valueSchema: new StringSchema(), omitEmpty: true }, { key: 'timestamp', valueSchema: new Uint64Schema(), omitEmpty: true }, {
|
|
2764
|
+
key: 'comment',
|
|
2765
|
+
valueSchema: new OptionalSchema(new StringSchema()),
|
|
2766
|
+
omitEmpty: true,
|
|
2767
|
+
}, {
|
|
2768
|
+
key: 'devmode',
|
|
2769
|
+
valueSchema: new OptionalSchema(new BooleanSchema()),
|
|
2770
|
+
omitEmpty: true,
|
|
2771
|
+
});
|
|
2772
|
+
}
|
|
2773
|
+
return this.encodingSchemaValue;
|
|
2774
|
+
}
|
|
2775
|
+
/**
|
|
2776
|
+
* Creates a new `Genesis` object.
|
|
2777
|
+
* @param alloc -
|
|
2778
|
+
* @param fees -
|
|
2779
|
+
* @param id -
|
|
2780
|
+
* @param network -
|
|
2781
|
+
* @param proto -
|
|
2782
|
+
* @param rwd -
|
|
2783
|
+
* @param timestamp -
|
|
2784
|
+
* @param comment -
|
|
2785
|
+
* @param devmode -
|
|
2786
|
+
*/
|
|
2787
|
+
constructor({ alloc, fees, id, network, proto, rwd, timestamp, comment, devmode, }) {
|
|
2788
|
+
this.alloc = alloc;
|
|
2789
|
+
this.fees = fees;
|
|
2790
|
+
this.id = id;
|
|
2791
|
+
this.network = network;
|
|
2792
|
+
this.proto = proto;
|
|
2793
|
+
this.rwd = rwd;
|
|
2794
|
+
this.timestamp = ensureSafeInteger(timestamp);
|
|
2795
|
+
this.comment = comment;
|
|
2796
|
+
this.devmode = devmode;
|
|
2797
|
+
}
|
|
2798
|
+
// eslint-disable-next-line class-methods-use-this
|
|
2799
|
+
getEncodingSchema() {
|
|
2800
|
+
return Genesis.encodingSchema;
|
|
2801
|
+
}
|
|
2802
|
+
toEncodingData() {
|
|
2803
|
+
return new Map([
|
|
2804
|
+
['alloc', this.alloc.map((v) => v.toEncodingData())],
|
|
2805
|
+
['fees', this.fees],
|
|
2806
|
+
['id', this.id],
|
|
2807
|
+
['network', this.network],
|
|
2808
|
+
['proto', this.proto],
|
|
2809
|
+
['rwd', this.rwd],
|
|
2810
|
+
['timestamp', this.timestamp],
|
|
2811
|
+
['comment', this.comment],
|
|
2812
|
+
['devmode', this.devmode],
|
|
2813
|
+
]);
|
|
2814
|
+
}
|
|
2815
|
+
static fromEncodingData(data) {
|
|
2816
|
+
if (!(data instanceof Map)) {
|
|
2817
|
+
throw new Error(`Invalid decoded Genesis: ${data}`);
|
|
2818
|
+
}
|
|
2819
|
+
return new Genesis({
|
|
2820
|
+
alloc: (data.get('alloc') ?? []).map((v) => GenesisAllocation.fromEncodingData(v)),
|
|
2821
|
+
fees: data.get('fees'),
|
|
2822
|
+
id: data.get('id'),
|
|
2823
|
+
network: data.get('network'),
|
|
2824
|
+
proto: data.get('proto'),
|
|
2825
|
+
rwd: data.get('rwd'),
|
|
2826
|
+
timestamp: data.get('timestamp'),
|
|
2827
|
+
comment: data.get('comment'),
|
|
2828
|
+
devmode: data.get('devmode'),
|
|
2829
|
+
});
|
|
2830
|
+
}
|
|
2831
|
+
}
|
|
2832
|
+
export class GenesisAllocation {
|
|
2833
|
+
static get encodingSchema() {
|
|
2834
|
+
if (!this.encodingSchemaValue) {
|
|
2835
|
+
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
2836
|
+
this.encodingSchemaValue.pushEntries({ key: 'addr', valueSchema: new StringSchema(), omitEmpty: true }, { key: 'comment', valueSchema: new StringSchema(), omitEmpty: true }, {
|
|
2837
|
+
key: 'state',
|
|
2838
|
+
valueSchema: UntypedValue.encodingSchema,
|
|
2839
|
+
omitEmpty: true,
|
|
2840
|
+
});
|
|
2841
|
+
}
|
|
2842
|
+
return this.encodingSchemaValue;
|
|
2843
|
+
}
|
|
2844
|
+
/**
|
|
2845
|
+
* Creates a new `GenesisAllocation` object.
|
|
2846
|
+
* @param addr -
|
|
2847
|
+
* @param comment -
|
|
2848
|
+
* @param state -
|
|
2849
|
+
*/
|
|
2850
|
+
constructor({ addr, comment, state, }) {
|
|
2851
|
+
this.addr = addr;
|
|
2852
|
+
this.comment = comment;
|
|
2853
|
+
this.state = state;
|
|
2854
|
+
}
|
|
2855
|
+
// eslint-disable-next-line class-methods-use-this
|
|
2856
|
+
getEncodingSchema() {
|
|
2857
|
+
return GenesisAllocation.encodingSchema;
|
|
2858
|
+
}
|
|
2859
|
+
toEncodingData() {
|
|
2860
|
+
return new Map([
|
|
2861
|
+
['addr', this.addr],
|
|
2862
|
+
['comment', this.comment],
|
|
2863
|
+
['state', this.state.toEncodingData()],
|
|
2864
|
+
]);
|
|
2865
|
+
}
|
|
2866
|
+
static fromEncodingData(data) {
|
|
2867
|
+
if (!(data instanceof Map)) {
|
|
2868
|
+
throw new Error(`Invalid decoded GenesisAllocation: ${data}`);
|
|
2869
|
+
}
|
|
2870
|
+
return new GenesisAllocation({
|
|
2871
|
+
addr: data.get('addr'),
|
|
2872
|
+
comment: data.get('comment'),
|
|
2873
|
+
state: UntypedValue.fromEncodingData(data.get('state') ?? new Map()),
|
|
2874
|
+
});
|
|
2875
|
+
}
|
|
2876
|
+
}
|
|
2803
2877
|
/**
|
|
2804
2878
|
* Response containing the timestamp offset in seconds
|
|
2805
2879
|
*/
|
|
@@ -2876,55 +2950,6 @@ export class GetSyncRoundResponse {
|
|
|
2876
2950
|
});
|
|
2877
2951
|
}
|
|
2878
2952
|
}
|
|
2879
|
-
/**
|
|
2880
|
-
* A single Delta containing the key, the previous value and the current value for
|
|
2881
|
-
* a single round.
|
|
2882
|
-
*/
|
|
2883
|
-
export class KvDelta {
|
|
2884
|
-
static get encodingSchema() {
|
|
2885
|
-
if (!this.encodingSchemaValue) {
|
|
2886
|
-
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
2887
|
-
this.encodingSchemaValue.pushEntries({
|
|
2888
|
-
key: 'key',
|
|
2889
|
-
valueSchema: new OptionalSchema(new ByteArraySchema()),
|
|
2890
|
-
omitEmpty: true,
|
|
2891
|
-
}, {
|
|
2892
|
-
key: 'value',
|
|
2893
|
-
valueSchema: new OptionalSchema(new ByteArraySchema()),
|
|
2894
|
-
omitEmpty: true,
|
|
2895
|
-
});
|
|
2896
|
-
}
|
|
2897
|
-
return this.encodingSchemaValue;
|
|
2898
|
-
}
|
|
2899
|
-
/**
|
|
2900
|
-
* Creates a new `KvDelta` object.
|
|
2901
|
-
* @param key - The key, base64 encoded.
|
|
2902
|
-
* @param value - The new value of the KV store entry, base64 encoded.
|
|
2903
|
-
*/
|
|
2904
|
-
constructor({ key, value, }) {
|
|
2905
|
-
this.key = typeof key === 'string' ? base64ToBytes(key) : key;
|
|
2906
|
-
this.value = typeof value === 'string' ? base64ToBytes(value) : value;
|
|
2907
|
-
}
|
|
2908
|
-
// eslint-disable-next-line class-methods-use-this
|
|
2909
|
-
getEncodingSchema() {
|
|
2910
|
-
return KvDelta.encodingSchema;
|
|
2911
|
-
}
|
|
2912
|
-
toEncodingData() {
|
|
2913
|
-
return new Map([
|
|
2914
|
-
['key', this.key],
|
|
2915
|
-
['value', this.value],
|
|
2916
|
-
]);
|
|
2917
|
-
}
|
|
2918
|
-
static fromEncodingData(data) {
|
|
2919
|
-
if (!(data instanceof Map)) {
|
|
2920
|
-
throw new Error(`Invalid decoded KvDelta: ${data}`);
|
|
2921
|
-
}
|
|
2922
|
-
return new KvDelta({
|
|
2923
|
-
key: data.get('key'),
|
|
2924
|
-
value: data.get('value'),
|
|
2925
|
-
});
|
|
2926
|
-
}
|
|
2927
|
-
}
|
|
2928
2953
|
/**
|
|
2929
2954
|
* Contains a ledger delta for a single transaction group
|
|
2930
2955
|
*/
|