Some checks failed
deploy / deploy (push) Failing after 37s
Proof: npm test (138 passing); npm run operator-dashboard:build; git diff --cached --check. Assumptions: Bridge deposits expose near_token_id/intents_token_id for credited asset attribution; nBTC is the solver trading reserve while btc.omft.near remains a tracked legacy BTC wrapper. Still fake: No live asset migration was submitted; existing btc.omft.near balance is only tracked and withdrawable until a separately approved conversion or withdrawal is executed.
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
|
|
import {
|
|
bridgeDepositAssetId,
|
|
intentsAssetIdFromNearTokenId,
|
|
} from '../src/core/bridge-assets.mjs';
|
|
|
|
const NBTC = 'nep141:nbtc.bridge.near';
|
|
const LEGACY_BTC = 'nep141:btc.omft.near';
|
|
|
|
const assetRegistry = new Map([
|
|
[NBTC, { assetId: NBTC }],
|
|
[LEGACY_BTC, { assetId: LEGACY_BTC }],
|
|
]);
|
|
|
|
test('intentsAssetIdFromNearTokenId normalizes NEAR token ids to verifier asset ids', () => {
|
|
assert.equal(intentsAssetIdFromNearTokenId('nbtc.bridge.near'), NBTC);
|
|
assert.equal(intentsAssetIdFromNearTokenId(NBTC), NBTC);
|
|
assert.equal(intentsAssetIdFromNearTokenId(''), null);
|
|
});
|
|
|
|
test('bridgeDepositAssetId uses credited bridge near_token_id instead of chain-only fallback', () => {
|
|
assert.equal(bridgeDepositAssetId({
|
|
near_token_id: 'btc.omft.near',
|
|
defuse_asset_identifier: 'btc:mainnet:native',
|
|
}, {
|
|
assetRegistry,
|
|
fallbackAssetId: NBTC,
|
|
}), LEGACY_BTC);
|
|
|
|
assert.equal(bridgeDepositAssetId({
|
|
near_token_id: 'nbtc.bridge.near',
|
|
defuse_asset_identifier: 'btc:mainnet:native',
|
|
}, {
|
|
assetRegistry,
|
|
fallbackAssetId: LEGACY_BTC,
|
|
}), NBTC);
|
|
});
|