koilib 5.0.0 → 5.1.1

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.
@@ -185,6 +185,12 @@ export interface BaseTransactionOptions {
185
185
  * testing purposes and check the possible events triggered.
186
186
  */
187
187
  broadcast?: boolean;
188
+ /**
189
+ * Function to be called before sending a transaction to the
190
+ * blockchain. It is useful to apply multisignatures to
191
+ * the transaction
192
+ */
193
+ beforeSend?: (tx: TransactionJson) => Promise<void>;
188
194
  }
189
195
  export interface TransactionOptions extends BaseTransactionOptions {
190
196
  /**
@@ -229,6 +235,52 @@ export interface DeployOptions extends BaseTransactionOptions {
229
235
  */
230
236
  authorizesUploadContract?: boolean;
231
237
  }
238
+ export interface SendTransactionOptions {
239
+ /**
240
+ * Broadcast
241
+ *
242
+ * Boolean to define if the transaction should be broadcasted
243
+ * to the different nodes in the network. By default it is true.
244
+ *
245
+ * Set it to false if you want to interact with a contract for
246
+ * testing purposes and check the possible events triggered.
247
+ */
248
+ broadcast?: boolean;
249
+ /**
250
+ * Collection of Abis so that the receiver can parse the
251
+ * operations in the transaction
252
+ */
253
+ abis?: Record<string, Abi>;
254
+ /**
255
+ * Function to be called before sending a transaction to the
256
+ * blockchain. It is useful to apply multisignatures to
257
+ * the transaction.
258
+ *
259
+ * @example
260
+ * ```ts
261
+ * const signer2 = Signer.fromSeed("signer2");
262
+ * const signer3 = Signer.fromSeed("signer3");
263
+ *
264
+ * const addMoreSignatures = async (tx) => {
265
+ * await signer2.signTransaction(tx);
266
+ * await signer3.signTransaction(tx);
267
+ * };
268
+ *
269
+ * const { transaction } = await koin.transfer(
270
+ * {
271
+ * from: "16MT1VQFgsVxEfJrSGinrA5buiqBsN5ViJ",
272
+ * to: "1Gvqdo9if6v6tFomEuTuMWP1D7H7U9yksb",
273
+ * value: "1000000",
274
+ * },
275
+ * {
276
+ * payer: signer2.getAddress(),
277
+ * beforeSend: addMoreSignatures,
278
+ * }
279
+ * );
280
+ * ```
281
+ */
282
+ beforeSend?: (tx: TransactionJson) => Promise<void>;
283
+ }
232
284
  export interface RecoverPublicKeyOptions {
233
285
  /**
234
286
  * Boolean to define if the public key should
@@ -263,7 +315,10 @@ export interface RecoverPublicKeyOptions {
263
315
  *
264
316
  * @param timeout - Timeout in milliseconds. By default it is 15000
265
317
  */
266
- export declare type WaitFunction = (type?: "byBlock" | "byTransactionId", timeout?: number) => Promise<string | number>;
318
+ export declare type WaitFunction = (type?: "byBlock" | "byTransactionId", timeout?: number) => Promise<{
319
+ blockId: string;
320
+ blockNumber?: number;
321
+ }>;
267
322
  export interface GenesisDataEntryEncoded {
268
323
  space: {
269
324
  system?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koilib",
3
- "version": "5.0.0",
3
+ "version": "5.1.1",
4
4
  "description": "JS Koinos Library",
5
5
  "author": "Julian Gonzalez",
6
6
  "repository": {