Skip to content

Commit

Permalink
fix(localchain): callWhens return PromiseVow
Browse files Browse the repository at this point in the history
  • Loading branch information
mhofman authored and michaelfig committed Jun 21, 2024
1 parent 225af1a commit 92fd11f
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions packages/vats/src/localchain.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { AmountShape, BrandShape, PaymentShape } from '@agoric/ertp';
import { Shape as NetworkShape } from '@agoric/network';

const { Fail } = assert;
const { Vow$ } = NetworkShape;

/**
* @import {TypedJson, ResponseTo, JsonSafe} from '@agoric/cosmic-proto';
Expand Down Expand Up @@ -45,15 +46,17 @@ const { Fail } = assert;
*/

export const LocalChainAccountI = M.interface('LocalChainAccount', {
getAddress: M.callWhen().returns(M.string()),
getBalance: M.callWhen(BrandShape).returns(AmountShape),
getAddress: M.callWhen().returns(Vow$(M.string())),
getBalance: M.callWhen(BrandShape).returns(Vow$(AmountShape)),
deposit: M.callWhen(PaymentShape)
.optional(M.pattern())
.returns(NetworkShape.Vow$(AmountShape)),
withdraw: M.callWhen(AmountShape).returns(PaymentShape),
executeTx: M.callWhen(M.arrayOf(M.record())).returns(M.arrayOf(M.record())),
.returns(Vow$(AmountShape)),
withdraw: M.callWhen(AmountShape).returns(Vow$(PaymentShape)),
executeTx: M.callWhen(M.arrayOf(M.record())).returns(
Vow$(M.arrayOf(M.record())),
),
monitorTransfers: M.callWhen(M.remotable('TransferTap')).returns(
M.remotable('TargetRegistration'),
Vow$(M.remotable('TargetRegistration')),
),
});

Expand Down Expand Up @@ -192,9 +195,11 @@ export const prepareLocalChainAccountKit = (zone, { watch }) =>
/** @typedef {LocalChainAccountKit['account']} LocalChainAccount */

export const LocalChainI = M.interface('LocalChain', {
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())),
makeAccount: M.callWhen().returns(Vow$(M.remotable('LocalChainAccount'))),
query: M.callWhen(M.record()).returns(Vow$(M.record())),
queryMany: M.callWhen(M.arrayOf(M.record())).returns(
Vow$(M.arrayOf(M.record())),
),
});

/**
Expand Down

0 comments on commit 92fd11f

Please sign in to comment.