@agoric/orchestration 0.1.1-dev-66bf702.0 → 0.1.1-dev-31a57fc.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.
@@ -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,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqDE"}
package/src/chain-info.js CHANGED
@@ -4,7 +4,7 @@ import { connectionKey } from './exos/chain-hub.js';
4
4
  import fetchedChainInfo from './fetched-chain-info.js'; // Refresh with scripts/refresh-chain-info.ts
5
5
  import { CosmosChainInfoShape } from './typeGuards.js';
6
6
 
7
- /** @import {CosmosChainInfo, EthChainInfo} from './types.js'; */
7
+ /** @import {CosmosChainInfo, EthChainInfo, IBCConnectionInfo} from './types.js'; */
8
8
 
9
9
  /** @typedef {CosmosChainInfo | EthChainInfo} ChainInfo */
10
10
 
@@ -65,6 +65,35 @@ const knownChains = /** @satisfies {Record<string, ChainInfo>} */ (
65
65
 
66
66
  /** @typedef {typeof knownChains} KnownChains */
67
67
 
68
+ /**
69
+ * Utility to reverse connection info perspective.
70
+ *
71
+ * @param {IBCConnectionInfo} connInfo
72
+ * @returns {IBCConnectionInfo}
73
+ */
74
+ const reverseConnInfo = connInfo => {
75
+ const { transferChannel } = connInfo;
76
+ return {
77
+ id: connInfo.counterparty.connection_id,
78
+ client_id: connInfo.counterparty.client_id,
79
+ counterparty: {
80
+ client_id: connInfo.client_id,
81
+ connection_id: connInfo.id,
82
+ prefix: {
83
+ key_prefix: '',
84
+ },
85
+ },
86
+ state: connInfo.state,
87
+ transferChannel: {
88
+ ...transferChannel,
89
+ channelId: transferChannel.counterPartyChannelId,
90
+ counterPartyChannelId: transferChannel.channelId,
91
+ portId: transferChannel.counterPartyPortId,
92
+ counterPartyPortId: transferChannel.portId,
93
+ },
94
+ };
95
+ };
96
+
68
97
  /**
69
98
  * @param {ERef<import('@agoric/vats').NameHubKit['nameAdmin']>} agoricNamesAdmin
70
99
  * @param {string} name
@@ -90,12 +119,16 @@ export const registerChain = async (
90
119
  .then(() => log(`registered agoricNames chain.${name}`)),
91
120
  ];
92
121
 
122
+ const { chainId } = chainInfo;
93
123
  // FIXME updates redundantly, twice per edge
94
124
  for (const [counterChainId, connInfo] of Object.entries(connections)) {
95
- const key = connectionKey(chainInfo.chainId, counterChainId);
125
+ const key = connectionKey(chainId, counterChainId);
126
+ const normalizedConnInfo =
127
+ chainId < counterChainId ? connInfo : reverseConnInfo(connInfo);
128
+
96
129
  promises.push(
97
130
  E(connAdmin)
98
- .update(key, connInfo)
131
+ .update(key, normalizedConnInfo)
99
132
  .then(() => log(`registering agoricNames chainConnection.${key}`)),
100
133
  );
101
134
  }
@@ -101,8 +101,8 @@ const prepareRemoteChainFacadeKit = (
101
101
  return watch(
102
102
  E(orchestration).makeAccount(
103
103
  remoteChainInfo.chainId,
104
- connectionInfo.id,
105
104
  connectionInfo.counterparty.connection_id,
105
+ connectionInfo.id,
106
106
  ),
107
107
  this.facets.makeAccountWatcher,
108
108
  );