Skip to content

Commit

Permalink
chore: pare CosmosChainInfo to essentials
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Jun 10, 2024
1 parent 22b7345 commit 1ae0327
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 38 deletions.
20 changes: 0 additions & 20 deletions packages/orchestration/src/chain-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,22 @@ export const wellKnownChainInfo =
harden({
agoric: {
chainId: 'agoriclocal',
ibcHooksEnabled: true,
icaEnabled: true,
icqEnabled: true,
pfmEnabled: true,
},
// https://github.com/cosmos/chain-registry/blob/master/stride/chain.json
stride: {
chainId: 'stride-1',
icaEnabled: true,
icqEnabled: true,
pfmEnabled: true,
ibcHooksEnabled: true,
stakingTokens: [{ denom: 'ustride' }],
},
cosmos: {
chainId: 'cosmoslocal',
icaEnabled: true,
icqEnabled: true,
pfmEnabled: true,
ibcHooksEnabled: true,
stakingTokens: [{ denom: 'uatom' }],
},
celestia: {
chainId: 'celestia',
icaEnabled: true,
icqEnabled: true,
pfmEnabled: true,
ibcHooksEnabled: true,
stakingTokens: [{ denom: 'utia' }],
},
osmosis: {
chainId: 'osmosislocal',
icaEnabled: true,
icqEnabled: true,
pfmEnabled: true,
ibcHooksEnabled: true,
stakingTokens: [{ denom: 'uosmo' }],
},
})
Expand Down
4 changes: 0 additions & 4 deletions packages/orchestration/src/cosmos-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ export type IBCConnectionInfo = {
*/
export type CosmosChainInfo = {
chainId: string;
icaEnabled: boolean;
icqEnabled: boolean;
pfmEnabled: boolean;
ibcHooksEnabled: boolean;

/**
* cf https://github.com/cosmos/chain-registry/blob/master/chain.schema.json#L117
Expand Down
5 changes: 0 additions & 5 deletions packages/orchestration/src/facade.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ const anyVal = null;
const mockLocalChainInfo = {
allegedName: 'agoric',
chainId: 'agoriclocal',
connections: anyVal,
ibcHooksEnabled: true,
icaEnabled: true,
icqEnabled: true,
pfmEnabled: true,
};

/**
Expand Down
5 changes: 0 additions & 5 deletions packages/orchestration/src/typeGuards.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,8 @@ export const IBCConnectionInfoShape = M.splitRecord({
export const CosmosChainInfoShape = M.splitRecord(
{
chainId: M.string(),
connections: M.record(),
},
{
stakingTokens: M.arrayOf({ denom: M.string() }),
icaEnabled: M.boolean(),
icqEnabled: M.boolean(),
pfmEnabled: M.boolean(),
ibcHooksEnabled: M.boolean(),
},
);
13 changes: 9 additions & 4 deletions packages/orchestration/src/utils/chainHub.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,15 @@ export const makeChainHub = (agoricNames, zone = makeHeapZone()) => {
* @param {ERef<import('@agoric/vats').NameHubKit['nameAdmin']>} agoricNamesAdmin
* @param {string} name
* @param {CosmosChainInfo} chainInfo
* @param {any} connections
*/
export const registerChain = async (agoricNamesAdmin, name, chainInfo) => {
export const registerChain = async (
agoricNamesAdmin,
name,
chainInfo,
// FIXME get real data
connections = [],
) => {
const { nameAdmin } = await E(agoricNamesAdmin).provideChild('chain');
const { nameAdmin: connAdmin } =
await E(agoricNamesAdmin).provideChild('chainConnection');
Expand All @@ -127,9 +134,7 @@ export const registerChain = async (agoricNamesAdmin, name, chainInfo) => {
// XXX chainInfo.connections is redundant here.
await E(nameAdmin).update(name, chainInfo);

for await (const [destChainId, connInfo] of Object.entries(
chainInfo.connections,
)) {
for await (const [destChainId, connInfo] of Object.entries(connections)) {
const key = connectionKey(chainInfo.chainId, destChainId);
await E(connAdmin).update(key, connInfo);
}
Expand Down

0 comments on commit 1ae0327

Please sign in to comment.