@drift-labs/common 1.0.0
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/Config.d.ts +26 -0
- package/lib/Config.js +29 -0
- package/lib/Config.js.map +1 -0
- package/lib/EnvironmentConstants.d.ts +40 -0
- package/lib/EnvironmentConstants.js +64 -0
- package/lib/EnvironmentConstants.js.map +1 -0
- package/lib/actions/actionHelpers/accountDeletionHelpers.d.ts +16 -0
- package/lib/actions/actionHelpers/accountDeletionHelpers.js +151 -0
- package/lib/actions/actionHelpers/accountDeletionHelpers.js.map +1 -0
- package/lib/actions/actionHelpers/actionHelpers.d.ts +13 -0
- package/lib/actions/actionHelpers/actionHelpers.js +8 -0
- package/lib/actions/actionHelpers/actionHelpers.js.map +1 -0
- package/lib/chartConstants.d.ts +2 -0
- package/lib/chartConstants.js +14 -0
- package/lib/chartConstants.js.map +1 -0
- package/lib/clients/candleClient.d.ts +74 -0
- package/lib/clients/candleClient.js +364 -0
- package/lib/clients/candleClient.js.map +1 -0
- package/lib/clients/dataApiWsClient.d.ts +33 -0
- package/lib/clients/dataApiWsClient.js +118 -0
- package/lib/clients/dataApiWsClient.js.map +1 -0
- package/lib/clients/index.d.ts +1 -0
- package/lib/clients/index.js +19 -0
- package/lib/clients/index.js.map +1 -0
- package/lib/clients/marketDataFeed.d.ts +42 -0
- package/lib/clients/marketDataFeed.js +422 -0
- package/lib/clients/marketDataFeed.js.map +1 -0
- package/lib/clients/redisClient.d.ts +89 -0
- package/lib/clients/redisClient.js +647 -0
- package/lib/clients/redisClient.js.map +1 -0
- package/lib/clients/swiftClient.d.ts +57 -0
- package/lib/clients/swiftClient.js +289 -0
- package/lib/clients/swiftClient.js.map +1 -0
- package/lib/clients/tvFeed.d.ts +63 -0
- package/lib/clients/tvFeed.js +351 -0
- package/lib/clients/tvFeed.js.map +1 -0
- package/lib/common-ui-utils/commonUiUtils.d.ts +211 -0
- package/lib/common-ui-utils/commonUiUtils.js +624 -0
- package/lib/common-ui-utils/commonUiUtils.js.map +1 -0
- package/lib/common-ui-utils/index.d.ts +6 -0
- package/lib/common-ui-utils/index.js +23 -0
- package/lib/common-ui-utils/index.js.map +1 -0
- package/lib/common-ui-utils/market.d.ts +27 -0
- package/lib/common-ui-utils/market.js +80 -0
- package/lib/common-ui-utils/market.js.map +1 -0
- package/lib/common-ui-utils/order.d.ts +11 -0
- package/lib/common-ui-utils/order.js +161 -0
- package/lib/common-ui-utils/order.js.map +1 -0
- package/lib/common-ui-utils/settings/settings.d.ts +51 -0
- package/lib/common-ui-utils/settings/settings.js +84 -0
- package/lib/common-ui-utils/settings/settings.js.map +1 -0
- package/lib/common-ui-utils/trading.d.ts +56 -0
- package/lib/common-ui-utils/trading.js +200 -0
- package/lib/common-ui-utils/trading.js.map +1 -0
- package/lib/common-ui-utils/user.d.ts +13 -0
- package/lib/common-ui-utils/user.js +124 -0
- package/lib/common-ui-utils/user.js.map +1 -0
- package/lib/constants/autogenerated/driftErrors.json +1787 -0
- package/lib/constants/autogenerated/jup-v4-error-codes.json +67 -0
- package/lib/constants/autogenerated/jup-v6-error-codes.json +115 -0
- package/lib/constants/dev.d.ts +15 -0
- package/lib/constants/dev.js +19 -0
- package/lib/constants/dev.js.map +1 -0
- package/lib/constants/geoblockList.d.ts +4 -0
- package/lib/constants/geoblockList.js +32 -0
- package/lib/constants/geoblockList.js.map +1 -0
- package/lib/constants/index.d.ts +9 -0
- package/lib/constants/index.js +26 -0
- package/lib/constants/index.js.map +1 -0
- package/lib/constants/markets.d.ts +1 -0
- package/lib/constants/markets.js +5 -0
- package/lib/constants/markets.js.map +1 -0
- package/lib/constants/misc.d.ts +23 -0
- package/lib/constants/misc.js +27 -0
- package/lib/constants/misc.js.map +1 -0
- package/lib/constants/orders.d.ts +12 -0
- package/lib/constants/orders.js +79 -0
- package/lib/constants/orders.js.map +1 -0
- package/lib/constants/pools.d.ts +5 -0
- package/lib/constants/pools.js +9 -0
- package/lib/constants/pools.js.map +1 -0
- package/lib/constants/predictionMarket.d.ts +3 -0
- package/lib/constants/predictionMarket.js +7 -0
- package/lib/constants/predictionMarket.js.map +1 -0
- package/lib/constants/superstake.d.ts +22 -0
- package/lib/constants/superstake.js +45 -0
- package/lib/constants/superstake.js.map +1 -0
- package/lib/constants/trade.d.ts +2 -0
- package/lib/constants/trade.js +9 -0
- package/lib/constants/trade.js.map +1 -0
- package/lib/drift/Drift/clients/AuthorityDrift/DriftL2OrderbookManager.d.ts +68 -0
- package/lib/drift/Drift/clients/AuthorityDrift/DriftL2OrderbookManager.js +146 -0
- package/lib/drift/Drift/clients/AuthorityDrift/DriftL2OrderbookManager.js.map +1 -0
- package/lib/drift/Drift/clients/AuthorityDrift/DriftOperations/index.d.ts +204 -0
- package/lib/drift/Drift/clients/AuthorityDrift/DriftOperations/index.js +530 -0
- package/lib/drift/Drift/clients/AuthorityDrift/DriftOperations/index.js.map +1 -0
- package/lib/drift/Drift/clients/AuthorityDrift/DriftOperations/types.d.ts +90 -0
- package/lib/drift/Drift/clients/AuthorityDrift/DriftOperations/types.js +3 -0
- package/lib/drift/Drift/clients/AuthorityDrift/DriftOperations/types.js.map +1 -0
- package/lib/drift/Drift/clients/AuthorityDrift/SubscriptionManager.d.ts +139 -0
- package/lib/drift/Drift/clients/AuthorityDrift/SubscriptionManager.js +287 -0
- package/lib/drift/Drift/clients/AuthorityDrift/SubscriptionManager.js.map +1 -0
- package/lib/drift/Drift/clients/AuthorityDrift/index.d.ts +242 -0
- package/lib/drift/Drift/clients/AuthorityDrift/index.js +503 -0
- package/lib/drift/Drift/clients/AuthorityDrift/index.js.map +1 -0
- package/lib/drift/Drift/clients/CentralServerDrift.d.ts +91 -0
- package/lib/drift/Drift/clients/CentralServerDrift.js +326 -0
- package/lib/drift/Drift/clients/CentralServerDrift.js.map +1 -0
- package/lib/drift/Drift/clients/index.d.ts +3 -0
- package/lib/drift/Drift/clients/index.js +20 -0
- package/lib/drift/Drift/clients/index.js.map +1 -0
- package/lib/drift/Drift/constants/blockchain.d.ts +24 -0
- package/lib/drift/Drift/constants/blockchain.js +32 -0
- package/lib/drift/Drift/constants/blockchain.js.map +1 -0
- package/lib/drift/Drift/constants/errors.d.ts +6 -0
- package/lib/drift/Drift/constants/errors.js +14 -0
- package/lib/drift/Drift/constants/errors.js.map +1 -0
- package/lib/drift/Drift/constants/index.d.ts +3 -0
- package/lib/drift/Drift/constants/index.js +20 -0
- package/lib/drift/Drift/constants/index.js.map +1 -0
- package/lib/drift/Drift/constants/orderbook.d.ts +7 -0
- package/lib/drift/Drift/constants/orderbook.js +10 -0
- package/lib/drift/Drift/constants/orderbook.js.map +1 -0
- package/lib/drift/Drift/data/PollingDlob.d.ts +154 -0
- package/lib/drift/Drift/data/PollingDlob.js +387 -0
- package/lib/drift/Drift/data/PollingDlob.js.map +1 -0
- package/lib/drift/Drift/data/index.d.ts +1 -0
- package/lib/drift/Drift/data/index.js +18 -0
- package/lib/drift/Drift/data/index.js.map +1 -0
- package/lib/drift/Drift/index.d.ts +4 -0
- package/lib/drift/Drift/index.js +21 -0
- package/lib/drift/Drift/index.js.map +1 -0
- package/lib/drift/Drift/stores/MarkPriceCache.d.ts +27 -0
- package/lib/drift/Drift/stores/MarkPriceCache.js +59 -0
- package/lib/drift/Drift/stores/MarkPriceCache.js.map +1 -0
- package/lib/drift/Drift/stores/OraclePriceCache.d.ts +21 -0
- package/lib/drift/Drift/stores/OraclePriceCache.js +57 -0
- package/lib/drift/Drift/stores/OraclePriceCache.js.map +1 -0
- package/lib/drift/Drift/stores/UserAccountCache.d.ts +49 -0
- package/lib/drift/Drift/stores/UserAccountCache.js +107 -0
- package/lib/drift/Drift/stores/UserAccountCache.js.map +1 -0
- package/lib/drift/Drift/stores/index.d.ts +3 -0
- package/lib/drift/Drift/stores/index.js +20 -0
- package/lib/drift/Drift/stores/index.js.map +1 -0
- package/lib/drift/base/actions/index.d.ts +4 -0
- package/lib/drift/base/actions/index.js +21 -0
- package/lib/drift/base/actions/index.js.map +1 -0
- package/lib/drift/base/actions/perp/index.d.ts +2 -0
- package/lib/drift/base/actions/perp/index.js +19 -0
- package/lib/drift/base/actions/perp/index.js.map +1 -0
- package/lib/drift/base/actions/perp/settleFunding.d.ts +25 -0
- package/lib/drift/base/actions/perp/settleFunding.js +41 -0
- package/lib/drift/base/actions/perp/settleFunding.js.map +1 -0
- package/lib/drift/base/actions/perp/settlePnl.d.ts +35 -0
- package/lib/drift/base/actions/perp/settlePnl.js +44 -0
- package/lib/drift/base/actions/perp/settlePnl.js.map +1 -0
- package/lib/drift/base/actions/spot/borrow.d.ts +1 -0
- package/lib/drift/base/actions/spot/borrow.js +8 -0
- package/lib/drift/base/actions/spot/borrow.js.map +1 -0
- package/lib/drift/base/actions/spot/deposit.d.ts +40 -0
- package/lib/drift/base/actions/spot/deposit.js +82 -0
- package/lib/drift/base/actions/spot/deposit.js.map +1 -0
- package/lib/drift/base/actions/spot/index.d.ts +3 -0
- package/lib/drift/base/actions/spot/index.js +20 -0
- package/lib/drift/base/actions/spot/index.js.map +1 -0
- package/lib/drift/base/actions/spot/withdraw.d.ts +16 -0
- package/lib/drift/base/actions/spot/withdraw.js +39 -0
- package/lib/drift/base/actions/spot/withdraw.js.map +1 -0
- package/lib/drift/base/actions/trade/cancelOrder.d.ts +47 -0
- package/lib/drift/base/actions/trade/cancelOrder.js +55 -0
- package/lib/drift/base/actions/trade/cancelOrder.js.map +1 -0
- package/lib/drift/base/actions/trade/editOrder.d.ts +55 -0
- package/lib/drift/base/actions/trade/editOrder.js +35 -0
- package/lib/drift/base/actions/trade/editOrder.js.map +1 -0
- package/lib/drift/base/actions/trade/index.d.ts +4 -0
- package/lib/drift/base/actions/trade/index.js +21 -0
- package/lib/drift/base/actions/trade/index.js.map +1 -0
- package/lib/drift/base/actions/trade/openPerpOrder/index.d.ts +3 -0
- package/lib/drift/base/actions/trade/openPerpOrder/index.js +20 -0
- package/lib/drift/base/actions/trade/openPerpOrder/index.js.map +1 -0
- package/lib/drift/base/actions/trade/openPerpOrder/openPerpMarketOrder/index.d.ts +84 -0
- package/lib/drift/base/actions/trade/openPerpOrder/openPerpMarketOrder/index.js +293 -0
- package/lib/drift/base/actions/trade/openPerpOrder/openPerpMarketOrder/index.js.map +1 -0
- package/lib/drift/base/actions/trade/openPerpOrder/openPerpNonMarketOrder/index.d.ts +19 -0
- package/lib/drift/base/actions/trade/openPerpOrder/openPerpNonMarketOrder/index.js +161 -0
- package/lib/drift/base/actions/trade/openPerpOrder/openPerpNonMarketOrder/index.js.map +1 -0
- package/lib/drift/base/actions/trade/openPerpOrder/openSwiftOrder/index.d.ts +166 -0
- package/lib/drift/base/actions/trade/openPerpOrder/openSwiftOrder/index.js +156 -0
- package/lib/drift/base/actions/trade/openPerpOrder/openSwiftOrder/index.js.map +1 -0
- package/lib/drift/base/actions/trade/swap.d.ts +62 -0
- package/lib/drift/base/actions/trade/swap.js +60 -0
- package/lib/drift/base/actions/trade/swap.js.map +1 -0
- package/lib/drift/base/actions/user/create.d.ts +75 -0
- package/lib/drift/base/actions/user/create.js +104 -0
- package/lib/drift/base/actions/user/create.js.map +1 -0
- package/lib/drift/base/actions/user/delete.d.ts +47 -0
- package/lib/drift/base/actions/user/delete.js +39 -0
- package/lib/drift/base/actions/user/delete.js.map +1 -0
- package/lib/drift/base/actions/user/index.d.ts +1 -0
- package/lib/drift/base/actions/user/index.js +18 -0
- package/lib/drift/base/actions/user/index.js.map +1 -0
- package/lib/drift/base/constants/accountNames.d.ts +1 -0
- package/lib/drift/base/constants/accountNames.js +13 -0
- package/lib/drift/base/constants/accountNames.js.map +1 -0
- package/lib/drift/base/details/index.d.ts +2 -0
- package/lib/drift/base/details/index.js +19 -0
- package/lib/drift/base/details/index.js.map +1 -0
- package/lib/drift/base/details/market/funding.d.ts +9 -0
- package/lib/drift/base/details/market/funding.js +50 -0
- package/lib/drift/base/details/market/funding.js.map +1 -0
- package/lib/drift/base/details/market/index.d.ts +2 -0
- package/lib/drift/base/details/market/index.js +19 -0
- package/lib/drift/base/details/market/index.js.map +1 -0
- package/lib/drift/base/details/market/openInterest.d.ts +5 -0
- package/lib/drift/base/details/market/openInterest.js +12 -0
- package/lib/drift/base/details/market/openInterest.js.map +1 -0
- package/lib/drift/base/details/user/balances.d.ts +40 -0
- package/lib/drift/base/details/user/balances.js +39 -0
- package/lib/drift/base/details/user/balances.js.map +1 -0
- package/lib/drift/base/details/user/index.d.ts +4 -0
- package/lib/drift/base/details/user/index.js +21 -0
- package/lib/drift/base/details/user/index.js.map +1 -0
- package/lib/drift/base/details/user/marginInfo.d.ts +29 -0
- package/lib/drift/base/details/user/marginInfo.js +49 -0
- package/lib/drift/base/details/user/marginInfo.js.map +1 -0
- package/lib/drift/base/details/user/orders.d.ts +3 -0
- package/lib/drift/base/details/user/orders.js +11 -0
- package/lib/drift/base/details/user/orders.js.map +1 -0
- package/lib/drift/base/details/user/positions.d.ts +70 -0
- package/lib/drift/base/details/user/positions.js +146 -0
- package/lib/drift/base/details/user/positions.js.map +1 -0
- package/lib/drift/cli.d.ts +25 -0
- package/lib/drift/cli.js +900 -0
- package/lib/drift/cli.js.map +1 -0
- package/lib/drift/constants/apiUrls.d.ts +27 -0
- package/lib/drift/constants/apiUrls.js +31 -0
- package/lib/drift/constants/apiUrls.js.map +1 -0
- package/lib/drift/example.d.ts +19 -0
- package/lib/drift/example.js +249 -0
- package/lib/drift/example.js.map +1 -0
- package/lib/drift/index.d.ts +3 -0
- package/lib/drift/index.js +20 -0
- package/lib/drift/index.js.map +1 -0
- package/lib/drift/utils/auctionParamsResponseMapper.d.ts +45 -0
- package/lib/drift/utils/auctionParamsResponseMapper.js +148 -0
- package/lib/drift/utils/auctionParamsResponseMapper.js.map +1 -0
- package/lib/drift/utils/funding.d.ts +2 -0
- package/lib/drift/utils/funding.js +9 -0
- package/lib/drift/utils/funding.js.map +1 -0
- package/lib/drift/utils/index.d.ts +3 -0
- package/lib/drift/utils/index.js +23 -0
- package/lib/drift/utils/index.js.map +1 -0
- package/lib/drift/utils/orderParams.d.ts +48 -0
- package/lib/drift/utils/orderParams.js +140 -0
- package/lib/drift/utils/orderParams.js.map +1 -0
- package/lib/index.d.ts +45 -0
- package/lib/index.js +68 -0
- package/lib/index.js.map +1 -0
- package/lib/serializableTypes.d.ts +961 -0
- package/lib/serializableTypes.js +3887 -0
- package/lib/serializableTypes.js.map +1 -0
- package/lib/types/MarketId.d.ts +26 -0
- package/lib/types/MarketId.js +64 -0
- package/lib/types/MarketId.js.map +1 -0
- package/lib/types/Superstake.d.ts +7 -0
- package/lib/types/Superstake.js +3 -0
- package/lib/types/Superstake.js.map +1 -0
- package/lib/types/UIEnv.d.ts +26 -0
- package/lib/types/UIEnv.js +49 -0
- package/lib/types/UIEnv.js.map +1 -0
- package/lib/types/UIMarket.d.ts +94 -0
- package/lib/types/UIMarket.js +224 -0
- package/lib/types/UIMarket.js.map +1 -0
- package/lib/types/candles.d.ts +4 -0
- package/lib/types/candles.js +9 -0
- package/lib/types/candles.js.map +1 -0
- package/lib/types/dataServer.d.ts +53 -0
- package/lib/types/dataServer.js +3 -0
- package/lib/types/dataServer.js.map +1 -0
- package/lib/types/historyServer.d.ts +38 -0
- package/lib/types/historyServer.js +11 -0
- package/lib/types/historyServer.js.map +1 -0
- package/lib/types/index.d.ts +12 -0
- package/lib/types/index.js +29 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/leaderboard.d.ts +80 -0
- package/lib/types/leaderboard.js +11 -0
- package/lib/types/leaderboard.js.map +1 -0
- package/lib/types/remote-configs.d.ts +61 -0
- package/lib/types/remote-configs.js +3 -0
- package/lib/types/remote-configs.js.map +1 -0
- package/lib/types/trade.d.ts +18 -0
- package/lib/types/trade.js +3 -0
- package/lib/types/trade.js.map +1 -0
- package/lib/types/user.d.ts +40 -0
- package/lib/types/user.js +3 -0
- package/lib/types/user.js.map +1 -0
- package/lib/types/utility.d.ts +15 -0
- package/lib/types/utility.js +3 -0
- package/lib/types/utility.js.map +1 -0
- package/lib/utils/CircularBuffers/CircularBuffer.d.ts +22 -0
- package/lib/utils/CircularBuffers/CircularBuffer.js +73 -0
- package/lib/utils/CircularBuffers/CircularBuffer.js.map +1 -0
- package/lib/utils/CircularBuffers/UniqueCircularBuffer.d.ts +19 -0
- package/lib/utils/CircularBuffers/UniqueCircularBuffer.js +78 -0
- package/lib/utils/CircularBuffers/UniqueCircularBuffer.js.map +1 -0
- package/lib/utils/CircularBuffers/index.d.ts +2 -0
- package/lib/utils/CircularBuffers/index.js +19 -0
- package/lib/utils/CircularBuffers/index.js.map +1 -0
- package/lib/utils/MultiplexWebSocket.d.ts +95 -0
- package/lib/utils/MultiplexWebSocket.js +416 -0
- package/lib/utils/MultiplexWebSocket.js.map +1 -0
- package/lib/utils/NumLib.d.ts +106 -0
- package/lib/utils/NumLib.js +300 -0
- package/lib/utils/NumLib.js.map +1 -0
- package/lib/utils/SharedInterval.d.ts +21 -0
- package/lib/utils/SharedInterval.js +47 -0
- package/lib/utils/SharedInterval.js.map +1 -0
- package/lib/utils/SlotBasedResultValidator.d.ts +9 -0
- package/lib/utils/SlotBasedResultValidator.js +27 -0
- package/lib/utils/SlotBasedResultValidator.js.map +1 -0
- package/lib/utils/Stopwatch.d.ts +15 -0
- package/lib/utils/Stopwatch.js +31 -0
- package/lib/utils/Stopwatch.js.map +1 -0
- package/lib/utils/StrictEventEmitter.d.ts +15 -0
- package/lib/utils/StrictEventEmitter.js +55 -0
- package/lib/utils/StrictEventEmitter.js.map +1 -0
- package/lib/utils/WalletConnectionState.d.ts +31 -0
- package/lib/utils/WalletConnectionState.js +83 -0
- package/lib/utils/WalletConnectionState.js.map +1 -0
- package/lib/utils/assert.d.ts +1 -0
- package/lib/utils/assert.js +10 -0
- package/lib/utils/assert.js.map +1 -0
- package/lib/utils/candles/Candle.d.ts +94 -0
- package/lib/utils/candles/Candle.js +580 -0
- package/lib/utils/candles/Candle.js.map +1 -0
- package/lib/utils/candles/types.d.ts +8 -0
- package/lib/utils/candles/types.js +3 -0
- package/lib/utils/candles/types.js.map +1 -0
- package/lib/utils/dlob-server/DlobServerWebsocketUtils.d.ts +57 -0
- package/lib/utils/dlob-server/DlobServerWebsocketUtils.js +137 -0
- package/lib/utils/dlob-server/DlobServerWebsocketUtils.js.map +1 -0
- package/lib/utils/driftEvents.d.ts +10 -0
- package/lib/utils/driftEvents.js +123 -0
- package/lib/utils/driftEvents.js.map +1 -0
- package/lib/utils/equalityChecks.d.ts +12 -0
- package/lib/utils/equalityChecks.js +71 -0
- package/lib/utils/equalityChecks.js.map +1 -0
- package/lib/utils/featureFlags.d.ts +3 -0
- package/lib/utils/featureFlags.js +7 -0
- package/lib/utils/featureFlags.js.map +1 -0
- package/lib/utils/geoblock/index.d.ts +4 -0
- package/lib/utils/geoblock/index.js +20 -0
- package/lib/utils/geoblock/index.js.map +1 -0
- package/lib/utils/index.d.ts +181 -0
- package/lib/utils/index.js +608 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/insuranceFund.d.ts +15 -0
- package/lib/utils/insuranceFund.js +84 -0
- package/lib/utils/insuranceFund.js.map +1 -0
- package/lib/utils/logger.d.ts +5 -0
- package/lib/utils/logger.js +53 -0
- package/lib/utils/logger.js.map +1 -0
- package/lib/utils/math.d.ts +10 -0
- package/lib/utils/math.js +89 -0
- package/lib/utils/math.js.map +1 -0
- package/lib/utils/orderbook/index.d.ts +65 -0
- package/lib/utils/orderbook/index.js +80 -0
- package/lib/utils/orderbook/index.js.map +1 -0
- package/lib/utils/pollingSequenceGuard.d.ts +9 -0
- package/lib/utils/pollingSequenceGuard.js +24 -0
- package/lib/utils/pollingSequenceGuard.js.map +1 -0
- package/lib/utils/priority-fees/PriorityFeeCalculator.d.ts +24 -0
- package/lib/utils/priority-fees/PriorityFeeCalculator.js +53 -0
- package/lib/utils/priority-fees/PriorityFeeCalculator.js.map +1 -0
- package/lib/utils/priority-fees/PriorityFeeStrategies.d.ts +5 -0
- package/lib/utils/priority-fees/PriorityFeeStrategies.js +43 -0
- package/lib/utils/priority-fees/PriorityFeeStrategies.js.map +1 -0
- package/lib/utils/priority-fees/index.d.ts +2 -0
- package/lib/utils/priority-fees/index.js +19 -0
- package/lib/utils/priority-fees/index.js.map +1 -0
- package/lib/utils/priorityFees.d.ts +14 -0
- package/lib/utils/priorityFees.js +68 -0
- package/lib/utils/priorityFees.js.map +1 -0
- package/lib/utils/rpcLatency.d.ts +7 -0
- package/lib/utils/rpcLatency.js +49 -0
- package/lib/utils/rpcLatency.js.map +1 -0
- package/lib/utils/rxjs.d.ts +11 -0
- package/lib/utils/rxjs.js +24 -0
- package/lib/utils/rxjs.js.map +1 -0
- package/lib/utils/s3Buckets.d.ts +43 -0
- package/lib/utils/s3Buckets.js +108 -0
- package/lib/utils/s3Buckets.js.map +1 -0
- package/lib/utils/superstake.d.ts +86 -0
- package/lib/utils/superstake.js +224 -0
- package/lib/utils/superstake.js.map +1 -0
- package/lib/utils/token.d.ts +16 -0
- package/lib/utils/token.js +44 -0
- package/lib/utils/token.js.map +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WalletConnectionState = exports.ConnectionStates = exports.ConnectionStateSteps = void 0;
|
|
4
|
+
var ConnectionStateSteps;
|
|
5
|
+
(function (ConnectionStateSteps) {
|
|
6
|
+
ConnectionStateSteps[ConnectionStateSteps["NotConnected"] = 0] = "NotConnected";
|
|
7
|
+
ConnectionStateSteps[ConnectionStateSteps["AdapterConnected"] = 1] = "AdapterConnected";
|
|
8
|
+
ConnectionStateSteps[ConnectionStateSteps["ClientConnected"] = 2] = "ClientConnected";
|
|
9
|
+
ConnectionStateSteps[ConnectionStateSteps["BalanceLoaded"] = 4] = "BalanceLoaded";
|
|
10
|
+
ConnectionStateSteps[ConnectionStateSteps["SubaccountsSubscribed"] = 8] = "SubaccountsSubscribed";
|
|
11
|
+
})(ConnectionStateSteps || (exports.ConnectionStateSteps = ConnectionStateSteps = {}));
|
|
12
|
+
var ConnectionStates;
|
|
13
|
+
(function (ConnectionStates) {
|
|
14
|
+
ConnectionStates[ConnectionStates["NotConnected"] = 0] = "NotConnected";
|
|
15
|
+
ConnectionStates[ConnectionStates["AdapterConnected"] = 1] = "AdapterConnected";
|
|
16
|
+
ConnectionStates[ConnectionStates["ClientConnected"] = 2] = "ClientConnected";
|
|
17
|
+
ConnectionStates[ConnectionStates["BalanceLoaded"] = 4] = "BalanceLoaded";
|
|
18
|
+
ConnectionStates[ConnectionStates["SubaccountsSubscribed"] = 8] = "SubaccountsSubscribed";
|
|
19
|
+
ConnectionStates[ConnectionStates["FullyConnected"] = 15] = "FullyConnected";
|
|
20
|
+
})(ConnectionStates || (exports.ConnectionStates = ConnectionStates = {}));
|
|
21
|
+
class WalletConnectionState {
|
|
22
|
+
constructor(authority) {
|
|
23
|
+
this.state = ConnectionStates.NotConnected;
|
|
24
|
+
this.authority = authority;
|
|
25
|
+
}
|
|
26
|
+
is(stateQuery) {
|
|
27
|
+
switch (stateQuery) {
|
|
28
|
+
case 'NotConnected':
|
|
29
|
+
return this.state === ConnectionStates.NotConnected;
|
|
30
|
+
case 'AdapterConnected':
|
|
31
|
+
return ((this.state & ConnectionStates.AdapterConnected) ===
|
|
32
|
+
ConnectionStates.AdapterConnected);
|
|
33
|
+
case 'ClientConnected':
|
|
34
|
+
return ((this.state & ConnectionStates.ClientConnected) ===
|
|
35
|
+
ConnectionStates.ClientConnected);
|
|
36
|
+
case 'BalanceLoaded':
|
|
37
|
+
return ((this.state & ConnectionStates.BalanceLoaded) ===
|
|
38
|
+
ConnectionStates.BalanceLoaded);
|
|
39
|
+
case 'FullyConnected':
|
|
40
|
+
return ((this.state & ConnectionStates.FullyConnected) ===
|
|
41
|
+
ConnectionStates.FullyConnected);
|
|
42
|
+
case 'SubaccountsSubscribed':
|
|
43
|
+
return ((this.state & ConnectionStates.SubaccountsSubscribed) ===
|
|
44
|
+
ConnectionStates.SubaccountsSubscribed);
|
|
45
|
+
default: {
|
|
46
|
+
// Throw a typescript error if we have an unhandled case
|
|
47
|
+
const nothing = stateQuery;
|
|
48
|
+
return nothing;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
update(updateStep, authorityGate) {
|
|
53
|
+
// Check that authorities match before updating state
|
|
54
|
+
if (authorityGate && !this.authority.equals(authorityGate)) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (updateStep === 'NotConnected') {
|
|
58
|
+
this.state = ConnectionStates.NotConnected;
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
this.state = this.state | ConnectionStateSteps[updateStep];
|
|
62
|
+
}
|
|
63
|
+
get NotConnected() {
|
|
64
|
+
return this.is('NotConnected');
|
|
65
|
+
}
|
|
66
|
+
get AdapterConnected() {
|
|
67
|
+
return this.is('AdapterConnected');
|
|
68
|
+
}
|
|
69
|
+
get ClientConnected() {
|
|
70
|
+
return this.is('ClientConnected');
|
|
71
|
+
}
|
|
72
|
+
get BalanceLoaded() {
|
|
73
|
+
return this.is('BalanceLoaded');
|
|
74
|
+
}
|
|
75
|
+
get FullyConnected() {
|
|
76
|
+
return this.is('FullyConnected');
|
|
77
|
+
}
|
|
78
|
+
get SubaccountsSubscribed() {
|
|
79
|
+
return this.is('SubaccountsSubscribed');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.WalletConnectionState = WalletConnectionState;
|
|
83
|
+
//# sourceMappingURL=WalletConnectionState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalletConnectionState.js","sourceRoot":"","sources":["../../src/utils/WalletConnectionState.ts"],"names":[],"mappings":"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","sourcesContent":["import { PublicKey } from '@drift-labs/sdk';\n\nexport enum ConnectionStateSteps {\n\tNotConnected = 0,\n\tAdapterConnected = 1,\n\tClientConnected = 2,\n\tBalanceLoaded = 4,\n\tSubaccountsSubscribed = 8,\n}\n\nexport enum ConnectionStates {\n\tNotConnected = ConnectionStateSteps.NotConnected,\n\tAdapterConnected = ConnectionStateSteps.AdapterConnected,\n\tClientConnected = ConnectionStateSteps.ClientConnected,\n\tBalanceLoaded = ConnectionStateSteps.BalanceLoaded,\n\tSubaccountsSubscribed = ConnectionStateSteps.SubaccountsSubscribed,\n\tFullyConnected = ConnectionStateSteps.AdapterConnected +\n\t\tConnectionStateSteps.ClientConnected +\n\t\tConnectionStateSteps.BalanceLoaded +\n\t\tConnectionStateSteps.SubaccountsSubscribed,\n}\n\nexport type ConnectionStepString = keyof typeof ConnectionStateSteps;\n\nexport type ConnectionStateString = keyof typeof ConnectionStates;\n\nexport class WalletConnectionState {\n\tstate: number;\n\tauthority: PublicKey;\n\n\tconstructor(authority: PublicKey) {\n\t\tthis.state = ConnectionStates.NotConnected;\n\t\tthis.authority = authority;\n\t}\n\n\tis(stateQuery: ConnectionStateString) {\n\t\tswitch (stateQuery) {\n\t\t\tcase 'NotConnected':\n\t\t\t\treturn this.state === ConnectionStates.NotConnected;\n\t\t\tcase 'AdapterConnected':\n\t\t\t\treturn (\n\t\t\t\t\t(this.state & ConnectionStates.AdapterConnected) ===\n\t\t\t\t\tConnectionStates.AdapterConnected\n\t\t\t\t);\n\t\t\tcase 'ClientConnected':\n\t\t\t\treturn (\n\t\t\t\t\t(this.state & ConnectionStates.ClientConnected) ===\n\t\t\t\t\tConnectionStates.ClientConnected\n\t\t\t\t);\n\t\t\tcase 'BalanceLoaded':\n\t\t\t\treturn (\n\t\t\t\t\t(this.state & ConnectionStates.BalanceLoaded) ===\n\t\t\t\t\tConnectionStates.BalanceLoaded\n\t\t\t\t);\n\t\t\tcase 'FullyConnected':\n\t\t\t\treturn (\n\t\t\t\t\t(this.state & ConnectionStates.FullyConnected) ===\n\t\t\t\t\tConnectionStates.FullyConnected\n\t\t\t\t);\n\t\t\tcase 'SubaccountsSubscribed':\n\t\t\t\treturn (\n\t\t\t\t\t(this.state & ConnectionStates.SubaccountsSubscribed) ===\n\t\t\t\t\tConnectionStates.SubaccountsSubscribed\n\t\t\t\t);\n\t\t\tdefault: {\n\t\t\t\t// Throw a typescript error if we have an unhandled case\n\t\t\t\tconst nothing: never = stateQuery;\n\t\t\t\treturn nothing;\n\t\t\t}\n\t\t}\n\t}\n\n\tupdate(updateStep: ConnectionStepString, authorityGate?: PublicKey) {\n\t\t// Check that authorities match before updating state\n\t\tif (authorityGate && !this.authority.equals(authorityGate)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (updateStep === 'NotConnected') {\n\t\t\tthis.state = ConnectionStates.NotConnected;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.state = this.state | ConnectionStateSteps[updateStep];\n\t}\n\n\tget NotConnected() {\n\t\treturn this.is('NotConnected');\n\t}\n\tget AdapterConnected() {\n\t\treturn this.is('AdapterConnected');\n\t}\n\tget ClientConnected() {\n\t\treturn this.is('ClientConnected');\n\t}\n\tget BalanceLoaded() {\n\t\treturn this.is('BalanceLoaded');\n\t}\n\tget FullyConnected() {\n\t\treturn this.is('FullyConnected');\n\t}\n\tget SubaccountsSubscribed() {\n\t\treturn this.is('SubaccountsSubscribed');\n\t}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function assert(condition: boolean, error?: string): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assert = void 0;
|
|
4
|
+
function assert(condition, error) {
|
|
5
|
+
if (!condition) {
|
|
6
|
+
throw new Error(error || 'Unspecified AssertionError');
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.assert = assert;
|
|
10
|
+
//# sourceMappingURL=assert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assert.js","sourceRoot":"","sources":["../../src/utils/assert.ts"],"names":[],"mappings":";;;AAAA,SAAgB,MAAM,CAAC,SAAkB,EAAE,KAAc;IACxD,IAAI,CAAC,SAAS,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,KAAK,IAAI,4BAA4B,CAAC,CAAC;IACxD,CAAC;AACF,CAAC;AAJD,wBAIC","sourcesContent":["export function assert(condition: boolean, error?: string): void {\n\tif (!condition) {\n\t\tthrow new Error(error || 'Unspecified AssertionError');\n\t}\n}\n"]}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { BN, CandleResolution, WrappedEvent } from '@drift-labs/sdk';
|
|
2
|
+
import { SerializableCandle, UISerializableCandle } from '../../serializableTypes';
|
|
3
|
+
import { CandleType } from '../../types';
|
|
4
|
+
import { PartialUISerializableOrderActionRecord } from '..';
|
|
5
|
+
import { Bar } from './types';
|
|
6
|
+
type CandleData = Pick<Candle, 'baseVolume' | 'fillOpen' | 'fillHigh' | 'fillClose' | 'fillLow' | 'oracleOpen' | 'oracleHigh' | 'oracleClose' | 'oracleLow' | 'quoteVolume' | 'resolution' | 'start'>;
|
|
7
|
+
type CandleProps = {
|
|
8
|
+
start: BN;
|
|
9
|
+
fillOpen: BN;
|
|
10
|
+
fillHigh: BN;
|
|
11
|
+
fillClose: BN;
|
|
12
|
+
fillLow: BN;
|
|
13
|
+
oracleOpen: BN;
|
|
14
|
+
oracleHigh: BN;
|
|
15
|
+
oracleClose: BN;
|
|
16
|
+
oracleLow: BN;
|
|
17
|
+
quoteVolume: BN;
|
|
18
|
+
baseVolume: BN;
|
|
19
|
+
resolution: CandleResolution;
|
|
20
|
+
};
|
|
21
|
+
export declare class Candle {
|
|
22
|
+
start: BN;
|
|
23
|
+
fillOpen: BN;
|
|
24
|
+
fillHigh: BN;
|
|
25
|
+
fillClose: BN;
|
|
26
|
+
fillLow: BN;
|
|
27
|
+
oracleOpen: BN;
|
|
28
|
+
oracleHigh: BN;
|
|
29
|
+
oracleClose: BN;
|
|
30
|
+
oracleLow: BN;
|
|
31
|
+
quoteVolume: BN;
|
|
32
|
+
baseVolume: BN;
|
|
33
|
+
resolution: CandleResolution;
|
|
34
|
+
static getSafeProps(props: CandleProps): {
|
|
35
|
+
start: BN;
|
|
36
|
+
fillOpen: BN;
|
|
37
|
+
fillHigh: BN;
|
|
38
|
+
fillClose: BN;
|
|
39
|
+
fillLow: BN;
|
|
40
|
+
oracleOpen: BN;
|
|
41
|
+
oracleHigh: BN;
|
|
42
|
+
oracleClose: BN;
|
|
43
|
+
oracleLow: BN;
|
|
44
|
+
quoteVolume: BN;
|
|
45
|
+
baseVolume: BN;
|
|
46
|
+
resolution: CandleResolution;
|
|
47
|
+
};
|
|
48
|
+
static sanityCheckProps(props: CandleProps): void;
|
|
49
|
+
private constructor();
|
|
50
|
+
print(): string;
|
|
51
|
+
toSerializable(): SerializableCandle;
|
|
52
|
+
toUISerializable(): UISerializableCandle;
|
|
53
|
+
static fromData(candle: CandleData): Candle;
|
|
54
|
+
static fromUICandle(candle: UISerializableCandle, handleBadCandle?: boolean): Candle;
|
|
55
|
+
static blank(startMs: BN, resolution: CandleResolution, fillPrice?: BN, oraclePrice?: BN): Candle;
|
|
56
|
+
static clone(candle: Candle): Candle;
|
|
57
|
+
static mergeSmallCandlesIntoBig(start: number, smallCandles: Candle[], outputResolution: CandleResolution): Candle;
|
|
58
|
+
/**
|
|
59
|
+
* Merge two candles together. The previous candle should be from either the same window or a previous window.
|
|
60
|
+
*
|
|
61
|
+
* - If the previous candle is in the same window => outputs both the candles merged into one
|
|
62
|
+
* - If the previous candle is in the previous window => ensures the current candle correctly "follows" the previous one (updates open price, etc.)
|
|
63
|
+
*
|
|
64
|
+
* @param current
|
|
65
|
+
* @param previous
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
68
|
+
static fromMerge(current: Candle, previous?: Candle): Candle;
|
|
69
|
+
static fromBlankAfterPrevious(previousCandle: Candle, resolution: CandleResolution, start: number): Candle;
|
|
70
|
+
static fromMergeAll(candles: Candle[]): Candle;
|
|
71
|
+
static resolutionStringToCandleLengthMs(resolutionString: CandleResolution): number;
|
|
72
|
+
private static tsIsSeconds;
|
|
73
|
+
static startTimeForCandle(ts: number, resolution: CandleResolution): number;
|
|
74
|
+
static endTimeForCandle(ts: number, resolution: CandleResolution): number;
|
|
75
|
+
static getDividingResolution(resolutionString: CandleResolution): CandleResolution;
|
|
76
|
+
/**
|
|
77
|
+
* Filter for trades which we want to include in candles, which may change over time.
|
|
78
|
+
*/
|
|
79
|
+
static filterOrderActionsForCandles(tradeEvent: Pick<WrappedEvent<'OrderActionRecord'>, 'action' | 'actionExplanation'>): boolean;
|
|
80
|
+
static candleFromTrade(start: number, resolution: CandleResolution, trade: Omit<PartialUISerializableOrderActionRecord, 'slot'>): Candle;
|
|
81
|
+
static stitchCandles(allCandles: Candle[]): Candle[];
|
|
82
|
+
/**
|
|
83
|
+
* Create an array of candles from an array of trades. Merges trades into a single candle if they are in the same candle window.
|
|
84
|
+
*/
|
|
85
|
+
static mergeTradesIntoCandles(trades: PartialUISerializableOrderActionRecord[], resolution: CandleResolution): Candle[];
|
|
86
|
+
static mergeTradesIntoCandle(trades: PartialUISerializableOrderActionRecord[], candle: UISerializableCandle): Candle;
|
|
87
|
+
static convertTradesToCandle(trades: PartialUISerializableOrderActionRecord[], fromMs: number, resolution: CandleResolution, previousCandle?: UISerializableCandle): Candle;
|
|
88
|
+
static candleToTvBar(candle: UISerializableCandle, candleType: CandleType): Bar;
|
|
89
|
+
/**
|
|
90
|
+
* This method handles the candles that come back from the exchange history server and converts them into Bars for the TradingView Chart. It also fills any gaps in the candles with blanks.
|
|
91
|
+
*/
|
|
92
|
+
static candlesToTvBars(candles: UISerializableCandle[], resolution: CandleResolution, candleType: CandleType): Bar[];
|
|
93
|
+
}
|
|
94
|
+
export {};
|