koilib 5.3.1 → 5.4.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.
@@ -111,7 +111,61 @@ export interface DecodedOperationJson {
111
111
  /** Arguments decoded. See [[Abi]] */
112
112
  args?: Record<string, unknown>;
113
113
  }
114
- export interface BaseTransactionOptions {
114
+ export interface SendTransactionOptions {
115
+ /**
116
+ * Broadcast
117
+ *
118
+ * Boolean to define if the transaction should be broadcasted
119
+ * to the different nodes in the network. By default it is true.
120
+ *
121
+ * Set it to false if you want to interact with a contract for
122
+ * testing purposes and check the possible events triggered.
123
+ */
124
+ broadcast?: boolean;
125
+ /**
126
+ * Collection of Abis so that the receiver can parse the
127
+ * operations in the transaction
128
+ */
129
+ abis?: Record<string, Abi>;
130
+ /**
131
+ * Send abis
132
+ *
133
+ * Boolean to define if the abis should be shared with
134
+ * the signer so it will be able to decode the operations.
135
+ * By default it is true.
136
+ */
137
+ sendAbis?: boolean;
138
+ /**
139
+ * Function to be called before sending a transaction to the
140
+ * blockchain. It is useful to apply multisignatures to
141
+ * the transaction.
142
+ *
143
+ * @example
144
+ * ```ts
145
+ * const signer2 = Signer.fromSeed("signer2");
146
+ * const signer3 = Signer.fromSeed("signer3");
147
+ *
148
+ * const addMoreSignatures = async (tx, opts) => {
149
+ * await signer2.signTransaction(tx);
150
+ * await signer3.signTransaction(tx);
151
+ * };
152
+ *
153
+ * const { transaction } = await koin.transfer(
154
+ * {
155
+ * from: "16MT1VQFgsVxEfJrSGinrA5buiqBsN5ViJ",
156
+ * to: "1Gvqdo9if6v6tFomEuTuMWP1D7H7U9yksb",
157
+ * value: "1000000",
158
+ * },
159
+ * {
160
+ * payer: signer2.getAddress(),
161
+ * beforeSend: addMoreSignatures,
162
+ * }
163
+ * );
164
+ * ```
165
+ */
166
+ beforeSend?: (tx: TransactionJson, options?: SendTransactionOptions) => Promise<void>;
167
+ }
168
+ export interface TransactionOptions extends SendTransactionOptions {
115
169
  /**
116
170
  * Chain ID
117
171
  *
@@ -160,6 +214,8 @@ export interface BaseTransactionOptions {
160
214
  * not set the blockchain will increase the payer's nonce.
161
215
  */
162
216
  payee?: string;
217
+ }
218
+ export interface ContractTransactionOptions extends TransactionOptions {
163
219
  /**
164
220
  * Only operation
165
221
  *
@@ -195,34 +251,10 @@ export interface BaseTransactionOptions {
195
251
  * true.
196
252
  */
197
253
  sendTransaction?: boolean;
198
- /**
199
- * Broadcast
200
- *
201
- * Boolean to define if the transaction should be broadcasted
202
- * to the different nodes in the network. By default it is true.
203
- *
204
- * Set it to false if you want to interact with a contract for
205
- * testing purposes and check the possible events triggered.
206
- */
207
- broadcast?: boolean;
208
- /**
209
- * Function to be called before sending a transaction to the
210
- * blockchain. It is useful to apply multisignatures to
211
- * the transaction
212
- */
213
- beforeSend?: (tx: TransactionJson, options?: SendTransactionOptions) => Promise<void>;
214
254
  }
215
- export interface TransactionOptions extends BaseTransactionOptions {
216
- /**
217
- * Send abis
218
- *
219
- * Boolean to define if the abis should be shared with
220
- * the signer so it will be able to decode the operations.
221
- * By default it is true.
222
- */
223
- sendAbis?: boolean;
255
+ export interface CallContractOptions extends ContractTransactionOptions {
224
256
  }
225
- export interface DeployOptions extends BaseTransactionOptions {
257
+ export interface DeployOptions extends ContractTransactionOptions {
226
258
  /**
227
259
  * ABI
228
260
  *
@@ -255,52 +287,6 @@ export interface DeployOptions extends BaseTransactionOptions {
255
287
  */
256
288
  authorizesUploadContract?: boolean;
257
289
  }
258
- export interface SendTransactionOptions {
259
- /**
260
- * Broadcast
261
- *
262
- * Boolean to define if the transaction should be broadcasted
263
- * to the different nodes in the network. By default it is true.
264
- *
265
- * Set it to false if you want to interact with a contract for
266
- * testing purposes and check the possible events triggered.
267
- */
268
- broadcast?: boolean;
269
- /**
270
- * Collection of Abis so that the receiver can parse the
271
- * operations in the transaction
272
- */
273
- abis?: Record<string, Abi>;
274
- /**
275
- * Function to be called before sending a transaction to the
276
- * blockchain. It is useful to apply multisignatures to
277
- * the transaction.
278
- *
279
- * @example
280
- * ```ts
281
- * const signer2 = Signer.fromSeed("signer2");
282
- * const signer3 = Signer.fromSeed("signer3");
283
- *
284
- * const addMoreSignatures = async (tx, opts) => {
285
- * await signer2.signTransaction(tx);
286
- * await signer3.signTransaction(tx);
287
- * };
288
- *
289
- * const { transaction } = await koin.transfer(
290
- * {
291
- * from: "16MT1VQFgsVxEfJrSGinrA5buiqBsN5ViJ",
292
- * to: "1Gvqdo9if6v6tFomEuTuMWP1D7H7U9yksb",
293
- * value: "1000000",
294
- * },
295
- * {
296
- * payer: signer2.getAddress(),
297
- * beforeSend: addMoreSignatures,
298
- * }
299
- * );
300
- * ```
301
- */
302
- beforeSend?: (tx: TransactionJson, options?: SendTransactionOptions) => Promise<void>;
303
- }
304
290
  export interface RecoverPublicKeyOptions {
305
291
  /**
306
292
  * Boolean to define if the public key should
package/lib/index.d.ts CHANGED
@@ -4,4 +4,5 @@ export * as interfaces from "./interface";
4
4
  export * from "./Contract";
5
5
  export * from "./Signer";
6
6
  export * from "./Provider";
7
+ export * from "./Transaction";
7
8
  export * from "./Serializer";
package/lib/index.js CHANGED
@@ -34,5 +34,6 @@ exports.interfaces = __importStar(require("./interface"));
34
34
  __exportStar(require("./Contract"), exports);
35
35
  __exportStar(require("./Signer"), exports);
36
36
  __exportStar(require("./Provider"), exports);
37
+ __exportStar(require("./Transaction"), exports);
37
38
  __exportStar(require("./Serializer"), exports);
38
39
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wEAAwE;AACxE,iCAAiC;AACjC,sDAAsC;AACtC,0DAA0C;AAC1C,6CAA2B;AAC3B,2CAAyB;AACzB,6CAA2B;AAC3B,+CAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wEAAwE;AACxE,iCAAiC;AACjC,sDAAsC;AACtC,0DAA0C;AAC1C,6CAA2B;AAC3B,2CAAyB;AACzB,6CAA2B;AAC3B,gDAA8B;AAC9B,+CAA6B"}
package/lib/index2.js CHANGED
@@ -28,10 +28,12 @@ const utils = __importStar(require("./utils"));
28
28
  const Contract_1 = require("./Contract");
29
29
  const Signer_1 = require("./Signer");
30
30
  const Provider_1 = require("./Provider");
31
+ const Transaction_1 = require("./Transaction");
31
32
  const Serializer_1 = require("./Serializer");
32
33
  window.utils = utils;
33
34
  window.Contract = Contract_1.Contract;
34
35
  window.Signer = Signer_1.Signer;
35
36
  window.Provider = Provider_1.Provider;
37
+ window.Transaction = Transaction_1.Transaction;
36
38
  window.Serializer = Serializer_1.Serializer;
37
39
  //# sourceMappingURL=index2.js.map
package/lib/index2.js.map CHANGED
@@ -1 +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"}
1
+ {"version":3,"file":"index2.js","sourceRoot":"","sources":["../src/index2.ts"],"names":[],"mappings":";AAAA,wEAAwE;;;;;;;;;;;;;;;;;;;;;;;;;AAExE,+CAAiC;AACjC,yCAAsC;AACtC,qCAAkC;AAClC,yCAAsC;AACtC,+CAA4C;AAC5C,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,WAAW,GAAG,yBAAW,CAAC;AACjC,MAAM,CAAC,UAAU,GAAG,uBAAU,CAAC"}
@@ -111,7 +111,61 @@ export interface DecodedOperationJson {
111
111
  /** Arguments decoded. See [[Abi]] */
112
112
  args?: Record<string, unknown>;
113
113
  }
114
- export interface BaseTransactionOptions {
114
+ export interface SendTransactionOptions {
115
+ /**
116
+ * Broadcast
117
+ *
118
+ * Boolean to define if the transaction should be broadcasted
119
+ * to the different nodes in the network. By default it is true.
120
+ *
121
+ * Set it to false if you want to interact with a contract for
122
+ * testing purposes and check the possible events triggered.
123
+ */
124
+ broadcast?: boolean;
125
+ /**
126
+ * Collection of Abis so that the receiver can parse the
127
+ * operations in the transaction
128
+ */
129
+ abis?: Record<string, Abi>;
130
+ /**
131
+ * Send abis
132
+ *
133
+ * Boolean to define if the abis should be shared with
134
+ * the signer so it will be able to decode the operations.
135
+ * By default it is true.
136
+ */
137
+ sendAbis?: boolean;
138
+ /**
139
+ * Function to be called before sending a transaction to the
140
+ * blockchain. It is useful to apply multisignatures to
141
+ * the transaction.
142
+ *
143
+ * @example
144
+ * ```ts
145
+ * const signer2 = Signer.fromSeed("signer2");
146
+ * const signer3 = Signer.fromSeed("signer3");
147
+ *
148
+ * const addMoreSignatures = async (tx, opts) => {
149
+ * await signer2.signTransaction(tx);
150
+ * await signer3.signTransaction(tx);
151
+ * };
152
+ *
153
+ * const { transaction } = await koin.transfer(
154
+ * {
155
+ * from: "16MT1VQFgsVxEfJrSGinrA5buiqBsN5ViJ",
156
+ * to: "1Gvqdo9if6v6tFomEuTuMWP1D7H7U9yksb",
157
+ * value: "1000000",
158
+ * },
159
+ * {
160
+ * payer: signer2.getAddress(),
161
+ * beforeSend: addMoreSignatures,
162
+ * }
163
+ * );
164
+ * ```
165
+ */
166
+ beforeSend?: (tx: TransactionJson, options?: SendTransactionOptions) => Promise<void>;
167
+ }
168
+ export interface TransactionOptions extends SendTransactionOptions {
115
169
  /**
116
170
  * Chain ID
117
171
  *
@@ -160,6 +214,8 @@ export interface BaseTransactionOptions {
160
214
  * not set the blockchain will increase the payer's nonce.
161
215
  */
162
216
  payee?: string;
217
+ }
218
+ export interface ContractTransactionOptions extends TransactionOptions {
163
219
  /**
164
220
  * Only operation
165
221
  *
@@ -195,34 +251,10 @@ export interface BaseTransactionOptions {
195
251
  * true.
196
252
  */
197
253
  sendTransaction?: boolean;
198
- /**
199
- * Broadcast
200
- *
201
- * Boolean to define if the transaction should be broadcasted
202
- * to the different nodes in the network. By default it is true.
203
- *
204
- * Set it to false if you want to interact with a contract for
205
- * testing purposes and check the possible events triggered.
206
- */
207
- broadcast?: boolean;
208
- /**
209
- * Function to be called before sending a transaction to the
210
- * blockchain. It is useful to apply multisignatures to
211
- * the transaction
212
- */
213
- beforeSend?: (tx: TransactionJson, options?: SendTransactionOptions) => Promise<void>;
214
254
  }
215
- export interface TransactionOptions extends BaseTransactionOptions {
216
- /**
217
- * Send abis
218
- *
219
- * Boolean to define if the abis should be shared with
220
- * the signer so it will be able to decode the operations.
221
- * By default it is true.
222
- */
223
- sendAbis?: boolean;
255
+ export interface CallContractOptions extends ContractTransactionOptions {
224
256
  }
225
- export interface DeployOptions extends BaseTransactionOptions {
257
+ export interface DeployOptions extends ContractTransactionOptions {
226
258
  /**
227
259
  * ABI
228
260
  *
@@ -255,52 +287,6 @@ export interface DeployOptions extends BaseTransactionOptions {
255
287
  */
256
288
  authorizesUploadContract?: boolean;
257
289
  }
258
- export interface SendTransactionOptions {
259
- /**
260
- * Broadcast
261
- *
262
- * Boolean to define if the transaction should be broadcasted
263
- * to the different nodes in the network. By default it is true.
264
- *
265
- * Set it to false if you want to interact with a contract for
266
- * testing purposes and check the possible events triggered.
267
- */
268
- broadcast?: boolean;
269
- /**
270
- * Collection of Abis so that the receiver can parse the
271
- * operations in the transaction
272
- */
273
- abis?: Record<string, Abi>;
274
- /**
275
- * Function to be called before sending a transaction to the
276
- * blockchain. It is useful to apply multisignatures to
277
- * the transaction.
278
- *
279
- * @example
280
- * ```ts
281
- * const signer2 = Signer.fromSeed("signer2");
282
- * const signer3 = Signer.fromSeed("signer3");
283
- *
284
- * const addMoreSignatures = async (tx, opts) => {
285
- * await signer2.signTransaction(tx);
286
- * await signer3.signTransaction(tx);
287
- * };
288
- *
289
- * const { transaction } = await koin.transfer(
290
- * {
291
- * from: "16MT1VQFgsVxEfJrSGinrA5buiqBsN5ViJ",
292
- * to: "1Gvqdo9if6v6tFomEuTuMWP1D7H7U9yksb",
293
- * value: "1000000",
294
- * },
295
- * {
296
- * payer: signer2.getAddress(),
297
- * beforeSend: addMoreSignatures,
298
- * }
299
- * );
300
- * ```
301
- */
302
- beforeSend?: (tx: TransactionJson, options?: SendTransactionOptions) => Promise<void>;
303
- }
304
290
  export interface RecoverPublicKeyOptions {
305
291
  /**
306
292
  * Boolean to define if the public key should
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koilib",
3
- "version": "5.3.1",
3
+ "version": "5.4.0",
4
4
  "description": "JS Koinos Library",
5
5
  "author": "Julian Gonzalez",
6
6
  "repository": {