@leofcoin/lib 1.2.12 → 1.2.13

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.
package/exports/index.js CHANGED
@@ -59,8 +59,8 @@ const calculateReward = (validators, fees) => {
59
59
  return validators;
60
60
  };
61
61
  const createTransactionHash = async (transaction) => (await new CodecHash(transaction, { name: 'transaction-message' })).digest;
62
- const signTransaction = async (wallet, transaction) => {
63
- const signature = await wallet.sign(transaction);
62
+ const signTransaction = async (transaction, wallet) => {
63
+ const signature = await wallet.sign(await createTransactionHash(transaction));
64
64
  const signedTransaction = { ...transaction, signature };
65
65
  return signedTransaction;
66
66
  };
@@ -26,5 +26,5 @@ export declare const createContractMessage: (creator: any, contract: any, constr
26
26
  export declare const calculateFee: (transaction: any) => Promise<string | 0>;
27
27
  export declare const calculateTransactionFee: (transaction: any) => Promise<string | 0>;
28
28
  export declare const calculateReward: (validators: any, fees: any) => [];
29
- export declare const createTransactionHash: (transaction: any) => Promise<any>;
30
- export declare const signTransaction: (wallet: signable, transaction: transaction) => Promise<signedTransaction>;
29
+ export declare const createTransactionHash: (transaction: transaction) => Promise<Uint8Array>;
30
+ export declare const signTransaction: (transaction: transaction, wallet: signable) => Promise<signedTransaction>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/lib",
3
- "version": "1.2.12",
3
+ "version": "1.2.13",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "typings": "./exports/typings/index.d.ts",
package/src/index.ts CHANGED
@@ -77,11 +77,11 @@ export const calculateReward = (validators, fees): [] => {
77
77
  return validators
78
78
  }
79
79
 
80
- export const createTransactionHash = async (transaction) =>
80
+ export const createTransactionHash = async (transaction: transaction): Promise<Uint8Array> =>
81
81
  (await new CodecHash(transaction, {name: 'transaction-message'})).digest
82
82
 
83
- export const signTransaction = async (wallet: signable, transaction: transaction): Promise<signedTransaction> => {
84
- const signature = await wallet.sign(transaction)
83
+ export const signTransaction = async (transaction: transaction, wallet: signable): Promise<signedTransaction> => {
84
+ const signature = await wallet.sign(await createTransactionHash(transaction))
85
85
  const signedTransaction = {...transaction, signature}
86
86
  return signedTransaction
87
87
  }