@xchainjs/xchain-thorchain-amm 2.0.21 → 2.0.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.esm.js +8 -4
- package/lib/index.js +7 -3
- package/package.json +1 -1
package/lib/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AssetAVAX, AVAXChain as AVAXChain$1, Client as Client$3, defaultAvaxParams } from '@xchainjs/xchain-avax';
|
|
2
2
|
import { FeeOption, TxType, Network, ExplorerProvider, Protocol } from '@xchainjs/xchain-client';
|
|
3
3
|
import { ClientKeystore as ClientKeystore$1, KeystoreSigner, abi, MAX_APPROVAL } from '@xchainjs/xchain-evm';
|
|
4
|
-
import { AssetType, assetToString, baseAmount, bnOrZero, assetFromString, eqAsset, isSynthAsset, getContractAddressFromAsset, isTradeAsset, AssetCryptoAmount, CryptoAmount } from '@xchainjs/xchain-util';
|
|
4
|
+
import { AssetType, assetToString, baseAmount, bnOrZero, assetFromString, eqAsset, isSynthAsset, getContractAddressFromAsset, isTradeAsset, isSecuredAsset, AssetCryptoAmount, CryptoAmount } from '@xchainjs/xchain-util';
|
|
5
5
|
import { ethers, BigNumber } from 'ethers';
|
|
6
6
|
import { BTCChain, Client as Client$8, defaultBTCParams } from '@xchainjs/xchain-bitcoin';
|
|
7
7
|
import { BCHChain, Client as Client$7, defaultBchParams } from '@xchainjs/xchain-bitcoincash';
|
|
@@ -4610,14 +4610,16 @@ class ThorchainAction {
|
|
|
4610
4610
|
static isNonProtocolParams(params) {
|
|
4611
4611
|
if ((params.assetAmount.asset.chain === THORChain ||
|
|
4612
4612
|
isSynthAsset(params.assetAmount.asset) ||
|
|
4613
|
-
isTradeAsset(params.assetAmount.asset)
|
|
4613
|
+
isTradeAsset(params.assetAmount.asset) ||
|
|
4614
|
+
isSecuredAsset(params.assetAmount.asset)) &&
|
|
4614
4615
|
'address' in params &&
|
|
4615
4616
|
!!params.address) {
|
|
4616
4617
|
throw Error('Inconsistent params. Native actions do not support recipient');
|
|
4617
4618
|
}
|
|
4618
4619
|
return (params.assetAmount.asset.chain !== THORChain &&
|
|
4619
4620
|
!isSynthAsset(params.assetAmount.asset) &&
|
|
4620
|
-
!isTradeAsset(params.assetAmount.asset)
|
|
4621
|
+
!isTradeAsset(params.assetAmount.asset) &&
|
|
4622
|
+
!isSecuredAsset(params.assetAmount.asset));
|
|
4621
4623
|
}
|
|
4622
4624
|
}
|
|
4623
4625
|
|
|
@@ -4692,7 +4694,9 @@ class ThorchainAMM {
|
|
|
4692
4694
|
return __awaiter$1(this, void 0, void 0, function* () {
|
|
4693
4695
|
const errors = [];
|
|
4694
4696
|
if (destinationAddress &&
|
|
4695
|
-
!validateAddress(this.thorchainQuery.thorchainCache.midgardQuery.midgardCache.midgard.network, isSynthAsset(destinationAsset) || isTradeAsset(destinationAsset)
|
|
4697
|
+
!validateAddress(this.thorchainQuery.thorchainCache.midgardQuery.midgardCache.midgard.network, isSynthAsset(destinationAsset) || isTradeAsset(destinationAsset) || isSecuredAsset(destinationAsset)
|
|
4698
|
+
? THORChain
|
|
4699
|
+
: destinationAsset.chain, destinationAddress)) {
|
|
4696
4700
|
errors.push(`destinationAddress ${destinationAddress} is not a valid address`);
|
|
4697
4701
|
}
|
|
4698
4702
|
if (!isTradeAsset(fromAsset) && !eqAsset(fromAsset, AssetRuneNative) && isTradeAsset(destinationAsset)) {
|
package/lib/index.js
CHANGED
|
@@ -4612,14 +4612,16 @@ class ThorchainAction {
|
|
|
4612
4612
|
static isNonProtocolParams(params) {
|
|
4613
4613
|
if ((params.assetAmount.asset.chain === xchainThorchain.THORChain ||
|
|
4614
4614
|
xchainUtil.isSynthAsset(params.assetAmount.asset) ||
|
|
4615
|
-
xchainUtil.isTradeAsset(params.assetAmount.asset)
|
|
4615
|
+
xchainUtil.isTradeAsset(params.assetAmount.asset) ||
|
|
4616
|
+
xchainUtil.isSecuredAsset(params.assetAmount.asset)) &&
|
|
4616
4617
|
'address' in params &&
|
|
4617
4618
|
!!params.address) {
|
|
4618
4619
|
throw Error('Inconsistent params. Native actions do not support recipient');
|
|
4619
4620
|
}
|
|
4620
4621
|
return (params.assetAmount.asset.chain !== xchainThorchain.THORChain &&
|
|
4621
4622
|
!xchainUtil.isSynthAsset(params.assetAmount.asset) &&
|
|
4622
|
-
!xchainUtil.isTradeAsset(params.assetAmount.asset)
|
|
4623
|
+
!xchainUtil.isTradeAsset(params.assetAmount.asset) &&
|
|
4624
|
+
!xchainUtil.isSecuredAsset(params.assetAmount.asset));
|
|
4623
4625
|
}
|
|
4624
4626
|
}
|
|
4625
4627
|
|
|
@@ -4694,7 +4696,9 @@ class ThorchainAMM {
|
|
|
4694
4696
|
return __awaiter$1(this, void 0, void 0, function* () {
|
|
4695
4697
|
const errors = [];
|
|
4696
4698
|
if (destinationAddress &&
|
|
4697
|
-
!validateAddress(this.thorchainQuery.thorchainCache.midgardQuery.midgardCache.midgard.network, xchainUtil.isSynthAsset(destinationAsset) || xchainUtil.isTradeAsset(destinationAsset)
|
|
4699
|
+
!validateAddress(this.thorchainQuery.thorchainCache.midgardQuery.midgardCache.midgard.network, xchainUtil.isSynthAsset(destinationAsset) || xchainUtil.isTradeAsset(destinationAsset) || xchainUtil.isSecuredAsset(destinationAsset)
|
|
4700
|
+
? xchainThorchain.THORChain
|
|
4701
|
+
: destinationAsset.chain, destinationAddress)) {
|
|
4698
4702
|
errors.push(`destinationAddress ${destinationAddress} is not a valid address`);
|
|
4699
4703
|
}
|
|
4700
4704
|
if (!xchainUtil.isTradeAsset(fromAsset) && !xchainUtil.eqAsset(fromAsset, xchainThorchain.AssetRuneNative) && xchainUtil.isTradeAsset(destinationAsset)) {
|