@agoric/orchestration 0.1.1-dev-4687f0d.0 → 0.1.1-dev-0282e58.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.
Files changed (37) hide show
  1. package/package.json +15 -15
  2. package/src/chain-info.d.ts +334 -74
  3. package/src/chain-info.d.ts.map +1 -1
  4. package/src/chain-info.js +3 -1
  5. package/src/examples/sendAnywhere.contract.d.ts +1 -1
  6. package/src/examples/stakeIca.contract.d.ts +3 -1
  7. package/src/examples/stakeIca.contract.d.ts.map +1 -1
  8. package/src/examples/stakeIca.contract.js +4 -2
  9. package/src/examples/swapExample.contract.d.ts +1 -1
  10. package/src/examples/swapExample.contract.d.ts.map +1 -1
  11. package/src/examples/swapExample.contract.js +7 -7
  12. package/src/examples/unbondExample.contract.d.ts +2 -3
  13. package/src/examples/unbondExample.contract.d.ts.map +1 -1
  14. package/src/examples/unbondExample.contract.js +3 -3
  15. package/src/exos/chainAccountKit.d.ts +2 -1
  16. package/src/exos/chainAccountKit.d.ts.map +1 -1
  17. package/src/exos/chainAccountKit.js +5 -4
  18. package/src/exos/local-chain-account-kit.d.ts +346 -85
  19. package/src/exos/local-chain-account-kit.d.ts.map +1 -1
  20. package/src/facade.d.ts +1 -1
  21. package/src/facade.d.ts.map +1 -1
  22. package/src/facade.js +20 -14
  23. package/src/fetched-chain-info.d.ts +1935 -2984
  24. package/src/fetched-chain-info.js +335 -73
  25. package/src/proposals/orchestration-proposal.d.ts +10 -6
  26. package/src/proposals/orchestration-proposal.d.ts.map +1 -1
  27. package/src/proposals/orchestration-proposal.js +43 -24
  28. package/src/proposals/start-stakeAtom.d.ts +1 -1
  29. package/src/proposals/start-stakeAtom.d.ts.map +1 -1
  30. package/src/proposals/start-stakeAtom.js +4 -2
  31. package/src/service.d.ts +2 -1
  32. package/src/service.d.ts.map +1 -1
  33. package/src/service.js +8 -3
  34. package/src/utils/chainHub.d.ts +378 -88
  35. package/src/utils/chainHub.d.ts.map +1 -1
  36. package/src/utils/chainHub.js +47 -19
  37. package/src/vat-orchestration.d.ts +2 -2
