Skip to content

Commit

Permalink
Chore(optimism): fix hex encoding for chain ID
Browse files Browse the repository at this point in the history
  • Loading branch information
Quazia committed Sep 11, 2023
1 parent 356cd01 commit 2b17325
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions packages/optimism/src/Optimism.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('Given the optimism plugin', () => {
})

expect(filter).to.deep.equal({
chainId: '0xa',
chainId: 10,
to: addresses.L2StandardBridge[420],
input: {
$abi: l2StandardBridgeABI,
Expand All @@ -52,7 +52,7 @@ describe('Given the optimism plugin', () => {
})

expect(filter).to.deep.equal({
chainId: '0x1',
chainId: 1,
to: addresses.L1StandardBridge[1],
input: {
$abi: l1StandardBridgeABI,
Expand All @@ -73,7 +73,7 @@ describe('Given the optimism plugin', () => {
})

expect(filter).to.deep.equal({
chainId: '0x1',
chainId: 1,
to: addresses.L1StandardBridge[1],
value: {
$gte: '100000',
Expand Down
7 changes: 3 additions & 4 deletions packages/optimism/src/Optimism.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { type BridgeActionParams, compressJson } from '@rabbitholegg/questdk'
import { toHex } from 'viem'
import {
l1StandardBridgeABI,
l2StandardBridgeABI,
Expand All @@ -16,7 +15,7 @@ export const bridge = async (bridge: BridgeActionParams) => {
// If we're on the L1 and the token is ETH, we need to use a different input
if (tokenAddress === ETH_TOKEN_ADDRESS) {
return compressJson({
chainId: toHex(sourceChainId), // The chainId of the source chain
chainId: sourceChainId, // The chainId of the source chain
to: contractAddress || addresses.L1StandardBridge[1], // The contract address of the bridge
value: amount,
input: {
Expand All @@ -25,7 +24,7 @@ export const bridge = async (bridge: BridgeActionParams) => {
})
}
return compressJson({
chainId: toHex(sourceChainId), // The chainId of the source chain
chainId: sourceChainId, // The chainId of the source chain
to: contractAddress || addresses.L1StandardBridge[1], // The contract address of the bridge
input: {
$abi: l1StandardBridgeABI,
Expand All @@ -35,7 +34,7 @@ export const bridge = async (bridge: BridgeActionParams) => {
})
}
return compressJson({
chainId: toHex(sourceChainId), // The chainId of the source chain
chainId: sourceChainId, // The chainId of the source chain
to: contractAddress || addresses.L2StandardBridge[420], // The contract address of the bridge
input: {
$abi: l2StandardBridgeABI,
Expand Down

0 comments on commit 2b17325

Please sign in to comment.