UNPKG

@velora-dex/sdk

Version:
94 lines 3.49 kB
import { Bridge } from '../..'; import { SwapSide } from '../../constants'; import type { ConstructFetchInput, EnumerateLiteral, RequestParameters } from '../../types'; import { BridgePriceInfo } from './helpers/types'; type SwapSideUnion = EnumerateLiteral<typeof SwapSide>; export type DeltaPriceParams = { /** @description Source Token Address. Not Native Token */ srcToken: string; /** @description Destination Token Address */ destToken: string; /** @description srcToken amount in wei */ amount: string; /** @description Source Token Decimals */ srcDecimals: number; /** @description Destination Token Decimals */ destDecimals: number; /** @description User's Wallet Address */ userAddress?: string; /** @description Beneficiary Address */ beneficiary?: string; /** @description Partner string. */ partner?: string; /** @description Destination Chain ID for Crosschain Orders */ destChainId?: number; /** @description SELL or BUY, default is SELL */ side?: SwapSideUnion; includeAgents?: string[]; excludeAgents?: string[]; }; export declare const DEFAULT_BRIDGE: { readonly protocolSelector: "0x00000000"; readonly destinationChainId: 0; readonly outputToken: "0x0000000000000000000000000000000000000000"; readonly scalingFactor: 0; readonly protocolData: "0x"; }; export type DeltaPrice = { srcToken: string; destToken: string; srcAmount: string; /** @description Available for BUY side */ srcAmountBeforeFee?: string; destAmount: string; /** @description Available for SELL side */ destAmountBeforeFee?: string; /** @description amount of the final outcome token */ receivedDestAmount: string; receivedDestUSD: string; /** @description Available for SELL side */ receivedDestAmountBeforeFee?: string; /** @description Available for SELL side */ receivedDestUSDBeforeFee?: string; gasCost: string; gasCostBeforeFee: string; gasCostUSD: string; gasCostUSDBeforeFee: string; srcUSD: string; /** @description Available for BUY side */ srcUSDBeforeFee?: string; destUSD: string; /** @description Available for SELL side */ destUSDBeforeFee?: string; partner: string; partnerFee: number; hmac: string; bridge: Bridge; }; type AvailableBridgePrice = Pick<DeltaPrice, 'destToken' | 'destAmount' | 'destAmountBeforeFee' | 'destUSD' | 'destUSDBeforeFee' | 'gasCostUSD' | 'gasCost' | 'gasCostUSDBeforeFee' | 'gasCostBeforeFee'>; type AvailableBridge = AvailableBridgePrice & { bridgeParams: { bridge: Bridge; bridgeInfo: BridgePriceInfo; }[]; }; export type BridgePrice = Omit<DeltaPrice, 'bridge'> & { bridge: Bridge; bridgeInfo: BridgePriceInfo; availableBridges: AvailableBridge[]; }; interface GetDeltaPrice { (options: DeltaPriceParams & { destChainId: number; }, requestParams?: RequestParameters): Promise<BridgePrice>; (options: DeltaPriceParams & { destChainId?: undefined; }, requestParams?: RequestParameters): Promise<DeltaPrice>; (options: DeltaPriceParams, requestParams?: RequestParameters): Promise<DeltaPrice | BridgePrice>; } export type GetDeltaPriceFunctions = { getDeltaPrice: GetDeltaPrice; }; export declare const constructGetDeltaPrice: ({ apiURL, chainId, fetcher, }: ConstructFetchInput) => GetDeltaPriceFunctions; export {}; //# sourceMappingURL=getDeltaPrice.d.ts.map