Skip to content

Commit

Permalink
fix(cosmosOrchestrationAccount): use AmountArg consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpatrickdev committed Jun 17, 2024
1 parent b6df6c2 commit 71403dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
13 changes: 7 additions & 6 deletions packages/orchestration/src/exos/cosmosOrchestrationAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
MsgUndelegateResponse,
} from '@agoric/cosmic-proto/cosmos/staking/v1beta1/tx.js';
import { Any } from '@agoric/cosmic-proto/google/protobuf/any.js';
import { AmountShape } from '@agoric/ertp';
import { makeTracer } from '@agoric/internal';
import { M } from '@agoric/vat-data';
import { TopicsRecordShape } from '@agoric/zoe/src/contractSupport/index.js';
Expand Down Expand Up @@ -75,11 +74,13 @@ export const IcaAccountHolderI = M.interface('IcaAccountHolder', {
holder: M.any(),
}),
getPublicTopics: M.call().returns(TopicsRecordShape),
delegate: M.callWhen(ChainAddressShape, AmountShape).returns(M.undefined()),
delegate: M.callWhen(ChainAddressShape, AmountArgShape).returns(
M.undefined(),
),
redelegate: M.callWhen(
ChainAddressShape,
ChainAddressShape,
AmountShape,
AmountArgShape,
).returns(M.undefined()),
withdrawReward: M.callWhen(ChainAddressShape).returns(
M.arrayOf(ChainAmountShape),
Expand Down Expand Up @@ -123,11 +124,11 @@ export const prepareCosmosOrchestrationAccountKit = (
helper: M.interface('helper', {
owned: M.call().returns(M.remotable()),
getUpdater: M.call().returns(M.remotable()),
amountToCoin: M.call(AmountShape).returns(M.record()),
amountToCoin: M.call(AmountArgShape).returns(M.record()),
}),
holder: IcaAccountHolderI,
invitationMakers: M.interface('invitationMakers', {
Delegate: M.callWhen(ChainAddressShape, AmountShape).returns(
Delegate: M.callWhen(ChainAddressShape, AmountArgShape).returns(
InvitationShape,
),
Redelegate: M.callWhen(
Expand Down Expand Up @@ -197,7 +198,7 @@ export const prepareCosmosOrchestrationAccountKit = (
invitationMakers: {
/**
* @param {CosmosValidatorAddress} validator
* @param {Amount<'nat'>} amount
* @param {AmountArg} amount
*/
Delegate(validator, amount) {
trace('Delegate', validator, amount);
Expand Down
7 changes: 5 additions & 2 deletions packages/orchestration/test/staking-ops.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,11 @@ test(`delegate; redelegate using invitationMakers`, async t => {
const { validator, delegations } = configStaking;
{
const value = BigInt(Object.values(delegations)[0].amount);
const anAmount = { brand: aBrand, value };
const toDelegate = await E(invitationMakers).Delegate(validator, anAmount);
const anAmountArg = { denom: 'uatom', value };
const toDelegate = await E(invitationMakers).Delegate(
validator,
anAmountArg,
);
const seat = E(zoe).offer(toDelegate);
const result = await E(seat).getOfferResult();

Expand Down

0 comments on commit 71403dd

Please sign in to comment.