How to use the js-xdr.VarArray 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 astroband / astrograph / src / orm / entities / account.ts View on Github external
from: (value: string | null) => {
        if (!value) {
          return null;
        }
        const signersArray = new VarArray(xdr.Signer).fromXDR(value, "base64");
        return signersArray.map((signerXDR: any) => SignerFactory.fromXDR(signerXDR));
      },
      // we don't actually need `to` transform,
github astroband / astrograph / src / model / factories / account_factory.ts View on Github external
public static fromDb(row: IAccountTableRow): Account {
    const data: IAccount = {
      id: row.accountid,
      balance: row.balance,
      sequenceNumber: row.seqnum,
      numSubentries: row.numsubentries,
      inflationDestination: row.inflationdest,
      homeDomain: row.homedomain,
      lastModified: row.lastmodified,
      thresholds: AccountThresholdsFactory.fromValue(row.thresholds),
      flags: AccountFlagsFactory.fromValue(row.flags)
    };

    if (row.signers) {
      const signersArray = new VarArray(xdr.Signer).fromXDR(row.signers, "base64");
      data.signers = signersArray.map((signerXDR: any) => SignerFactory.fromXDR(signerXDR, row.accountid));
    }

    return new Account(data);
  }
}

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