Skip to content

Commit

Permalink
refactor(orchestration): rename createAccount -> makeAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpatrickdev committed May 1, 2024
1 parent 5cb19f9 commit e0d8788
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 27 deletions.
6 changes: 3 additions & 3 deletions packages/boot/test/bootstrapTests/test-orchestration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ test.serial('stakeAtom - repl-style', async t => {
const publicFacet = await EV(zoe).getPublicFacet(instance);
t.truthy(publicFacet, 'stakeAtom publicFacet is available');

const account = await EV(publicFacet).createAccount();
const account = await EV(publicFacet).makeAccount();
t.log('account', account);
t.truthy(account, 'createAccount returns an account on ATOM connection');
t.truthy(account, 'makeAccount returns an account on ATOM connection');
t.truthy(
matches(account, M.remotable('ChainAccount')),
'account is a remotable',
Expand All @@ -140,7 +140,7 @@ test.serial('stakeAtom - smart wallet', async t => {
invitationSpec: {
source: 'agoricContract',
instancePath: ['stakeAtom'],
callPipe: [['makeCreateAccountInvitation']],
callPipe: [['makeAccountInvitation']],
},
proposal: {},
});
Expand Down
14 changes: 7 additions & 7 deletions packages/boot/test/bootstrapTests/test-vat-orchestration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,18 @@ test.before(async t => {

test.after.always(t => t.context.shutdown?.());

test('createAccount returns an ICA connection', async t => {
test('makeAccount returns an ICA connection', async t => {
const {
runUtils: { EV },
} = t.context;

const orchestration = await EV.vat('bootstrap').consumeItem('orchestration');

const account = await EV(orchestration).createAccount(
const account = await EV(orchestration).makeAccount(
'connection-0',
'connection-0',
);
t.truthy(account, 'createAccount returns an account');
t.truthy(account, 'makeAccount returns an account');
t.truthy(
matches(account, M.remotable('ChainAccount')),
'account is a remotable',
Expand Down Expand Up @@ -103,11 +103,11 @@ test('ICA connection can be closed', async t => {
const orchestration: OrchestrationService =
await EV.vat('bootstrap').consumeItem('orchestration');

const account = await EV(orchestration).createAccount(
const account = await EV(orchestration).makeAccount(
'connection-0',
'connection-0',
);
t.truthy(account, 'createAccount returns an account');
t.truthy(account, 'makeAccount returns an account');

await EV(account).close();

Expand All @@ -123,11 +123,11 @@ test('ICA connection can send msg with proto3', async t => {

const orchestration = await EV.vat('bootstrap').consumeItem('orchestration');

const account: ChainAccount = await EV(orchestration).createAccount(
const account: ChainAccount = await EV(orchestration).makeAccount(
'connection-0',
'connection-0',
);
t.truthy(account, 'createAccount returns an account');
t.truthy(account, 'makeAccount returns an account');

// @ts-expect-error intentional
await t.throwsAsync(EV(account).executeEncodedTx('malformed'), {
Expand Down
18 changes: 9 additions & 9 deletions packages/orchestration/src/examples/stakeAtom.contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export const start = async (zcf, privateArgs, baggage) => {
zcf,
);

async function createAccount() {
const account = await E(orchestration).createAccount(
async function makeAccount() {
const account = await E(orchestration).makeAccount(
hostConnectionId,
controllerConnectionId,
);
Expand All @@ -69,20 +69,20 @@ export const start = async (zcf, privateArgs, baggage) => {
const publicFacet = zone.exo(
'StakeAtom',
M.interface('StakeAtomI', {
createAccount: M.callWhen().returns(M.remotable('ChainAccount')),
makeCreateAccountInvitation: M.call().returns(M.promise()),
makeAccount: M.callWhen().returns(M.remotable('ChainAccount')),
makeAccountInvitation: M.call().returns(M.promise()),
}),
{
async createAccount() {
trace('createAccount');
return createAccount().then(({ account }) => account);
async makeAccount() {
trace('makeAccount');
return makeAccount().then(({ account }) => account);
},
makeCreateAccountInvitation() {
makeAccountInvitation() {
trace('makeCreateAccountInvitation');
return zcf.makeInvitation(
async seat => {
seat.exit();
return createAccount();
return makeAccount();
},
'wantStakingAccount',
undefined,
Expand Down
4 changes: 2 additions & 2 deletions packages/orchestration/src/examples/swapExample.contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export const start = async (zcf, privateArgs) => {
const agoric = await orch.getChain('agoric');

const [celestiaAccount, localAccount] = await Promise.all([
celestia.createAccount(),
agoric.createAccount(),
celestia.makeAccount(),
agoric.makeAccount(),
]);

const tiaAddress = await celestiaAccount.getChainAddress();
Expand Down
4 changes: 2 additions & 2 deletions packages/orchestration/src/examples/unbondExample.contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ export const start = async (zcf, privateArgs) => {
// ??? could these be passed in? It would reduce the size of this handler,
// keeping it focused on long-running operations.
const celestia = await orch.getChain('celestia');
const celestiaAccount = await celestia.createAccount();
const celestiaAccount = await celestia.makeAccount();

const delegations = await celestiaAccount.getDelegations();
// wait for the undelegations to be complete (may take weeks)
await celestiaAccount.undelegate(delegations);

// ??? should this be synchronous? depends on how names are resolved.
const stride = await orch.getChain('stride');
const strideAccount = await stride.createAccount();
const strideAccount = await stride.makeAccount();

// TODO the `TIA` string actually needs to be the Brand from AgoricNames
const tiaAmt = await celestiaAccount.getBalance('TIA');
Expand Down
2 changes: 1 addition & 1 deletion packages/orchestration/src/exos/stakingAccountKit.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const prepareStakingAccountKit = (baggage, makeRecorderKit, zcf) => {
return this.state.topicKit.recorder;
},
// TODO move this beneath the Orchestration abstraction,
// to the OrchestrationAccount provided by createAccount()
// to the OrchestrationAccount provided by makeAccount()
/**
* _Assumes users has already sent funds to their ICA, until #9193
* @param {string} validatorAddress
Expand Down
4 changes: 2 additions & 2 deletions packages/orchestration/src/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ const prepareChainAccount = zone =>
);

export const OrchestrationI = M.interface('Orchestration', {
createAccount: M.callWhen(M.string(), M.string()).returns(
makeAccount: M.callWhen(M.string(), M.string()).returns(
M.remotable('ChainAccount'),
),
});
Expand Down Expand Up @@ -254,7 +254,7 @@ const prepareOrchestration = (zone, createChainAccount) =>
* self connection_id
* @returns {Promise<ChainAccount>}
*/
async createAccount(hostConnectionId, controllerConnectionId) {
async makeAccount(hostConnectionId, controllerConnectionId) {
const port = await this.facets.self.bindPort();

const remoteConnAddr = makeICAConnectionAddress(
Expand Down
2 changes: 1 addition & 1 deletion packages/orchestration/src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export interface Chain<C extends keyof KnownChains> {
* Creates a new account on the remote chain.
* @returns an object that controls a new remote account on Chain
*/
createAccount: () => Promise<OrchestrationAccount<C>>;
makeAccount: () => Promise<OrchestrationAccount<C>>;
// FUTURE supply optional port object; also fetch port object

/**
Expand Down

0 comments on commit e0d8788

Please sign in to comment.