koilib 2.5.0 → 2.7.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.
Files changed (46) hide show
  1. package/README.md +6 -6
  2. package/dist/koinos.js +2986 -4607
  3. package/dist/koinos.min.js +1 -1
  4. package/dist/koinos.min.js.LICENSE.txt +2 -2
  5. package/lib/Contract.d.ts +9 -11
  6. package/lib/Contract.js +20 -20
  7. package/lib/Contract.js.map +1 -1
  8. package/lib/Provider.d.ts +24 -17
  9. package/lib/Provider.js +99 -105
  10. package/lib/Provider.js.map +1 -1
  11. package/lib/Serializer.js +9 -9
  12. package/lib/Serializer.js.map +1 -1
  13. package/lib/Signer.d.ts +9 -9
  14. package/lib/Signer.js +30 -22
  15. package/lib/Signer.js.map +1 -1
  16. package/lib/browser/Contract.d.ts +200 -0
  17. package/lib/browser/Contract.js +298 -0
  18. package/lib/browser/Contract.js.map +1 -0
  19. package/lib/browser/Provider.d.ts +160 -0
  20. package/lib/browser/Provider.js +246 -0
  21. package/lib/browser/Provider.js.map +1 -0
  22. package/lib/browser/Serializer.d.ts +81 -0
  23. package/lib/browser/Serializer.js +169 -0
  24. package/lib/browser/Serializer.js.map +1 -0
  25. package/lib/browser/Signer.d.ts +296 -0
  26. package/lib/browser/Signer.js +429 -0
  27. package/lib/browser/Signer.js.map +1 -0
  28. package/lib/browser/index.d.ts +7 -0
  29. package/lib/browser/index.js +34 -0
  30. package/lib/browser/index.js.map +1 -0
  31. package/lib/browser/index2.d.ts +2 -0
  32. package/lib/browser/index2.js +33 -0
  33. package/lib/browser/index2.js.map +1 -0
  34. package/lib/browser/interface.d.ts +279 -0
  35. package/lib/browser/interface.js +3 -0
  36. package/lib/browser/interface.js.map +1 -0
  37. package/lib/browser/jsonDescriptors/krc20-proto.json +183 -0
  38. package/lib/browser/jsonDescriptors/protocol-proto.json +246 -0
  39. package/lib/browser/utils.d.ts +326 -0
  40. package/lib/browser/utils.js +252 -0
  41. package/lib/browser/utils.js.map +1 -0
  42. package/lib/interface.d.ts +24 -25
  43. package/lib/utils.d.ts +12 -8
  44. package/lib/utils.js +7 -7
  45. package/lib/utils.js.map +1 -1
  46. package/package.json +34 -31
