-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: chain-capabilities.js constants
- adds `IcqEnabled` and `PfmEnabled` constants to support `CosmosChainInfo` - this data is not available via a well-known registry like cosmos/chain-registry, but necessary for the Orchestration API - exports `withChainCapabilities` helper so consumers can include this data with fetched-chain-info.js
- Loading branch information
1 parent
e1c35da
commit 52ff70a
Showing
4 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+22 Bytes
(100%)
packages/builders/test/snapshots/orchestration-imports.test.js.snap
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/** | ||
* @file Contains ChainInfo that not available from a well-known chain registry. | ||
*/ | ||
|
||
import { objectMap } from '@endo/patterns'; | ||
|
||
/** @import {CosmosChainInfo, KnownChains} from '@agoric/orchestration'; */ | ||
|
||
/** | ||
* Chains with the async-icq (icq-1) module available. | ||
* | ||
* @satisfies {Partial<Record<keyof KnownChains, boolean>>} | ||
*/ | ||
const IcqEnabled = /** @type {const} */ ({ | ||
omniflixhub: true, | ||
osmosis: true, | ||
}); | ||
harden(IcqEnabled); | ||
|
||
/** | ||
* Chains with the packet-forward-middleware module available. | ||
* | ||
* @satisfies {Partial<Record<keyof KnownChains, boolean>>} | ||
*/ | ||
const PfmEnabled = /** @type {const} */ ({ | ||
agoric: true, | ||
celestia: true, | ||
cosmoshub: true, | ||
juno: true, | ||
neutron: true, | ||
noble: true, | ||
omniflixhub: true, | ||
osmosis: true, | ||
secretnetwork: true, | ||
stargaze: true, | ||
stride: true, | ||
umee: true, | ||
}); | ||
harden(PfmEnabled); | ||
|
||
/** | ||
* @param {Record<string, CosmosChainInfo>} chainInfo | ||
* @param {{ | ||
* PfmEnabled: Record<string, boolean>; | ||
* IcqEnabled: Record<string, boolean>; | ||
* }} [opts] | ||
*/ | ||
export const withChainCapabilities = ( | ||
chainInfo, | ||
opts = { | ||
PfmEnabled, | ||
IcqEnabled, | ||
}, | ||
) => { | ||
return objectMap(chainInfo, (info, name) => ({ | ||
...info, | ||
pfmEnabled: !!opts.PfmEnabled[name], | ||
icqEnabled: !!opts.IcqEnabled[name], | ||
})); | ||
}; |