@agoric/orchestration 0.1.1-dev-4687f0d.0 → 0.1.1-dev-1d94913.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 +15 -15
- package/src/chain-info.d.ts +73 -73
- package/src/exos/local-chain-account-kit.d.ts +93 -84
- package/src/exos/local-chain-account-kit.d.ts.map +1 -1
- package/src/fetched-chain-info.d.ts +1671 -2983
- package/src/fetched-chain-info.js +73 -73
- package/src/proposals/orchestration-proposal.d.ts +7 -3
- package/src/proposals/orchestration-proposal.d.ts.map +1 -1
- package/src/proposals/orchestration-proposal.js +43 -24
- package/src/utils/chainHub.d.ts +92 -83
- package/src/utils/chainHub.d.ts.map +1 -1
- package/src/utils/chainHub.js +36 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chainHub.d.ts","sourceRoot":"","sources":["chainHub.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chainHub.d.ts","sourceRoot":"","sources":["chainHub.js"],"names":[],"mappings":"AAOA;;;;;;GAMG;AAEH,wCAAwC;AACxC,gCAAiC;AACjC,kCAAkC;AAClC,gDAAiD;AAqB1C,wCAHI,MAAM,YACN,MAAM,UAUhB;AAMM;IAaH;;;;;;;;;;;OAWG;wBAFQ,MAAM;IAMjB;;;;;;;;OAQG;iBAHuB,CAAC,4BAAD,CAAC,AAHf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gDAjBZ;;;;;;;;;;;+BAWG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAsCH;;;;mBAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAdH;;;;OAIG;mCAHQ,MAAM,eACN,MAAM;IAQjB;;;;OAIG;kCAHQ,MAAM,eACN,MAAM;EAsBpB;AASM,gDALI,IAAI,CAAC,OAAO,cAAc,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,QACpD,MAAM,oCAEN,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,iBAgCzC;uBAtCa,UAAU,CAAC,OAAO,YAAY,CAAC;6BApInB,cAAc;4BAGf,kBAAkB;0BACpB,cAAc;qCAHgB,kBAAkB;+BAC9B,kBAAkB;uCADN,kBAAkB"}
|
package/src/utils/chainHub.js
CHANGED
|
@@ -3,6 +3,8 @@ import { M, mustMatch } from '@endo/patterns';
|
|
|
3
3
|
import { makeHeapZone } from '@agoric/zone';
|
|
4
4
|
import { CosmosChainInfoShape, IBCConnectionInfoShape } from '../typeGuards.js';
|
|
5
5
|
|
|
6
|
+
const { Fail } = assert;
|
|
7
|
+
|
|
6
8
|
/**
|
|
7
9
|
* @import {NameHub} from '@agoric/vats';
|
|
8
10
|
* @import {CosmosChainInfo, IBCConnectionInfo} from '../cosmos-api.js';
|
|
@@ -16,6 +18,17 @@ export const CHAIN_KEY = 'chain';
|
|
|
16
18
|
/** namehub for connection info */
|
|
17
19
|
export const CONNECTIONS_KEY = 'chainConnection';
|
|
18
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Character used in a connection tuple key to separate the two chain ids. Valid
|
|
23
|
+
* because a chainId can contain only alphanumerics and dash.
|
|
24
|
+
*
|
|
25
|
+
* Vstorage keys can be only alphanumerics, dash or underscore. That leaves
|
|
26
|
+
* underscore as the only valid separator.
|
|
27
|
+
*
|
|
28
|
+
* @see {@link https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-2.md}
|
|
29
|
+
*/
|
|
30
|
+
const CHAIN_ID_SEPARATOR = '_';
|
|
31
|
+
|
|
19
32
|
/**
|
|
20
33
|
* The entries of the top-level namehubs in agoricNames are reflected to
|
|
21
34
|
* vstorage. But only the top level. So we combine the 2 chain ids into 1 key.
|
|
@@ -24,8 +37,15 @@ export const CONNECTIONS_KEY = 'chainConnection';
|
|
|
24
37
|
* @param {string} chainId1
|
|
25
38
|
* @param {string} chainId2
|
|
26
39
|
*/
|
|
27
|
-
export const connectionKey = (chainId1, chainId2) =>
|
|
28
|
-
|
|
40
|
+
export const connectionKey = (chainId1, chainId2) => {
|
|
41
|
+
if (
|
|
42
|
+
chainId1.includes(CHAIN_ID_SEPARATOR) ||
|
|
43
|
+
chainId2.includes(CHAIN_ID_SEPARATOR)
|
|
44
|
+
) {
|
|
45
|
+
Fail`invalid chain id ${chainId1} or ${chainId2}`;
|
|
46
|
+
}
|
|
47
|
+
return [chainId1, chainId2].sort().join(CHAIN_ID_SEPARATOR);
|
|
48
|
+
};
|
|
29
49
|
|
|
30
50
|
/**
|
|
31
51
|
* @param {Remote<NameHub>} agoricNames
|
|
@@ -138,12 +158,22 @@ export const registerChain = async (
|
|
|
138
158
|
|
|
139
159
|
mustMatch(chainInfo, CosmosChainInfoShape);
|
|
140
160
|
const { connections = {}, ...vertex } = chainInfo;
|
|
141
|
-
log(`registering agoricNames chain.${name}`);
|
|
142
|
-
await E(nameAdmin).update(name, vertex);
|
|
143
161
|
|
|
162
|
+
const promises = [
|
|
163
|
+
E(nameAdmin)
|
|
164
|
+
.update(name, vertex)
|
|
165
|
+
.then(() => log(`registered agoricNames chain.${name}`)),
|
|
166
|
+
];
|
|
167
|
+
|
|
168
|
+
// XXX updates redundantly, twice per edge
|
|
144
169
|
for await (const [destChainId, connInfo] of Object.entries(connections)) {
|
|
145
170
|
const key = connectionKey(chainInfo.chainId, destChainId);
|
|
146
|
-
|
|
147
|
-
|
|
171
|
+
promises.push(
|
|
172
|
+
E(connAdmin)
|
|
173
|
+
.update(key, connInfo)
|
|
174
|
+
.then(() => log(`registering agoricNames chainConnection.${key}`)),
|
|
175
|
+
);
|
|
148
176
|
}
|
|
177
|
+
// Bundle to pipeline IO
|
|
178
|
+
await Promise.all(promises);
|
|
149
179
|
};
|