diff --git a/packages/orchestration/src/contracts/stakeAtom.contract.js b/packages/orchestration/src/contracts/stakeAtom.contract.js index a8c8cf268cc2..d8845790e717 100644 --- a/packages/orchestration/src/contracts/stakeAtom.contract.js +++ b/packages/orchestration/src/contracts/stakeAtom.contract.js @@ -4,13 +4,15 @@ * */ -import { makeTracer } from '@agoric/internal'; import { makeDurableZone } from '@agoric/zone/durable.js'; import { V as E } from '@agoric/vat-data/vow.js'; -const trace = makeTracer('StakeAtom'); - -/** @typedef {{ hostConnectionId: string, controllerConnectionId: string }} StakeAtomTerms */ +/** + * @typedef {{ + * hostConnectionId: import('../types').ConnectionId; + * controllerConnectionId: import('../types').ConnectionId; + * }} StakeAtomTerms + */ /** * @@ -31,8 +33,7 @@ export const start = async (zcf, privateArgs, baggage) => { * @param {Port} [port] if the user has a bound port and wants to reuse it */ async provideAccount(port) { - trace(`provideAccount. ${port ? 'Reusing port' : 'Binding new port'}`); - return E(orchestration).provideAccount( + return E(orchestration).createAccount( hostConnectionId, controllerConnectionId, port, diff --git a/packages/vats/src/orchestration.js b/packages/vats/src/orchestration.js index 5a67e5f5ffd2..011f47b0a7ab 100644 --- a/packages/vats/src/orchestration.js +++ b/packages/vats/src/orchestration.js @@ -37,7 +37,7 @@ const getPower = (powers, name) => { }; export const ChainAccountI = M.interface('ChainAccount', { - getAddress: M.call().returns(M.string()), + getAccountAddress: M.call().returns(M.string()), getLocalAddress: M.call().returns(M.string()), getRemoteAddress: M.call().returns(M.string()), getPort: M.call().returns(M.remotable('Port')), @@ -73,7 +73,7 @@ const prepareChainAccount = zone => * localAddress: string | undefined; * requestedRemoteAddress: string; * remoteAddress: string | undefined; - * chainAddress: ChainAddress | undefined; + * accountAddress: ChainAddress | undefined; * }} */ ( harden({ @@ -81,16 +81,16 @@ const prepareChainAccount = zone => connection: undefined, requestedRemoteAddress, remoteAddress: undefined, - chainAddress: undefined, + accountAddress: undefined, localAddress: undefined, }) ), { account: { - getAddress() { - const { chainAddress } = this.state; - chainAddress || Fail`chain address not available`; - return chainAddress; + getAccountAddress() { + const { accountAddress } = this.state; + accountAddress || Fail`account address not available`; + return accountAddress; }, getLocalAddress() { const { localAddress } = this.state; @@ -146,7 +146,7 @@ const prepareChainAccount = zone => this.state.remoteAddress = remoteAddr; this.state.localAddress = localAddr; // XXX parseAddress currently throws, should it return '' instead? - this.state.chainAddress = parseAddress(remoteAddr); + this.state.accountAddress = parseAddress(remoteAddr); }, async onClose(connection, reason) { trace(`ICA Channel closed. Reason: ${reason}`); @@ -161,7 +161,7 @@ const prepareChainAccount = zone => ); export const OrchestrationI = M.interface('Orchestration', { - provideAccount: M.callWhen(M.string(), M.string()) + createAccount: M.callWhen(M.string(), M.string()) .optional(M.remotable('Port')) .returns(M.remotable('ChainAccount')), getChain: M.callWhen(M.string()).returns(M.remotable('Chain')), @@ -206,7 +206,7 @@ const prepareOrchestration = (zone, createChainAccount) => * @param {Port} [currentPort] if a port is provided, it will be reused * to create the account */ - async provideAccount( + async createAccount( hostConnectionId, controllerConnectionId, currentPort,