UNPKG

@ledgerhq/live-common

Version:
120 lines 3.92 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createFixtureCryptoCurrency = createFixtureCryptoCurrency; exports.createFixtureTokenAccount = createFixtureTokenAccount; exports.createFixtureAccount = createFixtureAccount; const bignumber_js_1 = __importDefault(require("bignumber.js")); const cryptoassets_1 = require("@ledgerhq/cryptoassets"); function createFixtureCryptoCurrency(family) { return { type: "CryptoCurrency", id: "testCoinId", coinType: 8008, name: "MyCoin", managerAppName: "MyCoin", ticker: "MYC", scheme: "mycoin", color: "#ff0000", family, units: [ { name: "MYC", code: "MYC", magnitude: 8, }, { name: "SmallestUnit", code: "SMALLESTUNIT", magnitude: 0, }, ], explorerViews: [ { address: "https://mycoinexplorer.com/account/$address", tx: "https://mycoinexplorer.com/transaction/$hash", token: "https://mycoinexplorer.com/token/$contractAddress/?a=$address", }, ], }; } const defaultEthCryptoFamily = cryptoassets_1.cryptocurrenciesById["ethereum"]; const defaultERC20USDTToken = { type: "TokenCurrency", id: "ethereum/erc20/usd_tether__erc20_", name: "Tether USD (ERC-20)", ticker: "USDT", units: [{ name: "Tether USD", code: "USDT", magnitude: 6 }], contractAddress: "0xdac17f958d2ee523a2206206994597c13d831ec7", parentCurrency: defaultEthCryptoFamily, tokenType: "erc20", }; function createFixtureTokenAccount(id = "00", token = defaultERC20USDTToken) { return { type: "TokenAccount", id: `js:2:ethereum:0x${id}:+ethereum%2Ferc20%2Fusd_tether__erc20_`, parentId: `js:2:ethereum:0x0${id}:`, token, balance: new bignumber_js_1.default("51281813126095913"), spendableBalance: new bignumber_js_1.default("51281813126095913"), creationDate: new Date(), operationsCount: 0, operations: [], pendingOperations: [], balanceHistoryCache: { HOUR: { balances: [], latestDate: undefined, }, DAY: { balances: [], latestDate: undefined, }, WEEK: { balances: [], latestDate: undefined, }, }, swapHistory: [], }; } function createFixtureAccount(id = "00", currency = defaultEthCryptoFamily) { return { type: "Account", id: `js:2:${currency.id}:0x0${id}:`, seedIdentifier: "0x01", derivationMode: "ethM", index: 0, freshAddress: "0x01", freshAddressPath: "44'/60'/0'/0/0", used: false, balance: new bignumber_js_1.default("51281813126095913"), spendableBalance: new bignumber_js_1.default("51281813126095913"), creationDate: new Date(), blockHeight: 8168983, currency, xpub: currency.family === "bitcoin" ? "testxpub" : undefined, operationsCount: 0, operations: [], pendingOperations: [], lastSyncDate: new Date(), balanceHistoryCache: { HOUR: { balances: [], latestDate: undefined, }, DAY: { balances: [], latestDate: undefined, }, WEEK: { balances: [], latestDate: undefined, }, }, swapHistory: [], }; } //# sourceMappingURL=cryptoCurrencies.js.map