-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
decodedTransaction.publicKey.toString() returns [object Object] #1381
Comments
Some information is being lost on |
Thank you for the bug report, @kujtimprenku ! Really appreciate the example code and call out on the missing Unfortunately I think this has always been the behavior here. In any case, this is only a limitation of // providers/src/schema.ts
export function decodeTransaction(bytes: Uint8Array) {
const decoded = new Transaction(deserialize(SCHEMA.Transaction, bytes));
const { publicKey: { ed25519Key, secp256k1Key } } = decoded;
decoded.publicKey = new PublicKey({
keyType: ed25519Key ? KeyType.ED25519 : KeyType.SECP256K1,
data: ed25519Key ? ed25519Key.data || secp256k1Key.data,
});
return decoded;
} |
Actually in versions before moving to I pushed a new branch in the example code above to demo it: I also deployed this branch to gh-pages of the example: In the past this code used to work properly now because of the missing enum it's broken |
But as you mentioned maybe the |
Thanks for the clarification, I did check previous behavior but I only went back as far as version 3 lol That makes sense about |
I agree, the proposed fix would work just fine without digging through borsh-js. |
Prerequisites
near-api-js
.Description
Unable get convert the public key to string from a decoded transaction.
Reproducible demo
https://github.com/kujtimprenku/naj-publickey
Steps to reproduce
Live demo: https://kujtimprenku.github.io/naj-publickey/
Expected behavior
The
publicKey.toString()
should return the string value for the public key:ed25519:xxxxxxxxxxx
.Actual behavior
It returns
'[object Object]'
Your environment
Self-service
The text was updated successfully, but these errors were encountered: