dotbit
Version:
A complete .bit SDK and utilities in TypeScript
34 lines • 1.28 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.mapSymbolToCoinType = exports.mapCoinTypeToSymbol = void 0;
const coinType2Symbol_json_1 = __importDefault(require("./coinType2Symbol.json"));
function mapCoinTypeToSymbol(coinType) {
if (coinType === null || coinType === void 0 ? void 0 : coinType.match(/^\d+$/)) {
return (coinType2Symbol_json_1.default[coinType] || coinType).toUpperCase();
}
return coinType === null || coinType === void 0 ? void 0 : coinType.toUpperCase();
}
exports.mapCoinTypeToSymbol = mapCoinTypeToSymbol;
function mapSymbolToCoinType(chain) {
const customMapper = {
POLYGON: '966',
BSC: '9006'
};
if (chain) {
chain = chain.toUpperCase();
if (customMapper[chain]) {
return customMapper[chain];
}
for (const coinType in coinType2Symbol_json_1.default) {
if (coinType2Symbol_json_1.default[coinType] === chain) {
return coinType;
}
}
}
return chain;
}
exports.mapSymbolToCoinType = mapSymbolToCoinType;
//# sourceMappingURL=slip44.js.map
;