@snowballmoney/chain-agnostic-utils
Version:
Chain agnostic utilities for cross-chain applications
15 lines • 487 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseCAIP2 = parseCAIP2;
exports.formatCAIP2 = formatCAIP2;
function parseCAIP2(chainId) {
const [namespace, reference] = chainId.split(':');
if (!namespace || !reference) {
throw new Error('Invalid CAIP-2 identifier');
}
return { namespace, reference };
}
function formatCAIP2(namespace, reference) {
return `${namespace}:${reference}`;
}
//# sourceMappingURL=parser.js.map