@agoric/orchestration 0.1.1-dev-c5c52ec.0 → 0.1.1-dev-01a1123.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 +2 -2
- package/src/chain-info.d.ts.map +1 -1
- package/src/chain-info.js +2 -2
- package/src/examples/sendAnywhere.contract.d.ts.map +1 -1
- package/src/examples/sendAnywhere.contract.js +7 -2
- package/src/examples/swapExample.contract.d.ts.map +1 -1
- package/src/examples/swapExample.contract.js +5 -2
- package/src/exos/local-chain-facade.d.ts +7 -4
- package/src/exos/local-chain-facade.d.ts.map +1 -1
- package/src/exos/local-chain-facade.js +28 -18
- package/src/exos/orchestrator.d.ts +5 -4
- package/src/exos/orchestrator.d.ts.map +1 -1
- package/src/exos/remote-chain-facade.d.ts +7 -4
- package/src/exos/remote-chain-facade.d.ts.map +1 -1
- package/src/exos/remote-chain-facade.js +31 -18
- package/src/proposals/revise-chain-info.d.ts +21 -0
- package/src/proposals/revise-chain-info.d.ts.map +1 -0
- package/src/proposals/revise-chain-info.js +44 -0
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +3 -2
- package/src/utils/registry.d.ts +13 -0
- package/src/utils/registry.d.ts.map +1 -0
- package/src/utils/registry.js +131 -0
- package/src/utils/start-helper.d.ts.map +1 -1
- package/src/utils/start-helper.js +2 -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-01a1123.0+01a1123",
|
|
4
4
|
"description": "Chain abstraction for Agoric's orchestration clients",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -33,20 +33,20 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@agoric/assert": "0.6.1-dev-
|
|
37
|
-
"@agoric/async-flow": "0.1.1-dev-
|
|
38
|
-
"@agoric/cosmic-proto": "0.4.1-dev-
|
|
39
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
40
|
-
"@agoric/internal": "0.3.3-dev-
|
|
41
|
-
"@agoric/network": "0.1.1-dev-
|
|
42
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
43
|
-
"@agoric/store": "0.9.3-dev-
|
|
44
|
-
"@agoric/time": "0.3.3-dev-
|
|
45
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
46
|
-
"@agoric/vats": "0.15.2-dev-
|
|
47
|
-
"@agoric/vow": "0.1.1-dev-
|
|
48
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
49
|
-
"@agoric/zone": "0.2.3-dev-
|
|
36
|
+
"@agoric/assert": "0.6.1-dev-01a1123.0+01a1123",
|
|
37
|
+
"@agoric/async-flow": "0.1.1-dev-01a1123.0+01a1123",
|
|
38
|
+
"@agoric/cosmic-proto": "0.4.1-dev-01a1123.0+01a1123",
|
|
39
|
+
"@agoric/ertp": "0.16.3-dev-01a1123.0+01a1123",
|
|
40
|
+
"@agoric/internal": "0.3.3-dev-01a1123.0+01a1123",
|
|
41
|
+
"@agoric/network": "0.1.1-dev-01a1123.0+01a1123",
|
|
42
|
+
"@agoric/notifier": "0.6.3-dev-01a1123.0+01a1123",
|
|
43
|
+
"@agoric/store": "0.9.3-dev-01a1123.0+01a1123",
|
|
44
|
+
"@agoric/time": "0.3.3-dev-01a1123.0+01a1123",
|
|
45
|
+
"@agoric/vat-data": "0.5.3-dev-01a1123.0+01a1123",
|
|
46
|
+
"@agoric/vats": "0.15.2-dev-01a1123.0+01a1123",
|
|
47
|
+
"@agoric/vow": "0.1.1-dev-01a1123.0+01a1123",
|
|
48
|
+
"@agoric/zoe": "0.26.3-dev-01a1123.0+01a1123",
|
|
49
|
+
"@agoric/zone": "0.2.3-dev-01a1123.0+01a1123",
|
|
50
50
|
"@endo/base64": "^1.0.5",
|
|
51
51
|
"@endo/far": "^1.1.2",
|
|
52
52
|
"@endo/marshal": "^1.5.0",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"typeCoverage": {
|
|
91
91
|
"atLeast": 97.1
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "01a1123a526b11e11fa1ef80e0c532a616cd29b9"
|
|
94
94
|
}
|
package/src/chain-info.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export function registerChain(agoricNamesAdmin: ERef<import("@agoric/vats").NameHubKit["nameAdmin"]>, name: string, chainInfo: CosmosChainInfo, log?: (...messages: string[]) => void): Promise<void>;
|
|
2
|
-
export function registerChainNamespace(agoricNamesAdmin: ERef<import("@agoric/vats").NameHubKit["nameAdmin"]>, log
|
|
1
|
+
export function registerChain(agoricNamesAdmin: ERef<import("@agoric/vats").NameHubKit["nameAdmin"]>, name: string, chainInfo: CosmosChainInfo, log?: ((...messages: string[]) => void) | undefined): Promise<void>;
|
|
2
|
+
export function registerChainNamespace(agoricNamesAdmin: ERef<import("@agoric/vats").NameHubKit["nameAdmin"]>, log?: ((...messages: string[]) => void) | undefined): Promise<void>;
|
|
3
3
|
export type ChainInfo = CosmosChainInfo | EthChainInfo;
|
|
4
4
|
export type KnownChains = typeof knownChains;
|
|
5
5
|
import type { CosmosChainInfo } from './types.js';
|
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":"AAyEO,gDALI,IAAI,CAAC,OAAO,cAAc,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,QACpD,MAAM,aACN,eAAe,
|
|
1
|
+
{"version":3,"file":"chain-info.d.ts","sourceRoot":"","sources":["chain-info.js"],"names":[],"mappings":"AAyEO,gDALI,IAAI,CAAC,OAAO,cAAc,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,QACpD,MAAM,aACN,eAAe,uBACD,MAAM,EAAE,KAAK,IAAI,8BAgCzC;AAMM,yDAHI,IAAI,CAAC,OAAO,cAAc,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,uBACtC,MAAM,EAAE,KAAK,IAAI,8BAMzC;wBAzGa,eAAe,GAAG,YAAY;0BAyD9B,OAAO,WAAW;qCA3DiB,YAAY;kCAAZ,YAAY;AAA7D,iEAAiE;AAEjE,0DAA0D;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqDE"}
|
package/src/chain-info.js
CHANGED
|
@@ -69,7 +69,7 @@ const knownChains = /** @satisfies {Record<string, ChainInfo>} */ (
|
|
|
69
69
|
* @param {ERef<import('@agoric/vats').NameHubKit['nameAdmin']>} agoricNamesAdmin
|
|
70
70
|
* @param {string} name
|
|
71
71
|
* @param {CosmosChainInfo} chainInfo
|
|
72
|
-
* @param {(...messages: string[]) => void} log
|
|
72
|
+
* @param {(...messages: string[]) => void} [log]
|
|
73
73
|
*/
|
|
74
74
|
export const registerChain = async (
|
|
75
75
|
agoricNamesAdmin,
|
|
@@ -105,7 +105,7 @@ export const registerChain = async (
|
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
107
|
* @param {ERef<import('@agoric/vats').NameHubKit['nameAdmin']>} agoricNamesAdmin
|
|
108
|
-
* @param {(...messages: string[]) => void} log
|
|
108
|
+
* @param {(...messages: string[]) => void} [log]
|
|
109
109
|
*/
|
|
110
110
|
export const registerChainNamespace = async (agoricNamesAdmin, log) => {
|
|
111
111
|
for await (const [name, info] of Object.entries(knownChains)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendAnywhere.contract.d.ts","sourceRoot":"","sources":["sendAnywhere.contract.js"],"names":[],"mappings":"AAYA;;;;;;;;GAQG;AAEH;;;;;;;;GAQG;AAEH,kEAKE;AASK,2BANI,GAAG,eACH,mBAAmB,GAAG;IAChC,UAAc,EAAE,UAAU,CAAC;CACxB,WACO,OAAO;;;;;
|
|
1
|
+
{"version":3,"file":"sendAnywhere.contract.d.ts","sourceRoot":"","sources":["sendAnywhere.contract.js"],"names":[],"mappings":"AAYA;;;;;;;;GAQG;AAEH;;;;;;;;GAQG;AAEH,kEAKE;AASK,2BANI,GAAG,eACH,mBAAmB,GAAG;IAChC,UAAc,EAAE,UAAU,CAAC;CACxB,WACO,OAAO;;;;;QA2FZ;;;WAGG;4BAFQ,eAAe,kBACf,iBAAiB;;GAmBjC;kCArIY;IACZ,UAAc,EAAE,OAAO,UAAU,CAAC,CAAC;IACnC,oBAAwB,EAAE,OAAO,oBAAoB,CAAC,CAAC;IACvD,WAAe,EAAE,OAAO,WAAW,CAAC,CAAC;IACrC,YAAgB,EAAE,OAAO,YAAY,CAAC,CAAC;IACvC,WAAe,EAAE,OAAO,OAAO,CAAC,CAAC;CAC9B;6BAhBsB,kBAAkB;qCACS,eAAe;uCAAf,eAAe;gCAEvC,gCAAgC;4BAGpC,aAAa;0CAFC,eAAe;kCAFX,cAAc;6BAG/B,cAAc"}
|
|
@@ -83,11 +83,16 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
83
83
|
// FIXME ok to use a heap var crossing the membrane scope this way?
|
|
84
84
|
if (!contractAccount) {
|
|
85
85
|
const agoricChain = await orch.getChain('agoric');
|
|
86
|
-
|
|
86
|
+
// XXX when() until membrane
|
|
87
|
+
contractAccount = await V.when(agoricChain.makeAccount());
|
|
88
|
+
console.log('contractAccount', contractAccount);
|
|
87
89
|
}
|
|
88
90
|
|
|
89
|
-
|
|
91
|
+
// XXX when() until membrane
|
|
92
|
+
const info = await V.when(chain.getChainInfo());
|
|
93
|
+
console.log('info', info);
|
|
90
94
|
const { chainId } = info;
|
|
95
|
+
assert(typeof chainId === 'string', 'bad chainId');
|
|
91
96
|
const { [kw]: pmtP } = await withdrawFromSeat(zcf, seat, give);
|
|
92
97
|
await E.when(pmtP, pmt => contractAccount.deposit(pmt));
|
|
93
98
|
await contractAccount.transfer(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swapExample.contract.d.ts","sourceRoot":"","sources":["swapExample.contract.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"swapExample.contract.d.ts","sourceRoot":"","sources":["swapExample.contract.js"],"names":[],"mappings":"AAUA;;;;;;;;GAQG;AAEH,yCAAyC;AACzC,mBADW,YAAY,CAAC,OAAO,KAAK,CAAC,CAWnC;AASK,0CAHI,KAAK;;;EAIsC;AAc/C,2BAXI,GAAG,eACH;IACV,WAAe,EAAE,OAAO,OAAO,CAAC,CAAC;IACjC,UAAc,EAAE,OAAO,UAAU,CAAC,CAAC;IACnC,oBAAwB,EAAE,OAAO,oBAAoB,CAAC,CAAC;IACvD,WAAe,EAAE,OAAO,WAAW,CAAC,CAAC;IACrC,YAAgB,EAAE,OAAO,YAAY,CAAC,CAAC;IACvC,UAAc,EAAE,UAAU,CAAC;CACxB,WACO,OAAO;;;oBA+BD,MAAM,CAAC,KAAK,CAAC;uBAAa,sBAAsB;;;;oBAAhD,MAAM,CAAC,KAAK,CAAC;uBAAa,sBAAsB;;;GAsEhE;6BAzIyB,cAAc;4BAHf,kBAAkB;gCADd,gCAAgC;0CAEtB,eAAe;kCAHvB,cAAc;6BAInB,kBAAkB;4CALuB,aAAa"}
|
|
@@ -4,6 +4,7 @@ import { withdrawFromSeat } from '@agoric/zoe/src/contractSupport/zoeHelpers.js'
|
|
|
4
4
|
import { Far } from '@endo/far';
|
|
5
5
|
import { deeplyFulfilled } from '@endo/marshal';
|
|
6
6
|
import { M, objectMap } from '@endo/patterns';
|
|
7
|
+
import { when } from '@agoric/vow/vat.js';
|
|
7
8
|
import { orcUtils } from '../utils/orc.js';
|
|
8
9
|
import { provideOrchestration } from '../utils/start-helper.js';
|
|
9
10
|
|
|
@@ -95,8 +96,10 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
95
96
|
const agoric = await orch.getChain('agoric');
|
|
96
97
|
|
|
97
98
|
const [omniAccount, localAccount] = await Promise.all([
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
// XXX when() until membrane
|
|
100
|
+
when(omni.makeAccount()),
|
|
101
|
+
// XXX when() until membrane
|
|
102
|
+
when(agoric.makeAccount()),
|
|
100
103
|
]);
|
|
101
104
|
|
|
102
105
|
const omniAddress = omniAccount.getAddress();
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export function prepareLocalChainFacade(zone: Zone, { makeLocalOrchestrationAccountKit, localchain, storageNode }: {
|
|
1
|
+
export function prepareLocalChainFacade(zone: Zone, { makeLocalOrchestrationAccountKit, localchain, storageNode, vowTools: { allVows }, }: {
|
|
2
2
|
makeLocalOrchestrationAccountKit: MakeLocalOrchestrationAccountKit;
|
|
3
3
|
orchestration: Remote<OrchestrationService>;
|
|
4
4
|
storageNode: Remote<StorageNode>;
|
|
5
5
|
timer: Remote<TimerService>;
|
|
6
6
|
localchain: Remote<LocalChain>;
|
|
7
|
+
vowTools: VowTools;
|
|
7
8
|
}): (localChainInfo: Readonly<{
|
|
8
9
|
chainId: string;
|
|
9
10
|
connections?: Record<string, IBCConnectionInfo>;
|
|
@@ -12,7 +13,7 @@ export function prepareLocalChainFacade(zone: Zone, { makeLocalOrchestrationAcco
|
|
|
12
13
|
denom: string;
|
|
13
14
|
}>>;
|
|
14
15
|
}>) => import("@endo/exo").Guarded<{
|
|
15
|
-
getChainInfo():
|
|
16
|
+
getChainInfo(): Vow<Readonly<{
|
|
16
17
|
chainId: string;
|
|
17
18
|
connections?: Record<string, IBCConnectionInfo>;
|
|
18
19
|
icqEnabled?: boolean;
|
|
@@ -20,8 +21,8 @@ export function prepareLocalChainFacade(zone: Zone, { makeLocalOrchestrationAcco
|
|
|
20
21
|
denom: string;
|
|
21
22
|
}>>;
|
|
22
23
|
}>>;
|
|
23
|
-
/** @returns {
|
|
24
|
-
makeAccount():
|
|
24
|
+
/** @returns {Vow<OrchestrationAccount<ChainInfo>>} */
|
|
25
|
+
makeAccount(): Vow<OrchestrationAccount<ChainInfo>>;
|
|
25
26
|
}>;
|
|
26
27
|
export type MakeLocalChainFacade = ReturnType<typeof prepareLocalChainFacade>;
|
|
27
28
|
import type { Zone } from '@agoric/base-zone';
|
|
@@ -30,7 +31,9 @@ import type { OrchestrationService } from '../service.js';
|
|
|
30
31
|
import type { Remote } from '@agoric/internal';
|
|
31
32
|
import type { TimerService } from '@agoric/time';
|
|
32
33
|
import type { LocalChain } from '@agoric/vats/src/localchain.js';
|
|
34
|
+
import type { VowTools } from '@agoric/vow';
|
|
33
35
|
import type { IBCConnectionInfo } from '../types.js';
|
|
36
|
+
import type { Vow } from '@agoric/vow';
|
|
34
37
|
import type { ChainInfo } from '../types.js';
|
|
35
38
|
import type { OrchestrationAccount } from '../types.js';
|
|
36
39
|
//# sourceMappingURL=local-chain-facade.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-chain-facade.d.ts","sourceRoot":"","sources":["local-chain-facade.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"local-chain-facade.d.ts","sourceRoot":"","sources":["local-chain-facade.js"],"names":[],"mappings":"AA2BO,8CAVI,IAAI,yFACJ;IACV,gCAAoC,EAAE,gCAAgC,CAAC;IACvE,aAAiB,EAAE,OAAO,oBAAoB,CAAC,CAAC;IAChD,WAAe,EAAE,OAAO,WAAW,CAAC,CAAC;IACrC,KAAS,EAAE,OAAO,YAAY,CAAC,CAAC;IAChC,UAAc,EAAE,OAAO,UAAU,CAAC,CAAC;IACnC,QAAY,EAAE,QAAQ,CAAC;CACpB;;;;;;;;;;;;;;;;IA2BE,sDAAsD;mBAAxC,IAAI,qBAAqB,SAAS,CAAC,CAAC;GAsBrD;mCAEW,UAAU,CAAC,OAAO,uBAAuB,CAAC;0BAtEjC,mBAAmB;sDAMS,kCAAkC;0CAD9C,eAAe;4BAH7B,kBAAkB;kCADZ,cAAc;gCAEhB,gCAAgC;8BAC7B,aAAa;uCAGyC,aAAa;yBAHnE,aAAa;+BAGyC,aAAa;0CAAb,aAAa"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @file ChainAccount exo */
|
|
2
|
-
import { V } from '@agoric/vow/vat.js';
|
|
2
|
+
import { V, watch } from '@agoric/vow/vat.js';
|
|
3
3
|
|
|
4
4
|
import { ChainFacadeI } from '../typeGuards.js';
|
|
5
5
|
|
|
@@ -8,6 +8,7 @@ import { ChainFacadeI } from '../typeGuards.js';
|
|
|
8
8
|
* @import {TimerService} from '@agoric/time';
|
|
9
9
|
* @import {Remote} from '@agoric/internal';
|
|
10
10
|
* @import {LocalChain} from '@agoric/vats/src/localchain.js';
|
|
11
|
+
* @import {Vow, VowTools} from '@agoric/vow';
|
|
11
12
|
* @import {OrchestrationService} from '../service.js';
|
|
12
13
|
* @import {MakeLocalOrchestrationAccountKit} from './local-orchestration-account.js';
|
|
13
14
|
* @import {ChainInfo, CosmosChainInfo, IBCConnectionInfo, OrchestrationAccount} from '../types.js';
|
|
@@ -21,11 +22,17 @@ import { ChainFacadeI } from '../typeGuards.js';
|
|
|
21
22
|
* storageNode: Remote<StorageNode>;
|
|
22
23
|
* timer: Remote<TimerService>;
|
|
23
24
|
* localchain: Remote<LocalChain>;
|
|
25
|
+
* vowTools: VowTools;
|
|
24
26
|
* }} powers
|
|
25
27
|
*/
|
|
26
28
|
export const prepareLocalChainFacade = (
|
|
27
29
|
zone,
|
|
28
|
-
{
|
|
30
|
+
{
|
|
31
|
+
makeLocalOrchestrationAccountKit,
|
|
32
|
+
localchain,
|
|
33
|
+
storageNode,
|
|
34
|
+
vowTools: { allVows },
|
|
35
|
+
},
|
|
29
36
|
) =>
|
|
30
37
|
zone.exoClass(
|
|
31
38
|
'LocalChainFacade',
|
|
@@ -37,29 +44,32 @@ export const prepareLocalChainFacade = (
|
|
|
37
44
|
return { localChainInfo };
|
|
38
45
|
},
|
|
39
46
|
{
|
|
40
|
-
|
|
41
|
-
return this.state.localChainInfo;
|
|
47
|
+
getChainInfo() {
|
|
48
|
+
return watch(this.state.localChainInfo);
|
|
42
49
|
},
|
|
43
50
|
|
|
44
51
|
// FIXME parameterize on the remoteChainInfo to make()
|
|
45
52
|
// That used to work but got lost in the migration to Exo
|
|
46
|
-
/** @returns {
|
|
47
|
-
|
|
53
|
+
/** @returns {Vow<OrchestrationAccount<ChainInfo>>} */
|
|
54
|
+
makeAccount() {
|
|
48
55
|
const { localChainInfo } = this.state;
|
|
49
56
|
const lcaP = V(localchain).makeAccount();
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
// FIXME use watch() from vowTools
|
|
58
|
+
return watch(allVows([lcaP, V(lcaP).getAddress()]), {
|
|
59
|
+
onFulfilled: ([lca, address]) => {
|
|
60
|
+
const { holder: account } = makeLocalOrchestrationAccountKit({
|
|
61
|
+
account: lca,
|
|
62
|
+
address: harden({
|
|
63
|
+
address,
|
|
64
|
+
addressEncoding: 'bech32',
|
|
65
|
+
chainId: localChainInfo.chainId,
|
|
66
|
+
}),
|
|
67
|
+
// FIXME storage path https://github.com/Agoric/agoric-sdk/issues/9066
|
|
68
|
+
storageNode,
|
|
69
|
+
});
|
|
70
|
+
return account;
|
|
71
|
+
},
|
|
60
72
|
});
|
|
61
|
-
|
|
62
|
-
return account;
|
|
63
73
|
},
|
|
64
74
|
},
|
|
65
75
|
);
|
|
@@ -22,7 +22,7 @@ export function prepareOrchestratorKit(zone: Zone, { chainHub, localchain, makeL
|
|
|
22
22
|
makeLocalChainFacadeWatcher: {
|
|
23
23
|
/** @param {ChainInfo} agoricChainInfo */
|
|
24
24
|
onFulfilled(agoricChainInfo: ChainInfo): import("@endo/exo").Guarded<{
|
|
25
|
-
getChainInfo():
|
|
25
|
+
getChainInfo(): Vow<Readonly<{
|
|
26
26
|
chainId: string;
|
|
27
27
|
connections?: Record<string, IBCConnectionInfo>;
|
|
28
28
|
icqEnabled?: boolean;
|
|
@@ -30,7 +30,7 @@ export function prepareOrchestratorKit(zone: Zone, { chainHub, localchain, makeL
|
|
|
30
30
|
denom: string;
|
|
31
31
|
}>>;
|
|
32
32
|
}>>;
|
|
33
|
-
makeAccount():
|
|
33
|
+
makeAccount(): Vow<OrchestrationAccount<ChainInfo>>;
|
|
34
34
|
}>;
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
@@ -45,7 +45,7 @@ export function prepareOrchestratorKit(zone: Zone, { chainHub, localchain, makeL
|
|
|
45
45
|
* @param {[ChainInfo, ChainInfo, IBCConnectionInfo]} chainsAndConnection
|
|
46
46
|
*/
|
|
47
47
|
onFulfilled([_agoricChainInfo, remoteChainInfo, connectionInfo]: [ChainInfo, ChainInfo, IBCConnectionInfo]): import("@endo/exo").Guarded<{
|
|
48
|
-
getChainInfo():
|
|
48
|
+
getChainInfo(): Vow<Readonly<{
|
|
49
49
|
chainId: string;
|
|
50
50
|
connections?: Record<string, IBCConnectionInfo>;
|
|
51
51
|
icqEnabled?: boolean;
|
|
@@ -53,7 +53,7 @@ export function prepareOrchestratorKit(zone: Zone, { chainHub, localchain, makeL
|
|
|
53
53
|
denom: string;
|
|
54
54
|
}>>;
|
|
55
55
|
}>>;
|
|
56
|
-
makeAccount():
|
|
56
|
+
makeAccount(): Vow<OrchestrationAccount<ChainInfo>>;
|
|
57
57
|
}>;
|
|
58
58
|
};
|
|
59
59
|
orchestrator: {
|
|
@@ -84,6 +84,7 @@ import type { TimerService } from '@agoric/time';
|
|
|
84
84
|
import type { VowTools } from '@agoric/vow';
|
|
85
85
|
import type { ChainInfo } from '../types.js';
|
|
86
86
|
import type { IBCConnectionInfo } from '../types.js';
|
|
87
|
+
import type { Vow } from '@agoric/vow';
|
|
87
88
|
import type { OrchestrationAccount } from '../types.js';
|
|
88
89
|
import type { Chain } from '../types.js';
|
|
89
90
|
//# sourceMappingURL=orchestrator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["orchestrator.js"],"names":[],"mappings":"AAiCA,0BAA0B;AAC1B;;;;;GAKG;AAkBI,6CAfI,IAAI,qGACJ;IACV,cAAkB,EAAE,cAAc,CAAC;IACnC,QAAY,EAAE,QAAQ,CAAC;IACvB,UAAc,EAAE,OAAO,UAAU,CAAC,CAAC;IACnC,eAAmB,EAAE,eAAe,CAAC;IACrC,oBAAwB,EAAE,oBAAoB,CAAC;IAC/C,qBAAyB,EAAE,qBAAqB,CAAC;IACjD,oBAAwB,EAAE,OAAO,oBAAoB,CAAC,CAAC;IACvD,WAAe,EAAE,OAAO,WAAW,CAAC,CAAC;IACrC,YAAgB,EAAE,OAAO,YAAY,CAAC,CAAC;IACvC,QAAY,EAAE,QAAQ,CAAC;IACvB,GAAO,EAAE,GAAG,CAAC;CACV;IAmCE,2DAA2D;;QAEzD,yCAAyC;;;;;;;;;;;;;IAK3C;;;OAGG;;QAED;;;;;WAKG;;;;;;;;;;;;;;QAMH,uCAAuC;;;;;;;;;;;;;GA0B5C;0BA7HoB,mBAAmB;oCAET,oBAAoB;8BAD1B,gBAAgB;gCAId,gCAAgC;4BAEpC,kBAAkB;qCADI,6CAA6C;0CAKrD,yBAAyB;2CACxB,0BAA0B;0CAH3B,eAAe;kCALvB,cAAc;8BADb,aAAa;+BAU8D,aAAa;uCAAb,aAAa;
|
|
1
|
+
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["orchestrator.js"],"names":[],"mappings":"AAiCA,0BAA0B;AAC1B;;;;;GAKG;AAkBI,6CAfI,IAAI,qGACJ;IACV,cAAkB,EAAE,cAAc,CAAC;IACnC,QAAY,EAAE,QAAQ,CAAC;IACvB,UAAc,EAAE,OAAO,UAAU,CAAC,CAAC;IACnC,eAAmB,EAAE,eAAe,CAAC;IACrC,oBAAwB,EAAE,oBAAoB,CAAC;IAC/C,qBAAyB,EAAE,qBAAqB,CAAC;IACjD,oBAAwB,EAAE,OAAO,oBAAoB,CAAC,CAAC;IACvD,WAAe,EAAE,OAAO,WAAW,CAAC,CAAC;IACrC,YAAgB,EAAE,OAAO,YAAY,CAAC,CAAC;IACvC,QAAY,EAAE,QAAQ,CAAC;IACvB,GAAO,EAAE,GAAG,CAAC;CACV;IAmCE,2DAA2D;;QAEzD,yCAAyC;;;;;;;;;;;;;IAK3C;;;OAGG;;QAED;;;;;WAKG;;;;;;;;;;;;;;QAMH,uCAAuC;;;;;;;;;;;;;GA0B5C;0BA7HoB,mBAAmB;oCAET,oBAAoB;8BAD1B,gBAAgB;gCAId,gCAAgC;4BAEpC,kBAAkB;qCADI,6CAA6C;0CAKrD,yBAAyB;2CACxB,0BAA0B;0CAH3B,eAAe;kCALvB,cAAc;8BADb,aAAa;+BAU8D,aAAa;uCAAb,aAAa;yBAVxF,aAAa;0CAU8D,aAAa;2BAAb,aAAa"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export function prepareRemoteChainFacade(zone: Zone, { makeCosmosOrchestrationAccount, orchestration, storageNode, timer }: {
|
|
1
|
+
export function prepareRemoteChainFacade(zone: Zone, { makeCosmosOrchestrationAccount, orchestration, storageNode, timer, vowTools: { allVows }, }: {
|
|
2
2
|
makeCosmosOrchestrationAccount: ReturnType<typeof prepareCosmosOrchestrationAccount>;
|
|
3
3
|
orchestration: Remote<OrchestrationService>;
|
|
4
4
|
storageNode: Remote<StorageNode>;
|
|
5
5
|
timer: Remote<TimerService>;
|
|
6
|
+
vowTools: VowTools;
|
|
6
7
|
}): (remoteChainInfo: Readonly<{
|
|
7
8
|
chainId: string;
|
|
8
9
|
connections?: Record<string, IBCConnectionInfo>;
|
|
@@ -11,7 +12,7 @@ export function prepareRemoteChainFacade(zone: Zone, { makeCosmosOrchestrationAc
|
|
|
11
12
|
denom: string;
|
|
12
13
|
}>>;
|
|
13
14
|
}>, connectionInfo: IBCConnectionInfo) => import("@endo/exo").Guarded<{
|
|
14
|
-
getChainInfo():
|
|
15
|
+
getChainInfo(): Vow<Readonly<{
|
|
15
16
|
chainId: string;
|
|
16
17
|
connections?: Record<string, IBCConnectionInfo>;
|
|
17
18
|
icqEnabled?: boolean;
|
|
@@ -19,8 +20,8 @@ export function prepareRemoteChainFacade(zone: Zone, { makeCosmosOrchestrationAc
|
|
|
19
20
|
denom: string;
|
|
20
21
|
}>>;
|
|
21
22
|
}>>;
|
|
22
|
-
/** @returns {
|
|
23
|
-
makeAccount():
|
|
23
|
+
/** @returns {Vow<OrchestrationAccount<ChainInfo>>} */
|
|
24
|
+
makeAccount(): Vow<OrchestrationAccount<ChainInfo>>;
|
|
24
25
|
}>;
|
|
25
26
|
export type MakeRemoteChainFacade = ReturnType<typeof prepareRemoteChainFacade>;
|
|
26
27
|
import type { Zone } from '@agoric/base-zone';
|
|
@@ -28,7 +29,9 @@ import type { prepareCosmosOrchestrationAccount } from './cosmos-orchestration-a
|
|
|
28
29
|
import type { OrchestrationService } from '../service.js';
|
|
29
30
|
import type { Remote } from '@agoric/internal';
|
|
30
31
|
import type { TimerService } from '@agoric/time';
|
|
32
|
+
import type { VowTools } from '@agoric/vow';
|
|
31
33
|
import type { IBCConnectionInfo } from '../types.js';
|
|
34
|
+
import type { Vow } from '@agoric/vow';
|
|
32
35
|
import type { ChainInfo } from '../types.js';
|
|
33
36
|
import type { OrchestrationAccount } from '../types.js';
|
|
34
37
|
//# sourceMappingURL=remote-chain-facade.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-chain-facade.d.ts","sourceRoot":"","sources":["remote-chain-facade.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"remote-chain-facade.d.ts","sourceRoot":"","sources":["remote-chain-facade.js"],"names":[],"mappings":"AAkCO,+CAXI,IAAI,iGACJ;IACV,8BAAkC,EAAE,UAAU,CAC9C,wCAA8C,CACzC,CAAC;IACN,aAAiB,EAAE,OAAO,oBAAoB,CAAC,CAAC;IAChD,WAAe,EAAE,OAAO,WAAW,CAAC,CAAC;IACrC,KAAS,EAAE,OAAO,YAAY,CAAC,CAAC;IAChC,QAAY,EAAE,QAAQ,CAAC;CACpB;;;;;;;;;;;;;;;;IA8BE,sDAAsD;mBAAxC,IAAI,qBAAqB,SAAS,CAAC,CAAC;GA6BrD;oCAEW,UAAU,CAAC,OAAO,wBAAwB,CAAC;0BAtFlC,mBAAmB;uDAKU,mCAAmC;0CADhD,eAAe;4BAF7B,kBAAkB;kCADZ,cAAc;8BAEb,aAAa;uCAGyC,aAAa;yBAHnE,aAAa;+BAGyC,aAAa;0CAAb,aAAa"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @file ChainAccount exo */
|
|
2
2
|
import { makeTracer } from '@agoric/internal';
|
|
3
|
-
import { V } from '@agoric/vow/vat.js';
|
|
3
|
+
import { V, watch } from '@agoric/vow/vat.js';
|
|
4
4
|
|
|
5
5
|
import { ChainFacadeI } from '../typeGuards.js';
|
|
6
6
|
|
|
@@ -8,6 +8,7 @@ import { ChainFacadeI } from '../typeGuards.js';
|
|
|
8
8
|
* @import {Zone} from '@agoric/base-zone';
|
|
9
9
|
* @import {TimerService} from '@agoric/time';
|
|
10
10
|
* @import {Remote} from '@agoric/internal';
|
|
11
|
+
* @import {Vow, VowTools} from '@agoric/vow';
|
|
11
12
|
* @import {OrchestrationService} from '../service.js';
|
|
12
13
|
* @import {prepareCosmosOrchestrationAccount} from './cosmos-orchestration-account.js';
|
|
13
14
|
* @import {ChainInfo, CosmosChainInfo, IBCConnectionInfo, OrchestrationAccount} from '../types.js';
|
|
@@ -28,11 +29,18 @@ const anyVal = null;
|
|
|
28
29
|
* orchestration: Remote<OrchestrationService>;
|
|
29
30
|
* storageNode: Remote<StorageNode>;
|
|
30
31
|
* timer: Remote<TimerService>;
|
|
32
|
+
* vowTools: VowTools;
|
|
31
33
|
* }} powers
|
|
32
34
|
*/
|
|
33
35
|
export const prepareRemoteChainFacade = (
|
|
34
36
|
zone,
|
|
35
|
-
{
|
|
37
|
+
{
|
|
38
|
+
makeCosmosOrchestrationAccount,
|
|
39
|
+
orchestration,
|
|
40
|
+
storageNode,
|
|
41
|
+
timer,
|
|
42
|
+
vowTools: { allVows },
|
|
43
|
+
},
|
|
36
44
|
) =>
|
|
37
45
|
zone.exoClass(
|
|
38
46
|
'RemoteChainFacade',
|
|
@@ -46,33 +54,38 @@ export const prepareRemoteChainFacade = (
|
|
|
46
54
|
return { remoteChainInfo, connectionInfo };
|
|
47
55
|
},
|
|
48
56
|
{
|
|
49
|
-
|
|
50
|
-
return this.state.remoteChainInfo;
|
|
57
|
+
getChainInfo() {
|
|
58
|
+
return watch(this.state.remoteChainInfo);
|
|
51
59
|
},
|
|
52
60
|
|
|
53
61
|
// FIXME parameterize on the remoteChainInfo to make()
|
|
54
62
|
// That used to work but got lost in the migration to Exo
|
|
55
|
-
/** @returns {
|
|
56
|
-
|
|
63
|
+
/** @returns {Vow<OrchestrationAccount<ChainInfo>>} */
|
|
64
|
+
makeAccount() {
|
|
57
65
|
const { remoteChainInfo, connectionInfo } = this.state;
|
|
66
|
+
const stakingDenom = remoteChainInfo.stakingTokens?.[0]?.denom;
|
|
67
|
+
if (!stakingDenom) {
|
|
68
|
+
// FIXME methods that return vows must not throw synchronously
|
|
69
|
+
throw Fail`chain info lacks staking denom`;
|
|
70
|
+
}
|
|
58
71
|
|
|
59
|
-
const
|
|
72
|
+
const icaP = V(orchestration).makeAccount(
|
|
60
73
|
remoteChainInfo.chainId,
|
|
61
74
|
connectionInfo.id,
|
|
62
75
|
connectionInfo.counterparty.connection_id,
|
|
63
76
|
);
|
|
64
77
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
// FIXME use watch() from vowTools
|
|
79
|
+
return watch(allVows([icaP, V(icaP).getAddress()]), {
|
|
80
|
+
onFulfilled: ([account, address]) => {
|
|
81
|
+
return makeCosmosOrchestrationAccount(address, stakingDenom, {
|
|
82
|
+
account,
|
|
83
|
+
storageNode,
|
|
84
|
+
// FIXME provide real ICQ connection
|
|
85
|
+
icqConnection: anyVal,
|
|
86
|
+
timer,
|
|
87
|
+
});
|
|
88
|
+
},
|
|
76
89
|
});
|
|
77
90
|
},
|
|
78
91
|
},
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function reviseChainInfo({ consume: { agoricNamesAdmin } }: BootstrapPowers, { options: { chainInfo } }: {
|
|
2
|
+
options: {
|
|
3
|
+
chainInfo: Record<string, CosmosChainInfo>;
|
|
4
|
+
};
|
|
5
|
+
}): Promise<void>;
|
|
6
|
+
export function getManifestForReviseChains(_powers: any, { chainInfo }: {
|
|
7
|
+
chainInfo: any;
|
|
8
|
+
}): {
|
|
9
|
+
manifest: {
|
|
10
|
+
[x: string]: {
|
|
11
|
+
consume: {
|
|
12
|
+
agoricNamesAdmin: boolean;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
options: {
|
|
17
|
+
chainInfo: any;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
import type { CosmosChainInfo } from '../types.js';
|
|
21
|
+
//# sourceMappingURL=revise-chain-info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revise-chain-info.d.ts","sourceRoot":"","sources":["revise-chain-info.js"],"names":[],"mappings":"AAeO,mEAHI,eAAe,8BACf;IAAE,OAAO,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;KAAE,CAAA;CAAE,iBAgBrE;AAGM;;;;;;;;;;;;;EAWL;qCAtCiC,aAAa"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { makeTracer } from '@agoric/internal';
|
|
2
|
+
import { registerChain } from '../chain-info.js';
|
|
3
|
+
|
|
4
|
+
const trace = makeTracer('ReviseChainInfo', true);
|
|
5
|
+
|
|
6
|
+
/** @import {CosmosChainInfo} from '../types.js'; */
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* This will add news values AND overwrite any existing values. Voters on a
|
|
10
|
+
* proposal of core-eval must be careful not to overwrite any values operating
|
|
11
|
+
* in production.
|
|
12
|
+
*
|
|
13
|
+
* @param {BootstrapPowers} powers
|
|
14
|
+
* @param {{ options: { chainInfo: Record<string, CosmosChainInfo> } }} opt
|
|
15
|
+
*/
|
|
16
|
+
export const reviseChainInfo = async (
|
|
17
|
+
{ consume: { agoricNamesAdmin } },
|
|
18
|
+
{ options: { chainInfo } },
|
|
19
|
+
) => {
|
|
20
|
+
trace('init-chainInfo');
|
|
21
|
+
|
|
22
|
+
assert(chainInfo, 'chainInfo is required');
|
|
23
|
+
|
|
24
|
+
trace(chainInfo);
|
|
25
|
+
|
|
26
|
+
// Now register the names
|
|
27
|
+
for await (const [name, info] of Object.entries(chainInfo)) {
|
|
28
|
+
await registerChain(agoricNamesAdmin, name, info, trace);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
harden(reviseChainInfo);
|
|
32
|
+
|
|
33
|
+
export const getManifestForReviseChains = (_powers, { chainInfo }) => ({
|
|
34
|
+
manifest: {
|
|
35
|
+
[reviseChainInfo.name]: {
|
|
36
|
+
consume: {
|
|
37
|
+
agoricNamesAdmin: true,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
options: {
|
|
42
|
+
chainInfo,
|
|
43
|
+
},
|
|
44
|
+
});
|
package/src/typeGuards.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeGuards.d.ts","sourceRoot":"","sources":["typeGuards.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typeGuards.d.ts","sourceRoot":"","sources":["typeGuards.js"],"names":[],"mappings":"AAIA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;AAiBH,8DAAkE;;;;;AAOlE,uEAUE;AAEF,iEAA4C;AAC5C,mEAQG;AACH,oEAA+C;AAC/C,sEAYG;AAEH,oEAUE;AAGF,8DAAsC;AACtC,sEAAuE;AACvE,0DAAqC;AAErC,8DAAsC;;;;;;AAItC,mBAAmB;AACnB;;;GAGG"}
|
package/src/typeGuards.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AmountShape } from '@agoric/ertp';
|
|
2
|
+
import { VowShape } from '@agoric/vow';
|
|
2
3
|
import { M } from '@endo/patterns';
|
|
3
4
|
|
|
4
5
|
export const ConnectionHandlerI = M.interface('ConnectionHandler', {
|
|
@@ -89,6 +90,6 @@ export const DenomAmountShape = { denom: DenomShape, value: M.bigint() };
|
|
|
89
90
|
|
|
90
91
|
/** @see {Chain} */
|
|
91
92
|
export const ChainFacadeI = M.interface('ChainFacade', {
|
|
92
|
-
getChainInfo: M.
|
|
93
|
-
makeAccount: M.
|
|
93
|
+
getChainInfo: M.call().returns(VowShape),
|
|
94
|
+
makeAccount: M.call().returns(VowShape),
|
|
94
95
|
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function convertChainInfo(registry: Pick<ChainRegistryClient, "chains" | "ibcData">): Promise<{
|
|
2
|
+
[k: string]: Readonly<{
|
|
3
|
+
chainId: string;
|
|
4
|
+
connections?: Record<string, IBCConnectionInfo>;
|
|
5
|
+
icqEnabled?: boolean;
|
|
6
|
+
stakingTokens?: Readonly<Array<{
|
|
7
|
+
denom: string;
|
|
8
|
+
}>>;
|
|
9
|
+
}>;
|
|
10
|
+
}>;
|
|
11
|
+
import type { ChainRegistryClient } from '@chain-registry/client';
|
|
12
|
+
import type { IBCConnectionInfo } from '../cosmos-api.js';
|
|
13
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["registry.js"],"names":[],"mappings":"AAwFO,2CAFI,IAAI,CAAC,mBAAmB,EAAE,QAAQ,GAAG,SAAS,CAAC;;;;;;;;;GA4CzD;yCAxHqC,wBAAwB;uCACT,kBAAkB"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import {
|
|
2
|
+
State as IBCChannelState,
|
|
3
|
+
Order,
|
|
4
|
+
} from '@agoric/cosmic-proto/ibc/core/channel/v1/channel.js';
|
|
5
|
+
import { State as IBCConnectionState } from '@agoric/cosmic-proto/ibc/core/connection/v1/connection.js';
|
|
6
|
+
import assert from 'node:assert';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @import {IBCChannelID, IBCConnectionID} from '@agoric/vats';
|
|
10
|
+
* @import {Chain, IBCInfo} from '@chain-registry/types';
|
|
11
|
+
* @import {ChainRegistryClient} from '@chain-registry/client';
|
|
12
|
+
* @import {CosmosChainInfo, IBCConnectionInfo} from '../cosmos-api.js';
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {IBCInfo} ibcInfo
|
|
17
|
+
* @param {string} name
|
|
18
|
+
* @param {Record<string, CosmosChainInfo>} chainInfo
|
|
19
|
+
* @returns {[string, IBCConnectionInfo] | []}
|
|
20
|
+
*/
|
|
21
|
+
function toConnectionEntry(ibcInfo, name, chainInfo) {
|
|
22
|
+
// IbcInfo encodes the undirected edge as a tuple of (chain_1, chain_2) in alphabetical order
|
|
23
|
+
const fromChain1 = ibcInfo.chain_1.chain_name === name;
|
|
24
|
+
const [from, to] = fromChain1
|
|
25
|
+
? [ibcInfo.chain_1, ibcInfo.chain_2]
|
|
26
|
+
: [ibcInfo.chain_2, ibcInfo.chain_1];
|
|
27
|
+
assert.equal(from.chain_name, name);
|
|
28
|
+
const transferChannels = ibcInfo.channels.filter(
|
|
29
|
+
c =>
|
|
30
|
+
c.chain_1.port_id === 'transfer' &&
|
|
31
|
+
// @ts-expect-error tags does not specify keys
|
|
32
|
+
c.tags?.preferred,
|
|
33
|
+
);
|
|
34
|
+
if (transferChannels.length === 0) {
|
|
35
|
+
console.warn(
|
|
36
|
+
'no transfer channel for [',
|
|
37
|
+
from.chain_name,
|
|
38
|
+
to.chain_name,
|
|
39
|
+
']',
|
|
40
|
+
'(skipping)',
|
|
41
|
+
);
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
if (transferChannels.length > 1) {
|
|
45
|
+
console.warn(
|
|
46
|
+
'multiple preferred transfer channels [',
|
|
47
|
+
from.chain_name,
|
|
48
|
+
to.chain_name,
|
|
49
|
+
']:',
|
|
50
|
+
transferChannels,
|
|
51
|
+
'(choosing first)',
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
const [channel] = transferChannels;
|
|
55
|
+
const [channelFrom, channelTo] = fromChain1
|
|
56
|
+
? [channel.chain_2, channel.chain_1]
|
|
57
|
+
: [channel.chain_1, channel.chain_2];
|
|
58
|
+
const record = {
|
|
59
|
+
id: /** @type {IBCConnectionID} */ (from.connection_id),
|
|
60
|
+
client_id: from.client_id,
|
|
61
|
+
counterparty: {
|
|
62
|
+
client_id: to.client_id,
|
|
63
|
+
connection_id: /** @type {IBCConnectionID} */ (to.connection_id),
|
|
64
|
+
prefix: {
|
|
65
|
+
key_prefix: 'FIXME',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
state: IBCConnectionState.STATE_OPEN, // XXX presumably
|
|
69
|
+
transferChannel: {
|
|
70
|
+
channelId: /** @type {IBCChannelID} */ (channelFrom.channel_id),
|
|
71
|
+
portId: channelFrom.port_id,
|
|
72
|
+
counterPartyChannelId: /** @type {IBCChannelID} */ (channelTo.channel_id),
|
|
73
|
+
counterPartyPortId: channelTo.port_id,
|
|
74
|
+
// FIXME mapping, our guard expects a numerical enum
|
|
75
|
+
ordering: Order.ORDER_NONE_UNSPECIFIED,
|
|
76
|
+
state: IBCChannelState.STATE_OPEN, // XXX presumably
|
|
77
|
+
version: channel.version,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
const destChainId = chainInfo[to.chain_name].chainId;
|
|
81
|
+
return [destChainId, record];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Converts the given chain info to our local config format
|
|
86
|
+
*
|
|
87
|
+
* @param {Pick<ChainRegistryClient, 'chains' | 'ibcData'>} registry
|
|
88
|
+
*/
|
|
89
|
+
export const convertChainInfo = async registry => {
|
|
90
|
+
/** @type {Record<string, CosmosChainInfo>} */
|
|
91
|
+
const chainInfo = {};
|
|
92
|
+
|
|
93
|
+
for (const chain of registry.chains) {
|
|
94
|
+
console.log('processing info', chain.chain_name);
|
|
95
|
+
chainInfo[chain.chain_name] = {
|
|
96
|
+
chainId: chain.chain_id,
|
|
97
|
+
stakingTokens: chain.staking?.staking_tokens,
|
|
98
|
+
// UNTIL https://github.com/Agoric/agoric-sdk/issues/9326
|
|
99
|
+
icqEnabled: chain.chain_name === 'osmosis',
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// XXX probably easier to keep ibc separate
|
|
104
|
+
const ibcLookup = {};
|
|
105
|
+
for (const ibc of registry.ibcData) {
|
|
106
|
+
ibcLookup[ibc.chain_1.chain_name] ||= [];
|
|
107
|
+
ibcLookup[ibc.chain_2.chain_name] ||= [];
|
|
108
|
+
|
|
109
|
+
ibcLookup[ibc.chain_1.chain_name].push(ibc);
|
|
110
|
+
ibcLookup[ibc.chain_2.chain_name].push(ibc);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const chainNames = registry.chains.map(c => c.chain_name).sort();
|
|
114
|
+
|
|
115
|
+
// iterate this after chainInfo is filled out
|
|
116
|
+
for (const name of chainNames) {
|
|
117
|
+
console.log('processing connections', name);
|
|
118
|
+
|
|
119
|
+
const ibcData = ibcLookup[name];
|
|
120
|
+
const connections = Object.fromEntries(
|
|
121
|
+
ibcData
|
|
122
|
+
.map(datum => toConnectionEntry(datum, name, chainInfo))
|
|
123
|
+
// sort alphabetically for consistency
|
|
124
|
+
.sort(([a], [b]) => (a && b ? a.localeCompare(b) : 0)),
|
|
125
|
+
);
|
|
126
|
+
chainInfo[name] = { ...chainInfo[name], connections };
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// return object with insertion in alphabetical order of chain name
|
|
130
|
+
return Object.fromEntries(chainNames.map(name => [name, chainInfo[name]]));
|
|
131
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-helper.d.ts","sourceRoot":"","sources":["start-helper.js"],"names":[],"mappings":"AAwCO,0CALI,GAAG,WACH,OAAO,gBACP,mBAAmB,cACnB,UAAU;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"start-helper.d.ts","sourceRoot":"","sources":["start-helper.js"],"names":[],"mappings":"AAwCO,0CALI,GAAG,WACH,OAAO,gBACP,mBAAmB,cACnB,UAAU;;;;;;;;;;;;;iKA4DT,GAAa,kCAED,GACxB;EAKC;kCApFY;IACZ,UAAc,EAAE,OAAO,UAAU,CAAC,CAAC;IACnC,oBAAwB,EAAE,OAAO,oBAAoB,CAAC,CAAC;IACvD,WAAe,EAAE,OAAO,WAAW,CAAC,CAAC;IACrC,YAAgB,EAAE,OAAO,YAAY,CAAC,CAAC;IACvC,WAAe,EAAE,OAAO,OAAO,CAAC,CAAC;CAC9B;6BAbsB,kBAAkB;gCAFf,gCAAgC;4BAIpC,aAAa;0CACC,eAAe;kCAJX,cAAc;6BAE/B,cAAc"}
|
|
@@ -77,6 +77,7 @@ export const provideOrchestration = (
|
|
|
77
77
|
orchestration: remotePowers.orchestrationService,
|
|
78
78
|
storageNode: remotePowers.storageNode,
|
|
79
79
|
timer: remotePowers.timerService,
|
|
80
|
+
vowTools,
|
|
80
81
|
});
|
|
81
82
|
|
|
82
83
|
const makeLocalChainFacade = prepareLocalChainFacade(zone, {
|
|
@@ -86,6 +87,7 @@ export const provideOrchestration = (
|
|
|
86
87
|
storageNode: remotePowers.storageNode,
|
|
87
88
|
orchestration: remotePowers.orchestrationService,
|
|
88
89
|
timer: remotePowers.timerService,
|
|
90
|
+
vowTools,
|
|
89
91
|
});
|
|
90
92
|
|
|
91
93
|
const facade = makeOrchestrationFacade({
|