@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
|
@@ -3,6 +3,7 @@ import { E, Far } from '@endo/far';
|
|
|
3
3
|
import { makeMarshal } from '@endo/marshal';
|
|
4
4
|
import { Fail } from '@agoric/assert';
|
|
5
5
|
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
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
/**
|