Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
signTransaction = ({ accountNonce, recipient, price, amount, secretKey }: { accountNonce: number, recipient: string, price: number, amount: number, secretKey: string }) => {
const sk = fromHexString(secretKey);
const types = xdr.config((xdr1) => {
xdr1.struct('InnerSerializableSignedTransaction', [
['AccountNonce', xdr1.uhyper()],
['Recipient', xdr1.opaque(20)],
['GasLimit', xdr1.uhyper()],
['Price', xdr1.uhyper()],
['Amount', xdr1.uhyper()]
]);
xdr1.struct('SerializableSignedTransaction', [
['InnerSerializableSignedTransaction', xdr1.lookup('InnerSerializableSignedTransaction')],
['Signature', xdr1.opaque(64)]
]);
});
const message = new types.InnerSerializableSignedTransaction({
AccountNonce: xdr.UnsignedHyper.fromString(accountNonce),
Recipient: fromHexString(recipient).slice(12),
GasLimit: xdr.UnsignedHyper.fromString('5'), // TODO: change to real number passed from user selection
// Automatically generated on 2019-10-02T15:45:16-07:00
// DO NOT EDIT or your changes may be overwritten
/* jshint maxstatements:2147483647 */
/* jshint esnext:true */
import * as XDR from 'js-xdr';
var types = XDR.config(xdr => {
// === xdr source ============================================================
//
// typedef PublicKey AccountID;
//
// ===========================================================================
xdr.typedef("AccountId", xdr.lookup("PublicKey"));
// === xdr source ============================================================
//
// typedef opaque Thresholds[4];
//
// ===========================================================================
xdr.typedef("Thresholds", xdr.opaque(4));
// === xdr source ============================================================