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,429 @@
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
+ defaultTypeName: "active_transaction_data",
113
+ bytesConversion: false,
114
+ });
115
+ }
116
+ if (typeof c.privateKey === "string") {
117
+ this.publicKey = secp.getPublicKey(c.privateKey, this.compressed);
118
+ this.address = (0, utils_1.bitcoinAddress)(this.publicKey);
119
+ }
120
+ else {
121
+ this.publicKey = secp.getPublicKey(c.privateKey, this.compressed);
122
+ this.address = (0, utils_1.bitcoinAddress)(this.publicKey);
123
+ }
124
+ }
125
+ /**
126
+ * Function to import a private key from the WIF
127
+ * @param wif - Private key in WIF format
128
+ * @example
129
+ * ```ts
130
+ * const signer = Signer.fromWif("L59UtJcTdNBnrH2QSBA5beSUhRufRu3g6tScDTite6Msuj7U93tM")
131
+ * console.log(signer.getAddress());
132
+ * // 1MbL6mG8ASAvSYdoMnGUfG3ZXkmQ2dpL5b
133
+ * ```
134
+ * @returns Signer object
135
+ */
136
+ static fromWif(wif) {
137
+ const compressed = wif[0] !== "5";
138
+ const privateKey = (0, utils_1.bitcoinDecode)(wif);
139
+ return new Signer({
140
+ privateKey: (0, utils_1.toHexString)(privateKey),
141
+ compressed,
142
+ });
143
+ }
144
+ /**
145
+ * Function to import a private key from the seed
146
+ * @param seed - Seed words
147
+ * @param compressed -
148
+ * @example
149
+ * ```ts
150
+ * const signer = Signer.fromSeed("my seed");
151
+ * console.log(signer.getAddress());
152
+ * // 1BqtgWBcqm9cSZ97avLGZGJdgso7wx6pCA
153
+ * ```
154
+ * @returns Signer object
155
+ */
156
+ static fromSeed(seed, compressed) {
157
+ const privateKey = (0, sha256_1.sha256)(seed);
158
+ return new Signer({ privateKey, compressed });
159
+ }
160
+ /**
161
+ * @param compressed - determines if the address should be
162
+ * derived from the compressed public key (default) or the public key
163
+ * @returns Signer address
164
+ */
165
+ getAddress(compressed = true) {
166
+ if (typeof this.privateKey === "string") {
167
+ const publicKey = secp.getPublicKey(this.privateKey, compressed);
168
+ return (0, utils_1.bitcoinAddress)(publicKey);
169
+ }
170
+ const publicKey = secp.getPublicKey(this.privateKey, compressed);
171
+ return (0, utils_1.bitcoinAddress)(publicKey);
172
+ }
173
+ /**
174
+ * Function to get the private key in hex format or wif format
175
+ * @param format - The format must be "hex" (default) or "wif"
176
+ * @param compressed - Optional arg when using WIF format. By default it
177
+ * uses the compressed value defined in the signer
178
+ * @example
179
+ * ```ts
180
+ * const signer = Signer.fromSeed("one two three four five six");
181
+ * console.log(signer.getPrivateKey());
182
+ * // bab7fd6e5bd624f4ea0c33f7e7219262a6fa93a945a8964d9f110148286b7b37
183
+ *
184
+ * console.log(signer.getPrivateKey("wif"));
185
+ * // L3UfgFJWmbVziGB1uZBjkG1UjKkF7hhpXWY7mbTUdmycmvXCVtiL
186
+ *
187
+ * console.log(signer.getPrivateKey("wif", false));
188
+ * // 5KEX4TMHG66fT7cM9HMZLmdp4hVq4LC4X2Fkg6zeypM5UteWmtd
189
+ * ```
190
+ */
191
+ getPrivateKey(format = "hex", compressed) {
192
+ let stringPrivateKey;
193
+ if (this.privateKey instanceof Uint8Array) {
194
+ stringPrivateKey = (0, utils_1.toHexString)(this.privateKey);
195
+ }
196
+ else if (typeof this.privateKey === "string") {
197
+ stringPrivateKey = this.privateKey;
198
+ }
199
+ else {
200
+ stringPrivateKey = BigInt(this.privateKey).toString(16).padStart(64, "0");
201
+ }
202
+ const comp = compressed === undefined ? this.compressed : compressed;
203
+ switch (format) {
204
+ case "hex":
205
+ return stringPrivateKey;
206
+ case "wif":
207
+ return (0, utils_1.bitcoinEncode)((0, utils_1.toUint8Array)(stringPrivateKey), "private", comp);
208
+ default:
209
+ /* eslint-disable-next-line @typescript-eslint/restrict-template-expressions */
210
+ throw new Error(`Invalid format ${format}`);
211
+ }
212
+ }
213
+ /**
214
+ * Function to sign a transaction. It's important to remark that
215
+ * the transaction parameter is modified inside this function.
216
+ * @param tx - Unsigned transaction
217
+ * @returns
218
+ */
219
+ async signTransaction(tx) {
220
+ if (!tx.active)
221
+ throw new Error("Active data is not defined");
222
+ const hash = (0, sha256_1.sha256)((0, utils_1.decodeBase64)(tx.active));
223
+ const [compSignature, recovery] = await secp.sign(hash, this.privateKey, {
224
+ recovered: true,
225
+ canonical: true,
226
+ der: false, // compact signature
227
+ });
228
+ const compactSignature = new Uint8Array(65);
229
+ compactSignature.set([recovery + 31], 0);
230
+ compactSignature.set(compSignature, 1);
231
+ tx.signature_data = (0, utils_1.encodeBase64)(compactSignature);
232
+ const multihash = `0x1220${(0, utils_1.toHexString)(hash)}`; // 12: code sha2-256. 20: length (32 bytes)
233
+ tx.id = multihash;
234
+ return tx;
235
+ }
236
+ /**
237
+ * Function to sign and send a transaction. It internally uses
238
+ * [[Provider.sendTransaction]]
239
+ * @param tx - Transaction to send. It will be signed inside this function
240
+ * if it is not signed yet
241
+ * @param _abis - Collection of Abis to parse the operations in the
242
+ * transaction. This parameter is optional.
243
+ * @returns
244
+ */
245
+ async sendTransaction(tx, _abis) {
246
+ if (!tx.signature_data || !tx.id)
247
+ await this.signTransaction(tx);
248
+ if (!this.provider)
249
+ throw new Error("provider is undefined");
250
+ await this.provider.sendTransaction(tx);
251
+ return {
252
+ ...tx,
253
+ wait: async (type = "byBlock", timeout = 30000) => {
254
+ if (!this.provider)
255
+ throw new Error("provider is undefined");
256
+ return this.provider.wait(tx.id, type, timeout);
257
+ },
258
+ };
259
+ }
260
+ /**
261
+ * Function to recover the public key from a signed
262
+ * transaction or block.
263
+ * The output format can be compressed (default) or uncompressed.
264
+ *
265
+ * @example
266
+ * ```ts
267
+ * const publicKey = await Signer.recoverPublicKey(tx);
268
+ * ```
269
+ *
270
+ * If the signature data contains more data, like in the
271
+ * blocks for PoW consensus, use the "transformSignature"
272
+ * function to extract the signature.
273
+ *
274
+ * @example
275
+ * ```ts
276
+ * const powDescriptorJson = {
277
+ * nested: {
278
+ * mypackage: {
279
+ * nested: {
280
+ * pow_signature_data: {
281
+ * fields: {
282
+ * nonce: {
283
+ * type: "bytes",
284
+ * id: 1,
285
+ * },
286
+ * recoverable_signature: {
287
+ * type: "bytes",
288
+ * id: 2,
289
+ * },
290
+ * },
291
+ * },
292
+ * },
293
+ * },
294
+ * },
295
+ * };
296
+ *
297
+ * const serializer = new Serializer(powDescriptorJson, {
298
+ * defaultTypeName: "pow_signature_data",
299
+ * });
300
+ *
301
+ * const signer = await Signer.recoverPublicKey(block, {
302
+ * transformSignature: async (signatureData) => {
303
+ * const powSignatureData = await serializer.deserialize(signatureData);
304
+ * return powSignatureData.recoverable_signature;
305
+ * },
306
+ * });
307
+ * ```
308
+ */
309
+ static async recoverPublicKey(txOrBlock, opts) {
310
+ if (!txOrBlock.active)
311
+ throw new Error("active is not defined");
312
+ if (!txOrBlock.signature_data)
313
+ throw new Error("signature_data is not defined");
314
+ let signatureData = txOrBlock.signature_data;
315
+ if (opts && typeof opts.transformSignature === "function") {
316
+ signatureData = await opts.transformSignature(txOrBlock.signature_data);
317
+ }
318
+ let compressed = true;
319
+ if (opts && typeof opts.compressed !== "undefined") {
320
+ compressed = opts.compressed;
321
+ }
322
+ const hash = (0, sha256_1.sha256)((0, utils_1.decodeBase64)(txOrBlock.active));
323
+ const compactSignatureHex = (0, utils_1.toHexString)((0, utils_1.decodeBase64)(signatureData));
324
+ const recovery = Number(`0x${compactSignatureHex.slice(0, 2)}`) - 31;
325
+ const rHex = compactSignatureHex.slice(2, 66);
326
+ const sHex = compactSignatureHex.slice(66);
327
+ const r = BigInt(`0x${rHex}`);
328
+ const s = BigInt(`0x${sHex}`);
329
+ const sig = new secp.Signature(r, s);
330
+ const publicKey = secp.recoverPublicKey((0, utils_1.toHexString)(hash), sig.toHex(), recovery);
331
+ if (!publicKey)
332
+ throw new Error("Public key cannot be recovered");
333
+ if (!compressed)
334
+ return (0, utils_1.toHexString)(publicKey);
335
+ return secp.Point.fromHex(publicKey).toHex(true);
336
+ }
337
+ /**
338
+ * Function to recover the signer address from a signed
339
+ * transaction or block.
340
+ * The output format can be compressed (default) or uncompressed.
341
+ * @example
342
+ * ```ts
343
+ * const publicKey = await Signer.recoverAddress(tx);
344
+ * ```
345
+ *
346
+ * If the signature data contains more data, like in the
347
+ * blocks for PoW consensus, use the "transformSignature"
348
+ * function to extract the signature.
349
+ *
350
+ * @example
351
+ * ```ts
352
+ * const powDescriptorJson = {
353
+ * nested: {
354
+ * mypackage: {
355
+ * nested: {
356
+ * pow_signature_data: {
357
+ * fields: {
358
+ * nonce: {
359
+ * type: "bytes",
360
+ * id: 1,
361
+ * },
362
+ * recoverable_signature: {
363
+ * type: "bytes",
364
+ * id: 2,
365
+ * },
366
+ * },
367
+ * },
368
+ * },
369
+ * },
370
+ * },
371
+ * };
372
+ *
373
+ * const serializer = new Serializer(powDescriptorJson, {
374
+ * defaultTypeName: "pow_signature_data",
375
+ * });
376
+ *
377
+ * const signer = await Signer.recoverAddress(block, {
378
+ * transformSignature: async (signatureData) => {
379
+ * const powSignatureData = await serializer.deserialize(signatureData);
380
+ * return powSignatureData.recoverable_signature;
381
+ * },
382
+ * });
383
+ * ```
384
+ */
385
+ static async recoverAddress(txOrBlock, opts) {
386
+ const publicKey = await Signer.recoverPublicKey(txOrBlock, opts);
387
+ return (0, utils_1.bitcoinAddress)((0, utils_1.toUint8Array)(publicKey));
388
+ }
389
+ /**
390
+ * Function to encode a transaction
391
+ * @param activeData - Active data consists of nonce, rc_limit, and
392
+ * operations. Do not set the nonce to get it from the blockchain
393
+ * using the provider. The rc_limit is 1e8 by default.
394
+ * @returns A transaction encoded. The active field is encoded in
395
+ * base64url
396
+ */
397
+ async encodeTransaction(activeData) {
398
+ let { nonce } = activeData;
399
+ if (activeData.nonce === undefined) {
400
+ if (!this.provider)
401
+ throw new Error("Cannot get the nonce because provider is undefined. To skip this call set a nonce in the parameters");
402
+ // TODO: Option to resolve names
403
+ // this depends on the final architecture for names on Koinos
404
+ nonce = await this.provider.getNonce(this.getAddress());
405
+ }
406
+ const rcLimit = activeData.rc_limit === undefined ? 1e8 : activeData.rc_limit;
407
+ const operations = activeData.operations ? activeData.operations : [];
408
+ const activeData2 = {
409
+ rc_limit: rcLimit,
410
+ nonce,
411
+ operations,
412
+ };
413
+ const buffer = await this.serializer.serialize(activeData2);
414
+ return {
415
+ active: (0, utils_1.encodeBase64)(buffer),
416
+ };
417
+ }
418
+ /**
419
+ * Function to decode a transaction
420
+ */
421
+ async decodeTransaction(tx) {
422
+ if (!tx.active)
423
+ throw new Error("Active data is not defined");
424
+ return this.serializer.deserialize(tx.active);
425
+ }
426
+ }
427
+ exports.Signer = Signer;
428
+ exports.default = Signer;
429
+ //# 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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C3B,IAAI,UAAU,CAAC,KAAK,KAAK,SAAS,EAAE;YAClC,IAAI,CAAC,IAAI,CAAC,QAAQ;gBAChB,MAAM,IAAI,KAAK,CACb,qGAAqG,CACtG,CAAC;YACJ,gCAAgC;YAChC,6DAA6D;YAC7D,KAAK,GAAG,MAAM,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,CAAC,WAAW,CAAC,CAAC;QAE7D,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,CAAC,CAAC;IACjD,CAAC;CACF;AAjZD,wBAiZC;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"}