Skip to content

Commit

Permalink
test(orch supports): for sendAnywhere
Browse files Browse the repository at this point in the history
 - add IST to vbankAsset
 - inspectLocalBridge
  • Loading branch information
dckc committed Jun 7, 2024
1 parent 54a5c8e commit 7b02b45
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions packages/orchestration/test/supports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ import { makeNameHubKit } from '@agoric/vats';
import { makeWellKnownSpaces } from '@agoric/vats/src/core/utils.js';
import { fakeNetworkEchoStuff } from './network-fakes.js';
import { prepareOrchestrationTools } from '../src/service.js';
import { CHAIN_KEY } from '../src/facade.js';
import type { CosmosChainInfo } from '../src/cosmos-api.js';
import {
registerChainNamespace,
wellKnownChainInfo,
} from '../src/chain-info.js';
import { registerChainNamespace } from '../src/chain-info.js';

export { makeFakeLocalchainBridge } from '@agoric/vats/tools/fake-bridge.js';

Expand All @@ -29,8 +24,11 @@ export const commonSetup = async t => {
// To test durability in unit tests, test a particular entity with `relaxDurabilityRules: false`.
// To test durability integrating multiple vats, use a RunUtils/bootstrap test.
const rootZone = makeHeapZone();
const bld = withAmountUtils(makeIssuerKit('BLD'));
const ist = withAmountUtils(makeIssuerKit('IST'));
const { mint: _b, ...bld } = withAmountUtils(makeIssuerKit('BLD'));
const { mint: _i, ...ist } = withAmountUtils(makeIssuerKit('IST'));

const { nameHub: agoricNames, nameAdmin: agoricNamesAdmin } =
makeNameHubKit();

const { bankManager, pourPayment } = await makeFakeBankManagerKit();
await E(bankManager).addAsset('ubld', 'BLD', 'Staking Token', bld.issuerKit);
Expand All @@ -40,8 +38,24 @@ export const commonSetup = async t => {
'Inter Stable Token',
ist.issuerKit,
);
// XXX real bankManager does this. fake should too?
await makeWellKnownSpaces(agoricNamesAdmin, t.log, ['vbankAsset']);
await E(E(agoricNamesAdmin).lookupAdmin('vbankAsset')).update(
'uist',
/** @type {AssetInfo} */ harden({
brand: ist.brand,
issuer: ist.issuer,
issuerName: 'IST',
denom: 'uist',
proposedName: 'IST',
displayInfo: { IOU: true },
}),
);

const localchainBridge = makeFakeLocalchainBridge(rootZone);
const localBrigeMessages = [] as any[];
const localchainBridge = makeFakeLocalchainBridge(rootZone, obj =>
localBrigeMessages.push(obj),
);
const localchain = prepareLocalChainTools(
rootZone.subZone('localchain'),
).makeLocalChain({
Expand All @@ -61,9 +75,6 @@ export const commonSetup = async t => {
const { portAllocator } = fakeNetworkEchoStuff(rootZone.subZone('network'));
const { public: orchestration } = makeOrchestrationKit({ portAllocator });

const { nameHub: agoricNames, nameAdmin: agoricNamesAdmin } =
makeNameHubKit();

await registerChainNamespace(agoricNamesAdmin, t.log);

return {
Expand All @@ -78,7 +89,6 @@ export const commonSetup = async t => {
storage,
},
brands: {
// TODO consider omitting `issuer` to prevent minting, which the bank can't observe
bld,
ist,
},
Expand All @@ -87,6 +97,7 @@ export const commonSetup = async t => {
localchain,
orchestrationService: orchestration,
storageNode: storage.rootNode,
marshaller,
timerService: timer,
},
facadeServices: {
Expand All @@ -97,6 +108,7 @@ export const commonSetup = async t => {
},
utils: {
pourPayment,
inspectLocalBridge: () => harden([...localBrigeMessages]),
},
};
};
Expand Down

0 comments on commit 7b02b45

Please sign in to comment.