Skip to content

Commit

Permalink
refactor: ChainAmountShape → DenomAmountShape
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Jul 16, 2024
1 parent f3de157 commit 7e2a619
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
13 changes: 6 additions & 7 deletions packages/orchestration/src/exos/cosmos-orchestration-account.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
/** @file Use-object for the owner of a staking account */
import { Fail } from '@endo/errors';
import { decodeBase64 } from '@endo/base64';
import { E } from '@endo/far';
import { toRequestQueryJson } from '@agoric/cosmic-proto';
import {
QueryBalanceRequest,
Expand All @@ -22,12 +19,14 @@ import { makeTracer } from '@agoric/internal';
import { Shape as NetworkShape } from '@agoric/network';
import { M } from '@agoric/vat-data';
import { VowShape } from '@agoric/vow';
import { decodeBase64 } from '@endo/base64';
import { Fail } from '@endo/errors';
import { E } from '@endo/far';
import {
AmountArgShape,
ChainAddressShape,
ChainAmountShape,
DenomAmountShape,
DelegationShape,
DenomAmountShape,
} from '../typeGuards.js';
import { maxClockSkew, tryDecodeResponse } from '../utils/cosmos.js';
import { orchestrationAccountMethods } from '../utils/orchestrationAccount.js';
Expand Down Expand Up @@ -78,9 +77,9 @@ export const IcaAccountHolderI = M.interface('IcaAccountHolder', {
AmountArgShape,
).returns(VowShape),
withdrawReward: M.call(ChainAddressShape).returns(
Vow$(M.arrayOf(ChainAmountShape)),
Vow$(M.arrayOf(DenomAmountShape)),
),
withdrawRewards: M.call().returns(Vow$(M.arrayOf(ChainAmountShape))),
withdrawRewards: M.call().returns(Vow$(M.arrayOf(DenomAmountShape))),
undelegate: M.call(M.arrayOf(DelegationShape)).returns(VowShape),
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { VowShape } from '@agoric/vow';
import { E } from '@endo/far';
import {
ChainAddressShape,
ChainAmountShape,
DenomAmountShape,
DenomShape,
IBCTransferOptionsShape,
Expand Down Expand Up @@ -105,7 +104,7 @@ export const prepareLocalOrchestrationAccountKit = (
.optional({
destination: ChainAddressShape,
opts: M.or(M.undefined(), IBCTransferOptionsShape),
amount: ChainAmountShape,
amount: DenomAmountShape,
})
.returns(Vow$(M.record())),
}),
Expand Down
6 changes: 2 additions & 4 deletions packages/orchestration/src/typeGuards.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ export const Proto3Shape = {
value: M.string(),
};

export const ChainAmountShape = harden({ denom: M.string(), value: M.nat() });

export const AmountArgShape = M.or(AmountShape, ChainAmountShape);

// FIXME missing `delegatorAddress` from the type
/** @type {TypedPattern<Delegation>} */
export const DelegationShape = harden({
Expand Down Expand Up @@ -108,6 +104,8 @@ export const BrandInfoShape = M.any();
/** @type {TypedPattern<DenomAmount>} */
export const DenomAmountShape = { denom: DenomShape, value: M.bigint() };

export const AmountArgShape = M.or(AmountShape, DenomAmountShape);

/** @see {Chain} */
export const ChainFacadeI = M.interface('ChainFacade', {
getChainInfo: M.call().returns(VowShape),
Expand Down

0 comments on commit 7e2a619

Please sign in to comment.