Skip to content

Commit

Permalink
feat(icaAccount): guard TxBodyOptsShape
Browse files Browse the repository at this point in the history
- improves exciting guard of M.record() with a specific shape
  • Loading branch information
0xpatrickdev committed Aug 7, 2024
1 parent fc104e8 commit 9f991a3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/orchestration/src/exos/ica-account-kit.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
ChainAddressShape,
OutboundConnectionHandlerI,
Proto3Shape,
TxBodyOptsShape,
} from '../typeGuards.js';
import { findAddressField } from '../utils/address.js';
import { makeTxPacket, parseTxPacket } from '../utils/packet.js';
Expand All @@ -34,7 +35,7 @@ export const IcaAccountI = M.interface('IcaAccount', {
getPort: M.call().returns(M.remotable('Port')),
executeTx: M.call(M.arrayOf(M.record())).returns(VowShape),
executeEncodedTx: M.call(M.arrayOf(Proto3Shape))
.optional(M.record())
.optional(TxBodyOptsShape)
.returns(VowShape),
close: M.call().returns(VowShape),
});
Expand Down
14 changes: 13 additions & 1 deletion packages/orchestration/src/typeGuards.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import { M } from '@endo/patterns';

/**
* @import {TypedPattern} from '@agoric/internal';
* @import {ChainAddress, CosmosAssetInfo, ChainInfo, CosmosChainInfo, DenomAmount, DenomDetail} from './types.js';
* @import {ChainAddress, CosmosAssetInfo, ChainInfo, CosmosChainInfo, DenomAmount} from './types.js';
* @import {Delegation} from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
* @import {TxBody} from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
*/

/**
Expand Down Expand Up @@ -130,3 +131,14 @@ export const ChainFacadeI = M.interface('ChainFacade', chainFacadeMethods);
* from `@agoric/time`
*/
export const TimestampProtoShape = { seconds: M.nat(), nanos: M.number() };

/** see {@link TxBody} for more details */
export const TxBodyOptsShape = M.splitRecord(
{},
{
memo: M.string(),
timeoutHeight: M.bigint(),
extensionOptions: M.arrayOf(M.any()),
nonCriticalExtensionOptions: M.arrayOf(M.any()),
},
);

0 comments on commit 9f991a3

Please sign in to comment.