Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function signTransaction({
account: { freshAddress, freshAddressPath, id: accountId, balance },
transport,
transaction,
coreTransaction,
onDeviceSignatureRequested,
onDeviceSignatureGranted
}) {
const hwApp = new Xrp(transport);
const serialized = await coreTransaction.serialize();
onDeviceSignatureRequested();
const result = await hwApp.signTransaction(freshAddressPath, serialized);
onDeviceSignatureGranted();
await coreTransaction.setDERSignature(result);
const signature = await coreTransaction.serialize();
// build optimistic update
const txHash = ""; // will be resolved at broadcast() time
const senders = [freshAddress];
const receiver = await coreTransaction.getReceiver();
const recipients = [await receiver.toBase58()];
export default async (
transport: Transport<*>,
currency: CryptoCurrency,
path: string,
{ verify = false }: *,
) => {
const xrp = new Xrp(transport)
const { address, publicKey } = await xrp.getAddress(path, verify)
return { path, address, publicKey }
}
export default async (
currency: CryptoCurrency,
transport: Transport<*>,
path: string,
txArg: Object
) => {
const tx = { ...txArg };
const xrp = new Xrp(transport);
const { publicKey } = await xrp.getAddress(path);
tx.SigningPubKey = publicKey.toUpperCase();
const rawTxHex = BinaryCodec.encode(tx).toUpperCase();
tx.TxnSignature = (await xrp.signTransaction(path, rawTxHex)).toUpperCase();
return BinaryCodec.encode(tx).toUpperCase();
};
const resolver: Resolver = async (
transport,
{ path, verify, askChainCode }
) => {
const xrp = new Xrp(transport);
const { address, publicKey, chainCode } = await xrp.getAddress(
path,
verify,
askChainCode || false
);
return { path, address, publicKey, chainCode };
};