@leofcoin/lib 1.2.21 → 1.2.23

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
@@ -1,5 +1,4 @@
1
1
  import { ContractMessage, TransactionMessage } from '@leofcoin/messages';
2
- import { CodecHash } from '@leofcoin/codec-format-interface';
3
2
  import { validators as validators$1, contractFactory as contractFactory$1 } from '@leofcoin/addresses';
4
3
  export { default as nodeConfig } from './node-config.js';
5
4
  import { parseUnits, formatUnits } from '@leofcoin/utils';
@@ -52,7 +51,10 @@ const calculateReward = (validators, fees) => {
52
51
  }, []);
53
52
  return validators;
54
53
  };
55
- const createTransactionHash = async (transaction) => (await new CodecHash(transaction, { name: 'transaction-message' })).digest;
54
+ const createTransactionHash = async (transaction) => {
55
+ transaction = await (await new TransactionMessage(transaction)).hash();
56
+ return transaction.peernetHash.digest;
57
+ };
56
58
  const signTransaction = async (transaction, wallet) => {
57
59
  const signature = await wallet.sign(await createTransactionHash(transaction));
58
60
  const signedTransaction = { ...transaction, signature };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/lib",
3
- "version": "1.2.21",
3
+ "version": "1.2.23",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "typings": "./exports/typings/index.d.ts",
package/src/index.ts CHANGED
@@ -72,8 +72,11 @@ export const calculateReward = (validators, fees): [] => {
72
72
  return validators
73
73
  }
74
74
 
75
- export const createTransactionHash = async (transaction: transaction): Promise<Uint8Array> =>
76
- (await new CodecHash(transaction, {name: 'transaction-message'})).digest
75
+ export const createTransactionHash = async (transaction: transaction): Promise<Uint8Array> => {
76
+ transaction = await (await new TransactionMessage(transaction)).hash()
77
+ return transaction.peernetHash.digest
78
+ }
79
+
77
80
 
78
81
  export const signTransaction = async (transaction: transaction, wallet: signable): Promise<signedTransaction> => {
79
82
  const signature = await wallet.sign(await createTransactionHash(transaction))