Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: release v1.772.0 #8863

Merged
merged 7 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .env.base
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ REACT_APP_FEATURE_SAVERS_VAULTS_DEPOSIT=false
REACT_APP_FEATURE_SAVERS_VAULTS_WITHDRAW=false
REACT_APP_FEATURE_WALLET_CONNECT_TO_DAPPS_V2=true
REACT_APP_FEATURE_WALLET_CONNECT_TO_DAPPS=true
REACT_APP_FEATURE_YAT=true
REACT_APP_FEATURE_NFT_METADATA=false
REACT_APP_FEATURE_CHATWOOT=false
REACT_APP_FEATURE_ADVANCED_SLIPPAGE=true
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/swapper/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { makeSwapErrorRight } from './utils'

export const DEFAULT_GET_TRADE_QUOTE_POLLING_INTERVAL = 20_000
export const QUOTE_TIMEOUT_MS = 60_000
export const TRADE_POLL_INTERVAL_MILLISECONDS = 10_000
export const TRADE_POLL_INTERVAL_MILLISECONDS = 5_000

export const QUOTE_TIMEOUT_ERROR = makeSwapErrorRight({
message: `quote timed out after ${QUOTE_TIMEOUT_MS / 1000}s`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export async function getTradeQuote(
slippageTolerancePercentageDecimal: getDefaultSlippageDecimalPercentageForSwapper(
SwapperName.ArbitrumBridge,
),
swapperName: SwapperName.ArbitrumBridge,
steps: [
{
estimatedExecutionTimeMs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export async function getTradeRate(
slippageTolerancePercentageDecimal: getDefaultSlippageDecimalPercentageForSwapper(
SwapperName.ArbitrumBridge,
),
swapperName: SwapperName.ArbitrumBridge,
steps: [
{
estimatedExecutionTimeMs,
Expand Down
11 changes: 11 additions & 0 deletions packages/swapper/src/swappers/ChainflipSwapper/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,14 @@ export const usdcAsset: Asset = {
relatedAssetKey: 'eip155:1/erc20:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
symbol: 'USDC',
}

export enum ChainflipStatusMessage {
WaitingForDeposit = 'Waiting for deposit...',
DepositDetected = 'Deposit detected, waiting for confirmation...',
ProcessingSwap = 'Processing swap...',
OutboundTransactionInitiated = 'Outbound transaction initiated...',
PreparingOutboundTransaction = 'Preparing outbound transaction...',
TransactionSent = 'Transaction sent, waiting for confirmation...',
SwapComplete = 'Swap complete',
SwapFailed = 'Swap failed',
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import type {
UtxoFeeData,
} from '../../types'
import { isExecutableTradeQuote, isExecutableTradeStep, isToken } from '../../utils'
import { ChainflipStatusMessage } from './constants'
import type { ChainflipBaasSwapDepositAddress } from './models'
import { getTradeQuote } from './swapperApi/getTradeQuote'
import { getTradeRate } from './swapperApi/getTradeRate'
Expand Down Expand Up @@ -297,7 +298,8 @@ export const chainflipApi: SwapperApi = {
return {
buyTxHash: undefined,
status: TxStatus.Unknown,
message: undefined,
// assume the swap is not yet seen on that call
message: ChainflipStatusMessage.WaitingForDeposit,
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
import { ChainflipStatusMessage } from '../constants'
import type { ChainFlipStatus } from '../types'

export const getLatestChainflipStatusMessage = (status: ChainFlipStatus): string => {
const { state, swapEgress } = status.status

switch (state) {
case 'waiting':
return 'Waiting for deposit...'
return ChainflipStatusMessage.WaitingForDeposit
case 'receiving':
return 'Deposit detected, waiting for confirmation...'
return ChainflipStatusMessage.DepositDetected
case 'swapping':
return 'Processing swap...'
return ChainflipStatusMessage.ProcessingSwap
case 'sent':
return 'Transaction sent, waiting for confirmation...'
return ChainflipStatusMessage.TransactionSent
case 'sending':
return swapEgress?.transactionReference
? 'Outbound transaction initiated...'
: 'Preparing outbound transaction...'
? ChainflipStatusMessage.OutboundTransactionInitiated
: ChainflipStatusMessage.PreparingOutboundTransaction
case 'completed':
return 'Swap complete'
return ChainflipStatusMessage.SwapComplete
case 'failed':
return 'Swap failed'
return ChainflipStatusMessage.SwapFailed
default:
return 'Unknown status'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ export const getQuoteOrRate = async (
slippageTolerancePercentageDecimal:
input.slippageTolerancePercentageDecimal ??
getDefaultSlippageDecimalPercentageForSwapper(SwapperName.Chainflip),
swapperName: SwapperName.Chainflip,
steps: [
{
buyAmountBeforeFeesCryptoBaseUnit,
Expand Down Expand Up @@ -376,6 +377,7 @@ export const getQuoteOrRate = async (
slippageTolerancePercentageDecimal:
input.slippageTolerancePercentageDecimal ??
getDefaultSlippageDecimalPercentageForSwapper(SwapperName.Chainflip),
swapperName: SwapperName.Chainflip,
steps: [
{
buyAmountBeforeFeesCryptoBaseUnit,
Expand Down
4 changes: 4 additions & 0 deletions packages/swapper/src/swappers/CowSwapper/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export enum CowStatusMessage {
Open = 'Order Placed',
Fulfilled = 'Order Fulfilled',
}
5 changes: 3 additions & 2 deletions packages/swapper/src/swappers/CowSwapper/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import type {
} from '../../types'
import { SwapperName } from '../../types'
import { checkSafeTransactionStatus, getHopByIndex, isExecutableTradeQuote } from '../../utils'
import { CowStatusMessage } from './constants'
import { getCowSwapTradeQuote } from './getCowSwapTradeQuote/getCowSwapTradeQuote'
import { getCowSwapTradeRate } from './getCowSwapTradeRate/getCowSwapTradeRate'
import type { CowSwapGetTradesResponse } from './types'
Expand Down Expand Up @@ -183,14 +184,14 @@ export const cowApi: SwapperApi = {
return {
status: TxStatus.Confirmed,
buyTxHash,
message: 'fulfilled',
message: CowStatusMessage.Fulfilled,
}
}

return {
status: TxStatus.Pending,
buyTxHash: undefined,
message: 'open',
message: CowStatusMessage.Open,
}
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ const expectedTradeQuoteWethToFox: TradeQuote = {
potentialAffiliateBps: '0',
rate: '14924.80846543344314936607', // 14942 FOX per WETH
slippageTolerancePercentageDecimal: '0.005',
swapperName: SwapperName.CowSwap,
steps: [
{
estimatedExecutionTimeMs: undefined,
Expand Down Expand Up @@ -191,6 +192,7 @@ const expectedTradeQuoteFoxToEth: TradeQuote = {
potentialAffiliateBps: '0',
rate: '0.00004995640398295996',
slippageTolerancePercentageDecimal: '0.005',
swapperName: SwapperName.CowSwap,
steps: [
{
estimatedExecutionTimeMs: undefined,
Expand Down Expand Up @@ -237,6 +239,7 @@ const expectedTradeQuoteUsdcToXdai: TradeQuote = {
potentialAffiliateBps: '0',
rate: '1.0003121775396440882',
slippageTolerancePercentageDecimal: '0.005',
swapperName: SwapperName.CowSwap,
steps: [
{
allowanceContract: '0xc92e8bdf79f0507f65a392b0ab4667716bfe0110',
Expand Down Expand Up @@ -283,6 +286,7 @@ const expectedTradeQuoteUsdcToEthArbitrum: TradeQuote = {
potentialAffiliateBps: '0',
rate: '0.00028787191526496171',
slippageTolerancePercentageDecimal: '0.005',
swapperName: SwapperName.CowSwap,
steps: [
{
allowanceContract: '0xc92e8bdf79f0507f65a392b0ab4667716bfe0110',
Expand Down Expand Up @@ -329,6 +333,7 @@ const expectedTradeQuoteSmallAmountWethToFox: TradeQuote = {
potentialAffiliateBps: '0',
rate: '14716.04718939437523468382', // 14716 FOX per WETH
slippageTolerancePercentageDecimal: '0.005',
swapperName: SwapperName.CowSwap,
steps: [
{
estimatedExecutionTimeMs: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ async function _getCowSwapTradeQuote(
potentialAffiliateBps,
rate,
slippageTolerancePercentageDecimal,
swapperName: SwapperName.CowSwap,
steps: [
{
estimatedExecutionTimeMs: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ async function _getCowSwapTradeRate(
potentialAffiliateBps,
rate,
slippageTolerancePercentageDecimal,
swapperName: SwapperName.CowSwap,
steps: [
{
estimatedExecutionTimeMs: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ export const getTradeQuote = async (
receiveAddress,
slippageTolerancePercentageDecimal,
priceImpactPercentageDecimal: priceResponse.priceImpactPct,
swapperName: SwapperName.Jupiter,
steps: [
{
accountNumber,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ export const getTradeRate = async (
affiliateBps,
priceImpactPercentageDecimal: priceResponse.priceImpactPct,
slippageTolerancePercentageDecimal,
swapperName: SwapperName.Jupiter,
steps: [
{
buyAmountBeforeFeesCryptoBaseUnit: priceResponse.outAmount,
Expand Down
5 changes: 5 additions & 0 deletions packages/swapper/src/swappers/LifiSwapper/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export enum LifiStatusMessage {
BridgeWaitingForConfirmations = 'The bridge deposit has been received. The bridge is waiting for more confirmations to start the off-chain logic.',
BridgeOffChainExecution = 'The bridge off-chain logic is being executed. Wait for the transaction to appear in the destination chain.',
BridgeComplete = 'The transfer is complete.',
}
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ export async function getTrade({
},
affiliateBps,
potentialAffiliateBps,
swapperName: SwapperName.LIFI,
steps,
rate: netRate,
selectedLifiRoute,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ export async function getPortalsTradeQuote(
potentialAffiliateBps,
rate: inputOutputRate,
slippageTolerancePercentageDecimal,
swapperName: SwapperName.Portals,
steps: [
{
accountNumber,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export async function getPortalsTradeRate(
potentialAffiliateBps,
rate: inputOutputRate,
slippageTolerancePercentageDecimal,
swapperName: SwapperName.Portals,
steps: [
{
estimatedExecutionTimeMs: undefined, // Portals doesn't provide this info
Expand Down
16 changes: 16 additions & 0 deletions packages/swapper/src/swappers/ThorchainSwapper/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,19 @@ export const getMaxBytesLengthByChainId = (chainId: ChainId) => {
if (isUtxoChainId(chainId)) return BTC_MAXIMUM_BYTES_LENGTH
return Infinity
}

export enum ThorchainStatusMessage {
InboundObserved = 'Inbound transaction accepted by THOR',
InboundObservingPending = 'Inbound transaction pending',
InboundConfirmationCounted = 'Inbound transaction confirmed',
InboundConfirmationPending = 'Awaiting inbound transaction confirmation',
InboundFinalized = 'Inbound transaction finalized',
InboundFinalizationPending = 'Awaiting inbound transaction finalization',
SwapPending = 'Swap pending',
SwapCompleteAwaitingOutbound = 'Swap complete, awaiting outbound transaction',
SwapCompleteAwaitingDestination = 'Swap complete, awaiting destination chain',
OutboundDelayTimeRemaining = 'Awaiting outbound delay ({timeRemaining} remaining)',
OutboundDelayPending = 'Awaiting outbound delay',
OutboundSigned = 'Outbound transaction transmitted, waiting on destination chain...',
OutboundScheduled = 'Outbound transaction scheduled, waiting on destination chain...',
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const expectedQuoteResponse: Omit<ThorEvmTradeQuote, 'id'>[] = [
tradeType: TradeType.L1ToL1,
slippageTolerancePercentageDecimal: '0.04357',
expiry: 1713710808,
swapperName: SwapperName.Thorchain,
steps: [
{
estimatedExecutionTimeMs: 1600000,
Expand Down Expand Up @@ -110,6 +111,7 @@ const expectedQuoteResponse: Omit<ThorEvmTradeQuote, 'id'>[] = [
tradeType: TradeType.L1ToL1,
slippageTolerancePercentageDecimal: undefined,
expiry: 1713710808,
swapperName: SwapperName.Thorchain,
steps: [
{
estimatedExecutionTimeMs: 1600000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ export const getL1Rate = async (
vault,
expiry: quote.expiry,
tradeType: tradeType ?? TradeType.L1ToL1,
swapperName: SwapperName.Thorchain,
steps: [
{
estimatedExecutionTimeMs,
Expand Down Expand Up @@ -378,6 +379,7 @@ export const getL1Rate = async (
? undefined
: slippageTolerancePercentageDecimal,
rate,
swapperName: SwapperName.Thorchain,
steps: [
{
estimatedExecutionTimeMs,
Expand Down Expand Up @@ -458,6 +460,7 @@ export const getL1Rate = async (
: slippageTolerancePercentageDecimal,
rate,
tradeType: tradeType ?? TradeType.L1ToL1,
swapperName: SwapperName.Thorchain,
steps: [
{
estimatedExecutionTimeMs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ export const getL1Quote = async (
vault,
expiry: quote.expiry,
tradeType: tradeType ?? TradeType.L1ToL1,
swapperName: SwapperName.Thorchain,
steps: [
{
estimatedExecutionTimeMs,
Expand Down Expand Up @@ -395,6 +396,7 @@ export const getL1Quote = async (
? undefined
: slippageTolerancePercentageDecimal,
rate,
swapperName: SwapperName.Thorchain,
steps: [
{
estimatedExecutionTimeMs,
Expand Down Expand Up @@ -490,6 +492,7 @@ export const getL1Quote = async (
: slippageTolerancePercentageDecimal,
rate,
tradeType: tradeType ?? TradeType.L1ToL1,
swapperName: SwapperName.Thorchain,
steps: [
{
estimatedExecutionTimeMs,
Expand Down
Loading