UNPKG

@okxweb3/coin-stellar

Version:

@ok/coin-stellar is a Stellar SDK for building Web3 wallets and applications. It supports Stellar and PI blockchains, enabling private key management, address generation, transaction signing, trustline creation, and asset transfers

44 lines 2.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.scValToBigInt = exports.XdrLargeInt = exports.ScInt = exports.Int256 = exports.Int128 = exports.Uint256 = exports.Uint128 = void 0; const xdr_large_int_1 = require("./xdr_large_int"); Object.defineProperty(exports, "XdrLargeInt", { enumerable: true, get: function () { return xdr_large_int_1.XdrLargeInt; } }); var uint128_1 = require("./uint128"); Object.defineProperty(exports, "Uint128", { enumerable: true, get: function () { return uint128_1.Uint128; } }); var uint256_1 = require("./uint256"); Object.defineProperty(exports, "Uint256", { enumerable: true, get: function () { return uint256_1.Uint256; } }); var int128_1 = require("./int128"); Object.defineProperty(exports, "Int128", { enumerable: true, get: function () { return int128_1.Int128; } }); var int256_1 = require("./int256"); Object.defineProperty(exports, "Int256", { enumerable: true, get: function () { return int256_1.Int256; } }); var sc_int_1 = require("./sc_int"); Object.defineProperty(exports, "ScInt", { enumerable: true, get: function () { return sc_int_1.ScInt; } }); function scValToBigInt(scv) { const scIntType = xdr_large_int_1.XdrLargeInt.getType(scv.switch().name); switch (scv.switch().name) { case 'scvU32': case 'scvI32': return BigInt(scv.value()); case 'scvU64': case 'scvI64': return new xdr_large_int_1.XdrLargeInt(scIntType, scv.value()).toBigInt(); case 'scvU128': case 'scvI128': return new xdr_large_int_1.XdrLargeInt(scIntType, [ scv.value().lo(), scv.value().hi() ]).toBigInt(); case 'scvU256': case 'scvI256': return new xdr_large_int_1.XdrLargeInt(scIntType, [ scv.value().loLo(), scv.value().loHi(), scv.value().hiLo(), scv.value().hiHi() ]).toBigInt(); default: throw TypeError(`expected integer type, got ${scv.switch()}`); } } exports.scValToBigInt = scValToBigInt; //# sourceMappingURL=index.js.map