koilib 2.6.1 → 3.0.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 (66) hide show
  1. package/README.md +66 -12
  2. package/dist/koinos.js +8533 -274
  3. package/dist/koinos.min.js +1 -1
  4. package/lib/Contract.d.ts +53 -16
  5. package/lib/Contract.js +99 -31
  6. package/lib/Contract.js.map +1 -1
  7. package/lib/Provider.d.ts +39 -19
  8. package/lib/Provider.js +119 -87
  9. package/lib/Provider.js.map +1 -1
  10. package/lib/Serializer.d.ts +8 -3
  11. package/lib/Serializer.js +60 -41
  12. package/lib/Serializer.js.map +1 -1
  13. package/lib/Signer.d.ts +53 -39
  14. package/lib/Signer.js +320 -91
  15. package/lib/Signer.js.map +1 -1
  16. package/lib/browser/Contract.d.ts +53 -16
  17. package/lib/browser/Contract.js +99 -31
  18. package/lib/browser/Contract.js.map +1 -1
  19. package/lib/browser/Provider.d.ts +39 -19
  20. package/lib/browser/Provider.js +119 -87
  21. package/lib/browser/Provider.js.map +1 -1
  22. package/lib/browser/Serializer.d.ts +8 -3
  23. package/lib/browser/Serializer.js +60 -41
  24. package/lib/browser/Serializer.js.map +1 -1
  25. package/lib/browser/Signer.d.ts +53 -39
  26. package/lib/browser/Signer.js +320 -91
  27. package/lib/browser/Signer.js.map +1 -1
  28. package/lib/browser/index.d.ts +1 -1
  29. package/lib/browser/index.js +1 -1
  30. package/lib/browser/index.js.map +1 -1
  31. package/lib/browser/indexUtils.d.ts +2 -0
  32. package/lib/browser/indexUtils.js +15 -0
  33. package/lib/browser/indexUtils.js.map +1 -0
  34. package/lib/browser/interface.d.ts +242 -65
  35. package/lib/browser/jsonDescriptors/chain-proto.json +676 -0
  36. package/lib/browser/jsonDescriptors/krc20-proto.json +47 -4
  37. package/lib/browser/protoModules/protocol-proto.d.ts +2 -0
  38. package/lib/browser/protoModules/protocol-proto.js +6336 -0
  39. package/lib/browser/protoModules/protocol-proto.js.map +1 -0
  40. package/lib/browser/utils.d.ts +18 -254
  41. package/lib/browser/utils.js +140 -12
  42. package/lib/browser/utils.js.map +1 -1
  43. package/lib/browser/utilsNode.d.ts +1021 -0
  44. package/lib/browser/utilsNode.js +346 -0
  45. package/lib/browser/utilsNode.js.map +1 -0
  46. package/lib/index.d.ts +1 -1
  47. package/lib/index.js +1 -1
  48. package/lib/index.js.map +1 -1
  49. package/lib/indexUtils.d.ts +2 -0
  50. package/lib/indexUtils.js +15 -0
  51. package/lib/indexUtils.js.map +1 -0
  52. package/lib/interface.d.ts +242 -65
  53. package/lib/jsonDescriptors/chain-proto.json +676 -0
  54. package/lib/jsonDescriptors/krc20-proto.json +47 -4
  55. package/lib/protoModules/protocol-proto.d.ts +2 -0
  56. package/lib/protoModules/protocol-proto.js +6336 -0
  57. package/lib/protoModules/protocol-proto.js.map +1 -0
  58. package/lib/utils.d.ts +18 -254
  59. package/lib/utils.js +140 -12
  60. package/lib/utils.js.map +1 -1
  61. package/lib/utilsNode.d.ts +1021 -0
  62. package/lib/utilsNode.js +346 -0
  63. package/lib/utilsNode.js.map +1 -0
  64. package/package.json +1 -1
  65. package/lib/browser/jsonDescriptors/protocol-proto.json +0 -246
  66. package/lib/jsonDescriptors/protocol-proto.json +0 -246
@@ -1,7 +1,7 @@
1
1
  import { Signer, SignerInterface } from "./Signer";
2
2
  import { Provider } from "./Provider";
