@gera2ld/lib-dex 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +3 -0
  2. package/dist/common/abis/index.d.ts +2 -0
  3. package/dist/common/constants.d.ts +9 -0
  4. package/dist/common/evm.d.ts +1 -0
  5. package/dist/common/index.d.ts +4 -0
  6. package/dist/common/types.d.ts +13 -0
  7. package/dist/common/util.d.ts +21 -0
  8. package/dist/index.d.ts +7 -0
  9. package/dist/index.js +17853 -0
  10. package/dist/node/index.d.ts +1 -0
  11. package/dist/node/index.js +23 -0
  12. package/dist/node/wallets/index.d.ts +1 -0
  13. package/dist/node/wallets/solana/index.d.ts +3 -0
  14. package/dist/prices/coingecko.d.ts +5 -0
  15. package/dist/prices/coingecko.integration.d.ts +1 -0
  16. package/dist/prices/index.d.ts +7 -0
  17. package/dist/prices/lifi.d.ts +4 -0
  18. package/dist/quotes/1inch/index.d.ts +60 -0
  19. package/dist/quotes/1inch/index.integration.d.ts +1 -0
  20. package/dist/quotes/base.d.ts +43 -0
  21. package/dist/quotes/deprecated-0x/index.d.ts +46 -0
  22. package/dist/quotes/deprecated-0x/types.d.ts +56 -0
  23. package/dist/quotes/index.d.ts +22 -0
  24. package/dist/quotes/jupiter/index.d.ts +2 -0
  25. package/dist/quotes/jupiter/metis.d.ts +35 -0
  26. package/dist/quotes/jupiter/metis.integration.d.ts +1 -0
  27. package/dist/quotes/jupiter/metis.types.d.ts +35 -0
  28. package/dist/quotes/jupiter/ultra.d.ts +44 -0
  29. package/dist/quotes/jupiter/ultra.integration.d.ts +1 -0
  30. package/dist/quotes/jupiter/ultra.types.d.ts +20 -0
  31. package/dist/quotes/kyberswap/index.d.ts +39 -0
  32. package/dist/quotes/kyberswap/index.integration.d.ts +1 -0
  33. package/dist/quotes/kyberswap/types.d.ts +18 -0
  34. package/dist/quotes/lifi/index.d.ts +36 -0
  35. package/dist/quotes/lifi/types.d.ts +53 -0
  36. package/dist/quotes/lifi/util.d.ts +6 -0
  37. package/dist/quotes/odos/index.d.ts +32 -0
  38. package/dist/quotes/odos/index.integration.d.ts +1 -0
  39. package/dist/quotes/odos/types.d.ts +21 -0
  40. package/dist/quotes/paraswap/index.d.ts +39 -0
  41. package/dist/quotes/paraswap/types.d.ts +25 -0
  42. package/dist/quotes/types.d.ts +36 -0
  43. package/dist/tokens/chain/evm.d.ts +2 -0
  44. package/dist/tokens/chain/index.d.ts +5 -0
  45. package/dist/tokens/chain/solana.d.ts +2 -0
  46. package/dist/tokens/constants.d.ts +2 -0
  47. package/dist/tokens/index.d.ts +4 -0
  48. package/dist/tokens/lifi.d.ts +4 -0
  49. package/dist/transactions/evm/ankr.d.ts +70 -0
  50. package/dist/transactions/evm/ankr.integration.d.ts +1 -0
  51. package/dist/transactions/evm/index.d.ts +2 -0
  52. package/dist/transactions/evm/wallet.d.ts +21 -0
  53. package/dist/transactions/index.d.ts +6 -0
  54. package/dist/transactions/index.integration.d.ts +1 -0
  55. package/dist/transactions/solana/index.d.ts +1 -0
  56. package/dist/transactions/solana/wallet.d.ts +38 -0
  57. package/dist/transactions/solana/wallet.integration.d.ts +1 -0
  58. package/dist/transactions/types.d.ts +15 -0
  59. package/dist/trezor/index.d.ts +12 -0
  60. package/dist/trezor/util.d.ts +9 -0
  61. package/dist/wallets/common.d.ts +2 -0
  62. package/dist/wallets/evm/client.d.ts +25 -0
  63. package/dist/wallets/evm/index.d.ts +2 -0
  64. package/dist/wallets/evm/wallet.d.ts +71 -0
  65. package/dist/wallets/index.d.ts +4 -0
  66. package/dist/wallets/solana/index.d.ts +2 -0
  67. package/dist/wallets/solana/util/connection.d.ts +6 -0
  68. package/dist/wallets/solana/wallet.d.ts +55 -0
  69. package/dist/wallets/types.d.ts +34 -0
  70. package/package.json +47 -0
