koilib 2.8.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -12
- package/dist/koinos.js +8535 -284
- package/dist/koinos.min.js +1 -1
- package/lib/Contract.d.ts +66 -18
- package/lib/Contract.js +103 -40
- package/lib/Contract.js.map +1 -1
- package/lib/Provider.d.ts +22 -7
- package/lib/Provider.js +60 -21
- package/lib/Provider.js.map +1 -1
- package/lib/Serializer.d.ts +3 -1
- package/lib/Serializer.js +103 -83
- package/lib/Serializer.js.map +1 -1
- package/lib/Signer.d.ts +54 -42
- package/lib/Signer.js +305 -114
- package/lib/Signer.js.map +1 -1
- package/lib/browser/Contract.d.ts +66 -18
- package/lib/browser/Contract.js +103 -40
- package/lib/browser/Contract.js.map +1 -1
- package/lib/browser/Provider.d.ts +22 -7
- package/lib/browser/Provider.js +60 -21
- package/lib/browser/Provider.js.map +1 -1
- package/lib/browser/Serializer.d.ts +3 -1
- package/lib/browser/Serializer.js +103 -83
- package/lib/browser/Serializer.js.map +1 -1
- package/lib/browser/Signer.d.ts +54 -42
- package/lib/browser/Signer.js +305 -114
- package/lib/browser/Signer.js.map +1 -1
- package/lib/browser/index.d.ts +1 -1
- package/lib/browser/index.js +1 -1
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/indexUtils.d.ts +2 -0
- package/lib/browser/indexUtils.js +15 -0
- package/lib/browser/indexUtils.js.map +1 -0
- package/lib/browser/interface.d.ts +242 -46
- package/lib/browser/jsonDescriptors/chain-proto.json +676 -0
- package/lib/browser/jsonDescriptors/{krc20-proto.json → token-proto.json} +47 -4
- package/lib/browser/protoModules/protocol-proto.d.ts +2 -0
- package/lib/browser/protoModules/protocol-proto.js +6336 -0
- package/lib/browser/protoModules/protocol-proto.js.map +1 -0
- package/lib/browser/utils.d.ts +19 -255
- package/lib/browser/utils.js +170 -15
- package/lib/browser/utils.js.map +1 -1
- package/lib/browser/utilsNode.d.ts +1021 -0
- package/lib/browser/utilsNode.js +346 -0
- package/lib/browser/utilsNode.js.map +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/indexUtils.d.ts +2 -0
- package/lib/indexUtils.js +15 -0
- package/lib/indexUtils.js.map +1 -0
- package/lib/interface.d.ts +242 -46
- package/lib/jsonDescriptors/chain-proto.json +676 -0
- package/lib/jsonDescriptors/{krc20-proto.json → token-proto.json} +47 -4
- package/lib/protoModules/protocol-proto.d.ts +2 -0
- package/lib/protoModules/protocol-proto.js +6336 -0
- package/lib/protoModules/protocol-proto.js.map +1 -0
- package/lib/utils.d.ts +19 -255
- package/lib/utils.js +170 -15
- package/lib/utils.js.map +1 -1
- package/lib/utilsNode.d.ts +1021 -0
- package/lib/utilsNode.js +346 -0
- package/lib/utilsNode.js.map +1 -0
- package/package.json +1 -1
- package/lib/browser/jsonDescriptors/protocol-proto.json +0 -246
- package/lib/jsonDescriptors/protocol-proto.json +0 -246
package/lib/utilsNode.js
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ChainTypes = exports.decodeGenesisData = exports.encodeGenesisData = void 0;
|
|
7
|
+
const sha256_1 = require("@noble/hashes/sha256");
|
|
8
|
+
const Serializer_1 = require("./Serializer");
|
|
9
|
+
const utils_1 = require("./utils");
|
|
10
|
+
const chain_proto_json_1 = __importDefault(require("./jsonDescriptors/chain-proto.json"));
|
|
11
|
+
const defaultAlias = {
|
|
12
|
+
"object_key::head_block": { typeName: "block" },
|
|
13
|
+
"object_key::chain_id": {},
|
|
14
|
+
"object_key::genesis_key": { isAddress: true },
|
|
15
|
+
"object_key::resource_limit_data": { typeName: "resource_limit_data" },
|
|
16
|
+
"object_key::max_account_resources": { typeName: "max_account_resources" },
|
|
17
|
+
"object_key::protocol_descriptor": {},
|
|
18
|
+
"object_key::compute_bandwidth_registry": {
|
|
19
|
+
typeName: "compute_bandwidth_registry",
|
|
20
|
+
},
|
|
21
|
+
"object_key::block_hash_code": {},
|
|
22
|
+
};
|
|
23
|
+
function prepareDictionary(dictionary) {
|
|
24
|
+
const serializerChain = new Serializer_1.Serializer(chain_proto_json_1.default, { bytesConversion: true });
|
|
25
|
+
const defaultDictionary = {};
|
|
26
|
+
Object.keys(defaultAlias).forEach((alias) => {
|
|
27
|
+
const key = (0, utils_1.encodeBase64)((0, utils_1.multihash)((0, sha256_1.sha256)(alias)));
|
|
28
|
+
defaultDictionary[key] = {
|
|
29
|
+
serializer: serializerChain,
|
|
30
|
+
alias,
|
|
31
|
+
...defaultAlias[alias],
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
const dic = {
|
|
35
|
+
...defaultDictionary,
|
|
36
|
+
...dictionary,
|
|
37
|
+
};
|
|
38
|
+
return dic;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Function to encode genesis data in order to launch a
|
|
42
|
+
* new blockchain. The different values are serialized using
|
|
43
|
+
* protobuffers. One of the arguments is the dictionary which
|
|
44
|
+
* contains the relevant information to perform the serialization.
|
|
45
|
+
* By default the function contains the dictionary for the
|
|
46
|
+
* following keys:
|
|
47
|
+
*
|
|
48
|
+
* - "object_key::head_block"
|
|
49
|
+
* - "object_key::chain_id"
|
|
50
|
+
* - "object_key::genesis_key"
|
|
51
|
+
* - "object_key::resource_limit_data"
|
|
52
|
+
* - "object_key::max_account_resources"
|
|
53
|
+
* - "object_key::protocol_descriptor"
|
|
54
|
+
* - "object_key::compute_bandwidth_registry"
|
|
55
|
+
* - "object_key::block_hash_code"
|
|
56
|
+
*
|
|
57
|
+
* @param genesisDataDecoded - Genesis data where the values are
|
|
58
|
+
* objects.
|
|
59
|
+
* @param dictionary - Set of keys which contains the relevant
|
|
60
|
+
* information to perform the serialization
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
*
|
|
64
|
+
* ```ts
|
|
65
|
+
* const signer = Signer.fromSeed("seed");
|
|
66
|
+
* const genesisDataDecoded = {
|
|
67
|
+
* entries: [
|
|
68
|
+
* {
|
|
69
|
+
* space: { system: true },
|
|
70
|
+
* alias: "object_key::genesis_key",
|
|
71
|
+
* value: signer.address,
|
|
72
|
+
* },
|
|
73
|
+
* ],
|
|
74
|
+
* };
|
|
75
|
+
*
|
|
76
|
+
* const genesisData = await encodeGenesisData(genesisDataDecoded);
|
|
77
|
+
* console.log(genesisData);
|
|
78
|
+
*
|
|
79
|
+
* // {
|
|
80
|
+
* // entries: [
|
|
81
|
+
* // {
|
|
82
|
+
* // space: { system: true },
|
|
83
|
+
* // key: "EiC3nO+XbeKg4C8ugW7M7XdfmJKY4i3l91KoJWxosQPImA==",
|
|
84
|
+
* // value: "AMpASH7CjUHBpl2QR8E5lGKVjVLAvJRg5g==",
|
|
85
|
+
* // },
|
|
86
|
+
* // ],
|
|
87
|
+
* // }
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @example adding a custom dictionary
|
|
91
|
+
*
|
|
92
|
+
* ```ts
|
|
93
|
+
* const contractId = Signer.fromSeed("seed").address;
|
|
94
|
+
* const zone = encodeBase64(decodeBase58(contractId));
|
|
95
|
+
* const genesisDataDecoded = {
|
|
96
|
+
* entries: [
|
|
97
|
+
* {
|
|
98
|
+
* space: { system: true, zone, id: 1 },
|
|
99
|
+
* key: "difficulty_metadata_key",
|
|
100
|
+
* value: {
|
|
101
|
+
* target: encodeBase64url(toUint8Array("F".repeat(64))),
|
|
102
|
+
* last_block_time: "1641038400000",
|
|
103
|
+
* difficulty: encodeBase64url(toUint8Array("1".repeat(64))),
|
|
104
|
+
* target_block_interval: "10",
|
|
105
|
+
* },
|
|
106
|
+
* },
|
|
107
|
+
* ],
|
|
108
|
+
* };
|
|
109
|
+
*
|
|
110
|
+
* const powJson = {
|
|
111
|
+
* nested: {
|
|
112
|
+
* mypackage: {
|
|
113
|
+
* nested: {
|
|
114
|
+
* difficulty_metadata: {
|
|
115
|
+
* "fields": {
|
|
116
|
+
* "target": { "type": "bytes", "id": 1 },
|
|
117
|
+
* "last_block_time": { "type": "uint64", "id": 2,
|
|
118
|
+
* "options": { "jstype": "JS_STRING" }
|
|
119
|
+
* },
|
|
120
|
+
* "difficulty": { "type": "bytes", "id": 3 },
|
|
121
|
+
* "target_block_interval": { "type": "uint64", "id": 4,
|
|
122
|
+
* "options": { "jstype": "JS_STRING" }
|
|
123
|
+
* }
|
|
124
|
+
* }
|
|
125
|
+
* },
|
|
126
|
+
* }
|
|
127
|
+
* }
|
|
128
|
+
* }
|
|
129
|
+
* }
|
|
130
|
+
*
|
|
131
|
+
* const dic = {
|
|
132
|
+
* difficulty_metadata_key: {
|
|
133
|
+
* serializer: new Serializer(powJson),
|
|
134
|
+
* typeName: "difficulty_metadata",
|
|
135
|
+
* },
|
|
136
|
+
* };
|
|
137
|
+
*
|
|
138
|
+
* const genesisData = await encodeGenesisData(genesisDataDecoded, dic);
|
|
139
|
+
* console.log(genesisData);
|
|
140
|
+
*
|
|
141
|
+
* // {
|
|
142
|
+
* // entries: [
|
|
143
|
+
* // {
|
|
144
|
+
* // key: "difficulty_metadata_key",
|
|
145
|
+
* // space: {
|
|
146
|
+
* // id: 1,
|
|
147
|
+
* // system: true,
|
|
148
|
+
* // zone: "AMpASH7CjUHBpl2QR8E5lGKVjVLAvJRg5g==",
|
|
149
|
+
* // },
|
|
150
|
+
* // value:
|
|
151
|
+
* // "CiD//////////////////////////////////////////xCAlIus4S8aIBERERERERERERERERERERERERERERERERERERERERERIAo=",
|
|
152
|
+
* // },
|
|
153
|
+
* // ],
|
|
154
|
+
* // };
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
async function encodeGenesisData(genesisDataDecoded, dictionary = {}) {
|
|
158
|
+
const genesisData = {};
|
|
159
|
+
if (!genesisDataDecoded || !genesisDataDecoded.entries)
|
|
160
|
+
return genesisData;
|
|
161
|
+
const dic = prepareDictionary(dictionary);
|
|
162
|
+
genesisData.entries = await Promise.all(genesisDataDecoded.entries.map(async (entry) => {
|
|
163
|
+
const key = Object.keys(dic).find((k) => k === entry.key || (entry.alias && dic[k].alias === entry.alias));
|
|
164
|
+
if (!key)
|
|
165
|
+
return {
|
|
166
|
+
error: `key ${entry.key} not found in the dictionary`,
|
|
167
|
+
space: entry.space,
|
|
168
|
+
key: entry.key,
|
|
169
|
+
value: (0, utils_1.encodeBase64)(new Uint8Array()),
|
|
170
|
+
};
|
|
171
|
+
const { isAddress, serializer, typeName } = dic[key];
|
|
172
|
+
let valueBytes;
|
|
173
|
+
let error = "";
|
|
174
|
+
if (isAddress) {
|
|
175
|
+
valueBytes = (0, utils_1.decodeBase58)(entry.value);
|
|
176
|
+
}
|
|
177
|
+
else if (serializer && typeName) {
|
|
178
|
+
valueBytes = await serializer.serialize(entry.value, typeName);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
valueBytes = new Uint8Array();
|
|
182
|
+
error = "no serializer or typeName defined in the dictionary";
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
...(error && { error }),
|
|
186
|
+
space: entry.space,
|
|
187
|
+
key,
|
|
188
|
+
value: (0, utils_1.encodeBase64)(valueBytes),
|
|
189
|
+
};
|
|
190
|
+
}));
|
|
191
|
+
return genesisData;
|
|
192
|
+
}
|
|
193
|
+
exports.encodeGenesisData = encodeGenesisData;
|
|
194
|
+
/**
|
|
195
|
+
* Function to decode genesis data used to launch a
|
|
196
|
+
* new blockchain. The different values are deserialized using
|
|
197
|
+
* protobuffers. One of the arguments is the dictionary which
|
|
198
|
+
* contains the relevant information for the deserialization.
|
|
199
|
+
* By default the function contains the dictionary for the
|
|
200
|
+
* following keys:
|
|
201
|
+
*
|
|
202
|
+
* - "object_key::head_block"
|
|
203
|
+
* - "object_key::chain_id"
|
|
204
|
+
* - "object_key::genesis_key"
|
|
205
|
+
* - "object_key::resource_limit_data"
|
|
206
|
+
* - "object_key::max_account_resources"
|
|
207
|
+
* - "object_key::protocol_descriptor"
|
|
208
|
+
* - "object_key::compute_bandwidth_registry"
|
|
209
|
+
* - "object_key::block_hash_code"
|
|
210
|
+
*
|
|
211
|
+
* @param genesisData - Genesis data
|
|
212
|
+
* @param dictionary - Set of keys which contains the relevant
|
|
213
|
+
* information to perform the deserialization
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
*
|
|
217
|
+
* ```ts
|
|
218
|
+
* const genesisData = {
|
|
219
|
+
* entries: [
|
|
220
|
+
* {
|
|
221
|
+
* space: { system: true },
|
|
222
|
+
* key: "EiC3nO+XbeKg4C8ugW7M7XdfmJKY4i3l91KoJWxosQPImA==",
|
|
223
|
+
* value: "AMpASH7CjUHBpl2QR8E5lGKVjVLAvJRg5g==",
|
|
224
|
+
* },
|
|
225
|
+
* ],
|
|
226
|
+
* }
|
|
227
|
+
*
|
|
228
|
+
* const genesisDataDecoded = await decodeGenesisData(genesisData);
|
|
229
|
+
* console.log(genesisDataDecoded);
|
|
230
|
+
*
|
|
231
|
+
* // {
|
|
232
|
+
* // entries: [
|
|
233
|
+
* // {
|
|
234
|
+
* // space: { system: true },
|
|
235
|
+
* // key: "EiC3nO+XbeKg4C8ugW7M7XdfmJKY4i3l91KoJWxosQPImA==",
|
|
236
|
+
* // alias: "object_key::genesis_key",
|
|
237
|
+
* // value: "1KSQWDyUnFZ48Pf2hsW8Akh1b5fKUWc8Z3",
|
|
238
|
+
* // },
|
|
239
|
+
* // ],
|
|
240
|
+
* // };
|
|
241
|
+
* ```
|
|
242
|
+
*
|
|
243
|
+
* @example adding a custom dictionary
|
|
244
|
+
*
|
|
245
|
+
* ```ts
|
|
246
|
+
* const genesisData = {
|
|
247
|
+
* entries: [
|
|
248
|
+
* {
|
|
249
|
+
* key: "difficulty_metadata_key",
|
|
250
|
+
* space: {
|
|
251
|
+
* id: 1,
|
|
252
|
+
* system: true,
|
|
253
|
+
* zone: "AMpASH7CjUHBpl2QR8E5lGKVjVLAvJRg5g==",
|
|
254
|
+
* },
|
|
255
|
+
* value:
|
|
256
|
+
* "CiD//////////////////////////////////////////xCAlIus4S8aIBERERERERERERERERERERERERERERERERERERERERERIAo=",
|
|
257
|
+
* },
|
|
258
|
+
* ],
|
|
259
|
+
* };
|
|
260
|
+
*
|
|
261
|
+
* const powJson = {
|
|
262
|
+
* nested: {
|
|
263
|
+
* mypackage: {
|
|
264
|
+
* nested: {
|
|
265
|
+
* difficulty_metadata: {
|
|
266
|
+
* "fields": {
|
|
267
|
+
* "target": { "type": "bytes", "id": 1 },
|
|
268
|
+
* "last_block_time": { "type": "uint64", "id": 2,
|
|
269
|
+
* "options": { "jstype": "JS_STRING" }
|
|
270
|
+
* },
|
|
271
|
+
* "difficulty": { "type": "bytes", "id": 3 },
|
|
272
|
+
* "target_block_interval": { "type": "uint64", "id": 4,
|
|
273
|
+
* "options": { "jstype": "JS_STRING" }
|
|
274
|
+
* }
|
|
275
|
+
* }
|
|
276
|
+
* },
|
|
277
|
+
* }
|
|
278
|
+
* }
|
|
279
|
+
* }
|
|
280
|
+
* }
|
|
281
|
+
*
|
|
282
|
+
* const dic = {
|
|
283
|
+
* difficulty_metadata_key: {
|
|
284
|
+
* serializer: new Serializer(powJson),
|
|
285
|
+
* typeName: "difficulty_metadata",
|
|
286
|
+
* },
|
|
287
|
+
* };
|
|
288
|
+
*
|
|
289
|
+
* const genesisDataDecoded = await decodeGenesisData(genesisData, dic);
|
|
290
|
+
* console.log(genesisData);
|
|
291
|
+
*
|
|
292
|
+
* // {
|
|
293
|
+
* // entries: [
|
|
294
|
+
* // {
|
|
295
|
+
* // space: { system: true, zone, id: 1 },
|
|
296
|
+
* // key: "difficulty_metadata_key",
|
|
297
|
+
* // value: {
|
|
298
|
+
* // target: "__________________________________________8=",
|
|
299
|
+
* // last_block_time: "1641038400000",
|
|
300
|
+
* // difficulty: "ERERERERERERERERERERERERERERERERERERERERERE=",
|
|
301
|
+
* // target_block_interval: "10",
|
|
302
|
+
* // },
|
|
303
|
+
* // },
|
|
304
|
+
* // ],
|
|
305
|
+
* // };
|
|
306
|
+
* ```
|
|
307
|
+
*/
|
|
308
|
+
async function decodeGenesisData(genesisData, dictionary = {}) {
|
|
309
|
+
const genesisDataDecoded = {};
|
|
310
|
+
if (!genesisData || !genesisData.entries)
|
|
311
|
+
return genesisDataDecoded;
|
|
312
|
+
const dic = prepareDictionary(dictionary);
|
|
313
|
+
genesisDataDecoded.entries = await Promise.all(genesisData.entries.map(async (entry) => {
|
|
314
|
+
const key = Object.keys(dic).find((k) => k === entry.key);
|
|
315
|
+
if (!key)
|
|
316
|
+
return {
|
|
317
|
+
error: `key ${entry.key} not found in the dictionary`,
|
|
318
|
+
...entry,
|
|
319
|
+
};
|
|
320
|
+
const { isAddress, serializer, typeName, alias } = dic[key];
|
|
321
|
+
const valueBase64url = (0, utils_1.encodeBase64url)((0, utils_1.decodeBase64)(entry.value));
|
|
322
|
+
let value;
|
|
323
|
+
let error = "";
|
|
324
|
+
if (isAddress) {
|
|
325
|
+
value = (0, utils_1.encodeBase58)((0, utils_1.decodeBase64url)(valueBase64url));
|
|
326
|
+
}
|
|
327
|
+
else if (serializer && typeName) {
|
|
328
|
+
value = await serializer.deserialize(valueBase64url, typeName);
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
value = valueBase64url;
|
|
332
|
+
error = "no serializer or typeName defined in the dictionary";
|
|
333
|
+
}
|
|
334
|
+
return {
|
|
335
|
+
...(error && { error }),
|
|
336
|
+
space: entry.space,
|
|
337
|
+
key,
|
|
338
|
+
value,
|
|
339
|
+
...(alias && { alias }),
|
|
340
|
+
};
|
|
341
|
+
}));
|
|
342
|
+
return genesisDataDecoded;
|
|
343
|
+
}
|
|
344
|
+
exports.decodeGenesisData = decodeGenesisData;
|
|
345
|
+
exports.ChainTypes = chain_proto_json_1.default;
|
|
346
|
+
//# sourceM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AAK;aACT,CAAC;QAEJ,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QAE5D,MAAM,cAAc,GAAG,IAAA,uBAAe,EAAC,IAAA,oBAAY,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAClE,IAAI,KAAuC,CAAC;QAC5C,IAAI,KAAK,GAAG,EAAE,CAAC;QACf,IAAI,SAAS,EAAE;YACb,KAAK,GAAG,IAAA,oBAAY,EAAC,IAAA,uBAAe,EAAC,cAAc,CAAC,CAAC,CAAC;SACvD;aAAM,IAAI,UAAU,IAAI,QAAQ,EAAE;YACjC,KAAK,GAAG,MAAM,UAAU,CAAC,WAAW,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;SAChE;aAAM;YACL,KAAK,GAAG,cAAc,CAAC;YACvB,KAAK,GAAG,qDAAqD,CAAC;SAC/D;QAED,OAAO;YACL,GAAG,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,CAAC;YACvB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,GAAG;YACH,KAAK;YACL,GAAG,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,CAAC;SACxB,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;IAEF,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AA1CD,8CA0CC;AAEY,QAAA,UAAU,GAAG,0BAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"nested": {
|
|
3
|
-
"koinos": {
|
|
4
|
-
"nested": {
|
|
5
|
-
"protocol": {
|
|
6
|
-
"options": {
|
|
7
|
-
"go_package": "github.com/koinos/koinos-proto-golang/koinos/protocol"
|
|
8
|
-
},
|
|
9
|
-
"nested": {
|
|
10
|
-
"contract_call_bundle": {
|
|
11
|
-
"fields": {
|
|
12
|
-
"contract_id": {
|
|
13
|
-
"type": "bytes",
|
|
14
|
-
"id": 1,
|
|
15
|
-
"options": {
|
|
16
|
-
"(koinos_bytes_type)": "CONTRACT_ID"
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"entry_point": {
|
|
20
|
-
"type": "uint32",
|
|
21
|
-
"id": 2
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"system_call_target": {
|
|
26
|
-
"oneofs": {
|
|
27
|
-
"target": {
|
|
28
|
-
"oneof": ["thunk_id", "system_call_bundle"]
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"fields": {
|
|
32
|
-
"thunk_id": {
|
|
33
|
-
"type": "uint32",
|
|
34
|
-
"id": 1
|
|
35
|
-
},
|
|
36
|
-
"system_call_bundle": {
|
|
37
|
-
"type": "contract_call_bundle",
|
|
38
|
-
"id": 2
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
"upload_contract_operation": {
|
|
43
|
-
"fields": {
|
|
44
|
-
"contract_id": {
|
|
45
|
-
"type": "bytes",
|
|
46
|
-
"id": 1,
|
|
47
|
-
"options": {
|
|
48
|
-
"(koinos_bytes_type)": "CONTRACT_ID"
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
"bytecode": {
|
|
52
|
-
"type": "bytes",
|
|
53
|
-
"id": 2
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
"call_contract_operation": {
|
|
58
|
-
"fields": {
|
|
59
|
-
"contract_id": {
|
|
60
|
-
"type": "bytes",
|
|
61
|
-
"id": 1,
|
|
62
|
-
"options": {
|
|
63
|
-
"(koinos_bytes_type)": "CONTRACT_ID"
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
"entry_point": {
|
|
67
|
-
"type": "uint32",
|
|
68
|
-
"id": 2
|
|
69
|
-
},
|
|
70
|
-
"args": {
|
|
71
|
-
"type": "bytes",
|
|
72
|
-
"id": 3
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
"set_system_call_operation": {
|
|
77
|
-
"fields": {
|
|
78
|
-
"call_id": {
|
|
79
|
-
"type": "uint32",
|
|
80
|
-
"id": 1
|
|
81
|
-
},
|
|
82
|
-
"target": {
|
|
83
|
-
"type": "system_call_target",
|
|
84
|
-
"id": 2
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
"operation": {
|
|
89
|
-
"oneofs": {
|
|
90
|
-
"op": {
|
|
91
|
-
"oneof": [
|
|
92
|
-
"upload_contract",
|
|
93
|
-
"call_contract",
|
|
94
|
-
"set_system_call"
|
|
95
|
-
]
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
"fields": {
|
|
99
|
-
"upload_contract": {
|
|
100
|
-
"type": "upload_contract_operation",
|
|
101
|
-
"id": 1
|
|
102
|
-
},
|
|
103
|
-
"call_contract": {
|
|
104
|
-
"type": "call_contract_operation",
|
|
105
|
-
"id": 2
|
|
106
|
-
},
|
|
107
|
-
"set_system_call": {
|
|
108
|
-
"type": "set_system_call_operation",
|
|
109
|
-
"id": 3
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
"active_transaction_data": {
|
|
114
|
-
"fields": {
|
|
115
|
-
"rc_limit": {
|
|
116
|
-
"type": "uint64",
|
|
117
|
-
"id": 1,
|
|
118
|
-
"options": {
|
|
119
|
-
"jstype": "JS_STRING"
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
"nonce": {
|
|
123
|
-
"type": "uint64",
|
|
124
|
-
"id": 2,
|
|
125
|
-
"options": {
|
|
126
|
-
"jstype": "JS_STRING"
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
"operations": {
|
|
130
|
-
"rule": "repeated",
|
|
131
|
-
"type": "operation",
|
|
132
|
-
"id": 3
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
"passive_transaction_data": {
|
|
137
|
-
"fields": {}
|
|
138
|
-
},
|
|
139
|
-
"transaction": {
|
|
140
|
-
"fields": {
|
|
141
|
-
"id": {
|
|
142
|
-
"type": "bytes",
|
|
143
|
-
"id": 1,
|
|
144
|
-
"options": {
|
|
145
|
-
"(koinos_bytes_type)": "TRANSACTION_ID"
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
"active": {
|
|
149
|
-
"type": "bytes",
|
|
150
|
-
"id": 2
|
|
151
|
-
},
|
|
152
|
-
"passive": {
|
|
153
|
-
"type": "bytes",
|
|
154
|
-
"id": 3
|
|
155
|
-
},
|
|
156
|
-
"signature_data": {
|
|
157
|
-
"type": "bytes",
|
|
158
|
-
"id": 4
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
"active_block_data": {
|
|
163
|
-
"fields": {
|
|
164
|
-
"transaction_merkle_root": {
|
|
165
|
-
"type": "bytes",
|
|
166
|
-
"id": 1
|
|
167
|
-
},
|
|
168
|
-
"passive_data_merkle_root": {
|
|
169
|
-
"type": "bytes",
|
|
170
|
-
"id": 2
|
|
171
|
-
},
|
|
172
|
-
"signer": {
|
|
173
|
-
"type": "bytes",
|
|
174
|
-
"id": 3
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
"passive_block_data": {
|
|
179
|
-
"fields": {}
|
|
180
|
-
},
|
|
181
|
-
"block_header": {
|
|
182
|
-
"fields": {
|
|
183
|
-
"previous": {
|
|
184
|
-
"type": "bytes",
|
|
185
|
-
"id": 1,
|
|
186
|
-
"options": {
|
|
187
|
-
"(koinos_bytes_type)": "BLOCK_ID"
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
"height": {
|
|
191
|
-
"type": "uint64",
|
|
192
|
-
"id": 2,
|
|
193
|
-
"options": {
|
|
194
|
-
"jstype": "JS_STRING"
|
|
195
|
-
}
|
|
196
|
-
},
|
|
197
|
-
"timestamp": {
|
|
198
|
-
"type": "uint64",
|
|
199
|
-
"id": 3,
|
|
200
|
-
"options": {
|
|
201
|
-
"jstype": "JS_STRING"
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
"block": {
|
|
207
|
-
"fields": {
|
|
208
|
-
"id": {
|
|
209
|
-
"type": "bytes",
|
|
210
|
-
"id": 1,
|
|
211
|
-
"options": {
|
|
212
|
-
"(koinos_bytes_type)": "BLOCK_ID"
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
"header": {
|
|
216
|
-
"type": "block_header",
|
|
217
|
-
"id": 2
|
|
218
|
-
},
|
|
219
|
-
"active": {
|
|
220
|
-
"type": "bytes",
|
|
221
|
-
"id": 3
|
|
222
|
-
},
|
|
223
|
-
"passive": {
|
|
224
|
-
"type": "bytes",
|
|
225
|
-
"id": 4
|
|
226
|
-
},
|
|
227
|
-
"signature_data": {
|
|
228
|
-
"type": "bytes",
|
|
229
|
-
"id": 5
|
|
230
|
-
},
|
|
231
|
-
"transactions": {
|
|
232
|
-
"rule": "repeated",
|
|
233
|
-
"type": "transaction",
|
|
234
|
-
"id": 6
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
},
|
|
238
|
-
"block_receipt": {
|
|
239
|
-
"fields": {}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|