-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
9757 Orchestration docs timebox #10050
Changes from all commits
56fbf58
b8c6841
96bf8c3
23ef07c
901efc5
4a149cc
da56653
1d0d961
ed3f2e6
15fe11b
48a325c
eb5b978
1f3fc93
a7e1917
47a4ff6
54cc2b9
7b97301
1af6135
c3df059
5d3a614
98103e9
e34bf51
cc4b382
45fae2b
220d4b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,6 +101,6 @@ | |
"access": "public" | ||
}, | ||
"typeCoverage": { | ||
"atLeast": 75.1 | ||
"atLeast": 75.7 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,6 +99,6 @@ | |
"workerThreads": false | ||
}, | ||
"typeCoverage": { | ||
"atLeast": 77.36 | ||
"atLeast": 77.44 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,6 +90,6 @@ | |
"workerThreads": false | ||
}, | ||
"typeCoverage": { | ||
"atLeast": 86.64 | ||
"atLeast": 90.03 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,6 @@ | |
"workerThreads": false | ||
}, | ||
"typeCoverage": { | ||
"atLeast": 76.03 | ||
"atLeast": 81.8 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,6 +69,6 @@ | |
"timeout": "20m" | ||
}, | ||
"typeCoverage": { | ||
"atLeast": 80.6 | ||
"atLeast": 80.53 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,6 +72,6 @@ | |
"access": "public" | ||
}, | ||
"typeCoverage": { | ||
"atLeast": 82.44 | ||
"atLeast": 82.6 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,6 +82,6 @@ | |
"access": "public" | ||
}, | ||
"typeCoverage": { | ||
"atLeast": 95.81 | ||
"atLeast": 95.8 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,6 @@ | |
"access": "public" | ||
}, | ||
"typeCoverage": { | ||
"atLeast": 93.82 | ||
"atLeast": 93.32 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,6 @@ | |
"workerThreads": false | ||
}, | ||
"typeCoverage": { | ||
"atLeast": 90.69 | ||
"atLeast": 91.15 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,6 +92,6 @@ | |
"access": "public" | ||
}, | ||
"typeCoverage": { | ||
"atLeast": 98.1 | ||
"atLeast": 97.57 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,10 +9,15 @@ import { | |
import fetchedChainInfo from './fetched-chain-info.js'; // Refresh with scripts/refresh-chain-info.ts | ||
import { CosmosAssetInfoShape, CosmosChainInfoShape } from './typeGuards.js'; | ||
|
||
/** @import {CosmosAssetInfo, CosmosChainInfo, EthChainInfo, IBCConnectionInfo} from './types.js'; */ | ||
/** @import {Chain, CosmosAssetInfo, CosmosChainInfo, EthChainInfo, IBCConnectionInfo} from './types.js'; */ | ||
/** @import {NameAdmin} from '@agoric/vats'; */ | ||
|
||
/** @typedef {CosmosChainInfo | EthChainInfo} ChainInfo */ | ||
/** | ||
* Info used to build a {@link Chain} object - channel, connection, and denom | ||
* info. | ||
* | ||
* @typedef {CosmosChainInfo | EthChainInfo} ChainInfo | ||
*/ | ||
|
||
const knownChains = /** @satisfies {Record<string, ChainInfo>} */ ( | ||
harden({ | ||
|
@@ -69,14 +74,19 @@ const knownChains = /** @satisfies {Record<string, ChainInfo>} */ ( | |
}) | ||
); | ||
|
||
/** @typedef {typeof knownChains} KnownChains */ | ||
/** | ||
* @typedef {typeof knownChains} KnownChains | ||
* @internal | ||
*/ | ||
|
||
// TODO(#9572): include this in registerChain | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👏 |
||
/** | ||
* TODO(#9572): include this in registerChain | ||
* Register chain assets into agoricNames | ||
* | ||
* @param {ERef<NameAdmin>} agoricNamesAdmin | ||
* @param {string} name | ||
* @param {CosmosAssetInfo[]} assets | ||
* @alpha | ||
*/ | ||
export const registerChainAssets = async (agoricNamesAdmin, name, assets) => { | ||
mustMatch(assets, M.arrayOf(CosmosAssetInfoShape)); | ||
|
@@ -86,6 +96,8 @@ export const registerChainAssets = async (agoricNamesAdmin, name, assets) => { | |
}; | ||
|
||
/** | ||
* Register a chain into agoricNames | ||
* | ||
* @param {ERef<NameAdmin>} agoricNamesAdmin | ||
* @param {string} name | ||
* @param {CosmosChainInfo} chainInfo | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ export type CosmosValidatorAddress = ChainAddress & { | |
}; | ||
|
||
/** Represents an IBC Connection between two chains, which can contain multiple Channels. */ | ||
export type IBCConnectionInfo = { | ||
export interface IBCConnectionInfo { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd expect to use interfaces for things with methods, but this is an ordinary data structure. Why not leave it as a type alias? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess being able to refer to each property with a link is nice. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I read some perf docs recently: https://github.com/microsoft/TypeScript/wiki/Performance#preferring-interfaces-over-intersections |
||
id: IBCConnectionID; // e.g. connection-0 | ||
client_id: string; // '07-tendermint-0' | ||
state: IBCConnectionState; | ||
|
@@ -56,12 +56,12 @@ export type IBCConnectionInfo = { | |
state: IBCChannelState; | ||
version: string; // e.eg. 'ics20-1' | ||
}; | ||
}; | ||
} | ||
|
||
/** | ||
* https://github.com/cosmos/chain-registry/blob/master/assetlist.schema.json | ||
*/ | ||
export type CosmosAssetInfo = { | ||
export interface CosmosAssetInfo extends Record<string, unknown> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. likewise, seems fine as a type alias |
||
base: Denom; | ||
name: string; | ||
display: string; | ||
|
@@ -79,7 +79,7 @@ export type CosmosAssetInfo = { | |
path: string; | ||
}; | ||
}>; | ||
} & Record<string, unknown>; | ||
} | ||
|
||
/** | ||
* Info for a Cosmos-based chain. | ||
|
@@ -97,6 +97,12 @@ export type CosmosChainInfo = Readonly<{ | |
stakingTokens?: Readonly<Array<{ denom: string }>>; | ||
}>; | ||
|
||
/** | ||
* Queries for the staking properties of an account. | ||
* | ||
* @see {@link https://docs.cosmos.network/main/build/modules/staking#messages x/staking messages} | ||
* {@link https://cosmos.github.io/cosmjs/latest/stargate/interfaces/StakingExtension.html StakingExtension} in cosmjs | ||
*/ | ||
export interface StakingAccountQueries { | ||
/** | ||
* @returns all active delegations from the account to any validator (or [] if none) | ||
|
@@ -141,6 +147,13 @@ export interface StakingAccountQueries { | |
*/ | ||
getReward: (validator: CosmosValidatorAddress) => Promise<DenomAmount[]>; | ||
} | ||
|
||
/** | ||
* Transactions for doing staking operations on an individual account. | ||
* | ||
* @see {@link https://docs.cosmos.network/main/build/modules/staking#messages x/staking messages} and | ||
* {@link https://cosmos.github.io/cosmjs/latest/stargate/interfaces/StakingExtension.html StakingExtension} in cosmjs | ||
*/ | ||
export interface StakingAccountActions { | ||
/** | ||
* Delegate an amount to a validator. The promise settles when the delegation is complete. | ||
|
@@ -241,11 +254,13 @@ export interface IcaAccount { | |
getPort: () => Port; | ||
} | ||
|
||
export type LiquidStakingMethods = { | ||
/** Methods on chains that support Liquid Staking */ | ||
export interface LiquidStakingMethods { | ||
liquidStake: (amount: AmountArg) => Promise<void>; | ||
}; | ||
} | ||
|
||
export type LocalAccountMethods = { | ||
/** Methods supported only on Agoric chain accounts */ | ||
export interface LocalAccountMethods { | ||
/** deposit payment (from zoe, for example) to the account */ | ||
deposit: (payment: Payment<'nat'>) => Promise<void>; | ||
/** withdraw a Payment from the account */ | ||
|
@@ -261,14 +276,28 @@ export type LocalAccountMethods = { | |
* @param tap | ||
*/ | ||
monitorTransfers: (tap: TargetApp) => Promise<TargetRegistration>; | ||
}; | ||
} | ||
|
||
export type IBCMsgTransferOptions = { | ||
/** | ||
* Options for {@link OrchestrationAccountI} `transfer` method. | ||
* | ||
* @see {@link https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures ICS 20 Data Structures} | ||
*/ | ||
export interface IBCMsgTransferOptions { | ||
timeoutHeight?: MsgTransfer['timeoutHeight']; | ||
timeoutTimestamp?: MsgTransfer['timeoutTimestamp']; | ||
memo?: string; | ||
}; | ||
} | ||
|
||
/** | ||
* Cosmos-specific methods to extend `OrchestrationAccountI`, parameterized | ||
* by `CosmosChainInfo`. | ||
* | ||
* In particular, if the chain info includes a staking token, {@link StakingAccountActions} | ||
* are available. | ||
* | ||
* @see {OrchestrationAccountI} | ||
*/ | ||
export type CosmosChainAccountMethods<CCI extends CosmosChainInfo> = | ||
(CCI extends { | ||
icaEnabled: true; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are there any particular features that we're using from this release? or was this just housekeeping?
I notice it's less than a day old. For ref: c56c478
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe hoping for better visibility support?