Skip to content

Commit

Permalink
Remove Thorchainquery crypto amount (#956)
Browse files Browse the repository at this point in the history
* Thorchainquery cryptoamount removed

* Tests

* Thorchainquery cryptoamount removed

* Thorchainquery cryptoamount removed from tests

* Thorchainquery cryptoamount removed from examples 2

* Test bug fix

* Package version file

* Bug fix
  • Loading branch information
0xp3gasus authored Dec 20, 2023
1 parent 5d1d6a4 commit 390eefb
Show file tree
Hide file tree
Showing 25 changed files with 47 additions and 173 deletions.
6 changes: 6 additions & 0 deletions .changeset/calm-tables-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@xchainjs/xchain-thorchain-query': minor
'@xchainjs/xchain-thorchain-amm': patch
---

CryptoAmount type removed
3 changes: 2 additions & 1 deletion examples/do-swap/doStreamingSwap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { Network } from '@xchainjs/xchain-client'
import { Midgard, MidgardCache, MidgardQuery } from '@xchainjs/xchain-midgard-query'
import { THORChain } from '@xchainjs/xchain-thorchain'
import { AmmEstimateSwapParams, ThorchainAMM, Wallet } from '@xchainjs/xchain-thorchain-amm'
import { CryptoAmount, ThorchainCache, ThorchainQuery, Thornode, TxDetails } from '@xchainjs/xchain-thorchain-query'
import { ThorchainCache, ThorchainQuery, Thornode, TxDetails } from '@xchainjs/xchain-thorchain-query'
import {
CryptoAmount,
assetAmount,
assetFromString,
assetToBase,
Expand Down
3 changes: 2 additions & 1 deletion examples/do-swap/doSwap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { Network } from '@xchainjs/xchain-client'
import { Midgard, MidgardCache, MidgardQuery } from '@xchainjs/xchain-midgard-query'
import { THORChain } from '@xchainjs/xchain-thorchain'
import { AmmEstimateSwapParams, ThorchainAMM, Wallet } from '@xchainjs/xchain-thorchain-amm'
import { CryptoAmount, ThorchainCache, ThorchainQuery, Thornode, TxDetails } from '@xchainjs/xchain-thorchain-query'
import { ThorchainCache, ThorchainQuery, Thornode, TxDetails } from '@xchainjs/xchain-thorchain-query'
import {
CryptoAmount,
assetAmount,
assetFromString,
assetToBase,
Expand Down
3 changes: 1 addition & 2 deletions examples/estimate-swap/estimateSwap.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { Network } from '@xchainjs/xchain-client'
import { Midgard, MidgardCache, MidgardQuery } from '@xchainjs/xchain-midgard-query'
import {
CryptoAmount,
QuoteSwapParams,
SwapEstimate,
ThorchainCache,
ThorchainQuery,
Thornode,
TxDetails,
} from '@xchainjs/xchain-thorchain-query'
import { assetAmount, assetFromString, assetToBase, register9Rheader } from '@xchainjs/xchain-util'
import { CryptoAmount, assetAmount, assetFromString, assetToBase, register9Rheader } from '@xchainjs/xchain-util'
import axios from 'axios'

register9Rheader(axios)
Expand Down
10 changes: 2 additions & 8 deletions examples/liquidity/add-liquidity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@ import { Network } from '@xchainjs/xchain-client'
import { Midgard, MidgardCache, MidgardQuery } from '@xchainjs/xchain-midgard-query'
import { isAssetRuneNative } from '@xchainjs/xchain-thorchain'
import { ThorchainAMM, Wallet } from '@xchainjs/xchain-thorchain-amm'
import {
AddliquidityPosition,
CryptoAmount,
ThorchainCache,
ThorchainQuery,
Thornode,
} from '@xchainjs/xchain-thorchain-query'
import { assetAmount, assetFromStringEx, assetToBase, register9Rheader } from '@xchainjs/xchain-util'
import { AddliquidityPosition, ThorchainCache, ThorchainQuery, Thornode } from '@xchainjs/xchain-thorchain-query'
import { CryptoAmount, assetAmount, assetFromStringEx, assetToBase, register9Rheader } from '@xchainjs/xchain-util'
import axios from 'axios'

register9Rheader(cosmosclient.config.globalAxios)
Expand Down
4 changes: 2 additions & 2 deletions examples/liquidity/add-savers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Network } from '@xchainjs/xchain-client'
import { Midgard, MidgardCache, MidgardQuery } from '@xchainjs/xchain-midgard-query'
import { ThorchainAMM, Wallet } from '@xchainjs/xchain-thorchain-amm'
import { CryptoAmount, ThorchainCache, ThorchainQuery, Thornode } from '@xchainjs/xchain-thorchain-query'
import { assetAmount, assetFromStringEx, assetToBase, register9Rheader } from '@xchainjs/xchain-util'
import { ThorchainCache, ThorchainQuery, Thornode } from '@xchainjs/xchain-thorchain-query'
import { CryptoAmount, assetAmount, assetFromStringEx, assetToBase, register9Rheader } from '@xchainjs/xchain-util'
import axios from 'axios'

register9Rheader(axios)
Expand Down
3 changes: 1 addition & 2 deletions examples/liquidity/estimate-add-liquidity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ import { Midgard, MidgardCache, MidgardQuery } from '@xchainjs/xchain-midgard-qu
import { isAssetRuneNative } from '@xchainjs/xchain-thorchain'
import {
AddliquidityPosition,
CryptoAmount,
EstimateAddLP,
ThorchainCache,
ThorchainQuery,
Thornode,
} from '@xchainjs/xchain-thorchain-query'
import { assetAmount, assetFromStringEx, assetToBase, register9Rheader } from '@xchainjs/xchain-util'
import { CryptoAmount, assetAmount, assetFromStringEx, assetToBase, register9Rheader } from '@xchainjs/xchain-util'
import axios from 'axios'

register9Rheader(axios)
Expand Down
10 changes: 2 additions & 8 deletions examples/liquidity/estimate-add-saver.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import { Network } from '@xchainjs/xchain-client'
import { Midgard, MidgardCache, MidgardQuery } from '@xchainjs/xchain-midgard-query'
import {
CryptoAmount,
EstimateAddSaver,
ThorchainCache,
ThorchainQuery,
Thornode,
} from '@xchainjs/xchain-thorchain-query'
import { assetAmount, assetFromStringEx, assetToBase, register9Rheader } from '@xchainjs/xchain-util'
import { EstimateAddSaver, ThorchainCache, ThorchainQuery, Thornode } from '@xchainjs/xchain-thorchain-query'
import { CryptoAmount, assetAmount, assetFromStringEx, assetToBase, register9Rheader } from '@xchainjs/xchain-util'
import axios from 'axios'

register9Rheader(axios)
Expand Down
10 changes: 2 additions & 8 deletions examples/loans/loanQuoteClosed.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import { Network } from '@xchainjs/xchain-client'
import { Midgard, MidgardCache, MidgardQuery } from '@xchainjs/xchain-midgard-query'
import { ThorchainAMM } from '@xchainjs/xchain-thorchain-amm'
import {
CryptoAmount,
LoanCloseParams,
ThorchainCache,
ThorchainQuery,
Thornode,
} from '@xchainjs/xchain-thorchain-query'
import { assetAmount, assetFromStringEx, assetToBase, register9Rheader } from '@xchainjs/xchain-util'
import { LoanCloseParams, ThorchainCache, ThorchainQuery, Thornode } from '@xchainjs/xchain-thorchain-query'
import { CryptoAmount, assetAmount, assetFromStringEx, assetToBase, register9Rheader } from '@xchainjs/xchain-util'
import axios from 'axios'

register9Rheader(axios)
Expand Down
10 changes: 2 additions & 8 deletions examples/loans/loanQuoteOpen.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import { Network } from '@xchainjs/xchain-client'
import { Midgard, MidgardCache, MidgardQuery } from '@xchainjs/xchain-midgard-query'
import { ThorchainAMM } from '@xchainjs/xchain-thorchain-amm'
import {
CryptoAmount,
LoanOpenParams,
ThorchainCache,
ThorchainQuery,
Thornode,
} from '@xchainjs/xchain-thorchain-query'
import { assetAmount, assetFromStringEx, assetToBase, register9Rheader } from '@xchainjs/xchain-util'
import { LoanOpenParams, ThorchainCache, ThorchainQuery, Thornode } from '@xchainjs/xchain-thorchain-query'
import { CryptoAmount, assetAmount, assetFromStringEx, assetToBase, register9Rheader } from '@xchainjs/xchain-util'
import axios from 'axios'

register9Rheader(axios)
Expand Down
4 changes: 2 additions & 2 deletions packages/xchain-thorchain-amm/__tests__/thorchainAMM.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { AssetBTC } from '@xchainjs/xchain-bitcoin'
import { AssetETH } from '@xchainjs/xchain-ethereum'
import { AssetRuneNative } from '@xchainjs/xchain-thorchain'
import { CryptoAmount, ThorchainQuery } from '@xchainjs/xchain-thorchain-query'
import { Asset, assetAmount, assetToBase } from '@xchainjs/xchain-util'
import { ThorchainQuery } from '@xchainjs/xchain-thorchain-query'
import { Asset, CryptoAmount, assetAmount, assetToBase } from '@xchainjs/xchain-util'

import mockMidgardApi from '../__mocks__/midgard-api'
import mockThornodeApi from '../__mocks__/thornode-api'
Expand Down
2 changes: 1 addition & 1 deletion packages/xchain-thorchain-amm/src/thorchain-amm.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
AddliquidityPosition,
CryptoAmount,
EstimateAddLP,
EstimateAddSaver,
EstimateWithdrawLP,
Expand All @@ -17,6 +16,7 @@ import {
WithdrawLiquidityPosition,
getSaver,
} from '@xchainjs/xchain-thorchain-query'
import { CryptoAmount } from '@xchainjs/xchain-util'

import { TxSubmitted } from './types'
import { Wallet } from './wallet'
Expand Down
4 changes: 2 additions & 2 deletions packages/xchain-thorchain-amm/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Balance, FeeOption } from '@xchainjs/xchain-client'
import { CryptoAmount, LiquidityPool } from '@xchainjs/xchain-thorchain-query'
import { Address, Asset, BaseAmount, Chain } from '@xchainjs/xchain-util'
import { LiquidityPool } from '@xchainjs/xchain-thorchain-query'
import { Address, Asset, BaseAmount, Chain, CryptoAmount } from '@xchainjs/xchain-util'

export type AllBalances = {
chain: Chain
Expand Down
4 changes: 2 additions & 2 deletions packages/xchain-thorchain-amm/src/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { EVMClientParams } from '@xchainjs/xchain-evm'
import { Client as LtcClient, LTCChain, defaultLtcParams } from '@xchainjs/xchain-litecoin'
import { Client as MayaClient, MAYAChain, MayachainClientParams } from '@xchainjs/xchain-mayachain'
import { Client as ThorClient, THORChain, ThorchainClient, ThorchainClientParams } from '@xchainjs/xchain-thorchain'
import { CryptoAmount, ThorchainQuery } from '@xchainjs/xchain-thorchain-query'
import { Address, Asset, assetFromString } from '@xchainjs/xchain-util'
import { ThorchainQuery } from '@xchainjs/xchain-thorchain-query'
import { Address, Asset, CryptoAmount, assetFromString } from '@xchainjs/xchain-util'
import { Client as UTXOClient, UtxoClientParams } from '@xchainjs/xchain-utxo'

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { assetAmount, assetFromStringEx, assetToBase, baseAmount } from '@xchainjs/xchain-util'
import { CryptoAmount, assetAmount, assetFromStringEx, assetToBase, baseAmount } from '@xchainjs/xchain-util'

import mockMidgardApi from '../__mocks__/midgard-api'
import mockThornodeApi from '../__mocks__/thornode-api'
import { CryptoAmount } from '../src/crypto-amount'
import { ThorchainQuery } from '../src/thorchain-query'
import { AssetRuneNative } from '../src/utils'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Pool } from '@xchainjs/xchain-thornode'
import { assetAmount, assetFromStringEx, assetToBase, baseAmount } from '@xchainjs/xchain-util'
import { CryptoAmount, assetAmount, assetFromStringEx, assetToBase, baseAmount } from '@xchainjs/xchain-util'
import BigNumber from 'bignumber.js'

import mockMidgardApi from '../__mocks__/midgard-api'
import mockThornodeApi from '../__mocks__/thornode-api'
import { CryptoAmount } from '../src/crypto-amount'
import { LiquidityPool } from '../src/liquidity-pool'
import { ThorchainQuery } from '../src/thorchain-query'
import { Block, LiquidityToAdd, PoolShareDetail, PostionDepositValue, UnitData } from '../src/types'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { assetAmount, assetFromStringEx, assetToBase } from '@xchainjs/xchain-util'
import { CryptoAmount, assetAmount, assetFromStringEx, assetToBase } from '@xchainjs/xchain-util'

import mockMidgardApi from '../__mocks__/midgard-api'
import mockThornodeApi from '../__mocks__/thornode-api'
import { CryptoAmount } from '../src/crypto-amount'
import { ThorchainCache } from '../src/thorchain-cache'
import { ThorchainQuery } from '../src/thorchain-query'
import { QuoteSwapParams, TxDetails } from '../src/types'
Expand Down
108 changes: 0 additions & 108 deletions packages/xchain-thorchain-query/src/crypto-amount.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/xchain-thorchain-query/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export * from './thorchain-query'
export * from './thorchain-checktx'
export * from './thorchain-cache'
export * from './liquidity-pool'
export * from './crypto-amount'
export * from './chain-defaults'
export * from './types'
export * from './utils'
Expand Down
12 changes: 10 additions & 2 deletions packages/xchain-thorchain-query/src/thorchain-cache.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import { MidgardQuery } from '@xchainjs/xchain-midgard-query'
import { Address, Asset, CachedValue, Chain, assetToString, baseAmount, eqAsset } from '@xchainjs/xchain-util'
import {
Address,
Asset,
CachedValue,
Chain,
CryptoAmount,
assetToString,
baseAmount,
eqAsset,
} from '@xchainjs/xchain-util'
import { BigNumber } from 'bignumber.js'

import { CryptoAmount } from './crypto-amount'
import { LiquidityPool } from './liquidity-pool'
import { InboundDetail } from './types'
import { THORChain, isAssetRuneNative } from './utils'
Expand Down
3 changes: 1 addition & 2 deletions packages/xchain-thorchain-query/src/thorchain-checktx.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Saver, TxDetailsResponse, TxSignersResponse } from '@xchainjs/xchain-thornode'
import { Asset, Chain, assetFromStringEx, baseAmount } from '@xchainjs/xchain-util'
import { Asset, Chain, CryptoAmount, assetFromStringEx, baseAmount } from '@xchainjs/xchain-util'

