koilib 2.6.0 → 2.8.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 (43) hide show
  1. package/README.md +5 -5
  2. package/dist/koinos.js +178 -688
  3. package/dist/koinos.min.js +1 -1
  4. package/lib/Contract.d.ts +9 -11
  5. package/lib/Contract.js +12 -12
  6. package/lib/Contract.js.map +1 -1
  7. package/lib/Provider.d.ts +24 -17
  8. package/lib/Provider.js +83 -81
  9. package/lib/Provider.js.map +1 -1
  10. package/lib/Serializer.d.ts +6 -2
  11. package/lib/Serializer.js +10 -4
  12. package/lib/Serializer.js.map +1 -1
  13. package/lib/Signer.d.ts +24 -10
  14. package/lib/Signer.js +71 -24
  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 +85 -0
  23. package/lib/browser/Serializer.js +175 -0
  24. package/lib/browser/Serializer.js.map +1 -0
  25. package/lib/browser/Signer.d.ts +310 -0
  26. package/lib/browser/Signer.js +468 -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 +22 -21
  43. package/package.json +9 -6
@@ -0,0 +1,468 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.Signer = void 0;
26
+ /* eslint-disable no-param-reassign */
27
+ const sha256_1 = require("@noble/hashes/sha256");
28
+ const secp = __importStar(require("@noble/secp256k1"));
29
+ const protocol_proto_json_1 = __importDefault(require("./jsonDescriptors/protocol-proto.json"));
30
+ const utils_1 = require("./utils");
31
+ const Serializer_1 = require("./Serializer");
32
+ /**
33
+ * The Signer Class contains the private key needed to sign transactions.
34
+ * It can be created using the seed, wif, or private key
35
+ *
36
+ * @example
37
+ * using private key as hex string
38
+ * ```ts
39
+ * var privateKey = "ec8601a24f81decd57f4b611b5ac6eb801cb3780bb02c0f9cdfe9d09daaddf9c";
40
+ * var signer = new Signer({ privateKey });
41
+ * ```
42
+ * <br>
43
+ *
44
+ * using private key as Uint8Array
45
+ * ```ts
46
+ * var buffer = new Uint8Array([
47
+ * 236, 134, 1, 162, 79, 129, 222, 205,
48
+ * 87, 244, 182, 17, 181, 172, 110, 184,
49
+ * 1, 203, 55, 128, 187, 2, 192, 249,
50
+ * 205, 254, 157, 9, 218, 173, 223, 156
51
+ * ]);
52
+ * var signer = new Signer({ privateKey: buffer });
53
+ * ```
54
+ *
55
+ * <br>
56
+ *
57
+ * using private key as bigint
58
+ * ```ts
59
+ * var privateKey = 106982601049961974618234078204952280507266494766432547312316920283818886029212n;
60
+ * var signer = new Signer({ privateKey });
61
+ * ```
62
+ *
63
+ * <br>
64
+ *
65
+ * using the seed
66
+ * ```ts
67
+ * var signer = Signer.fromSeed("my seed");
68
+ * ```
69
+ *
70
+ * <br>
71
+ *
72
+ * using private key in WIF format
73
+ * ```ts
74
+ * var signer = Signer.fromWif("L59UtJcTdNBnrH2QSBA5beSUhRufRu3g6tScDTite6Msuj7U93tM");
75
+ * ```
76
+ *
77
+ * <br>
78
+ *
79
+ * defining a provider
80
+ * ```ts
81
+ * var provider = new Provider(["https://example.com/jsonrpc"]);
82
+ * var privateKey = "ec8601a24f81decd57f4b611b5ac6eb801cb3780bb02c0f9cdfe9d09daaddf9c";
83
+ * var signer = new Signer({ privateKey, provider });
84
+ * ```
85
+ */
86
+ class Signer {
87
+ /**
88
+ * The constructor receives de private key as hexstring, bigint or Uint8Array.
89
+ * See also the functions [[Signer.fromWif]] and [[Signer.fromSeed]]
90
+ * to create the signer from the WIF or Seed respectively.
91
+ *
92
+ * @param privateKey - Private key as hexstring, bigint or Uint8Array
93
+ * @param compressed - compressed format is true by default
94
+ * @param provider - provider to connect with the blockchain
95
+ * @example
96
+ * ```ts
97
+ * const privateKey = "ec8601a24f81decd57f4b611b5ac6eb801cb3780bb02c0f9cdfe9d09daaddf9c";
98
+ * cons signer = new Signer({ privateKey });
99
+ * console.log(signer.getAddress());
100
+ * // 1MbL6mG8ASAvSYdoMnGUfG3ZXkmQ2dpL5b
101
+ * ```
102
+ */
103
+ constructor(c) {
104
+ this.compressed = typeof c.compressed === "undefined" ? true : c.compressed;
105
+ this.privateKey = c.privateKey;
106
+ this.provider = c.provider;
107
+ if (c.serializer) {
108
+ this.serializer = c.serializer;
109
+ }
110
+ else {
111
+ this.serializer = new Serializer_1.Serializer(protocol_proto_json_1.default, {
112
+ bytesConversion: false,
113
+ });
114
+ }
115
+ if (typeof c.privateKey === "string") {
116
+ this.publicKey = secp.getPublicKey(c.privateKey, this.compressed);
117
+ this.address = (0, utils_1.bitcoinAddress)(this.publicKey);
118
+ }
119
+ else {
120
+ this.publicKey = secp.getPublicKey(c.privateKey, this.compressed);
121
+ this.address = (0, utils_1.bitcoinAddress)(this.publicKey);
122
+ }
123
+ }
124
+ /**
125
+ * Function to import a private key from the WIF
126
+ * @param wif - Private key in WIF format
127
+ * @example
128
+ * ```ts
129
+ * const signer = Signer.fromWif("L59UtJcTdNBnrH2QSBA5beSUhRufRu3g6tScDTite6Msuj7U93tM")
130
+ * console.log(signer.getAddress());
131
+ * // 1MbL6mG8ASAvSYdoMnGUfG3ZXkmQ2dpL5b
132
+ * ```
133
+ * @returns Signer object
134
+ */
135
+ static fromWif(wif) {
136
+ const compressed = wif[0] !== "5";
137
+ const privateKey = (0, utils_1.bitcoinDecode)(wif);
138
+ return new Signer({
139
+ privateKey: (0, utils_1.toHexString)(privateKey),
140
+ compressed,
141
+ });
142
+ }
143
+ /**
144
+ * Function to import a private key from the seed
145
+ * @param seed - Seed words
146
+ * @param compressed -
147
+ * @example
148
+ * ```ts
149
+ * const signer = Signer.fromSeed("my seed");
150
+ * console.log(signer.getAddress());
151
+ * // 1BqtgWBcqm9cSZ97avLGZGJdgso7wx6pCA
152
+ * ```
153
+ * @returns Signer object
154
+ */
155
+ static fromSeed(seed, compressed) {
156
+ const privateKey = (0, sha256_1.sha256)(seed);
157
+ return new Signer({ privateKey, compressed });
158
+ }
159
+ /**
160
+ * @param compressed - determines if the address should be
161
+ * derived from the compressed public key (default) or the public key
162
+ * @returns Signer address
163
+ */
164
+ getAddress(compressed = true) {
165
+ if (typeof this.privateKey === "string") {
166
+ const publicKey = secp.getPublicKey(this.privateKey, compressed);
167
+ return (0, utils_1.bitcoinAddress)(publicKey);
168
+ }
169
+ const publicKey = secp.getPublicKey(this.privateKey, compressed);
170
+ return (0, utils_1.bitcoinAddress)(publicKey);
171
+ }
172
+ /**
173
+ * Function to get the private key in hex format or wif format
174
+ * @param format - The format must be "hex" (default) or "wif"
175
+ * @param compressed - Optional arg when using WIF format. By default it
176
+ * uses the compressed value defined in the signer
177
+ * @example
178
+ * ```ts
179
+ * const signer = Signer.fromSeed("one two three four five six");
180
+ * console.log(signer.getPrivateKey());
181
+ * // bab7fd6e5bd624f4ea0c33f7e7219262a6fa93a945a8964d9f110148286b7b37
182
+ *
183
+ * console.log(signer.getPrivateKey("wif"));
184
+ * // L3UfgFJWmbVziGB1uZBjkG1UjKkF7hhpXWY7mbTUdmycmvXCVtiL
185
+ *
186
+ * console.log(signer.getPrivateKey("wif", false));
187
+ * // 5KEX4TMHG66fT7cM9HMZLmdp4hVq4LC4X2Fkg6zeypM5UteWmtd
188
+ * ```
189
+ */
190
+ getPrivateKey(format = "hex", compressed) {
191
+ let stringPrivateKey;
192
+ if (this.privateKey instanceof Uint8Array) {
193
+ stringPrivateKey = (0, utils_1.toHexString)(this.privateKey);
194
+ }
195
+ else if (typeof this.privateKey === "string") {
196
+ stringPrivateKey = this.privateKey;
197
+ }
198
+ else {
199
+ stringPrivateKey = BigInt(this.privateKey).toString(16).padStart(64, "0");
200
+ }
201
+ const comp = compressed === undefined ? this.compressed : compressed;
202
+ switch (format) {
203
+ case "hex":
204
+ return stringPrivateKey;
205
+ case "wif":
206
+ return (0, utils_1.bitcoinEncode)((0, utils_1.toUint8Array)(stringPrivateKey), "private", comp);
207
+ default:
208
+ /* eslint-disable-next-line @typescript-eslint/restrict-template-expressions */
209
+ throw new Error(`Invalid format ${format}`);
210
+ }
211
+ }
212
+ /**
213
+ * Function to sign a hash value. It returns the signature encoded
214
+ * in base64. The signature is in compact format with the
215
+ * recovery byte
216
+ * @param hash Hash value. Also known as digest
217
+ */
218
+ async signHash(hash) {
219
+ const [compSignature, recovery] = await secp.sign(hash, this.privateKey, {
220
+ recovered: true,
221
+ canonical: true,
222
+ der: false, // compact signature
223
+ });
224
+ const compactSignature = new Uint8Array(65);
225
+ compactSignature.set([recovery + 31], 0);
226
+ compactSignature.set(compSignature, 1);
227
+ return (0, utils_1.encodeBase64)(compactSignature);
228
+ }
229
+ /**
230
+ * Function to sign a transaction. It's important to remark that
231
+ * the transaction parameter is modified inside this function.
232
+ * @param tx - Unsigned transaction
233
+ */
234
+ async signTransaction(tx) {
235
+ if (!tx.active)
236
+ throw new Error("Active data is not defined");
237
+ const hash = (0, sha256_1.sha256)((0, utils_1.decodeBase64)(tx.active));
238
+ tx.signature_data = await this.signHash(hash);
239
+ // multihash 0x1220. 12: code sha2-256. 20: length (32 bytes)
240
+ tx.id = `0x1220${(0, utils_1.toHexString)(hash)}`;
241
+ return tx;
242
+ }
243
+ /**
244
+ * Function to sign a block for federated consensus. That is,
245
+ * just the ecdsa signature. For other algorithms, like PoW,
246
+ * you have to sign the block and then process the signature
247
+ * to add the extra data (nonce in the case of PoW).
248
+ * @param block - Unsigned block
249
+ */
250
+ async signBlock(block) {
251
+ const activeBytes = (0, utils_1.decodeBase64)(block.active);
252
+ const headerBytes = await this.serializer.serialize(block.header, "block_header", { bytesConversion: true });
253
+ const headerActiveBytes = new Uint8Array(headerBytes.length + activeBytes.length);
254
+ headerActiveBytes.set(headerBytes, 0);
255
+ headerActiveBytes.set(activeBytes, headerBytes.length);
256
+ const hash = (0, sha256_1.sha256)(headerActiveBytes);
257
+ block.signature_data = await this.signHash(hash);
258
+ // multihash 0x1220. 12: code sha2-256. 20: length (32 bytes)
259
+ block.id = `0x1220${(0, utils_1.toHexString)(hash)}`;
260
+ return block;
261
+ }
262
+ /**
263
+ * Function to sign and send a transaction. It internally uses
264
+ * [[Provider.sendTransaction]]
265
+ * @param tx - Transaction to send. It will be signed inside this function
266
+ * if it is not signed yet
267
+ * @param _abis - Collection of Abis to parse the operations in the
268
+ * transaction. This parameter is optional.
269
+ * @returns
270
+ */
271
+ async sendTransaction(tx, _abis) {
272
+ if (!tx.signature_data || !tx.id)
273
+ await this.signTransaction(tx);
274
+ if (!this.provider)
275
+ throw new Error("provider is undefined");
276
+ await this.provider.sendTransaction(tx);
277
+ return {
278
+ ...tx,
279
+ wait: async (type = "byBlock", timeout = 30000) => {
280
+ if (!this.provider)
281
+ throw new Error("provider is undefined");
282
+ return this.provider.wait(tx.id, type, timeout);
283
+ },
284
+ };
285
+ }
286
+ /**
287
+ * Function to recover the public key from a signed
288
+ * transaction or block.
289
+ * The output format can be compressed (default) or uncompressed.
290
+ *
291
+ * @example
292
+ * ```ts
293
+ * const publicKey = await Signer.recoverPublicKey(tx);
294
+ * ```
295
+ *
296
+ * If the signature data contains more data, like in the
297
+ * blocks for PoW consensus, use the "transformSignature"
298
+ * function to extract the signature.
299
+ *
300
+ * @example
301
+ * ```ts
302
+ * const powDescriptorJson = {
303
+ * nested: {
304
+ * mypackage: {
305
+ * nested: {
306
+ * pow_signature_data: {
307
+ * fields: {
308
+ * nonce: {
309
+ * type: "bytes",
310
+ * id: 1,
311
+ * },
312
+ * recoverable_signature: {
313
+ * type: "bytes",
314
+ * id: 2,
315
+ * },
316
+ * },
317
+ * },
318
+ * },
319
+ * },
320
+ * },
321
+ * };
322
+ *
323
+ * const serializer = new Serializer(powDescriptorJson, {
324
+ * defaultTypeName: "pow_signature_data",
325
+ * });
326
+ *
327
+ * const signer = await signer.recoverPublicKey(block, {
328
+ * transformSignature: async (signatureData) => {
329
+ * const powSignatureData = await serializer.deserialize(signatureData);
330
+ * return powSignatureData.recoverable_signature;
331
+ * },
332
+ * });
333
+ * ```
334
+ */
335
+ async recoverPublicKey(txOrBlock, opts) {
336
+ if (!txOrBlock.active)
337
+ throw new Error("active is not defined");
338
+ if (!txOrBlock.signature_data)
339
+ throw new Error("signature_data is not defined");
340
+ let signatureData = txOrBlock.signature_data;
341
+ if (opts && typeof opts.transformSignature === "function") {
342
+ signatureData = await opts.transformSignature(txOrBlock.signature_data);
343
+ }
344
+ let compressed = true;
345
+ if (opts && typeof opts.compressed !== "undefined") {
346
+ compressed = opts.compressed;
347
+ }
348
+ const block = txOrBlock;
349
+ let hash;
350
+ const activeBytes = (0, utils_1.decodeBase64)(block.active);
351
+ if (block.header) {
352
+ const headerBytes = await this.serializer.serialize(block.header, "block_header", { bytesConversion: true });
353
+ const headerActiveBytes = new Uint8Array(headerBytes.length + activeBytes.length);
354
+ headerActiveBytes.set(headerBytes, 0);
355
+ headerActiveBytes.set(activeBytes, headerBytes.length);
356
+ hash = (0, sha256_1.sha256)(headerActiveBytes);
357
+ }
358
+ else {
359
+ // transaction
360
+ hash = (0, sha256_1.sha256)(activeBytes);
361
+ }
362
+ const compactSignatureHex = (0, utils_1.toHexString)((0, utils_1.decodeBase64)(signatureData));
363
+ const recovery = Number(`0x${compactSignatureHex.slice(0, 2)}`) - 31;
364
+ const rHex = compactSignatureHex.slice(2, 66);
365
+ const sHex = compactSignatureHex.slice(66);
366
+ const r = BigInt(`0x${rHex}`);
367
+ const s = BigInt(`0x${sHex}`);
368
+ const sig = new secp.Signature(r, s);
369
+ const publicKey = secp.recoverPublicKey((0, utils_1.toHexString)(hash), sig.toHex(), recovery);
370
+ if (!publicKey)
371
+ throw new Error("Public key cannot be recovered");
372
+ if (!compressed)
373
+ return (0, utils_1.toHexString)(publicKey);
374
+ return secp.Point.fromHex(publicKey).toHex(true);
375
+ }
376
+ /**
377
+ * Function to recover the signer address from a signed
378
+ * transaction or block.
379
+ * The output format can be compressed (default) or uncompressed.
380
+ * @example
381
+ * ```ts
382
+ * const publicKey = await signer.recoverAddress(tx);
383
+ * ```
384
+ *
385
+ * If the signature data contains more data, like in the
386
+ * blocks for PoW consensus, use the "transformSignature"
387
+ * function to extract the signature.
388
+ *
389
+ * @example
390
+ * ```ts
391
+ * const powDescriptorJson = {
392
+ * nested: {
393
+ * mypackage: {
394
+ * nested: {
395
+ * pow_signature_data: {
396
+ * fields: {
397
+ * nonce: {
398
+ * type: "bytes",
399
+ * id: 1,
400
+ * },
401
+ * recoverable_signature: {
402
+ * type: "bytes",
403
+ * id: 2,
404
+ * },
405
+ * },
406
+ * },
407
+ * },
408
+ * },
409
+ * },
410
+ * };
411
+ *
412
+ * const serializer = new Serializer(powDescriptorJson, {
413
+ * defaultTypeName: "pow_signature_data",
414
+ * });
415
+ *
416
+ * const signer = await signer.recoverAddress(block, {
417
+ * transformSignature: async (signatureData) => {
418
+ * const powSignatureData = await serializer.deserialize(signatureData);
419
+ * return powSignatureData.recoverable_signature;
420
+ * },
421
+ * });
422
+ * ```
423
+ */
424
+ async recoverAddress(txOrBlock, opts) {
425
+ const publicKey = await this.recoverPublicKey(txOrBlock, opts);
426
+ return (0, utils_1.bitcoinAddress)((0, utils_1.toUint8Array)(publicKey));
427
+ }
428
+ /**
429
+ * Function to encode a transaction
430
+ * @param activeData - Active data consists of nonce, rc_limit, and
431
+ * operations. Do not set the nonce to get it from the blockchain
432
+ * using the provider. The rc_limit is 1e8 by default.
433
+ * @returns A transaction encoded. The active field is encoded in
434
+ * base64url
435
+ */
436
+ async encodeTransaction(activeData) {
437
+ let { nonce } = activeData;
438
+ if (activeData.nonce === undefined) {
439
+ if (!this.provider)
440
+ throw new Error("Cannot get the nonce because provider is undefined. To skip this call set a nonce in the parameters");
441
+ // TODO: Option to resolve names
442
+ // this depends on the final architecture for names on Koinos
443
+ nonce = await this.provider.getNonce(this.getAddress());
444
+ }
445
+ const rcLimit = activeData.rc_limit === undefined ? 1e8 : activeData.rc_limit;
446
+ const operations = activeData.operations ? activeData.operations : [];
447
+ const activeData2 = {
448
+ rc_limit: rcLimit,
449
+ nonce,
450
+ operations,
451
+ };
452
+ const buffer = await this.serializer.serialize(activeData2, "active_transaction_data");
453
+ return {
454
+ active: (0, utils_1.encodeBase64)(buffer),
455
+ };
456
+ }
457
+ /**
458
+ * Function to decode a transaction
459
+ */
460
+ async decodeTransaction(tx) {
461
+ if (!tx.active)
462
+ throw new Error("Active data is not defined");
463
+ return this.serializer.deserialize(tx.active, "active_transaction_data");
464
+ }
465
+ }
466
+ exports.Signer = Signer;
467
+ exports.default = Signer;
468
+ //# sourceMappingURL=Signer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Signer.js","sourceRoot":"","sources":["../../src/Signer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAsC;AACtC,iDAA8C;AAC9C,uDAAyC;AAUzC,gGAAiE;AACjE,mCAQiB;AACjB,6CAA0C;AAkB1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAa,MAAM;IA0BjB;;;;;;;;;;;;;;;OAeG;IACH,YAAY,CAWX;QACC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,CAAC,UAAU,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;QAC5E,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC;QAC3B,IAAI,CAAC,CAAC,UAAU,EAAE;YAChB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC;SAChC;aAAM;YACL,IAAI,CAAC,UAAU,GAAG,IAAI,uBAAU,CAAC,6BAAY,EAAE;gBAC7C,eAAe,EAAE,KAAK;aACvB,CAAC,CAAC;SACJ;QACD,IAAI,OAAO,CAAC,CAAC,UAAU,KAAK,QAAQ,EAAE;YACpC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;YAClE,IAAI,CAAC,OAAO,GAAG,IAAA,sBAAc,EAAC,IAAI,CAAC,SAA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AM,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;SACzD;QACD,MAAM,OAAO,GACX,UAAU,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC;QAChE,MAAM,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;QAEtE,MAAM,WAAW,GAA0B;YACzC,QAAQ,EAAE,OAAO;YACjB,KAAK;YACL,UAAU;SACX,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAW,CAAC,SAAS,CAC7C,WAAW,EACX,yBAAyB,CAC1B,CAAC;QAEF,OAAO;YACL,MAAM,EAAE,IAAA,oBAAY,EAAC,MAAM,CAAC;SACV,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,iBAAiB,CAAC,EAAmB;QACzC,IAAI,CAAC,EAAE,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAC9D,OAAO,IAAI,CAAC,UAAW,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;IAC5E,CAAC;CACF;AAxcD,wBAwcC;AAED,kBAAe,MAAM,CAAC"}
@@ -0,0 +1,7 @@
1
+ /*! koilib - MIT License (c) Julian Gonzalez (joticajulian@gmail.com) */
2
+ export * as utils from "./utils";
3
+ export * as interfaces from "./interface";
4
+ export * from "./Contract";
5
+ export * from "./Signer";
6
+ export * from "./Provider";
7
+ export * from "./Serializer";
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
22
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.interfaces = exports.utils = void 0;
26
+ /*! koilib - MIT License (c) Julian Gonzalez (joticajulian@gmail.com) */
27
+ // eslint-disable import/no-cycle
28
+ exports.utils = __importStar(require("./utils"));
29
+ exports.interfaces = __importStar(require("./interface"));
30
+ __exportStar(require("./Contract"), exports);
31
+ __exportStar(require("./Signer"), exports);
32
+ __exportStar(require("./Provider"), exports);
33
+ __exportStar(require("./Serializer"), exports);
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wEAAwE;AACxE,iCAAiC;AACjC,iDAAiC;AACjC,0DAA0C;AAC1C,6CAA2B;AAC3B,2CAAyB;AACzB,6CAA2B;AAC3B,+CAA6B"}
@@ -0,0 +1,2 @@
1
+ /*! koilib - MIT License (c) Julian Gonzalez (joticajulian@gmail.com) */
2
+ export {};
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ /*! koilib - MIT License (c) Julian Gonzalez (joticajulian@gmail.com) */
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
6
+ }) : (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ o[k2] = m[k];
9
+ }));
10
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
11
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
12
+ }) : function(o, v) {
13
+ o["default"] = v;
14
+ });
15
+ var __importStar = (this && this.__importStar) || function (mod) {
16
+ if (mod && mod.__esModule) return mod;
17
+ var result = {};
18
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
19
+ __setModuleDefault(result, mod);
20
+ return result;
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ const utils = __importStar(require("./utils"));
24
+ const Contract_1 = require("./Contract");
25
+ const Signer_1 = require("./Signer");
26
+ const Provider_1 = require("./Provider");
27
+ const Serializer_1 = require("./Serializer");
28
+ window.utils = utils;
29
+ window.Contract = Contract_1.Contract;
30
+ window.Signer = Signer_1.Signer;
31
+ window.Provider = Provider_1.Provider;
32
+ window.Serializer = Serializer_1.Serializer;
33
+ //# sourceMappingURL=index2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index2.js","sourceRoot":"","sources":["../../src/index2.ts"],"names":[],"mappings":";AAAA,wEAAwE;;;;;;;;;;;;;;;;;;;;;AAExE,+CAAiC;AACjC,yCAAsC;AACtC,qCAAkC;AAClC,yCAAsC;AACtC,6CAA0C;AAI1C,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;AACrB,MAAM,CAAC,QAAQ,GAAG,mBAAQ,CAAC;AAC3B,MAAM,CAAC,MAAM,GAAG,eAAM,CAAC;AACvB,MAAM,CAAC,QAAQ,GAAG,mBAAQ,CAAC;AAC3B,MAAM,CAAC,UAAU,GAAG,uBAAU,CAAC"}