Skip to content

Commit

Permalink
wasm, react: hotfix for new testnet token mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
sehyunc committed Oct 30, 2024
1 parent a7584a7 commit a37de4c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/core/src/types/token.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { type Address, isHex } from 'viem'

import { type Address, isHex, zeroAddress } from 'viem'
import { tokenMapping } from '../constants.js'

export class Token {
Expand Down Expand Up @@ -48,7 +47,7 @@ export class Token {
tokenData.decimals,
)
}
throw new Error(`Token not found for ${ticker}`)
return DEFAULT_TOKEN
}

static findByAddress(address: Address): Token {
Expand All @@ -63,7 +62,7 @@ export class Token {
tokenData.decimals,
)
}
throw new Error(`Token not found for ${address}`)
return DEFAULT_TOKEN
}

static create(
Expand All @@ -78,3 +77,5 @@ export class Token {
return new Token(name, ticker, address, decimals)
}
}

const DEFAULT_TOKEN = new Token('UNKNOWN', 'UNKNOWN', zeroAddress, 0)

0 comments on commit a37de4c

Please sign in to comment.