@agoric/orchestration 0.1.1-dev-0c96ea5.0 → 0.1.1-dev-77fcd1a.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +16 -16
- package/src/chain-info.d.ts +6 -2
- package/src/chain-info.d.ts.map +1 -1
- package/src/chain-info.js +27 -7
- package/src/cosmos-api.d.ts +26 -1
- package/src/cosmos-api.d.ts.map +1 -1
- package/src/cosmos-api.ts +24 -1
- package/src/exos/chain-hub.d.ts +52 -2
- package/src/exos/chain-hub.d.ts.map +1 -1
- package/src/exos/chain-hub.js +74 -3
- package/src/exos/orchestrator.d.ts +25 -10
- package/src/exos/orchestrator.d.ts.map +1 -1
- package/src/exos/orchestrator.js +40 -14
- package/src/typeGuards.d.ts +4 -1
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +12 -1
- package/src/types.d.ts +1 -0
- package/src/types.d.ts.map +1 -1
- package/src/types.ts +1 -0
- package/src/utils/start-helper.d.ts +2 -0
- package/src/utils/start-helper.d.ts.map +1 -1
- package/src/utils/start-helper.js +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/orchestration",
|
|
3
|
-
"version": "0.1.1-dev-
|
|
3
|
+
"version": "0.1.1-dev-77fcd1a.0+77fcd1a",
|
|
4
4
|
"description": "Chain abstraction for Agoric's orchestration clients",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -33,19 +33,19 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@agoric/async-flow": "0.1.1-dev-
|
|
37
|
-
"@agoric/cosmic-proto": "0.4.1-dev-
|
|
38
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
39
|
-
"@agoric/internal": "0.3.3-dev-
|
|
40
|
-
"@agoric/network": "0.1.1-dev-
|
|
41
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
42
|
-
"@agoric/store": "0.9.3-dev-
|
|
43
|
-
"@agoric/time": "0.3.3-dev-
|
|
44
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
45
|
-
"@agoric/vats": "0.15.2-dev-
|
|
46
|
-
"@agoric/vow": "0.1.1-dev-
|
|
47
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
48
|
-
"@agoric/zone": "0.2.3-dev-
|
|
36
|
+
"@agoric/async-flow": "0.1.1-dev-77fcd1a.0+77fcd1a",
|
|
37
|
+
"@agoric/cosmic-proto": "0.4.1-dev-77fcd1a.0+77fcd1a",
|
|
38
|
+
"@agoric/ertp": "0.16.3-dev-77fcd1a.0+77fcd1a",
|
|
39
|
+
"@agoric/internal": "0.3.3-dev-77fcd1a.0+77fcd1a",
|
|
40
|
+
"@agoric/network": "0.1.1-dev-77fcd1a.0+77fcd1a",
|
|
41
|
+
"@agoric/notifier": "0.6.3-dev-77fcd1a.0+77fcd1a",
|
|
42
|
+
"@agoric/store": "0.9.3-dev-77fcd1a.0+77fcd1a",
|
|
43
|
+
"@agoric/time": "0.3.3-dev-77fcd1a.0+77fcd1a",
|
|
44
|
+
"@agoric/vat-data": "0.5.3-dev-77fcd1a.0+77fcd1a",
|
|
45
|
+
"@agoric/vats": "0.15.2-dev-77fcd1a.0+77fcd1a",
|
|
46
|
+
"@agoric/vow": "0.1.1-dev-77fcd1a.0+77fcd1a",
|
|
47
|
+
"@agoric/zoe": "0.26.3-dev-77fcd1a.0+77fcd1a",
|
|
48
|
+
"@agoric/zone": "0.2.3-dev-77fcd1a.0+77fcd1a",
|
|
49
49
|
"@endo/base64": "^1.0.5",
|
|
50
50
|
"@endo/errors": "^1.2.2",
|
|
51
51
|
"@endo/far": "^1.1.2",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@noble/hashes": "github:paulmillr/noble-hashes#ae060da"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
57
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-77fcd1a.0+77fcd1a",
|
|
58
58
|
"@chain-registry/client": "^1.47.4",
|
|
59
59
|
"@cosmjs/amino": "^0.32.3",
|
|
60
60
|
"@cosmjs/proto-signing": "^0.32.3",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"typeCoverage": {
|
|
95
95
|
"atLeast": 98.05
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "77fcd1ad792f5c30ead15a2081f7f63a6ab6f8af"
|
|
98
98
|
}
|
package/src/chain-info.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
export function
|
|
1
|
+
export function registerChainAssets(agoricNamesAdmin: ERef<NameAdmin>, name: string, assets: CosmosAssetInfo[]): Promise<void>;
|
|
2
|
+
export function registerChain(agoricNamesAdmin: ERef<NameAdmin>, name: string, chainInfo: CosmosChainInfo, log?: ((...messages: string[]) => void) | undefined, handledConnections?: Set<string> | undefined): Promise<void>;
|
|
2
3
|
export function registerKnownChains(agoricNamesAdmin: ERef<import("@agoric/vats").NameHubKit["nameAdmin"]>, log?: ((...messages: string[]) => void) | undefined): Promise<void>;
|
|
3
4
|
export type ChainInfo = CosmosChainInfo | EthChainInfo;
|
|
4
5
|
export type KnownChains = typeof knownChains;
|
|
6
|
+
import type { NameAdmin } from '@agoric/vats';
|
|
7
|
+
import type { CosmosAssetInfo } from './types.js';
|
|
5
8
|
import type { CosmosChainInfo } from './types.js';
|
|
6
9
|
import type { EthChainInfo } from './types.js';
|
|
7
|
-
/** @import {CosmosChainInfo, EthChainInfo, IBCConnectionInfo} from './types.js'; */
|
|
10
|
+
/** @import {CosmosAssetInfo, CosmosChainInfo, EthChainInfo, IBCConnectionInfo} from './types.js'; */
|
|
11
|
+
/** @import {NameAdmin} from '@agoric/vats'; */
|
|
8
12
|
/** @typedef {CosmosChainInfo | EthChainInfo} ChainInfo */
|
|
9
13
|
declare const knownChains: {
|
|
10
14
|
agoriclocal: {
|
package/src/chain-info.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain-info.d.ts","sourceRoot":"","sources":["chain-info.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chain-info.d.ts","sourceRoot":"","sources":["chain-info.js"],"names":[],"mappings":"AAgFO,sDAJI,IAAI,CAAC,SAAS,CAAC,QACf,MAAM,UACN,eAAe,EAAE,iBAO3B;AAUM,gDAPI,IAAI,CAAC,SAAS,CAAC,QACf,MAAM,aACN,eAAe,uBACD,MAAM,EAAE,KAAK,IAAI,4EA6CzC;AAQM,sDAHI,IAAI,CAAC,OAAO,cAAc,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,uBACtC,MAAM,EAAE,KAAK,IAAI,8BAOzC;wBAvIa,eAAe,GAAG,YAAY;0BAyD9B,OAAO,WAAW;+BA3DH,cAAc;qCAD0C,YAAY;qCAAZ,YAAY;kCAAZ,YAAY;AAAjG,qGAAqG;AACrG,+CAA+C;AAE/C,0DAA0D;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,
|
|
5
|
+
CHAIN_KEY,
|
|
6
|
+
CONNECTIONS_KEY,
|
|
7
|
+
normalizeConnectionInfo,
|
|
8
|
+
} from './exos/chain-hub.js';
|
|
4
9
|
import fetchedChainInfo from './fetched-chain-info.js'; // Refresh with scripts/refresh-chain-info.ts
|
|
5
|
-
import { CosmosChainInfoShape } from './typeGuards.js';
|
|
10
|
+
import { CosmosAssetInfoShape, CosmosChainInfoShape } from './typeGuards.js';
|
|
6
11
|
|
|
7
|
-
/** @import {CosmosChainInfo, EthChainInfo, IBCConnectionInfo} from './types.js'; */
|
|
12
|
+
/** @import {CosmosAssetInfo, CosmosChainInfo, EthChainInfo, IBCConnectionInfo} from './types.js'; */
|
|
13
|
+
/** @import {NameAdmin} from '@agoric/vats'; */
|
|
8
14
|
|
|
9
15
|
/** @typedef {CosmosChainInfo | EthChainInfo} ChainInfo */
|
|
10
16
|
|
|
@@ -66,7 +72,21 @@ const knownChains = /** @satisfies {Record<string, ChainInfo>} */ (
|
|
|
66
72
|
/** @typedef {typeof knownChains} KnownChains */
|
|
67
73
|
|
|
68
74
|
/**
|
|
69
|
-
*
|
|
75
|
+
* TODO(#9572): include this in registerChain
|
|
76
|
+
*
|
|
77
|
+
* @param {ERef<NameAdmin>} agoricNamesAdmin
|
|
78
|
+
* @param {string} name
|
|
79
|
+
* @param {CosmosAssetInfo[]} assets
|
|
80
|
+
*/
|
|
81
|
+
export const registerChainAssets = async (agoricNamesAdmin, name, assets) => {
|
|
82
|
+
mustMatch(assets, M.arrayOf(CosmosAssetInfoShape));
|
|
83
|
+
const { nameAdmin: assetAdmin } =
|
|
84
|
+
await E(agoricNamesAdmin).provideChild(ASSETS_KEY);
|
|
85
|
+
return E(assetAdmin).update(name, assets);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @param {ERef<NameAdmin>} agoricNamesAdmin
|
|
70
90
|
* @param {string} name
|
|
71
91
|
* @param {CosmosChainInfo} chainInfo
|
|
72
92
|
* @param {(...messages: string[]) => void} [log]
|
|
@@ -80,9 +100,9 @@ export const registerChain = async (
|
|
|
80
100
|
log = () => {},
|
|
81
101
|
handledConnections = new Set(),
|
|
82
102
|
) => {
|
|
83
|
-
const { nameAdmin } = await E(agoricNamesAdmin).provideChild(
|
|
103
|
+
const { nameAdmin } = await E(agoricNamesAdmin).provideChild(CHAIN_KEY);
|
|
84
104
|
const { nameAdmin: connAdmin } =
|
|
85
|
-
await E(agoricNamesAdmin).provideChild(
|
|
105
|
+
await E(agoricNamesAdmin).provideChild(CONNECTIONS_KEY);
|
|
86
106
|
|
|
87
107
|
mustMatch(chainInfo, CosmosChainInfoShape);
|
|
88
108
|
const { connections = {}, ...vertex } = chainInfo;
|
package/src/cosmos-api.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type { Port } from '@agoric/network';
|
|
|
9
9
|
import type { IBCChannelID, IBCConnectionID } from '@agoric/vats';
|
|
10
10
|
import type { TargetApp, TargetRegistration } from '@agoric/vats/src/bridge-target.js';
|
|
11
11
|
import type { LocalIbcAddress, RemoteIbcAddress } from '@agoric/vats/tools/ibc-utils.js';
|
|
12
|
-
import type { AmountArg, ChainAddress, DenomAmount } from './types.js';
|
|
12
|
+
import type { AmountArg, ChainAddress, Denom, DenomAmount } from './types.js';
|
|
13
13
|
/** An address for a validator on some blockchain, e.g., cosmos, eth, etc. */
|
|
14
14
|
export type CosmosValidatorAddress = ChainAddress & {
|
|
15
15
|
value: `${string}valoper${string}`;
|
|
@@ -37,6 +37,31 @@ export type IBCConnectionInfo = {
|
|
|
37
37
|
version: string;
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* https://github.com/cosmos/chain-registry/blob/master/assetlist.schema.json
|
|
42
|
+
*/
|
|
43
|
+
export type CosmosAssetInfo = {
|
|
44
|
+
base: Denom;
|
|
45
|
+
name: string;
|
|
46
|
+
display: string;
|
|
47
|
+
symbol: string;
|
|
48
|
+
denom_units: Array<{
|
|
49
|
+
denom: Denom;
|
|
50
|
+
exponent: number;
|
|
51
|
+
}>;
|
|
52
|
+
traces?: Array<{
|
|
53
|
+
type: 'ibc';
|
|
54
|
+
counterparty: {
|
|
55
|
+
chain_name: string;
|
|
56
|
+
base_denom: Denom;
|
|
57
|
+
channel_id: IBCChannelID;
|
|
58
|
+
};
|
|
59
|
+
chain: {
|
|
60
|
+
channel_id: IBCChannelID;
|
|
61
|
+
path: string;
|
|
62
|
+
};
|
|
63
|
+
}>;
|
|
64
|
+
} & Record<string, unknown>;
|
|
40
65
|
/**
|
|
41
66
|
* Info for a Cosmos-based chain.
|
|
42
67
|
*/
|
package/src/cosmos-api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cosmos-api.d.ts","sourceRoot":"","sources":["cosmos-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,mBAAmB,EACpB,MAAM,wDAAwD,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8CAA8C,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yDAAyD,CAAC;AAC3F,OAAO,KAAK,EACV,KAAK,IAAI,eAAe,EACxB,KAAK,EACN,MAAM,qDAAqD,CAAC;AAC7D,OAAO,KAAK,EAAE,KAAK,IAAI,kBAAkB,EAAE,MAAM,2DAA2D,CAAC;AAC7G,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,KAAK,EACV,SAAS,EACT,kBAAkB,EACnB,MAAM,mCAAmC,CAAC;AAC3C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A6D;IAC7D,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,0CAA0C;IAC1C,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7D;;;;;;;;;OASG;IACH,gBAAgB,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACnE,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,aAAa,CAAC,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;IAC7C,gBAAgB,CAAC,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,yBAAyB,CAAC,GAAG,SAAS,eAAe,IAC/D,CAAC,GAAG,SAAS;IACX,UAAU,EAAE,IAAI,CAAC;CAClB,GACG,UAAU,GACV,EAAE,CAAC,GACL,GAAG,SAAS;IACZ,aAAa,EAAE,EAAE,CAAC;CACnB,GACG,qBAAqB,GACrB,EAAE,CAAC"}
|
package/src/cosmos-api.ts
CHANGED
|
@@ -22,7 +22,7 @@ import type {
|
|
|
22
22
|
LocalIbcAddress,
|
|
23
23
|
RemoteIbcAddress,
|
|
24
24
|
} from '@agoric/vats/tools/ibc-utils.js';
|
|
25
|
-
import type { AmountArg, ChainAddress, DenomAmount } from './types.js';
|
|
25
|
+
import type { AmountArg, ChainAddress, Denom, DenomAmount } from './types.js';
|
|
26
26
|
|
|
27
27
|
/** An address for a validator on some blockchain, e.g., cosmos, eth, etc. */
|
|
28
28
|
export type CosmosValidatorAddress = ChainAddress & {
|
|
@@ -54,6 +54,29 @@ export type IBCConnectionInfo = {
|
|
|
54
54
|
};
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* https://github.com/cosmos/chain-registry/blob/master/assetlist.schema.json
|
|
59
|
+
*/
|
|
60
|
+
export type CosmosAssetInfo = {
|
|
61
|
+
base: Denom;
|
|
62
|
+
name: string;
|
|
63
|
+
display: string;
|
|
64
|
+
symbol: string;
|
|
65
|
+
denom_units: Array<{ denom: Denom; exponent: number }>;
|
|
66
|
+
traces?: Array<{
|
|
67
|
+
type: 'ibc';
|
|
68
|
+
counterparty: {
|
|
69
|
+
chain_name: string;
|
|
70
|
+
base_denom: Denom;
|
|
71
|
+
channel_id: IBCChannelID;
|
|
72
|
+
};
|
|
73
|
+
chain: {
|
|
74
|
+
channel_id: IBCChannelID;
|
|
75
|
+
path: string;
|
|
76
|
+
};
|
|
77
|
+
}>;
|
|
78
|
+
} & Record<string, unknown>;
|
|
79
|
+
|
|
57
80
|
/**
|
|
58
81
|
* Info for a Cosmos-based chain.
|
|
59
82
|
*/
|
package/src/exos/chain-hub.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @import {NameHub} from '@agoric/vats';
|
|
3
3
|
* @import {Vow, VowTools} from '@agoric/vow';
|
|
4
|
-
* @import {CosmosChainInfo, IBCConnectionInfo} from '../cosmos-api.js';
|
|
4
|
+
* @import {CosmosAssetInfo, CosmosChainInfo, IBCConnectionInfo} from '../cosmos-api.js';
|
|
5
5
|
* @import {ChainInfo, KnownChains} from '../chain-info.js';
|
|
6
|
+
* @import {Denom} from '../orchestration-api.js';
|
|
6
7
|
* @import {Remote} from '@agoric/internal';
|
|
7
|
-
* @import {
|
|
8
|
+
* @import {TypedPattern} from '@agoric/internal';
|
|
8
9
|
*/
|
|
9
10
|
/**
|
|
10
11
|
* @template {string} K
|
|
@@ -12,10 +13,22 @@
|
|
|
12
13
|
* ? Omit<KnownChains[K], 'connections'>
|
|
13
14
|
* : ChainInfo} ActualChainInfo
|
|
14
15
|
*/
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {object} DenomDetail
|
|
18
|
+
* @property {string} baseName - name of issuing chain; e.g. cosmoshub
|
|
19
|
+
* @property {Denom} baseDenom - e.g. uatom
|
|
20
|
+
* @property {string} chainName - name of holding chain; e.g. agoric
|
|
21
|
+
* @property {Brand} [brand] - vbank brand, if registered
|
|
22
|
+
* @see {ChainHub} `registerAsset` method
|
|
23
|
+
*/
|
|
24
|
+
/** @type {TypedPattern<DenomDetail>} */
|
|
25
|
+
export const DenomDetailShape: TypedPattern<DenomDetail>;
|
|
15
26
|
/** agoricNames key for ChainInfo hub */
|
|
16
27
|
export const CHAIN_KEY: "chain";
|
|
17
28
|
/** namehub for connection info */
|
|
18
29
|
export const CONNECTIONS_KEY: "chainConnection";
|
|
30
|
+
/** namehub for assets info */
|
|
31
|
+
export const ASSETS_KEY: "chainAssets";
|
|
19
32
|
export function connectionKey(chainId1: string, chainId2: string): string;
|
|
20
33
|
export function reverseConnInfo(connInfo: IBCConnectionInfo): IBCConnectionInfo;
|
|
21
34
|
export function normalizeConnectionInfo(primaryChainId: string, counterChainId: string, directed: IBCConnectionInfo): [string, IBCConnectionInfo];
|
|
@@ -65,15 +78,52 @@ export function makeChainHub(agoricNames: Remote<NameHub>, vowTools: VowTools):
|
|
|
65
78
|
* >}
|
|
66
79
|
*/
|
|
67
80
|
getChainsAndConnection<C1 extends string, C2 extends string>(primaryName: C1, counterName: C2): Vow<[ActualChainInfo<C1>, ActualChainInfo<C2>, IBCConnectionInfo]>;
|
|
81
|
+
/**
|
|
82
|
+
* Register an asset that may be held on a chain other than the issuing
|
|
83
|
+
* chain.
|
|
84
|
+
*
|
|
85
|
+
* @param {Denom} denom - on the holding chain, whose name is given in
|
|
86
|
+
* `detail.chainName`
|
|
87
|
+
* @param {DenomDetail} detail - chainName and baseName must be registered
|
|
88
|
+
*/
|
|
89
|
+
registerAsset(denom: Denom, detail: DenomDetail): void;
|
|
90
|
+
/**
|
|
91
|
+
* Retrieve holding, issuing chain names etc. for a denom.
|
|
92
|
+
*
|
|
93
|
+
* @param {Denom} denom
|
|
94
|
+
*/
|
|
95
|
+
lookupAsset(denom: Denom): DenomDetail;
|
|
68
96
|
}>;
|
|
97
|
+
export function registerAssets(chainHub: ChainHub, name: string, assets: CosmosAssetInfo[]): void;
|
|
69
98
|
export type ActualChainInfo<K extends string> = K extends keyof KnownChains ? Omit<KnownChains[K], "connections"> : ChainInfo;
|
|
99
|
+
export type DenomDetail = {
|
|
100
|
+
/**
|
|
101
|
+
* - name of issuing chain; e.g. cosmoshub
|
|
102
|
+
*/
|
|
103
|
+
baseName: string;
|
|
104
|
+
/**
|
|
105
|
+
* - e.g. uatom
|
|
106
|
+
*/
|
|
107
|
+
baseDenom: Denom;
|
|
108
|
+
/**
|
|
109
|
+
* - name of holding chain; e.g. agoric
|
|
110
|
+
*/
|
|
111
|
+
chainName: string;
|
|
112
|
+
/**
|
|
113
|
+
* - vbank brand, if registered
|
|
114
|
+
*/
|
|
115
|
+
brand?: globalThis.Brand | undefined;
|
|
116
|
+
};
|
|
70
117
|
export type ChainHub = ReturnType<typeof makeChainHub>;
|
|
118
|
+
import type { TypedPattern } from '@agoric/internal';
|
|
71
119
|
import type { IBCConnectionInfo } from '../cosmos-api.js';
|
|
72
120
|
import type { NameHub } from '@agoric/vats';
|
|
73
121
|
import type { Remote } from '@agoric/internal';
|
|
74
122
|
import type { VowTools } from '@agoric/vow';
|
|
75
123
|
import type { CosmosChainInfo } from '../cosmos-api.js';
|
|
76
124
|
import type { Vow } from '@agoric/vow';
|
|
125
|
+
import type { Denom } from '../orchestration-api.js';
|
|
126
|
+
import type { CosmosAssetInfo } from '../cosmos-api.js';
|
|
77
127
|
import type { KnownChains } from '../chain-info.js';
|
|
78
128
|
import type { ChainInfo } from '../chain-info.js';
|
|
79
129
|
//# sourceMappingURL=chain-hub.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain-hub.d.ts","sourceRoot":"","sources":["chain-hub.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chain-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AW,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,GACnC,SAAS;;;;;cAKF,MAAM;;;;eACN,KAAK;;;;eACL,MAAM;;;;;;uBA2WN,UAAU,CAAC,OAAO,YAAY,CAAC;kCAzXd,kBAAkB;uCAJqB,kBAAkB;6BAF9D,cAAc;4BAKf,kBAAkB;8BAJX,aAAa;qCACyB,kBAAkB;yBADxD,aAAa;2BAGrB,yBAAyB;qCAFqB,kBAAkB;iCAC/C,kBAAkB;+BAAlB,kBAAkB"}
|
package/src/exos/chain-hub.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Fail, makeError } from '@endo/errors';
|
|
1
|
+
import { Fail, makeError, q } from '@endo/errors';
|
|
2
2
|
import { E } from '@endo/far';
|
|
3
3
|
import { M } from '@endo/patterns';
|
|
4
|
+
import { BrandShape } from '@agoric/ertp/src/typeGuards.js';
|
|
4
5
|
|
|
5
6
|
import { VowShape } from '@agoric/vow';
|
|
6
7
|
import { makeHeapZone } from '@agoric/zone';
|
|
@@ -9,10 +10,11 @@ import { CosmosChainInfoShape, IBCConnectionInfoShape } from '../typeGuards.js';
|
|
|
9
10
|
/**
|
|
10
11
|
* @import {NameHub} from '@agoric/vats';
|
|
11
12
|
* @import {Vow, VowTools} from '@agoric/vow';
|
|
12
|
-
* @import {CosmosChainInfo, IBCConnectionInfo} from '../cosmos-api.js';
|
|
13
|
+
* @import {CosmosAssetInfo, CosmosChainInfo, IBCConnectionInfo} from '../cosmos-api.js';
|
|
13
14
|
* @import {ChainInfo, KnownChains} from '../chain-info.js';
|
|
15
|
+
* @import {Denom} from '../orchestration-api.js';
|
|
14
16
|
* @import {Remote} from '@agoric/internal';
|
|
15
|
-
* @import {
|
|
17
|
+
* @import {TypedPattern} from '@agoric/internal';
|
|
16
18
|
*/
|
|
17
19
|
|
|
18
20
|
/**
|
|
@@ -22,10 +24,26 @@ import { CosmosChainInfoShape, IBCConnectionInfoShape } from '../typeGuards.js';
|
|
|
22
24
|
* : ChainInfo} ActualChainInfo
|
|
23
25
|
*/
|
|
24
26
|
|
|
27
|
+
/**
|
|
28
|
+
* @typedef {object} DenomDetail
|
|
29
|
+
* @property {string} baseName - name of issuing chain; e.g. cosmoshub
|
|
30
|
+
* @property {Denom} baseDenom - e.g. uatom
|
|
31
|
+
* @property {string} chainName - name of holding chain; e.g. agoric
|
|
32
|
+
* @property {Brand} [brand] - vbank brand, if registered
|
|
33
|
+
* @see {ChainHub} `registerAsset` method
|
|
34
|
+
*/
|
|
35
|
+
/** @type {TypedPattern<DenomDetail>} */
|
|
36
|
+
export const DenomDetailShape = M.splitRecord(
|
|
37
|
+
{ chainName: M.string(), baseName: M.string(), baseDenom: M.string() },
|
|
38
|
+
{ brand: BrandShape },
|
|
39
|
+
);
|
|
40
|
+
|
|
25
41
|
/** agoricNames key for ChainInfo hub */
|
|
26
42
|
export const CHAIN_KEY = 'chain';
|
|
27
43
|
/** namehub for connection info */
|
|
28
44
|
export const CONNECTIONS_KEY = 'chainConnection';
|
|
45
|
+
/** namehub for assets info */
|
|
46
|
+
export const ASSETS_KEY = 'chainAssets';
|
|
29
47
|
|
|
30
48
|
/**
|
|
31
49
|
* Character used in a connection tuple key to separate the two chain ids. Valid
|
|
@@ -146,6 +164,8 @@ const ChainHubI = M.interface('ChainHub', {
|
|
|
146
164
|
).returns(),
|
|
147
165
|
getConnectionInfo: M.call(ChainIdArgShape, ChainIdArgShape).returns(VowShape),
|
|
148
166
|
getChainsAndConnection: M.call(M.string(), M.string()).returns(VowShape),
|
|
167
|
+
registerAsset: M.call(M.string(), DenomDetailShape).returns(),
|
|
168
|
+
lookupAsset: M.call(M.string()).returns(DenomDetailShape),
|
|
149
169
|
});
|
|
150
170
|
|
|
151
171
|
/**
|
|
@@ -172,6 +192,12 @@ export const makeChainHub = (agoricNames, vowTools) => {
|
|
|
172
192
|
valueShape: IBCConnectionInfoShape,
|
|
173
193
|
});
|
|
174
194
|
|
|
195
|
+
/** @type {MapStore<string, DenomDetail>} */
|
|
196
|
+
const denomDetails = zone.mapStore('denom', {
|
|
197
|
+
keyShape: M.string(),
|
|
198
|
+
valueShape: DenomDetailShape,
|
|
199
|
+
});
|
|
200
|
+
|
|
175
201
|
const lookupChainInfo = vowTools.retriable(
|
|
176
202
|
zone,
|
|
177
203
|
'lookupChainInfo',
|
|
@@ -336,8 +362,53 @@ export const makeChainHub = (agoricNames, vowTools) => {
|
|
|
336
362
|
// @ts-expect-error XXX generic parameter propagation
|
|
337
363
|
return lookupChainsAndConnection(primaryName, counterName);
|
|
338
364
|
},
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Register an asset that may be held on a chain other than the issuing
|
|
368
|
+
* chain.
|
|
369
|
+
*
|
|
370
|
+
* @param {Denom} denom - on the holding chain, whose name is given in
|
|
371
|
+
* `detail.chainName`
|
|
372
|
+
* @param {DenomDetail} detail - chainName and baseName must be registered
|
|
373
|
+
*/
|
|
374
|
+
registerAsset(denom, detail) {
|
|
375
|
+
const { chainName, baseName } = detail;
|
|
376
|
+
chainInfos.has(chainName) ||
|
|
377
|
+
Fail`must register chain ${q(chainName)} first`;
|
|
378
|
+
chainInfos.has(baseName) ||
|
|
379
|
+
Fail`must register chain ${q(baseName)} first`;
|
|
380
|
+
denomDetails.init(denom, detail);
|
|
381
|
+
},
|
|
382
|
+
/**
|
|
383
|
+
* Retrieve holding, issuing chain names etc. for a denom.
|
|
384
|
+
*
|
|
385
|
+
* @param {Denom} denom
|
|
386
|
+
*/
|
|
387
|
+
lookupAsset(denom) {
|
|
388
|
+
return denomDetails.get(denom);
|
|
389
|
+
},
|
|
339
390
|
});
|
|
340
391
|
|
|
341
392
|
return chainHub;
|
|
342
393
|
};
|
|
343
394
|
/** @typedef {ReturnType<typeof makeChainHub>} ChainHub */
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* @param {ChainHub} chainHub
|
|
398
|
+
* @param {string} name
|
|
399
|
+
* @param {CosmosAssetInfo[]} assets
|
|
400
|
+
*/
|
|
401
|
+
export const registerAssets = (chainHub, name, assets) => {
|
|
402
|
+
for (const { base, traces } of assets) {
|
|
403
|
+
const native = !traces;
|
|
404
|
+
native || traces.length === 1 || Fail`unexpected ${traces.length} traces`;
|
|
405
|
+
const [chainName, baseName, baseDenom] = native
|
|
406
|
+
? [name, name, base]
|
|
407
|
+
: [
|
|
408
|
+
name,
|
|
409
|
+
traces[0].counterparty.chain_name,
|
|
410
|
+
traces[0].counterparty.base_denom,
|
|
411
|
+
];
|
|
412
|
+
chainHub.registerAsset(base, { chainName, baseName, baseDenom });
|
|
413
|
+
}
|
|
414
|
+
};
|
|
@@ -5,10 +5,11 @@ export const OrchestratorI: import("@endo/patterns").InterfaceGuard<{
|
|
|
5
5
|
getBrandInfo: import("@endo/patterns").MethodGuard;
|
|
6
6
|
asAmount: import("@endo/patterns").MethodGuard;
|
|
7
7
|
}>;
|
|
8
|
-
export function prepareOrchestratorKit(zone: Zone, { chainHub, localchain, makeLocalChainFacade, makeRemoteChainFacade, vowTools: { watch }, }: {
|
|
8
|
+
export function prepareOrchestratorKit(zone: Zone, { chainHub, localchain, chainByName, makeLocalChainFacade, makeRemoteChainFacade, vowTools: { watch, asVow }, }: {
|
|
9
9
|
asyncFlowTools: AsyncFlowTools;
|
|
10
10
|
chainHub: ChainHub;
|
|
11
11
|
localchain: Remote<LocalChain>;
|
|
12
|
+
chainByName: MapStore<string, HostInterface<Chain<any>>>;
|
|
12
13
|
makeRecorderKit: MakeRecorderKit;
|
|
13
14
|
makeLocalChainFacade: MakeLocalChainFacade;
|
|
14
15
|
makeRemoteChainFacade: MakeRemoteChainFacade;
|
|
@@ -20,8 +21,11 @@ export function prepareOrchestratorKit(zone: Zone, { chainHub, localchain, makeL
|
|
|
20
21
|
}): () => import("@endo/exo").GuardedKit<{
|
|
21
22
|
/** Waits for `chainInfo` and returns a LocalChainFacade */
|
|
22
23
|
makeLocalChainFacadeWatcher: {
|
|
23
|
-
/**
|
|
24
|
-
|
|
24
|
+
/**
|
|
25
|
+
* @param {ChainInfo} agoricChainInfo
|
|
26
|
+
* @param {string} name
|
|
27
|
+
*/
|
|
28
|
+
onFulfilled(agoricChainInfo: ChainInfo, name: string): import("@endo/exo").Guarded<{
|
|
25
29
|
getChainInfo(): Vow<Readonly<{
|
|
26
30
|
chainId: string;
|
|
27
31
|
connections?: Record<string, IBCConnectionInfo>;
|
|
@@ -43,15 +47,16 @@ export function prepareOrchestratorKit(zone: Zone, { chainHub, localchain, makeL
|
|
|
43
47
|
* RemoteChainFacade
|
|
44
48
|
*
|
|
45
49
|
* @param {[ChainInfo, ChainInfo, IBCConnectionInfo]} chainsAndConnection
|
|
50
|
+
* @param {string} name
|
|
46
51
|
*/
|
|
47
|
-
onFulfilled([_agoricChainInfo, remoteChainInfo, connectionInfo]: [ChainInfo, ChainInfo, IBCConnectionInfo]): import("@endo/exo").Guarded<{
|
|
48
|
-
getChainInfo(): Vow<any extends import("@endo/pass-style").Passable ? any :
|
|
49
|
-
makeAccount(): Vow<import("../orchestration-api.js").OrchestrationAccount<any> extends import("@endo/pass-style").Passable ? import("@endo/pass-style").Passable & import("../orchestration-api.js").OrchestrationAccount<any> :
|
|
52
|
+
onFulfilled([_agoricChainInfo, remoteChainInfo, connectionInfo]: [ChainInfo, ChainInfo, IBCConnectionInfo], name: string): import("@endo/exo").Guarded<{
|
|
53
|
+
getChainInfo(): Vow<any extends import("@endo/pass-style").Passable ? any : HostInterface<any>>;
|
|
54
|
+
makeAccount(): Vow<import("../orchestration-api.js").OrchestrationAccount<any> extends import("@endo/pass-style").Passable ? import("@endo/pass-style").Passable & import("../orchestration-api.js").OrchestrationAccount<any> : HostInterface<import("../orchestration-api.js").OrchestrationAccount<any>>>;
|
|
50
55
|
}>;
|
|
51
56
|
};
|
|
52
57
|
orchestrator: {
|
|
53
58
|
/** @type {HostOf<Orchestrator['getChain']>} */
|
|
54
|
-
getChain(chainName: string): Vow<Chain<any> extends import("@endo/pass-style").Passable ? import("@endo/pass-style").Passable & Chain<any> :
|
|
59
|
+
getChain(chainName: string): Vow<Chain<any> extends import("@endo/pass-style").Passable ? import("@endo/pass-style").Passable & Chain<any> : HostInterface<Chain<any>>>;
|
|
55
60
|
makeLocalAccount(): Vow<import("@endo/exo").Guarded<{
|
|
56
61
|
getAddress(): string;
|
|
57
62
|
getBalance(brand: Brand<"nat">): import("@agoric/vow").PromiseVow<Amount<"nat">>;
|
|
@@ -60,8 +65,15 @@ export function prepareOrchestratorKit(zone: Zone, { chainHub, localchain, makeL
|
|
|
60
65
|
executeTx<MT extends import("@agoric/cosmic-proto").TypedJson[]>(messages: MT): PromiseVowOfTupleMappedToGenerics<{ [K in keyof MT]: import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto").ResponseTo<MT[K]>>; }>;
|
|
61
66
|
monitorTransfers(tap: import("@agoric/vats/src/bridge-target.js").TargetApp): import("@agoric/vow").PromiseVow<import("@agoric/vats/src/bridge-target.js").TargetRegistration>;
|
|
62
67
|
}>>;
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
/** @type {HostOf<Orchestrator['getBrandInfo']>} */
|
|
69
|
+
getBrandInfo<HoldingChain extends keyof import("../chain-info.js").KnownChains, IssuingChain extends keyof import("../chain-info.js").KnownChains>(denom: import("../orchestration-api.js").Denom): {
|
|
70
|
+
brand?: globalThis.Brand;
|
|
71
|
+
chain: Chain<import("../chain-info.js").KnownChains[HoldingChain]>;
|
|
72
|
+
base: Chain<import("../chain-info.js").KnownChains[IssuingChain]>;
|
|
73
|
+
baseDenom: import("../orchestration-api.js").Denom;
|
|
74
|
+
};
|
|
75
|
+
/** @type {HostOf<Orchestrator['asAmount']>} */
|
|
76
|
+
asAmount: HostOf<Orchestrator["asAmount"]>;
|
|
65
77
|
};
|
|
66
78
|
}>;
|
|
67
79
|
/**
|
|
@@ -74,6 +86,8 @@ import type { AsyncFlowTools } from '@agoric/async-flow';
|
|
|
74
86
|
import type { ChainHub } from './chain-hub.js';
|
|
75
87
|
import type { LocalChain } from '@agoric/vats/src/localchain.js';
|
|
76
88
|
import type { Remote } from '@agoric/internal';
|
|
89
|
+
import type { Chain } from '../types.js';
|
|
90
|
+
import type { HostInterface } from '@agoric/async-flow';
|
|
77
91
|
import type { MakeRecorderKit } from '@agoric/zoe/src/contractSupport/recorder.js';
|
|
78
92
|
import type { MakeLocalChainFacade } from './local-chain-facade.js';
|
|
79
93
|
import type { MakeRemoteChainFacade } from './remote-chain-facade.js';
|
|
@@ -83,5 +97,6 @@ import type { VowTools } from '@agoric/vow';
|
|
|
83
97
|
import type { ChainInfo } from '../types.js';
|
|
84
98
|
import type { IBCConnectionInfo } from '../types.js';
|
|
85
99
|
import type { Vow } from '@agoric/vow';
|
|
86
|
-
import type {
|
|
100
|
+
import type { Orchestrator } from '../types.js';
|
|
101
|
+
import type { HostOf } from '@agoric/async-flow';
|
|
87
102
|
//# sourceMappingURL=orchestrator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["orchestrator.js"],"names":[],"mappings":"AAmCA,0BAA0B;AAC1B;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["orchestrator.js"],"names":[],"mappings":"AAmCA,0BAA0B;AAC1B;;;;;GAKG;AAmBI,6CAhBI,IAAI,mHACJ;IACV,cAAkB,EAAE,cAAc,CAAC;IACnC,QAAY,EAAE,QAAQ,CAAC;IACvB,UAAc,EAAE,OAAO,UAAU,CAAC,CAAC;IACnC,WAAe,EAAE,QAAQ,CAAC,MAAM,EAAE,yBAAoB,CAAC,CAAC;IACxD,eAAmB,EAAE,eAAe,CAAC;IACrC,oBAAwB,EAAE,oBAAoB,CAAC;IAC/C,qBAAyB,EAAE,qBAAqB,CAAC;IACjD,oBAAwB,EAAE,OAAO,uBAAuB,CAAC,CAAC;IAC1D,WAAe,EAAE,OAAO,WAAW,CAAC,CAAC;IACrC,YAAgB,EAAE,OAAO,YAAY,CAAC,CAAC;IACvC,QAAY,EAAE,QAAQ,CAAC;IACvB,GAAO,EAAE,GAAG,CAAC;CACV;IAkCE,2DAA2D;;QAEzD;;;WAGG;sDADQ,MAAM;;;;;;;;;;;;IAQnB;;;OAGG;;QAED;;;;;;WAMG;0HADQ,MAAM;;;;;;QASjB,+CAA+C;;;;;;;;;;QAqB/C,mDAAmD;;iBA3BG,CAAC;;;;;QAwCvD,+CAA+C;kBAApC,OAAO,YAAY,CAAC,UAAU,CAAC,CAAC;;GAIhD;;;;;+BAMU,UAAU,CACtB,UAAc,CAAC,OAAO,sBAAsB,CAAC,CAC1C,CAAC,cAAc,CAAC;0BAzJG,mBAAmB;oCAEc,oBAAoB;8BADjD,gBAAgB;gCAId,gCAAgC;4BAEpC,kBAAkB;2BAMyB,aAAa;mCAXzB,oBAAoB;qCAI7B,6CAA6C;0CAKrD,yBAAyB;2CACxB,0BAA0B;6CAHxB,gCAAgC;kCAL3C,cAAc;8BADb,aAAa;+BAUuB,aAAa;uCAAb,aAAa;yBAVjD,aAAa;kCAUuB,aAAa;4BAXzB,oBAAoB"}
|
package/src/exos/orchestrator.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { AmountShape } from '@agoric/ertp';
|
|
3
3
|
import { makeTracer } from '@agoric/internal';
|
|
4
4
|
import { Shape as NetworkShape } from '@agoric/network';
|
|
5
|
+
import { Fail, q } from '@endo/errors';
|
|
5
6
|
import { E } from '@endo/far';
|
|
6
7
|
import { M } from '@endo/patterns';
|
|
7
8
|
import {
|
|
@@ -15,7 +16,7 @@ import {
|
|
|
15
16
|
/**
|
|
16
17
|
* @import {Zone} from '@agoric/base-zone';
|
|
17
18
|
* @import {ChainHub} from './chain-hub.js';
|
|
18
|
-
* @import {AsyncFlowTools, HostOf} from '@agoric/async-flow';
|
|
19
|
+
* @import {AsyncFlowTools, HostInterface, HostOf} from '@agoric/async-flow';
|
|
19
20
|
* @import {Vow, VowTools} from '@agoric/vow';
|
|
20
21
|
* @import {TimerService} from '@agoric/time';
|
|
21
22
|
* @import {LocalChain} from '@agoric/vats/src/localchain.js';
|
|
@@ -29,7 +30,6 @@ import {
|
|
|
29
30
|
* @import {Chain, ChainInfo, IBCConnectionInfo, Orchestrator} from '../types.js';
|
|
30
31
|
*/
|
|
31
32
|
|
|
32
|
-
const { Fail } = assert;
|
|
33
33
|
const { Vow$ } = NetworkShape; // TODO #9611
|
|
34
34
|
const trace = makeTracer('Orchestrator');
|
|
35
35
|
|
|
@@ -47,6 +47,7 @@ export const OrchestratorI = M.interface('Orchestrator', {
|
|
|
47
47
|
* asyncFlowTools: AsyncFlowTools;
|
|
48
48
|
* chainHub: ChainHub;
|
|
49
49
|
* localchain: Remote<LocalChain>;
|
|
50
|
+
* chainByName: MapStore<string, HostInterface<Chain>>;
|
|
50
51
|
* makeRecorderKit: MakeRecorderKit;
|
|
51
52
|
* makeLocalChainFacade: MakeLocalChainFacade;
|
|
52
53
|
* makeRemoteChainFacade: MakeRemoteChainFacade;
|
|
@@ -62,9 +63,10 @@ export const prepareOrchestratorKit = (
|
|
|
62
63
|
{
|
|
63
64
|
chainHub,
|
|
64
65
|
localchain,
|
|
66
|
+
chainByName,
|
|
65
67
|
makeLocalChainFacade,
|
|
66
68
|
makeRemoteChainFacade,
|
|
67
|
-
vowTools: { watch },
|
|
69
|
+
vowTools: { watch, asVow },
|
|
68
70
|
},
|
|
69
71
|
) =>
|
|
70
72
|
zone.exoClassKit(
|
|
@@ -72,15 +74,13 @@ export const prepareOrchestratorKit = (
|
|
|
72
74
|
{
|
|
73
75
|
orchestrator: OrchestratorI,
|
|
74
76
|
makeLocalChainFacadeWatcher: M.interface('makeLocalChainFacadeWatcher', {
|
|
75
|
-
onFulfilled: M.call(M.record())
|
|
76
|
-
.optional(M.arrayOf(M.undefined()))
|
|
77
|
-
.returns(M.any()), // FIXME narrow
|
|
77
|
+
onFulfilled: M.call(M.record(), M.string()).returns(M.any()), // FIXME narrow
|
|
78
78
|
}),
|
|
79
79
|
makeRemoteChainFacadeWatcher: M.interface(
|
|
80
80
|
'makeRemoteChainFacadeWatcher',
|
|
81
81
|
{
|
|
82
|
-
onFulfilled: M.call(M.any())
|
|
83
|
-
.optional(M.arrayOf(M.undefined()))
|
|
82
|
+
onFulfilled: M.call(M.any(), M.string())
|
|
83
|
+
.optional(M.arrayOf(M.undefined())) // XXX needed?
|
|
84
84
|
.returns(M.any()), // FIXME narrow
|
|
85
85
|
},
|
|
86
86
|
),
|
|
@@ -92,9 +92,14 @@ export const prepareOrchestratorKit = (
|
|
|
92
92
|
{
|
|
93
93
|
/** Waits for `chainInfo` and returns a LocalChainFacade */
|
|
94
94
|
makeLocalChainFacadeWatcher: {
|
|
95
|
-
/**
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
/**
|
|
96
|
+
* @param {ChainInfo} agoricChainInfo
|
|
97
|
+
* @param {string} name
|
|
98
|
+
*/
|
|
99
|
+
onFulfilled(agoricChainInfo, name) {
|
|
100
|
+
const it = makeLocalChainFacade(agoricChainInfo);
|
|
101
|
+
chainByName.init(name, it);
|
|
102
|
+
return it;
|
|
98
103
|
},
|
|
99
104
|
},
|
|
100
105
|
/**
|
|
@@ -107,29 +112,50 @@ export const prepareOrchestratorKit = (
|
|
|
107
112
|
* RemoteChainFacade
|
|
108
113
|
*
|
|
109
114
|
* @param {[ChainInfo, ChainInfo, IBCConnectionInfo]} chainsAndConnection
|
|
115
|
+
* @param {string} name
|
|
110
116
|
*/
|
|
111
|
-
onFulfilled([_agoricChainInfo, remoteChainInfo, connectionInfo]) {
|
|
112
|
-
|
|
117
|
+
onFulfilled([_agoricChainInfo, remoteChainInfo, connectionInfo], name) {
|
|
118
|
+
const it = makeRemoteChainFacade(remoteChainInfo, connectionInfo);
|
|
119
|
+
chainByName.init(name, it);
|
|
120
|
+
return it;
|
|
113
121
|
},
|
|
114
122
|
},
|
|
115
123
|
orchestrator: {
|
|
116
124
|
/** @type {HostOf<Orchestrator['getChain']>} */
|
|
117
125
|
getChain(name) {
|
|
126
|
+
if (chainByName.has(name)) {
|
|
127
|
+
return asVow(() => chainByName.get(name));
|
|
128
|
+
}
|
|
118
129
|
if (name === 'agoric') {
|
|
119
130
|
return watch(
|
|
120
131
|
chainHub.getChainInfo('agoric'),
|
|
121
132
|
this.facets.makeLocalChainFacadeWatcher,
|
|
133
|
+
name,
|
|
122
134
|
);
|
|
123
135
|
}
|
|
124
136
|
return watch(
|
|
125
137
|
chainHub.getChainsAndConnection('agoric', name),
|
|
126
138
|
this.facets.makeRemoteChainFacadeWatcher,
|
|
139
|
+
name,
|
|
127
140
|
);
|
|
128
141
|
},
|
|
129
142
|
makeLocalAccount() {
|
|
130
143
|
return watch(E(localchain).makeAccount());
|
|
131
144
|
},
|
|
132
|
-
|
|
145
|
+
/** @type {HostOf<Orchestrator['getBrandInfo']>} */
|
|
146
|
+
getBrandInfo(denom) {
|
|
147
|
+
const { chainName, baseName, baseDenom, brand } =
|
|
148
|
+
chainHub.lookupAsset(denom);
|
|
149
|
+
chainByName.has(chainName) ||
|
|
150
|
+
Fail`use getChain(${q(chainName)}) before getBrandInfo(${q(denom)})`;
|
|
151
|
+
const chain = chainByName.get(chainName);
|
|
152
|
+
chainByName.has(baseName) ||
|
|
153
|
+
Fail`use getChain(${q(baseName)}) before getBrandInfo(${q(denom)})`;
|
|
154
|
+
const base = chainByName.get(baseName);
|
|
155
|
+
// @ts-expect-error XXX HostOf<> not quite right?
|
|
156
|
+
return harden({ chain, base, brand, baseDenom });
|
|
157
|
+
},
|
|
158
|
+
/** @type {HostOf<Orchestrator['asAmount']>} */
|
|
133
159
|
asAmount: () => Fail`not yet implemented`,
|
|
134
160
|
},
|
|
135
161
|
},
|
package/src/typeGuards.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @import {TypedPattern} from '@agoric/internal';
|
|
3
|
-
* @import {ChainAddress, ChainInfo, CosmosChainInfo, DenomAmount} from './types.js';
|
|
3
|
+
* @import {ChainAddress, CosmosAssetInfo, ChainInfo, CosmosChainInfo, DenomAmount, DenomDetail} from './types.js';
|
|
4
4
|
* @import {Delegation} from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
@@ -25,6 +25,8 @@ export const IBCChannelIDShape: import("@endo/patterns").Matcher;
|
|
|
25
25
|
export const IBCChannelInfoShape: import("@endo/patterns").Matcher;
|
|
26
26
|
export const IBCConnectionIDShape: import("@endo/patterns").Matcher;
|
|
27
27
|
export const IBCConnectionInfoShape: import("@endo/patterns").Matcher;
|
|
28
|
+
/** @type {TypedPattern<CosmosAssetInfo>} */
|
|
29
|
+
export const CosmosAssetInfoShape: TypedPattern<CosmosAssetInfo>;
|
|
28
30
|
/** @type {TypedPattern<CosmosChainInfo>} */
|
|
29
31
|
export const CosmosChainInfoShape: TypedPattern<CosmosChainInfo>;
|
|
30
32
|
/** @type {TypedPattern<ChainInfo>} */
|
|
@@ -47,6 +49,7 @@ export namespace TimestampProtoShape {
|
|
|
47
49
|
import type { ChainAddress } from './types.js';
|
|
48
50
|
import type { TypedPattern } from '@agoric/internal';
|
|
49
51
|
import type { Delegation } from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
|
|
52
|
+
import type { CosmosAssetInfo } from './types.js';
|
|
50
53
|
import type { CosmosChainInfo } from './types.js';
|
|
51
54
|
import type { ChainInfo } from './types.js';
|
|
52
55
|
import type { DenomAmount } from './types.js';
|
package/src/typeGuards.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeGuards.d.ts","sourceRoot":"","sources":["typeGuards.js"],"names":[],"mappings":"AAIA;;;;GAIG;AAEH;;;;GAIG;AACH;;;GAQE;AAEF,yCAAyC;AACzC,gCADW,aAAa,YAAY,CAAC,CAKnC;;;;;AAQF,uCAAuC;AACvC,8BADW,aAAa,UAAU,CAAC,CAIhC;AAEH,uEAUE;AAEF,iEAA4C;AAC5C,mEAQG;AACH,oEAA+C;AAC/C,sEAYG;AAEH,4CAA4C;AAC5C,mCADW,aAAa,eAAe,CAAC,CAWtC;AAEF,sCAAsC;AACtC,6BADW,aAAa,SAAS,CAAC,CAG/B;AACH,sEAAuE;AACvE,0DAAqC;AAErC,8DAAsC;AAEtC,wCAAwC;AACxC,+BADW,aAAa,WAAW,CAAC,CACqC;AAEzE,8DAAkE;AAElE,mBAAmB;AACnB;;;GAGG;;;;;
|
|
1
|
+
{"version":3,"file":"typeGuards.d.ts","sourceRoot":"","sources":["typeGuards.js"],"names":[],"mappings":"AAIA;;;;GAIG;AAEH;;;;GAIG;AACH;;;GAQE;AAEF,yCAAyC;AACzC,gCADW,aAAa,YAAY,CAAC,CAKnC;;;;;AAQF,uCAAuC;AACvC,8BADW,aAAa,UAAU,CAAC,CAIhC;AAEH,uEAUE;AAEF,iEAA4C;AAC5C,mEAQG;AACH,oEAA+C;AAC/C,sEAYG;AAEH,4CAA4C;AAC5C,mCADW,aAAa,eAAe,CAAC,CASrC;AAEH,4CAA4C;AAC5C,mCADW,aAAa,eAAe,CAAC,CAWtC;AAEF,sCAAsC;AACtC,6BADW,aAAa,SAAS,CAAC,CAG/B;AACH,sEAAuE;AACvE,0DAAqC;AAErC,8DAAsC;AAEtC,wCAAwC;AACxC,+BADW,aAAa,WAAW,CAAC,CACqC;AAEzE,8DAAkE;AAElE,mBAAmB;AACnB;;;GAGG;;;;;kCArHmG,YAAY;kCADnF,kBAAkB;gCAEpB,wDAAwD;qCADiB,YAAY;qCAAZ,YAAY;+BAAZ,YAAY;iCAAZ,YAAY"}
|
package/src/typeGuards.js
CHANGED
|
@@ -4,7 +4,7 @@ import { M } from '@endo/patterns';
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @import {TypedPattern} from '@agoric/internal';
|
|
7
|
-
* @import {ChainAddress, ChainInfo, CosmosChainInfo, DenomAmount} from './types.js';
|
|
7
|
+
* @import {ChainAddress, CosmosAssetInfo, ChainInfo, CosmosChainInfo, DenomAmount, DenomDetail} from './types.js';
|
|
8
8
|
* @import {Delegation} from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
|
|
9
9
|
*/
|
|
10
10
|
|
|
@@ -79,6 +79,17 @@ export const IBCConnectionInfoShape = M.splitRecord({
|
|
|
79
79
|
transferChannel: IBCChannelInfoShape,
|
|
80
80
|
});
|
|
81
81
|
|
|
82
|
+
/** @type {TypedPattern<CosmosAssetInfo>} */
|
|
83
|
+
export const CosmosAssetInfoShape = M.splitRecord({
|
|
84
|
+
base: M.string(),
|
|
85
|
+
name: M.string(),
|
|
86
|
+
display: M.string(),
|
|
87
|
+
symbol: M.string(),
|
|
88
|
+
denom_units: M.arrayOf(
|
|
89
|
+
M.splitRecord({ denom: M.string(), exponent: M.number() }),
|
|
90
|
+
),
|
|
91
|
+
});
|
|
92
|
+
|
|
82
93
|
/** @type {TypedPattern<CosmosChainInfo>} */
|
|
83
94
|
export const CosmosChainInfoShape = M.splitRecord(
|
|
84
95
|
{
|
package/src/types.d.ts
CHANGED
|
@@ -6,5 +6,6 @@ export type * from './exos/chain-account-kit.js';
|
|
|
6
6
|
export type * from './exos/icq-connection-kit.js';
|
|
7
7
|
export type * from './orchestration-api.js';
|
|
8
8
|
export type * from './exos/cosmos-interchain-service.js';
|
|
9
|
+
export type * from './exos/chain-hub.js';
|
|
9
10
|
export type * from './vat-orchestration.js';
|
|
10
11
|
//# sourceMappingURL=types.d.ts.map
|
package/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAEhG,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,6BAA6B,CAAC;AACjD,mBAAmB,8BAA8B,CAAC;AAClD,mBAAmB,wBAAwB,CAAC;AAC5C,mBAAmB,qCAAqC,CAAC;AACzD,mBAAmB,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAEhG,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,6BAA6B,CAAC;AACjD,mBAAmB,8BAA8B,CAAC;AAClD,mBAAmB,wBAAwB,CAAC;AAC5C,mBAAmB,qCAAqC,CAAC;AACzD,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,wBAAwB,CAAC"}
|
package/src/types.ts
CHANGED
|
@@ -7,4 +7,5 @@ export type * from './exos/chain-account-kit.js';
|
|
|
7
7
|
export type * from './exos/icq-connection-kit.js';
|
|
8
8
|
export type * from './orchestration-api.js';
|
|
9
9
|
export type * from './exos/cosmos-interchain-service.js';
|
|
10
|
+
export type * from './exos/chain-hub.js';
|
|
10
11
|
export type * from './vat-orchestration.js';
|
|
@@ -9,6 +9,8 @@ export function provideOrchestration(zcf: ZCF, baggage: Baggage, remotePowers: O
|
|
|
9
9
|
chainId: string;
|
|
10
10
|
}): import("@agoric/vow").Vow<import("../cosmos-api.js").IBCConnectionInfo>;
|
|
11
11
|
getChainsAndConnection<C1 extends string, C2 extends string>(primaryName: C1, counterName: C2): import("@agoric/vow").Vow<[ActualChainInfo<C1>, ActualChainInfo<C2>, import("../cosmos-api.js").IBCConnectionInfo]>;
|
|
12
|
+
registerAsset(denom: import("../orchestration-api.js").Denom, detail: DenomDetail): void;
|
|
13
|
+
lookupAsset(denom: import("../orchestration-api.js").Denom): import("../exos/chain-hub.js").DenomDetail;
|
|
12
14
|
}>;
|
|
13
15
|
vowTools: {
|
|
14
16
|
when: <T, TResult1 = import("@agoric/vow").EUnwrap<T>, TResult2 = never>(specimenP: T, onFulfilled?: ((value: import("@agoric/vow").EUnwrap<T>) => TResult1 | PromiseLike<TResult1>) | undefined, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined) => Promise<TResult1 | TResult2>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-helper.d.ts","sourceRoot":"","sources":["start-helper.js"],"names":[],"mappings":"AA8CO,0CALI,GAAG,WACH,OAAO,gBACP,mBAAmB,cACnB,UAAU
|
|
1
|
+
{"version":3,"file":"start-helper.d.ts","sourceRoot":"","sources":["start-helper.js"],"names":[],"mappings":"AA8CO,0CALI,GAAG,WACH,OAAO,gBACP,mBAAmB,cACnB,UAAU;;;;;;;;;;;;;;;;;;;wCA+B+B,GAAG;;+BAjDjD,GAAG,+EAIY,GAAG,yCACA,GAAG;;;;;;;;;;;;;;;EAwH1B;AAuBM,kCAdgC,EAAE,SAA3B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAE,EAGhC,EAAE,SAFM,mBAAmB,GAAG;IACnC,UAAc,EAAE,UAAU,CAAC;CACvB,EACQ,CAAC,cACH,CACV,GAAO,EAAE,GAAG,CAAC,EAAE,CAAC,EAChB,WAAe,EAAE,EAAE,EACnB,IAAQ,EAAE,IAAI,EACd,KAAS,EAAE,kBAAkB,KACtB,OAAO,CAAC,CAAC,CAAC,GACL,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAYzE;kCA7JU;IACZ,UAAc,EAAE,OAAO,UAAU,CAAC,CAAC;IACnC,oBAAwB,EAAE,OAAO,uBAAuB,CAAC,CAAC;IAC1D,WAAe,EAAE,OAAO,WAAW,CAAC,CAAC;IACrC,YAAgB,EAAE,OAAO,YAAY,CAAC,CAAC;IACvC,WAAe,EAAE,OAAO,OAAO,CAAC,CAAC;CAC9B;iCA0HU,IAAI,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,EAAE,MAAM,CAAC;6BAxIzC,kBAAkB;0BAGrB,cAAc;gCALR,gCAAgC;4BAIpC,aAAa;6CAEI,sCAAsC;kCALrC,cAAc;6BAE/B,cAAc"}
|
|
@@ -114,10 +114,13 @@ export const provideOrchestration = (
|
|
|
114
114
|
vowTools,
|
|
115
115
|
});
|
|
116
116
|
|
|
117
|
+
const chainByName = zones.orchestration.mapStore('chainName');
|
|
118
|
+
|
|
117
119
|
const makeOrchestratorKit = prepareOrchestratorKit(zones.orchestration, {
|
|
118
120
|
asyncFlowTools,
|
|
119
121
|
chainHub,
|
|
120
122
|
localchain: remotePowers.localchain,
|
|
123
|
+
chainByName,
|
|
121
124
|
makeRecorderKit,
|
|
122
125
|
makeLocalChainFacade,
|
|
123
126
|
makeRemoteChainFacade,
|