Skip to content

Commit

Permalink
fixup! feat(orchestration): add more chain infos for fusdc
Browse files Browse the repository at this point in the history
  • Loading branch information
samsiegart committed Jan 21, 2025
1 parent 9f28f36 commit aee86c6
Show file tree
Hide file tree
Showing 5 changed files with 670 additions and 206 deletions.
61 changes: 61 additions & 0 deletions packages/fast-usdc/test/chain-info.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import test from 'ava';
import fetchedChainInfo from '@agoric/orchestration/src/fetched-chain-info.js';

// List of chains to test to ensure an IBC connection exists from noble to them
// XXX: Some missing connections.
const fastUsdcDestinationChains = [
// 'archway', // Connection in chain registry but not tagged as 'preferred'
'beezee',
// 'carbon', // Connection in mapofzones but not chain registry
// 'celestia', // No connection in mapofzones or chain registry
'coreum',
'cosmoshub',
'crescent',
'doravota',
'dydx',
'dymension',
// 'empowerchain', // No connection in mapofzones or chain registry
'evmos',
'haqq',
'injective',
'juno',
'kava',
'kujira',
'lava',
'migaloo',
'neutron',
// 'nibiru', // Connection in chain registry but not tagged as 'preferred'
// 'nolus', // Connection in mapofzones but not chain registry
'omniflixhub',
'osmosis',
'persistence',
'planq',
'provenance',
'pryzm',
// 'quicksilver', // No connection in mapofzones or chain registry
'secretnetwork',
'sei',
'shido',
// 'sifchain', // Connection in mapofzones but not chain registry
'stargaze',
// 'stride', // No connection in mapofzones or chain registry
'terra2',
'titan',
'umee',
];

const testNobleConnection = test.macro({
exec(t, input) {
const info = fetchedChainInfo[input];
const { chainId } = info;
const connection = fetchedChainInfo.noble.connections[chainId];
t.truthy(connection);
},
title(_, input) {
return `Connection from noble to ${input}`;
},
});

for (const chain of fastUsdcDestinationChains) {
test(testNobleConnection, chain);
}
63 changes: 29 additions & 34 deletions packages/orchestration/scripts/fetch-chain-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,62 +12,57 @@ const outputFile = 'src/fetched-chain-info.js';
/**
* Names for which to fetch info
*/
export const icaChainNames = new Set([
export const chainNames = [
'agoric',
'archway',
'beezee',
'carbon',
'celestia',
'coreum',
'cosmoshub',
'crescent',
'doravota',
'dydx',
'dymension',
'empowerchain',
'evmos',
'haqq',
'injective',
'juno',
'kava',
'kujira',
'lava',
'migaloo',
'neutron',
'nibiru',
'noble',
'nolus',
'omniflixhub',
'osmosis',
'secretnetwork',
'stargaze',
'stride',
'umee',
]);

const nonIcaChainNames = [
'migaloo',
'terra',
'persistence',
'planq',
'coreum',
'haqq',
'evmos',
'provenance',
'pryzm',
'nibiru',
'carbon',
'sei',
'archway',
'doravota',
'persistence',
'injective',
'sifchain',
'quicksilver',
'provenance',
'crescent',
'nolus',
'empowerchain',
'kava',
'kujira',
'secretnetwork',
'sei',
'shido',
'dymension',
'lava',
'sifchain',
'stargaze',
'stride',
'terra2',
'titan',
'beezee',
'umee',
];

const client = new ChainRegistryClient({
chainNames: [...icaChainNames, ...nonIcaChainNames],
chainNames,
});

// chain info, assets and ibc data will be downloaded dynamically by invoking fetchUrls method
await client.fetchUrls();

const chainInfo = await convertChainInfo(client, name =>
icaChainNames.has(name),
);
const chainInfo = await convertChainInfo(client);

const record = JSON.stringify(chainInfo, null, 2);
const src = `/** @file Generated by fetch-chain-info.ts */\nexport default /** @type {const} } */ (${record});`;
Expand Down
20 changes: 20 additions & 0 deletions packages/orchestration/src/chain-capabilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,43 @@ const PfmEnabled = /** @type {const} */ ({
});
harden(PfmEnabled);

const IcaEnabled = /** @type {const} */ ({
agoric: true,
celestia: true,
cosmoshub: true,
dydx: true,
juno: true,
neutron: true,
noble: true,
omniflixhub: true,
osmosis: true,
secretnetwork: true,
stargaze: true,
stride: true,
umee: true,
});
harden(IcaEnabled);

/**
* @param {Record<string, CosmosChainInfo>} chainInfo
* @param {{
* PfmEnabled: Record<string, boolean>;
* IcqEnabled: Record<string, boolean>;
* IcaEnabled: Record<string, boolean>;
* }} [opts]
*/
export const withChainCapabilities = (
chainInfo,
opts = {
PfmEnabled,
IcqEnabled,
IcaEnabled,
},
) => {
return objectMap(chainInfo, (info, name) => ({
...info,
pfmEnabled: !!opts.PfmEnabled[name],
icqEnabled: !!opts.IcqEnabled[name],
icaEnabled: !!opts.IcqEnabled[name],
}));
};
Loading

0 comments on commit aee86c6

Please sign in to comment.