Skip to content

Commit 1f846b8

Browse files
committed
fix: ensure correct chain switching in sendOriginTransaction and clean up unused imports in IntentQuoteDisplayStep
1 parent 8813fbc commit 1f846b8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

extras/demo-anypay/src/components/IntentQuoteDisplayStep.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { getChainInfo } from '@/utils/formatting'
1919
import { IntentAction } from '@/types'
2020
import { Hex, formatUnits, isAddressEqual, zeroAddress } from 'viem'
2121
import { Address as OxAddress } from 'ox'
22-
import * as chains from 'viem/chains'
2322
import {
2423
MOCK_CHAIN_ID,
2524
MOCK_CONTRACT_ADDRESS,

packages/wallet/anypay-sdk/src/intents.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ export async function sendOriginTransaction(
151151
client: WalletClient,
152152
originParams: SendOriginCallTxArgs,
153153
): Promise<`0x${string}`> {
154+
const chainId = await client.getChainId()
155+
if (chainId !== originParams.chain.id) {
156+
await client.switchChain({ id: originParams.chain.id })
157+
}
158+
154159
const hash = await client.sendTransaction({
155160
account: wallet,
156161
to: originParams.to as `0x${string}`,

0 commit comments

Comments
 (0)