@xchainjs/xchain-aggregator 2.3.1 → 2.3.3

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.
@@ -0,0 +1,8 @@
1
+ import { OneClickQuoteRequest, OneClickQuoteResponse, OneClickToken } from './types';
2
+ export declare class OneClickApi {
3
+ private headers;
4
+ constructor(apiKey?: string);
5
+ getTokens(): Promise<OneClickToken[]>;
6
+ getQuote(params: OneClickQuoteRequest): Promise<OneClickQuoteResponse>;
7
+ submitDeposit(txHash: string, depositAddress: string): Promise<void>;
8
+ }
@@ -0,0 +1 @@
1
+ export { OneClickProtocol } from './oneclickProtocol';
@@ -0,0 +1,19 @@
1
+ import { AnyAsset, Chain } from '@xchainjs/xchain-util';
2
+ import { ApproveParams, IProtocol, IsApprovedParams, ProtocolConfig, QuoteSwap, QuoteSwapParams, SwapHistory, SwapHistoryParams, TxSubmitted } from '../../types';
3
+ export declare class OneClickProtocol implements IProtocol {
4
+ readonly name: "OneClick";
5
+ private api;
6
+ private wallet?;
7
+ private affiliateAddress?;
8
+ private affiliateBps?;
9
+ private tokensCache;
10
+ constructor(configuration?: ProtocolConfig);
11
+ approveRouterToSpend(_params: ApproveParams): Promise<TxSubmitted>;
12
+ shouldBeApproved(_params: IsApprovedParams): Promise<boolean>;
13
+ isAssetSupported(asset: AnyAsset): Promise<boolean>;
14
+ getSupportedChains(): Promise<Chain[]>;
15
+ estimateSwap(params: QuoteSwapParams): Promise<QuoteSwap>;
16
+ doSwap(params: QuoteSwapParams): Promise<TxSubmitted>;
17
+ getSwapHistory(_params: SwapHistoryParams): Promise<SwapHistory>;
18
+ private errorQuote;
19
+ }
@@ -0,0 +1,41 @@
1
+ import { Asset, TokenAsset } from '@xchainjs/xchain-util';
2
+ export type CompatibleAsset = Asset | TokenAsset;
3
+ export type OneClickToken = {
4
+ assetId: string;
5
+ blockchain: string;
6
+ symbol: string;
7
+ decimals: number;
8
+ contractAddress?: string;
9
+ price?: number;
10
+ priceUpdatedAt?: string;
11
+ };
12
+ export type OneClickQuoteRequest = {
13
+ dry?: boolean;
14
+ swapType: 'EXACT_INPUT';
15
+ depositType: 'ORIGIN_CHAIN';
16
+ recipientType: 'DESTINATION_CHAIN';
17
+ refundType: 'ORIGIN_CHAIN';
18
+ originAsset: string;
19
+ destinationAsset: string;
20
+ amount: string;
21
+ refundTo: string;
22
+ recipient: string;
23
+ slippageTolerance?: number;
24
+ deadline?: string;
25
+ appFees?: {
26
+ recipient: string;
27
+ fee: number;
28
+ }[];
29
+ };
30
+ export type OneClickQuoteInner = {
31
+ amountOut: string;
32
+ amountOutFormatted?: string;
33
+ timeEstimate?: number;
34
+ depositAddress?: string;
35
+ };
36
+ export type OneClickQuoteResponse = {
37
+ quote: OneClickQuoteInner;
38
+ error?: string;
39
+ message?: string;
40
+ statusCode?: number;
41
+ };
@@ -0,0 +1,11 @@
1
+ import { AnyAsset, AssetType, Chain } from '@xchainjs/xchain-util';
2
+ import { OneClickToken } from './types';
3
+ export declare const xChainToOneClickBlockchain: (chain: Chain) => string | null;
4
+ export declare const oneClickBlockchainToXChain: (blockchain: string) => Chain | null;
5
+ export declare const findOneClickToken: (asset: AnyAsset, tokens: OneClickToken[]) => OneClickToken | undefined;
6
+ export declare const oneClickTokenToXAsset: (token: OneClickToken) => {
7
+ chain: Chain;
8
+ symbol: string;
9
+ ticker: string;
10
+ type: AssetType;
11
+ } | null;
package/lib/types.d.ts CHANGED
@@ -20,7 +20,7 @@ type Fees = {
20
20
  /**
21
21
  * Protocols supported by the Aggregator
22
22
  */
23
- type Protocol = 'Thorchain' | 'Mayachain' | 'Chainflip';
23
+ type Protocol = 'Thorchain' | 'Mayachain' | 'Chainflip' | 'OneClick';
24
24
  /**
25
25
  * Affiliate config for the aggregator
26
26
  */
@@ -65,6 +65,10 @@ export type Config = Partial<{
65
65
  * Broker URL for Chainflip protocol
66
66
  */
67
67
  brokerUrl: string;
68
+ /**
69
+ * API key for OneClick (NEAR Intents) protocol
70
+ */
71
+ oneClickApiKey: string;
68
72
  }>;
69
73
  /**
70
74
  * Protocol config
@@ -79,6 +83,7 @@ export type ProtocolConfig = Partial<{
79
83
  commissionBps: number;
80
84
  }[];
81
85
  brokerUrl: string;
86
+ oneClickApiKey: string;
82
87
  }>;
83
88
  /**
84
89
  * Represents a quote for a swap operation.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xchainjs/xchain-aggregator",
3
3
  "description": "Protocol aggregator to make actions in different protocols",
4
- "version": "2.3.1",
4
+ "version": "2.3.3",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
7
7
  "module": "lib/index.esm.js",
@@ -30,24 +30,24 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@chainflip/sdk": "2.1.1",
33
- "@xchainjs/xchain-client": "2.0.11",
34
- "@xchainjs/xchain-mayachain": "4.1.2",
35
- "@xchainjs/xchain-mayachain-amm": "4.1.16",
36
- "@xchainjs/xchain-mayachain-query": "2.1.8",
37
- "@xchainjs/xchain-thorchain": "3.0.15",
38
- "@xchainjs/xchain-thorchain-amm": "3.0.35",
39
- "@xchainjs/xchain-thorchain-query": "3.0.2",
40
- "@xchainjs/xchain-util": "2.0.6",
41
- "@xchainjs/xchain-wallet": "2.0.25"
33
+ "@xchainjs/xchain-client": "2.0.13",
34
+ "@xchainjs/xchain-mayachain": "4.1.4",
35
+ "@xchainjs/xchain-mayachain-amm": "4.1.18",
36
+ "@xchainjs/xchain-mayachain-query": "2.1.10",
37
+ "@xchainjs/xchain-thorchain": "3.0.17",
38
+ "@xchainjs/xchain-thorchain-amm": "3.0.37",
39
+ "@xchainjs/xchain-thorchain-query": "3.0.4",
40
+ "@xchainjs/xchain-util": "2.0.7",
41
+ "@xchainjs/xchain-wallet": "2.0.27"
42
42
  },
43
43
  "devDependencies": {
44
- "@xchainjs/xchain-avax": "2.0.15",
45
- "@xchainjs/xchain-base": "1.0.15",
46
- "@xchainjs/xchain-bitcoin": "2.2.2",
47
- "@xchainjs/xchain-bsc": "2.0.16",
48
- "@xchainjs/xchain-ethereum": "2.0.16",
49
- "@xchainjs/xchain-kujira": "2.0.11",
50
- "axios": "1.13.5",
44
+ "@xchainjs/xchain-avax": "2.0.17",
45
+ "@xchainjs/xchain-base": "1.0.17",
46
+ "@xchainjs/xchain-bitcoin": "2.2.4",
47
+ "@xchainjs/xchain-bsc": "2.0.18",
48
+ "@xchainjs/xchain-ethereum": "2.0.18",
49
+ "@xchainjs/xchain-kujira": "2.0.13",
50
+ "axios": "1.15.2",
51
51
  "axios-mock-adapter": "^2.1.0"
52
52
  }
53
53
  }