@gmx-io/sdk 1.4.2 → 1.5.0-alpha-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.
- package/build/cjs/scripts/prebuild/index.js +6 -1
- package/build/cjs/scripts/prebuild/prebuildKinkModelMarketRatesKeys.js +2 -28
- package/build/cjs/scripts/prebuild/prebuildMarketConfigKeys.js +2 -2
- package/build/cjs/scripts/prebuild/prebuildMarketValuesKeys.js +2 -2
- package/build/cjs/scripts/subsquid-codegen.js +26 -0
- package/build/cjs/src/{utils → clients/v1}/callContract.js +4 -6
- package/build/cjs/src/{index.js → clients/v1/index.js} +4 -4
- package/build/cjs/src/{modules → clients/v1/modules}/accounts/accounts.js +1 -1
- package/build/cjs/src/{modules → clients/v1/modules}/accounts/accounts.spec.js +1 -1
- package/build/cjs/src/clients/v1/modules/markets/index.js +227 -0
- package/build/cjs/src/{modules → clients/v1/modules}/markets/markets.spec.js +1 -1
- package/build/cjs/src/{modules → clients/v1/modules}/oracle.js +1 -1
- package/build/cjs/src/{modules → clients/v1/modules}/orders/helpers.js +9 -9
- package/build/cjs/src/{modules → clients/v1/modules}/orders/helpers.spec.js +5 -5
- package/build/cjs/src/{modules → clients/v1/modules}/orders/orders.js +11 -11
- package/build/cjs/src/{modules → clients/v1/modules}/orders/orders.spec.js +1 -1
- package/build/cjs/src/{modules → clients/v1/modules}/orders/transactions/cancelOrdersTxn.js +2 -2
- package/build/cjs/src/{modules → clients/v1/modules}/orders/transactions/createDecreaseOrderTxn.js +7 -7
- package/build/cjs/src/{modules → clients/v1/modules}/orders/transactions/createIncreaseOrderTxn.js +11 -11
- package/build/cjs/src/{modules → clients/v1/modules}/orders/transactions/createSwapOrderTxn.js +10 -10
- package/build/cjs/src/{modules → clients/v1/modules}/orders/transactions/createWrapOrUnwrapTxn.js +2 -2
- package/build/cjs/src/{modules → clients/v1/modules}/orders/transactions/updateOrderTxn.js +3 -3
- package/build/cjs/src/{modules → clients/v1/modules}/orders/utils.js +7 -7
- package/build/cjs/src/{modules → clients/v1/modules}/positions/positions.js +11 -11
- package/build/cjs/src/{modules → clients/v1/modules}/positions/positions.spec.js +1 -1
- package/build/cjs/src/{modules → clients/v1/modules}/tokens/tokens.js +3 -3
- package/build/cjs/src/{modules → clients/v1/modules}/tokens/tokens.spec.js +1 -1
- package/build/cjs/src/{modules → clients/v1/modules}/trades/trades.js +19 -19
- package/build/cjs/src/{modules → clients/v1/modules}/trades/trades.spec.js +1 -1
- package/build/cjs/src/{modules → clients/v1/modules}/utils/utils.js +8 -8
- package/build/cjs/src/{utils → clients/v1}/multicall.js +2 -2
- package/build/cjs/src/{utils → clients/v1}/simulateExecuteOrder.js +5 -5
- package/build/cjs/src/{utils → clients/v1}/testUtil.js +2 -2
- package/build/cjs/src/clients/v2/index.js +21 -0
- package/build/cjs/src/codegen/prebuilt/index.js +16 -0
- package/build/cjs/src/configs/api.js +15 -0
- package/build/cjs/src/configs/chains.js +29 -1
- package/build/cjs/src/configs/dataStore.js +6 -2
- package/build/cjs/src/configs/multichain.js +29 -19
- package/build/cjs/src/configs/tokens.js +1 -0
- package/build/cjs/src/test/mock.js +5 -122
- package/build/cjs/src/utils/24h/index.js +17 -0
- package/build/cjs/src/utils/LruCache/index.js +17 -0
- package/build/cjs/src/utils/__tests__/fees.spec.js +1 -1
- package/build/cjs/src/utils/__tests__/orderTransactions/batchUtils.spec.js +2 -2
- package/build/cjs/src/utils/__tests__/orderTransactions/decreaseOrders.spec.js +33 -33
- package/build/cjs/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.js +4 -4
- package/build/cjs/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +28 -28
- package/build/cjs/src/utils/__tests__/orderTransactions/swapOrders.spec.js +20 -20
- package/build/cjs/src/utils/__tests__/orderTransactions/updateOrder.spec.js +3 -3
- package/build/cjs/src/utils/__tests__/prices.spec.js +18 -18
- package/build/cjs/src/utils/abort/index.js +17 -0
- package/build/cjs/src/utils/bigmath/index.js +17 -0
- package/build/cjs/src/utils/buildUrl/index.js +17 -0
- package/build/cjs/src/utils/chains/index.js +17 -0
- package/build/cjs/src/utils/common/index.js +17 -0
- package/build/cjs/src/utils/{common.js → common/utils.js} +1 -2
- package/build/cjs/src/utils/fees/executionFee.js +2 -2
- package/build/cjs/src/utils/fees/index.js +9 -9
- package/build/cjs/src/utils/gelatoRelay/index.js +17 -0
- package/build/cjs/src/utils/graphqlFetcher/index.js +8 -0
- package/build/cjs/src/utils/hash/index.js +17 -0
- package/build/cjs/src/utils/{hash.js → hash/utils.js} +1 -1
- package/build/cjs/src/utils/http/http.js +33 -0
- package/build/cjs/src/utils/indexers/index.js +17 -0
- package/build/cjs/src/utils/{indexers.js → indexers/utils.js} +1 -1
- package/build/cjs/src/utils/markets/__tests__/mockMarkets.js +129 -0
- package/build/cjs/src/utils/markets/api.js +14 -0
- package/build/cjs/src/utils/{marketKeysAndConfigs.js → markets/hashKeys.js} +32 -3
- package/build/cjs/src/utils/markets/index.js +21 -0
- package/build/cjs/src/{modules/markets/query-builders.js → utils/markets/multicall.js} +149 -42
- package/build/cjs/src/utils/markets/utils.js +398 -0
- package/build/cjs/src/utils/numbers/index.js +17 -0
- package/build/cjs/src/utils/{numbers.js → numbers/utils.js} +8 -3
- package/build/cjs/src/utils/objects/index.js +17 -0
- package/build/cjs/src/utils/{objects.js → objects/utils.js} +9 -1
- package/build/cjs/src/utils/orderTransactions/index.js +17 -0
- package/build/cjs/src/utils/{orderTransactions.js → orderTransactions/utils.js} +22 -22
- package/build/cjs/src/utils/orders/index.js +18 -0
- package/build/cjs/src/utils/{orders.js → orders/utils.js} +22 -22
- package/build/cjs/src/utils/positions/index.js +18 -0
- package/build/cjs/src/utils/{positions.js → positions/utils.js} +6 -6
- package/build/cjs/src/utils/prices/index.js +17 -0
- package/build/cjs/src/utils/{prices.js → prices/utils.js} +15 -15
- package/build/cjs/src/utils/referrals/index.js +18 -0
- package/build/cjs/src/utils/sidecarOrders/index.js +17 -0
- package/build/cjs/src/utils/swap/__tests__/mockRouting.spec.js +14 -14
- package/build/cjs/src/utils/swap/__tests__/swapRouting.spec.js +5 -5
- package/build/cjs/src/utils/swap/__tests__/swapStats.spec.js +10 -10
- package/build/cjs/src/utils/swap/botanixStaking.js +3 -3
- package/build/cjs/src/utils/swap/buildSwapStrategy.js +2 -2
- package/build/cjs/src/utils/swap/externalSwapPath.js +2 -2
- package/build/cjs/src/utils/swap/externalSwapQuoteByPath.js +2 -2
- package/build/cjs/src/utils/swap/index.js +12 -0
- package/build/cjs/src/utils/swap/swapPath.js +3 -3
- package/build/cjs/src/utils/swap/swapValues.js +4 -4
- package/build/cjs/src/utils/time/index.js +17 -0
- package/build/cjs/src/utils/tokens/index.js +18 -0
- package/build/cjs/src/utils/{tokens.js → tokens/utils.js} +4 -4
- package/build/cjs/src/utils/trade/decrease.js +8 -8
- package/build/cjs/src/utils/trade/increase.js +2 -2
- package/build/cjs/src/utils/trade/index.js +3 -0
- package/build/cjs/src/utils/trade/trade.js +10 -10
- package/build/cjs/src/utils/tradeHistory/index.js +18 -0
- package/build/cjs/src/utils/{tradeHistory.js → tradeHistory/utils.js} +4 -4
- package/build/cjs/src/utils/twap/index.js +15 -0
- package/build/cjs/src/utils/types/index.js +7 -0
- package/build/esm/scripts/prebuild/index.js +3 -1
- package/build/esm/scripts/prebuild/prebuildKinkModelMarketRatesKeys.js +2 -28
- package/build/esm/scripts/prebuild/prebuildMarketConfigKeys.js +1 -1
- package/build/esm/scripts/prebuild/prebuildMarketValuesKeys.js +1 -1
- package/build/esm/scripts/subsquid-codegen.js +24 -0
- package/build/esm/src/{utils → clients/v1}/callContract.js +5 -5
- package/build/esm/src/{index.js → clients/v1/index.js} +4 -4
- package/build/esm/src/{modules → clients/v1/modules}/accounts/accounts.js +1 -1
- package/build/esm/src/{modules → clients/v1/modules}/accounts/accounts.spec.js +1 -1
- package/build/esm/src/clients/v1/modules/markets/index.js +220 -0
- package/build/esm/src/{modules → clients/v1/modules}/markets/markets.spec.js +1 -1
- package/build/esm/src/{modules → clients/v1/modules}/oracle.js +1 -1
- package/build/esm/src/{modules → clients/v1/modules}/orders/helpers.js +6 -6
- package/build/esm/src/{modules → clients/v1/modules}/orders/helpers.spec.js +5 -5
- package/build/esm/src/{modules → clients/v1/modules}/orders/orders.js +4 -4
- package/build/esm/src/{modules → clients/v1/modules}/orders/orders.spec.js +1 -1
- package/build/esm/src/{modules → clients/v1/modules}/orders/transactions/cancelOrdersTxn.js +2 -2
- package/build/esm/src/{modules → clients/v1/modules}/orders/transactions/createDecreaseOrderTxn.js +7 -7
- package/build/esm/src/{modules → clients/v1/modules}/orders/transactions/createIncreaseOrderTxn.js +8 -8
- package/build/esm/src/{modules → clients/v1/modules}/orders/transactions/createSwapOrderTxn.js +7 -7
- package/build/esm/src/{modules → clients/v1/modules}/orders/transactions/createWrapOrUnwrapTxn.js +2 -2
- package/build/esm/src/{modules → clients/v1/modules}/orders/transactions/updateOrderTxn.js +3 -3
- package/build/esm/src/{modules → clients/v1/modules}/orders/utils.js +7 -7
- package/build/esm/src/{modules → clients/v1/modules}/positions/positions.js +11 -11
- package/build/esm/src/{modules → clients/v1/modules}/positions/positions.spec.js +1 -1
- package/build/esm/src/{modules → clients/v1/modules}/tokens/tokens.js +3 -3
- package/build/esm/src/{modules → clients/v1/modules}/tokens/tokens.spec.js +1 -1
- package/build/esm/src/{modules → clients/v1/modules}/trades/trades.js +8 -8
- package/build/esm/src/{modules → clients/v1/modules}/trades/trades.spec.js +1 -1
- package/build/esm/src/{modules → clients/v1/modules}/utils/utils.js +8 -8
- package/build/esm/src/{utils → clients/v1}/multicall.js +2 -2
- package/build/esm/src/{utils → clients/v1}/simulateExecuteOrder.js +5 -5
- package/build/esm/src/{utils → clients/v1}/testUtil.js +2 -2
- package/build/esm/src/clients/v2/index.js +17 -0
- package/build/esm/src/codegen/prebuilt/index.js +10 -0
- package/build/esm/src/configs/api.js +11 -0
- package/build/esm/src/configs/chains.js +29 -1
- package/build/esm/src/configs/dataStore.js +3 -0
- package/build/esm/src/configs/multichain.js +28 -19
- package/build/esm/src/configs/tokens.js +1 -0
- package/build/esm/src/test/mock.js +3 -120
- package/build/esm/src/utils/24h/index.js +1 -0
- package/build/esm/src/utils/LruCache/index.js +1 -0
- package/build/esm/src/utils/__tests__/fees.spec.js +1 -1
- package/build/esm/src/utils/__tests__/orderTransactions/batchUtils.spec.js +1 -1
- package/build/esm/src/utils/__tests__/orderTransactions/decreaseOrders.spec.js +1 -1
- package/build/esm/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.js +1 -1
- package/build/esm/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +1 -1
- package/build/esm/src/utils/__tests__/orderTransactions/swapOrders.spec.js +1 -1
- package/build/esm/src/utils/__tests__/orderTransactions/updateOrder.spec.js +1 -1
- package/build/esm/src/utils/__tests__/prices.spec.js +2 -2
- package/build/esm/src/utils/abort/index.js +1 -0
- package/build/esm/src/utils/bigmath/index.js +1 -0
- package/build/esm/src/utils/buildUrl/index.js +1 -0
- package/build/esm/src/utils/chains/index.js +1 -0
- package/build/esm/src/utils/common/index.js +1 -0
- package/build/esm/src/utils/{common.js → common/utils.js} +0 -1
- package/build/esm/src/utils/fees/executionFee.js +1 -1
- package/build/esm/src/utils/fees/index.js +7 -7
- package/build/esm/src/utils/gelatoRelay/index.js +1 -0
- package/build/esm/src/utils/graphqlFetcher/index.js +1 -0
- package/build/esm/src/utils/hash/index.js +1 -0
- package/build/esm/src/utils/{hash.js → hash/utils.js} +1 -1
- package/build/esm/src/utils/http/http.js +26 -0
- package/build/esm/src/utils/indexers/index.js +1 -0
- package/build/esm/src/utils/{indexers.js → indexers/utils.js} +1 -1
- package/build/esm/src/utils/markets/__tests__/mockMarkets.js +124 -0
- package/build/esm/src/utils/markets/api.js +9 -0
- package/build/esm/src/utils/{marketKeysAndConfigs.js → markets/hashKeys.js} +30 -2
- package/build/esm/src/utils/markets/index.js +5 -0
- package/build/esm/src/{modules/markets/query-builders.js → utils/markets/multicall.js} +146 -41
- package/build/esm/src/utils/markets/utils.js +364 -0
- package/build/esm/src/utils/numbers/index.js +1 -0
- package/build/esm/src/utils/{numbers.js → numbers/utils.js} +8 -3
- package/build/esm/src/utils/objects/index.js +1 -0
- package/build/esm/src/utils/{objects.js → objects/utils.js} +7 -0
- package/build/esm/src/utils/orderTransactions/index.js +1 -0
- package/build/esm/src/utils/{orderTransactions.js → orderTransactions/utils.js} +14 -14
- package/build/esm/src/utils/orders/index.js +2 -0
- package/build/esm/src/utils/{orders.js → orders/utils.js} +8 -8
- package/build/esm/src/utils/positions/index.js +2 -0
- package/build/esm/src/utils/{positions.js → positions/utils.js} +6 -6
- package/build/esm/src/utils/prices/index.js +1 -0
- package/build/esm/src/utils/{prices.js → prices/utils.js} +7 -7
- package/build/esm/src/utils/referrals/index.js +2 -0
- package/build/esm/src/utils/sidecarOrders/index.js +1 -0
- package/build/esm/src/utils/swap/__tests__/mockRouting.spec.js +1 -1
- package/build/esm/src/utils/swap/__tests__/swapRouting.spec.js +1 -1
- package/build/esm/src/utils/swap/__tests__/swapStats.spec.js +1 -1
- package/build/esm/src/utils/swap/botanixStaking.js +1 -1
- package/build/esm/src/utils/swap/buildSwapStrategy.js +1 -1
- package/build/esm/src/utils/swap/externalSwapPath.js +1 -1
- package/build/esm/src/utils/swap/externalSwapQuoteByPath.js +1 -1
- package/build/esm/src/utils/swap/index.js +12 -0
- package/build/esm/src/utils/swap/swapPath.js +1 -1
- package/build/esm/src/utils/swap/swapValues.js +1 -1
- package/build/esm/src/utils/time/index.js +1 -0
- package/build/esm/src/utils/tokens/index.js +2 -0
- package/build/esm/src/utils/{tokens.js → tokens/utils.js} +4 -4
- package/build/esm/src/utils/trade/decrease.js +1 -1
- package/build/esm/src/utils/trade/increase.js +1 -1
- package/build/esm/src/utils/trade/index.js +3 -0
- package/build/esm/src/utils/trade/trade.js +2 -2
- package/build/esm/src/utils/tradeHistory/index.js +2 -0
- package/build/esm/src/utils/{tradeHistory.js → tradeHistory/utils.js} +4 -4
- package/build/esm/src/utils/twap/index.js +1 -0
- package/build/esm/src/utils/types/index.js +3 -0
- package/build/types/scripts/subsquid-codegen.d.ts +3 -0
- package/build/types/src/clients/v1/callContract.d.ts +7 -0
- package/build/types/src/{index.d.ts → clients/v1/index.d.ts} +3 -3
- package/build/types/src/{modules → clients/v1/modules}/markets/index.d.ts +12 -1
- package/build/types/src/{modules → clients/v1/modules}/oracle.d.ts +1 -1
- package/build/types/src/{modules → clients/v1/modules}/orders/helpers.d.ts +3 -3
- package/build/types/src/{modules → clients/v1/modules}/orders/orders.d.ts +5 -5
- package/build/types/src/{modules → clients/v1/modules}/orders/transactions/createDecreaseOrderTxn.d.ts +2 -2
- package/build/types/src/{modules → clients/v1/modules}/orders/transactions/createIncreaseOrderTxn.d.ts +4 -4
- package/build/types/src/{modules → clients/v1/modules}/orders/transactions/createSwapOrderTxn.d.ts +2 -2
- package/build/types/src/{modules → clients/v1/modules}/orders/transactions/updateOrderTxn.d.ts +1 -1
- package/build/types/src/{modules → clients/v1/modules}/orders/utils.d.ts +8 -8
- package/build/types/src/{modules → clients/v1/modules}/positions/positions.d.ts +4 -4
- package/build/types/src/{modules → clients/v1/modules}/tokens/tokens.d.ts +1 -1
- package/build/types/src/{modules → clients/v1/modules}/trades/trades.d.ts +4 -4
- package/build/types/src/{modules → clients/v1/modules}/utils/utils.d.ts +4 -4
- package/build/types/src/{utils → clients/v1}/multicall.d.ts +2 -2
- package/build/types/src/{utils → clients/v1}/simulateExecuteOrder.d.ts +3 -3
- package/build/types/src/{utils → clients/v1}/testUtil.d.ts +2 -2
- package/build/types/src/{types/sdk.d.ts → clients/v1/types.d.ts} +3 -3
- package/build/types/src/clients/v2/index.d.ts +13 -0
- package/build/types/src/codegen/prebuilt/index.d.ts +13636 -0
- package/build/types/src/{types → codegen}/subsquid.d.ts +13 -0
- package/build/types/src/configs/api.d.ts +1 -0
- package/build/types/src/configs/chains.d.ts +26 -2
- package/build/types/src/configs/dataStore.d.ts +1 -0
- package/build/types/src/configs/express.d.ts +1 -1
- package/build/types/src/configs/gasLimits.d.ts +1 -1
- package/build/types/src/configs/markets.d.ts +1 -1
- package/build/types/src/configs/multichain.d.ts +6 -3
- package/build/types/src/configs/tokens.d.ts +1 -1
- package/build/types/src/test/mock.d.ts +3 -7
- package/build/types/src/utils/24h/index.d.ts +1 -0
- package/build/types/src/utils/24h/types.d.ts +7 -0
- package/build/types/src/utils/LruCache/index.d.ts +1 -0
- package/build/types/src/utils/abort/index.d.ts +1 -0
- package/build/types/src/utils/bigmath/index.d.ts +1 -0
- package/build/types/src/utils/buildUrl/index.d.ts +1 -0
- package/build/types/src/utils/chains/index.d.ts +1 -0
- package/build/types/src/utils/common/index.d.ts +1 -0
- package/build/types/src/utils/{common.d.ts → common/utils.d.ts} +0 -1
- package/build/types/src/utils/fees/executionFee.d.ts +3 -3
- package/build/types/src/utils/fees/getNaiveEstimatedGasBySwapCount.d.ts +1 -1
- package/build/types/src/utils/fees/index.d.ts +10 -13
- package/build/types/src/utils/fees/priceImpact.d.ts +3 -3
- package/build/types/src/{types/fees.d.ts → utils/fees/types.d.ts} +2 -2
- package/build/types/src/utils/gelatoRelay/index.d.ts +1 -0
- package/build/types/src/utils/graphqlFetcher/index.d.ts +1 -0
- package/build/types/src/utils/hash/index.d.ts +1 -0
- package/build/types/src/utils/http/http.d.ts +9 -0
- package/build/types/src/utils/http/types.d.ts +7 -0
- package/build/types/src/utils/indexers/index.d.ts +1 -0
- package/build/types/src/utils/markets/__tests__/mockMarkets.d.ts +9 -0
- package/build/types/src/utils/markets/api.d.ts +9 -0
- package/build/types/src/utils/markets/hashKeys.d.ts +23 -0
- package/build/types/src/utils/markets/index.d.ts +5 -0
- package/build/types/src/utils/markets/multicall.d.ts +25 -0
- package/build/types/src/{types/markets.d.ts → utils/markets/types.d.ts} +64 -1
- package/build/types/src/utils/markets/utils.d.ts +122 -0
- package/build/types/src/utils/numbers/index.d.ts +1 -0
- package/build/types/src/utils/{numbers.d.ts → numbers/utils.d.ts} +3 -1
- package/build/types/src/utils/objects/index.d.ts +1 -0
- package/build/types/src/utils/{objects.d.ts → objects/utils.d.ts} +1 -0
- package/build/types/src/utils/orderTransactions/index.d.ts +1 -0
- package/build/types/src/utils/{orderTransactions.d.ts → orderTransactions/utils.d.ts} +6 -6
- package/build/types/src/utils/orders/index.d.ts +2 -0
- package/build/types/src/{types/orders.d.ts → utils/orders/types.d.ts} +3 -3
- package/build/types/src/utils/{orders.d.ts → orders/utils.d.ts} +3 -3
- package/build/types/src/utils/positions/index.d.ts +2 -0
- package/build/types/src/{types/positions.d.ts → utils/positions/types.d.ts} +2 -2
- package/build/types/src/utils/{positions.d.ts → positions/utils.d.ts} +4 -4
- package/build/types/src/utils/prices/index.d.ts +1 -0
- package/build/types/src/utils/{prices.d.ts → prices/utils.d.ts} +4 -4
- package/build/types/src/utils/referrals/index.d.ts +2 -0
- package/build/types/src/utils/sidecarOrders/index.d.ts +1 -0
- package/build/types/src/{types/sidecarOrders.d.ts → utils/sidecarOrders/types.d.ts} +2 -2
- package/build/types/src/utils/swap/botanixStaking.d.ts +2 -2
- package/build/types/src/utils/swap/buildSwapStrategy.d.ts +5 -5
- package/build/types/src/utils/swap/externalSwapPath.d.ts +1 -1
- package/build/types/src/utils/swap/externalSwapQuoteByPath.d.ts +1 -1
- package/build/types/src/utils/swap/findSwapPathsBetweenTokens.d.ts +1 -1
- package/build/types/src/utils/swap/index.d.ts +12 -0
- package/build/types/src/utils/swap/preparedSwapData.d.ts +1 -1
- package/build/types/src/utils/swap/swapPath.d.ts +6 -6
- package/build/types/src/utils/swap/swapRouting.d.ts +5 -5
- package/build/types/src/utils/swap/swapStats.d.ts +3 -3
- package/build/types/src/utils/swap/swapValues.d.ts +4 -4
- package/build/types/src/{types/swapStrategy.d.ts → utils/swap/types.d.ts} +1 -1
- package/build/types/src/utils/time/index.d.ts +1 -0
- package/build/types/src/utils/tokens/index.d.ts +2 -0
- package/build/types/src/utils/{tokens.d.ts → tokens/utils.d.ts} +2 -2
- package/build/types/src/utils/trade/decrease.d.ts +5 -5
- package/build/types/src/utils/trade/increase.d.ts +5 -5
- package/build/types/src/utils/trade/index.d.ts +3 -0
- package/build/types/src/utils/trade/trade.d.ts +1 -1
- package/build/types/src/{types/trade.d.ts → utils/trade/types.d.ts} +4 -4
- package/build/types/src/utils/tradeHistory/index.d.ts +2 -0
- package/build/types/src/{types/tradeHistory.d.ts → utils/tradeHistory/types.d.ts} +3 -3
- package/build/types/src/utils/{tradeHistory.d.ts → tradeHistory/utils.d.ts} +4 -4
- package/build/types/src/utils/twap/index.d.ts +3 -2
- package/build/types/src/utils/{types.d.ts → types/index.d.ts} +0 -1
- package/package.json +277 -29
- package/build/cjs/src/modules/markets/index.js +0 -366
- package/build/cjs/src/prebuilt/index.js +0 -15
- package/build/cjs/src/utils/markets.js +0 -195
- package/build/cjs/src/utils/types.js +0 -13
- package/build/esm/src/modules/markets/index.js +0 -359
- package/build/esm/src/prebuilt/index.js +0 -7
- package/build/esm/src/utils/markets.js +0 -171
- package/build/esm/src/utils/types.js +0 -8
- package/build/types/src/modules/markets/query-builders.d.ts +0 -42
- package/build/types/src/modules/markets/types.d.ts +0 -51
- package/build/types/src/prebuilt/index.d.ts +0 -24
- package/build/types/src/types/common.d.ts +0 -1
- package/build/types/src/utils/callContract.d.ts +0 -17
- package/build/types/src/utils/marketKeysAndConfigs.d.ts +0 -73
- package/build/types/src/utils/markets.d.ts +0 -58
- /package/build/cjs/src/{modules → clients/v1/modules}/base.js +0 -0
- /package/build/cjs/src/{modules/markets → clients/v1}/types.js +0 -0
- /package/build/cjs/src/{prebuilt → codegen/prebuilt}/hashedKinkModelMarketRatesKeys.json +0 -0
- /package/build/cjs/src/{prebuilt → codegen/prebuilt}/hashedMarketConfigKeys.json +0 -0
- /package/build/cjs/src/{prebuilt → codegen/prebuilt}/hashedMarketValuesKeys.json +0 -0
- /package/build/cjs/src/{types → codegen}/subsquid.js +0 -0
- /package/build/cjs/src/{types/chains.js → utils/24h/types.js} +0 -0
- /package/build/cjs/src/utils/{LruCache.js → LruCache/utils.js} +0 -0
- /package/build/cjs/src/utils/{abort.js → abort/utils.js} +0 -0
- /package/build/cjs/src/utils/{bigmath.js → bigmath/utils.js} +0 -0
- /package/build/cjs/src/utils/{buildUrl.js → buildUrl/utils.js} +0 -0
- /package/build/cjs/src/{types/common.js → utils/chains/types.js} +0 -0
- /package/build/cjs/src/{types/fees.js → utils/fees/types.js} +0 -0
- /package/build/cjs/src/utils/{gelatoRelay.js → gelatoRelay/utils.js} +0 -0
- /package/build/cjs/src/utils/{graphqlFetcher.js → graphqlFetcher/utils.js} +0 -0
- /package/build/cjs/src/{types/markets.js → utils/http/types.js} +0 -0
- /package/build/cjs/src/{types/positions.js → utils/markets/types.js} +0 -0
- /package/build/cjs/src/{types/orders.js → utils/orders/types.js} +0 -0
- /package/build/cjs/src/{types/sdk.js → utils/positions/types.js} +0 -0
- /package/build/cjs/src/{types/referrals.js → utils/referrals/types.js} +0 -0
- /package/build/cjs/src/utils/{referrals.js → referrals/utils.js} +0 -0
- /package/build/cjs/src/{types/sidecarOrders.js → utils/sidecarOrders/types.js} +0 -0
- /package/build/cjs/src/{types/swapStrategy.js → utils/swap/types.js} +0 -0
- /package/build/cjs/src/utils/{time.js → time/utils.js} +0 -0
- /package/build/cjs/src/{types/tokens.js → utils/tokens/types.js} +0 -0
- /package/build/cjs/src/{types/trade.js → utils/trade/types.js} +0 -0
- /package/build/cjs/src/{types/tradeHistory.js → utils/tradeHistory/types.js} +0 -0
- /package/build/cjs/src/{types/twap.js → utils/twap/types.js} +0 -0
- /package/build/esm/src/{modules → clients/v1/modules}/base.js +0 -0
- /package/build/esm/src/{modules/markets → clients/v1}/types.js +0 -0
- /package/build/esm/src/{prebuilt → codegen/prebuilt}/hashedKinkModelMarketRatesKeys.json +0 -0
- /package/build/esm/src/{prebuilt → codegen/prebuilt}/hashedMarketConfigKeys.json +0 -0
- /package/build/esm/src/{prebuilt → codegen/prebuilt}/hashedMarketValuesKeys.json +0 -0
- /package/build/esm/src/{types → codegen}/subsquid.js +0 -0
- /package/build/esm/src/{types/chains.js → utils/24h/types.js} +0 -0
- /package/build/esm/src/utils/{LruCache.js → LruCache/utils.js} +0 -0
- /package/build/esm/src/utils/{abort.js → abort/utils.js} +0 -0
- /package/build/esm/src/utils/{bigmath.js → bigmath/utils.js} +0 -0
- /package/build/esm/src/utils/{buildUrl.js → buildUrl/utils.js} +0 -0
- /package/build/esm/src/{types/common.js → utils/chains/types.js} +0 -0
- /package/build/esm/src/{types/fees.js → utils/fees/types.js} +0 -0
- /package/build/esm/src/utils/{gelatoRelay.js → gelatoRelay/utils.js} +0 -0
- /package/build/esm/src/utils/{graphqlFetcher.js → graphqlFetcher/utils.js} +0 -0
- /package/build/esm/src/{types/markets.js → utils/http/types.js} +0 -0
- /package/build/esm/src/{types/positions.js → utils/markets/types.js} +0 -0
- /package/build/esm/src/{types/orders.js → utils/orders/types.js} +0 -0
- /package/build/esm/src/{types/sdk.js → utils/positions/types.js} +0 -0
- /package/build/esm/src/{types/referrals.js → utils/referrals/types.js} +0 -0
- /package/build/esm/src/utils/{referrals.js → referrals/utils.js} +0 -0
- /package/build/esm/src/{types/sidecarOrders.js → utils/sidecarOrders/types.js} +0 -0
- /package/build/esm/src/{types/swapStrategy.js → utils/swap/types.js} +0 -0
- /package/build/esm/src/utils/{time.js → time/utils.js} +0 -0
- /package/build/esm/src/{types/tokens.js → utils/tokens/types.js} +0 -0
- /package/build/esm/src/{types/trade.js → utils/trade/types.js} +0 -0
- /package/build/esm/src/{types/tradeHistory.js → utils/tradeHistory/types.js} +0 -0
- /package/build/esm/src/{types/twap.js → utils/twap/types.js} +0 -0
- /package/build/types/src/{modules → clients/v1/modules}/accounts/accounts.d.ts +0 -0
- /package/build/types/src/{modules → clients/v1/modules}/accounts/accounts.spec.d.ts +0 -0
- /package/build/types/src/{modules → clients/v1/modules}/base.d.ts +0 -0
- /package/build/types/src/{modules → clients/v1/modules}/markets/markets.spec.d.ts +0 -0
- /package/build/types/src/{modules → clients/v1/modules}/orders/helpers.spec.d.ts +0 -0
- /package/build/types/src/{modules → clients/v1/modules}/orders/orders.spec.d.ts +0 -0
- /package/build/types/src/{modules → clients/v1/modules}/orders/transactions/cancelOrdersTxn.d.ts +0 -0
- /package/build/types/src/{modules → clients/v1/modules}/orders/transactions/createWrapOrUnwrapTxn.d.ts +0 -0
- /package/build/types/src/{modules → clients/v1/modules}/positions/positions.spec.d.ts +0 -0
- /package/build/types/src/{modules → clients/v1/modules}/tokens/tokens.spec.d.ts +0 -0
- /package/build/types/src/{modules → clients/v1/modules}/trades/trades.spec.d.ts +0 -0
- /package/build/types/src/utils/{LruCache.d.ts → LruCache/utils.d.ts} +0 -0
- /package/build/types/src/utils/{abort.d.ts → abort/utils.d.ts} +0 -0
- /package/build/types/src/utils/{bigmath.d.ts → bigmath/utils.d.ts} +0 -0
- /package/build/types/src/utils/{buildUrl.d.ts → buildUrl/utils.d.ts} +0 -0
- /package/build/types/src/{types/chains.d.ts → utils/chains/types.d.ts} +0 -0
- /package/build/types/src/utils/{gelatoRelay.d.ts → gelatoRelay/utils.d.ts} +0 -0
- /package/build/types/src/utils/{graphqlFetcher.d.ts → graphqlFetcher/utils.d.ts} +0 -0
- /package/build/types/src/utils/{hash.d.ts → hash/utils.d.ts} +0 -0
- /package/build/types/src/utils/{indexers.d.ts → indexers/utils.d.ts} +0 -0
- /package/build/types/src/{types/referrals.d.ts → utils/referrals/types.d.ts} +0 -0
- /package/build/types/src/utils/{referrals.d.ts → referrals/utils.d.ts} +0 -0
- /package/build/types/src/utils/{time.d.ts → time/utils.d.ts} +0 -0
- /package/build/types/src/{types/tokens.d.ts → utils/tokens/types.d.ts} +0 -0
- /package/build/types/src/{types/twap.d.ts → utils/twap/types.d.ts} +0 -0
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mockExternalSwap = exports.mockMarketsInfoData = exports.mockMarketsData = exports.mockTokensData = exports.mockMarketKeys = exports.MOCK_GAS_PRICE = exports.usdToToken = void 0;
|
|
4
|
-
const viem_1 = require("viem");
|
|
5
4
|
const factors_1 = require("../configs/factors");
|
|
6
|
-
const trade_1 = require("../types/trade");
|
|
7
|
-
const markets_1 = require("../utils/markets");
|
|
8
5
|
const numbers_1 = require("../utils/numbers");
|
|
9
6
|
const tokens_1 = require("../utils/tokens");
|
|
7
|
+
const types_1 = require("../utils/trade/types");
|
|
10
8
|
function usdToToken(usd, token) {
|
|
11
9
|
return (0, tokens_1.convertToTokenAmount)((0, numbers_1.expandDecimals)(usd, factors_1.USD_DECIMALS), token.decimals, token.prices?.minPrice);
|
|
12
10
|
}
|
|
@@ -136,130 +134,15 @@ exports.mockTokensData = mockTokensData;
|
|
|
136
134
|
/**
|
|
137
135
|
* @param marketKeys - array of market keys in the following format: indexToken-longToken-shortToken
|
|
138
136
|
*/
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
acc[key] = {
|
|
143
|
-
marketTokenAddress: key,
|
|
144
|
-
indexTokenAddress,
|
|
145
|
-
longTokenAddress,
|
|
146
|
-
shortTokenAddress,
|
|
147
|
-
isSameCollaterals: longTokenAddress === shortTokenAddress,
|
|
148
|
-
isSpotOnly: indexTokenAddress === "SPOT",
|
|
149
|
-
data: "",
|
|
150
|
-
name: "Test Market",
|
|
151
|
-
};
|
|
152
|
-
return acc;
|
|
153
|
-
}, {});
|
|
154
|
-
}
|
|
155
|
-
exports.mockMarketsData = mockMarketsData;
|
|
156
|
-
function mockMarketsInfoData(tokensData, marketKeys, overrides = {}) {
|
|
157
|
-
return marketKeys.reduce((acc, key) => {
|
|
158
|
-
const [indexTokenAddress, longTokenAddress, shortTokenAddress] = key.split("-");
|
|
159
|
-
const indexToken = (0, tokens_1.getTokenData)(tokensData, indexTokenAddress);
|
|
160
|
-
const longToken = (0, tokens_1.getTokenData)(tokensData, longTokenAddress);
|
|
161
|
-
const shortToken = (0, tokens_1.getTokenData)(tokensData, shortTokenAddress);
|
|
162
|
-
const isSpotOnly = indexTokenAddress === "SPOT";
|
|
163
|
-
acc[key] = {
|
|
164
|
-
isDisabled: false,
|
|
165
|
-
marketTokenAddress: key,
|
|
166
|
-
indexTokenAddress,
|
|
167
|
-
longTokenAddress,
|
|
168
|
-
shortTokenAddress,
|
|
169
|
-
isSameCollaterals: longTokenAddress === shortTokenAddress,
|
|
170
|
-
isSpotOnly,
|
|
171
|
-
name: (0, markets_1.getMarketFullName)({ longToken, shortToken, indexToken, isSpotOnly }),
|
|
172
|
-
longToken,
|
|
173
|
-
shortToken,
|
|
174
|
-
indexToken,
|
|
175
|
-
longPoolAmount: usdToToken(1000, longToken),
|
|
176
|
-
shortPoolAmount: usdToToken(1000, shortToken),
|
|
177
|
-
maxLongPoolAmount: usdToToken(10000, longToken),
|
|
178
|
-
maxShortPoolAmount: usdToToken(10000, shortToken),
|
|
179
|
-
maxLongPoolUsdForDeposit: usdToToken(10000, longToken),
|
|
180
|
-
maxShortPoolUsdForDeposit: usdToToken(10000, shortToken),
|
|
181
|
-
poolValueMax: (0, numbers_1.expandDecimals)(2000, factors_1.USD_DECIMALS),
|
|
182
|
-
poolValueMin: (0, numbers_1.expandDecimals)(2000, factors_1.USD_DECIMALS),
|
|
183
|
-
reserveFactorLong: (0, numbers_1.expandDecimals)(5, 29),
|
|
184
|
-
reserveFactorShort: (0, numbers_1.expandDecimals)(5, 29),
|
|
185
|
-
openInterestReserveFactorLong: (0, numbers_1.expandDecimals)(5, 29),
|
|
186
|
-
openInterestReserveFactorShort: (0, numbers_1.expandDecimals)(5, 29),
|
|
187
|
-
maxOpenInterestLong: (0, numbers_1.expandDecimals)(5, 29),
|
|
188
|
-
maxOpenInterestShort: (0, numbers_1.expandDecimals)(5, 29),
|
|
189
|
-
positionImpactPoolAmount: usdToToken(1000, indexToken),
|
|
190
|
-
positionImpactPoolDistributionRate: 0n,
|
|
191
|
-
minPositionImpactPoolAmount: 0n,
|
|
192
|
-
swapImpactPoolAmountLong: usdToToken(1000, longToken),
|
|
193
|
-
swapImpactPoolAmountShort: usdToToken(1000, shortToken),
|
|
194
|
-
positionFeeFactorForBalanceWasImproved: (0, numbers_1.expandDecimals)(5, 26),
|
|
195
|
-
positionFeeFactorForBalanceWasNotImproved: (0, numbers_1.expandDecimals)(5, 26),
|
|
196
|
-
positionImpactFactorPositive: (0, numbers_1.expandDecimals)(2, 23),
|
|
197
|
-
positionImpactFactorNegative: (0, numbers_1.expandDecimals)(1, 23),
|
|
198
|
-
maxPositionImpactFactorPositive: (0, numbers_1.expandDecimals)(2, 23),
|
|
199
|
-
maxPositionImpactFactorNegative: (0, numbers_1.expandDecimals)(1, 23),
|
|
200
|
-
maxPositionImpactFactorForLiquidations: (0, numbers_1.expandDecimals)(1, 23),
|
|
201
|
-
maxLendableImpactFactor: (0, numbers_1.expandDecimals)(1, 23),
|
|
202
|
-
maxLendableImpactFactorForWithdrawals: (0, numbers_1.expandDecimals)(1, 23),
|
|
203
|
-
maxLendableImpactUsd: (0, numbers_1.expandDecimals)(1, 23),
|
|
204
|
-
lentPositionImpactPoolAmount: (0, numbers_1.expandDecimals)(1, 23),
|
|
205
|
-
positionImpactExponentFactorPositive: (0, numbers_1.expandDecimals)(2, 30),
|
|
206
|
-
positionImpactExponentFactorNegative: (0, numbers_1.expandDecimals)(2, 30),
|
|
207
|
-
useOpenInterestInTokensForBalance: true,
|
|
208
|
-
swapFeeFactorForBalanceWasImproved: (0, numbers_1.expandDecimals)(2, 27),
|
|
209
|
-
swapFeeFactorForBalanceWasNotImproved: (0, numbers_1.expandDecimals)(2, 27),
|
|
210
|
-
atomicSwapFeeFactor: (0, numbers_1.expandDecimals)(2, 27),
|
|
211
|
-
swapImpactFactorPositive: (0, numbers_1.expandDecimals)(2, 23),
|
|
212
|
-
swapImpactFactorNegative: (0, numbers_1.expandDecimals)(1, 23),
|
|
213
|
-
swapImpactExponentFactor: (0, numbers_1.expandDecimals)(2, 30),
|
|
214
|
-
withdrawalFeeFactorBalanceWasImproved: (0, numbers_1.expandDecimals)(2, 27),
|
|
215
|
-
withdrawalFeeFactorBalanceWasNotImproved: (0, numbers_1.expandDecimals)(2, 27),
|
|
216
|
-
// MarketInfo
|
|
217
|
-
borrowingFactorPerSecondForLongs: 0n,
|
|
218
|
-
borrowingFactorPerSecondForShorts: 0n,
|
|
219
|
-
borrowingExponentFactorLong: 0n,
|
|
220
|
-
borrowingExponentFactorShort: 0n,
|
|
221
|
-
fundingFactor: 0n,
|
|
222
|
-
fundingExponentFactor: 0n,
|
|
223
|
-
fundingIncreaseFactorPerSecond: 0n,
|
|
224
|
-
fundingDecreaseFactorPerSecond: 0n,
|
|
225
|
-
maxFundingFactorPerSecond: 0n,
|
|
226
|
-
minFundingFactorPerSecond: 0n,
|
|
227
|
-
thresholdForDecreaseFunding: 0n,
|
|
228
|
-
thresholdForStableFunding: 0n,
|
|
229
|
-
totalBorrowingFees: 0n,
|
|
230
|
-
minCollateralFactor: 0n,
|
|
231
|
-
minCollateralFactorForLiquidation: 0n,
|
|
232
|
-
minCollateralFactorForOpenInterestLong: 0n,
|
|
233
|
-
minCollateralFactorForOpenInterestShort: 0n,
|
|
234
|
-
borrowingFactorLong: 0n,
|
|
235
|
-
borrowingFactorShort: 0n,
|
|
236
|
-
fundingFactorPerSecond: 0n,
|
|
237
|
-
longsPayShorts: false,
|
|
238
|
-
longInterestUsd: (0, numbers_1.expandDecimals)(500, factors_1.USD_DECIMALS),
|
|
239
|
-
shortInterestUsd: (0, numbers_1.expandDecimals)(500, factors_1.USD_DECIMALS),
|
|
240
|
-
longInterestInTokens: usdToToken(500, indexToken),
|
|
241
|
-
shortInterestInTokens: usdToToken(500, indexToken),
|
|
242
|
-
maxPnlFactorForTradersLong: (0, numbers_1.expandDecimals)(1, 30),
|
|
243
|
-
maxPnlFactorForTradersShort: (0, numbers_1.expandDecimals)(1, 30),
|
|
244
|
-
data: "",
|
|
245
|
-
virtualPoolAmountForLongToken: 0n,
|
|
246
|
-
virtualPoolAmountForShortToken: 0n,
|
|
247
|
-
virtualInventoryForPositions: 0n,
|
|
248
|
-
virtualMarketId: viem_1.zeroAddress,
|
|
249
|
-
virtualLongTokenId: viem_1.zeroAddress,
|
|
250
|
-
virtualShortTokenId: viem_1.zeroAddress,
|
|
251
|
-
...(overrides[key] || {}),
|
|
252
|
-
};
|
|
253
|
-
return acc;
|
|
254
|
-
}, {});
|
|
255
|
-
}
|
|
256
|
-
exports.mockMarketsInfoData = mockMarketsInfoData;
|
|
137
|
+
var mockMarkets_1 = require("../utils/markets/__tests__/mockMarkets");
|
|
138
|
+
Object.defineProperty(exports, "mockMarketsData", { enumerable: true, get: function () { return mockMarkets_1.mockMarketsData; } });
|
|
139
|
+
Object.defineProperty(exports, "mockMarketsInfoData", { enumerable: true, get: function () { return mockMarkets_1.mockMarketsInfoData; } });
|
|
257
140
|
function mockExternalSwap({ inToken, outToken, amountIn, amountOut, priceIn, priceOut, feesUsd = (0, numbers_1.expandDecimals)(5, factors_1.USD_DECIMALS), // $5 default fee
|
|
258
141
|
data = "0x1", to = "0x6352a56caadC4F1E25CD6c75970Fa768A3304e64", receiver = "0x1234567890123456789012345678901234567890", }) {
|
|
259
142
|
const usdIn = (amountIn * priceIn) / (0, numbers_1.expandDecimals)(1, inToken.decimals);
|
|
260
143
|
const usdOut = (amountOut * priceOut) / (0, numbers_1.expandDecimals)(1, outToken.decimals);
|
|
261
144
|
return {
|
|
262
|
-
aggregator:
|
|
145
|
+
aggregator: types_1.ExternalSwapAggregator.OpenOcean,
|
|
263
146
|
inTokenAddress: inToken.address,
|
|
264
147
|
outTokenAddress: outToken.address,
|
|
265
148
|
receiver,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./utils"), exports);
|
|
@@ -11,7 +11,7 @@ function toFactor(percent) {
|
|
|
11
11
|
const value = parseFloat(percent.replace("%", ""));
|
|
12
12
|
return (0, numbers_1.numberToBigint)(value, 30 - 2);
|
|
13
13
|
}
|
|
14
|
-
const second =
|
|
14
|
+
const second = 1n;
|
|
15
15
|
(0, vitest_1.describe)("getFundingFactorPerPeriod", () => {
|
|
16
16
|
(0, vitest_1.it)("works when short pay, shorts OI bigger", () => {
|
|
17
17
|
const marketInfo = {
|
|
@@ -4,8 +4,8 @@ const viem_1 = require("viem");
|
|
|
4
4
|
const vitest_1 = require("vitest");
|
|
5
5
|
const chains_1 = require("../../../configs/chains");
|
|
6
6
|
const tokens_1 = require("../../../configs/tokens");
|
|
7
|
-
const orders_1 = require("../../../types/orders");
|
|
8
7
|
const numbers_1 = require("../../numbers");
|
|
8
|
+
const types_1 = require("../../orders/types");
|
|
9
9
|
const orderTransactions_1 = require("../../orderTransactions");
|
|
10
10
|
const mock_1 = require("../../../test/mock");
|
|
11
11
|
// Common tokens and addresses
|
|
@@ -37,7 +37,7 @@ const commonMarketIncreaseParams = {
|
|
|
37
37
|
allowedSlippage: 100,
|
|
38
38
|
executionFeeAmount: (0, numbers_1.parseValue)("0.1", WETH.decimals),
|
|
39
39
|
validFromTime: 0n,
|
|
40
|
-
orderType:
|
|
40
|
+
orderType: types_1.OrderType.MarketIncrease,
|
|
41
41
|
uiFeeReceiver: viem_1.zeroAddress,
|
|
42
42
|
};
|
|
43
43
|
// Helper to build a batch with multiple increase orders
|
|
@@ -6,8 +6,8 @@ const chains_1 = require("../../../configs/chains");
|
|
|
6
6
|
const contracts_1 = require("../../../configs/contracts");
|
|
7
7
|
const markets_1 = require("../../../configs/markets");
|
|
8
8
|
const tokens_1 = require("../../../configs/tokens");
|
|
9
|
-
const orders_1 = require("../../../types/orders");
|
|
10
9
|
const numbers_1 = require("../../numbers");
|
|
10
|
+
const types_1 = require("../../orders/types");
|
|
11
11
|
const orderTransactions_1 = require("../../orderTransactions");
|
|
12
12
|
const uiFeeReceiver_1 = require("../../twap/uiFeeReceiver");
|
|
13
13
|
const mock_1 = require("../../../test/mock");
|
|
@@ -43,7 +43,7 @@ const mock_1 = require("../../../test/mock");
|
|
|
43
43
|
collateralTokenAddress: WETH.address,
|
|
44
44
|
collateralDeltaAmount: (0, numbers_1.parseValue)("1", WETH.decimals), // 1 ETH
|
|
45
45
|
swapPath: [ETH_MARKET.marketTokenAddress],
|
|
46
|
-
orderType:
|
|
46
|
+
orderType: types_1.OrderType.MarketDecrease,
|
|
47
47
|
allowedSlippage: SLIPPAGE,
|
|
48
48
|
acceptablePrice: (0, numbers_1.parseValue)("1200", numbers_1.USD_DECIMALS), // $1200 base price
|
|
49
49
|
triggerPrice: 0n,
|
|
@@ -55,7 +55,7 @@ const mock_1 = require("../../../test/mock");
|
|
|
55
55
|
const params = {
|
|
56
56
|
...commonParams,
|
|
57
57
|
isLong: true,
|
|
58
|
-
decreasePositionSwapType:
|
|
58
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.SwapPnlTokenToCollateralToken,
|
|
59
59
|
receiveTokenAddress: tokens_1.NATIVE_TOKEN_ADDRESS,
|
|
60
60
|
};
|
|
61
61
|
const result = (0, orderTransactions_1.buildDecreaseOrderPayload)(params);
|
|
@@ -80,8 +80,8 @@ const mock_1 = require("../../../test/mock");
|
|
|
80
80
|
minOutputAmount: 0n,
|
|
81
81
|
validFromTime: 0n,
|
|
82
82
|
},
|
|
83
|
-
orderType:
|
|
84
|
-
decreasePositionSwapType:
|
|
83
|
+
orderType: types_1.OrderType.MarketDecrease,
|
|
84
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.SwapPnlTokenToCollateralToken,
|
|
85
85
|
isLong: true,
|
|
86
86
|
shouldUnwrapNativeToken: true,
|
|
87
87
|
autoCancel: false,
|
|
@@ -114,7 +114,7 @@ const mock_1 = require("../../../test/mock");
|
|
|
114
114
|
const params = {
|
|
115
115
|
...commonParams,
|
|
116
116
|
isLong: false,
|
|
117
|
-
decreasePositionSwapType:
|
|
117
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.SwapPnlTokenToCollateralToken,
|
|
118
118
|
receiveTokenAddress: tokens_1.NATIVE_TOKEN_ADDRESS,
|
|
119
119
|
};
|
|
120
120
|
const result = (0, orderTransactions_1.buildDecreaseOrderPayload)(params);
|
|
@@ -139,8 +139,8 @@ const mock_1 = require("../../../test/mock");
|
|
|
139
139
|
minOutputAmount: 0n,
|
|
140
140
|
validFromTime: 0n,
|
|
141
141
|
},
|
|
142
|
-
orderType:
|
|
143
|
-
decreasePositionSwapType:
|
|
142
|
+
orderType: types_1.OrderType.MarketDecrease,
|
|
143
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.SwapPnlTokenToCollateralToken,
|
|
144
144
|
isLong: false,
|
|
145
145
|
shouldUnwrapNativeToken: true,
|
|
146
146
|
autoCancel: false,
|
|
@@ -172,7 +172,7 @@ const mock_1 = require("../../../test/mock");
|
|
|
172
172
|
(0, vitest_1.it)("Market Decrease with ERC20 Receive", () => {
|
|
173
173
|
const params = {
|
|
174
174
|
...commonParams,
|
|
175
|
-
decreasePositionSwapType:
|
|
175
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.SwapPnlTokenToCollateralToken,
|
|
176
176
|
receiveTokenAddress: USDC.address,
|
|
177
177
|
};
|
|
178
178
|
const result = (0, orderTransactions_1.buildDecreaseOrderPayload)(params);
|
|
@@ -197,8 +197,8 @@ const mock_1 = require("../../../test/mock");
|
|
|
197
197
|
minOutputAmount: 0n,
|
|
198
198
|
validFromTime: 0n,
|
|
199
199
|
},
|
|
200
|
-
orderType:
|
|
201
|
-
decreasePositionSwapType:
|
|
200
|
+
orderType: types_1.OrderType.MarketDecrease,
|
|
201
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.SwapPnlTokenToCollateralToken,
|
|
202
202
|
isLong: true,
|
|
203
203
|
shouldUnwrapNativeToken: false,
|
|
204
204
|
autoCancel: false,
|
|
@@ -230,9 +230,9 @@ const mock_1 = require("../../../test/mock");
|
|
|
230
230
|
(0, vitest_1.it)("TP/SL Long", () => {
|
|
231
231
|
const params = {
|
|
232
232
|
...commonParams,
|
|
233
|
-
orderType:
|
|
233
|
+
orderType: types_1.OrderType.LimitDecrease,
|
|
234
234
|
triggerPrice: (0, numbers_1.parseValue)("1200", numbers_1.USD_DECIMALS),
|
|
235
|
-
decreasePositionSwapType:
|
|
235
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.SwapPnlTokenToCollateralToken,
|
|
236
236
|
receiveTokenAddress: tokens_1.NATIVE_TOKEN_ADDRESS,
|
|
237
237
|
};
|
|
238
238
|
const result = (0, orderTransactions_1.buildDecreaseOrderPayload)(params);
|
|
@@ -257,8 +257,8 @@ const mock_1 = require("../../../test/mock");
|
|
|
257
257
|
minOutputAmount: 0n,
|
|
258
258
|
validFromTime: 0n,
|
|
259
259
|
},
|
|
260
|
-
orderType:
|
|
261
|
-
decreasePositionSwapType:
|
|
260
|
+
orderType: types_1.OrderType.LimitDecrease,
|
|
261
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.SwapPnlTokenToCollateralToken,
|
|
262
262
|
isLong: true,
|
|
263
263
|
shouldUnwrapNativeToken: true,
|
|
264
264
|
autoCancel: false,
|
|
@@ -291,9 +291,9 @@ const mock_1 = require("../../../test/mock");
|
|
|
291
291
|
const params = {
|
|
292
292
|
...commonParams,
|
|
293
293
|
isLong: false,
|
|
294
|
-
orderType:
|
|
294
|
+
orderType: types_1.OrderType.LimitDecrease,
|
|
295
295
|
triggerPrice: (0, numbers_1.parseValue)("1200", numbers_1.USD_DECIMALS),
|
|
296
|
-
decreasePositionSwapType:
|
|
296
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.SwapPnlTokenToCollateralToken,
|
|
297
297
|
receiveTokenAddress: tokens_1.NATIVE_TOKEN_ADDRESS,
|
|
298
298
|
autoCancel: true,
|
|
299
299
|
};
|
|
@@ -319,8 +319,8 @@ const mock_1 = require("../../../test/mock");
|
|
|
319
319
|
minOutputAmount: 0n,
|
|
320
320
|
validFromTime: 0n,
|
|
321
321
|
},
|
|
322
|
-
orderType:
|
|
323
|
-
decreasePositionSwapType:
|
|
322
|
+
orderType: types_1.OrderType.LimitDecrease,
|
|
323
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.SwapPnlTokenToCollateralToken,
|
|
324
324
|
isLong: false,
|
|
325
325
|
shouldUnwrapNativeToken: true,
|
|
326
326
|
autoCancel: true,
|
|
@@ -352,8 +352,8 @@ const mock_1 = require("../../../test/mock");
|
|
|
352
352
|
(0, vitest_1.it)("TWAP Decrease Long", () => {
|
|
353
353
|
const params = {
|
|
354
354
|
...commonParams,
|
|
355
|
-
orderType:
|
|
356
|
-
decreasePositionSwapType:
|
|
355
|
+
orderType: types_1.OrderType.MarketDecrease,
|
|
356
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.SwapPnlTokenToCollateralToken,
|
|
357
357
|
receiveTokenAddress: tokens_1.NATIVE_TOKEN_ADDRESS,
|
|
358
358
|
};
|
|
359
359
|
const twapParams = {
|
|
@@ -398,8 +398,8 @@ const mock_1 = require("../../../test/mock");
|
|
|
398
398
|
minOutputAmount: 0n,
|
|
399
399
|
validFromTime,
|
|
400
400
|
},
|
|
401
|
-
orderType:
|
|
402
|
-
decreasePositionSwapType:
|
|
401
|
+
orderType: types_1.OrderType.LimitDecrease,
|
|
402
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.SwapPnlTokenToCollateralToken,
|
|
403
403
|
isLong: true,
|
|
404
404
|
shouldUnwrapNativeToken: true,
|
|
405
405
|
autoCancel: false,
|
|
@@ -414,7 +414,7 @@ const mock_1 = require("../../../test/mock");
|
|
|
414
414
|
executionFeeAmount: params.executionFeeAmount / 4n,
|
|
415
415
|
sizeDeltaUsd: params.sizeDeltaUsd / 4n,
|
|
416
416
|
sizeDeltaInTokens: params.sizeDeltaInTokens / 4n,
|
|
417
|
-
orderType:
|
|
417
|
+
orderType: types_1.OrderType.LimitDecrease,
|
|
418
418
|
allowedSlippage: 0,
|
|
419
419
|
uiFeeReceiver,
|
|
420
420
|
validFromTime,
|
|
@@ -448,8 +448,8 @@ const mock_1 = require("../../../test/mock");
|
|
|
448
448
|
const params = {
|
|
449
449
|
...commonParams,
|
|
450
450
|
isLong: false,
|
|
451
|
-
orderType:
|
|
452
|
-
decreasePositionSwapType:
|
|
451
|
+
orderType: types_1.OrderType.MarketDecrease,
|
|
452
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.SwapPnlTokenToCollateralToken,
|
|
453
453
|
receiveTokenAddress: tokens_1.NATIVE_TOKEN_ADDRESS,
|
|
454
454
|
};
|
|
455
455
|
const twapParams = {
|
|
@@ -494,8 +494,8 @@ const mock_1 = require("../../../test/mock");
|
|
|
494
494
|
minOutputAmount: 0n,
|
|
495
495
|
validFromTime,
|
|
496
496
|
},
|
|
497
|
-
orderType:
|
|
498
|
-
decreasePositionSwapType:
|
|
497
|
+
orderType: types_1.OrderType.LimitDecrease,
|
|
498
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.SwapPnlTokenToCollateralToken,
|
|
499
499
|
isLong: false,
|
|
500
500
|
shouldUnwrapNativeToken: true,
|
|
501
501
|
autoCancel: false,
|
|
@@ -510,7 +510,7 @@ const mock_1 = require("../../../test/mock");
|
|
|
510
510
|
executionFeeAmount: params.executionFeeAmount / 4n,
|
|
511
511
|
sizeDeltaUsd: params.sizeDeltaUsd / 4n,
|
|
512
512
|
sizeDeltaInTokens: params.sizeDeltaInTokens / 4n,
|
|
513
|
-
orderType:
|
|
513
|
+
orderType: types_1.OrderType.LimitDecrease,
|
|
514
514
|
allowedSlippage: 0,
|
|
515
515
|
uiFeeReceiver,
|
|
516
516
|
validFromTime,
|
|
@@ -542,8 +542,8 @@ const mock_1 = require("../../../test/mock");
|
|
|
542
542
|
(0, vitest_1.it)("Market Decrease with Undefined Optional Parameters", () => {
|
|
543
543
|
const params = {
|
|
544
544
|
...commonParams,
|
|
545
|
-
orderType:
|
|
546
|
-
decreasePositionSwapType:
|
|
545
|
+
orderType: types_1.OrderType.MarketDecrease,
|
|
546
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.SwapPnlTokenToCollateralToken,
|
|
547
547
|
receiveTokenAddress: tokens_1.NATIVE_TOKEN_ADDRESS,
|
|
548
548
|
uiFeeReceiver: undefined,
|
|
549
549
|
referralCode: undefined,
|
|
@@ -571,8 +571,8 @@ const mock_1 = require("../../../test/mock");
|
|
|
571
571
|
minOutputAmount: 0n,
|
|
572
572
|
validFromTime: 0n,
|
|
573
573
|
},
|
|
574
|
-
orderType:
|
|
575
|
-
decreasePositionSwapType:
|
|
574
|
+
orderType: types_1.OrderType.MarketDecrease,
|
|
575
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.SwapPnlTokenToCollateralToken,
|
|
576
576
|
isLong: true,
|
|
577
577
|
shouldUnwrapNativeToken: true,
|
|
578
578
|
autoCancel: false,
|
|
@@ -5,8 +5,8 @@ const chains_1 = require("../../../configs/chains");
|
|
|
5
5
|
const contracts_1 = require("../../../configs/contracts");
|
|
6
6
|
const markets_1 = require("../../../configs/markets");
|
|
7
7
|
const tokens_1 = require("../../../configs/tokens");
|
|
8
|
-
const orders_1 = require("../../../types/orders");
|
|
9
8
|
const numbers_1 = require("../../numbers");
|
|
9
|
+
const types_1 = require("../../orders/types");
|
|
10
10
|
const orderTransactions_1 = require("../../orderTransactions");
|
|
11
11
|
const mock_1 = require("../../../test/mock");
|
|
12
12
|
(0, vitest_1.beforeAll)(() => {
|
|
@@ -42,7 +42,7 @@ const mock_1 = require("../../../test/mock");
|
|
|
42
42
|
collateralTokenAddress: WETH.address,
|
|
43
43
|
collateralDeltaAmount: (0, numbers_1.parseValue)("1", WETH.decimals), // 1 ETH
|
|
44
44
|
swapPath: [ETH_MARKET.marketTokenAddress],
|
|
45
|
-
orderType:
|
|
45
|
+
orderType: types_1.OrderType.MarketIncrease,
|
|
46
46
|
allowedSlippage: SLIPPAGE,
|
|
47
47
|
acceptablePrice: (0, numbers_1.parseValue)("1200", numbers_1.USD_DECIMALS), // $1200 base price
|
|
48
48
|
triggerPrice: 0n,
|
|
@@ -123,7 +123,7 @@ const mock_1 = require("../../../test/mock");
|
|
|
123
123
|
const updateParams = {
|
|
124
124
|
chainId: CHAIN_ID,
|
|
125
125
|
orderKey: ORDER_KEY,
|
|
126
|
-
orderType:
|
|
126
|
+
orderType: types_1.OrderType.LimitIncrease,
|
|
127
127
|
sizeDeltaUsd: (0, numbers_1.parseValue)("1000", numbers_1.USD_DECIMALS),
|
|
128
128
|
triggerPrice: (0, numbers_1.parseValue)("1200", numbers_1.USD_DECIMALS),
|
|
129
129
|
acceptablePrice: (0, numbers_1.parseValue)("1194", numbers_1.USD_DECIMALS),
|
|
@@ -201,7 +201,7 @@ const mock_1 = require("../../../test/mock");
|
|
|
201
201
|
const updateParams = {
|
|
202
202
|
chainId: CHAIN_ID,
|
|
203
203
|
orderKey: ORDER_KEY,
|
|
204
|
-
orderType:
|
|
204
|
+
orderType: types_1.OrderType.LimitIncrease,
|
|
205
205
|
sizeDeltaUsd: (0, numbers_1.parseValue)("1000", numbers_1.USD_DECIMALS),
|
|
206
206
|
triggerPrice: (0, numbers_1.parseValue)("1200", numbers_1.USD_DECIMALS),
|
|
207
207
|
acceptablePrice: (0, numbers_1.parseValue)("1194", numbers_1.USD_DECIMALS),
|
|
@@ -6,8 +6,8 @@ const chains_1 = require("../../../configs/chains");
|
|
|
6
6
|
const contracts_1 = require("../../../configs/contracts");
|
|
7
7
|
const markets_1 = require("../../../configs/markets");
|
|
8
8
|
const tokens_1 = require("../../../configs/tokens");
|
|
9
|
-
const orders_1 = require("../../../types/orders");
|
|
10
9
|
const numbers_1 = require("../../numbers");
|
|
10
|
+
const types_1 = require("../../orders/types");
|
|
11
11
|
const orderTransactions_1 = require("../../orderTransactions");
|
|
12
12
|
const uiFeeReceiver_1 = require("../../twap/uiFeeReceiver");
|
|
13
13
|
const mock_1 = require("../../../test/mock");
|
|
@@ -44,7 +44,7 @@ const mock_1 = require("../../../test/mock");
|
|
|
44
44
|
collateralTokenAddress: WETH.address,
|
|
45
45
|
collateralDeltaAmount: (0, numbers_1.parseValue)("1", WETH.decimals), // 1 ETH
|
|
46
46
|
swapPath: [ETH_MARKET.marketTokenAddress],
|
|
47
|
-
orderType:
|
|
47
|
+
orderType: types_1.OrderType.MarketIncrease,
|
|
48
48
|
allowedSlippage: SLIPPAGE,
|
|
49
49
|
acceptablePrice: (0, numbers_1.parseValue)("1200", numbers_1.USD_DECIMALS), // $1200 base price
|
|
50
50
|
triggerPrice: 0n,
|
|
@@ -80,8 +80,8 @@ const mock_1 = require("../../../test/mock");
|
|
|
80
80
|
minOutputAmount: 0n,
|
|
81
81
|
validFromTime: 0n,
|
|
82
82
|
},
|
|
83
|
-
orderType:
|
|
84
|
-
decreasePositionSwapType:
|
|
83
|
+
orderType: types_1.OrderType.MarketIncrease,
|
|
84
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.NoSwap,
|
|
85
85
|
isLong: true,
|
|
86
86
|
shouldUnwrapNativeToken: true,
|
|
87
87
|
autoCancel: false,
|
|
@@ -139,8 +139,8 @@ const mock_1 = require("../../../test/mock");
|
|
|
139
139
|
minOutputAmount: 0n,
|
|
140
140
|
validFromTime: 0n,
|
|
141
141
|
},
|
|
142
|
-
orderType:
|
|
143
|
-
decreasePositionSwapType:
|
|
142
|
+
orderType: types_1.OrderType.MarketIncrease,
|
|
143
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.NoSwap,
|
|
144
144
|
isLong: false,
|
|
145
145
|
shouldUnwrapNativeToken: true,
|
|
146
146
|
autoCancel: false,
|
|
@@ -197,8 +197,8 @@ const mock_1 = require("../../../test/mock");
|
|
|
197
197
|
minOutputAmount: 0n,
|
|
198
198
|
validFromTime: 0n,
|
|
199
199
|
},
|
|
200
|
-
orderType:
|
|
201
|
-
decreasePositionSwapType:
|
|
200
|
+
orderType: types_1.OrderType.MarketIncrease,
|
|
201
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.NoSwap,
|
|
202
202
|
isLong: true,
|
|
203
203
|
shouldUnwrapNativeToken: false,
|
|
204
204
|
autoCancel: false,
|
|
@@ -262,8 +262,8 @@ const mock_1 = require("../../../test/mock");
|
|
|
262
262
|
minOutputAmount: 0n,
|
|
263
263
|
validFromTime: 0n,
|
|
264
264
|
},
|
|
265
|
-
orderType:
|
|
266
|
-
decreasePositionSwapType:
|
|
265
|
+
orderType: types_1.OrderType.MarketIncrease,
|
|
266
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.NoSwap,
|
|
267
267
|
isLong: true,
|
|
268
268
|
shouldUnwrapNativeToken: false,
|
|
269
269
|
autoCancel: false,
|
|
@@ -336,8 +336,8 @@ const mock_1 = require("../../../test/mock");
|
|
|
336
336
|
minOutputAmount: 0n,
|
|
337
337
|
validFromTime: 0n,
|
|
338
338
|
},
|
|
339
|
-
orderType:
|
|
340
|
-
decreasePositionSwapType:
|
|
339
|
+
orderType: types_1.OrderType.MarketIncrease,
|
|
340
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.NoSwap,
|
|
341
341
|
isLong: true,
|
|
342
342
|
shouldUnwrapNativeToken: true,
|
|
343
343
|
autoCancel: false,
|
|
@@ -417,8 +417,8 @@ const mock_1 = require("../../../test/mock");
|
|
|
417
417
|
minOutputAmount: 0n,
|
|
418
418
|
validFromTime: 0n,
|
|
419
419
|
},
|
|
420
|
-
orderType:
|
|
421
|
-
decreasePositionSwapType:
|
|
420
|
+
orderType: types_1.OrderType.MarketIncrease,
|
|
421
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.NoSwap,
|
|
422
422
|
isLong: true,
|
|
423
423
|
shouldUnwrapNativeToken: false,
|
|
424
424
|
autoCancel: false,
|
|
@@ -464,7 +464,7 @@ const mock_1 = require("../../../test/mock");
|
|
|
464
464
|
...commonParams,
|
|
465
465
|
payTokenAddress: tokens_1.NATIVE_TOKEN_ADDRESS,
|
|
466
466
|
payTokenAmount: (0, numbers_1.parseValue)("1", WETH.decimals), // 1 ETH
|
|
467
|
-
orderType:
|
|
467
|
+
orderType: types_1.OrderType.LimitIncrease,
|
|
468
468
|
triggerPrice: (0, numbers_1.parseValue)("1200", numbers_1.USD_DECIMALS), // $1200
|
|
469
469
|
};
|
|
470
470
|
const result = (0, orderTransactions_1.buildIncreaseOrderPayload)(params);
|
|
@@ -489,8 +489,8 @@ const mock_1 = require("../../../test/mock");
|
|
|
489
489
|
minOutputAmount: 0n,
|
|
490
490
|
validFromTime: 0n,
|
|
491
491
|
},
|
|
492
|
-
orderType:
|
|
493
|
-
decreasePositionSwapType:
|
|
492
|
+
orderType: types_1.OrderType.LimitIncrease,
|
|
493
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.NoSwap,
|
|
494
494
|
isLong: true,
|
|
495
495
|
shouldUnwrapNativeToken: true,
|
|
496
496
|
autoCancel: false,
|
|
@@ -524,7 +524,7 @@ const mock_1 = require("../../../test/mock");
|
|
|
524
524
|
...commonParams,
|
|
525
525
|
payTokenAddress: tokens_1.NATIVE_TOKEN_ADDRESS,
|
|
526
526
|
payTokenAmount: (0, numbers_1.parseValue)("1", WETH.decimals), // 1 ETH
|
|
527
|
-
orderType:
|
|
527
|
+
orderType: types_1.OrderType.MarketIncrease,
|
|
528
528
|
};
|
|
529
529
|
const twapParams = {
|
|
530
530
|
duration: {
|
|
@@ -568,8 +568,8 @@ const mock_1 = require("../../../test/mock");
|
|
|
568
568
|
minOutputAmount: 0n,
|
|
569
569
|
validFromTime,
|
|
570
570
|
},
|
|
571
|
-
orderType:
|
|
572
|
-
decreasePositionSwapType:
|
|
571
|
+
orderType: types_1.OrderType.LimitIncrease,
|
|
572
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.NoSwap,
|
|
573
573
|
isLong: true,
|
|
574
574
|
shouldUnwrapNativeToken: true,
|
|
575
575
|
autoCancel: false,
|
|
@@ -585,7 +585,7 @@ const mock_1 = require("../../../test/mock");
|
|
|
585
585
|
executionFeeAmount: params.executionFeeAmount / 4n,
|
|
586
586
|
sizeDeltaUsd: params.sizeDeltaUsd / 4n,
|
|
587
587
|
sizeDeltaInTokens: params.sizeDeltaInTokens / 4n,
|
|
588
|
-
orderType:
|
|
588
|
+
orderType: types_1.OrderType.LimitIncrease,
|
|
589
589
|
allowedSlippage: 0,
|
|
590
590
|
uiFeeReceiver,
|
|
591
591
|
validFromTime,
|
|
@@ -619,7 +619,7 @@ const mock_1 = require("../../../test/mock");
|
|
|
619
619
|
...commonParams,
|
|
620
620
|
payTokenAddress: tokens_1.NATIVE_TOKEN_ADDRESS,
|
|
621
621
|
payTokenAmount: (0, numbers_1.parseValue)("1", WETH.decimals), // 1 ETH
|
|
622
|
-
orderType:
|
|
622
|
+
orderType: types_1.OrderType.MarketIncrease,
|
|
623
623
|
isLong: false,
|
|
624
624
|
};
|
|
625
625
|
const twapParams = {
|
|
@@ -664,8 +664,8 @@ const mock_1 = require("../../../test/mock");
|
|
|
664
664
|
minOutputAmount: 0n,
|
|
665
665
|
validFromTime,
|
|
666
666
|
},
|
|
667
|
-
orderType:
|
|
668
|
-
decreasePositionSwapType:
|
|
667
|
+
orderType: types_1.OrderType.LimitIncrease,
|
|
668
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.NoSwap,
|
|
669
669
|
isLong: false,
|
|
670
670
|
shouldUnwrapNativeToken: true,
|
|
671
671
|
autoCancel: false,
|
|
@@ -681,7 +681,7 @@ const mock_1 = require("../../../test/mock");
|
|
|
681
681
|
executionFeeAmount: params.executionFeeAmount / 4n,
|
|
682
682
|
sizeDeltaUsd: params.sizeDeltaUsd / 4n,
|
|
683
683
|
sizeDeltaInTokens: params.sizeDeltaInTokens / 4n,
|
|
684
|
-
orderType:
|
|
684
|
+
orderType: types_1.OrderType.LimitIncrease,
|
|
685
685
|
allowedSlippage: 0,
|
|
686
686
|
uiFeeReceiver,
|
|
687
687
|
validFromTime,
|
|
@@ -715,7 +715,7 @@ const mock_1 = require("../../../test/mock");
|
|
|
715
715
|
...commonParams,
|
|
716
716
|
payTokenAddress: tokens_1.NATIVE_TOKEN_ADDRESS,
|
|
717
717
|
payTokenAmount: (0, numbers_1.parseValue)("1", WETH.decimals), // 1 ETH
|
|
718
|
-
orderType:
|
|
718
|
+
orderType: types_1.OrderType.MarketIncrease,
|
|
719
719
|
uiFeeReceiver: undefined,
|
|
720
720
|
referralCode: undefined,
|
|
721
721
|
validFromTime: undefined,
|
|
@@ -742,8 +742,8 @@ const mock_1 = require("../../../test/mock");
|
|
|
742
742
|
minOutputAmount: 0n,
|
|
743
743
|
validFromTime: 0n,
|
|
744
744
|
},
|
|
745
|
-
orderType:
|
|
746
|
-
decreasePositionSwapType:
|
|
745
|
+
orderType: types_1.OrderType.MarketIncrease,
|
|
746
|
+
decreasePositionSwapType: types_1.DecreasePositionSwapType.NoSwap,
|
|
747
747
|
isLong: true,
|
|
748
748
|
shouldUnwrapNativeToken: true,
|
|
749
749
|
autoCancel: false,
|