@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,39 @@
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
+ export declare class ParaSwapProvider extends BaseProvider {
7
+ static readonly providerName = "paraswap";
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: {
31
+ from: string;
32
+ to: string;
33
+ data: string;
34
+ value: string;
35
+ gasPrice: string;
36
+ chainId: number;
37
+ };
38
+ }>;
39
+ }
@@ -0,0 +1,25 @@
1
+ export interface IQuote {
2
+ priceRoute: {
3
+ blockNumber: number;
4
+ network: number;
5
+ srcToken: string;
6
+ srcDecimals: number;
7
+ srcAmount: string;
8
+ destToken: string;
9
+ destDecimals: number;
10
+ destAmount: string;
11
+ gasCostUSD: string;
12
+ gasCost: string;
13
+ side: 'SELL';
14
+ version: string;
15
+ contractAddress: string;
16
+ tokenTransferProxy: string;
17
+ contractMethod: string;
18
+ partnerFee: number;
19
+ srcUSD: string;
20
+ destUSD: string;
21
+ partner: string;
22
+ maxImpactReached: boolean;
23
+ hmac: string;
24
+ };
25
+ }
@@ -0,0 +1,36 @@
1
+ import type { ISupportedChains, ITokenInfo } from '@/common';
2
+ export interface IQuoteState {
3
+ createdAt: number;
4
+ expiresAt: number;
5
+ quote?: any;
6
+ }
7
+ export interface IQuoteInfo {
8
+ chain: ISupportedChains;
9
+ price: number;
10
+ priceUsdFrom: number;
11
+ priceUsdTo: number;
12
+ worstPrice: number;
13
+ worstPriceUsdFrom: number;
14
+ worstPriceUsdTo: number;
15
+ gasToken: ITokenInfo;
16
+ gasPriceUsd: number;
17
+ gasAmount: number;
18
+ gasAmountUsd: number;
19
+ fromAddress: string;
20
+ toAddress: string;
21
+ fromToken: ITokenInfo;
22
+ fromAmount: number;
23
+ fromAmountUsd: number;
24
+ toToken: ITokenInfo;
25
+ toAmount: number;
26
+ toAmountUsd: number;
27
+ toAmountMin: number;
28
+ toAmountMinUsd: number;
29
+ slippage: number;
30
+ approvalAddress?: string;
31
+ }
32
+ export interface ICheckQuoteResult {
33
+ provider: string;
34
+ quoteState: IQuoteState;
35
+ quoteInfo: IQuoteInfo;
36
+ }
@@ -0,0 +1,2 @@
1
+ import { type ISupportedChains, type ITokenInfo } from '@/common';
2
+ export declare const cachedEvmTokenInfo: import("@gera2ld/async-memo").CachedFunction<[chain: number | ISupportedChains, address: string], ITokenInfo, Map<string, import("@gera2ld/async-memo").CacheData<unknown>>>;
@@ -0,0 +1,5 @@
1
+ import type { ISupportedChains } from '../../common';
2
+ /**
3
+ * @deprecated Use lifi API instead.
4
+ */
5
+ export declare function cachedTokenInfoFromChain(chain: ISupportedChains, address: string): Promise<import("../..").ITokenInfo>;
@@ -0,0 +1,2 @@
1
+ import { type ITokenInfo } from '@/common';
2
+ export declare const cachedSolTokenInfo: import("@gera2ld/async-memo").CachedFunction<[address: string], ITokenInfo, Map<string, import("@gera2ld/async-memo").CacheData<unknown>>>;
@@ -0,0 +1,2 @@
1
+ export declare const SOL_ADDRESS = "11111111111111111111111111111111";
2
+ export declare const WSOL_ADDRESS = "So11111111111111111111111111111111111111112";
@@ -0,0 +1,4 @@
1
+ import type { ISupportedChains, ITokenInfo } from '@/common';
2
+ import { cachedTokenInfoFromLifi } from './lifi';
3
+ export { cachedTokenInfoFromLifi };
4
+ export declare const cachedTokenInfo: (chain: ISupportedChains | number, token: string) => Promise<ITokenInfo>;
@@ -0,0 +1,4 @@
1
+ import { type ISupportedChains, type ITokenInfo } from '@/common';
2
+ export declare const cachedTokenInfoFromLifi: import("@gera2ld/async-memo").CachedFunction<[chain: number | ISupportedChains, token: string], ITokenInfo & {
3
+ priceApprox: number;
4
+ }, Map<string, import("@gera2ld/async-memo").CacheData<unknown>>>;
@@ -0,0 +1,70 @@
1
+ import { type ISupportedChains } from '@/common';
2
+ import { type Address, type Hash, type Hex, type PublicClient } from 'viem';
3
+ export declare function getEvmTransactionDetailFromAnkr(hash: string, walletAddress: string, options: Record<string, unknown> & {
4
+ chain: ISupportedChains;
5
+ client?: PublicClient;
6
+ ankrRpcUrl: string;
7
+ }): Promise<{
8
+ raw: {
9
+ transactions: Array<{
10
+ nonce: Hex;
11
+ blockNumber: Hex;
12
+ from: Address;
13
+ to: Address;
14
+ gas: Hex;
15
+ gasPrice: Hex;
16
+ input: Hex;
17
+ transactionIndex: Hex;
18
+ blockHash: Hash;
19
+ value: Hex;
20
+ type: Hex;
21
+ gasUsed: Hex;
22
+ cumulativeGasUsed: Hex;
23
+ hash: Hash;
24
+ status: Hex;
25
+ blockchain: string;
26
+ timestamp: Hex;
27
+ method: {
28
+ name: string;
29
+ id: Hex;
30
+ string: string;
31
+ signature: string;
32
+ verified: boolean;
33
+ };
34
+ logs: Array<{
35
+ blockchain: string;
36
+ address: Address;
37
+ topics: Address[];
38
+ data: Hex;
39
+ logIndex: Hex;
40
+ removed: boolean;
41
+ timestamp: Hex;
42
+ event: {
43
+ name: string;
44
+ id: Hex;
45
+ string: string;
46
+ signature: string;
47
+ verified: boolean;
48
+ inputs: Array<{
49
+ name: string;
50
+ type: string;
51
+ indexed: boolean;
52
+ size: number;
53
+ valueDecoded: string;
54
+ }>;
55
+ };
56
+ }>;
57
+ }>;
58
+ syncStatus: {
59
+ timestamp: number;
60
+ lag: string;
61
+ status: string;
62
+ };
63
+ };
64
+ hash: `0x${string}`;
65
+ timestamp: number;
66
+ feePaid: number;
67
+ gasFee: number;
68
+ priorityFee: number;
69
+ balanceChanges: Record<string, number>;
70
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './ankr';
2
+ export * from './wallet';
@@ -0,0 +1,21 @@
1
+ import { type ISupportedChains } from '@/common';
2
+ import { type Address, type PublicClient, type Transaction, type TransactionReceipt } from 'viem';
3
+ import type { ITransactionDetail } from '../types';
4
+ export declare function getEvmTransactionDetailFromChain(hash: string, walletAddress: string, options: Record<string, unknown> & {
5
+ chain: ISupportedChains;
6
+ client?: PublicClient;
7
+ }): Promise<ITransactionDetail>;
8
+ export declare function getTransactionDetail(details: {
9
+ chain: number;
10
+ receipt: TransactionReceipt;
11
+ transaction: Transaction;
12
+ timestamp: bigint;
13
+ }, walletAddress: Address): Promise<{
14
+ raw: any;
15
+ hash: `0x${string}`;
16
+ timestamp: number;
17
+ feePaid: number;
18
+ gasFee: number;
19
+ priorityFee: number;
20
+ balanceChanges: Record<string, number>;
21
+ }>;
@@ -0,0 +1,6 @@
1
+ import { getEvmTransactionDetailFromAnkr, getEvmTransactionDetailFromChain } from './evm';
2
+ import { getSolanaTransactionDetailFromChain } from './solana';
3
+ import type { TransactionProvider } from './types';
4
+ export { getEvmTransactionDetailFromAnkr, getEvmTransactionDetailFromChain, getSolanaTransactionDetailFromChain, };
5
+ export declare const transactionProviders: Record<string, TransactionProvider>;
6
+ export declare const getTransactionDetail: TransactionProvider;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from './wallet';
@@ -0,0 +1,38 @@
1
+ import { Connection, type ParsedInstruction, type ParsedTransactionMeta, type ParsedTransactionWithMeta, type PartiallyDecodedInstruction } from '@solana/web3.js';
2
+ import type { ITransactionDetail } from '../types';
3
+ export declare function getSolanaTransactionDetailFromChain(hash: string, walletAddress: string, options: Record<string, unknown> & {
4
+ connection?: Connection;
5
+ }): Promise<ITransactionDetail>;
6
+ export interface SerializedParsedTransaction {
7
+ slot: number;
8
+ transaction: {
9
+ signatures: string[];
10
+ message: {
11
+ accountKeys: {
12
+ pubkey: string;
13
+ signer: boolean;
14
+ writable: boolean;
15
+ source?: string;
16
+ }[];
17
+ instructions: (ParsedInstruction | PartiallyDecodedInstruction)[];
18
+ recentBlockhash: string;
19
+ version?: 'legacy' | 0;
20
+ };
21
+ };
22
+ meta: ParsedTransactionMeta | null;
23
+ blockTime?: number | null;
24
+ version?: 'legacy' | 0;
25
+ }
26
+ export declare function parsedTransactionToJson(txResponse: ParsedTransactionWithMeta): SerializedParsedTransaction;
27
+ export declare function jsonToParsedTransaction(serialized: SerializedParsedTransaction): ParsedTransactionWithMeta;
28
+ export declare function getTransactionDetail(details: ParsedTransactionWithMeta, walletAddress: string): {
29
+ raw: SerializedParsedTransaction;
30
+ hash: string;
31
+ timestamp: number;
32
+ feePaid: number;
33
+ gasFee: number;
34
+ priorityFee: number;
35
+ balanceChanges: {
36
+ [k: string]: number;
37
+ };
38
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ import type { ISupportedChains } from '@/common';
2
+ export interface ITransactionDetail {
3
+ hash: string;
4
+ timestamp: number;
5
+ feePaid: number;
6
+ gasFee: number;
7
+ priorityFee: number;
8
+ balanceChanges: Record<string, number>;
9
+ }
10
+ export type TransactionProvider = (hash: string,
11
+ /** EVM wallet addresses must be in lower case. */
12
+ walletAddress: string, options: Record<string, unknown> & {
13
+ provider?: string;
14
+ chain: ISupportedChains;
15
+ }) => Promise<ITransactionDetail>;
@@ -0,0 +1,12 @@
1
+ import type { VersionedTransaction } from '@solana/web3.js';
2
+ import { type LocalAccount } from 'viem';
3
+ export * from './util';
4
+ export declare function createTrezorEvmAccount(path?: string): Promise<LocalAccount | undefined>;
5
+ export interface SolanaLocalAccount {
6
+ address: string;
7
+ signTransaction(transaction: VersionedTransaction): Promise<{
8
+ signature: string;
9
+ serializedTx: string;
10
+ }>;
11
+ }
12
+ export declare function createTrezorSolanaAccount(path?: string): Promise<SolanaLocalAccount>;
@@ -0,0 +1,9 @@
1
+ import type { TrezorConnect } from '@trezor/connect-web';
2
+ export declare const trezorManifest: {
3
+ email: string;
4
+ appName: string;
5
+ appUrl: string;
6
+ };
7
+ export declare const initializeTrezor: (() => Promise<TrezorConnect>) & {
8
+ cache: import("es-toolkit").MemoizeCache<any, Promise<TrezorConnect>>;
9
+ };
@@ -0,0 +1,2 @@
1
+ import type { ISupportedChains } from '../common/index.ts';
2
+ export declare const overrideRpcUrls: Partial<Record<ISupportedChains, string>>;
@@ -0,0 +1,25 @@
1
+ import type { ISupportedChains } from '@/common';
2
+ import { type Account, type Address, type PublicClient, type TransactionSerializable, type Transport, type WalletClient } from 'viem';
3
+ import { type Chain } from 'viem/chains';
4
+ export declare const evmChainConfigList: Array<{
5
+ name: ISupportedChains;
6
+ config: Chain;
7
+ }>;
8
+ export declare function getEvmChainConfig(nameOrId: ISupportedChains | number): {
9
+ name: ISupportedChains;
10
+ config: Chain;
11
+ } | undefined;
12
+ export declare function ensureEvmChainConfig(nameOrId: ISupportedChains | number): {
13
+ name: ISupportedChains;
14
+ config: Chain;
15
+ };
16
+ export declare function getClient(options: {
17
+ chain: ISupportedChains | number;
18
+ transport?: Transport;
19
+ }): PublicClient;
20
+ export declare function getWalletClient(options: {
21
+ chain: ISupportedChains | number;
22
+ account?: Account | Address;
23
+ transport?: Transport;
24
+ }): WalletClient;
25
+ export declare function normalizeSerializable(serializable: any): TransactionSerializable;
@@ -0,0 +1,2 @@
1
+ export * from './client.ts';
2
+ export * from './wallet.ts';
@@ -0,0 +1,71 @@
1
+ import { type ISupportedChains, type ITransactionRequest } from '@/common';
2
+ import { Logger } from '@gera2ld/common';
3
+ import { type Hash, type PublicClient, type TransactionRequest, type WalletClient } from 'viem';
4
+ import type { IPublicWallet, IWallet } from '../types.ts';
5
+ export declare class EvmPublicWallet implements IPublicWallet {
6
+ client: PublicClient;
7
+ logger: Logger;
8
+ constructor(client: PublicClient, logger: Logger);
9
+ getBalance(walletAddress: string, tokenAddress: string): Promise<number>;
10
+ estimateGasFee(request: TransactionRequest): Promise<bigint>;
11
+ getAllowance(options: {
12
+ address: string;
13
+ tokenAddress: string;
14
+ approvalAddress: string;
15
+ }): Promise<bigint | undefined>;
16
+ buildAllowanceRequest(options: {
17
+ address: string;
18
+ tokenAddress: string;
19
+ approvalAddress: string;
20
+ amount: string | number | bigint;
21
+ approvalAmount?: string | number | bigint;
22
+ }): Promise<{
23
+ request: unknown;
24
+ }>;
25
+ checkAllowance(options: {
26
+ allowance?: bigint;
27
+ address: string;
28
+ tokenAddress: string;
29
+ approvalAddress: string;
30
+ amount: string | number | bigint;
31
+ approvalAmount?: string | number | bigint;
32
+ }): Promise<{
33
+ request: unknown;
34
+ } | undefined>;
35
+ sendRawTransaction(serializedTransaction: string): Promise<{
36
+ hash: `0x${string}`;
37
+ }>;
38
+ confirmTransaction(options: {
39
+ hash: Hash;
40
+ }): Promise<{
41
+ hash: `0x${string}`;
42
+ chain: string;
43
+ chainId: number;
44
+ gasFee: number;
45
+ }>;
46
+ }
47
+ export declare class EvmWallet extends EvmPublicWallet implements IWallet {
48
+ signer: IWallet['signer'];
49
+ constructor(signer: IWallet['signer'], client: PublicClient, logger: Logger);
50
+ private checkGasFee;
51
+ sendTransaction(input: ITransactionRequest, options?: {
52
+ maxGasAmountInflated?: number | bigint;
53
+ }): Promise<{
54
+ hash: `0x${string}`;
55
+ chain: string;
56
+ chainId: number;
57
+ nonce: number;
58
+ }>;
59
+ private signAndSendViaWallet;
60
+ }
61
+ export declare const getPublicWallet: ((options: {
62
+ chain: ISupportedChains | number;
63
+ client?: PublicClient;
64
+ }) => EvmPublicWallet) & {
65
+ cache: import("es-toolkit").MemoizeCache<any, EvmPublicWallet>;
66
+ };
67
+ export declare function getWallet(options: {
68
+ chain: ISupportedChains | number;
69
+ walletClient: WalletClient;
70
+ client?: PublicClient;
71
+ }): EvmWallet;
@@ -0,0 +1,4 @@
1
+ export * as evm from './evm';
2
+ export * as solana from './solana';
3
+ export * from './common';
4
+ export * from './types';
@@ -0,0 +1,2 @@
1
+ export * from './util/connection.ts';
2
+ export * from './wallet.ts';
@@ -0,0 +1,6 @@
1
+ import { Connection } from '@solana/web3.js';
2
+ declare function initializeConnection(): Connection;
3
+ export declare const getConnection: typeof initializeConnection & {
4
+ cache: import("es-toolkit").MemoizeCache<any, Connection>;
5
+ };
6
+ export {};
@@ -0,0 +1,55 @@
1
+ import type { ITransactionRequest } from '@/common';
2
+ import { Logger } from '@gera2ld/common';
3
+ import { Connection, VersionedTransaction } from '@solana/web3.js';
4
+ import type { IPublicWallet, IWallet } from '../types.ts';
5
+ export declare class SolanaPublicWallet implements IPublicWallet {
6
+ connection: Connection;
7
+ logger: Logger;
8
+ constructor(connection?: Connection, logger?: Logger);
9
+ getAllBalances(walletAddress: string): Promise<Record<string, {
10
+ symbol: string;
11
+ address: string;
12
+ balance: number;
13
+ }>>;
14
+ estimateGasFee(transaction: VersionedTransaction): Promise<number>;
15
+ sendRawTransaction(data: string | Uint8Array, simulate?: boolean): Promise<{
16
+ blockhash: import("@solana/web3.js").Blockhash;
17
+ lastValidBlockHeight: number;
18
+ hash: string;
19
+ }>;
20
+ confirmTransaction(options: {
21
+ hash: string;
22
+ blockhash?: string;
23
+ lastValidBlockHeight?: number;
24
+ }): Promise<{
25
+ hash: string;
26
+ chain: string;
27
+ chainId: number;
28
+ }>;
29
+ }
30
+ export declare class SolanaWallet extends SolanaPublicWallet implements IWallet {
31
+ signer: IWallet['signer'];
32
+ constructor(signer: IWallet['signer'], connection?: Connection, logger?: Logger);
33
+ private checkGasFee;
34
+ private signAndSendLocally;
35
+ sendTransaction({ request }: ITransactionRequest, options?: {
36
+ maxGasAmountInflated?: number | bigint;
37
+ }): Promise<{
38
+ hash: string;
39
+ chain: string;
40
+ chainId: number;
41
+ gasFee: number | undefined;
42
+ }>;
43
+ }
44
+ export declare const getPublicWallet: ((options?: {
45
+ connection?: Connection;
46
+ }) => SolanaPublicWallet) & {
47
+ cache: import("es-toolkit").MemoizeCache<any, SolanaPublicWallet>;
48
+ };
49
+ export declare function getWallet(options: {
50
+ solSignTransaction?: (transaction: VersionedTransaction) => Promise<VersionedTransaction>;
51
+ solSignAndSend?: (transaction: VersionedTransaction) => Promise<{
52
+ hash: string;
53
+ }>;
54
+ connection?: Connection;
55
+ }): SolanaWallet;
@@ -0,0 +1,34 @@
1
+ import type { VersionedTransaction } from '@solana/web3.js';
2
+ import type { Hex } from 'viem';
3
+ import type { ITransactionRequest } from '../common';
4
+ export interface IPublicWallet {
5
+ confirmTransaction(options: {
6
+ hash: string;
7
+ }): Promise<{
8
+ hash: string;
9
+ chain: string;
10
+ chainId: number;
11
+ gasFee?: number;
12
+ priorityFee?: number;
13
+ }>;
14
+ }
15
+ export interface IWallet extends IPublicWallet {
16
+ signer: {
17
+ evmSignTypedData?: (data: any) => Promise<Hex>;
18
+ evmSignAndSend?: (data: any) => Promise<Hex>;
19
+ solSignTransaction?: (data: VersionedTransaction) => Promise<VersionedTransaction>;
20
+ solSignAndSend?: (data: VersionedTransaction) => Promise<{
21
+ hash: string;
22
+ }>;
23
+ };
24
+ sendTransaction(request: ITransactionRequest, options?: {
25
+ maxGasAmountInflated?: number | bigint;
26
+ }): Promise<{
27
+ hash: string;
28
+ chain: string;
29
+ chainId: number;
30
+ nonce?: number;
31
+ gasFee?: number;
32
+ priorityFee?: number;
33
+ }>;
34
+ }
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@gera2ld/lib-dex",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "import": "./dist/index.js",
8
+ "types": "./dist/index.d.ts"
9
+ },
10
+ "./node": {
11
+ "import": "./dist/node/index.js",
12
+ "types": "./dist/node/index.d.ts"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "publishConfig": {
19
+ "access": "public",
20
+ "registry": "https://registry.npmjs.org/"
21
+ },
22
+ "devDependencies": {
23
+ "@1inch/fusion-sdk": "^2.4.3",
24
+ "assert": "^2.1.0",
25
+ "@gera2ld/common": "^0.0.1"
26
+ },
27
+ "peerDependencies": {
28
+ "@project-serum/anchor": "^0.26.0",
29
+ "@solana/spl-token": "^0.4.13",
30
+ "@solana/web3.js": "^1.98.0",
31
+ "@trezor/connect-web": "^9.7.1",
32
+ "axios": "^1.11.0",
33
+ "bs58": "^6.0.0",
34
+ "viem": "^2.27.2"
35
+ },
36
+ "dependencies": {
37
+ "@gera2ld/async-memo": "^1.0.0",
38
+ "bignumber.js": "^9.3.1",
39
+ "es-toolkit": "^1.41.0"
40
+ },
41
+ "scripts": {
42
+ "clean": "del-cli dist tsconfig.tsbuildinfo",
43
+ "build:types": "tsc",
44
+ "build:js": "vite build",
45
+ "build": "pnpm clean && pnpm /^build:/"
46
+ }
47
+ }