3
3
  import { Serializer } from "./Serializer";
4
- import { CallContractOperationNested, UploadContractOperationNested, TransactionJson, Abi, TransactionOptions, DecodedOperationJson, SendTransactionResponse } from "./interface";
4
+ import { CallContractOperationNested, UploadContractOperationNested, TransactionJsonWait, Abi, TransactionOptions, DecodedOperationJson, DeployOptions } from "./interface";
5
5
  /**
6
6
  * The contract class contains the contract ID and contract entries
7
7
  * definition needed to encode/decode operations during the
@@ -40,15 +40,15 @@ import { CallContractOperationNested, UploadContractOperationNested, Transaction
40
40
  * console.log(result)
41
41
  *
42
42
  * // Transfer
43
- * const { transaction, transactionResponse } = await koin.transfer({
43
+ * const { transaction } = await koin.transfer({
44
44
  * to: "172AB1FgCsYrRAW5cwQ8KjadgxofvgPFd6",
45
45
  * value: "10.0001",
46
46
  * });
47
47
  * console.log(`Transaction id ${transaction.id} submitted`);
48
48
  *
49
49
  * // wait to be mined
50
- * const blockId = await transactionResponse.wait();
51
- * console.log(`Transaction mined. Block id: ${blockId}`);
50
+ * const blockNumber = await transaction.wait();
51
+ * console.log(`Transaction mined. Block number: ${blockNumber}`);
52
52
  * }
53
53
  *
54
54
  * main();
@@ -69,12 +69,29 @@ export declare class Contract {
69
69
  * const owner = "1Gvqdo9if6v6tFomEuTuMWP1D7H7U9yksb";
70
70
  * await koinContract.functions.balanceOf({ owner });
71
71
  * ```
72
+ *
73
+ * @example using options
74
+ * ```ts
75
+ * await koinContract.functions.transfer({
76
+ * from: "1Gvqdo9if6v6tFomEuTuMWP1D7H7U9yksb",
77
+ * to: "19JntSm8pSNETT9aHTwAUHC5RMoaSmgZPJ",
78
+ * value: "1",
79
+ * },{
80
+ * chainId: "EiB-hw5ABo-EXy6fGDd1Iq3gbAenxQ4Qe60pRbEVMVrR9A==",
81
+ * rcLimit: "100000000",
82
+ * nonce: "OAI=",
83
+ * payer: "19JntSm8pSNETT9aHTwAUHC5RMoaSmgZPJ",
84
+ * payee: "1Gvqdo9if6v6tFomEuTuMWP1D7H7U9yksb",
85
+ * signTransaction: true,
86
+ * sendTransaction: true,
87
+ * sendAbis: true,
88
+ * });
89
+ * ```
72
90
  */
73
91
  functions: {
74
92
  [x: string]: <T = Record<string, unknown>>(args?: unknown, opts?: TransactionOptions) => Promise<{
75
93
  operation: CallContractOperationNested;
76
- transaction?: TransactionJson;
77
- transactionResponse?: SendTransactionResponse;
94
+ transaction?: TransactionJsonWait;
78
95
  result?: T;
79
96
  }>;
80
97
  };
@@ -119,10 +136,6 @@ export declare class Contract {
119
136
  */
120
137
  serializer?: Serializer;
121
138
  });
122
- /**
123
- * Compute contract Id
124
- */
125
- static computeContractId(address: string): Uint8Array;
126
139
  /**
127
140
  * Get contract Id
128
141
  */
