How to use the js-xdr.config function in js-xdr

To help you get started, we’ve selected a few js-xdr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github spacemeshos / smapp / app / infra / cryptoService / cryptoService.js View on Github external
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
github stellar / js-stellar-base / src / generated / stellar-xdr_generated.js View on Github external
// 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 ============================================================

js-xdr

Read/write XDR encoded data structures (RFC 4506)

Apache-2.0
Latest version published 4 months ago

Package Health Score

56 / 100
Full package analysis

Similar packages