Closed sin5 closed 6 years ago
@hyperbolist any thoughts on this? thanks
I second that. Same issue RippledError: invalidTransaction
.
The sample code was wrong. SignTransaction argument required SigningPubKey . "JSON.SigningPubKey = address.publicKey.toUpperCase ();" should be executed earlier than the signTransaction method .
"xrp.signTransaction" is correct. I apologize to you.
@sin5 Do you know how to construct xrp multi sign transaction by ledger?
@qiluge Sorry, I don't know . This document may be helpful . "Set Up Multi-Signing"
Hi
I signed with LedgerNanoS with the following code. But, the result is "[RippledError (invalidTransaction)]".
I think that the result of "xrp.signTransaction" is incorrect. Or is the test code incorrect?
` 'use strict'; import TransportNodeHid from "@ledgerhq/hw-transport-node-hid/lib/TransportNodeHid"; import Xrp from "@ledgerhq/hw-app-xrp";
import API from 'ripple-lib'; import Bin from 'ripple-binary-codec';
const txTest = async function(){ const xrp = new Xrp.await TransportNodeHid.create()); const api = new API.RippleAPI({ //server: 'wss://s1.ripple.com' // Public rippled server server: 'wss://s.altnet.rippletest.net:51233' // TEST rippled server }); const address = await xrp.getAddress("44'/144'/0'/0/0"); const _ = await api.connect(); const json = JSON.parse((await api.preparePayment(address.address,{ source: { address: address.address, amount: { currency: "XRP", value: "1000" } }, destination: { address: "rGr3jiLoXhtUNQYabnuFKkU1imRE2qZ3mk", minAmount: { currency: "XRP", value: "1000" }, tag: 1 } },{ maxLedgerVersionOffset: 12, fee: "12" })).txJSON); console.info(json); const rawTx = Bin.encode(json); console.info(rawTx); let txJSON = Bin.decode(rawTx); txJSON.TxnSignature = (await xrp.signTransaction("44'/144'/0'/0/0", rawTx, false)).toUpperCase(); txJSON.SigningPubKey = address.publicKey.toUpperCase(); console.info(txJSON);
const txHEX = Bin.encode(txJSON); console.info(txHEX);
await api.submit(txHEX).then(info => { console.error(info); return api.disconnect(); }).catch(e => console.error(e));
};
txTest(); `