@drift-labs/sdk-browser 2.104.0-beta.21
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/README.md +276 -0
- package/VERSION +1 -0
- package/bun.lockb +0 -0
- package/get_events.ts +47 -0
- package/lib/browser/accounts/basicUserAccountSubscriber.d.ts +27 -0
- package/lib/browser/accounts/basicUserAccountSubscriber.js +38 -0
- package/lib/browser/accounts/bulkAccountLoader.d.ts +37 -0
- package/lib/browser/accounts/bulkAccountLoader.js +222 -0
- package/lib/browser/accounts/bulkUserStatsSubscription.d.ts +7 -0
- package/lib/browser/accounts/bulkUserStatsSubscription.js +21 -0
- package/lib/browser/accounts/bulkUserSubscription.d.ts +7 -0
- package/lib/browser/accounts/bulkUserSubscription.js +21 -0
- package/lib/browser/accounts/fetch.d.ts +6 -0
- package/lib/browser/accounts/fetch.js +30 -0
- package/lib/browser/accounts/grpcAccountSubscriber.d.ts +16 -0
- package/lib/browser/accounts/grpcAccountSubscriber.js +154 -0
- package/lib/browser/accounts/grpcDriftClientAccountSubscriber.d.ts +12 -0
- package/lib/browser/accounts/grpcDriftClientAccountSubscriber.js +98 -0
- package/lib/browser/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts +10 -0
- package/lib/browser/accounts/grpcInsuranceFundStakeAccountSubscriber.js +30 -0
- package/lib/browser/accounts/grpcProgramAccountSubscriber.d.ts +18 -0
- package/lib/browser/accounts/grpcProgramAccountSubscriber.js +171 -0
- package/lib/browser/accounts/grpcUserAccountSubscriber.d.ts +10 -0
- package/lib/browser/accounts/grpcUserAccountSubscriber.js +28 -0
- package/lib/browser/accounts/grpcUserStatsAccountSubscriber.d.ts +10 -0
- package/lib/browser/accounts/grpcUserStatsAccountSubscriber.js +28 -0
- package/lib/browser/accounts/oneShotUserAccountSubscriber.d.ts +18 -0
- package/lib/browser/accounts/oneShotUserAccountSubscriber.js +48 -0
- package/lib/browser/accounts/pollingDriftClientAccountSubscriber.d.ts +69 -0
- package/lib/browser/accounts/pollingDriftClientAccountSubscriber.js +418 -0
- package/lib/browser/accounts/pollingHighLeverageModeConfigAccountSubscriber.d.ts +29 -0
- package/lib/browser/accounts/pollingHighLeverageModeConfigAccountSubscriber.js +111 -0
- package/lib/browser/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts +29 -0
- package/lib/browser/accounts/pollingInsuranceFundStakeAccountSubscriber.js +110 -0
- package/lib/browser/accounts/pollingOracleAccountSubscriber.d.ts +27 -0
- package/lib/browser/accounts/pollingOracleAccountSubscriber.js +78 -0
- package/lib/browser/accounts/pollingTokenAccountSubscriber.d.ts +26 -0
- package/lib/browser/accounts/pollingTokenAccountSubscriber.js +78 -0
- package/lib/browser/accounts/pollingUserAccountSubscriber.d.ts +29 -0
- package/lib/browser/accounts/pollingUserAccountSubscriber.js +102 -0
- package/lib/browser/accounts/pollingUserStatsAccountSubscriber.d.ts +27 -0
- package/lib/browser/accounts/pollingUserStatsAccountSubscriber.js +94 -0
- package/lib/browser/accounts/testBulkAccountLoader.d.ts +4 -0
- package/lib/browser/accounts/testBulkAccountLoader.js +45 -0
- package/lib/browser/accounts/types.d.ts +168 -0
- package/lib/browser/accounts/types.js +16 -0
- package/lib/browser/accounts/utils.d.ts +8 -0
- package/lib/browser/accounts/utils.js +49 -0
- package/lib/browser/accounts/webSocketAccountSubscriber.d.ts +29 -0
- package/lib/browser/accounts/webSocketAccountSubscriber.js +149 -0
- package/lib/browser/accounts/webSocketDriftClientAccountSubscriber.d.ts +66 -0
- package/lib/browser/accounts/webSocketDriftClientAccountSubscriber.js +358 -0
- package/lib/browser/accounts/webSocketHighLeverageModeConfigAccountSubscriber.d.ts +23 -0
- package/lib/browser/accounts/webSocketHighLeverageModeConfigAccountSubscriber.js +69 -0
- package/lib/browser/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +23 -0
- package/lib/browser/accounts/webSocketInsuranceFundStakeAccountSubscriber.js +67 -0
- package/lib/browser/accounts/webSocketProgramAccountSubscriber.d.ts +32 -0
- package/lib/browser/accounts/webSocketProgramAccountSubscriber.js +120 -0
- package/lib/browser/accounts/webSocketUserAccountSubscriber.d.ts +23 -0
- package/lib/browser/accounts/webSocketUserAccountSubscriber.js +61 -0
- package/lib/browser/accounts/webSocketUserStatsAccountSubsriber.d.ts +22 -0
- package/lib/browser/accounts/webSocketUserStatsAccountSubsriber.js +52 -0
- package/lib/browser/addresses/marketAddresses.d.ts +2 -0
- package/lib/browser/addresses/marketAddresses.js +15 -0
- package/lib/browser/addresses/pda.d.ts +32 -0
- package/lib/browser/addresses/pda.js +211 -0
- package/lib/browser/adminClient.d.ts +206 -0
- package/lib/browser/adminClient.js +1858 -0
- package/lib/browser/assert/assert.d.ts +1 -0
- package/lib/browser/assert/assert.js +9 -0
- package/lib/browser/auctionSubscriber/auctionSubscriber.d.ts +14 -0
- package/lib/browser/auctionSubscriber/auctionSubscriber.js +32 -0
- package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.d.ts +15 -0
- package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.js +32 -0
- package/lib/browser/auctionSubscriber/index.d.ts +3 -0
- package/lib/browser/auctionSubscriber/index.js +19 -0
- package/lib/browser/auctionSubscriber/types.d.ts +14 -0
- package/lib/browser/auctionSubscriber/types.js +2 -0
- package/lib/browser/bankrun/bankrunConnection.d.ts +75 -0
- package/lib/browser/bankrun/bankrunConnection.js +332 -0
- package/lib/browser/blockhashSubscriber/BlockhashSubscriber.d.ts +27 -0
- package/lib/browser/blockhashSubscriber/BlockhashSubscriber.js +89 -0
- package/lib/browser/blockhashSubscriber/index.d.ts +1 -0
- package/lib/browser/blockhashSubscriber/index.js +17 -0
- package/lib/browser/blockhashSubscriber/types.d.ts +7 -0
- package/lib/browser/blockhashSubscriber/types.js +2 -0
- package/lib/browser/clock/clockSubscriber.d.ts +31 -0
- package/lib/browser/clock/clockSubscriber.js +80 -0
- package/lib/browser/config.d.ts +60 -0
- package/lib/browser/config.js +130 -0
- package/lib/browser/constants/numericConstants.d.ts +71 -0
- package/lib/browser/constants/numericConstants.js +75 -0
- package/lib/browser/constants/perpMarkets.d.ts +19 -0
- package/lib/browser/constants/perpMarkets.js +997 -0
- package/lib/browser/constants/spotMarkets.d.ts +24 -0
- package/lib/browser/constants/spotMarkets.js +470 -0
- package/lib/browser/constants/txConstants.d.ts +1 -0
- package/lib/browser/constants/txConstants.js +4 -0
- package/lib/browser/decode/phoenix.d.ts +7 -0
- package/lib/browser/decode/phoenix.js +159 -0
- package/lib/browser/decode/user.d.ts +4 -0
- package/lib/browser/decode/user.js +339 -0
- package/lib/browser/dlob/DLOB.d.ts +186 -0
- package/lib/browser/dlob/DLOB.js +1039 -0
- package/lib/browser/dlob/DLOBNode.d.ts +68 -0
- package/lib/browser/dlob/DLOBNode.js +100 -0
- package/lib/browser/dlob/DLOBSubscriber.d.ts +54 -0
- package/lib/browser/dlob/DLOBSubscriber.js +139 -0
- package/lib/browser/dlob/NodeList.d.ts +25 -0
- package/lib/browser/dlob/NodeList.js +126 -0
- package/lib/browser/dlob/orderBookLevels.d.ts +72 -0
- package/lib/browser/dlob/orderBookLevels.js +438 -0
- package/lib/browser/dlob/types.d.ts +18 -0
- package/lib/browser/dlob/types.js +2 -0
- package/lib/browser/driftClient.d.ts +861 -0
- package/lib/browser/driftClient.js +4768 -0
- package/lib/browser/driftClientConfig.d.ts +49 -0
- package/lib/browser/driftClientConfig.js +2 -0
- package/lib/browser/events/eventList.d.ts +22 -0
- package/lib/browser/events/eventList.js +80 -0
- package/lib/browser/events/eventSubscriber.d.ts +46 -0
- package/lib/browser/events/eventSubscriber.js +223 -0
- package/lib/browser/events/eventsServerLogProvider.d.ts +21 -0
- package/lib/browser/events/eventsServerLogProvider.js +121 -0
- package/lib/browser/events/fetchLogs.d.ts +25 -0
- package/lib/browser/events/fetchLogs.js +99 -0
- package/lib/browser/events/parse.d.ts +6 -0
- package/lib/browser/events/parse.js +106 -0
- package/lib/browser/events/pollingLogProvider.d.ts +17 -0
- package/lib/browser/events/pollingLogProvider.js +58 -0
- package/lib/browser/events/sort.d.ts +2 -0
- package/lib/browser/events/sort.js +24 -0
- package/lib/browser/events/txEventCache.d.ts +24 -0
- package/lib/browser/events/txEventCache.js +71 -0
- package/lib/browser/events/types.d.ts +79 -0
- package/lib/browser/events/types.js +32 -0
- package/lib/browser/events/webSocketLogProvider.d.ts +24 -0
- package/lib/browser/events/webSocketLogProvider.js +96 -0
- package/lib/browser/factory/bigNum.d.ts +122 -0
- package/lib/browser/factory/bigNum.js +457 -0
- package/lib/browser/factory/oracleClient.d.ts +5 -0
- package/lib/browser/factory/oracleClient.js +56 -0
- package/lib/browser/idl/drift.json +14440 -0
- package/lib/browser/idl/openbook.json +3854 -0
- package/lib/browser/idl/pyth_solana_receiver.json +628 -0
- package/lib/browser/idl/switchboard.json +8354 -0
- package/lib/browser/idl/switchboard_on_demand_30.json +4546 -0
- package/lib/browser/idl/token_faucet.json +142 -0
- package/lib/browser/index.d.ts +125 -0
- package/lib/browser/index.js +147 -0
- package/lib/browser/isomorphic/grpc.browser.d.ts +1 -0
- package/lib/browser/isomorphic/grpc.browser.js +8 -0
- package/lib/browser/isomorphic/grpc.d.ts +1 -0
- package/lib/browser/isomorphic/grpc.js +8 -0
- package/lib/browser/jupiter/jupiterClient.d.ts +302 -0
- package/lib/browser/jupiter/jupiterClient.js +178 -0
- package/lib/browser/keypair.d.ts +2 -0
- package/lib/browser/keypair.js +28 -0
- package/lib/browser/marinade/index.d.ts +12 -0
- package/lib/browser/marinade/index.js +36 -0
- package/lib/browser/marinade/types.d.ts +1963 -0
- package/lib/browser/marinade/types.js +1965 -0
- package/lib/browser/math/amm.d.ts +98 -0
- package/lib/browser/math/amm.js +626 -0
- package/lib/browser/math/auction.d.ts +23 -0
- package/lib/browser/math/auction.js +130 -0
- package/lib/browser/math/bankruptcy.d.ts +2 -0
- package/lib/browser/math/bankruptcy.js +31 -0
- package/lib/browser/math/conversion.d.ts +2 -0
- package/lib/browser/math/conversion.js +11 -0
- package/lib/browser/math/exchangeStatus.d.ts +6 -0
- package/lib/browser/math/exchangeStatus.js +77 -0
- package/lib/browser/math/fuel.d.ts +6 -0
- package/lib/browser/math/fuel.js +55 -0
- package/lib/browser/math/funding.d.ts +34 -0
- package/lib/browser/math/funding.js +209 -0
- package/lib/browser/math/insurance.d.ts +7 -0
- package/lib/browser/math/insurance.js +73 -0
- package/lib/browser/math/margin.d.ts +39 -0
- package/lib/browser/math/margin.js +184 -0
- package/lib/browser/math/market.d.ts +39 -0
- package/lib/browser/math/market.js +163 -0
- package/lib/browser/math/oracles.d.ts +14 -0
- package/lib/browser/math/oracles.js +134 -0
- package/lib/browser/math/orders.d.ts +23 -0
- package/lib/browser/math/orders.js +216 -0
- package/lib/browser/math/position.d.ts +70 -0
- package/lib/browser/math/position.js +225 -0
- package/lib/browser/math/repeg.d.ts +22 -0
- package/lib/browser/math/repeg.js +164 -0
- package/lib/browser/math/spotBalance.d.ts +83 -0
- package/lib/browser/math/spotBalance.js +373 -0
- package/lib/browser/math/spotMarket.d.ts +11 -0
- package/lib/browser/math/spotMarket.js +49 -0
- package/lib/browser/math/spotPosition.d.ts +19 -0
- package/lib/browser/math/spotPosition.js +78 -0
- package/lib/browser/math/state.d.ts +5 -0
- package/lib/browser/math/state.js +30 -0
- package/lib/browser/math/superStake.d.ts +167 -0
- package/lib/browser/math/superStake.js +306 -0
- package/lib/browser/math/tiers.d.ts +4 -0
- package/lib/browser/math/tiers.js +52 -0
- package/lib/browser/math/trade.d.ts +117 -0
- package/lib/browser/math/trade.js +637 -0
- package/lib/browser/math/userStatus.d.ts +2 -0
- package/lib/browser/math/userStatus.js +8 -0
- package/lib/browser/math/utils.d.ts +23 -0
- package/lib/browser/math/utils.js +112 -0
- package/lib/browser/memcmp.d.ts +11 -0
- package/lib/browser/memcmp.js +99 -0
- package/lib/browser/openbook/openbookV2FulfillmentConfigMap.d.ts +10 -0
- package/lib/browser/openbook/openbookV2FulfillmentConfigMap.js +17 -0
- package/lib/browser/openbook/openbookV2Subscriber.d.ts +36 -0
- package/lib/browser/openbook/openbookV2Subscriber.js +104 -0
- package/lib/browser/oracles/oracleClientCache.d.ts +9 -0
- package/lib/browser/oracles/oracleClientCache.js +19 -0
- package/lib/browser/oracles/oracleId.d.ts +4 -0
- package/lib/browser/oracles/oracleId.js +38 -0
- package/lib/browser/oracles/prelaunchOracleClient.d.ts +12 -0
- package/lib/browser/oracles/prelaunchOracleClient.js +24 -0
- package/lib/browser/oracles/pythClient.d.ts +14 -0
- package/lib/browser/oracles/pythClient.js +51 -0
- package/lib/browser/oracles/pythLazerClient.d.ts +16 -0
- package/lib/browser/oracles/pythLazerClient.js +61 -0
- package/lib/browser/oracles/pythPullClient.d.ts +19 -0
- package/lib/browser/oracles/pythPullClient.js +60 -0
- package/lib/browser/oracles/quoteAssetOracleClient.d.ts +10 -0
- package/lib/browser/oracles/quoteAssetOracleClient.js +21 -0
- package/lib/browser/oracles/strictOraclePrice.d.ts +9 -0
- package/lib/browser/oracles/strictOraclePrice.js +17 -0
- package/lib/browser/oracles/switchboardClient.d.ts +12 -0
- package/lib/browser/oracles/switchboardClient.js +40 -0
- package/lib/browser/oracles/switchboardOnDemandClient.d.ts +12 -0
- package/lib/browser/oracles/switchboardOnDemandClient.js +32 -0
- package/lib/browser/oracles/types.d.ts +23 -0
- package/lib/browser/oracles/types.js +2 -0
- package/lib/browser/orderParams.d.ts +29 -0
- package/lib/browser/orderParams.js +44 -0
- package/lib/browser/orderSubscriber/OrderSubscriber.d.ts +42 -0
- package/lib/browser/orderSubscriber/OrderSubscriber.js +172 -0
- package/lib/browser/orderSubscriber/PollingSubscription.d.ts +12 -0
- package/lib/browser/orderSubscriber/PollingSubscription.js +23 -0
- package/lib/browser/orderSubscriber/WebsocketSubscription.d.ts +23 -0
- package/lib/browser/orderSubscriber/WebsocketSubscription.js +67 -0
- package/lib/browser/orderSubscriber/grpcSubscription.d.ts +22 -0
- package/lib/browser/orderSubscriber/grpcSubscription.js +66 -0
- package/lib/browser/orderSubscriber/index.d.ts +2 -0
- package/lib/browser/orderSubscriber/index.js +18 -0
- package/lib/browser/orderSubscriber/types.d.ts +34 -0
- package/lib/browser/orderSubscriber/types.js +2 -0
- package/lib/browser/phoenix/phoenixFulfillmentConfigMap.d.ts +10 -0
- package/lib/browser/phoenix/phoenixFulfillmentConfigMap.js +17 -0
- package/lib/browser/phoenix/phoenixSubscriber.d.ts +41 -0
- package/lib/browser/phoenix/phoenixSubscriber.js +152 -0
- package/lib/browser/priorityFee/averageOverSlotsStrategy.d.ts +5 -0
- package/lib/browser/priorityFee/averageOverSlotsStrategy.js +16 -0
- package/lib/browser/priorityFee/averageStrategy.d.ts +5 -0
- package/lib/browser/priorityFee/averageStrategy.js +11 -0
- package/lib/browser/priorityFee/driftPriorityFeeMethod.d.ts +13 -0
- package/lib/browser/priorityFee/driftPriorityFeeMethod.js +26 -0
- package/lib/browser/priorityFee/ewmaStrategy.d.ts +11 -0
- package/lib/browser/priorityFee/ewmaStrategy.js +33 -0
- package/lib/browser/priorityFee/heliusPriorityFeeMethod.d.ts +20 -0
- package/lib/browser/priorityFee/heliusPriorityFeeMethod.js +46 -0
- package/lib/browser/priorityFee/index.d.ts +11 -0
- package/lib/browser/priorityFee/index.js +27 -0
- package/lib/browser/priorityFee/maxOverSlotsStrategy.d.ts +5 -0
- package/lib/browser/priorityFee/maxOverSlotsStrategy.js +17 -0
- package/lib/browser/priorityFee/maxStrategy.d.ts +7 -0
- package/lib/browser/priorityFee/maxStrategy.js +9 -0
- package/lib/browser/priorityFee/priorityFeeSubscriber.d.ts +46 -0
- package/lib/browser/priorityFee/priorityFeeSubscriber.js +188 -0
- package/lib/browser/priorityFee/priorityFeeSubscriberMap.d.ts +48 -0
- package/lib/browser/priorityFee/priorityFeeSubscriberMap.js +88 -0
- package/lib/browser/priorityFee/solanaPriorityFeeMethod.d.ts +6 -0
- package/lib/browser/priorityFee/solanaPriorityFeeMethod.js +21 -0
- package/lib/browser/priorityFee/types.d.ts +31 -0
- package/lib/browser/priorityFee/types.js +10 -0
- package/lib/browser/serum/serumFulfillmentConfigMap.d.ts +10 -0
- package/lib/browser/serum/serumFulfillmentConfigMap.js +17 -0
- package/lib/browser/serum/serumSubscriber.d.ts +32 -0
- package/lib/browser/serum/serumSubscriber.js +107 -0
- package/lib/browser/serum/types.d.ts +13 -0
- package/lib/browser/serum/types.js +2 -0
- package/lib/browser/slot/SlotSubscriber.d.ts +27 -0
- package/lib/browser/slot/SlotSubscriber.js +71 -0
- package/lib/browser/slot/SlothashSubscriber.d.ts +26 -0
- package/lib/browser/slot/SlothashSubscriber.js +85 -0
- package/lib/browser/testClient.d.ts +8 -0
- package/lib/browser/testClient.js +23 -0
- package/lib/browser/token/index.d.ts +5 -0
- package/lib/browser/token/index.js +15 -0
- package/lib/browser/tokenFaucet.d.ts +41 -0
- package/lib/browser/tokenFaucet.js +188 -0
- package/lib/browser/tx/baseTxSender.d.ts +59 -0
- package/lib/browser/tx/baseTxSender.js +294 -0
- package/lib/browser/tx/blockhashFetcher/baseBlockhashFetcher.d.ts +8 -0
- package/lib/browser/tx/blockhashFetcher/baseBlockhashFetcher.js +13 -0
- package/lib/browser/tx/blockhashFetcher/cachedBlockhashFetcher.d.ts +28 -0
- package/lib/browser/tx/blockhashFetcher/cachedBlockhashFetcher.js +73 -0
- package/lib/browser/tx/blockhashFetcher/types.d.ts +4 -0
- package/lib/browser/tx/blockhashFetcher/types.js +2 -0
- package/lib/browser/tx/fastSingleTxSender.d.ts +41 -0
- package/lib/browser/tx/fastSingleTxSender.js +86 -0
- package/lib/browser/tx/forwardOnlyTxSender.d.ts +37 -0
- package/lib/browser/tx/forwardOnlyTxSender.js +92 -0
- package/lib/browser/tx/priorityFeeCalculator.d.ts +44 -0
- package/lib/browser/tx/priorityFeeCalculator.js +85 -0
- package/lib/browser/tx/reportTransactionError.d.ts +20 -0
- package/lib/browser/tx/reportTransactionError.js +103 -0
- package/lib/browser/tx/retryTxSender.d.ts +37 -0
- package/lib/browser/tx/retryTxSender.js +86 -0
- package/lib/browser/tx/txHandler.d.ts +154 -0
- package/lib/browser/tx/txHandler.js +453 -0
- package/lib/browser/tx/txParamProcessor.d.ts +25 -0
- package/lib/browser/tx/txParamProcessor.js +88 -0
- package/lib/browser/tx/types.d.ts +29 -0
- package/lib/browser/tx/types.js +20 -0
- package/lib/browser/tx/utils.d.ts +2 -0
- package/lib/browser/tx/utils.js +10 -0
- package/lib/browser/tx/whileValidTxSender.d.ts +45 -0
- package/lib/browser/tx/whileValidTxSender.js +167 -0
- package/lib/browser/types.d.ts +1385 -0
- package/lib/browser/types.js +366 -0
- package/lib/browser/user.d.ts +411 -0
- package/lib/browser/user.js +2151 -0
- package/lib/browser/userConfig.d.ts +26 -0
- package/lib/browser/userConfig.js +2 -0
- package/lib/browser/userMap/PollingSubscription.d.ts +16 -0
- package/lib/browser/userMap/PollingSubscription.js +30 -0
- package/lib/browser/userMap/WebsocketSubscription.d.ts +27 -0
- package/lib/browser/userMap/WebsocketSubscription.js +45 -0
- package/lib/browser/userMap/grpcSubscription.d.ts +27 -0
- package/lib/browser/userMap/grpcSubscription.js +44 -0
- package/lib/browser/userMap/referrerMap.d.ts +45 -0
- package/lib/browser/userMap/referrerMap.js +181 -0
- package/lib/browser/userMap/userMap.d.ts +90 -0
- package/lib/browser/userMap/userMap.js +467 -0
- package/lib/browser/userMap/userMapConfig.d.ts +39 -0
- package/lib/browser/userMap/userMapConfig.js +2 -0
- package/lib/browser/userMap/userStatsMap.d.ts +46 -0
- package/lib/browser/userMap/userStatsMap.js +165 -0
- package/lib/browser/userName.d.ts +5 -0
- package/lib/browser/userName.js +21 -0
- package/lib/browser/userStats.d.ts +22 -0
- package/lib/browser/userStats.js +91 -0
- package/lib/browser/userStatsConfig.d.ts +25 -0
- package/lib/browser/userStatsConfig.js +2 -0
- package/lib/browser/util/TransactionConfirmationManager.d.ts +16 -0
- package/lib/browser/util/TransactionConfirmationManager.js +174 -0
- package/lib/browser/util/chainClock.d.ts +17 -0
- package/lib/browser/util/chainClock.js +29 -0
- package/lib/browser/util/computeUnits.d.ts +8 -0
- package/lib/browser/util/computeUnits.js +48 -0
- package/lib/browser/util/digest.d.ts +4 -0
- package/lib/browser/util/digest.js +14 -0
- package/lib/browser/util/promiseTimeout.d.ts +1 -0
- package/lib/browser/util/promiseTimeout.js +14 -0
- package/lib/browser/util/pythOracleUtils.d.ts +17 -0
- package/lib/browser/util/pythOracleUtils.js +107 -0
- package/lib/browser/util/tps.d.ts +2 -0
- package/lib/browser/util/tps.js +16 -0
- package/lib/browser/wallet.d.ts +11 -0
- package/lib/browser/wallet.js +32 -0
- package/lib/node/accounts/basicUserAccountSubscriber.d.ts +27 -0
- package/lib/node/accounts/basicUserAccountSubscriber.js +38 -0
- package/lib/node/accounts/bulkAccountLoader.d.ts +37 -0
- package/lib/node/accounts/bulkAccountLoader.js +222 -0
- package/lib/node/accounts/bulkUserStatsSubscription.d.ts +7 -0
- package/lib/node/accounts/bulkUserStatsSubscription.js +21 -0
- package/lib/node/accounts/bulkUserSubscription.d.ts +7 -0
- package/lib/node/accounts/bulkUserSubscription.js +21 -0
- package/lib/node/accounts/fetch.d.ts +6 -0
- package/lib/node/accounts/fetch.js +30 -0
- package/lib/node/accounts/grpcAccountSubscriber.d.ts +16 -0
- package/lib/node/accounts/grpcAccountSubscriber.js +154 -0
- package/lib/node/accounts/grpcDriftClientAccountSubscriber.d.ts +12 -0
- package/lib/node/accounts/grpcDriftClientAccountSubscriber.js +98 -0
- package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts +10 -0
- package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.js +30 -0
- package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts +18 -0
- package/lib/node/accounts/grpcProgramAccountSubscriber.js +171 -0
- package/lib/node/accounts/grpcUserAccountSubscriber.d.ts +10 -0
- package/lib/node/accounts/grpcUserAccountSubscriber.js +28 -0
- package/lib/node/accounts/grpcUserStatsAccountSubscriber.d.ts +10 -0
- package/lib/node/accounts/grpcUserStatsAccountSubscriber.js +28 -0
- package/lib/node/accounts/oneShotUserAccountSubscriber.d.ts +18 -0
- package/lib/node/accounts/oneShotUserAccountSubscriber.js +48 -0
- package/lib/node/accounts/pollingDriftClientAccountSubscriber.d.ts +69 -0
- package/lib/node/accounts/pollingDriftClientAccountSubscriber.js +418 -0
- package/lib/node/accounts/pollingHighLeverageModeConfigAccountSubscriber.d.ts +29 -0
- package/lib/node/accounts/pollingHighLeverageModeConfigAccountSubscriber.js +111 -0
- package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts +29 -0
- package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.js +110 -0
- package/lib/node/accounts/pollingOracleAccountSubscriber.d.ts +27 -0
- package/lib/node/accounts/pollingOracleAccountSubscriber.js +78 -0
- package/lib/node/accounts/pollingTokenAccountSubscriber.d.ts +26 -0
- package/lib/node/accounts/pollingTokenAccountSubscriber.js +78 -0
- package/lib/node/accounts/pollingUserAccountSubscriber.d.ts +29 -0
- package/lib/node/accounts/pollingUserAccountSubscriber.js +102 -0
- package/lib/node/accounts/pollingUserStatsAccountSubscriber.d.ts +27 -0
- package/lib/node/accounts/pollingUserStatsAccountSubscriber.js +94 -0
- package/lib/node/accounts/testBulkAccountLoader.d.ts +4 -0
- package/lib/node/accounts/testBulkAccountLoader.js +45 -0
- package/lib/node/accounts/types.d.ts +168 -0
- package/lib/node/accounts/types.js +16 -0
- package/lib/node/accounts/utils.d.ts +8 -0
- package/lib/node/accounts/utils.js +49 -0
- package/lib/node/accounts/webSocketAccountSubscriber.d.ts +29 -0
- package/lib/node/accounts/webSocketAccountSubscriber.js +149 -0
- package/lib/node/accounts/webSocketDriftClientAccountSubscriber.d.ts +66 -0
- package/lib/node/accounts/webSocketDriftClientAccountSubscriber.js +358 -0
- package/lib/node/accounts/webSocketHighLeverageModeConfigAccountSubscriber.d.ts +23 -0
- package/lib/node/accounts/webSocketHighLeverageModeConfigAccountSubscriber.js +69 -0
- package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +23 -0
- package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.js +67 -0
- package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts +32 -0
- package/lib/node/accounts/webSocketProgramAccountSubscriber.js +120 -0
- package/lib/node/accounts/webSocketUserAccountSubscriber.d.ts +23 -0
- package/lib/node/accounts/webSocketUserAccountSubscriber.js +61 -0
- package/lib/node/accounts/webSocketUserStatsAccountSubsriber.d.ts +22 -0
- package/lib/node/accounts/webSocketUserStatsAccountSubsriber.js +52 -0
- package/lib/node/addresses/marketAddresses.d.ts +2 -0
- package/lib/node/addresses/marketAddresses.js +15 -0
- package/lib/node/addresses/pda.d.ts +32 -0
- package/lib/node/addresses/pda.js +211 -0
- package/lib/node/adminClient.d.ts +206 -0
- package/lib/node/adminClient.js +1858 -0
- package/lib/node/assert/assert.d.ts +1 -0
- package/lib/node/assert/assert.js +9 -0
- package/lib/node/auctionSubscriber/auctionSubscriber.d.ts +14 -0
- package/lib/node/auctionSubscriber/auctionSubscriber.js +32 -0
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts +15 -0
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.js +32 -0
- package/lib/node/auctionSubscriber/index.d.ts +3 -0
- package/lib/node/auctionSubscriber/index.js +19 -0
- package/lib/node/auctionSubscriber/types.d.ts +14 -0
- package/lib/node/auctionSubscriber/types.js +2 -0
- package/lib/node/bankrun/bankrunConnection.d.ts +75 -0
- package/lib/node/bankrun/bankrunConnection.js +332 -0
- package/lib/node/blockhashSubscriber/BlockhashSubscriber.d.ts +27 -0
- package/lib/node/blockhashSubscriber/BlockhashSubscriber.js +89 -0
- package/lib/node/blockhashSubscriber/index.d.ts +1 -0
- package/lib/node/blockhashSubscriber/index.js +17 -0
- package/lib/node/blockhashSubscriber/types.d.ts +7 -0
- package/lib/node/blockhashSubscriber/types.js +2 -0
- package/lib/node/clock/clockSubscriber.d.ts +31 -0
- package/lib/node/clock/clockSubscriber.js +80 -0
- package/lib/node/config.d.ts +60 -0
- package/lib/node/config.js +130 -0
- package/lib/node/constants/numericConstants.d.ts +71 -0
- package/lib/node/constants/numericConstants.js +75 -0
- package/lib/node/constants/perpMarkets.d.ts +19 -0
- package/lib/node/constants/perpMarkets.js +997 -0
- package/lib/node/constants/spotMarkets.d.ts +24 -0
- package/lib/node/constants/spotMarkets.js +470 -0
- package/lib/node/constants/txConstants.d.ts +1 -0
- package/lib/node/constants/txConstants.js +4 -0
- package/lib/node/decode/phoenix.d.ts +7 -0
- package/lib/node/decode/phoenix.js +159 -0
- package/lib/node/decode/user.d.ts +4 -0
- package/lib/node/decode/user.js +339 -0
- package/lib/node/dlob/DLOB.d.ts +186 -0
- package/lib/node/dlob/DLOB.js +1039 -0
- package/lib/node/dlob/DLOBNode.d.ts +68 -0
- package/lib/node/dlob/DLOBNode.js +100 -0
- package/lib/node/dlob/DLOBSubscriber.d.ts +54 -0
- package/lib/node/dlob/DLOBSubscriber.js +139 -0
- package/lib/node/dlob/NodeList.d.ts +25 -0
- package/lib/node/dlob/NodeList.js +126 -0
- package/lib/node/dlob/orderBookLevels.d.ts +72 -0
- package/lib/node/dlob/orderBookLevels.js +438 -0
- package/lib/node/dlob/types.d.ts +18 -0
- package/lib/node/dlob/types.js +2 -0
- package/lib/node/driftClient.d.ts +861 -0
- package/lib/node/driftClient.js +4768 -0
- package/lib/node/driftClientConfig.d.ts +49 -0
- package/lib/node/driftClientConfig.js +2 -0
- package/lib/node/events/eventList.d.ts +22 -0
- package/lib/node/events/eventList.js +80 -0
- package/lib/node/events/eventSubscriber.d.ts +46 -0
- package/lib/node/events/eventSubscriber.js +223 -0
- package/lib/node/events/eventsServerLogProvider.d.ts +21 -0
- package/lib/node/events/eventsServerLogProvider.js +121 -0
- package/lib/node/events/fetchLogs.d.ts +25 -0
- package/lib/node/events/fetchLogs.js +99 -0
- package/lib/node/events/parse.d.ts +6 -0
- package/lib/node/events/parse.js +106 -0
- package/lib/node/events/pollingLogProvider.d.ts +17 -0
- package/lib/node/events/pollingLogProvider.js +58 -0
- package/lib/node/events/sort.d.ts +2 -0
- package/lib/node/events/sort.js +24 -0
- package/lib/node/events/txEventCache.d.ts +24 -0
- package/lib/node/events/txEventCache.js +71 -0
- package/lib/node/events/types.d.ts +79 -0
- package/lib/node/events/types.js +32 -0
- package/lib/node/events/webSocketLogProvider.d.ts +24 -0
- package/lib/node/events/webSocketLogProvider.js +96 -0
- package/lib/node/factory/bigNum.d.ts +122 -0
- package/lib/node/factory/bigNum.js +457 -0
- package/lib/node/factory/oracleClient.d.ts +5 -0
- package/lib/node/factory/oracleClient.js +56 -0
- package/lib/node/idl/drift.json +14440 -0
- package/lib/node/idl/openbook.json +3854 -0
- package/lib/node/idl/pyth_solana_receiver.json +628 -0
- package/lib/node/idl/switchboard.json +8354 -0
- package/lib/node/idl/switchboard_on_demand_30.json +4546 -0
- package/lib/node/idl/token_faucet.json +142 -0
- package/lib/node/index.d.ts +125 -0
- package/lib/node/index.js +147 -0
- package/lib/node/isomorphic/grpc.browser.d.ts +1 -0
- package/lib/node/isomorphic/grpc.browser.js +8 -0
- package/lib/node/isomorphic/grpc.d.ts +1 -0
- package/lib/node/isomorphic/grpc.js +8 -0
- package/lib/node/jupiter/jupiterClient.d.ts +302 -0
- package/lib/node/jupiter/jupiterClient.js +178 -0
- package/lib/node/keypair.d.ts +2 -0
- package/lib/node/keypair.js +28 -0
- package/lib/node/marinade/index.d.ts +12 -0
- package/lib/node/marinade/index.js +36 -0
- package/lib/node/marinade/types.d.ts +1963 -0
- package/lib/node/marinade/types.js +1965 -0
- package/lib/node/math/amm.d.ts +98 -0
- package/lib/node/math/amm.js +626 -0
- package/lib/node/math/auction.d.ts +23 -0
- package/lib/node/math/auction.js +130 -0
- package/lib/node/math/bankruptcy.d.ts +2 -0
- package/lib/node/math/bankruptcy.js +31 -0
- package/lib/node/math/conversion.d.ts +2 -0
- package/lib/node/math/conversion.js +11 -0
- package/lib/node/math/exchangeStatus.d.ts +6 -0
- package/lib/node/math/exchangeStatus.js +77 -0
- package/lib/node/math/fuel.d.ts +6 -0
- package/lib/node/math/fuel.js +55 -0
- package/lib/node/math/funding.d.ts +34 -0
- package/lib/node/math/funding.js +209 -0
- package/lib/node/math/insurance.d.ts +7 -0
- package/lib/node/math/insurance.js +73 -0
- package/lib/node/math/margin.d.ts +39 -0
- package/lib/node/math/margin.js +184 -0
- package/lib/node/math/market.d.ts +39 -0
- package/lib/node/math/market.js +163 -0
- package/lib/node/math/oracles.d.ts +14 -0
- package/lib/node/math/oracles.js +134 -0
- package/lib/node/math/orders.d.ts +23 -0
- package/lib/node/math/orders.js +216 -0
- package/lib/node/math/position.d.ts +70 -0
- package/lib/node/math/position.js +225 -0
- package/lib/node/math/repeg.d.ts +22 -0
- package/lib/node/math/repeg.js +164 -0
- package/lib/node/math/spotBalance.d.ts +83 -0
- package/lib/node/math/spotBalance.js +373 -0
- package/lib/node/math/spotMarket.d.ts +11 -0
- package/lib/node/math/spotMarket.js +49 -0
- package/lib/node/math/spotPosition.d.ts +19 -0
- package/lib/node/math/spotPosition.js +78 -0
- package/lib/node/math/state.d.ts +5 -0
- package/lib/node/math/state.js +30 -0
- package/lib/node/math/superStake.d.ts +167 -0
- package/lib/node/math/superStake.js +306 -0
- package/lib/node/math/tiers.d.ts +4 -0
- package/lib/node/math/tiers.js +52 -0
- package/lib/node/math/trade.d.ts +117 -0
- package/lib/node/math/trade.js +637 -0
- package/lib/node/math/userStatus.d.ts +2 -0
- package/lib/node/math/userStatus.js +8 -0
- package/lib/node/math/utils.d.ts +23 -0
- package/lib/node/math/utils.js +112 -0
- package/lib/node/memcmp.d.ts +11 -0
- package/lib/node/memcmp.js +99 -0
- package/lib/node/openbook/openbookV2FulfillmentConfigMap.d.ts +10 -0
- package/lib/node/openbook/openbookV2FulfillmentConfigMap.js +17 -0
- package/lib/node/openbook/openbookV2Subscriber.d.ts +36 -0
- package/lib/node/openbook/openbookV2Subscriber.js +104 -0
- package/lib/node/oracles/oracleClientCache.d.ts +9 -0
- package/lib/node/oracles/oracleClientCache.js +19 -0
- package/lib/node/oracles/oracleId.d.ts +4 -0
- package/lib/node/oracles/oracleId.js +38 -0
- package/lib/node/oracles/prelaunchOracleClient.d.ts +12 -0
- package/lib/node/oracles/prelaunchOracleClient.js +24 -0
- package/lib/node/oracles/pythClient.d.ts +14 -0
- package/lib/node/oracles/pythClient.js +51 -0
- package/lib/node/oracles/pythLazerClient.d.ts +16 -0
- package/lib/node/oracles/pythLazerClient.js +61 -0
- package/lib/node/oracles/pythPullClient.d.ts +19 -0
- package/lib/node/oracles/pythPullClient.js +60 -0
- package/lib/node/oracles/quoteAssetOracleClient.d.ts +10 -0
- package/lib/node/oracles/quoteAssetOracleClient.js +21 -0
- package/lib/node/oracles/strictOraclePrice.d.ts +9 -0
- package/lib/node/oracles/strictOraclePrice.js +17 -0
- package/lib/node/oracles/switchboardClient.d.ts +12 -0
- package/lib/node/oracles/switchboardClient.js +40 -0
- package/lib/node/oracles/switchboardOnDemandClient.d.ts +12 -0
- package/lib/node/oracles/switchboardOnDemandClient.js +32 -0
- package/lib/node/oracles/types.d.ts +23 -0
- package/lib/node/oracles/types.js +2 -0
- package/lib/node/orderParams.d.ts +29 -0
- package/lib/node/orderParams.js +44 -0
- package/lib/node/orderSubscriber/OrderSubscriber.d.ts +42 -0
- package/lib/node/orderSubscriber/OrderSubscriber.js +172 -0
- package/lib/node/orderSubscriber/PollingSubscription.d.ts +12 -0
- package/lib/node/orderSubscriber/PollingSubscription.js +23 -0
- package/lib/node/orderSubscriber/WebsocketSubscription.d.ts +23 -0
- package/lib/node/orderSubscriber/WebsocketSubscription.js +67 -0
- package/lib/node/orderSubscriber/grpcSubscription.d.ts +22 -0
- package/lib/node/orderSubscriber/grpcSubscription.js +66 -0
- package/lib/node/orderSubscriber/index.d.ts +2 -0
- package/lib/node/orderSubscriber/index.js +18 -0
- package/lib/node/orderSubscriber/types.d.ts +34 -0
- package/lib/node/orderSubscriber/types.js +2 -0
- package/lib/node/phoenix/phoenixFulfillmentConfigMap.d.ts +10 -0
- package/lib/node/phoenix/phoenixFulfillmentConfigMap.js +17 -0
- package/lib/node/phoenix/phoenixSubscriber.d.ts +41 -0
- package/lib/node/phoenix/phoenixSubscriber.js +152 -0
- package/lib/node/priorityFee/averageOverSlotsStrategy.d.ts +5 -0
- package/lib/node/priorityFee/averageOverSlotsStrategy.js +16 -0
- package/lib/node/priorityFee/averageStrategy.d.ts +5 -0
- package/lib/node/priorityFee/averageStrategy.js +11 -0
- package/lib/node/priorityFee/driftPriorityFeeMethod.d.ts +13 -0
- package/lib/node/priorityFee/driftPriorityFeeMethod.js +26 -0
- package/lib/node/priorityFee/ewmaStrategy.d.ts +11 -0
- package/lib/node/priorityFee/ewmaStrategy.js +33 -0
- package/lib/node/priorityFee/heliusPriorityFeeMethod.d.ts +20 -0
- package/lib/node/priorityFee/heliusPriorityFeeMethod.js +46 -0
- package/lib/node/priorityFee/index.d.ts +11 -0
- package/lib/node/priorityFee/index.js +27 -0
- package/lib/node/priorityFee/maxOverSlotsStrategy.d.ts +5 -0
- package/lib/node/priorityFee/maxOverSlotsStrategy.js +17 -0
- package/lib/node/priorityFee/maxStrategy.d.ts +7 -0
- package/lib/node/priorityFee/maxStrategy.js +9 -0
- package/lib/node/priorityFee/priorityFeeSubscriber.d.ts +46 -0
- package/lib/node/priorityFee/priorityFeeSubscriber.js +188 -0
- package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts +48 -0
- package/lib/node/priorityFee/priorityFeeSubscriberMap.js +88 -0
- package/lib/node/priorityFee/solanaPriorityFeeMethod.d.ts +6 -0
- package/lib/node/priorityFee/solanaPriorityFeeMethod.js +21 -0
- package/lib/node/priorityFee/types.d.ts +31 -0
- package/lib/node/priorityFee/types.js +10 -0
- package/lib/node/serum/serumFulfillmentConfigMap.d.ts +10 -0
- package/lib/node/serum/serumFulfillmentConfigMap.js +17 -0
- package/lib/node/serum/serumSubscriber.d.ts +32 -0
- package/lib/node/serum/serumSubscriber.js +107 -0
- package/lib/node/serum/types.d.ts +13 -0
- package/lib/node/serum/types.js +2 -0
- package/lib/node/slot/SlotSubscriber.d.ts +27 -0
- package/lib/node/slot/SlotSubscriber.js +71 -0
- package/lib/node/slot/SlothashSubscriber.d.ts +26 -0
- package/lib/node/slot/SlothashSubscriber.js +85 -0
- package/lib/node/testClient.d.ts +8 -0
- package/lib/node/testClient.js +23 -0
- package/lib/node/token/index.d.ts +5 -0
- package/lib/node/token/index.js +15 -0
- package/lib/node/tokenFaucet.d.ts +41 -0
- package/lib/node/tokenFaucet.js +188 -0
- package/lib/node/tx/baseTxSender.d.ts +59 -0
- package/lib/node/tx/baseTxSender.js +294 -0
- package/lib/node/tx/blockhashFetcher/baseBlockhashFetcher.d.ts +8 -0
- package/lib/node/tx/blockhashFetcher/baseBlockhashFetcher.js +13 -0
- package/lib/node/tx/blockhashFetcher/cachedBlockhashFetcher.d.ts +28 -0
- package/lib/node/tx/blockhashFetcher/cachedBlockhashFetcher.js +73 -0
- package/lib/node/tx/blockhashFetcher/types.d.ts +4 -0
- package/lib/node/tx/blockhashFetcher/types.js +2 -0
- package/lib/node/tx/fastSingleTxSender.d.ts +41 -0
- package/lib/node/tx/fastSingleTxSender.js +86 -0
- package/lib/node/tx/forwardOnlyTxSender.d.ts +37 -0
- package/lib/node/tx/forwardOnlyTxSender.js +92 -0
- package/lib/node/tx/priorityFeeCalculator.d.ts +44 -0
- package/lib/node/tx/priorityFeeCalculator.js +85 -0
- package/lib/node/tx/reportTransactionError.d.ts +20 -0
- package/lib/node/tx/reportTransactionError.js +103 -0
- package/lib/node/tx/retryTxSender.d.ts +37 -0
- package/lib/node/tx/retryTxSender.js +86 -0
- package/lib/node/tx/txHandler.d.ts +154 -0
- package/lib/node/tx/txHandler.js +453 -0
- package/lib/node/tx/txParamProcessor.d.ts +25 -0
- package/lib/node/tx/txParamProcessor.js +88 -0
- package/lib/node/tx/types.d.ts +29 -0
- package/lib/node/tx/types.js +20 -0
- package/lib/node/tx/utils.d.ts +2 -0
- package/lib/node/tx/utils.js +10 -0
- package/lib/node/tx/whileValidTxSender.d.ts +45 -0
- package/lib/node/tx/whileValidTxSender.js +167 -0
- package/lib/node/types.d.ts +1385 -0
- package/lib/node/types.js +366 -0
- package/lib/node/user.d.ts +411 -0
- package/lib/node/user.js +2151 -0
- package/lib/node/userConfig.d.ts +26 -0
- package/lib/node/userConfig.js +2 -0
- package/lib/node/userMap/PollingSubscription.d.ts +16 -0
- package/lib/node/userMap/PollingSubscription.js +30 -0
- package/lib/node/userMap/WebsocketSubscription.d.ts +27 -0
- package/lib/node/userMap/WebsocketSubscription.js +45 -0
- package/lib/node/userMap/grpcSubscription.d.ts +27 -0
- package/lib/node/userMap/grpcSubscription.js +44 -0
- package/lib/node/userMap/referrerMap.d.ts +45 -0
- package/lib/node/userMap/referrerMap.js +181 -0
- package/lib/node/userMap/userMap.d.ts +90 -0
- package/lib/node/userMap/userMap.js +467 -0
- package/lib/node/userMap/userMapConfig.d.ts +39 -0
- package/lib/node/userMap/userMapConfig.js +2 -0
- package/lib/node/userMap/userStatsMap.d.ts +46 -0
- package/lib/node/userMap/userStatsMap.js +165 -0
- package/lib/node/userName.d.ts +5 -0
- package/lib/node/userName.js +21 -0
- package/lib/node/userStats.d.ts +22 -0
- package/lib/node/userStats.js +91 -0
- package/lib/node/userStatsConfig.d.ts +25 -0
- package/lib/node/userStatsConfig.js +2 -0
- package/lib/node/util/TransactionConfirmationManager.d.ts +16 -0
- package/lib/node/util/TransactionConfirmationManager.js +174 -0
- package/lib/node/util/chainClock.d.ts +17 -0
- package/lib/node/util/chainClock.js +29 -0
- package/lib/node/util/computeUnits.d.ts +8 -0
- package/lib/node/util/computeUnits.js +48 -0
- package/lib/node/util/digest.d.ts +4 -0
- package/lib/node/util/digest.js +14 -0
- package/lib/node/util/promiseTimeout.d.ts +1 -0
- package/lib/node/util/promiseTimeout.js +14 -0
- package/lib/node/util/pythOracleUtils.d.ts +17 -0
- package/lib/node/util/pythOracleUtils.js +107 -0
- package/lib/node/util/tps.d.ts +2 -0
- package/lib/node/util/tps.js +16 -0
- package/lib/node/wallet.d.ts +11 -0
- package/lib/node/wallet.js +32 -0
- package/package.json +92 -0
- package/scripts/postbuild.js +95 -0
- package/scripts/updateVersion.js +28 -0
- package/src/accounts/basicUserAccountSubscriber.ts +59 -0
- package/src/accounts/bulkAccountLoader.ts +294 -0
- package/src/accounts/bulkUserStatsSubscription.ts +33 -0
- package/src/accounts/bulkUserSubscription.ts +33 -0
- package/src/accounts/fetch.ts +66 -0
- package/src/accounts/grpcAccountSubscriber.ts +160 -0
- package/src/accounts/grpcDriftClientAccountSubscriber.ts +203 -0
- package/src/accounts/grpcInsuranceFundStakeAccountSubscriber.ts +56 -0
- package/src/accounts/grpcProgramAccountSubscriber.ts +190 -0
- package/src/accounts/grpcUserAccountSubscriber.ts +48 -0
- package/src/accounts/grpcUserStatsAccountSubscriber.ts +50 -0
- package/src/accounts/oneShotUserAccountSubscriber.ts +68 -0
- package/src/accounts/pollingDriftClientAccountSubscriber.ts +644 -0
- package/src/accounts/pollingHighLeverageModeConfigAccountSubscriber.ts +189 -0
- package/src/accounts/pollingInsuranceFundStakeAccountSubscriber.ts +185 -0
- package/src/accounts/pollingOracleAccountSubscriber.ts +125 -0
- package/src/accounts/pollingTokenAccountSubscriber.ts +118 -0
- package/src/accounts/pollingUserAccountSubscriber.ts +160 -0
- package/src/accounts/pollingUserStatsAccountSubscriber.ts +156 -0
- package/src/accounts/testBulkAccountLoader.ts +53 -0
- package/src/accounts/types.ts +245 -0
- package/src/accounts/utils.ts +62 -0
- package/src/accounts/webSocketAccountSubscriber.ts +205 -0
- package/src/accounts/webSocketDriftClientAccountSubscriber.ts +621 -0
- package/src/accounts/webSocketHighLeverageModeConfigAccountSubscriber.ts +131 -0
- package/src/accounts/webSocketInsuranceFundStakeAccountSubscriber.ts +129 -0
- package/src/accounts/webSocketProgramAccountSubscriber.ts +182 -0
- package/src/accounts/webSocketUserAccountSubscriber.ts +104 -0
- package/src/accounts/webSocketUserStatsAccountSubsriber.ts +98 -0
- package/src/addresses/marketAddresses.ts +17 -0
- package/src/addresses/pda.ts +355 -0
- package/src/adminClient.ts +4030 -0
- package/src/assert/assert.ts +5 -0
- package/src/auctionSubscriber/auctionSubscriber.ts +66 -0
- package/src/auctionSubscriber/auctionSubscriberGrpc.ts +70 -0
- package/src/auctionSubscriber/index.ts +3 -0
- package/src/auctionSubscriber/types.ts +20 -0
- package/src/bankrun/bankrunConnection.ts +534 -0
- package/src/blockhashSubscriber/BlockhashSubscriber.ts +126 -0
- package/src/blockhashSubscriber/index.ts +1 -0
- package/src/blockhashSubscriber/types.ts +12 -0
- package/src/clock/clockSubscriber.ts +121 -0
- package/src/config.ts +212 -0
- package/src/constants/numericConstants.ts +113 -0
- package/src/constants/perpMarkets.ts +1084 -0
- package/src/constants/spotMarkets.ts +565 -0
- package/src/constants/txConstants.ts +1 -0
- package/src/decode/phoenix.ts +207 -0
- package/src/decode/user.ts +368 -0
- package/src/dlob/DLOB.ts +1897 -0
- package/src/dlob/DLOBNode.ts +197 -0
- package/src/dlob/DLOBSubscriber.ts +201 -0
- package/src/dlob/NodeList.ts +173 -0
- package/src/dlob/orderBookLevels.ts +643 -0
- package/src/dlob/types.ts +22 -0
- package/src/driftClient.ts +9032 -0
- package/src/driftClientConfig.ts +60 -0
- package/src/events/eventList.ts +97 -0
- package/src/events/eventSubscriber.ts +364 -0
- package/src/events/eventsServerLogProvider.ts +152 -0
- package/src/events/fetchLogs.ts +169 -0
- package/src/events/parse.ts +133 -0
- package/src/events/pollingLogProvider.ts +89 -0
- package/src/events/sort.ts +39 -0
- package/src/events/txEventCache.ts +74 -0
- package/src/events/types.ts +185 -0
- package/src/events/webSocketLogProvider.ts +121 -0
- package/src/factory/bigNum.ts +660 -0
- package/src/factory/oracleClient.ts +72 -0
- package/src/idl/drift.json +14440 -0
- package/src/idl/openbook.json +3854 -0
- package/src/idl/pyth.json +142 -0
- package/src/idl/pyth_solana_receiver.json +628 -0
- package/src/idl/switchboard.json +8354 -0
- package/src/idl/switchboard_on_demand_30.json +4546 -0
- package/src/idl/token_faucet.json +142 -0
- package/src/index.ts +127 -0
- package/src/isomorphic/README.md +19 -0
- package/src/isomorphic/grpc.browser.ts +4 -0
- package/src/isomorphic/grpc.node.ts +23 -0
- package/src/isomorphic/grpc.ts +1 -0
- package/src/jupiter/jupiterClient.ts +510 -0
- package/src/keypair.ts +24 -0
- package/src/marinade/idl/idl.json +1962 -0
- package/src/marinade/index.ts +64 -0
- package/src/marinade/types.ts +3925 -0
- package/src/math/amm.ts +1162 -0
- package/src/math/auction.ts +173 -0
- package/src/math/bankruptcy.ts +34 -0
- package/src/math/conversion.ts +13 -0
- package/src/math/exchangeStatus.ts +121 -0
- package/src/math/fuel.ts +70 -0
- package/src/math/funding.ts +342 -0
- package/src/math/insurance.ts +110 -0
- package/src/math/margin.ts +340 -0
- package/src/math/market.ts +336 -0
- package/src/math/oracles.ts +228 -0
- package/src/math/orders.ts +343 -0
- package/src/math/position.ts +324 -0
- package/src/math/repeg.ts +214 -0
- package/src/math/spotBalance.ts +630 -0
- package/src/math/spotMarket.ts +82 -0
- package/src/math/spotPosition.ts +184 -0
- package/src/math/state.ts +29 -0
- package/src/math/superStake.ts +525 -0
- package/src/math/tiers.ts +44 -0
- package/src/math/trade.ts +993 -0
- package/src/math/userStatus.ts +5 -0
- package/src/math/utils.ts +120 -0
- package/src/memcmp.ts +94 -0
- package/src/openbook/openbookV2FulfillmentConfigMap.ts +29 -0
- package/src/openbook/openbookV2Subscriber.ts +165 -0
- package/src/oracles/oracleClientCache.ts +25 -0
- package/src/oracles/oracleId.ts +28 -0
- package/src/oracles/prelaunchOracleClient.ts +37 -0
- package/src/oracles/pythClient.ts +85 -0
- package/src/oracles/pythLazerClient.ts +102 -0
- package/src/oracles/pythPullClient.ts +111 -0
- package/src/oracles/quoteAssetOracleClient.ts +25 -0
- package/src/oracles/strictOraclePrice.ts +19 -0
- package/src/oracles/switchboardClient.ts +77 -0
- package/src/oracles/switchboardOnDemandClient.ts +56 -0
- package/src/oracles/types.ts +23 -0
- package/src/orderParams.ts +79 -0
- package/src/orderSubscriber/OrderSubscriber.ts +249 -0
- package/src/orderSubscriber/PollingSubscription.ts +39 -0
- package/src/orderSubscriber/WebsocketSubscription.ts +119 -0
- package/src/orderSubscriber/grpcSubscription.ts +121 -0
- package/src/orderSubscriber/index.ts +2 -0
- package/src/orderSubscriber/types.ts +54 -0
- package/src/phoenix/phoenixFulfillmentConfigMap.ts +26 -0
- package/src/phoenix/phoenixSubscriber.ts +235 -0
- package/src/priorityFee/averageOverSlotsStrategy.ts +16 -0
- package/src/priorityFee/averageStrategy.ts +12 -0
- package/src/priorityFee/driftPriorityFeeMethod.ts +42 -0
- package/src/priorityFee/ewmaStrategy.ts +41 -0
- package/src/priorityFee/heliusPriorityFeeMethod.ts +57 -0
- package/src/priorityFee/index.ts +11 -0
- package/src/priorityFee/maxOverSlotsStrategy.ts +17 -0
- package/src/priorityFee/maxStrategy.ts +7 -0
- package/src/priorityFee/priorityFeeSubscriber.ts +251 -0
- package/src/priorityFee/priorityFeeSubscriberMap.ts +112 -0
- package/src/priorityFee/solanaPriorityFeeMethod.ts +34 -0
- package/src/priorityFee/types.ts +60 -0
- package/src/serum/serumFulfillmentConfigMap.ts +26 -0
- package/src/serum/serumSubscriber.ts +169 -0
- package/src/serum/types.ts +17 -0
- package/src/slot/SlotSubscriber.ts +101 -0
- package/src/slot/SlothashSubscriber.ts +126 -0
- package/src/testClient.ts +41 -0
- package/src/token/index.ts +13 -0
- package/src/tokenFaucet.ts +269 -0
- package/src/tx/baseTxSender.ts +477 -0
- package/src/tx/blockhashFetcher/baseBlockhashFetcher.ts +19 -0
- package/src/tx/blockhashFetcher/cachedBlockhashFetcher.ts +90 -0
- package/src/tx/blockhashFetcher/types.ts +5 -0
- package/src/tx/fastSingleTxSender.ts +142 -0
- package/src/tx/forwardOnlyTxSender.ts +145 -0
- package/src/tx/priorityFeeCalculator.ts +117 -0
- package/src/tx/reportTransactionError.ts +159 -0
- package/src/tx/retryTxSender.ts +135 -0
- package/src/tx/txHandler.ts +737 -0
- package/src/tx/txParamProcessor.ts +155 -0
- package/src/tx/types.ts +71 -0
- package/src/tx/utils.ts +11 -0
- package/src/tx/whileValidTxSender.ts +265 -0
- package/src/types.ts +1386 -0
- package/src/user.ts +4054 -0
- package/src/userConfig.ts +32 -0
- package/src/userMap/PollingSubscription.ts +47 -0
- package/src/userMap/WebsocketSubscription.ts +84 -0
- package/src/userMap/grpcSubscription.ts +85 -0
- package/src/userMap/referrerMap.ts +267 -0
- package/src/userMap/userMap.ts +654 -0
- package/src/userMap/userMapConfig.ts +63 -0
- package/src/userMap/userStatsMap.ts +218 -0
- package/src/userName.ts +21 -0
- package/src/userStats.ts +174 -0
- package/src/userStatsConfig.ts +31 -0
- package/src/util/TransactionConfirmationManager.ts +292 -0
- package/src/util/chainClock.ts +41 -0
- package/src/util/computeUnits.ts +65 -0
- package/src/util/digest.ts +11 -0
- package/src/util/promiseTimeout.ts +14 -0
- package/src/util/pythOracleUtils.ts +136 -0
- package/src/util/tps.ts +27 -0
- package/src/wallet.ts +43 -0
- package/tests/amm/test.ts +2092 -0
- package/tests/auctions/test.ts +81 -0
- package/tests/bn/test.ts +341 -0
- package/tests/ci/idl.ts +101 -0
- package/tests/ci/verifyConstants.ts +278 -0
- package/tests/decode/phoenix.ts +71 -0
- package/tests/decode/test.ts +266 -0
- package/tests/decode/userAccountBufferStrings.ts +102 -0
- package/tests/dlob/helpers.ts +749 -0
- package/tests/dlob/test.ts +6623 -0
- package/tests/insurance/test.ts +40 -0
- package/tests/spot/test.ts +226 -0
- package/tests/subscriber/openbook.ts +62 -0
- package/tests/tx/TransactionConfirmationManager.test.ts +305 -0
- package/tests/tx/cachedBlockhashFetcher.test.ts +96 -0
- package/tests/tx/priorityFeeCalculator.ts +77 -0
- package/tests/tx/priorityFeeStrategy.ts +95 -0
- package/tests/user/helpers.ts +92 -0
- package/tests/user/test.ts +517 -0
- package/tsconfig.browser.json +13 -0
- package/tsconfig.json +13 -0
|
@@ -0,0 +1,1385 @@
|
|
|
1
|
+
/// <reference types="bn.js" />
|
|
2
|
+
import { Keypair, PublicKey, Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
3
|
+
import { BN } from '.';
|
|
4
|
+
export type MappedRecord<A extends Record<string, unknown>, B> = {
|
|
5
|
+
[K in keyof A]: B;
|
|
6
|
+
};
|
|
7
|
+
export declare enum ExchangeStatus {
|
|
8
|
+
ACTIVE = 0,
|
|
9
|
+
DEPOSIT_PAUSED = 1,
|
|
10
|
+
WITHDRAW_PAUSED = 2,
|
|
11
|
+
AMM_PAUSED = 4,
|
|
12
|
+
FILL_PAUSED = 8,
|
|
13
|
+
LIQ_PAUSED = 16,
|
|
14
|
+
FUNDING_PAUSED = 32,
|
|
15
|
+
SETTLE_PNL_PAUSED = 64,
|
|
16
|
+
AMM_IMMEDIATE_FILL_PAUSED = 128,
|
|
17
|
+
PAUSED = 255
|
|
18
|
+
}
|
|
19
|
+
export declare class MarketStatus {
|
|
20
|
+
static readonly INITIALIZED: {
|
|
21
|
+
initialized: {};
|
|
22
|
+
};
|
|
23
|
+
static readonly ACTIVE: {
|
|
24
|
+
active: {};
|
|
25
|
+
};
|
|
26
|
+
static readonly FUNDING_PAUSED: {
|
|
27
|
+
fundingPaused: {};
|
|
28
|
+
};
|
|
29
|
+
static readonly AMM_PAUSED: {
|
|
30
|
+
ammPaused: {};
|
|
31
|
+
};
|
|
32
|
+
static readonly FILL_PAUSED: {
|
|
33
|
+
fillPaused: {};
|
|
34
|
+
};
|
|
35
|
+
static readonly WITHDRAW_PAUSED: {
|
|
36
|
+
withdrawPaused: {};
|
|
37
|
+
};
|
|
38
|
+
static readonly REDUCE_ONLY: {
|
|
39
|
+
reduceOnly: {};
|
|
40
|
+
};
|
|
41
|
+
static readonly SETTLEMENT: {
|
|
42
|
+
settlement: {};
|
|
43
|
+
};
|
|
44
|
+
static readonly DELISTED: {
|
|
45
|
+
delisted: {};
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export declare enum PerpOperation {
|
|
49
|
+
UPDATE_FUNDING = 1,
|
|
50
|
+
AMM_FILL = 2,
|
|
51
|
+
FILL = 4,
|
|
52
|
+
SETTLE_PNL = 8,
|
|
53
|
+
SETTLE_PNL_WITH_POSITION = 16,
|
|
54
|
+
LIQUIDATION = 32
|
|
55
|
+
}
|
|
56
|
+
export declare enum SpotOperation {
|
|
57
|
+
UPDATE_CUMULATIVE_INTEREST = 1,
|
|
58
|
+
FILL = 2,
|
|
59
|
+
DEPOSIT = 4,
|
|
60
|
+
WITHDRAW = 8,
|
|
61
|
+
LIQUIDATION = 16
|
|
62
|
+
}
|
|
63
|
+
export declare enum InsuranceFundOperation {
|
|
64
|
+
INIT = 1,
|
|
65
|
+
ADD = 2,
|
|
66
|
+
REQUEST_REMOVE = 4,
|
|
67
|
+
REMOVE = 8
|
|
68
|
+
}
|
|
69
|
+
export declare enum UserStatus {
|
|
70
|
+
BEING_LIQUIDATED = 1,
|
|
71
|
+
BANKRUPT = 2,
|
|
72
|
+
REDUCE_ONLY = 4,
|
|
73
|
+
ADVANCED_LP = 8,
|
|
74
|
+
PROTECTED_MAKER = 16
|
|
75
|
+
}
|
|
76
|
+
export declare class MarginMode {
|
|
77
|
+
static readonly DEFAULT: {
|
|
78
|
+
default: {};
|
|
79
|
+
};
|
|
80
|
+
static readonly HIGH_LEVERAGE: {
|
|
81
|
+
highLeverage: {};
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export declare class ContractType {
|
|
85
|
+
static readonly PERPETUAL: {
|
|
86
|
+
perpetual: {};
|
|
87
|
+
};
|
|
88
|
+
static readonly FUTURE: {
|
|
89
|
+
future: {};
|
|
90
|
+
};
|
|
91
|
+
static readonly PREDICTION: {
|
|
92
|
+
prediction: {};
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
export declare class ContractTier {
|
|
96
|
+
static readonly A: {
|
|
97
|
+
a: {};
|
|
98
|
+
};
|
|
99
|
+
static readonly B: {
|
|
100
|
+
b: {};
|
|
101
|
+
};
|
|
102
|
+
static readonly C: {
|
|
103
|
+
c: {};
|
|
104
|
+
};
|
|
105
|
+
static readonly SPECULATIVE: {
|
|
106
|
+
speculative: {};
|
|
107
|
+
};
|
|
108
|
+
static readonly HIGHLY_SPECULATIVE: {
|
|
109
|
+
highlySpeculative: {};
|
|
110
|
+
};
|
|
111
|
+
static readonly ISOLATED: {
|
|
112
|
+
isolated: {};
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
export declare class AssetTier {
|
|
116
|
+
static readonly COLLATERAL: {
|
|
117
|
+
collateral: {};
|
|
118
|
+
};
|
|
119
|
+
static readonly PROTECTED: {
|
|
120
|
+
protected: {};
|
|
121
|
+
};
|
|
122
|
+
static readonly CROSS: {
|
|
123
|
+
cross: {};
|
|
124
|
+
};
|
|
125
|
+
static readonly ISOLATED: {
|
|
126
|
+
isolated: {};
|
|
127
|
+
};
|
|
128
|
+
static readonly UNLISTED: {
|
|
129
|
+
unlisted: {};
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
export declare class SwapDirection {
|
|
133
|
+
static readonly ADD: {
|
|
134
|
+
add: {};
|
|
135
|
+
};
|
|
136
|
+
static readonly REMOVE: {
|
|
137
|
+
remove: {};
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
export declare class SpotBalanceType {
|
|
141
|
+
static readonly DEPOSIT: {
|
|
142
|
+
deposit: {};
|
|
143
|
+
};
|
|
144
|
+
static readonly BORROW: {
|
|
145
|
+
borrow: {};
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
export declare class PositionDirection {
|
|
149
|
+
static readonly LONG: {
|
|
150
|
+
long: {};
|
|
151
|
+
};
|
|
152
|
+
static readonly SHORT: {
|
|
153
|
+
short: {};
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
export declare class DepositDirection {
|
|
157
|
+
static readonly DEPOSIT: {
|
|
158
|
+
deposit: {};
|
|
159
|
+
};
|
|
160
|
+
static readonly WITHDRAW: {
|
|
161
|
+
withdraw: {};
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
export declare class OracleSource {
|
|
165
|
+
static readonly PYTH: {
|
|
166
|
+
pyth: {};
|
|
167
|
+
};
|
|
168
|
+
static readonly PYTH_1K: {
|
|
169
|
+
pyth1K: {};
|
|
170
|
+
};
|
|
171
|
+
static readonly PYTH_1M: {
|
|
172
|
+
pyth1M: {};
|
|
173
|
+
};
|
|
174
|
+
static readonly PYTH_PULL: {
|
|
175
|
+
pythPull: {};
|
|
176
|
+
};
|
|
177
|
+
static readonly PYTH_1K_PULL: {
|
|
178
|
+
pyth1KPull: {};
|
|
179
|
+
};
|
|
180
|
+
static readonly PYTH_1M_PULL: {
|
|
181
|
+
pyth1MPull: {};
|
|
182
|
+
};
|
|
183
|
+
static readonly SWITCHBOARD: {
|
|
184
|
+
switchboard: {};
|
|
185
|
+
};
|
|
186
|
+
static readonly QUOTE_ASSET: {
|
|
187
|
+
quoteAsset: {};
|
|
188
|
+
};
|
|
189
|
+
static readonly PYTH_STABLE_COIN: {
|
|
190
|
+
pythStableCoin: {};
|
|
191
|
+
};
|
|
192
|
+
static readonly PYTH_STABLE_COIN_PULL: {
|
|
193
|
+
pythStableCoinPull: {};
|
|
194
|
+
};
|
|
195
|
+
static readonly Prelaunch: {
|
|
196
|
+
prelaunch: {};
|
|
197
|
+
};
|
|
198
|
+
static readonly SWITCHBOARD_ON_DEMAND: {
|
|
199
|
+
switchboardOnDemand: {};
|
|
200
|
+
};
|
|
201
|
+
static readonly PYTH_LAZER: {
|
|
202
|
+
pythLazer: {};
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
export declare class OracleSourceNum {
|
|
206
|
+
static readonly PYTH = 0;
|
|
207
|
+
static readonly PYTH_1K = 1;
|
|
208
|
+
static readonly PYTH_1M = 2;
|
|
209
|
+
static readonly PYTH_PULL = 3;
|
|
210
|
+
static readonly PYTH_1K_PULL = 4;
|
|
211
|
+
static readonly PYTH_1M_PULL = 5;
|
|
212
|
+
static readonly SWITCHBOARD = 6;
|
|
213
|
+
static readonly QUOTE_ASSET = 7;
|
|
214
|
+
static readonly PYTH_STABLE_COIN = 8;
|
|
215
|
+
static readonly PYTH_STABLE_COIN_PULL = 9;
|
|
216
|
+
static readonly PRELAUNCH = 10;
|
|
217
|
+
static readonly SWITCHBOARD_ON_DEMAND = 11;
|
|
218
|
+
static readonly PYTH_LAZER = 12;
|
|
219
|
+
}
|
|
220
|
+
export declare class OrderType {
|
|
221
|
+
static readonly LIMIT: {
|
|
222
|
+
limit: {};
|
|
223
|
+
};
|
|
224
|
+
static readonly TRIGGER_MARKET: {
|
|
225
|
+
triggerMarket: {};
|
|
226
|
+
};
|
|
227
|
+
static readonly TRIGGER_LIMIT: {
|
|
228
|
+
triggerLimit: {};
|
|
229
|
+
};
|
|
230
|
+
static readonly MARKET: {
|
|
231
|
+
market: {};
|
|
232
|
+
};
|
|
233
|
+
static readonly ORACLE: {
|
|
234
|
+
oracle: {};
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
export declare type MarketTypeStr = 'perp' | 'spot';
|
|
238
|
+
export declare class MarketType {
|
|
239
|
+
static readonly SPOT: {
|
|
240
|
+
spot: {};
|
|
241
|
+
};
|
|
242
|
+
static readonly PERP: {
|
|
243
|
+
perp: {};
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
export declare class OrderStatus {
|
|
247
|
+
static readonly INIT: {
|
|
248
|
+
init: {};
|
|
249
|
+
};
|
|
250
|
+
static readonly OPEN: {
|
|
251
|
+
open: {};
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
export declare class OrderAction {
|
|
255
|
+
static readonly PLACE: {
|
|
256
|
+
place: {};
|
|
257
|
+
};
|
|
258
|
+
static readonly CANCEL: {
|
|
259
|
+
cancel: {};
|
|
260
|
+
};
|
|
261
|
+
static readonly EXPIRE: {
|
|
262
|
+
expire: {};
|
|
263
|
+
};
|
|
264
|
+
static readonly FILL: {
|
|
265
|
+
fill: {};
|
|
266
|
+
};
|
|
267
|
+
static readonly TRIGGER: {
|
|
268
|
+
trigger: {};
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
export declare class OrderActionExplanation {
|
|
272
|
+
static readonly NONE: {
|
|
273
|
+
none: {};
|
|
274
|
+
};
|
|
275
|
+
static readonly INSUFFICIENT_FREE_COLLATERAL: {
|
|
276
|
+
insufficientFreeCollateral: {};
|
|
277
|
+
};
|
|
278
|
+
static readonly ORACLE_PRICE_BREACHED_LIMIT_PRICE: {
|
|
279
|
+
oraclePriceBreachedLimitPrice: {};
|
|
280
|
+
};
|
|
281
|
+
static readonly MARKET_ORDER_FILLED_TO_LIMIT_PRICE: {
|
|
282
|
+
marketOrderFilledToLimitPrice: {};
|
|
283
|
+
};
|
|
284
|
+
static readonly ORDER_EXPIRED: {
|
|
285
|
+
orderExpired: {};
|
|
286
|
+
};
|
|
287
|
+
static readonly LIQUIDATION: {
|
|
288
|
+
liquidation: {};
|
|
289
|
+
};
|
|
290
|
+
static readonly ORDER_FILLED_WITH_AMM: {
|
|
291
|
+
orderFilledWithAmm: {};
|
|
292
|
+
};
|
|
293
|
+
static readonly ORDER_FILLED_WITH_AMM_JIT: {
|
|
294
|
+
orderFilledWithAmmJit: {};
|
|
295
|
+
};
|
|
296
|
+
static readonly ORDER_FILLED_WITH_AMM_JIT_LP_SPLIT: {
|
|
297
|
+
orderFilledWithAmmJitLpSplit: {};
|
|
298
|
+
};
|
|
299
|
+
static readonly ORDER_FILLED_WITH_LP_JIT: {
|
|
300
|
+
orderFilledWithLpJit: {};
|
|
301
|
+
};
|
|
302
|
+
static readonly ORDER_FILLED_WITH_MATCH: {
|
|
303
|
+
orderFilledWithMatch: {};
|
|
304
|
+
};
|
|
305
|
+
static readonly ORDER_FILLED_WITH_MATCH_JIT: {
|
|
306
|
+
orderFilledWithMatchJit: {};
|
|
307
|
+
};
|
|
308
|
+
static readonly MARKET_EXPIRED: {
|
|
309
|
+
marketExpired: {};
|
|
310
|
+
};
|
|
311
|
+
static readonly RISK_INCREASING_ORDER: {
|
|
312
|
+
riskingIncreasingOrder: {};
|
|
313
|
+
};
|
|
314
|
+
static readonly ORDER_FILLED_WITH_SERUM: {
|
|
315
|
+
orderFillWithSerum: {};
|
|
316
|
+
};
|
|
317
|
+
static readonly ORDER_FILLED_WITH_OPENBOOK_V2: {
|
|
318
|
+
orderFilledWithOpenbookV2: {};
|
|
319
|
+
};
|
|
320
|
+
static readonly ORDER_FILLED_WITH_PHOENIX: {
|
|
321
|
+
orderFillWithPhoenix: {};
|
|
322
|
+
};
|
|
323
|
+
static readonly REDUCE_ONLY_ORDER_INCREASED_POSITION: {
|
|
324
|
+
reduceOnlyOrderIncreasedPosition: {};
|
|
325
|
+
};
|
|
326
|
+
static readonly DERISK_LP: {
|
|
327
|
+
deriskLp: {};
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
export declare class OrderTriggerCondition {
|
|
331
|
+
static readonly ABOVE: {
|
|
332
|
+
above: {};
|
|
333
|
+
};
|
|
334
|
+
static readonly BELOW: {
|
|
335
|
+
below: {};
|
|
336
|
+
};
|
|
337
|
+
static readonly TRIGGERED_ABOVE: {
|
|
338
|
+
triggeredAbove: {};
|
|
339
|
+
};
|
|
340
|
+
static readonly TRIGGERED_BELOW: {
|
|
341
|
+
triggeredBelow: {};
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
export declare class SpotFulfillmentType {
|
|
345
|
+
static readonly EXTERNAL: {
|
|
346
|
+
external: {};
|
|
347
|
+
};
|
|
348
|
+
static readonly MATCH: {
|
|
349
|
+
match: {};
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
export declare class SpotFulfillmentStatus {
|
|
353
|
+
static readonly ENABLED: {
|
|
354
|
+
enabled: {};
|
|
355
|
+
};
|
|
356
|
+
static readonly DISABLED: {
|
|
357
|
+
disabled: {};
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
export declare class DepositExplanation {
|
|
361
|
+
static readonly NONE: {
|
|
362
|
+
none: {};
|
|
363
|
+
};
|
|
364
|
+
static readonly TRANSFER: {
|
|
365
|
+
transfer: {};
|
|
366
|
+
};
|
|
367
|
+
static readonly BORROW: {
|
|
368
|
+
borrow: {};
|
|
369
|
+
};
|
|
370
|
+
static readonly REPAY_BORROW: {
|
|
371
|
+
repayBorrow: {};
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
export declare class SettlePnlExplanation {
|
|
375
|
+
static readonly NONE: {
|
|
376
|
+
none: {};
|
|
377
|
+
};
|
|
378
|
+
static readonly EXPIRED_POSITION: {
|
|
379
|
+
expiredPosition: {};
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
export declare class SpotFulfillmentConfigStatus {
|
|
383
|
+
static readonly ENABLED: {
|
|
384
|
+
enabled: {};
|
|
385
|
+
};
|
|
386
|
+
static readonly DISABLED: {
|
|
387
|
+
disabled: {};
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
export declare class StakeAction {
|
|
391
|
+
static readonly STAKE: {
|
|
392
|
+
stake: {};
|
|
393
|
+
};
|
|
394
|
+
static readonly UNSTAKE_REQUEST: {
|
|
395
|
+
unstakeRequest: {};
|
|
396
|
+
};
|
|
397
|
+
static readonly UNSTAKE_CANCEL_REQUEST: {
|
|
398
|
+
unstakeCancelRequest: {};
|
|
399
|
+
};
|
|
400
|
+
static readonly UNSTAKE: {
|
|
401
|
+
unstake: {};
|
|
402
|
+
};
|
|
403
|
+
static readonly UNSTAKE_TRANSFER: {
|
|
404
|
+
unstakeTransfer: {};
|
|
405
|
+
};
|
|
406
|
+
static readonly STAKE_TRANSFER: {
|
|
407
|
+
stakeTransfer: {};
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
export declare class SettlePnlMode {
|
|
411
|
+
static readonly TRY_SETTLE: {
|
|
412
|
+
trySettle: {};
|
|
413
|
+
};
|
|
414
|
+
static readonly MUST_SETTLE: {
|
|
415
|
+
mustSettle: {};
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
export declare function isVariant(object: unknown, type: string): boolean;
|
|
419
|
+
export declare function isOneOfVariant(object: unknown, types: string[]): boolean;
|
|
420
|
+
export declare function getVariant(object: unknown): string;
|
|
421
|
+
export declare enum TradeSide {
|
|
422
|
+
None = 0,
|
|
423
|
+
Buy = 1,
|
|
424
|
+
Sell = 2
|
|
425
|
+
}
|
|
426
|
+
export type CandleResolution = '1' | '5' | '15' | '60' | '240' | 'D' | 'W' | 'M';
|
|
427
|
+
export type NewUserRecord = {
|
|
428
|
+
ts: BN;
|
|
429
|
+
userAuthority: PublicKey;
|
|
430
|
+
user: PublicKey;
|
|
431
|
+
subAccountId: number;
|
|
432
|
+
name: number[];
|
|
433
|
+
referrer: PublicKey;
|
|
434
|
+
};
|
|
435
|
+
export type DepositRecord = {
|
|
436
|
+
ts: BN;
|
|
437
|
+
userAuthority: PublicKey;
|
|
438
|
+
user: PublicKey;
|
|
439
|
+
direction: {
|
|
440
|
+
deposit?: any;
|
|
441
|
+
withdraw?: any;
|
|
442
|
+
};
|
|
443
|
+
marketIndex: number;
|
|
444
|
+
amount: BN;
|
|
445
|
+
oraclePrice: BN;
|
|
446
|
+
marketDepositBalance: BN;
|
|
447
|
+
marketWithdrawBalance: BN;
|
|
448
|
+
marketCumulativeDepositInterest: BN;
|
|
449
|
+
marketCumulativeBorrowInterest: BN;
|
|
450
|
+
totalDepositsAfter: BN;
|
|
451
|
+
totalWithdrawsAfter: BN;
|
|
452
|
+
depositRecordId: BN;
|
|
453
|
+
explanation: DepositExplanation;
|
|
454
|
+
transferUser?: PublicKey;
|
|
455
|
+
};
|
|
456
|
+
export type SpotInterestRecord = {
|
|
457
|
+
ts: BN;
|
|
458
|
+
marketIndex: number;
|
|
459
|
+
depositBalance: BN;
|
|
460
|
+
cumulativeDepositInterest: BN;
|
|
461
|
+
borrowBalance: BN;
|
|
462
|
+
cumulativeBorrowInterest: BN;
|
|
463
|
+
optimalUtilization: number;
|
|
464
|
+
optimalBorrowRate: number;
|
|
465
|
+
maxBorrowRate: number;
|
|
466
|
+
};
|
|
467
|
+
export type CurveRecord = {
|
|
468
|
+
ts: BN;
|
|
469
|
+
recordId: BN;
|
|
470
|
+
marketIndex: number;
|
|
471
|
+
pegMultiplierBefore: BN;
|
|
472
|
+
baseAssetReserveBefore: BN;
|
|
473
|
+
quoteAssetReserveBefore: BN;
|
|
474
|
+
sqrtKBefore: BN;
|
|
475
|
+
pegMultiplierAfter: BN;
|
|
476
|
+
baseAssetReserveAfter: BN;
|
|
477
|
+
quoteAssetReserveAfter: BN;
|
|
478
|
+
sqrtKAfter: BN;
|
|
479
|
+
baseAssetAmountLong: BN;
|
|
480
|
+
baseAssetAmountShort: BN;
|
|
481
|
+
baseAssetAmountWithAmm: BN;
|
|
482
|
+
totalFee: BN;
|
|
483
|
+
totalFeeMinusDistributions: BN;
|
|
484
|
+
adjustmentCost: BN;
|
|
485
|
+
numberOfUsers: BN;
|
|
486
|
+
oraclePrice: BN;
|
|
487
|
+
fillRecord: BN;
|
|
488
|
+
};
|
|
489
|
+
export declare type InsuranceFundRecord = {
|
|
490
|
+
ts: BN;
|
|
491
|
+
spotMarketIndex: number;
|
|
492
|
+
perpMarketIndex: number;
|
|
493
|
+
userIfFactor: number;
|
|
494
|
+
totalIfFactor: number;
|
|
495
|
+
vaultAmountBefore: BN;
|
|
496
|
+
insuranceVaultAmountBefore: BN;
|
|
497
|
+
totalIfSharesBefore: BN;
|
|
498
|
+
totalIfSharesAfter: BN;
|
|
499
|
+
amount: BN;
|
|
500
|
+
};
|
|
501
|
+
export declare type InsuranceFundStakeRecord = {
|
|
502
|
+
ts: BN;
|
|
503
|
+
userAuthority: PublicKey;
|
|
504
|
+
action: StakeAction;
|
|
505
|
+
amount: BN;
|
|
506
|
+
marketIndex: number;
|
|
507
|
+
insuranceVaultAmountBefore: BN;
|
|
508
|
+
ifSharesBefore: BN;
|
|
509
|
+
userIfSharesBefore: BN;
|
|
510
|
+
totalIfSharesBefore: BN;
|
|
511
|
+
ifSharesAfter: BN;
|
|
512
|
+
userIfSharesAfter: BN;
|
|
513
|
+
totalIfSharesAfter: BN;
|
|
514
|
+
};
|
|
515
|
+
export type LPRecord = {
|
|
516
|
+
ts: BN;
|
|
517
|
+
user: PublicKey;
|
|
518
|
+
action: LPAction;
|
|
519
|
+
nShares: BN;
|
|
520
|
+
marketIndex: number;
|
|
521
|
+
deltaBaseAssetAmount: BN;
|
|
522
|
+
deltaQuoteAssetAmount: BN;
|
|
523
|
+
pnl: BN;
|
|
524
|
+
};
|
|
525
|
+
export declare class LPAction {
|
|
526
|
+
static readonly ADD_LIQUIDITY: {
|
|
527
|
+
addLiquidity: {};
|
|
528
|
+
};
|
|
529
|
+
static readonly REMOVE_LIQUIDITY: {
|
|
530
|
+
removeLiquidity: {};
|
|
531
|
+
};
|
|
532
|
+
static readonly SETTLE_LIQUIDITY: {
|
|
533
|
+
settleLiquidity: {};
|
|
534
|
+
};
|
|
535
|
+
static readonly REMOVE_LIQUIDITY_DERISK: {
|
|
536
|
+
removeLiquidityDerisk: {};
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
export type FundingRateRecord = {
|
|
540
|
+
ts: BN;
|
|
541
|
+
recordId: BN;
|
|
542
|
+
marketIndex: number;
|
|
543
|
+
fundingRate: BN;
|
|
544
|
+
fundingRateLong: BN;
|
|
545
|
+
fundingRateShort: BN;
|
|
546
|
+
cumulativeFundingRateLong: BN;
|
|
547
|
+
cumulativeFundingRateShort: BN;
|
|
548
|
+
oraclePriceTwap: BN;
|
|
549
|
+
markPriceTwap: BN;
|
|
550
|
+
periodRevenue: BN;
|
|
551
|
+
baseAssetAmountWithAmm: BN;
|
|
552
|
+
baseAssetAmountWithUnsettledLp: BN;
|
|
553
|
+
};
|
|
554
|
+
export type FundingPaymentRecord = {
|
|
555
|
+
ts: BN;
|
|
556
|
+
userAuthority: PublicKey;
|
|
557
|
+
user: PublicKey;
|
|
558
|
+
marketIndex: number;
|
|
559
|
+
fundingPayment: BN;
|
|
560
|
+
baseAssetAmount: BN;
|
|
561
|
+
userLastCumulativeFunding: BN;
|
|
562
|
+
ammCumulativeFundingLong: BN;
|
|
563
|
+
ammCumulativeFundingShort: BN;
|
|
564
|
+
};
|
|
565
|
+
export type LiquidationRecord = {
|
|
566
|
+
ts: BN;
|
|
567
|
+
user: PublicKey;
|
|
568
|
+
liquidator: PublicKey;
|
|
569
|
+
liquidationType: LiquidationType;
|
|
570
|
+
marginRequirement: BN;
|
|
571
|
+
totalCollateral: BN;
|
|
572
|
+
marginFreed: BN;
|
|
573
|
+
liquidationId: number;
|
|
574
|
+
bankrupt: boolean;
|
|
575
|
+
canceledOrderIds: BN[];
|
|
576
|
+
liquidatePerp: LiquidatePerpRecord;
|
|
577
|
+
liquidateSpot: LiquidateSpotRecord;
|
|
578
|
+
liquidateBorrowForPerpPnl: LiquidateBorrowForPerpPnlRecord;
|
|
579
|
+
liquidatePerpPnlForDeposit: LiquidatePerpPnlForDepositRecord;
|
|
580
|
+
perpBankruptcy: PerpBankruptcyRecord;
|
|
581
|
+
spotBankruptcy: SpotBankruptcyRecord;
|
|
582
|
+
};
|
|
583
|
+
export declare class LiquidationType {
|
|
584
|
+
static readonly LIQUIDATE_PERP: {
|
|
585
|
+
liquidatePerp: {};
|
|
586
|
+
};
|
|
587
|
+
static readonly LIQUIDATE_BORROW_FOR_PERP_PNL: {
|
|
588
|
+
liquidateBorrowForPerpPnl: {};
|
|
589
|
+
};
|
|
590
|
+
static readonly LIQUIDATE_PERP_PNL_FOR_DEPOSIT: {
|
|
591
|
+
liquidatePerpPnlForDeposit: {};
|
|
592
|
+
};
|
|
593
|
+
static readonly PERP_BANKRUPTCY: {
|
|
594
|
+
perpBankruptcy: {};
|
|
595
|
+
};
|
|
596
|
+
static readonly SPOT_BANKRUPTCY: {
|
|
597
|
+
spotBankruptcy: {};
|
|
598
|
+
};
|
|
599
|
+
static readonly LIQUIDATE_SPOT: {
|
|
600
|
+
liquidateSpot: {};
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
export type LiquidatePerpRecord = {
|
|
604
|
+
marketIndex: number;
|
|
605
|
+
oraclePrice: BN;
|
|
606
|
+
baseAssetAmount: BN;
|
|
607
|
+
quoteAssetAmount: BN;
|
|
608
|
+
lpShares: BN;
|
|
609
|
+
userOrderId: BN;
|
|
610
|
+
liquidatorOrderId: BN;
|
|
611
|
+
fillRecordId: BN;
|
|
612
|
+
liquidatorFee: BN;
|
|
613
|
+
ifFee: BN;
|
|
614
|
+
};
|
|
615
|
+
export type LiquidateSpotRecord = {
|
|
616
|
+
assetMarketIndex: number;
|
|
617
|
+
assetPrice: BN;
|
|
618
|
+
assetTransfer: BN;
|
|
619
|
+
liabilityMarketIndex: number;
|
|
620
|
+
liabilityPrice: BN;
|
|
621
|
+
liabilityTransfer: BN;
|
|
622
|
+
ifFee: BN;
|
|
623
|
+
};
|
|
624
|
+
export type LiquidateBorrowForPerpPnlRecord = {
|
|
625
|
+
perpMarketIndex: number;
|
|
626
|
+
marketOraclePrice: BN;
|
|
627
|
+
pnlTransfer: BN;
|
|
628
|
+
liabilityMarketIndex: number;
|
|
629
|
+
liabilityPrice: BN;
|
|
630
|
+
liabilityTransfer: BN;
|
|
631
|
+
};
|
|
632
|
+
export type LiquidatePerpPnlForDepositRecord = {
|
|
633
|
+
perpMarketIndex: number;
|
|
634
|
+
marketOraclePrice: BN;
|
|
635
|
+
pnlTransfer: BN;
|
|
636
|
+
assetMarketIndex: number;
|
|
637
|
+
assetPrice: BN;
|
|
638
|
+
assetTransfer: BN;
|
|
639
|
+
};
|
|
640
|
+
export type PerpBankruptcyRecord = {
|
|
641
|
+
marketIndex: number;
|
|
642
|
+
pnl: BN;
|
|
643
|
+
ifPayment: BN;
|
|
644
|
+
clawbackUser: PublicKey | null;
|
|
645
|
+
clawbackUserPayment: BN | null;
|
|
646
|
+
cumulativeFundingRateDelta: BN;
|
|
647
|
+
};
|
|
648
|
+
export type SpotBankruptcyRecord = {
|
|
649
|
+
marketIndex: number;
|
|
650
|
+
borrowAmount: BN;
|
|
651
|
+
cumulativeDepositInterestDelta: BN;
|
|
652
|
+
ifPayment: BN;
|
|
653
|
+
};
|
|
654
|
+
export type SettlePnlRecord = {
|
|
655
|
+
ts: BN;
|
|
656
|
+
user: PublicKey;
|
|
657
|
+
marketIndex: number;
|
|
658
|
+
pnl: BN;
|
|
659
|
+
baseAssetAmount: BN;
|
|
660
|
+
quoteAssetAmountAfter: BN;
|
|
661
|
+
quoteEntryAmount: BN;
|
|
662
|
+
settlePrice: BN;
|
|
663
|
+
explanation: SettlePnlExplanation;
|
|
664
|
+
};
|
|
665
|
+
export type SwiftOrderRecord = {
|
|
666
|
+
ts: BN;
|
|
667
|
+
user: PublicKey;
|
|
668
|
+
hash: string;
|
|
669
|
+
matchingOrderParams: OrderParams;
|
|
670
|
+
swiftOrderMaxSlot: BN;
|
|
671
|
+
swiftOrderUuid: Uint8Array;
|
|
672
|
+
userOrderId: number;
|
|
673
|
+
};
|
|
674
|
+
export type OrderRecord = {
|
|
675
|
+
ts: BN;
|
|
676
|
+
user: PublicKey;
|
|
677
|
+
order: Order;
|
|
678
|
+
};
|
|
679
|
+
export type OrderActionRecord = {
|
|
680
|
+
ts: BN;
|
|
681
|
+
action: OrderAction;
|
|
682
|
+
actionExplanation: OrderActionExplanation;
|
|
683
|
+
marketIndex: number;
|
|
684
|
+
marketType: MarketType;
|
|
685
|
+
filler: PublicKey | null;
|
|
686
|
+
fillerReward: BN | null;
|
|
687
|
+
fillRecordId: BN | null;
|
|
688
|
+
baseAssetAmountFilled: BN | null;
|
|
689
|
+
quoteAssetAmountFilled: BN | null;
|
|
690
|
+
takerFee: BN | null;
|
|
691
|
+
makerFee: BN | null;
|
|
692
|
+
referrerReward: number | null;
|
|
693
|
+
quoteAssetAmountSurplus: BN | null;
|
|
694
|
+
spotFulfillmentMethodFee: BN | null;
|
|
695
|
+
taker: PublicKey | null;
|
|
696
|
+
takerOrderId: number | null;
|
|
697
|
+
takerOrderDirection: PositionDirection | null;
|
|
698
|
+
takerOrderBaseAssetAmount: BN | null;
|
|
699
|
+
takerOrderCumulativeBaseAssetAmountFilled: BN | null;
|
|
700
|
+
takerOrderCumulativeQuoteAssetAmountFilled: BN | null;
|
|
701
|
+
maker: PublicKey | null;
|
|
702
|
+
makerOrderId: number | null;
|
|
703
|
+
makerOrderDirection: PositionDirection | null;
|
|
704
|
+
makerOrderBaseAssetAmount: BN | null;
|
|
705
|
+
makerOrderCumulativeBaseAssetAmountFilled: BN | null;
|
|
706
|
+
makerOrderCumulativeQuoteAssetAmountFilled: BN | null;
|
|
707
|
+
oraclePrice: BN;
|
|
708
|
+
};
|
|
709
|
+
export type SwapRecord = {
|
|
710
|
+
ts: BN;
|
|
711
|
+
user: PublicKey;
|
|
712
|
+
amountOut: BN;
|
|
713
|
+
amountIn: BN;
|
|
714
|
+
outMarketIndex: number;
|
|
715
|
+
inMarketIndex: number;
|
|
716
|
+
outOraclePrice: BN;
|
|
717
|
+
inOraclePrice: BN;
|
|
718
|
+
fee: BN;
|
|
719
|
+
};
|
|
720
|
+
export type SpotMarketVaultDepositRecord = {
|
|
721
|
+
ts: BN;
|
|
722
|
+
marketIndex: number;
|
|
723
|
+
depositBalance: BN;
|
|
724
|
+
cumulativeDepositInterestBefore: BN;
|
|
725
|
+
cumulativeDepositInterestAfter: BN;
|
|
726
|
+
depositTokenAmountBefore: BN;
|
|
727
|
+
amount: BN;
|
|
728
|
+
};
|
|
729
|
+
export type DeleteUserRecord = {
|
|
730
|
+
ts: BN;
|
|
731
|
+
userAuthority: PublicKey;
|
|
732
|
+
user: PublicKey;
|
|
733
|
+
subAccountId: number;
|
|
734
|
+
keeper: PublicKey | null;
|
|
735
|
+
};
|
|
736
|
+
export type StateAccount = {
|
|
737
|
+
admin: PublicKey;
|
|
738
|
+
exchangeStatus: number;
|
|
739
|
+
whitelistMint: PublicKey;
|
|
740
|
+
discountMint: PublicKey;
|
|
741
|
+
oracleGuardRails: OracleGuardRails;
|
|
742
|
+
numberOfAuthorities: BN;
|
|
743
|
+
numberOfSubAccounts: BN;
|
|
744
|
+
numberOfMarkets: number;
|
|
745
|
+
numberOfSpotMarkets: number;
|
|
746
|
+
minPerpAuctionDuration: number;
|
|
747
|
+
defaultMarketOrderTimeInForce: number;
|
|
748
|
+
defaultSpotAuctionDuration: number;
|
|
749
|
+
liquidationMarginBufferRatio: number;
|
|
750
|
+
settlementDuration: number;
|
|
751
|
+
maxNumberOfSubAccounts: number;
|
|
752
|
+
signer: PublicKey;
|
|
753
|
+
signerNonce: number;
|
|
754
|
+
srmVault: PublicKey;
|
|
755
|
+
perpFeeStructure: FeeStructure;
|
|
756
|
+
spotFeeStructure: FeeStructure;
|
|
757
|
+
lpCooldownTime: BN;
|
|
758
|
+
initialPctToLiquidate: number;
|
|
759
|
+
liquidationDuration: number;
|
|
760
|
+
maxInitializeUserFee: number;
|
|
761
|
+
};
|
|
762
|
+
export type PerpMarketAccount = {
|
|
763
|
+
status: MarketStatus;
|
|
764
|
+
contractType: ContractType;
|
|
765
|
+
contractTier: ContractTier;
|
|
766
|
+
expiryTs: BN;
|
|
767
|
+
expiryPrice: BN;
|
|
768
|
+
marketIndex: number;
|
|
769
|
+
pubkey: PublicKey;
|
|
770
|
+
name: number[];
|
|
771
|
+
amm: AMM;
|
|
772
|
+
numberOfUsersWithBase: number;
|
|
773
|
+
numberOfUsers: number;
|
|
774
|
+
marginRatioInitial: number;
|
|
775
|
+
marginRatioMaintenance: number;
|
|
776
|
+
nextFillRecordId: BN;
|
|
777
|
+
nextFundingRateRecordId: BN;
|
|
778
|
+
nextCurveRecordId: BN;
|
|
779
|
+
pnlPool: PoolBalance;
|
|
780
|
+
liquidatorFee: number;
|
|
781
|
+
ifLiquidationFee: number;
|
|
782
|
+
imfFactor: number;
|
|
783
|
+
unrealizedPnlImfFactor: number;
|
|
784
|
+
unrealizedPnlMaxImbalance: BN;
|
|
785
|
+
unrealizedPnlInitialAssetWeight: number;
|
|
786
|
+
unrealizedPnlMaintenanceAssetWeight: number;
|
|
787
|
+
insuranceClaim: {
|
|
788
|
+
revenueWithdrawSinceLastSettle: BN;
|
|
789
|
+
maxRevenueWithdrawPerPeriod: BN;
|
|
790
|
+
lastRevenueWithdrawTs: BN;
|
|
791
|
+
quoteSettledInsurance: BN;
|
|
792
|
+
quoteMaxInsurance: BN;
|
|
793
|
+
};
|
|
794
|
+
quoteSpotMarketIndex: number;
|
|
795
|
+
feeAdjustment: number;
|
|
796
|
+
pausedOperations: number;
|
|
797
|
+
fuelBoostTaker: number;
|
|
798
|
+
fuelBoostMaker: number;
|
|
799
|
+
fuelBoostPosition: number;
|
|
800
|
+
highLeverageMarginRatioInitial: number;
|
|
801
|
+
highLeverageMarginRatioMaintenance: number;
|
|
802
|
+
};
|
|
803
|
+
export type HistoricalOracleData = {
|
|
804
|
+
lastOraclePrice: BN;
|
|
805
|
+
lastOracleDelay: BN;
|
|
806
|
+
lastOracleConf: BN;
|
|
807
|
+
lastOraclePriceTwap: BN;
|
|
808
|
+
lastOraclePriceTwap5Min: BN;
|
|
809
|
+
lastOraclePriceTwapTs: BN;
|
|
810
|
+
};
|
|
811
|
+
export type HistoricalIndexData = {
|
|
812
|
+
lastIndexBidPrice: BN;
|
|
813
|
+
lastIndexAskPrice: BN;
|
|
814
|
+
lastIndexPriceTwap: BN;
|
|
815
|
+
lastIndexPriceTwap5Min: BN;
|
|
816
|
+
lastIndexPriceTwapTs: BN;
|
|
817
|
+
};
|
|
818
|
+
export type SpotMarketAccount = {
|
|
819
|
+
status: MarketStatus;
|
|
820
|
+
assetTier: AssetTier;
|
|
821
|
+
name: number[];
|
|
822
|
+
marketIndex: number;
|
|
823
|
+
pubkey: PublicKey;
|
|
824
|
+
mint: PublicKey;
|
|
825
|
+
vault: PublicKey;
|
|
826
|
+
oracle: PublicKey;
|
|
827
|
+
oracleSource: OracleSource;
|
|
828
|
+
historicalOracleData: HistoricalOracleData;
|
|
829
|
+
historicalIndexData: HistoricalIndexData;
|
|
830
|
+
insuranceFund: {
|
|
831
|
+
vault: PublicKey;
|
|
832
|
+
totalShares: BN;
|
|
833
|
+
userShares: BN;
|
|
834
|
+
sharesBase: BN;
|
|
835
|
+
unstakingPeriod: BN;
|
|
836
|
+
lastRevenueSettleTs: BN;
|
|
837
|
+
revenueSettlePeriod: BN;
|
|
838
|
+
totalFactor: number;
|
|
839
|
+
userFactor: number;
|
|
840
|
+
};
|
|
841
|
+
revenuePool: PoolBalance;
|
|
842
|
+
ifLiquidationFee: number;
|
|
843
|
+
decimals: number;
|
|
844
|
+
optimalUtilization: number;
|
|
845
|
+
optimalBorrowRate: number;
|
|
846
|
+
maxBorrowRate: number;
|
|
847
|
+
cumulativeDepositInterest: BN;
|
|
848
|
+
cumulativeBorrowInterest: BN;
|
|
849
|
+
totalSocialLoss: BN;
|
|
850
|
+
totalQuoteSocialLoss: BN;
|
|
851
|
+
depositBalance: BN;
|
|
852
|
+
borrowBalance: BN;
|
|
853
|
+
maxTokenDeposits: BN;
|
|
854
|
+
lastInterestTs: BN;
|
|
855
|
+
lastTwapTs: BN;
|
|
856
|
+
initialAssetWeight: number;
|
|
857
|
+
maintenanceAssetWeight: number;
|
|
858
|
+
initialLiabilityWeight: number;
|
|
859
|
+
maintenanceLiabilityWeight: number;
|
|
860
|
+
liquidatorFee: number;
|
|
861
|
+
imfFactor: number;
|
|
862
|
+
scaleInitialAssetWeightStart: BN;
|
|
863
|
+
withdrawGuardThreshold: BN;
|
|
864
|
+
depositTokenTwap: BN;
|
|
865
|
+
borrowTokenTwap: BN;
|
|
866
|
+
utilizationTwap: BN;
|
|
867
|
+
nextDepositRecordId: BN;
|
|
868
|
+
orderStepSize: BN;
|
|
869
|
+
orderTickSize: BN;
|
|
870
|
+
minOrderSize: BN;
|
|
871
|
+
maxPositionSize: BN;
|
|
872
|
+
nextFillRecordId: BN;
|
|
873
|
+
spotFeePool: PoolBalance;
|
|
874
|
+
totalSpotFee: BN;
|
|
875
|
+
totalSwapFee: BN;
|
|
876
|
+
flashLoanAmount: BN;
|
|
877
|
+
flashLoanInitialTokenAmount: BN;
|
|
878
|
+
ordersEnabled: boolean;
|
|
879
|
+
pausedOperations: number;
|
|
880
|
+
ifPausedOperations: number;
|
|
881
|
+
maxTokenBorrowsFraction: number;
|
|
882
|
+
minBorrowRate: number;
|
|
883
|
+
fuelBoostDeposits: number;
|
|
884
|
+
fuelBoostBorrows: number;
|
|
885
|
+
fuelBoostTaker: number;
|
|
886
|
+
fuelBoostMaker: number;
|
|
887
|
+
fuelBoostInsurance: number;
|
|
888
|
+
tokenProgram: number;
|
|
889
|
+
poolId: number;
|
|
890
|
+
};
|
|
891
|
+
export type PoolBalance = {
|
|
892
|
+
scaledBalance: BN;
|
|
893
|
+
marketIndex: number;
|
|
894
|
+
};
|
|
895
|
+
export type AMM = {
|
|
896
|
+
baseAssetReserve: BN;
|
|
897
|
+
sqrtK: BN;
|
|
898
|
+
cumulativeFundingRate: BN;
|
|
899
|
+
lastFundingRate: BN;
|
|
900
|
+
lastFundingRateTs: BN;
|
|
901
|
+
lastMarkPriceTwap: BN;
|
|
902
|
+
lastMarkPriceTwap5Min: BN;
|
|
903
|
+
lastMarkPriceTwapTs: BN;
|
|
904
|
+
lastTradeTs: BN;
|
|
905
|
+
oracle: PublicKey;
|
|
906
|
+
oracleSource: OracleSource;
|
|
907
|
+
historicalOracleData: HistoricalOracleData;
|
|
908
|
+
lastOracleReservePriceSpreadPct: BN;
|
|
909
|
+
lastOracleConfPct: BN;
|
|
910
|
+
fundingPeriod: BN;
|
|
911
|
+
quoteAssetReserve: BN;
|
|
912
|
+
pegMultiplier: BN;
|
|
913
|
+
cumulativeFundingRateLong: BN;
|
|
914
|
+
cumulativeFundingRateShort: BN;
|
|
915
|
+
last24HAvgFundingRate: BN;
|
|
916
|
+
lastFundingRateShort: BN;
|
|
917
|
+
lastFundingRateLong: BN;
|
|
918
|
+
totalLiquidationFee: BN;
|
|
919
|
+
totalFeeMinusDistributions: BN;
|
|
920
|
+
totalFeeWithdrawn: BN;
|
|
921
|
+
totalFee: BN;
|
|
922
|
+
totalFeeEarnedPerLp: BN;
|
|
923
|
+
userLpShares: BN;
|
|
924
|
+
baseAssetAmountWithUnsettledLp: BN;
|
|
925
|
+
orderStepSize: BN;
|
|
926
|
+
orderTickSize: BN;
|
|
927
|
+
maxFillReserveFraction: number;
|
|
928
|
+
maxSlippageRatio: number;
|
|
929
|
+
baseSpread: number;
|
|
930
|
+
curveUpdateIntensity: number;
|
|
931
|
+
baseAssetAmountWithAmm: BN;
|
|
932
|
+
baseAssetAmountLong: BN;
|
|
933
|
+
baseAssetAmountShort: BN;
|
|
934
|
+
quoteAssetAmount: BN;
|
|
935
|
+
terminalQuoteAssetReserve: BN;
|
|
936
|
+
concentrationCoef: BN;
|
|
937
|
+
feePool: PoolBalance;
|
|
938
|
+
totalExchangeFee: BN;
|
|
939
|
+
totalMmFee: BN;
|
|
940
|
+
netRevenueSinceLastFunding: BN;
|
|
941
|
+
lastUpdateSlot: BN;
|
|
942
|
+
lastOracleNormalisedPrice: BN;
|
|
943
|
+
lastOracleValid: boolean;
|
|
944
|
+
lastBidPriceTwap: BN;
|
|
945
|
+
lastAskPriceTwap: BN;
|
|
946
|
+
longSpread: number;
|
|
947
|
+
shortSpread: number;
|
|
948
|
+
maxSpread: number;
|
|
949
|
+
baseAssetAmountPerLp: BN;
|
|
950
|
+
quoteAssetAmountPerLp: BN;
|
|
951
|
+
targetBaseAssetAmountPerLp: number;
|
|
952
|
+
ammJitIntensity: number;
|
|
953
|
+
maxOpenInterest: BN;
|
|
954
|
+
maxBaseAssetReserve: BN;
|
|
955
|
+
minBaseAssetReserve: BN;
|
|
956
|
+
totalSocialLoss: BN;
|
|
957
|
+
quoteBreakEvenAmountLong: BN;
|
|
958
|
+
quoteBreakEvenAmountShort: BN;
|
|
959
|
+
quoteEntryAmountLong: BN;
|
|
960
|
+
quoteEntryAmountShort: BN;
|
|
961
|
+
markStd: BN;
|
|
962
|
+
oracleStd: BN;
|
|
963
|
+
longIntensityCount: number;
|
|
964
|
+
longIntensityVolume: BN;
|
|
965
|
+
shortIntensityCount: number;
|
|
966
|
+
shortIntensityVolume: BN;
|
|
967
|
+
volume24H: BN;
|
|
968
|
+
minOrderSize: BN;
|
|
969
|
+
maxPositionSize: BN;
|
|
970
|
+
bidBaseAssetReserve: BN;
|
|
971
|
+
bidQuoteAssetReserve: BN;
|
|
972
|
+
askBaseAssetReserve: BN;
|
|
973
|
+
askQuoteAssetReserve: BN;
|
|
974
|
+
perLpBase: number;
|
|
975
|
+
netUnsettledFundingPnl: BN;
|
|
976
|
+
quoteAssetAmountWithUnsettledLp: BN;
|
|
977
|
+
referencePriceOffset: number;
|
|
978
|
+
};
|
|
979
|
+
export type PerpPosition = {
|
|
980
|
+
baseAssetAmount: BN;
|
|
981
|
+
lastCumulativeFundingRate: BN;
|
|
982
|
+
marketIndex: number;
|
|
983
|
+
quoteAssetAmount: BN;
|
|
984
|
+
quoteEntryAmount: BN;
|
|
985
|
+
quoteBreakEvenAmount: BN;
|
|
986
|
+
openOrders: number;
|
|
987
|
+
openBids: BN;
|
|
988
|
+
openAsks: BN;
|
|
989
|
+
settledPnl: BN;
|
|
990
|
+
lpShares: BN;
|
|
991
|
+
remainderBaseAssetAmount: number;
|
|
992
|
+
lastBaseAssetAmountPerLp: BN;
|
|
993
|
+
lastQuoteAssetAmountPerLp: BN;
|
|
994
|
+
perLpBase: number;
|
|
995
|
+
};
|
|
996
|
+
export type UserStatsAccount = {
|
|
997
|
+
numberOfSubAccounts: number;
|
|
998
|
+
numberOfSubAccountsCreated: number;
|
|
999
|
+
makerVolume30D: BN;
|
|
1000
|
+
takerVolume30D: BN;
|
|
1001
|
+
fillerVolume30D: BN;
|
|
1002
|
+
lastMakerVolume30DTs: BN;
|
|
1003
|
+
lastTakerVolume30DTs: BN;
|
|
1004
|
+
lastFillerVolume30DTs: BN;
|
|
1005
|
+
fees: {
|
|
1006
|
+
totalFeePaid: BN;
|
|
1007
|
+
totalFeeRebate: BN;
|
|
1008
|
+
totalTokenDiscount: BN;
|
|
1009
|
+
totalRefereeDiscount: BN;
|
|
1010
|
+
totalReferrerReward: BN;
|
|
1011
|
+
current_epoch_referrer_reward: BN;
|
|
1012
|
+
};
|
|
1013
|
+
referrer: PublicKey;
|
|
1014
|
+
referrerStatus: number;
|
|
1015
|
+
authority: PublicKey;
|
|
1016
|
+
ifStakedQuoteAssetAmount: BN;
|
|
1017
|
+
lastFuelIfBonusUpdateTs: number;
|
|
1018
|
+
fuelInsurance: number;
|
|
1019
|
+
fuelDeposits: number;
|
|
1020
|
+
fuelBorrows: number;
|
|
1021
|
+
fuelPositions: number;
|
|
1022
|
+
fuelTaker: number;
|
|
1023
|
+
fuelMaker: number;
|
|
1024
|
+
ifStakedGovTokenAmount: BN;
|
|
1025
|
+
};
|
|
1026
|
+
export type UserAccount = {
|
|
1027
|
+
authority: PublicKey;
|
|
1028
|
+
delegate: PublicKey;
|
|
1029
|
+
name: number[];
|
|
1030
|
+
subAccountId: number;
|
|
1031
|
+
spotPositions: SpotPosition[];
|
|
1032
|
+
perpPositions: PerpPosition[];
|
|
1033
|
+
orders: Order[];
|
|
1034
|
+
status: number;
|
|
1035
|
+
nextLiquidationId: number;
|
|
1036
|
+
nextOrderId: number;
|
|
1037
|
+
maxMarginRatio: number;
|
|
1038
|
+
lastAddPerpLpSharesTs: BN;
|
|
1039
|
+
settledPerpPnl: BN;
|
|
1040
|
+
totalDeposits: BN;
|
|
1041
|
+
totalWithdraws: BN;
|
|
1042
|
+
totalSocialLoss: BN;
|
|
1043
|
+
cumulativePerpFunding: BN;
|
|
1044
|
+
cumulativeSpotFees: BN;
|
|
1045
|
+
liquidationMarginFreed: BN;
|
|
1046
|
+
lastActiveSlot: BN;
|
|
1047
|
+
isMarginTradingEnabled: boolean;
|
|
1048
|
+
idle: boolean;
|
|
1049
|
+
openOrders: number;
|
|
1050
|
+
hasOpenOrder: boolean;
|
|
1051
|
+
openAuctions: number;
|
|
1052
|
+
hasOpenAuction: boolean;
|
|
1053
|
+
lastFuelBonusUpdateTs: number;
|
|
1054
|
+
marginMode: MarginMode;
|
|
1055
|
+
poolId: number;
|
|
1056
|
+
};
|
|
1057
|
+
export type SpotPosition = {
|
|
1058
|
+
marketIndex: number;
|
|
1059
|
+
balanceType: SpotBalanceType;
|
|
1060
|
+
scaledBalance: BN;
|
|
1061
|
+
openOrders: number;
|
|
1062
|
+
openBids: BN;
|
|
1063
|
+
openAsks: BN;
|
|
1064
|
+
cumulativeDeposits: BN;
|
|
1065
|
+
};
|
|
1066
|
+
export type Order = {
|
|
1067
|
+
status: OrderStatus;
|
|
1068
|
+
orderType: OrderType;
|
|
1069
|
+
marketType: MarketType;
|
|
1070
|
+
slot: BN;
|
|
1071
|
+
orderId: number;
|
|
1072
|
+
userOrderId: number;
|
|
1073
|
+
marketIndex: number;
|
|
1074
|
+
price: BN;
|
|
1075
|
+
baseAssetAmount: BN;
|
|
1076
|
+
quoteAssetAmount: BN;
|
|
1077
|
+
baseAssetAmountFilled: BN;
|
|
1078
|
+
quoteAssetAmountFilled: BN;
|
|
1079
|
+
direction: PositionDirection;
|
|
1080
|
+
reduceOnly: boolean;
|
|
1081
|
+
triggerPrice: BN;
|
|
1082
|
+
triggerCondition: OrderTriggerCondition;
|
|
1083
|
+
existingPositionDirection: PositionDirection;
|
|
1084
|
+
postOnly: boolean;
|
|
1085
|
+
immediateOrCancel: boolean;
|
|
1086
|
+
oraclePriceOffset: number;
|
|
1087
|
+
auctionDuration: number;
|
|
1088
|
+
auctionStartPrice: BN;
|
|
1089
|
+
auctionEndPrice: BN;
|
|
1090
|
+
maxTs: BN;
|
|
1091
|
+
};
|
|
1092
|
+
export type OrderParams = {
|
|
1093
|
+
orderType: OrderType;
|
|
1094
|
+
marketType: MarketType;
|
|
1095
|
+
userOrderId: number;
|
|
1096
|
+
direction: PositionDirection;
|
|
1097
|
+
baseAssetAmount: BN;
|
|
1098
|
+
price: BN;
|
|
1099
|
+
marketIndex: number;
|
|
1100
|
+
reduceOnly: boolean;
|
|
1101
|
+
postOnly: PostOnlyParams;
|
|
1102
|
+
immediateOrCancel: boolean;
|
|
1103
|
+
triggerPrice: BN | null;
|
|
1104
|
+
triggerCondition: OrderTriggerCondition;
|
|
1105
|
+
oraclePriceOffset: number | null;
|
|
1106
|
+
auctionDuration: number | null;
|
|
1107
|
+
maxTs: BN | null;
|
|
1108
|
+
auctionStartPrice: BN | null;
|
|
1109
|
+
auctionEndPrice: BN | null;
|
|
1110
|
+
};
|
|
1111
|
+
export declare class PostOnlyParams {
|
|
1112
|
+
static readonly NONE: {
|
|
1113
|
+
none: {};
|
|
1114
|
+
};
|
|
1115
|
+
static readonly MUST_POST_ONLY: {
|
|
1116
|
+
mustPostOnly: {};
|
|
1117
|
+
};
|
|
1118
|
+
static readonly TRY_POST_ONLY: {
|
|
1119
|
+
tryPostOnly: {};
|
|
1120
|
+
};
|
|
1121
|
+
static readonly SLIDE: {
|
|
1122
|
+
slide: {};
|
|
1123
|
+
};
|
|
1124
|
+
}
|
|
1125
|
+
export type NecessaryOrderParams = {
|
|
1126
|
+
orderType: OrderType;
|
|
1127
|
+
marketIndex: number;
|
|
1128
|
+
baseAssetAmount: BN;
|
|
1129
|
+
direction: PositionDirection;
|
|
1130
|
+
};
|
|
1131
|
+
export type OptionalOrderParams = {
|
|
1132
|
+
[Property in keyof OrderParams]?: OrderParams[Property];
|
|
1133
|
+
} & NecessaryOrderParams;
|
|
1134
|
+
export type ModifyOrderParams = {
|
|
1135
|
+
[Property in keyof OrderParams]?: OrderParams[Property] | null;
|
|
1136
|
+
} & {
|
|
1137
|
+
policy?: ModifyOrderPolicy;
|
|
1138
|
+
};
|
|
1139
|
+
export declare enum ModifyOrderPolicy {
|
|
1140
|
+
MustModify = 1,
|
|
1141
|
+
ExcludePreviousFill = 2
|
|
1142
|
+
}
|
|
1143
|
+
export declare const DefaultOrderParams: OrderParams;
|
|
1144
|
+
export type SwiftServerMessage = {
|
|
1145
|
+
slot: BN;
|
|
1146
|
+
swiftOrderSignature: Uint8Array;
|
|
1147
|
+
uuid: Uint8Array;
|
|
1148
|
+
};
|
|
1149
|
+
export type SwiftOrderParamsMessage = {
|
|
1150
|
+
swiftOrderParams: OptionalOrderParams;
|
|
1151
|
+
subAccountId: number;
|
|
1152
|
+
takeProfitOrderParams: SwiftTriggerOrderParams | null;
|
|
1153
|
+
stopLossOrderParams: SwiftTriggerOrderParams | null;
|
|
1154
|
+
};
|
|
1155
|
+
export type SwiftTriggerOrderParams = {
|
|
1156
|
+
triggerPrice: BN;
|
|
1157
|
+
baseAssetAmount: BN;
|
|
1158
|
+
};
|
|
1159
|
+
export type RFQMakerOrderParams = {
|
|
1160
|
+
uuid: Uint8Array;
|
|
1161
|
+
authority: PublicKey;
|
|
1162
|
+
subAccountId: number;
|
|
1163
|
+
marketIndex: number;
|
|
1164
|
+
marketType: MarketType;
|
|
1165
|
+
baseAssetAmount: BN;
|
|
1166
|
+
price: BN;
|
|
1167
|
+
direction: PositionDirection;
|
|
1168
|
+
maxTs: BN;
|
|
1169
|
+
};
|
|
1170
|
+
export type RFQMakerMessage = {
|
|
1171
|
+
orderParams: RFQMakerOrderParams;
|
|
1172
|
+
signature: Uint8Array;
|
|
1173
|
+
};
|
|
1174
|
+
export type RFQMatch = {
|
|
1175
|
+
baseAssetAmount: BN;
|
|
1176
|
+
makerOrderParams: RFQMakerOrderParams;
|
|
1177
|
+
makerSignature: Uint8Array;
|
|
1178
|
+
};
|
|
1179
|
+
export type MakerInfo = {
|
|
1180
|
+
maker: PublicKey;
|
|
1181
|
+
makerStats: PublicKey;
|
|
1182
|
+
makerUserAccount: UserAccount;
|
|
1183
|
+
order?: Order;
|
|
1184
|
+
};
|
|
1185
|
+
export type TakerInfo = {
|
|
1186
|
+
taker: PublicKey;
|
|
1187
|
+
takerStats: PublicKey;
|
|
1188
|
+
takerUserAccount: UserAccount;
|
|
1189
|
+
order: Order;
|
|
1190
|
+
};
|
|
1191
|
+
export type ReferrerInfo = {
|
|
1192
|
+
referrer: PublicKey;
|
|
1193
|
+
referrerStats: PublicKey;
|
|
1194
|
+
};
|
|
1195
|
+
export declare enum ReferrerStatus {
|
|
1196
|
+
IsReferrer = 1,
|
|
1197
|
+
IsReferred = 2
|
|
1198
|
+
}
|
|
1199
|
+
export declare enum PlaceAndTakeOrderSuccessCondition {
|
|
1200
|
+
PartialFill = 1,
|
|
1201
|
+
FullFill = 2
|
|
1202
|
+
}
|
|
1203
|
+
type ExactType<T> = Pick<T, keyof T>;
|
|
1204
|
+
export type BaseTxParams = ExactType<{
|
|
1205
|
+
computeUnits?: number;
|
|
1206
|
+
computeUnitsPrice?: number;
|
|
1207
|
+
}>;
|
|
1208
|
+
export type ProcessingTxParams = {
|
|
1209
|
+
useSimulatedComputeUnits?: boolean;
|
|
1210
|
+
computeUnitsBufferMultiplier?: number;
|
|
1211
|
+
useSimulatedComputeUnitsForCUPriceCalculation?: boolean;
|
|
1212
|
+
getCUPriceFromComputeUnits?: (computeUnits: number) => number;
|
|
1213
|
+
lowerBoundCu?: number;
|
|
1214
|
+
};
|
|
1215
|
+
export type TxParams = BaseTxParams & ProcessingTxParams;
|
|
1216
|
+
export declare class SwapReduceOnly {
|
|
1217
|
+
static readonly In: {
|
|
1218
|
+
in: {};
|
|
1219
|
+
};
|
|
1220
|
+
static readonly Out: {
|
|
1221
|
+
out: {};
|
|
1222
|
+
};
|
|
1223
|
+
}
|
|
1224
|
+
export interface IWallet {
|
|
1225
|
+
signTransaction(tx: Transaction): Promise<Transaction>;
|
|
1226
|
+
signAllTransactions(txs: Transaction[]): Promise<Transaction[]>;
|
|
1227
|
+
publicKey: PublicKey;
|
|
1228
|
+
payer?: Keypair;
|
|
1229
|
+
}
|
|
1230
|
+
export interface IVersionedWallet {
|
|
1231
|
+
signVersionedTransaction(tx: VersionedTransaction): Promise<VersionedTransaction>;
|
|
1232
|
+
signAllVersionedTransactions(txs: VersionedTransaction[]): Promise<VersionedTransaction[]>;
|
|
1233
|
+
publicKey: PublicKey;
|
|
1234
|
+
payer?: Keypair;
|
|
1235
|
+
}
|
|
1236
|
+
export type FeeStructure = {
|
|
1237
|
+
feeTiers: FeeTier[];
|
|
1238
|
+
fillerRewardStructure: OrderFillerRewardStructure;
|
|
1239
|
+
flatFillerFee: BN;
|
|
1240
|
+
referrerRewardEpochUpperBound: BN;
|
|
1241
|
+
};
|
|
1242
|
+
export type FeeTier = {
|
|
1243
|
+
feeNumerator: number;
|
|
1244
|
+
feeDenominator: number;
|
|
1245
|
+
makerRebateNumerator: number;
|
|
1246
|
+
makerRebateDenominator: number;
|
|
1247
|
+
referrerRewardNumerator: number;
|
|
1248
|
+
referrerRewardDenominator: number;
|
|
1249
|
+
refereeFeeNumerator: number;
|
|
1250
|
+
refereeFeeDenominator: number;
|
|
1251
|
+
};
|
|
1252
|
+
export type OrderFillerRewardStructure = {
|
|
1253
|
+
rewardNumerator: BN;
|
|
1254
|
+
rewardDenominator: BN;
|
|
1255
|
+
timeBasedRewardLowerBound: BN;
|
|
1256
|
+
};
|
|
1257
|
+
export type OracleGuardRails = {
|
|
1258
|
+
priceDivergence: {
|
|
1259
|
+
markOraclePercentDivergence: BN;
|
|
1260
|
+
oracleTwap5MinPercentDivergence: BN;
|
|
1261
|
+
};
|
|
1262
|
+
validity: {
|
|
1263
|
+
slotsBeforeStaleForAmm: BN;
|
|
1264
|
+
slotsBeforeStaleForMargin: BN;
|
|
1265
|
+
confidenceIntervalMaxSize: BN;
|
|
1266
|
+
tooVolatileRatio: BN;
|
|
1267
|
+
};
|
|
1268
|
+
};
|
|
1269
|
+
export type PrelaunchOracle = {
|
|
1270
|
+
price: BN;
|
|
1271
|
+
maxPrice: BN;
|
|
1272
|
+
confidence: BN;
|
|
1273
|
+
ammLastUpdateSlot: BN;
|
|
1274
|
+
lastUpdateSlot: BN;
|
|
1275
|
+
perpMarketIndex: number;
|
|
1276
|
+
};
|
|
1277
|
+
export type MarginCategory = 'Initial' | 'Maintenance';
|
|
1278
|
+
export type InsuranceFundStake = {
|
|
1279
|
+
costBasis: BN;
|
|
1280
|
+
marketIndex: number;
|
|
1281
|
+
authority: PublicKey;
|
|
1282
|
+
ifShares: BN;
|
|
1283
|
+
ifBase: BN;
|
|
1284
|
+
lastWithdrawRequestShares: BN;
|
|
1285
|
+
lastWithdrawRequestValue: BN;
|
|
1286
|
+
lastWithdrawRequestTs: BN;
|
|
1287
|
+
};
|
|
1288
|
+
export type SerumV3FulfillmentConfigAccount = {
|
|
1289
|
+
fulfillmentType: SpotFulfillmentType;
|
|
1290
|
+
status: SpotFulfillmentStatus;
|
|
1291
|
+
pubkey: PublicKey;
|
|
1292
|
+
marketIndex: number;
|
|
1293
|
+
serumProgramId: PublicKey;
|
|
1294
|
+
serumMarket: PublicKey;
|
|
1295
|
+
serumRequestQueue: PublicKey;
|
|
1296
|
+
serumEventQueue: PublicKey;
|
|
1297
|
+
serumBids: PublicKey;
|
|
1298
|
+
serumAsks: PublicKey;
|
|
1299
|
+
serumBaseVault: PublicKey;
|
|
1300
|
+
serumQuoteVault: PublicKey;
|
|
1301
|
+
serumOpenOrders: PublicKey;
|
|
1302
|
+
serumSignerNonce: BN;
|
|
1303
|
+
};
|
|
1304
|
+
export type PhoenixV1FulfillmentConfigAccount = {
|
|
1305
|
+
pubkey: PublicKey;
|
|
1306
|
+
phoenixProgramId: PublicKey;
|
|
1307
|
+
phoenixLogAuthority: PublicKey;
|
|
1308
|
+
phoenixMarket: PublicKey;
|
|
1309
|
+
phoenixBaseVault: PublicKey;
|
|
1310
|
+
phoenixQuoteVault: PublicKey;
|
|
1311
|
+
marketIndex: number;
|
|
1312
|
+
fulfillmentType: SpotFulfillmentType;
|
|
1313
|
+
status: SpotFulfillmentStatus;
|
|
1314
|
+
};
|
|
1315
|
+
export type OpenbookV2FulfillmentConfigAccount = {
|
|
1316
|
+
pubkey: PublicKey;
|
|
1317
|
+
openbookV2ProgramId: PublicKey;
|
|
1318
|
+
openbookV2Market: PublicKey;
|
|
1319
|
+
openbookV2MarketAuthority: PublicKey;
|
|
1320
|
+
openbookV2EventHeap: PublicKey;
|
|
1321
|
+
openbookV2Bids: PublicKey;
|
|
1322
|
+
openbookV2Asks: PublicKey;
|
|
1323
|
+
openbookV2BaseVault: PublicKey;
|
|
1324
|
+
openbookV2QuoteVault: PublicKey;
|
|
1325
|
+
marketIndex: number;
|
|
1326
|
+
fulfillmentType: SpotFulfillmentType;
|
|
1327
|
+
status: SpotFulfillmentStatus;
|
|
1328
|
+
remainingAccounts?: PublicKey[];
|
|
1329
|
+
};
|
|
1330
|
+
export type ReferrerNameAccount = {
|
|
1331
|
+
name: number[];
|
|
1332
|
+
user: PublicKey;
|
|
1333
|
+
authority: PublicKey;
|
|
1334
|
+
userStats: PublicKey;
|
|
1335
|
+
};
|
|
1336
|
+
export type PerpMarketExtendedInfo = {
|
|
1337
|
+
marketIndex: number;
|
|
1338
|
+
/**
|
|
1339
|
+
* Min order size measured in base asset, using base precision
|
|
1340
|
+
*/
|
|
1341
|
+
minOrderSize: BN;
|
|
1342
|
+
/**
|
|
1343
|
+
* Margin maintenance percentage, using margin precision (1e4)
|
|
1344
|
+
*/
|
|
1345
|
+
marginMaintenance: number;
|
|
1346
|
+
/**
|
|
1347
|
+
* Max insurance available, measured in quote asset, using quote preicision
|
|
1348
|
+
*/
|
|
1349
|
+
availableInsurance: BN;
|
|
1350
|
+
/**
|
|
1351
|
+
* Pnl pool available, this is measured in quote asset, using quote precision.
|
|
1352
|
+
* Should be generated by using getTokenAmount and passing in the scaled balance of the base asset + quote spot account
|
|
1353
|
+
*/
|
|
1354
|
+
pnlPoolValue: BN;
|
|
1355
|
+
contractTier: ContractTier;
|
|
1356
|
+
};
|
|
1357
|
+
export type HealthComponents = {
|
|
1358
|
+
deposits: HealthComponent[];
|
|
1359
|
+
borrows: HealthComponent[];
|
|
1360
|
+
perpPositions: HealthComponent[];
|
|
1361
|
+
perpPnl: HealthComponent[];
|
|
1362
|
+
};
|
|
1363
|
+
export type HealthComponent = {
|
|
1364
|
+
marketIndex: number;
|
|
1365
|
+
size: BN;
|
|
1366
|
+
value: BN;
|
|
1367
|
+
weight: BN;
|
|
1368
|
+
weightedValue: BN;
|
|
1369
|
+
};
|
|
1370
|
+
export interface DriftClientMetricsEvents {
|
|
1371
|
+
txSigned: SignedTxData[];
|
|
1372
|
+
preTxSigned: void;
|
|
1373
|
+
}
|
|
1374
|
+
export type SignedTxData = {
|
|
1375
|
+
txSig: string;
|
|
1376
|
+
signedTx: Transaction | VersionedTransaction;
|
|
1377
|
+
lastValidBlockHeight?: number;
|
|
1378
|
+
blockHash: string;
|
|
1379
|
+
};
|
|
1380
|
+
export type HighLeverageModeConfig = {
|
|
1381
|
+
maxUsers: number;
|
|
1382
|
+
currentUsers: number;
|
|
1383
|
+
reduceOnly: boolean;
|
|
1384
|
+
};
|
|
1385
|
+
export {};
|