koilib 2.1.0 → 2.4.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.
@@ -164,7 +164,7 @@
164
164
  "jstype": "JS_STRING"
165
165
  }
166
166
  },
167
- "lastManaUpdate": {
167
+ "last_mana_update": {
168
168
  "type": "uint64",
169
169
  "id": 3,
170
170
  "options": {
@@ -9,14 +9,14 @@
9
9
  "nested": {
10
10
  "contract_call_bundle": {
11
11
  "fields": {
12
- "contractId": {
12
+ "contract_id": {
13
13
  "type": "bytes",
14
14
  "id": 1,
15
15
  "options": {
16
16
  "(koinos_bytes_type)": "CONTRACT_ID"
17
17
  }
18
18
  },
19
- "entryPoint": {
19
+ "entry_point": {
20
20
  "type": "uint32",
21
21
  "id": 2
22
22
  }
@@ -25,15 +25,15 @@
25
25
  "system_call_target": {
26
26
  "oneofs": {
27
27
  "target": {
28
- "oneof": ["thunkId", "systemCallBundle"]
28
+ "oneof": ["thunk_id", "system_call_bundle"]
29
29
  }
30
30
  },
31
31
  "fields": {
32
- "thunkId": {
32
+ "thunk_id": {
33
33
  "type": "uint32",
34
34
  "id": 1
35
35
  },
36
- "systemCallBundle": {
36
+ "system_call_bundle": {
37
37
  "type": "contract_call_bundle",
38
38
  "id": 2
39
39
  }
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "upload_contract_operation": {
43
43
  "fields": {
44
- "contractId": {
44
+ "contract_id": {
45
45
  "type": "bytes",
46
46
  "id": 1,
47
47
  "options": {
@@ -56,14 +56,14 @@
56
56
  },
57
57
  "call_contract_operation": {
58
58
  "fields": {
59
- "contractId": {
59
+ "contract_id": {
60
60
  "type": "bytes",
61
61
  "id": 1,
62
62
  "options": {
63
63
  "(koinos_bytes_type)": "CONTRACT_ID"
64
64
  }
65
65
  },
66
- "entryPoint": {
66
+ "entry_point": {
67
67
  "type": "uint32",
68
68
  "id": 2
69
69
  },
@@ -75,7 +75,7 @@
75
75
  },
76
76
  "set_system_call_operation": {
77
77
  "fields": {
78
- "callId": {
78
+ "call_id": {
79
79
  "type": "uint32",
80
80
  "id": 1
81
81
  },
@@ -88,19 +88,23 @@
88
88
  "operation": {
89
89
  "oneofs": {
90
90
  "op": {
91
- "oneof": ["uploadContract", "callContract", "setSystemCall"]
91
+ "oneof": [
92
+ "upload_contract",
93
+ "call_contract",
94
+ "set_system_call"
95
+ ]
92
96
  }
93
97
  },
94
98
  "fields": {
95
- "uploadContract": {
99
+ "upload_contract": {
96
100
  "type": "upload_contract_operation",
97
101
  "id": 1
98
102
  },
99
- "callContract": {
103
+ "call_contract": {
100
104
  "type": "call_contract_operation",
101
105
  "id": 2
102
106
  },
103
- "setSystemCall": {
107
+ "set_system_call": {
104
108
  "type": "set_system_call_operation",
105
109
  "id": 3
106
110
  }
@@ -108,7 +112,7 @@
108
112
  },
109
113
  "active_transaction_data": {
110
114
  "fields": {
111
- "rcLimit": {
115
+ "rc_limit": {
112
116
  "type": "uint64",
113
117
  "id": 1,
114
118
  "options": {
@@ -149,7 +153,7 @@
149
153
  "type": "bytes",
150
154
  "id": 3
151
155
  },
152
- "signatureData": {
156
+ "signature_data": {
153
157
  "type": "bytes",
154
158
  "id": 4
155
159
  }
@@ -157,11 +161,11 @@
157
161
  },
158
162
  "active_block_data": {
159
163
  "fields": {
160
- "transactionMerkleRoot": {
164
+ "transaction_merkle_root": {
161
165
  "type": "bytes",
162
166
  "id": 1
163
167
  },
164
- "passiveDataMerkleRoot": {
168
+ "passive_data_merkle_root": {
165
169
  "type": "bytes",
166
170
  "id": 2
167
171
  },
@@ -220,7 +224,7 @@
220
224
  "type": "bytes",
221
225
  "id": 4
222
226
  },
223
- "signatureData": {
227
+ "signature_data": {
224
228
  "type": "bytes",
225
229
  "id": 5
226
230
  },
package/lib/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Abi } from "./Contract";
1
+ import { Abi } from "./interface";
2
2
  /**
3
3
  * Converts an hex string to Uint8Array
4
4
  */
@@ -32,7 +32,6 @@ export declare function decodeBase64(bs64: string): Uint8Array;
32
32
  * wallet import format (WIF).
33
33
  */
34
34
  export declare function bitcoinEncode(buffer: Uint8Array, type: "public" | "private", compressed?: boolean): string;
35
- export declare function copyUint8Array(source: Uint8Array, target: Uint8Array, targetStart: number, sourceStart: number, sourceEnd: number): void;
36
35
  /**
37
36
  * Decodes a public or private key formatted in base58 using
38
37
  * the bitcoin format (see [Bitcoin Base58Check encoding](https://en.bitcoin.it/wiki/Base58Check_encoding)
@@ -72,3 +71,252 @@ export declare function parseUnits(value: string, decimals: number): string;
72
71
  * ABI for tokens
73
72
  */
74
73
  export declare const Krc20Abi: Abi;
74
+ export declare const ProtocolTypes: {
75
+ nested: {
76
+ koinos: {
77
+ nested: {
78
+ protocol: {
79
+ options: {
80
+ go_package: string;
81
+ };
82
+ nested: {
83
+ contract_call_bundle: {
84
+ fields: {
85
+ contract_id: {
86
+ type: string;
87
+ id: number;
88
+ options: {
89
+ "(koinos_bytes_type)": string;
90
+ };
91
+ };
92
+ entry_point: {
93
+ type: string;
94
+ id: number;
95
+ };
96
+ };
97
+ };
98
+ system_call_target: {
99
+ oneofs: {
100
+ target: {
101
+ oneof: string[];
102
+ };
103
+ };
104
+ fields: {
105
+ thunk_id: {
106
+ type: string;
107
+ id: number;
108
+ };
109
+ system_call_bundle: {
110
+ type: string;
111
+ id: number;
112
+ };
113
+ };
114
+ };
115
+ upload_contract_operation: {
116
+ fields: {
117
+ contract_id: {
118
+ type: string;
119
+ id: number;
120
+ options: {
121
+ "(koinos_bytes_type)": string;
122
+ };
123
+ };
124
+ bytecode: {
125
+ type: string;
126
+ id: number;
127
+ };
128
+ };
129
+ };
130
+ call_contract_operation: {
131
+ fields: {
132
+ contract_id: {
133
+ type: string;
134
+ id: number;
135
+ options: {
136
+ "(koinos_bytes_type)": string;
137
+ };
138
+ };
139
+ entry_point: {
140
+ type: string;
141
+ id: number;
142
+ };
143
+ args: {
144
+ type: string;
145
+ id: number;
146
+ };
147
+ };
148
+ };
149
+ set_system_call_operation: {
150
+ fields: {
151
+ call_id: {
152
+ type: string;
153
+ id: number;
154
+ };
155
+ target: {
156
+ type: string;
157
+ id: number;
158
+ };
159
+ };
160
+ };
161
+ operation: {
162
+ oneofs: {
163
+ op: {
164
+ oneof: string[];
165
+ };
166
+ };
167
+ fields: {
168
+ upload_contract: {
169
+ type: string; /**
170
+ * Decodes a public or private key formatted in base58 using
171
+ * the bitcoin format (see [Bitcoin Base58Check encoding](https://en.bitcoin.it/wiki/Base58Check_encoding)
172
+ * and [Bitcoin WIF](https://en.bitcoin.it/wiki/Wallet_import_format)).
173
+ *
174
+ * For private keys this encode is also known as
175
+ * wallet import format (WIF).
176
+ */
177
+ id: number;
178
+ };
179
+ call_contract: {
180
+ type: string;
181
+ id: number;
182
+ };
183
+ set_system_call: {
184
+ type: string;
185
+ id: number;
186
+ };
187
+ };
188
+ };
189
+ active_transaction_data: {
190
+ fields: {
191
+ rc_limit: {
192
+ type: string;
193
+ id: number;
194
+ options: {
195
+ jstype: string;
196
+ };
197
+ };
198
+ nonce: {
199
+ type: string;
200
+ id: number;
201
+ options: {
202
+ jstype: string;
203
+ };
204
+ };
205
+ operations: {
206
+ rule: string;
207
+ type: string;
208
+ id: number;
209
+ };
210
+ };
211
+ };
212
+ passive_transaction_data: {
213
+ fields: {};
214
+ };
215
+ transaction: {
216
+ fields: {
217
+ id: {
218
+ type: string;
219
+ id: number;
220
+ options: {
221
+ "(koinos_bytes_type)": string;
222
+ };
223
+ };
224
+ active: {
225
+ type: string;
226
+ id: number;
227
+ };
228
+ passive: {
229
+ type: string;
230
+ id: number;
231
+ };
232
+ signature_data: {
233
+ type: string;
234
+ id: number;
235
+ };
236
+ };
237
+ };
238
+ active_block_data: {
239
+ fields: {
240
+ transaction_merkle_root: {
241
+ type: string;
242
+ id: number;
243
+ };
244
+ passive_data_merkle_root: {
245
+ type: string;
246
+ id: number;
247
+ };
248
+ signer: {
249
+ type: string;
250
+ id: number;
251
+ };
252
+ };
253
+ };
254
+ passive_block_data: {
255
+ fields: {};
256
+ };
257
+ block_header: {
258
+ fields: {
259
+ previous: {
260
+ type: string;
261
+ id: number;
262
+ options: {
263
+ "(koinos_bytes_type)": string;
264
+ };
265
+ };
266
+ height: {
267
+ type: string;
268
+ id: number;
269
+ options: {
270
+ jstype: string;
271
+ };
272
+ };
273
+ timestamp: {
274
+ type: string;
275
+ id: number;
276
+ options: {
277
+ jstype: string;
278
+ };
279
+ };
280
+ };
281
+ };
282
+ block: {
283
+ fields: {
284
+ id: {
285
+ type: string;
286
+ id: number;
287
+ options: {
288
+ "(koinos_bytes_type)": string;
289
+ };
290
+ };
291
+ header: {
292
+ type: string;
293
+ id: number;
294
+ };
295
+ active: {
296
+ type: string;
297
+ id: number;
298
+ };
299
+ passive: {
300
+ type: string;
301
+ id: number;
302
+ };
303
+ signature_data: {
304
+ type: string;
305
+ id: number;
306
+ };
307
+ transactions: {
308
+ rule: string;
309
+ type: string;
310
+ id: number;
311
+ };
312
+ };
313
+ };
314
+ block_receipt: {
315
+ fields: {};
316
+ };
317
+ };
318
+ };
319
+ };
320
+ };
321
+ };
322
+ };
package/lib/utils.js CHANGED
@@ -22,11 +22,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
22
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.Krc20Abi = exports.parseUnits = exports.formatUnits = exports.bitcoinAddress = exports.bitcoinDecode = exports.copyUint8Array = exports.bitcoinEncode = exports.decodeBase64 = exports.encodeBase64 = exports.decodeBase58 = exports.encodeBase58 = exports.toHexString = exports.toUint8Array = void 0;
25
+ exports.ProtocolTypes = exports.Krc20Abi = exports.parseUnits = exports.formatUnits = exports.bitcoinAddress = exports.bitcoinDecode = exports.bitcoinEncode = exports.decodeBase64 = exports.encodeBase64 = exports.decodeBase58 = exports.encodeBase58 = exports.toHexString = exports.toUint8Array = void 0;
26
26
  const multibase = __importStar(require("multibase"));
27
- const js_sha256_1 = require("js-sha256");
28
- const noble_ripemd160_1 = __importDefault(require("noble-ripemd160"));
29
- const krc20_proto_json_1 = __importDefault(require("./krc20-proto.json"));
27
+ const sha256_1 = require("@noble/hashes/lib/sha256");
28
+ const ripemd160_1 = require("@noble/hashes/lib/ripemd160");
29
+ const krc20_proto_json_1 = __importDefault(require("./jsonDescriptors/krc20-proto.json"));
30
+ const protocol_proto_json_1 = __importDefault(require("./jsonDescriptors/protocol-proto.json"));
30
31
  /**
31
32
  * Converts an hex string to Uint8Array
32
33
  */
@@ -111,22 +112,15 @@ function bitcoinEncode(buffer, type, compressed = false) {
111
112
  prefixBuffer[0] = 128;
112
113
  }
113
114
  prefixBuffer.set(buffer, 1);
114
- const firstHash = js_sha256_1.sha256(prefixBuffer);
115
- const doubleHash = js_sha256_1.sha256(toUint8Array(firstHash));
116
- const checksum = toUint8Array(doubleHash.substring(0, 8));
115
+ const firstHash = sha256_1.sha256(prefixBuffer);
116
+ const doubleHash = sha256_1.sha256(firstHash);
117
+ const checksum = new Uint8Array(4);
118
+ checksum.set(doubleHash.slice(0, 4));
117
119
  bufferCheck.set(buffer, 1);
118
120
  bufferCheck.set(checksum, offsetChecksum);
119
121
  return encodeBase58(bufferCheck);
120
122
  }
121
123
  exports.bitcoinEncode = bitcoinEncode;
122
- function copyUint8Array(source, target, targetStart, sourceStart, sourceEnd) {
123
- for (let cursorSource = sourceStart; cursorSource < sourceEnd; cursorSource += 1) {
124
- const cursorTarget = targetStart + cursorSource - sourceStart;
125
- /* eslint-disable-next-line no-param-reassign */
126
- target[cursorTarget] = source[cursorSource];
127
- }
128
- }
129
- exports.copyUint8Array = copyUint8Array;
130
124
  /**
131
125
  * Decodes a public or private key formatted in base58 using
132
126
  * the bitcoin format (see [Bitcoin Base58Check encoding](https://en.bitcoin.it/wiki/Base58Check_encoding)
@@ -140,13 +134,13 @@ function bitcoinDecode(value) {
140
134
  const privateKey = new Uint8Array(32);
141
135
  const checksum = new Uint8Array(4);
142
136
  // const prefix = buffer[0];
143
- copyUint8Array(buffer, privateKey, 0, 1, 33);
137
+ privateKey.set(buffer.slice(1, 33));
144
138
  if (value[0] !== "5") {
145
139
  // compressed
146
- copyUint8Array(buffer, checksum, 0, 34, 38);
140
+ checksum.set(buffer.slice(34, 38));
147
141
  }
148
142
  else {
149
- copyUint8Array(buffer, checksum, 0, 33, 37);
143
+ checksum.set(buffer.slice(33, 37));
150
144
  }
151
145
  // TODO: verify prefix and checksum
152
146
  return privateKey;
@@ -158,8 +152,8 @@ exports.bitcoinDecode = bitcoinDecode;
158
152
  * address = bitcoinEncode( ripemd160 ( sha256 ( publicKey ) ) )
159
153
  */
160
154
  function bitcoinAddress(publicKey) {
161
- const hash = js_sha256_1.sha256(publicKey);
162
- const hash160 = noble_ripemd160_1.default(toUint8Array(hash));
155
+ const hash = sha256_1.sha256(publicKey);
156
+ const hash160 = ripemd160_1.ripemd160(hash);
163
157
  return bitcoinEncode(hash160, "public");
164
158
  }
165
159
  exports.bitcoinAddress = bitcoinAddress;
@@ -212,46 +206,47 @@ exports.Krc20Abi = {
212
206
  methods: {
213
207
  name: {
214
208
  entryPoint: 0x76ea4297,
215
- inputs: "name_arguments",
216
- outputs: "name_result",
209
+ input: "name_arguments",
210
+ output: "name_result",
217
211
  readOnly: true,
218
212
  },
219
213
  symbol: {
220
214
  entryPoint: 0x7e794b24,
221
- inputs: "symbol_arguments",
222
- outputs: "symbol_result",
215
+ input: "symbol_arguments",
216
+ output: "symbol_result",
223
217
  readOnly: true,
224
218
  },
225
219
  decimals: {
226
220
  entryPoint: 0x59dc15ce,
227
- inputs: "decimals_arguments",
228
- outputs: "decimals_result",
221
+ input: "decimals_arguments",
222
+ output: "decimals_result",
229
223
  readOnly: true,
230
224
  },
231
225
  totalSupply: {
232
226
  entryPoint: 0xcf2e8212,
233
- inputs: "total_supply_arguments",
234
- outputs: "total_supply_result",
227
+ input: "total_supply_arguments",
228
+ output: "total_supply_result",
235
229
  readOnly: true,
236
230
  },
237
231
  balanceOf: {
238
232
  entryPoint: 0x15619248,
239
- inputs: "balance_of_arguments",
240
- outputs: "balance_of_result",
233
+ input: "balance_of_arguments",
234
+ output: "balance_of_result",
241
235
  readOnly: true,
242
236
  defaultOutput: { value: "0" },
243
237
  },
244
238
  transfer: {
245
239
  entryPoint: 0x62efa292,
246
- inputs: "transfer_arguments",
247
- outputs: "transfer_result",
240
+ input: "transfer_arguments",
241
+ output: "transfer_result",
248
242
  },
249
243
  mint: {
250
244
  entryPoint: 0xc2f82bdc,
251
- inputs: "mint_argumnets",
252
- outputs: "mint_result",
245
+ input: "mint_argumnets",
246
+ output: "mint_result",
253
247
  },
254
248
  },
255
249
  types: krc20_proto_json_1.default,
256
250
  };
251
+ exports.ProtocolTypes = protocol_proto_json_1.default;
257
252
  //# sourceMappingURL=utils.js.map
package/lib/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuC;AACvC,yCAAmC;AACnC,sEAAwC;AACxC,0EAAgD;AAGhD;;GAEG;AACH,SAAgB,YAAY,CAAC,GAAW;IACtC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IACxC,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;IAC3C,OAAO,IAAI,UAAU,CACnB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,sBAAsB;KACzD,CAAC;AACJ,CAAC;AAND,oCAMC;AAED;;GAEG;AACH,SAAgB,WAAW,CAAC,MAAkB;IAC5C,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;SACtB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,C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  "name": "koilib",
3
- "version": "2.1.0",
3
+ "version": "2.4.1",
4
4
  "description": "JS Koinos Library",
5
5
  "author": "Julian Gonzalez",
6
6
  "repository": {
@@ -16,16 +16,14 @@
16
16
  ],
17
17
  "main": "./lib/index.js",
18
18
  "types": "./lib/index.d.ts",
19
- "browser": "./dist/koinos.min.js",
19
+ "browser": "./lib/index.js",
20
20
  "scripts": {
21
21
  "audit": "audit-ci",
22
22
  "build": "rimraf lib && tsc",
23
23
  "bundle": "yarn bundle:no-min && yarn bundle:min",
24
24
  "bundle:min": "webpack --mode=production --config webpack.prod.config.js",
25
25
  "bundle:no-min": "webpack --mode=production --config webpack.dev.config.js",
26
- "docs": "yarn docs:generate && yarn docs:post",
27
- "docs:generate": "typedoc src/index.ts --includeVersion",
28
- "docs:post": "node -e \"require('fs').rename('docs/index.html', 'docs/main.html', console.log)\" && copyfiles -f tests/index.html docs && copyfiles -f tests/assets-index/* docs/assets-index && copyfiles -f dist/koinos.min.js docs/assets-index",
26
+ "docs": "typedoc src/index.ts --includeVersion",
29
27
  "clean": "rimraf dist coverage",
30
28
  "lint": "yarn lint:prettier && yarn lint:eslint && yarn lint:tsc",
31
29
  "lint:prettier": "prettier . --check",
@@ -35,18 +33,18 @@
35
33
  "proto": "node generateJsonKoinosProto.js",
36
34
  "test": "jest",
37
35
  "test:unit": "jest wallet.spec.ts",
38
- "test:e2e": "jest wallet.e2e-spec.ts"
36
+ "test:e2e": "jest wallet.e2e-spec.ts",
37
+ "test:chain": "jest chain.e2e-spec.ts"
39
38
  },
40
39
  "exports": {
41
40
  "./package.json": "./package.json",
42
41
  ".": "./lib/index.js"
43
42
  },
44
43
  "dependencies": {
44
+ "@noble/hashes": "^0.4.3",
45
+ "@noble/secp256k1": "^1.3.0",
45
46
  "axios": "^0.21.1",
46
- "js-sha256": "^0.9.0",
47
47
  "multibase": "^4.0.4",
48
- "noble-ripemd160": "^0.2.0",
49
- "noble-secp256k1": "^1.2.9",
50
48
  "protobufjs": "^6.11.2"
51
49
  },
52
50
  "devDependencies": {