How to use the @bitgo/account-lib.Trx function in @bitgo/account-lib

To help you get started, we’ve selected a few @bitgo/account-lib 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 BitGo / BitGoJS / modules / core / src / v2 / coins / trx.ts View on Github external
signMessage(key: KeyPair, message: string | Buffer): Buffer {
    const toSign = this.toHexString(message);

    let prv = key.prv;
    if (this.isValidXprv(prv)) {
      prv = HDNode.fromBase58(prv)
        .getKey()
        .getPrivateKeyBuffer();
    }

    let sig = bitgoAccountLib.Trx.Utils.signString(toSign, prv, true);

    // remove the preceding 0x
    sig = sig.replace(/^0x/, '');

    return Buffer.from(sig, 'hex');
  }
github BitGo / BitGoJS / modules / core / src / v2 / coins / trx.ts View on Github external
compressedPubToHexAddress(pub: string): string {
    const byteArrayAddr = bitgoAccountLib.Trx.Utils.getByteArrayFromHexAddress(pub);
    const rawAddress = bitgoAccountLib.Trx.Utils.getRawAddressFromPubKey(byteArrayAddr);
    return bitgoAccountLib.Trx.Utils.getHexAddressFromByteArray(rawAddress);
  }

@bitgo/account-lib

BitGo's account library functions

Apache-2.0
Latest version published 3 days ago

Package Health Score

78 / 100
Full package analysis

Similar packages