diff --git a/packages/boot/tools/supports.ts b/packages/boot/tools/supports.ts index 36af57d01ccc..339f422b991c 100644 --- a/packages/boot/tools/supports.ts +++ b/packages/boot/tools/supports.ts @@ -46,6 +46,10 @@ import type { SwingsetController } from '@agoric/swingset-vat/src/controller/con import type { BridgeHandler, IBCMethod, IBCPacket } from '@agoric/vats'; import type { BootstrapRootObject } from '@agoric/vats/src/core/lib-boot.js'; import type { EProxy } from '@endo/eventual-send'; +import { + buildVTransferEvent, + type BuildVTransferEventParams, +} from '@agoric/orchestration/tools/ibc-mocks.js'; import { icaMocks, protoMsgMockMap, protoMsgMocks } from './ibc/mocks.js'; const trace = makeTracer('BSTSupport', false); @@ -615,6 +619,13 @@ export const makeSwingsetTestKit = async ( console.log('🧻'); return i; }, + + async inboundVTransferEvent(params: BuildVTransferEventParams) { + await runUtils.queueAndRun( + () => inbound(BridgeId.VTRANSFER, buildVTransferEvent(params)), + true, + ); + }, }; return { diff --git a/packages/orchestration/tools/ibc-mocks.ts b/packages/orchestration/tools/ibc-mocks.ts index 65266645e5d0..6933bef394e8 100644 --- a/packages/orchestration/tools/ibc-mocks.ts +++ b/packages/orchestration/tools/ibc-mocks.ts @@ -6,7 +6,7 @@ import { ResponseQuery, } from '@agoric/cosmic-proto/tendermint/abci/types.js'; import { encodeBase64, btoa, atob, decodeBase64 } from '@endo/base64'; -import { toRequestQueryJson } from '@agoric/cosmic-proto'; +import { type JsonSafe, toRequestQueryJson } from '@agoric/cosmic-proto'; import { IBCChannelID, IBCEvent, @@ -152,18 +152,19 @@ export function buildQueryPacketString( return btoa(makeQueryPacket(msgs.map(msg => toRequestQueryJson(msg, opts)))); } -type BuildVTransferEventParams = { +export type BuildVTransferEventParams = { event?: VTransferIBCEvent['event']; /* defaults to cosmos1AccAddress. set to `agoric1fakeLCAAddress` to simulate an outgoing transfer event */ sender?: ChainAddress['value']; - /** defaults to agoric1fakeLCAAddress. set to a different value to simulate an outgoing transfer event */ + /* defaults to agoric1fakeLCAAddress. set to a different value to simulate an outgoing transfer event */ receiver?: ChainAddress['value']; target?: ChainAddress['value']; amount?: bigint; denom?: string; destinationChannel?: IBCChannelID; sourceChannel?: IBCChannelID; - sequence?: PacketSDKType['sequence']; + /* support bigint and string, to facilitate bootstrap testing */ + sequence?: PacketSDKType['sequence'] | JsonSafe; }; /**