@funded-labs/plug-controller
Version:
Internet Computer Plug wallet's controller
19 lines (18 loc) • 1.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tokens_1 = require("../../../constants/tokens");
exports.default = (storage) => (Object.assign(Object.assign({}, storage), { wallets: storage.wallets.map(wallet => (Object.assign(Object.assign({}, wallet), { assets: wallet.assets.reduce((acum, asset) => {
var _a, _b, _c;
return (Object.assign(Object.assign({}, acum), { [asset.canisterId]: {
amount: '0',
token: {
name: asset.name,
symbol: asset.symbol,
canisterId: asset.canisterId,
standard: ((_a = wallet.registeredTokens[asset.canisterId]) === null || _a === void 0 ? void 0 : _a.standard.toUpperCase()) || tokens_1.TOKENS[asset.symbol].standard,
decimals: ((_b = wallet.registeredTokens[asset.canisterId]) === null || _b === void 0 ? void 0 : _b.decimals) ||
tokens_1.TOKENS[asset.symbol].decimals,
color: (_c = wallet.registeredTokens[asset.canisterId]) === null || _c === void 0 ? void 0 : _c.color,
},
} }));
}, {}) }))) }));