@@ -0,0 +1,246 @@
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
+ }
@@ -0,0 +1,326 @@
1
+ import { Abi } from "./interface";
2
+ /**
3
+ * Converts an hex string to Uint8Array
4
+ */
5
+ export declare function toUint8Array(hex: string): Uint8Array;
6
+ /**
7
+ * Converts Uint8Array to hex string
8
+ */
9
+ export declare function toHexString(buffer: Uint8Array): string;
10
+ /**
11
+ * Encodes an Uint8Array in base58
12
+ */
13
+ export declare function encodeBase58(buffer: Uint8Array): string;
14
+ /**
15
+ * Decodes a buffer formatted in base58
16
+ */
17
+ export declare function decodeBase58(bs58: string): Uint8Array;
18
+ /**
19
+ * Encodes an Uint8Array in base64
20
+ */
21
+ export declare function encodeBase64(buffer: Uint8Array): string;
22
+ /**
23
+ * Decodes a buffer formatted in base64
24
+ */
25
+ export declare function decodeBase64(bs64: string): Uint8Array;
26
+ /**
27
+ * Encodes a public or private key in base58 using
28
+ * the bitcoin format (see [Bitcoin Base58Check encoding](https://en.bitcoin.it/wiki/Base58Check_encoding)
29
+ * and [Bitcoin WIF](https://en.bitcoin.it/wiki/Wallet_import_format)).
30
+ *
31
+ * For private keys this encode is also known as
32
+ * wallet import format (WIF).
33
+ */
34
+ export declare function bitcoinEncode(buffer: Uint8Array, type: "public" | "private", compressed?: boolean): string;
35
+ /**
36
+ * Decodes a public or private key formatted in base58 using
37
+ * the bitcoin format (see [Bitcoin Base58Check encoding](https://en.bitcoin.it/wiki/Base58Check_encoding)
38
+ * and [Bitcoin WIF](https://en.bitcoin.it/wiki/Wallet_import_format)).
39
+ *
40
+ * For private keys this encode is also known as
41
+ * wallet import format (WIF).
42
+ */
43
+ export declare function bitcoinDecode(value: string): Uint8Array;
44
+ /**
45
+ * Computes a bitcoin address, which is the format used in Koinos
46
+ *
47
+ * address = bitcoinEncode( ripemd160 ( sha256 ( publicKey ) ) )
48
+ */
49
+ export declare function bitcoinAddress(publicKey: Uint8Array): string;
50
+ /**
51
+ * Function to format a number in a decimal point number
52
+ * @example
53
+ * ```js
54
+ * const amount = formatUnits("123456", 8);
55
+ * console.log(amount);
56
+ * // '0.00123456'
57
+ * ```
58
+ */
59
+ export declare function formatUnits(value: string | number | bigint, decimals: number): string;
60
+ /**
61
+ * Function to format a decimal point number in an integer
62
+ * @example
63
+ * ```js
64
+ * const amount = parseUnits("0.00123456", 8);
65
+ * console.log(amount);
66
+ * // '123456'
67
+ * ```
68
+ */
69
+ export declare function parseUnits(value: string, decimals: number): string;
70
+ /**
71
+ * ABI for tokens
72
+ */
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
+ /**
126
+ * Encodes a public or private key in base58 using
127
+ * the bitcoin format (see [Bitcoin Base58Check encoding](https://en.bitcoin.it/wiki/Base58Check_encoding)
128
+ * and [Bitcoin WIF](https://en.bitcoin.it/wiki/Wallet_import_format)).
129
+ *
130
+ * For private keys this encode is also known as
131
+ * wallet import format (WIF).
132
+ */
133
+ type: string;
134
+ id: number;
135
+ };
136
+ };
137
+ };
138
+ call_contract_operation: {
139
+ fields: {
140
+ contract_id: {
141
+ type: string;
142
+ id: number;
143
+ options: {
144
+ "(koinos_bytes_type)": string;
145
+ };
146
+ };
147
+ entry_point: {
148
+ type: string;
149
+ id: number;
150
+ };
151
+ args: {
152
+ type: string;
153
+ id: number;
154
+ };
155
+ };
156
+ };
157
+ set_system_call_operation: {
158
+ fields: {
159
+ call_id: {
160
+ type: string;
161
+ id: number;
162
+ };
163
+ target: {
164
+ type: string;
165
+ id: number;
166
+ };
167
+ };
168
+ };
169
+ operation: {
170
+ oneofs: {
171
+ op: {
172
+ oneof: string[];
173
+ };
174
+ };
175
+ fields: {
176
+ upload_contract: {
177
+ type: string;
178
+ id: number;
179
+ };
180
+ call_contract: {
181
+ type: string;
182
+ id: number;
183
+ };
184
+ set_system_call: {
185
+ type: string;
186
+ id: number;
187
+ };
188
+ };
189
+ };
190
+ active_transaction_data: {
191
+ fields: {
192
+ rc_limit: {
193
+ type: string;
194
+ id: number;
195
+ options: {
196
+ jstype: string;
197
+ };
198
+ };
199
+ nonce: {
200
+ type: string;
201
+ id: number;
202
+ options: {
203
+ jstype: string;
204
+ };
205
+ };
206
+ operations: {
207
+ rule: string;
208
+ type: string;
209
+ id: number;
210
+ };
211
+ };
212
+ };
213
+ passive_transaction_data: {
214
+ fields: {};
215
+ };
216
+ transaction: {
217
+ fields: {
218
+ id: {
219
+ type: string;
220
+ id: number;
221
+ options: {
222
+ "(koinos_bytes_type)": string;
223
+ };
224
+ };
225
+ active: {
226
+ type: string;
227
+ id: number;
228
+ };
229
+ passive: {
230
+ type: string;
231
+ id: number;
232
+ };
233
+ signature_data: {
234
+ type: string;
235
+ id: number;
236
+ };
237
+ };
238
+ };
239
+ active_block_data: {
240
+ fields: {
241
+ transaction_merkle_root: {
242
+ type: string;
243
+ id: number;
244
+ };
245
+ passive_data_merkle_root: {
246
+ type: string;
247
+ id: number;
248
+ };
249
+ signer: {
250
+ type: string;
251
+ id: number;
252
+ };
253
+ };
254
+ };
255
+ passive_block_data: {
256
+ fields: {};
257
+ };
258
+ block_header: {
259
+ fields: {
260
+ previous: {
261
+ type: string;
262
+ /**
263
+ * ABI for tokens
264
+ */
265
+ id: number;
266
+ options: {
267
+ "(koinos_bytes_type)": string;
268
+ };
269
+ };
270
+ height: {
271
+ type: string;
272
+ id: number;
273
+ options: {
274
+ jstype: string;
275
+ };
276
+ };
277
+ timestamp: {
278
+ type: string;
279
+ id: number;
280
+ options: {
281
+ jstype: string;
282
+ };
283
+ };
284
+ };
285
+ };
286
+ block: {
287
+ fields: {
288
+ id: {
289
+ type: string;
290
+ id: number;
291
+ options: {
292
+ "(koinos_bytes_type)": string;
293
+ };
294
+ };
295
+ header: {
296
+ type: string;
297
+ id: number;
298
+ };
299
+ active: {
300
+ type: string;
301
+ id: number;
302
+ };
303
+ passive: {
304
+ type: string;
305
+ id: number;
306
+ };
307
+ signature_data: {
308
+ type: string;
309
+ id: number;
310
+ };
311
+ transactions: {
312
+ rule: string;
313
+ type: string;
314
+ id: number;
315
+ };
316
+ };
317
+ };
318
+ block_receipt: {
319
+ fields: {};
320
+ };
321
+ };
322
+ };
323
+ };
324
+ };
325
+ };
326
+ };