@@ -52,7 +52,11 @@ export function setupOrchestrationVat({ consume: { loadCriticalVat, portAllocato
52
52
  }) => Promise<void>;
53
53
  connectChainFaucet: ({ consume: { client } }: BootstrapPowers) => Promise<void>;
54
54
  makeVatsFromBundles: ({ vats, devices, consume: { vatStore }, produce: { vatAdminSvc, loadVat, loadCriticalVat }, }: BootstrapPowers & {}) => Promise<void>;
55
- produceDiagnostics: ({ produce }: Pick<ChainBootstrapSpace, "produce">) => Promise<void>;
55
+ produceDiagnostics: ({ produce }:
56
+ /**
57
+ * @param {BootstrapPowers} powers
58
+ */
59
+ Pick<ChainBootstrapSpace, "produce">) => Promise<void>;
56
60
  produceStartUpgradable: ({ zone, consume: { diagnostics, zoe }, produce, }: BootstrapSpace & {
57
61
  zone: import("@agoric/zone").Zone;
58
62
  }) => Promise<void>;
@@ -94,7 +98,7 @@ export function setupOrchestrationVat({ consume: { loadCriticalVat, portAllocato
94
98
  bootMsg?: {
95
99
  type: string;
96
100
  chainID: string;
97
- storagePort: number; /** @type {OrchestrationVats} */
101
+ storagePort: number;
98
102
  supplyCoins: {
99
103
  denom: string;
100
104
  amount: string;
@@ -382,7 +386,7 @@ export function addOrchestrationToClient({ consume: { client, orchestration } }:
382
386
  bootMsg?: {
383
387
  type: string;
384
388
  chainID: string;
385
- storagePort: number; /** @type {OrchestrationVats} */
389
+ storagePort: number;
386
390
  supplyCoins: {
387
391
  denom: string;
388
392
  amount: string;
@@ -556,7 +560,7 @@ export function addOrchestrationToClient({ consume: { client, orchestration } }:
556
560
  } & {
557
561
  consume: {
558
562
  orchestration: import("@endo/exo").Guarded<{
559
- makeAccount(hostConnectionId: `connection-${number}`, controllerConnectionId: `connection-${number}`): Promise<import("../cosmos-api.js").IcaAccount>;
563
+ makeAccount(chainId: string, hostConnectionId: `connection-${number}`, controllerConnectionId: `connection-${number}`): Promise<import("../cosmos-api.js").IcaAccount>;
560
564
  provideICQConnection(controllerConnectionId: `connection-${number}`): Promise<import("@endo/exo").Guarded<{
561
565
  getLocalAddress(): `/ibc-port/${string}`;
562
566
  getRemoteAddress(): `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`;
@@ -603,7 +607,7 @@ export type OrchestrationVats = {
603
607
  allocateICQControllerPort(): Promise<import("@agoric/network").Port>;
604
608
  };
605
609
  public: {
606
- makeAccount(hostConnectionId: `connection-${number}`, controllerConnectionId: `connection-${number}`): Promise<import("../cosmos-api.js").IcaAccount>;
610
+ makeAccount(chainId: string, hostConnectionId: `connection-${number}`, controllerConnectionId: `connection-${number}`): Promise<import("../cosmos-api.js").IcaAccount>;
607
611
  provideICQConnection(controllerConnectionId: `connection-${number}`): Promise<import("@endo/exo").Guarded<{
608
612
  getLocalAddress(): `/ibc-port/${string}`;
609
613
  getRemoteAddress(): `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`;
@@ -618,7 +622,7 @@ export type OrchestrationVats = {
618
622
  allocateICQControllerPort(): Promise<import("@agoric/network").Port>;
619
623
  };
620
624
  public: {
621
- makeAccount(hostConnectionId: `connection-${number}`, controllerConnectionId: `connection-${number}`): Promise<import("../cosmos-api.js").IcaAccount>;
625
+ makeAccount(chainId: string, hostConnectionId: `connection-${number}`, controllerConnectionId: `connection-${number}`): Promise<import("../cosmos-api.js").IcaAccount>;
622
626
  provideICQConnection(controllerConnectionId: `connection-${number}`): Promise<import("@endo/exo").Guarded<{
623
627
  getLocalAddress(): `/ibc-port/${string}`;
624
628
  getRemoteAddress(): `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`;
@@ -1 +1 @@
1
- {"version":3,"file":"orchestration-proposal.d.ts","sourceRoot":"","sources":["orchestration-proposal.js"],"names":[],"mappings":"AAgCO;;;;;;;;;;;;;;;;;wCAWL,eAAY;mIAyFV,eACE,GAAE;gBAAE,SAAc;oBAAE,iBAEf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import { registerChainNamespace } from '../chain-info.js';
6
+ import { CHAIN_KEY, CONNECTIONS_KEY } from '../utils/chainHub.js';
6
7
 
7
8
  const trace = makeTracer('CoreEvalOrchestration', true);
8
9
 
@@ -73,7 +74,6 @@ export const setupOrchestrationVat = async (
73
74
  * @param {ERef<import('@agoric/vats').NameHubKit['nameAdmin']>} agoricNamesAdmin
74
75
  * @param {ERef<StorageNode | null>} chainStorageP
75
76
  */
76
-
77
77
  const publishChainInfoToChainStorage = async (
78
78
  agoricNamesAdmin,
79
79
  chainStorageP,
@@ -84,29 +84,48 @@ const publishChainInfoToChainStorage = async (
84
84
  return;
85
85
  }
86
86
 
87
- const chainNamesNode = E(
88
- E(chainStorage).makeChildNode('agoricNames'),
89
- ).makeChildNode('chain');
90
- const { nameAdmin } = await E(agoricNamesAdmin).provideChild('chain');
91
-
92
- await E(nameAdmin).onUpdate(
93
- // XXX will live on the heap in the bootstrap vat. When we upgrade or kill
94
- // that this handler will sever and vat-agoricNames will need to be upgraded
95
- // to allow changing the handler, or to use pubsub mechanics instead.
96
- Far('chain info writer', {
97
- write(entries) {
98
- // chainInfo has no cap data but we need to marshal bigints
99
- const marshalData = makeMarshal(_val => Fail`data only`);
100
- for (const [chainName, info] of entries) {
101
- // XXX writes even if the entry hasn't changed
102
- const chainNode = E(chainNamesNode).makeChildNode(chainName);
103
- void E(chainNode).setValue(
104
- JSON.stringify(marshalData.toCapData(info)),
105
- );
106
- }
107
- },
108
- }),
109
- );
87
+ const agoricNamesNode = await E(chainStorage).makeChildNode('agoricNames');
88
+
89
+ /**
90
+ * @param {string} subpath
91
+ */
92
+ const echoNameUpdates = async subpath => {
93
+ const chainNamesNode = E(agoricNamesNode).makeChildNode(subpath);
94
+ const { nameAdmin } = await E(agoricNamesAdmin).provideChild(subpath);
95
+
96
+ /**
97
+ * Previous entries, to prevent redundant updates
98
+ *
99
+ * @type {Record<string, string>} chainName => stringified chainInfo
100
+ */
101
+ const prev = {};
102
+
103
+ // XXX cannot be changed until we upgrade vat-agoricNames to allow it
104
+ await E(nameAdmin).onUpdate(
105
+ // XXX will live on the heap in the bootstrap vat. When we upgrade or kill
106
+ // that this handler will sever and vat-agoricNames will need to be upgraded
107
+ // to allow changing the handler, or to use pubsub mechanics instead.
108
+ Far('chain info writer', {
109
+ write(entries) {
110
+ // chainInfo has no cap data but we need to marshal bigints
111
+ const marshalData = makeMarshal(_val => Fail`data only`);
112
+ for (const [chainName, info] of entries) {
113
+ const value = JSON.stringify(marshalData.toCapData(info));
114
+ if (prev[chainName] === value) {
115
+ continue;
116
+ }
117
+ const chainNode = E(chainNamesNode).makeChildNode(chainName);
118
+ prev[chainName] = value;
119
+ void E(chainNode)
120
+ .setValue(value)
121
+ .catch(() => delete prev[chainName]);
122
+ }
123
+ },
124
+ }),
125
+ );
126
+ };
127
+ await echoNameUpdates(CHAIN_KEY);
128
+ await echoNameUpdates(CONNECTIONS_KEY);
110
129
  };
111
130
 
112
131
  /**
@@ -3,7 +3,7 @@ export function startStakeAtom({ consume: { agoricNames, board, chainStorage, ch
3
3
  consume: {
4
4
  stakeIca: Installation<(zcf: ZCF<StakeIcaTerms>, privateArgs: {
5
5
  orchestration: import("@endo/exo").Guarded<{
6
- makeAccount(hostConnectionId: `connection-${number}`, controllerConnectionId: `connection-${number}`): Promise<import("../cosmos-api.js").IcaAccount>;
6
+ makeAccount(chainId: string, hostConnectionId: `connection-${number}`, controllerConnectionId: `connection-${number}`): Promise<import("../cosmos-api.js").IcaAccount>;
7
7
  provideICQConnection(controllerConnectionId: `connection-${number}`): Promise<import("@endo/exo").Guarded<{
8
8
  getLocalAddress(): `/ibc-port/${string}`;
9
9
  getRemoteAddress(): `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`;
@@ -1 +1 @@
1
- {"version":3,"file":"start-stakeAtom.d.ts","sourceRoot":"","sources":["start-stakeAtom.js"],"names":[],"mappings":"AAuBO,yOAVI,eAAe,GAAG;IAC5B,YAAgB,EAAE;QAClB,OAAa,EAAE;YACf,QAAgB,EAAE,YAAY,OAmCH,IAAI,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+GA2DojH,OAAO,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eA5FrmH,CAAC;SACH,CAAC;KACH,CAAC;CACH,iBAyDH;AAGM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BN;mCAtG6C,+BAA+B"}
1
+ {"version":3,"file":"start-stakeAtom.d.ts","sourceRoot":"","sources":["start-stakeAtom.js"],"names":[],"mappings":"AAuBO,yOAVI,eAAe,GAAG;IAC5B,YAAgB,EAAE;QAClB,OAAa,EAAE;YACf,QAAgB,EAAE,YAAY,OAoCZ,IAAI,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+GA4D89G,OAAO,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eA9FtgH,CAAC;SACH,CAAC;KACH,CAAC;CACH,iBA2DH;AAGM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BN;mCAxG6C,+BAA+B"}
@@ -48,10 +48,11 @@ export const startStakeAtom = async ({
48
48
 
49
49
  const chainHub = makeChainHub(await agoricNames);
50
50
 
51
+ const agoric = await chainHub.getChainInfo('agoric');
51
52
  const cosmoshub = await chainHub.getChainInfo('cosmoshub');
52
53
  const connectionInfo = await chainHub.getConnectionInfo(
53
- 'agoriclocal',
54
- 'cosmoshub-4',
54
+ agoric.chainId,
55
+ cosmoshub.chainId,
55
56
  );
56
57
 
57
58
  /** @type {StartUpgradableOpts<StakeAtomSF>} */
@@ -60,6 +61,7 @@ export const startStakeAtom = async ({
60
61
  installation: stakeIca,
61
62
  issuerKeywordRecord: harden({ ATOM: atomIssuer }),
62
63
  terms: {
64
+ chainId: cosmoshub.chainId,
63
65
  hostConnectionId: /** @type {IBCConnectionID} */ (connectionInfo.id),
64
66
  controllerConnectionId: /** @type {IBCConnectionID} */ (
65
67
  connectionInfo.counterparty.connection_id
package/src/service.d.ts CHANGED
@@ -10,12 +10,13 @@ export function prepareOrchestrationTools(zone: Zone): {
10
10
  };
11
11
  public: {
12
12
  /**
13
+ * @param {string} chainId
13
14
  * @param {IBCConnectionID} hostConnectionId the counterparty
14
15
  * connection_id
15
16
  * @param {IBCConnectionID} controllerConnectionId self connection_id
16
17
  * @returns {Promise<IcaAccount>}
17
18
  */
18
- makeAccount(hostConnectionId: `connection-${number}`, controllerConnectionId: `connection-${number}`): Promise<IcaAccount>;
19
+ makeAccount(chainId: string, hostConnectionId: `connection-${number}`, controllerConnectionId: `connection-${number}`): Promise<IcaAccount>;
19
20
  /**
20
21
  * @param {IBCConnectionID} controllerConnectionId
21
22
  * @returns {Promise<ICQConnection>}
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["service.js"],"names":[],"mappings":"AAoDA;;;GAOG;AA2GI;;;;;;;YAxDC;;;;;eAKG;;YAkBH;;;eAGG;;;;;;;;EAwCV;;;;;;;;;;;;;;yBAhJY,QAAQ,CACpB,MAAU,mBAAmB,EAC7B,mBAAuB,CAAC,MAAM,mBAAmB,CAAC,CAC/C;;;;;;;;;;;;;iCA0BU;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,cAAc,EAAE,kBAAkB,CAAA;CAAE;iCAsH1D,UAAU,CAAC,OAAO,yBAAyB,CAAC;+BAC5C,UAAU,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,CAAC;mCACtD,gBAAgB,CAAC,QAAQ,CAAC;0BAxKjB,mBAAmB;0BAEJ,iBAAiB;gCAEO,YAAY;4BAHjD,kBAAkB"}
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["service.js"],"names":[],"mappings":"AAoDA;;;GAOG;AAgHI;;;;;;;YA7DC;;;;;;eAMG;iCALQ,MAAM;YA2BjB;;;eAGG;;;;;;;;EAwCV;;;;;;;;;;;;;;yBArJY,QAAQ,CACpB,MAAU,mBAAmB,EAC7B,mBAAuB,CAAC,MAAM,mBAAmB,CAAC,CAC/C;;;;;;;;;;;;;iCA0BU;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,cAAc,EAAE,kBAAkB,CAAA;CAAE;iCA2H1D,UAAU,CAAC,OAAO,yBAAyB,CAAC;+BAC5C,UAAU,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,CAAC;mCACtD,gBAAgB,CAAC,QAAQ,CAAC;0BA7KjB,mBAAmB;0BAEJ,iBAAiB;gCAEO,YAAY;4BAHjD,kBAAkB"}
package/src/service.js CHANGED
@@ -51,7 +51,7 @@ const getPower = (powers, name) => {
51
51
  };
52
52
 
53
53
  export const OrchestrationI = M.interface('Orchestration', {
54
- makeAccount: M.callWhen(M.string(), M.string()).returns(
54
+ makeAccount: M.callWhen(M.string(), M.string(), M.string()).returns(
55
55
  M.remotable('ChainAccount'),
56
56
  ),
57
57
  provideICQConnection: M.callWhen(M.string()).returns(
@@ -109,19 +109,24 @@ const prepareOrchestrationKit = (
109
109
  },
110
110
  public: {
111
111
  /**
112
+ * @param {string} chainId
112
113
  * @param {IBCConnectionID} hostConnectionId the counterparty
113
114
  * connection_id
114
115
  * @param {IBCConnectionID} controllerConnectionId self connection_id
115
116
  * @returns {Promise<IcaAccount>}
116
117
  */
117
- async makeAccount(hostConnectionId, controllerConnectionId) {
118
+ async makeAccount(chainId, hostConnectionId, controllerConnectionId) {
118
119
  const port = await this.facets.self.allocateICAControllerPort();
119
120
 
120
121
  const remoteConnAddr = makeICAChannelAddress(
121
122
  hostConnectionId,
122
123
  controllerConnectionId,
123
124
  );
124
- const chainAccountKit = makeChainAccountKit(port, remoteConnAddr);
125
+ const chainAccountKit = makeChainAccountKit(
126
+ chainId,
127
+ port,
128
+ remoteConnAddr,
129
+ );
125
130
 
126
131
  // await so we do not return a ChainAccount before it successfully instantiates
127
132
  await E(port).connect(