-
Notifications
You must be signed in to change notification settings - Fork 256
Closed
Description
The current implementation of SignTransaction
signs the transaction.encode()
, which is the borsh serialized version of the transaction
:
near-api-js/packages/client/src/transactions/sign_and_send.ts
Lines 18 to 25 in 9cb7e89
const encodedTx = transaction.encode(); | |
const signedTransaction = new SignedTransaction({ | |
transaction, | |
signature: new Signature({ | |
keyType: transaction.publicKey.keyType, | |
data: await signer.signMessage(encodedTx), | |
}), | |
}); |
In reality, we need to sign the sha256
hash of the borsh
serialized transaction:
const encodedTx = new Uint8Array(sha256.sha256.array(transaction.encode()));
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Shipped 🚀