How to use the stellar-base.Memo function in stellar-base

To help you get started, we’ve selected a few stellar-base 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 stellar / js-stellar-sdk / lib / index.js View on Github external
_defaults(exports, _interopRequireWildcard(require("./errors")));

exports.Server = require("./server").Server;

// expose classes from stellar-base

var _stellarBase = require("stellar-base");

exports.Account = _stellarBase.Account;
exports.Transaction = _stellarBase.Transaction;
exports.TransactionBuilder = _stellarBase.TransactionBuilder;
exports.Asset = _stellarBase.Asset;
exports.Operation = _stellarBase.Operation;
exports.Keypair = _stellarBase.Keypair;
exports.Memo = _stellarBase.Memo;
exports.xdr = _stellarBase.xdr;
github astroband / astrograph / _experimental / model / transaction.ts View on Github external
this.id = data.txid;
    this.ledgerSeq = data.ledgerseq;
    this.index = data.txindex;

    this.body = data.txbody;

    this.result = data.txresult;
    this.meta = data.txmeta;
    this.feeMeta = data.txfeemeta;

    this.envelopeXDR = stellar.xdr.TransactionEnvelope.fromXDR(Buffer.from(this.body, "base64"));
    this.resultXDR = stellar.xdr.TransactionResultPair.fromXDR(Buffer.from(this.result, "base64"));

    const txBody = this.envelopeXDR.tx();

    const memo = stellar.Memo.fromXDRObject(txBody.memo());

    if (memo.value) {
      this.memo = memo;
    }

    const result = this.resultXDR.result();

    this.feeAmount = txBody.fee().toString();
    this.feeCharged = result.feeCharged().toString();
    this.resultCode = result.result().switch().value;
    this.success = this.resultCode === stellar.xdr.TransactionResultCode.txSuccess().value;

    this.sourceAccount = publicKeyFromBuffer(txBody.sourceAccount().value());

    const timeBounds = txBody.timeBounds();
github astroband / astrograph / src / model / factories / transaction_with_xdr_factory.ts View on Github external
public static fromDb(row: ITransactionTableRow): TransactionWithXDR {
    const bodyXDR = stellar.xdr.TransactionEnvelope.fromXDR(row.txbody, "base64");
    const resultXDR = stellar.xdr.TransactionResultPair.fromXDR(row.txresult, "base64");
    const metaXDR = stellar.xdr.TransactionMeta.fromXDR(row.txmeta, "base64");
    const feeMetaXDR = stellar.xdr.OperationMeta.fromXDR(row.txfeemeta, "base64");

    const body = bodyXDR.tx();
    const result = resultXDR.result();

    const memo = stellar.Memo.fromXDRObject(body.memo());

    const timeBounds = this.parseTimeBounds(body.timeBounds());

    const resultCode = result.result().switch().value;
    const success = resultCode === stellar.xdr.TransactionResultCode.txSuccess().value;
    const feeAmount = body.fee().toString();
    const feeCharged = result.feeCharged().toString();
    const sourceAccount = publicKeyFromBuffer(body.sourceAccount().value());

    const data: ITransactionWithXDR = {
      id: row.txid,
      index: row.txindex,
      ledgerSeq: row.ledgerseq,
      body: row.txbody,
      bodyXDR,
      result: row.txresult,