import { DefaultChainAttributes } from './chain-defaults'
import { CryptoAmount } from './crypto-amount'
import { ThorchainCache } from './thorchain-cache'
import { ChainAttributes } from './types'
import { AssetRuneNative, THORChain, isAssetRuneNative } from './utils'
Expand Down
2 changes: 1 addition & 1 deletion packages/xchain-thorchain-query/src/thorchain-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
Address,
Asset,
Chain,
CryptoAmount,
assetAmount,
assetFromStringEx,
assetToBase,
Expand All @@ -12,7 +13,6 @@ import {
import { BigNumber } from 'bignumber.js'

import { DefaultChainAttributes } from './chain-defaults'
import { CryptoAmount } from './crypto-amount'
import { ThorchainCache } from './thorchain-cache'
import {
AddliquidityPosition,
Expand Down
4 changes: 1 addition & 3 deletions packages/xchain-thorchain-query/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { FeeOption } from '@xchainjs/xchain-client'
import { LiquidityProviderSummary } from '@xchainjs/xchain-thornode'
import { Address, Asset, BaseAmount, Chain } from '@xchainjs/xchain-util'
import { Address, Asset, BaseAmount, Chain, CryptoAmount } from '@xchainjs/xchain-util'
import { BigNumber } from 'bignumber.js'

import { CryptoAmount } from './crypto-amount'

export type TotalFees = {
asset: Asset
affiliateFee: CryptoAmount
Expand Down
3 changes: 1 addition & 2 deletions packages/xchain-thorchain-query/src/utils/liquidity.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { baseAmount } from '@xchainjs/xchain-util'
import { CryptoAmount, baseAmount } from '@xchainjs/xchain-util'
import { BigNumber } from 'bignumber.js'

import { CryptoAmount } from '../crypto-amount'
import { LiquidityPool } from '../liquidity-pool'
import { Block, ILProtectionData, LiquidityToAdd, PoolShareDetail, PostionDepositValue, UnitData } from '../types'

Expand Down
Loading

0 comments on commit 390eefb

Please sign in to comment.