Skip to content

Commit

Permalink
Merge pull request #46 from xendfinance/fix
Browse files Browse the repository at this point in the history
[bug fix]: resolve front USDT name
  • Loading branch information
stephenson080 authored Feb 19, 2025
2 parents 6c4d1fa + 4db9b30 commit a73dfd1
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 37 deletions.
47 changes: 35 additions & 12 deletions backend-usdc/src/routes/sign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,43 @@ import { signTransaction } from '@/services/blockchain'

export default (): Resource => ({
async get(
req: Request<{}, {}, {}, { fromBridgeAddress?: string, toBridgeAssistAddress?: string, fromChain?: string; fromUser?: string; index?: string }>,
req: Request<
{},
{},
{},
{
fromBridgeAddress?: string
toBridgeAssistAddress?: string
fromChain?: string
fromUser?: string
index?: string
}
>,
res
) {
const { fromBridgeAddress, toBridgeAssistAddress, fromChain, fromUser, index } = req.query
try {
const { fromBridgeAddress, toBridgeAssistAddress, fromChain, fromUser, index } =
req.query

if (!fromBridgeAddress) return res.status(400).send('fromBridgeAddress not specified')
if (!toBridgeAssistAddress) return res.status(400).send('toBridgeAssistAddress not specified')
if (!fromChain) return res.status(400).send('from chain not specified')
if (!fromUser) return res.status(400).send('from user not specified')
if (!index) return res.status(400).send('index not specified')
console.log(fromBridgeAddress, toBridgeAssistAddress, fromChain, fromUser, index)
const signature = await signTransaction(fromBridgeAddress, toBridgeAssistAddress, fromChain, fromUser, index).catch(
console.error
)
res.status(200).json({ signature })
if (!fromBridgeAddress)
return res.status(400).send('fromBridgeAddress not specified')
if (!toBridgeAssistAddress)
return res.status(400).send('toBridgeAssistAddress not specified')
if (!fromChain) return res.status(400).send('from chain not specified')
if (!fromUser) return res.status(400).send('from user not specified')
if (!index) return res.status(400).send('index not specified')
console.log(fromBridgeAddress, toBridgeAssistAddress, fromChain, fromUser, index)
const signature = await signTransaction(
fromBridgeAddress,
toBridgeAssistAddress,
fromChain,
fromUser,
index
).catch(console.error)
res.status(200).json({ signature })
} catch (error: any) {
console.log(error)
throw new Error(error.message)
}
},
})
46 changes: 34 additions & 12 deletions backend-usdt/src/routes/sign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,41 @@ import { signTransaction } from '@/services/blockchain'

export default (): Resource => ({
async get(
req: Request<{}, {}, {}, { fromBridgeAddress?: string, toBridgeAssistAddress?: string, fromChain?: string; fromUser?: string; index?: string }>,
req: Request<
{},
{},
{},
{
fromBridgeAddress?: string
toBridgeAssistAddress?: string
fromChain?: string
fromUser?: string
index?: string
}
>,
res
) {
const { fromBridgeAddress, toBridgeAssistAddress, fromChain, fromUser, index } = req.query
if (!fromBridgeAddress) return res.status(400).send('fromBridgeAddress not specified')
if (!toBridgeAssistAddress) return res.status(400).send('toBridgeAssistAddress not specified')
if (!fromChain) return res.status(400).send('from chain not specified')
if (!fromUser) return res.status(400).send('from user not specified')
if (!index) return res.status(400).send('index not specified')
console.log(fromBridgeAddress, toBridgeAssistAddress, fromChain, fromUser, index)
const signature = await signTransaction(fromBridgeAddress, toBridgeAssistAddress, fromChain, fromUser, index).catch(
console.error
)
res.status(200).json({ signature })
try {
const { fromBridgeAddress, toBridgeAssistAddress, fromChain, fromUser, index } =
req.query
if (!fromBridgeAddress)
return res.status(400).send('fromBridgeAddress not specified')
if (!toBridgeAssistAddress)
return res.status(400).send('toBridgeAssistAddress not specified')
if (!fromChain) return res.status(400).send('from chain not specified')
if (!fromUser) return res.status(400).send('from user not specified')
if (!index) return res.status(400).send('index not specified')
console.log(fromBridgeAddress, toBridgeAssistAddress, fromChain, fromUser, index)
const signature = await signTransaction(
fromBridgeAddress,
toBridgeAssistAddress,
fromChain,
fromUser,
index
)
res.status(200).json({ signature })
} catch (error: any) {
throw new Error(error.message)
}
},
})
2 changes: 1 addition & 1 deletion backend-usdt/src/services/blockchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { TypedDataSigner } from '@ethersproject/abstract-signer'
import { GotbitKmsSigner } from '@/lib/kms-signer'
import CONFIRMATIONS from '../confirmations.json'

