Skip to content

Commit 10e70b4

Browse files
committed
fix(packages/bridging/src/providers/near-intents/util.ts): fixes hashQuote
1 parent 5c04822 commit 10e70b4

File tree

1 file changed

+33
-1
lines changed
  • packages/bridging/src/providers/near-intents

1 file changed

+33
-1
lines changed

packages/bridging/src/providers/near-intents/util.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,39 @@ export const hashQuote = ({
6464
timestamp: any
6565
}): Hex => {
6666
const adapter = getGlobalAdapter()
67-
const data = stringify({ ...quoteRequest, ...quote, timestamp })
67+
const data = stringify({
68+
dry: false,
69+
swapType: quoteRequest.swapType,
70+
slippageTolerance: quoteRequest.slippageTolerance,
71+
originAsset: quoteRequest.originAsset,
72+
depositType: quoteRequest.depositType,
73+
destinationAsset: quoteRequest.destinationAsset,
74+
amount: quoteRequest.amount,
75+
refundTo: quoteRequest.refundTo,
76+
refundType: quoteRequest.refundType,
77+
recipient: quoteRequest.recipient,
78+
recipientType: quoteRequest.recipientType,
79+
deadline: quoteRequest.deadline,
80+
quoteWaitingTimeMs: !!quoteRequest.quoteWaitingTimeMs ? quoteRequest.quoteWaitingTimeMs : undefined,
81+
referral: !!quoteRequest.referral ? quoteRequest.referral : undefined,
82+
virtualChainRecipient: !!quoteRequest.virtualChainRecipient ? quoteRequest.virtualChainRecipient : undefined,
83+
virtualChainRefundRecipient: !!quoteRequest.virtualChainRefundRecipient
84+
? quoteRequest.virtualChainRefundRecipient
85+
: undefined,
86+
customRecipientMsg: undefined,
87+
sessionId: undefined,
88+
connectedWallets: undefined,
89+
depositMode: quoteRequest.depositMode,
90+
amountIn: quote.amountIn,
91+
amountInFormatted: quote.amountInFormatted,
92+
amountInUsd: quote.amountInUsd,
93+
minAmountIn: quote.minAmountIn,
94+
amountOut: quote.amountOut,
95+
amountOutFormatted: quote.amountOutFormatted,
96+
amountOutUsd: quote.amountOutUsd,
97+
minAmountOut: quote.minAmountOut,
98+
timestamp,
99+
})
68100
if (!data) {
69101
throw new Error('Failed to serialize quote data: quote or quoteRequest may be undefined or invalid')
70102
}

0 commit comments

Comments
 (0)