Skip to content

Commit

Permalink
feat(synapse-interface): use origin user address for getting bridge q…
Browse files Browse the repository at this point in the history
…uotes (#2969)

* feat: pass connected address as `originUserAddress` option

* feat: use `originUserAddress` option for gas estimation
  • Loading branch information
ChiTimesChi authored Aug 6, 2024
1 parent 48de090 commit 5e61cf3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ const StateManagedBridge = () => {
toChainId,
fromToken.addresses[fromChainId],
toToken.addresses[toChainId],
stringToBigInt(debouncedFromValue, fromToken?.decimals[fromChainId])
stringToBigInt(debouncedFromValue, fromToken?.decimals[fromChainId]),
{
originUserAddress: address,
}
)

const pausedBridgeModules = new Set(
Expand Down
11 changes: 8 additions & 3 deletions packages/synapse-interface/utils/hooks/useGasEstimator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,19 @@ const getBridgeQuote = async (
toChainId: number,
fromToken: Token,
toToken: Token,
amount: string
amount: string,
userAddress: string
) => {
try {
return await synapseSDK.bridgeQuote(
fromChainId,
toChainId,
fromToken.addresses[fromChainId],
toToken.addresses[toChainId],
stringToBigInt(amount, fromToken?.decimals[fromChainId])
stringToBigInt(amount, fromToken?.decimals[fromChainId]),
{
originUserAddress: userAddress,
}
)
} catch (error) {
console.error('getBridgeQuote: ', error)
Expand Down Expand Up @@ -248,7 +252,8 @@ const queryEstimatedBridgeGasLimit = async (
toChainId,
fromToken,
toToken,
amount
amount,
address // userAddress
)

const bridgePayload = await getBridgePayload(
Expand Down

0 comments on commit 5e61cf3

Please sign in to comment.