Skip to content

Commit

Permalink
refactor(localchain): createAccount -> makeAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpatrickdev committed May 1, 2024
1 parent 35152f8 commit e8276f4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/orchestration/src/examples/stakeBld.contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const start = async (zcf, privateArgs, baggage) => {
const { give } = seat.getProposal();
trace('makeStakeBldInvitation', give);
// XXX type appears local but it's remote
const account = await E(privateArgs.localchain).createAccount();
const account = await E(privateArgs.localchain).makeAccount();
const lcaSeatKit = zcf.makeEmptySeatKit();
atomicTransfer(zcf, seat, lcaSeatKit.zcfSeat, give);
seat.exit();
Expand Down
14 changes: 7 additions & 7 deletions packages/vats/src/localchain.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const prepareLocalChainAccount = zone =>
*/

export const LocalChainI = M.interface('LocalChain', {
createAccount: M.callWhen().returns(M.remotable('LocalChainAccount')),
makeAccount: M.callWhen().returns(M.remotable('LocalChainAccount')),
query: M.callWhen(M.record()).returns(M.record()),
queryMany: M.callWhen(M.arrayOf(M.record())).returns(M.arrayOf(M.record())),
});
Expand All @@ -106,9 +106,9 @@ export const LocalChainAdminI = M.interface('LocalChainAdmin', {

/**
* @param {import('@agoric/base-zone').Zone} zone
* @param {ReturnType<typeof prepareLocalChainAccount>} createAccount
* @param {ReturnType<typeof prepareLocalChainAccount>} makeAccount
*/
const prepareLocalChain = (zone, createAccount) =>
const prepareLocalChain = (zone, makeAccount) =>
zone.exoClassKit(
'LocalChain',
{ public: LocalChainI, admin: LocalChainAdminI },
Expand Down Expand Up @@ -151,13 +151,13 @@ const prepareLocalChain = (zone, createAccount) =>
* x/vlocalchain/keeper/keeper.go AllocateAddress for the use of the app
* hash and block data hash.
*/
async createAccount() {
async makeAccount() {
const { powers } = this.state;
const system = getPower(powers, 'system');
const address = await E(system).toBridge({
type: 'VLOCALCHAIN_ALLOCATE_ADDRESS',
});
return createAccount(address, powers);
return makeAccount(address, powers);
},
/**
* Make a single query to the local chain. Will reject with an error if
Expand Down Expand Up @@ -205,8 +205,8 @@ const prepareLocalChain = (zone, createAccount) =>

/** @param {import('@agoric/base-zone').Zone} zone */
export const prepareLocalChainTools = zone => {
const createAccount = prepareLocalChainAccount(zone);
const makeLocalChain = prepareLocalChain(zone, createAccount);
const makeAccount = prepareLocalChainAccount(zone);
const makeLocalChain = prepareLocalChain(zone, makeAccount);

return harden({ makeLocalChain });
};
Expand Down
2 changes: 1 addition & 1 deletion packages/vats/src/proposals/localchain-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const testLocalChain = async (

let result;
try {
const lca = await E(localchain).createAccount();
const lca = await E(localchain).makeAccount();
console.info('created account', lca);
const address = await E(lca).getAddress();
console.info('address', address);
Expand Down

0 comments on commit e8276f4

Please sign in to comment.