@@ -0,0 +1 @@
1
+ export * from './wallets';
@@ -0,0 +1,23 @@
1
+ import { createHash as i } from "node:crypto";
2
+ import { toHex as a } from "viem";
3
+ function r(e) {
4
+ return a(e.slice(0, 8)).slice(2);
5
+ }
6
+ function o(e) {
7
+ const t = i("sha256").update(e).digest(), n = new Uint8Array(t);
8
+ return r(n);
9
+ }
10
+ function c(e) {
11
+ return o(
12
+ `global:${e.replace(/[A-Z]/g, (t) => "_" + t.toLowerCase())}`
13
+ );
14
+ }
15
+ const l = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
16
+ __proto__: null,
17
+ getDiscriminator: o,
18
+ getDiscriminatorByInstructionName: c,
19
+ getDiscriminatorBySha256: r
20
+ }, Symbol.toStringTag, { value: "Module" }));
21
+ export {
22
+ l as solana
23
+ };
@@ -0,0 +1 @@
1
+ export * as solana from './solana';
@@ -0,0 +1,3 @@
1
+ export declare function getDiscriminatorBySha256(bytes: Uint8Array): string;
2
+ export declare function getDiscriminator(input: string): string;
3
+ export declare function getDiscriminatorByInstructionName(name: string): string;
@@ -0,0 +1,5 @@
1
+ import { type ISupportedChains } from '../common';
2
+ /**
3
+ * Use Jupiter/Pyth when possible, and use Lifi as a fallback.
4
+ */
5
+ export declare const getTokenPriceFromCoinGecko: import("@gera2ld/async-memo").CachedFunction<[chain: ISupportedChains, address: string | string[]], Record<string, number>, Map<string, import("@gera2ld/async-memo").CacheData<unknown>>>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { ISupportedChains } from '@/common';
2
+ import { getTokenPriceFromCoinGecko } from './coingecko';
3
+ import { getTokenPriceFromLifi } from './lifi';
4
+ export { getTokenPriceFromCoinGecko, getTokenPriceFromLifi };
5
+ type PriceProvider = (chain: ISupportedChains, address: string[]) => Promise<Record<string, number>>;
6
+ export declare function getTokenPrice(chain: ISupportedChains, address: string | string[]): Promise<Record<string, number>>;
7
+ export declare function setTokenPriceProvider(newProvider: PriceProvider): void;
@@ -0,0 +1,4 @@
1
+ import type { ISupportedChains } from '@/common';
2
+ export declare function getTokenPriceFromLifi(chain: ISupportedChains, address: string[]): Promise<{
3
+ [k: string]: number;
4
+ }>;
@@ -0,0 +1,60 @@
1
+ import { type ISupportedChains } from '@/common';
2
+ import { type IWallet } from '@/wallets';
3
+ import { type LimitOrderV4Struct } from '@1inch/fusion-sdk';
4
+ import { Logger } from '@gera2ld/common';
5
+ import { BaseProvider } from '../base';
6
+ import type { ICheckQuoteResult } from '../types';
7
+ export declare class OneInchProvider extends BaseProvider {
8
+ static readonly providerName = "1inch";
9
+ static supportedChains: ISupportedChains[];
10
+ static enabled: boolean;
11
+ static apiKey: string;
12
+ static setApiKey(key: string): void;
13
+ logger: Logger;
14
+ private _sdk;
15
+ private get sdk();
16
+ private getQuote;
17
+ checkQuote(options: {
18
+ address: string;
19
+ fromAmount: number;
20
+ fromToken: string;
21
+ toToken: string;
22
+ slippage?: number;
23
+ }): Promise<ICheckQuoteResult>;
24
+ _1inchPrepareData(data: {
25
+ quoteData: ICheckQuoteResult;
26
+ }): {
27
+ quoteId: string;
28
+ orderStruct: LimitOrderV4Struct;
29
+ extension: string;
30
+ dataToSign: Record<string, unknown>;
31
+ };
32
+ _1inchSendTransaction(payload: {
33
+ quoteId: string;
34
+ orderStruct: LimitOrderV4Struct;
35
+ extension: string;
36
+ signature: string;
37
+ }): Promise<{
38
+ hash: string;
39
+ }>;
40
+ sendTransaction(data: {
41
+ quoteData: ICheckQuoteResult;
42
+ }, options: {
43
+ wallet: IWallet;
44
+ maxGasAmountInflated?: number | bigint;
45
+ }): Promise<{
46
+ hash: string;
47
+ }>;
48
+ confirmTransaction(pending: {
49
+ provider: string;
50
+ response: {
51
+ hash: string;
52
+ };
53
+ }): Promise<{
54
+ hash: string;
55
+ chain: ISupportedChains;
56
+ chainId: number;
57
+ gasFee: number;
58
+ priorityFee: number;
59
+ }>;
60
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,43 @@
1
+ import type { ISupportedChains } from '@/common';
2
+ import type { IPublicWallet, IWallet } from '../wallets';
3
+ import type { ICheckQuoteResult } from './types';
4
+ export declare abstract class BaseProvider {
5
+ chain: ISupportedChains;
6
+ static readonly providerName: string;
7
+ static supportedChains: ISupportedChains[];
8
+ static enabled: boolean;
9
+ constructor(chain: ISupportedChains);
10
+ abstract checkQuote(options: {
11
+ address: string;
12
+ fromAmount: number;
13
+ fromToken: string;
14
+ toToken: string;
15
+ slippage?: number;
16
+ }): Promise<ICheckQuoteResult>;
17
+ /**
18
+ * The returned request must be JSON serializable.
19
+ */
20
+ buildRequest(_data: {
21
+ quoteData: ICheckQuoteResult;
22
+ }): Promise<{
23
+ request: unknown;
24
+ }>;
25
+ sendTransaction(data: {
26
+ quoteData: ICheckQuoteResult;
27
+ }, { wallet, maxGasAmountInflated, }: {
28
+ wallet: IWallet;
29
+ maxGasAmountInflated?: number | bigint;
30
+ }): Promise<unknown>;
31
+ confirmTransaction(pending: {
32
+ provider: string;
33
+ response: unknown;
34
+ /** Wallet may not be needed for some providers, e.g. 1inch */
35
+ wallet?: IPublicWallet;
36
+ }): Promise<{
37
+ hash: string;
38
+ chain: string;
39
+ chainId: number;
40
+ gasFee?: number;
41
+ priorityFee?: number;
42
+ }>;
43
+ }
@@ -0,0 +1,46 @@
1
+ import { type ISupportedChains } from '@/common';
2
+ import { Logger } from '@gera2ld/common';
3
+ import { BaseProvider } from '../base.ts';
4
+ import type { ICheckQuoteResult, IQuoteInfo } from '../types.ts';
5
+ import type { IQuote } from './types.ts';
6
+ /**
7
+ * Price is not as good as others, and keeps sending spam emails.
8
+ */
9
+ export declare class ZeroExProvider extends BaseProvider {
10
+ static readonly providerName = "0x";
11
+ static supportedChains: ISupportedChains[];
12
+ static enabled: boolean;
13
+ static apiKey: string;
14
+ static setApiKey(key: string): void;
15
+ logger: Logger;
16
+ private getQuote;
17
+ checkQuote(options: {
18
+ address: string;
19
+ fromAmount: number;
20
+ fromToken: string;
21
+ toToken: string;
22
+ slippage?: number;
23
+ }): Promise<{
24
+ provider: string;
25
+ quoteState: {
26
+ quote: IQuote;
27
+ createdAt: number;
28
+ expiresAt: number;
29
+ };
30
+ quoteInfo: IQuoteInfo;
31
+ }>;
32
+ buildRequest(data: {
33
+ quoteData: ICheckQuoteResult;
34
+ }): Promise<{
35
+ request: {
36
+ to: string;
37
+ data: string;
38
+ gas: string;
39
+ gasPrice: string;
40
+ value: string;
41
+ };
42
+ permit2: {
43
+ eip712?: unknown;
44
+ };
45
+ }>;
46
+ }
@@ -0,0 +1,56 @@
1
+ export interface IQuote {
2
+ blockNumber: string;
3
+ buyAmount: string;
4
+ buyToken: string;
5
+ gas: string;
6
+ gasPrice: string;
7
+ issues: {
8
+ allowance: {
9
+ actual: string;
10
+ spender: string;
11
+ };
12
+ balance: {
13
+ token: string;
14
+ actual: string;
15
+ expected: string;
16
+ };
17
+ simulationIncomplete: boolean;
18
+ };
19
+ liquidityAvailable: boolean;
20
+ minBuyAmount: string;
21
+ sellAmount: string;
22
+ sellToken: string;
23
+ totalNetworkFee: string;
24
+ }
25
+ export interface IFirmQuote {
26
+ blockNumber: string;
27
+ buyAmount: string;
28
+ buyToken: string;
29
+ issues: {
30
+ allowance: {
31
+ actual: string;
32
+ spender: string;
33
+ };
34
+ balance: {
35
+ token: string;
36
+ actual: string;
37
+ expected: string;
38
+ };
39
+ simulationIncomplete: boolean;
40
+ };
41
+ liquidityAvailable: boolean;
42
+ minBuyAmount: string;
43
+ permit2: {
44
+ eip712?: unknown;
45
+ };
46
+ sellAmount: string;
47
+ sellToken: string;
48
+ totalNetworkFee: string;
49
+ transaction: {
50
+ to: string;
51
+ data: string;
52
+ gas: string;
53
+ gasPrice: string;
54
+ value: string;
55
+ };
56
+ }
@@ -0,0 +1,22 @@
1
+ import type { ISupportedChains } from '@/common';
2
+ import { OneInchProvider } from './1inch/index.ts';
3
+ import { BaseProvider } from './base.ts';
4
+ import { JupiterMetisProvider, JupiterUltraProvider } from './jupiter/index.ts';
5
+ import { KyberSwapProvider } from './kyberswap/index.ts';
6
+ import { LiFiProvider } from './lifi/index.ts';
7
+ import { OdosProvider } from './odos/index.ts';
8
+ import { ParaSwapProvider } from './paraswap/index.ts';
9
+ import type { IQuoteInfo } from './types';
10
+ export * from './base';
11
+ export * from './types';
12
+ export { JupiterMetisProvider, JupiterUltraProvider, KyberSwapProvider, LiFiProvider, OdosProvider, OneInchProvider, ParaSwapProvider, };
13
+ export declare const AllProviders: (typeof OneInchProvider | typeof JupiterMetisProvider | typeof JupiterUltraProvider | typeof KyberSwapProvider | typeof LiFiProvider | typeof OdosProvider | typeof ParaSwapProvider)[];
14
+ export declare function setEnabledProviders(names?: string[]): string[];
15
+ export declare function getProvider(chain: ISupportedChains, name: string): BaseProvider;
16
+ export declare function getProviders(chain: ISupportedChains, allowedProviders?: string[]): BaseProvider[];
17
+ export declare function getApprovalParams(quoteInfo: IQuoteInfo): {
18
+ address: string;
19
+ tokenAddress: string;
20
+ approvalAddress: string;
21
+ amount: bigint;
22
+ } | undefined;
@@ -0,0 +1,2 @@
1
+ export * from './metis';
2
+ export * from './ultra';
@@ -0,0 +1,35 @@
1
+ import type { ISupportedChains } from '@/common';
2
+ import { Logger } from '@gera2ld/common';
3
+ import { BaseProvider } from '../base.ts';
4
+ import type { ICheckQuoteResult, IQuoteInfo } from '../types.ts';
5
+ import type { IQuote } from './metis.types.ts';
6
+ export declare class JupiterMetisProvider extends BaseProvider {
7
+ static readonly providerName = "jupiter-metis";
8
+ static supportedChains: ISupportedChains[];
9
+ static enabled: boolean;
10
+ static apiKey: string;
11
+ static setApiKey(key: string): void;
12
+ logger: Logger;
13
+ private getHeaders;
14
+ private getQuote;
15
+ checkQuote(options: {
16
+ address: string;
17
+ fromAmount: number;
18
+ fromToken: string;
19
+ toToken: string;
20
+ slippage?: number;
21
+ }): Promise<{
22
+ provider: string;
23
+ quoteState: {
24
+ quote: IQuote;
25
+ createdAt: number;
26
+ expiresAt: number;
27
+ };
28
+ quoteInfo: IQuoteInfo;
29
+ }>;
30
+ buildRequest(data: {
31
+ quoteData: ICheckQuoteResult;
32
+ }): Promise<{
33
+ request: string;
34
+ }>;
35
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,35 @@
1
+ export interface IQuote {
2
+ inputMint: string;
3
+ outputMint: string;
4
+ inAmount: string;
5
+ outAmount: string;
6
+ otherAmountThreshold: string;
7
+ slippageBps: number;
8
+ swapMode: string;
9
+ priceImpactPct: string;
10
+ swapUsdValue: string;
11
+ }
12
+ export interface IRequest {
13
+ swapTransaction: string;
14
+ lastValidBlockHeight: number;
15
+ prioritizationFeeLamports: number;
16
+ computeUnitLimit: number;
17
+ prioritizationType: {
18
+ computeBudget: {
19
+ microLamports: number;
20
+ estimatedMicroLamports: number;
21
+ };
22
+ };
23
+ dynamicSlippageReport: {
24
+ slippageBps: number;
25
+ otherAmount: number;
26
+ simulatedIncurredSlippageBps: number;
27
+ amplificationRatio: string;
28
+ categoryName: string;
29
+ heuristicMaxSlippageBps: number;
30
+ };
31
+ simulationError?: {
32
+ errorCode: string;
33
+ error: string;
34
+ };
35
+ }
@@ -0,0 +1,44 @@
1
+ import { type ISupportedChains } from '@/common';
2
+ import { Logger } from '@gera2ld/common';
3
+ import type { IWallet } from '../../wallets/types.ts';
4
+ import { BaseProvider } from '../base.ts';
5
+ import type { ICheckQuoteResult, IQuoteInfo } from '../types.ts';
6
+ import type { IQuote } from './ultra.types.ts';
7
+ export declare class JupiterUltraProvider extends BaseProvider {
8
+ static readonly providerName = "jupiter-ultra";
9
+ static supportedChains: ISupportedChains[];
10
+ static enabled: boolean;
11
+ static apiKey: string;
12
+ static setApiKey(key: string): void;
13
+ logger: Logger;
14
+ private getHeaders;
15
+ private getQuote;
16
+ checkQuote(options: {
17
+ address: string;
18
+ fromAmount: number;
19
+ fromToken: string;
20
+ toToken: string;
21
+ }): Promise<{
22
+ provider: string;
23
+ quoteState: {
24
+ quote: IQuote;
25
+ createdAt: number;
26
+ expiresAt: number;
27
+ };
28
+ quoteInfo: IQuoteInfo;
29
+ }>;
30
+ _ultraSendTransaction(payload: {
31
+ requestId: string;
32
+ signedTransaction: string;
33
+ }): Promise<{
34
+ hash: string;
35
+ }>;
36
+ sendTransaction(data: {
37
+ quoteData: ICheckQuoteResult;
38
+ }, options: {
39
+ wallet: IWallet;
40
+ maxGasAmountInflated?: number | bigint;
41
+ }): Promise<{
42
+ hash: string;
43
+ }>;
44
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ export interface IQuote {
2
+ mode: string;
3
+ inputMint: string;
4
+ outputMint: string;
5
+ inAmount: string;
6
+ outAmount: string;
7
+ otherAmountThreshold: string;
8
+ slippageBps: number;
9
+ swapMode: string;
10
+ swapUsdValue: number;
11
+ inUsdValue: number;
12
+ outUsdValue: number;
13
+ priceImpact: number;
14
+ router: string;
15
+ transaction: string | null;
16
+ requestId: string;
17
+ expireAt?: string;
18
+ errorCode: number;
19
+ errorMessage: string;
20
+ }
@@ -0,0 +1,39 @@
1
+ import { type ISupportedChains } from '@/common';
2
+ import { Logger } from '@gera2ld/common';
3
+ import { type Address } from 'viem';
4
+ import { BaseProvider } from '../base.ts';
5
+ import type { ICheckQuoteResult, IQuoteInfo } from '../types.ts';
6
+ import type { IQuote } from './types.ts';
7
+ export declare class KyberSwapProvider extends BaseProvider {
8
+ static readonly providerName = "kyberswap";
9
+ static supportedChains: ISupportedChains[];
10
+ static enabled: boolean;
11
+ logger: Logger;
12
+ private getQuote;
13
+ checkQuote(options: {
14
+ address: string;
15
+ fromAmount: number;
16
+ fromToken: string;
17
+ toToken: string;
18
+ slippage?: number;
19
+ }): Promise<{
20
+ provider: string;
21
+ quoteState: {
22
+ quote: IQuote;
23
+ createdAt: number;
24
+ expiresAt: number;
25
+ };
26
+ quoteInfo: IQuoteInfo;
27
+ }>;
28
+ buildRequest(data: {
29
+ quoteData: ICheckQuoteResult;
30
+ }): Promise<{
31
+ request: {
32
+ data: `0x${string}`;
33
+ from: Address;
34
+ to: `0x${string}`;
35
+ gas: string;
36
+ gasPrice: string;
37
+ };
38
+ }>;
39
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ export interface IQuote {
2
+ code: number;
3
+ message: string;
4
+ data: {
5
+ routeSummary: {
6
+ tokenIn: string;
7
+ amountIn: string;
8
+ amountInUsd: string;
9
+ tokenOut: string;
10
+ amountOut: string;
11
+ amountOutUsd: string;
12
+ gas: string;
13
+ gasPrice: string;
14
+ gasUsd: string;
15
+ };
16
+ routerAddress: string;
17
+ };
18
+ }
@@ -0,0 +1,36 @@
1
+ import { type ISupportedChains } from '@/common';
2
+ import { Logger } from '@gera2ld/common';
3
+ import { type TransactionRequest } from 'viem';
4
+ import { BaseProvider } from '../base.ts';
5
+ import type { ICheckQuoteResult, IQuoteInfo } from '../types.ts';
6
+ import type { IQuote } from './types.ts';
7
+ export * from './util';
8
+ export declare class LiFiProvider extends BaseProvider {
9
+ static readonly providerName = "lifi";
10
+ static supportedChains: ISupportedChains[];
11
+ static enabled: boolean;
12
+ logger: Logger;
13
+ private getQuote;
14
+ checkQuote(options: {
15
+ address: string;
16
+ fromAmount: number;
17
+ fromToken: string;
18
+ toToken: string;
19
+ slippage?: number;
20
+ }): Promise<{
21
+ provider: string;
22
+ quoteState: {
23
+ quote: IQuote;
24
+ createdAt: number;
25
+ expiresAt: number;
26
+ };
27
+ quoteInfo: IQuoteInfo;
28
+ }>;
29
+ buildRequest(data: {
30
+ quoteData: ICheckQuoteResult;
31
+ }): Promise<{
32
+ request: `0x${string}` | undefined;
33
+ } | {
34
+ request: TransactionRequest;
35
+ }>;
36
+ }
@@ -0,0 +1,53 @@
1
+ export interface IQuoteToken {
2
+ address: string;
3
+ chainId: number;
4
+ symbol: string;
5
+ decimals: number;
6
+ name: string;
7
+ coinKey: string;
8
+ logoURI: string;
9
+ priceUSD: string;
10
+ }
11
+ export interface IQuoteGasCost {
12
+ type: 'SUM' | 'APPROVE' | 'SEND';
13
+ price: string;
14
+ estimate: string;
15
+ limit: string;
16
+ amount: string;
17
+ amountUSD: string;
18
+ token: IQuoteToken;
19
+ }
20
+ export interface IQuote {
21
+ id: string;
22
+ tool: string;
23
+ action: {
24
+ fromToken: IQuoteToken;
25
+ fromAmount: string;
26
+ toToken: IQuoteToken;
27
+ fromChainId: number;
28
+ toChainId: number;
29
+ slippage: number;
30
+ fromAddress: string;
31
+ toAddress: string;
32
+ };
33
+ estimate: {
34
+ tool: string;
35
+ approvalAddress: string;
36
+ toAmountMin: string;
37
+ toAmount: string;
38
+ fromAmount: string;
39
+ gasCosts: IQuoteGasCost[];
40
+ executionDuration: number;
41
+ fromAmountUSD: string;
42
+ toAmountUSD: string;
43
+ };
44
+ transactionRequest: {
45
+ chainId: number;
46
+ from: string;
47
+ to: string;
48
+ data: string;
49
+ value: string;
50
+ gasPrice: string;
51
+ gasLimit: string;
52
+ };
53
+ }
@@ -0,0 +1,6 @@
1
+ export declare function getLiFiTransactionDetail(txHash: string, fromChain: string): Promise<{
2
+ fromAmount: number;
3
+ fromGasAmount: number;
4
+ toAmount: number;
5
+ toGasAmount: number;
6
+ }>;
@@ -0,0 +1,32 @@
1
+ import { type ISupportedChains } from '@/common';
2
+ import { Logger } from '@gera2ld/common';
3
+ import { BaseProvider } from '../base';
4
+ import type { ICheckQuoteResult, IQuoteInfo } from '../types';
5
+ import type { IQuote } from './types';
6
+ export declare class OdosProvider extends BaseProvider {
7
+ static readonly providerName = "odos";
8
+ static supportedChains: ISupportedChains[];
9
+ static enabled: boolean;
10
+ logger: Logger;
11
+ private getQuote;
12
+ checkQuote(options: {
13
+ address: string;
14
+ fromAmount: number;
15
+ fromToken: string;
16
+ toToken: string;
17
+ slippage?: number;
18
+ }): Promise<{
19
+ provider: string;
20
+ quoteState: {
21
+ quote: IQuote;
22
+ createdAt: number;
23
+ expiresAt: number;
24
+ };
25
+ quoteInfo: IQuoteInfo;
26
+ }>;
27
+ buildRequest(data: {
28
+ quoteData: ICheckQuoteResult;
29
+ }): Promise<{
30
+ request: unknown;
31
+ }>;
32
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ export interface IQuote {
2
+ traceId: string;
3
+ inTokens: string[];
4
+ outTokens: string[];
5
+ inAmounts: string[];
6
+ outAmounts: string[];
7
+ gasEstimate: number;
8
+ dataGasEstimate: number;
9
+ gweiPerGas: number;
10
+ gasEstimateValue: number;
11
+ inValues: number[];
12
+ outValues: number[];
13
+ netOutValue: number;
14
+ priceImpact: number;
15
+ percentDiff: number;
16
+ permit2Message: null;
17
+ permit2Hash: null;
18
+ partnerFeePercent: number;
19
+ pathId: string;
20
+ blockNumber: number;
21
+ }