UNPKG

airgap-coin-lib

Version:

The airgap-coin-lib is a protocol agnostic library to prepare, sign and broadcast cryptocurrency transactions.

23 lines 737 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var bignumber_1 = require("../../dependencies/src/bignumber.js-9.0.0/bignumber"); function toBuffer(rlpArray) { if (Array.isArray(rlpArray)) { return rlpArray.map(toBuffer); } if (typeof rlpArray === 'number') { return Buffer.from(rlpArray.toString()); } if (typeof rlpArray === 'boolean') { return Buffer.from(rlpArray ? '1' : '0'); } if (bignumber_1.default.isBigNumber(rlpArray)) { return Buffer.from(rlpArray.toFixed()); } if (Buffer.isBuffer(rlpArray)) { return rlpArray; } return Buffer.from(rlpArray); } exports.toBuffer = toBuffer; //# sourceMappingURL=toBuffer.js.map