@@ -137,16 +150,40 @@ export declare class Contract {
137
150
  * const signer = new Signer({ privateKey, provider });
138
151
  * const bytecode = new Uint8Array([1, 2, 3, 4]);
139
152
  * const contract = new Contract({ signer, provider, bytecode });
140
- * const { transactionResponse } = await contract.deploy();
153
+ * const { transaction } = await contract.deploy();
154
+ * // wait to be mined
155
+ * const blockNumber = await transaction.wait();
156
+ * console.log(`Contract uploaded in block number ${blockNumber}`);
157
+ * ```
158
+ *
159
+ * @example using options
160
+ * ```ts
161
+ * const { transaction } = await contract.deploy({
162
+ * // contract options
163
+ * abi: "CssCChRrb2lub3Mvb3B0aW9ucy5wc...",
164
+ * authorizesCallContract: true,
165
+ * authorizesTransactionApplication: true,
166
+ * authorizesUploadContract: true,
167
+ *
168
+ * // transaction options
169
+ * chainId: "EiB-hw5ABo-EXy6fGDd1Iq3gbAenxQ4Qe60pRbEVMVrR9A==",
170
+ * rcLimit: "100000000",
171
+ * nonce: "OAI=",
172
+ * payer: "19JntSm8pSNETT9aHTwAUHC5RMoaSmgZPJ",
173
+ * payee: "1Gvqdo9if6v6tFomEuTuMWP1D7H7U9yksb",
174
+ *
175
+ * // sign and broadcast
176
+ * signTransaction: true,
177
+ * sendTransaction: true,
178
+ * });
141
179
  * // wait to be mined
142
- * const blockId = await transactionResponse.wait();
143
- * console.log(`Contract uploaded in block id ${blockId}`);
180
+ * const blockNumber = await transaction.wait();
181
+ * console.log(`Contract uploaded in block number ${blockNumber}`);
144
182
  * ```
145
183
  */
146
- deploy(options?: TransactionOptions): Promise<{
184
+ deploy(options?: DeployOptions): Promise<{
147
185
  operation: UploadContractOperationNested;
148
- transaction?: TransactionJson;
149
- transactionResponse?: SendTransactionResponse;
186
+ transaction: TransactionJsonWait;
150
187
  }>;
151
188
  /**
152
189
  * Encondes a contract operation using Koinos serialization
@@ -41,15 +41,15 @@ const utils_1 = require("./utils");
41
41
  * console.log(result)
42
42
  *
43
43
  * // Transfer
44
- * const { transaction, transactionResponse } = await koin.transfer({
44
+ * const { transaction } = await koin.transfer({
45
45
  * to: "172AB1FgCsYrRAW5cwQ8KjadgxofvgPFd6",
46
46
  * value: "10.0001",
47
47
  * });
48
48
  * console.log(`Transaction id ${transaction.id} submitted`);
49
49
  *
50
50
  * // wait to be mined
51
- * const blockId = await transactionResponse.wait();
52
- * console.log(`Transaction mined. Block id: ${blockId}`);
51
+ * const blockNumber = await transaction.wait();
52
+ * console.log(`Transaction mined. Block number: ${blockNumber}`);
53
53
  * }
54
54
  *
55
55
  * main();
@@ -71,7 +71,7 @@ class Contract {
71
71
  this.serializer = new Serializer_1.Serializer(c.abi.types);
72
72
  }
73
73
  this.options = {
74
- rc_limit: 1e8,
74
+ signTransaction: true,
75
75
  sendTransaction: true,
76
76
  sendAbis: true,
77
77
  ...c.options,
@@ -110,7 +110,7 @@ class Contract {
110
110
  const { result: resultEncoded } = await this.provider.readContract({
111
111
  contract_id: (0, utils_1.encodeBase58)(operation.call_contract.contract_id),
112
112
  entry_point: operation.call_contract.entry_point,
113
- args: (0, utils_1.encodeBase64)(operation.call_contract.args),
113
+ args: (0, utils_1.encodeBase64url)(operation.call_contract.args),
114
114
  });
115
115
  let result = defaultOutput;
116
116
  if (resultEncoded) {
@@ -121,33 +121,47 @@ class Contract {
121
121
  }
122
122
  return { operation, result };
123
123
  }
124
- // return operation if send is false
125
- if (!(opts === null || opts === void 0 ? void 0 : opts.sendTransaction))
126
- return { operation };
127
124
  // write contract (sign and send)
128
125
  if (!this.signer)
129
126
  throw new Error("signer not found");
130
- const transaction = await this.signer.encodeTransaction({
131
- ...opts,
132
- operations: [operation],
127
+ const tx = await this.signer.prepareTransaction({
128
+ header: {
129
+ ...((opts === null || opts === void 0 ? void 0 : opts.chainId) && { chain_id: opts === null || opts === void 0 ? void 0 : opts.chainId }),
130
+ ...((opts === null || opts === void 0 ? void 0 : opts.rcLimit) && { rc_limit: opts === null || opts === void 0 ? void 0 : opts.rcLimit }),
131
+ ...((opts === null || opts === void 0 ? void 0 : opts.nonce) && { nonce: opts === null || opts === void 0 ? void 0 : opts.nonce }),
132
+ ...((opts === null || opts === void 0 ? void 0 : opts.payer) && { payer: opts === null || opts === void 0 ? void 0 : opts.payer }),
133
+ ...((opts === null || opts === void 0 ? void 0 : opts.payee) && { payee: opts === null || opts === void 0 ? void 0 : opts.payee }),
134
+ },
135
+ operations: [
136
+ {
137
+ call_contract: {
138
+ contract_id: (0, utils_1.encodeBase58)(operation.call_contract.contract_id),
139
+ entry_point: operation.call_contract.entry_point,
140
+ args: (0, utils_1.encodeBase64url)(operation.call_contract.args),
141
+ },
142
+ },
143
+ ],
133
144
  });
134
145
  const abis = {};
135
146
  if (opts === null || opts === void 0 ? void 0 : opts.sendAbis) {
136
147
  const contractId = (0, utils_1.encodeBase58)(this.id);
137
148
  abis[contractId] = this.abi;
138
149
  }
139
- const transactionResponse = await this.signer.sendTransaction(transaction, abis);
140
- return { operation, transaction, transactionResponse };
150
+ // return result if the transaction will not be broadcasted
151
+ if (!(opts === null || opts === void 0 ? void 0 : opts.sendTransaction)) {
152
+ const noWait = () => {
153
+ throw new Error("This transaction was not broadcasted");
154
+ };
155
+ if (opts.signTransaction)
156
+ await this.signer.signTransaction(tx, abis);
157
+ return { operation, transaction: { ...tx, wait: noWait } };
158
+ }
159
+ const transaction = await this.signer.sendTransaction(tx, abis);
160
+ return { operation, transaction };
141
161
  };
142
162
  });
143
163
  }
144
164
  }
145
- /**
146
- * Compute contract Id
147
- */
148
- static computeContractId(address) {
149
- return (0, utils_1.decodeBase58)(address);
150
- }
151
165
  /**
152
166
  * Get contract Id
153
167
  */
@@ -166,10 +180,35 @@ class Contract {
166
180
  * const signer = new Signer({ privateKey, provider });
167
181
  * const bytecode = new Uint8Array([1, 2, 3, 4]);
168
182
  * const contract = new Contract({ signer, provider, bytecode });
169
- * const { transactionResponse } = await contract.deploy();
183
+ * const { transaction } = await contract.deploy();
170
184
  * // wait to be mined
171
- * const blockId = await transactionResponse.wait();
172
- * console.log(`Contract uploaded in block id ${blockId}`);
185
+ * const blockNumber = await transaction.wait();
186
+ * console.log(`Contract uploaded in block number ${blockNumber}`);
187
+ * ```
188
+ *
189
+ * @example using options
190
+ * ```ts
191
+ * const { transaction } = await contract.deploy({
192
+ * // contract options
193
+ * abi: "CssCChRrb2lub3Mvb3B0aW9ucy5wc...",
194
+ * authorizesCallContract: true,
195
+ * authorizesTransactionApplication: true,
196
+ * authorizesUploadContract: true,
197
+ *
198
+ * // transaction options
199
+ * chainId: "EiB-hw5ABo-EXy6fGDd1Iq3gbAenxQ4Qe60pRbEVMVrR9A==",
200
+ * rcLimit: "100000000",
201
+ * nonce: "OAI=",
202
+ * payer: "19JntSm8pSNETT9aHTwAUHC5RMoaSmgZPJ",
203
+ * payee: "1Gvqdo9if6v6tFomEuTuMWP1D7H7U9yksb",
204
+ *
205
+ * // sign and broadcast
206
+ * signTransaction: true,
207
+ * sendTransaction: true,
208
+ * });
209
+ * // wait to be mined
210
+ * const blockNumber = await transaction.wait();
211
+ * console.log(`Contract uploaded in block number ${blockNumber}`);
173
212
  * ```
174
213
  */
175
214
  async deploy(options) {
@@ -183,19 +222,48 @@ class Contract {
183
222
  };
184
223
  const operation = {
185
224
  upload_contract: {
186
- contract_id: Contract.computeContractId(this.signer.getAddress()),
225
+ contract_id: (0, utils_1.decodeBase58)(this.signer.getAddress()),
187
226
  bytecode: this.bytecode,
188
227
  },
189
228
  };
190
- // return operation if send is false
191
- if (!(opts === null || opts === void 0 ? void 0 : opts.sendTransaction))
192
- return { operation };
193
- const transaction = await this.signer.encodeTransaction({
194
- ...opts,
195
- operations: [operation],
229
+ const tx = await this.signer.prepareTransaction({
230
+ header: {
231
+ ...((opts === null || opts === void 0 ? void 0 : opts.chainId) && { chain_id: opts === null || opts === void 0 ? void 0 : opts.chainId }),
232
+ ...((opts === null || opts === void 0 ? void 0 : opts.rcLimit) && { rc_limit: opts === null || opts === void 0 ? void 0 : opts.rcLimit }),
233
+ ...((opts === null || opts === void 0 ? void 0 : opts.nonce) && { nonce: opts === null || opts === void 0 ? void 0 : opts.nonce }),
234
+ ...((opts === null || opts === void 0 ? void 0 : opts.payer) && { payer: opts === null || opts === void 0 ? void 0 : opts.payer }),
235
+ ...((opts === null || opts === void 0 ? void 0 : opts.payee) && { payee: opts === null || opts === void 0 ? void 0 : opts.payee }),
236
+ },
237
+ operations: [
238
+ {
239
+ upload_contract: {
240
+ contract_id: (0, utils_1.encodeBase58)(operation.upload_contract.contract_id),
241
+ bytecode: (0, utils_1.encodeBase64url)(this.bytecode),
242
+ ...((opts === null || opts === void 0 ? void 0 : opts.abi) && { abi: opts === null || opts === void 0 ? void 0 : opts.abi }),
243
+ ...((opts === null || opts === void 0 ? void 0 : opts.authorizesCallContract) && {
244
+ authorizes_call_contract: opts === null || opts === void 0 ? void 0 : opts.authorizesCallContract,
245
+ }),
246
+ ...((opts === null || opts === void 0 ? void 0 : opts.authorizesTransactionApplication) && {
247
+ authorizes_transaction_application: opts === null || opts === void 0 ? void 0 : opts.authorizesTransactionApplication,
248
+ }),
249
+ ...((opts === null || opts === void 0 ? void 0 : opts.authorizesUploadContract) && {
250
+ authorizes_upload_contract: opts === null || opts === void 0 ? void 0 : opts.authorizesUploadContract,
251
+ }),
252
+ },
253
+ },
254
+ ],
196
255
  });
197
- const transactionResponse = await this.signer.sendTransaction(transaction);
198
- return { operation, transaction, transactionResponse };
256
+ // return result if the transaction will not be broadcasted
257
+ if (!(opts === null || opts === void 0 ? void 0 : opts.sendTransaction)) {
258
+ const noWait = () => {
259
+ throw new Error("This transaction was not broadcasted");
260
+ };
261
+ if (opts.signTransaction)
262
+ await this.signer.signTransaction(tx);
263
+ return { operation, transaction: { ...tx, wait: noWait } };
264
+ }
265
+ const transaction = await this.signer.sendTransaction(tx);
266
+ return { operation, transaction };
199
267
  }
200
268
  /**
201
269
  * Encondes a contract operation using Koinos serialization
@@ -1 +1 @@
1
- {"version":3,"file":"Contract.js","sourceRoot":"","sources":["../../src/Cont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./interface";
1
+ import { BlockJson, TransactionJson, CallContractOperationJson } from "./interface";
2
2
  /**
3
3
  * Class to connect with the RPC node
4
4
  */
@@ -60,16 +60,19 @@ export declare class Provider {
60
60
  * transactions for a particular account. This call is used
61
61
  * when creating new transactions.
62
62
  * @param account - account address
63
+ * @param deserialize - If set true it will deserialize the nonce
64
+ * and return it as number (default). If set false it will return
65
+ * the nonce encoded as received from the RPC.
63
66
  * @returns Nonce
64
67
  */
65
- getNonce(account: string): Promise<number>;
68
+ getNonce(account: string, deserialize?: boolean): Promise<number | string>;
66
69
  getAccountRc(account: string): Promise<string>;
67
70
  /**
68
71
  * Get transactions by id and their corresponding block ids
69
72
  */
70
73
  getTransactionsById(transactionIds: string[]): Promise<{
71
74
  transactions: {
72
- transaction: TransactionJson[];
75
+ transaction: TransactionJson;
73
76
  containing_blocks: string[];
74
77
  }[];
75
78
  }>;
@@ -89,8 +92,13 @@ export declare class Provider {
89
92
  height: string;
90
93
  previous: string;
91
94
  };
95
+ head_state_merkle_root: string;
92
96
  last_irreversible_block: string;
93
97
  }>;
98
+ /**
99
+ * Function to get the chain
100
+ */
101
+ getChainId(): Promise<string>;
94
102
  /**
95
103
  * Function to get consecutive blocks in descending order
96
104
  * @param height - Starting block height
@@ -119,27 +127,39 @@ export declare class Provider {
119
127
  };
120
128
  }>;
121
129
  /**
122
- * Function to call "chain.submit_transaction" to send a signed
123
- * transaction to the blockchain. It returns an object with the async
124
- * function "wait", which can be called to wait for the
125
- * transaction to be mined (see [[SendTransactionResponse]]).
126
- * @param transaction - Signed transaction
130
+ * Function to wait for a transaction to be mined.
131
+ * @param txId - transaction id
132
+ * @param type - Type must be "byBlock" (default) or "byTransactionId".
133
+ * _byBlock_ will query the blockchain to get blocks and search for the
134
+ * transaction there. _byTransactionId_ will query the "transaction store"
135
+ * microservice to search the transaction by its id. If non of them is
136
+ * specified the function will use "byBlock" (as "byTransactionId"
137
+ * requires the transaction store, which is an optional microservice).
138
+ *
139
+ * When _byBlock_ is used it returns the block number.
140
+ *
141
+ * When _byTransactionId_ is used it returns the block id.
142
+ *
143
+ * @param timeout - Timeout in milliseconds. By default it is 30000
127
144
  * @example
128
145
  * ```ts
129
- * const { transactionResponse } = await provider.sendTransaction({
130
- * id: "1220...",
131
- * active: "...",
132
- * signatureData: "...",
133
- * });
134
- * console.log("Transaction submitted to the mempool");
135
- * // wait to be mined
136
- * const blockNumber = await transactionResponse.wait();
137
- * // const blockNumber = await transactionResponse.wait("byBlock", 30000);
138
- * // const blockId = await transactionResponse.wait("byTransactionId", 30000);
146
+ * const blockNumber = await provider.wait(txId);
147
+ * // const blockNumber = await provider.wait(txId, "byBlock", 30000);
148
+ * // const blockId = await provider.wait(txId, "byTransactionId", 30000);
139
149
  * console.log("Transaction mined")
140
150
  * ```
141
151
  */
142
- sendTransaction(transaction: TransactionJson): Promise<SendTransactionResponse>;
152
+ wait(txId: string, type?: "byTransactionId" | "byBlock", timeout?: number): Promise<string | number>;
153
+ /**
154
+ * Function to call "chain.submit_transaction" to send a signed
155
+ * transaction to the blockchain.
156
+ */
157
+ sendTransaction(transaction: TransactionJson): Promise<Record<string, never>>;
158
+ /**
159
+ * Function to call "chain.submit_block" to send a signed
160
+ * block to the blockchain.
161
+ */
162
+ submitBlock(block: BlockJson): Promise<Record<string, never>>;
143
163
  /**
144
164
  * Function to call "chain.read_contract" to read a contract.
145
165
  * This function is used by [[Contract]] class when read methods