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 committed Jun 22, 2024
1 parent 5ff628e commit b5cf8bd
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 b5cf8bd

Please sign in to comment.