@xchainjs/xchain-thorchain-amm 0.8.21 → 0.8.22
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.
- package/lib/index.d.ts +15 -0
- package/lib/index.esm.js +213 -136
- package/lib/index.js +213 -136
- package/lib/thorchain-amm.d.ts +58 -57
- package/lib/types.d.ts +33 -0
- package/lib/wallet.d.ts +91 -63
- package/package.json +4 -6
package/lib/thorchain-amm.d.ts
CHANGED
|
@@ -14,117 +14,118 @@ export type AmmEstimateSwapParams = QuoteSwapParams & {
|
|
|
14
14
|
export declare class ThorchainAMM {
|
|
15
15
|
private thorchainQuery;
|
|
16
16
|
/**
|
|
17
|
-
* Contructor to create a ThorchainAMM
|
|
17
|
+
* Contructor to create a ThorchainAMM instance
|
|
18
18
|
*
|
|
19
19
|
* @param thorchainQuery - an instance of the ThorchainQuery
|
|
20
20
|
* @returns ThorchainAMM
|
|
21
21
|
*/
|
|
22
22
|
constructor(thorchainQuery?: ThorchainQuery);
|
|
23
23
|
/**
|
|
24
|
-
* Provides
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
24
|
+
* * Provides an estimate for a swap based on the given swap details.
|
|
25
|
+
* Checks the parameters for errors before attempting to retrieve the estimate.
|
|
26
|
+
* Utilizes current pool data to calculate inbound and outbound fees, affiliate fees,
|
|
27
|
+
* and the expected wait time for the swap (inbound and outbound).
|
|
28
|
+
* @param params Parameters for the swap, including the amount to swap.
|
|
28
29
|
|
|
29
|
-
* @returns The
|
|
30
|
+
* @returns The estimated swap details.
|
|
30
31
|
*/
|
|
31
32
|
estimateSwap({ fromAsset, amount, destinationAsset, destinationAddress, affiliateAddress, interfaceID, affiliateBps, toleranceBps, wallet, walletIndex, }: AmmEstimateSwapParams): Promise<TxDetails>;
|
|
32
33
|
/**
|
|
33
|
-
* Conducts a swap with the given inputs.
|
|
34
|
+
* Conducts a swap with the given inputs. This method should be called after estimateSwap() to ensure the swap is valid.
|
|
34
35
|
*
|
|
35
|
-
* @param wallet - wallet to use
|
|
36
|
-
* @param params - swap
|
|
37
|
-
* @returns {SwapSubmitted} -
|
|
36
|
+
* @param wallet - The wallet to use for the swap.
|
|
37
|
+
* @param params - The swap parameters.
|
|
38
|
+
* @returns {SwapSubmitted} - The transaction hash, URL of BlockExplorer, and expected wait time.
|
|
38
39
|
*/
|
|
39
40
|
doSwap(wallet: Wallet, params: AmmEstimateSwapParams): Promise<TxSubmitted>;
|
|
40
41
|
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
* Wraps the estimate from ThorchainQuery for adding liquidity.
|
|
43
|
+
* @param params - The parameters for estimating adding liquidity.
|
|
44
|
+
* @returns - The estimated liquidity addition object.
|
|
45
|
+
*/
|
|
45
46
|
estimateAddLiquidity(params: AddliquidityPosition): Promise<EstimateAddLP>;
|
|
46
47
|
/**
|
|
47
|
-
* Wraps estimate
|
|
48
|
-
* @param params -
|
|
49
|
-
* @returns -
|
|
48
|
+
* Wraps the estimate from ThorchainQuery for withdrawing liquidity.
|
|
49
|
+
* @param params - The parameters for estimating withdrawing liquidity.
|
|
50
|
+
* @returns - The estimated liquidity withdrawal object.
|
|
50
51
|
*/
|
|
51
52
|
estimateWithdrawLiquidity(params: WithdrawLiquidityPosition): Promise<EstimateWithdrawLP>;
|
|
52
53
|
/**
|
|
53
|
-
*
|
|
54
|
-
* @param wallet -
|
|
55
|
-
* @param params -
|
|
54
|
+
* If there is no existing liquidity position, it is created automatically.
|
|
55
|
+
* @param wallet - Wallet class
|
|
56
|
+
* @param params - Liquidity parameter
|
|
56
57
|
* @returns
|
|
57
58
|
*/
|
|
58
59
|
addLiquidityPosition(wallet: Wallet, params: AddliquidityPosition): Promise<TxSubmitted[]>;
|
|
59
60
|
/**
|
|
60
|
-
*
|
|
61
|
-
* @param params -
|
|
62
|
-
* @param wallet -
|
|
63
|
-
* @return
|
|
61
|
+
* Withdraws liquidity from a position.
|
|
62
|
+
* @param params - The wallet to perform the transaction.
|
|
63
|
+
* @param wallet - The parameters for withdrawing liquidity.
|
|
64
|
+
* @return - The array of transaction submissions.
|
|
64
65
|
*/
|
|
65
66
|
withdrawLiquidityPosition(wallet: Wallet, params: WithdrawLiquidityPosition): Promise<TxSubmitted[]>;
|
|
66
67
|
/**
|
|
67
|
-
*
|
|
68
|
-
* @param addAssetAmount
|
|
69
|
-
* @returns
|
|
68
|
+
* Estimates adding to a saver.
|
|
69
|
+
* @param addAssetAmount The amount to add to the saver.
|
|
70
|
+
* @returns The estimated addition to the saver object.
|
|
70
71
|
*/
|
|
71
72
|
estimateAddSaver(addAssetAmount: CryptoAmount): Promise<EstimateAddSaver>;
|
|
72
73
|
/**
|
|
73
|
-
*
|
|
74
|
-
* @param withdrawParams
|
|
75
|
-
* @returns
|
|
74
|
+
* Estimates withdrawing from a saver.
|
|
75
|
+
* @param withdrawParams The parameters for withdrawing from the saver.
|
|
76
|
+
* @returns The estimated withdrawal from the saver object.
|
|
76
77
|
*/
|
|
77
78
|
estimateWithdrawSaver(withdrawParams: SaversWithdraw): Promise<EstimateWithdrawSaver>;
|
|
78
79
|
/**
|
|
79
|
-
*
|
|
80
|
-
* @param getsaver
|
|
81
|
-
* @returns
|
|
80
|
+
* Retrieves the position of a saver.
|
|
81
|
+
* @param getsaver The parameters to retrieve the saver position.
|
|
82
|
+
* @returns The saver position object.
|
|
82
83
|
*/
|
|
83
84
|
getSaverPosition(getsaver: getSaver): Promise<SaversPosition>;
|
|
84
85
|
/**
|
|
85
|
-
*
|
|
86
|
+
* Adds assets to a saver.
|
|
86
87
|
* @param wallet - wallet needed to execute tx
|
|
87
|
-
* @param addAssetAmount -
|
|
88
|
-
* @returns - submitted
|
|
88
|
+
* @param addAssetAmount - The amount to add to the saver.
|
|
89
|
+
* @returns - The submitted transaction.
|
|
89
90
|
*/
|
|
90
91
|
addSaver(wallet: Wallet, addAssetAmount: CryptoAmount): Promise<TxSubmitted>;
|
|
91
92
|
/**
|
|
92
|
-
*
|
|
93
|
-
* @param wallet - wallet to
|
|
94
|
-
* @param withdrawParams -
|
|
95
|
-
* @returns
|
|
93
|
+
* Withdraws assets from a saver.
|
|
94
|
+
* @param wallet - The wallet to perform the transaction.
|
|
95
|
+
* @param withdrawParams - The parameters for withdrawing from the saver.
|
|
96
|
+
* @returns The submitted transaction.
|
|
96
97
|
*/
|
|
97
98
|
withdrawSaver(wallet: Wallet, withdrawParams: SaversWithdraw): Promise<TxSubmitted>;
|
|
98
99
|
/**
|
|
99
|
-
*
|
|
100
|
-
* @param loanOpenParams
|
|
101
|
-
* @returns
|
|
100
|
+
* Retrieves a quote for opening a loan.
|
|
101
|
+
* @param loanOpenParams The parameters for opening the loan.
|
|
102
|
+
* @returns The quote for opening the loan.
|
|
102
103
|
*/
|
|
103
104
|
getLoanQuoteOpen(loanOpenParams: LoanOpenParams): Promise<LoanOpenQuote>;
|
|
104
105
|
/**
|
|
105
|
-
*
|
|
106
|
-
* @param loanCloseParams
|
|
107
|
-
* @returns
|
|
106
|
+
* Retrieves a quote for closing a loan.
|
|
107
|
+
* @param loanCloseParams The parameters for closing the loan.
|
|
108
|
+
* @returns The quote for closing the loan.
|
|
108
109
|
*/
|
|
109
110
|
getLoanQuoteClose(loanCloseParams: LoanCloseParams): Promise<LoanCloseQuote>;
|
|
110
111
|
/**
|
|
111
|
-
*
|
|
112
|
-
* @param wallet - wallet
|
|
113
|
-
* @param loanOpenParams -
|
|
114
|
-
* @returns - submitted
|
|
112
|
+
* Opens a loan.
|
|
113
|
+
* @param wallet - The wallet to perform the transaction.
|
|
114
|
+
* @param loanOpenParams - The parameters for opening the loan.
|
|
115
|
+
* @returns - The submitted transaction.
|
|
115
116
|
*/
|
|
116
117
|
addLoan(wallet: Wallet, loanOpenParams: LoanOpenParams): Promise<TxSubmitted>;
|
|
117
118
|
/**
|
|
118
|
-
*
|
|
119
|
-
* @param wallet - wallet to
|
|
120
|
-
* @param loanCloseParams -
|
|
121
|
-
* @returns
|
|
119
|
+
* Withdraws assets from a loan.
|
|
120
|
+
* @param wallet - The wallet to perform the transaction.
|
|
121
|
+
* @param loanCloseParams - The parameters for withdrawing from the loan.
|
|
122
|
+
* @returns The submitted transaction.
|
|
122
123
|
*/
|
|
123
124
|
withdrawLoan(wallet: Wallet, loanCloseParams: LoanCloseParams): Promise<TxSubmitted>;
|
|
124
125
|
/**
|
|
125
|
-
*
|
|
126
|
-
* @param address - address
|
|
127
|
-
* @returns
|
|
126
|
+
* Retrieves all Thornames and their associated data owned by an address.
|
|
127
|
+
* @param address - The address to retrieve Thornames for.
|
|
128
|
+
* @returns The Thornames data.
|
|
128
129
|
*/
|
|
129
130
|
getThornamesByAddress(address: string): Promise<import("@xchainjs/xchain-midgard/lib").ReverseTHORNames | undefined>;
|
|
130
131
|
}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { Balance, FeeOption } from '@xchainjs/xchain-client';
|
|
2
2
|
import { LiquidityPool } from '@xchainjs/xchain-thorchain-query';
|
|
3
3
|
import { Address, Asset, BaseAmount, Chain, CryptoAmount } from '@xchainjs/xchain-util';
|
|
4
|
+
/**
|
|
5
|
+
* Represents the balance information for all assets on a particular chain.
|
|
6
|
+
*/
|
|
4
7
|
export type AllBalances = {
|
|
5
8
|
chain: Chain;
|
|
6
9
|
address: string;
|
|
7
10
|
balances: Balance[] | string;
|
|
8
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* Represents the parameters for executing a swap transaction.
|
|
14
|
+
*/
|
|
9
15
|
export type ExecuteSwap = {
|
|
10
16
|
input: CryptoAmount;
|
|
11
17
|
destinationAsset: Asset;
|
|
@@ -14,22 +20,34 @@ export type ExecuteSwap = {
|
|
|
14
20
|
feeOption?: FeeOption;
|
|
15
21
|
walletIndex: number;
|
|
16
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* Represents a submitted transaction.
|
|
25
|
+
*/
|
|
17
26
|
export type TxSubmitted = {
|
|
18
27
|
hash: string;
|
|
19
28
|
url: string;
|
|
20
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* Represents a liquidity position in a liquidity pool.
|
|
32
|
+
*/
|
|
21
33
|
export type LiquidityPosition = {
|
|
22
34
|
assetPool: LiquidityPool;
|
|
23
35
|
assetAmount: CryptoAmount;
|
|
24
36
|
runeAmount: CryptoAmount;
|
|
25
37
|
impermanentLossProtection: number;
|
|
26
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* Represents the parameters for adding liquidity to a pool.
|
|
41
|
+
*/
|
|
27
42
|
export type AddLiquidity = {
|
|
28
43
|
asset: CryptoAmount;
|
|
29
44
|
rune: CryptoAmount;
|
|
30
45
|
waitTimeSeconds: number;
|
|
31
46
|
assetPool: string;
|
|
32
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* Represents the parameters for withdrawing liquidity from a pool.
|
|
50
|
+
*/
|
|
33
51
|
export type WithdrawLiquidity = {
|
|
34
52
|
assetFee: CryptoAmount;
|
|
35
53
|
runeFee: CryptoAmount;
|
|
@@ -39,6 +57,9 @@ export type WithdrawLiquidity = {
|
|
|
39
57
|
assetAddress?: string;
|
|
40
58
|
runeAddress?: string;
|
|
41
59
|
};
|
|
60
|
+
/**
|
|
61
|
+
* Represents the parameters for depositing an asset.
|
|
62
|
+
*/
|
|
42
63
|
export type DepositParams = {
|
|
43
64
|
walletIndex?: number;
|
|
44
65
|
asset: Asset;
|
|
@@ -46,16 +67,25 @@ export type DepositParams = {
|
|
|
46
67
|
feeOption: FeeOption;
|
|
47
68
|
memo: string;
|
|
48
69
|
};
|
|
70
|
+
/**
|
|
71
|
+
* Represents the parameters for opening a loan.
|
|
72
|
+
*/
|
|
49
73
|
export type LoanOpenParams = {
|
|
50
74
|
memo: string;
|
|
51
75
|
amount: CryptoAmount;
|
|
52
76
|
toAddress: Address;
|
|
53
77
|
};
|
|
78
|
+
/**
|
|
79
|
+
* Represents the parameters for closing a loan.
|
|
80
|
+
*/
|
|
54
81
|
export type LoanCloseParams = {
|
|
55
82
|
memo: string;
|
|
56
83
|
amount: CryptoAmount;
|
|
57
84
|
toAddress: Address;
|
|
58
85
|
};
|
|
86
|
+
/**
|
|
87
|
+
* Represents the parameters for registering a THORName.
|
|
88
|
+
*/
|
|
59
89
|
export type RegisterThornameParams = {
|
|
60
90
|
thorname: string;
|
|
61
91
|
owner?: string;
|
|
@@ -64,6 +94,9 @@ export type RegisterThornameParams = {
|
|
|
64
94
|
preferredAsset?: Asset;
|
|
65
95
|
expirity?: Date;
|
|
66
96
|
};
|
|
97
|
+
/**
|
|
98
|
+
* Represents the parameters for updating a THORName.
|
|
99
|
+
*/
|
|
67
100
|
export type UpdateThornameParams = {
|
|
68
101
|
thorname: string;
|
|
69
102
|
owner?: string;
|
package/lib/wallet.d.ts
CHANGED
|
@@ -16,7 +16,13 @@ import { Address, CryptoAmount } from '@xchainjs/xchain-util';
|
|
|
16
16
|
import { UtxoClientParams } from '@xchainjs/xchain-utxo';
|
|
17
17
|
import { AddLiquidity, AllBalances, ExecuteSwap, LoanCloseParams, LoanOpenParams, RegisterThornameParams, TxSubmitted, UpdateThornameParams, WithdrawLiquidity } from './types';
|
|
18
18
|
import { EvmHelper } from './utils/evm-helper';
|
|
19
|
+
/**
|
|
20
|
+
* Represents the URLs for different network nodes.
|
|
21
|
+
*/
|
|
19
22
|
export type NodeUrls = Record<Network, string>;
|
|
23
|
+
/**
|
|
24
|
+
* Represents configurations for different blockchain chains.
|
|
25
|
+
*/
|
|
20
26
|
export type ChainConfigs = Partial<{
|
|
21
27
|
[BTCChain]: Omit<UtxoClientParams, 'phrase' | 'network'>;
|
|
22
28
|
[BCHChain]: Omit<UtxoClientParams, 'phrase' | 'network'>;
|
|
@@ -40,75 +46,86 @@ export declare class Wallet {
|
|
|
40
46
|
/**
|
|
41
47
|
* Contructor to create a Wallet
|
|
42
48
|
*
|
|
43
|
-
* @param phrase -
|
|
44
|
-
* @param thorchainCache -
|
|
45
|
-
* @param chainConfigs -
|
|
49
|
+
* @param phrase - Mnemonic phrase
|
|
50
|
+
* @param thorchainCache - An instance of the ThorchainCache (could be pointing to stagenet,testnet,mainnet)
|
|
51
|
+
* @param chainConfigs - Configuration settings for different blockchain chains
|
|
46
52
|
* @returns Wallet
|
|
47
53
|
*/
|
|
48
54
|
constructor(phrase: string, thorchainQuery: ThorchainQuery, chainConfigs?: ChainConfigs);
|
|
49
55
|
/**
|
|
50
|
-
* Fetch
|
|
51
|
-
*
|
|
52
|
-
* @returns AllBalances[]
|
|
56
|
+
* Fetch the balance of all the chains.
|
|
57
|
+
* @returns An array of AllBalances objects containing balance information for all chains
|
|
53
58
|
*/
|
|
54
59
|
getAllBalances(): Promise<AllBalances[]>;
|
|
55
60
|
/**
|
|
56
|
-
* Executes a
|
|
57
|
-
*
|
|
58
|
-
* @
|
|
59
|
-
* @returns transaction details and explorer url
|
|
61
|
+
* Executes a swap using the provided swap details.
|
|
62
|
+
* @param swap Object containing details required for the swap
|
|
63
|
+
* @returns Object containing transaction details and explorer URL
|
|
60
64
|
* @see ThorchainAMM.doSwap()
|
|
61
65
|
*/
|
|
62
66
|
executeSwap(swap: ExecuteSwap): Promise<TxSubmitted>;
|
|
63
|
-
/**
|
|
64
|
-
*
|
|
65
|
-
* @
|
|
67
|
+
/** Validates the swap object details.
|
|
68
|
+
* @param swap - Object containing swap parameters
|
|
69
|
+
* @returns An array of validation errors
|
|
66
70
|
*/
|
|
67
71
|
validateSwap(swap: ExecuteSwap): Promise<string[]>;
|
|
72
|
+
/**
|
|
73
|
+
* Checks if a given string is a valid THORName.
|
|
74
|
+
* @param name - Name to check
|
|
75
|
+
* @returns Boolean indicating whether the name is a valid THORName
|
|
76
|
+
*/
|
|
68
77
|
private isThorname;
|
|
69
|
-
/**
|
|
78
|
+
/** Swaps assets from RUNE to another asset.
|
|
70
79
|
*
|
|
71
|
-
* @param swap -
|
|
72
|
-
* @returns -
|
|
80
|
+
* @param swap - Swap details parameter
|
|
81
|
+
* @returns - Object containing transaction details and explorer URL
|
|
73
82
|
*/
|
|
74
83
|
private swapRuneTo;
|
|
75
|
-
/**
|
|
76
|
-
*
|
|
77
|
-
* @
|
|
78
|
-
* @returns - TxSubmitted object
|
|
84
|
+
/** Swaps assets that are not RUNE.
|
|
85
|
+
* @param swap - swap details object
|
|
86
|
+
* @returns - Object containing transaction details and explorer URL
|
|
79
87
|
*/
|
|
80
88
|
private swapNonRune;
|
|
81
|
-
/**
|
|
89
|
+
/** Handles adding liquidity to the pool.
|
|
82
90
|
* BASED OFF https://dev.thorchain.or›g/thorchain-dev/network/memos
|
|
83
|
-
* @param params
|
|
84
|
-
* @returns transaction details submitted
|
|
91
|
+
* @param params Input parameters for adding liquidity
|
|
92
|
+
* @returns An array of transaction details submitted
|
|
85
93
|
*/
|
|
86
94
|
addLiquidity(params: AddLiquidity): Promise<TxSubmitted[]>;
|
|
87
|
-
/**
|
|
88
|
-
*
|
|
89
|
-
* @
|
|
90
|
-
* @returns object with tx response, url and wait time in seconds
|
|
95
|
+
/** Handles withdrawing liquidity from the pool.
|
|
96
|
+
* @param params - Parameters required for liquidity position
|
|
97
|
+
* @returns Object with transaction response, URL, and wait time in seconds
|
|
91
98
|
*/
|
|
92
99
|
withdrawLiquidity(params: WithdrawLiquidity): Promise<TxSubmitted[]>;
|
|
93
100
|
/**
|
|
94
|
-
*
|
|
95
|
-
* @param assetAmount - amount to add
|
|
96
|
-
* @param memo - memo required
|
|
101
|
+
* Adds funds to a savers account.
|
|
102
|
+
* @param assetAmount - The amount of assets to add.
|
|
103
|
+
* @param memo - The memo required for the transaction.
|
|
97
104
|
* @param waitTimeSeconds - expected wait for the transaction to be processed
|
|
98
|
-
* @returns
|
|
105
|
+
* @returns An object containing transaction details and explorer URL.
|
|
99
106
|
*/
|
|
100
107
|
addSavers(assetAmount: CryptoAmount, memo: string, toAddress: Address): Promise<TxSubmitted>;
|
|
101
108
|
/**
|
|
102
|
-
*
|
|
103
|
-
* @param assetAmount - amount to withdraw
|
|
104
|
-
* @param memo - memo required
|
|
109
|
+
* Withdraws funds from a savers account.
|
|
110
|
+
* @param assetAmount - The amount of assets to withdraw.
|
|
111
|
+
* @param memo - The memo required for the transaction.
|
|
105
112
|
* @param waitTimeSeconds - expected wait for the transaction to be processed
|
|
106
|
-
* @returns
|
|
113
|
+
* @returns An object containing transaction details and explorer URL.
|
|
107
114
|
*/
|
|
108
115
|
withdrawSavers(assetAmount: CryptoAmount, memo: string, toAddress: Address): Promise<TxSubmitted>;
|
|
116
|
+
/**
|
|
117
|
+
* Opens a new loan.
|
|
118
|
+
* @param params - Parameters required to open a loan.
|
|
119
|
+
* @returns An object containing transaction details and explorer URL.
|
|
120
|
+
*/
|
|
109
121
|
loanOpen(params: LoanOpenParams): Promise<TxSubmitted>;
|
|
110
|
-
loanClose(params: LoanCloseParams): Promise<TxSubmitted>;
|
|
111
122
|
/**
|
|
123
|
+
* Closes an existing loan.
|
|
124
|
+
* @param params - Parameters required to close a loan.
|
|
125
|
+
* @returns An object containing transaction details and explorer URL.
|
|
126
|
+
*/
|
|
127
|
+
loanClose(params: LoanCloseParams): Promise<TxSubmitted>;
|
|
128
|
+
/**Registers a THORName with default parameters.
|
|
112
129
|
* Register a THORName with a default expirity of one year. By default chain and chainAddress is getting from wallet instance and is BTC.
|
|
113
130
|
* By default owner is getting from wallet
|
|
114
131
|
* @param thorname - Name to register
|
|
@@ -121,7 +138,7 @@ export declare class Wallet {
|
|
|
121
138
|
* @returns memo and value of deposit
|
|
122
139
|
*/
|
|
123
140
|
registerThorname(params: RegisterThornameParams): Promise<string>;
|
|
124
|
-
/**
|
|
141
|
+
/**Updates an existing THORName with default parameters.
|
|
125
142
|
* Register a THORName with a default expirity of one year. By default chain and chainAddress is getting from wallet instance and is BTC.
|
|
126
143
|
* By default owner is getting from wallet
|
|
127
144
|
* @param thorname - Name to register
|
|
@@ -133,41 +150,52 @@ export declare class Wallet {
|
|
|
133
150
|
* @returns memo and value of deposit
|
|
134
151
|
*/
|
|
135
152
|
updateThorname(params: UpdateThornameParams): Promise<string>;
|
|
136
|
-
/**
|
|
137
|
-
*
|
|
138
|
-
* @param
|
|
139
|
-
* @param
|
|
140
|
-
* @param
|
|
141
|
-
* @param
|
|
142
|
-
* @
|
|
143
|
-
* @returns - tx object
|
|
153
|
+
/** Handles liquidity addition for non-RUNE assets.
|
|
154
|
+
* @param params - Parameters for add liquidity
|
|
155
|
+
* @param constructedMemo - Memo needed for thorchain
|
|
156
|
+
* @param waitTimeSeconds - Wait time for the tx to be confirmed
|
|
157
|
+
* @param assetClient - XChainClient for the asset.
|
|
158
|
+
* @param inboundAsgard - Inbound Asgard address for the LP.
|
|
159
|
+
* @returns - Transaction object.
|
|
144
160
|
*/
|
|
145
161
|
private addAssetLP;
|
|
146
|
-
/**
|
|
147
|
-
*
|
|
148
|
-
* @param
|
|
149
|
-
* @param
|
|
150
|
-
* @param
|
|
151
|
-
* @param
|
|
152
|
-
* @
|
|
153
|
-
* @returns - tx object
|
|
162
|
+
/** Handles liquidity withdrawal for non-RUNE assets.
|
|
163
|
+
* @param params - Parameters for withdrawing liquidity.
|
|
164
|
+
* @param constructedMemo - Memo needed for Thorchain execution.
|
|
165
|
+
* @param assetClient - Asset client to call transfer.
|
|
166
|
+
* @param waitTimeSeconds - Return back estimated wait
|
|
167
|
+
* @param inboundAsgard - Destination address.
|
|
168
|
+
* @returns - Transaction object.
|
|
154
169
|
*/
|
|
155
170
|
private withdrawAssetLP;
|
|
156
|
-
/**
|
|
157
|
-
*
|
|
158
|
-
* @param
|
|
159
|
-
* @
|
|
160
|
-
* @returns - tx object
|
|
171
|
+
/** Handles liquidity addition for Rune only.
|
|
172
|
+
* @param params - Deposit parameters
|
|
173
|
+
* @param memo - Memo needed to withdraw lp
|
|
174
|
+
* @returns - Transaction object.
|
|
161
175
|
*/
|
|
162
176
|
private addRuneLP;
|
|
163
|
-
/**
|
|
164
|
-
*
|
|
165
|
-
* @param
|
|
166
|
-
* @
|
|
167
|
-
* @returns - tx object
|
|
177
|
+
/** Handles liquidity withdrawal for Rune only.
|
|
178
|
+
* @param params - Withdraw parameters
|
|
179
|
+
* @param memo - Memo needed to withdraw lp
|
|
180
|
+
* @returns - Transaction object.
|
|
168
181
|
*/
|
|
169
182
|
private withdrawRuneLP;
|
|
183
|
+
/**
|
|
184
|
+
* Checks if an asset is an ERC20 asset.
|
|
185
|
+
* @param asset - Asset to check.
|
|
186
|
+
* @returns - Boolean indicating whether the asset is an ERC20 asset.
|
|
187
|
+
*/
|
|
170
188
|
private isERC20Asset;
|
|
189
|
+
/**
|
|
190
|
+
* Checks if an asset belongs to an EVM chain.
|
|
191
|
+
* @param asset - Asset to check.
|
|
192
|
+
* @returns - Boolean indicating whether the asset belongs to an EVM chain.
|
|
193
|
+
*/
|
|
171
194
|
private isEVMChain;
|
|
195
|
+
/**
|
|
196
|
+
* Checks if an asset belongs to a UTXO chain.
|
|
197
|
+
* @param asset - Asset to check.
|
|
198
|
+
* @returns - Boolean indicating whether the asset belongs to a UTXO chain.
|
|
199
|
+
*/
|
|
172
200
|
private isUTXOChain;
|
|
173
201
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-thorchain-amm",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.22",
|
|
4
4
|
"description": "module that exposes estimating & swappping cryptocurrency assets on thorchain",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"THORChain",
|
|
@@ -39,8 +39,10 @@
|
|
|
39
39
|
"@xchainjs/xchain-thorchain-query": "0.7.3",
|
|
40
40
|
"@xchainjs/xchain-avax": "0.4.5",
|
|
41
41
|
"@xchainjs/xchain-bsc": "0.4.6",
|
|
42
|
+
"@xchainjs/xchain-cosmos": "1.0.0",
|
|
42
43
|
"@xchainjs/xchain-ethereum": "0.31.5",
|
|
43
|
-
"@xchainjs/xchain-thorchain": "
|
|
44
|
+
"@xchainjs/xchain-thorchain": "1.0.3",
|
|
45
|
+
"@xchainjs/xchain-mayachain": "1.0.0"
|
|
44
46
|
},
|
|
45
47
|
"devDependencies": {
|
|
46
48
|
"@binance-chain/javascript-sdk": "^4.2.0",
|
|
@@ -50,13 +52,11 @@
|
|
|
50
52
|
"@xchainjs/xchain-bitcoin": "^0.23.10",
|
|
51
53
|
"@xchainjs/xchain-bitcoincash": "^0.17.8",
|
|
52
54
|
"@xchainjs/xchain-client": "^0.16.1",
|
|
53
|
-
"@xchainjs/xchain-cosmos": "^0.21.10",
|
|
54
55
|
"@xchainjs/xchain-crypto": "^0.3.1",
|
|
55
56
|
"@xchainjs/xchain-doge": "^0.7.10",
|
|
56
57
|
"@xchainjs/xchain-thornode": "^0.3.10",
|
|
57
58
|
"@xchainjs/xchain-evm": "^0.4.4",
|
|
58
59
|
"@xchainjs/xchain-litecoin": "^0.13.9",
|
|
59
|
-
"@xchainjs/xchain-mayachain": "^0.2.16",
|
|
60
60
|
"@xchainjs/xchain-midgard": "^0.5.2",
|
|
61
61
|
"@xchainjs/xchain-util": "^0.13.1",
|
|
62
62
|
"@xchainjs/xchain-utxo-providers": "^0.2.11",
|
|
@@ -81,13 +81,11 @@
|
|
|
81
81
|
"@xchainjs/xchain-bitcoin": "^0.23.10",
|
|
82
82
|
"@xchainjs/xchain-bitcoincash": "^0.17.8",
|
|
83
83
|
"@xchainjs/xchain-client": "^0.16.1",
|
|
84
|
-
"@xchainjs/xchain-cosmos": "^0.21.10",
|
|
85
84
|
"@xchainjs/xchain-crypto": "^0.3.1",
|
|
86
85
|
"@xchainjs/xchain-doge": "^0.7.10",
|
|
87
86
|
"@xchainjs/xchain-thornode": "^0.3.10",
|
|
88
87
|
"@xchainjs/xchain-evm": "^0.4.4",
|
|
89
88
|
"@xchainjs/xchain-litecoin": "^0.13.9",
|
|
90
|
-
"@xchainjs/xchain-mayachain": "^0.2.16",
|
|
91
89
|
"@xchainjs/xchain-midgard": "^0.5.2",
|
|
92
90
|
"@xchainjs/xchain-util": "^0.13.1",
|
|
93
91
|
"@xchainjs/xchain-utxo-providers": "^0.2.11",
|