export const REAL_CHAIN_IDS: ChainId[] = ['97', '42421', '421614', '200810', '200901', '42420', '42161', '56', '8453', '84532']
export const REAL_CHAIN_IDS: ChainId[] = ['97', '42421', '421614', '200810', '200901', '42420', '42161', '56', '8453', '84532', "1"]

const EIP712DOMAIN_NAME = 'BridgeAssist'
const EIP712DOMAIN_VERSION = '1.0'
Expand Down
26 changes: 15 additions & 11 deletions backend-weth/src/routes/sign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ export default (): Resource => ({
req: Request<{}, {}, {}, { fromBridgeAddress?: string, toBridgeAssistAddress?: string, fromChain?: string; fromUser?: string; index?: string }>,
res
) {
const { fromBridgeAddress, toBridgeAssistAddress, fromChain, fromUser, index } = req.query
if (!fromBridgeAddress) return res.status(400).send('fromBridgeAddress not specified')
if (!toBridgeAssistAddress) return res.status(400).send('toBridgeAssistAddress not specified')
if (!fromChain) return res.status(400).send('from chain not specified')
if (!fromUser) return res.status(400).send('from user not specified')
if (!index) return res.status(400).send('index not specified')
console.log(fromBridgeAddress, toBridgeAssistAddress, fromChain, fromUser, index)
const signature = await signTransaction(fromBridgeAddress, toBridgeAssistAddress, fromChain, fromUser, index).catch(
console.error
)
res.status(200).json({ signature })
try {
const { fromBridgeAddress, toBridgeAssistAddress, fromChain, fromUser, index } = req.query
if (!fromBridgeAddress) return res.status(400).send('fromBridgeAddress not specified')
if (!toBridgeAssistAddress) return res.status(400).send('toBridgeAssistAddress not specified')
if (!fromChain) return res.status(400).send('from chain not specified')
if (!fromUser) return res.status(400).send('from user not specified')
if (!index) return res.status(400).send('index not specified')
console.log(fromBridgeAddress, toBridgeAssistAddress, fromChain, fromUser, index)
const signature = await signTransaction(fromBridgeAddress, toBridgeAssistAddress, fromChain, fromUser, index)
res.status(200).json({ signature })
} catch (error: any) {
console.log(error)
throw new Error(error.message);
}

},
})
3 changes: 2 additions & 1 deletion frontend/src/store/contracts/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ export const useToken = defineContractStore<
}
} else {
// Fetch symbol and decimals for non-native tokens
symbol = await safeRead(contract.anyToken(item.token).symbol(), 'RWA')
const _symbol = await safeRead(contract.anyToken(item.token).symbol(), 'RWA')
symbol = _symbol === 'USDT' || _symbol === 'USD₮0' ? "USDT" : _symbol
decimals = await safeRead(contract.anyToken(item.token).decimals(), 6)
}

Expand Down

0 comments on commit a73dfd1

Please sign in to comment.