@velocity-exchange/sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierignore +1 -0
- package/.yarn/install-state.gz +0 -0
- package/README.md +275 -0
- package/VERSION +1 -0
- package/build-browser.js +58 -0
- package/bun.lock +1885 -0
- package/esbuild-shims.js +12 -0
- package/lib/browser/accounts/basicUserAccountSubscriber.d.ts +27 -0
- package/lib/browser/accounts/basicUserAccountSubscriber.js +38 -0
- package/lib/browser/accounts/basicUserStatsAccountSubscriber.d.ts +27 -0
- package/lib/browser/accounts/basicUserStatsAccountSubscriber.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/customizedCadenceBulkAccountLoader.d.ts +44 -0
- package/lib/browser/accounts/customizedCadenceBulkAccountLoader.js +152 -0
- package/lib/browser/accounts/fetch.d.ts +17 -0
- package/lib/browser/accounts/fetch.js +60 -0
- package/lib/browser/accounts/grpcAccountSubscriber.d.ts +17 -0
- package/lib/browser/accounts/grpcAccountSubscriber.js +162 -0
- package/lib/browser/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts +10 -0
- package/lib/browser/accounts/grpcInsuranceFundStakeAccountSubscriber.js +31 -0
- package/lib/browser/accounts/grpcMultiAccountSubscriber.d.ts +37 -0
- package/lib/browser/accounts/grpcMultiAccountSubscriber.js +378 -0
- package/lib/browser/accounts/grpcMultiUserAccountSubscriber.d.ts +25 -0
- package/lib/browser/accounts/grpcMultiUserAccountSubscriber.js +203 -0
- package/lib/browser/accounts/grpcProgramAccountSubscriber.d.ts +18 -0
- package/lib/browser/accounts/grpcProgramAccountSubscriber.js +179 -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/grpcVelocityClientAccountSubscriber.d.ts +16 -0
- package/lib/browser/accounts/grpcVelocityClientAccountSubscriber.js +101 -0
- package/lib/browser/accounts/grpcVelocityClientAccountSubscriberV2.d.ts +69 -0
- package/lib/browser/accounts/grpcVelocityClientAccountSubscriberV2.js +457 -0
- package/lib/browser/accounts/laserProgramAccountSubscriber.d.ts +23 -0
- package/lib/browser/accounts/laserProgramAccountSubscriber.js +162 -0
- package/lib/browser/accounts/oneShotUserAccountSubscriber.d.ts +18 -0
- package/lib/browser/accounts/oneShotUserAccountSubscriber.js +48 -0
- package/lib/browser/accounts/oneShotUserStatsAccountSubscriber.d.ts +18 -0
- package/lib/browser/accounts/oneShotUserStatsAccountSubscriber.js +48 -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/pollingVelocityClientAccountSubscriber.d.ts +73 -0
- package/lib/browser/accounts/pollingVelocityClientAccountSubscriber.js +420 -0
- package/lib/browser/accounts/testBulkAccountLoader.d.ts +4 -0
- package/lib/browser/accounts/testBulkAccountLoader.js +43 -0
- package/lib/browser/accounts/types.d.ts +205 -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 +170 -0
- package/lib/browser/accounts/webSocketAccountSubscriberV2.d.ts +109 -0
- package/lib/browser/accounts/webSocketAccountSubscriberV2.js +395 -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 +31 -0
- package/lib/browser/accounts/webSocketProgramAccountSubscriber.js +120 -0
- package/lib/browser/accounts/webSocketProgramAccountSubscriberV2.d.ts +145 -0
- package/lib/browser/accounts/webSocketProgramAccountSubscriberV2.js +744 -0
- package/lib/browser/accounts/webSocketProgramAccountsSubscriberV2.d.ts +145 -0
- package/lib/browser/accounts/webSocketProgramAccountsSubscriberV2.js +744 -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/accounts/webSocketVelocityClientAccountSubscriber.d.ts +77 -0
- package/lib/browser/accounts/webSocketVelocityClientAccountSubscriber.js +400 -0
- package/lib/browser/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts +91 -0
- package/lib/browser/accounts/webSocketVelocityClientAccountSubscriberV2.js +446 -0
- package/lib/browser/accounts/websocketProgramUserAccountSubscriber.d.ts +22 -0
- package/lib/browser/accounts/websocketProgramUserAccountSubscriber.js +54 -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 +47 -0
- package/lib/browser/addresses/pda.js +263 -0
- package/lib/browser/adminClient.d.ts +402 -0
- package/lib/browser/adminClient.js +2798 -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 +76 -0
- package/lib/browser/bankrun/bankrunConnection.js +348 -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 +75 -0
- package/lib/browser/config.js +164 -0
- package/lib/browser/constants/index.d.ts +10 -0
- package/lib/browser/constants/index.js +26 -0
- package/lib/browser/constants/insuranceFund.d.ts +5 -0
- package/lib/browser/constants/insuranceFund.js +9 -0
- package/lib/browser/constants/numericConstants.d.ts +73 -0
- package/lib/browser/constants/numericConstants.js +79 -0
- package/lib/browser/constants/perpMarkets.d.ts +21 -0
- package/lib/browser/constants/perpMarkets.js +971 -0
- package/lib/browser/constants/spotMarkets.d.ts +24 -0
- package/lib/browser/constants/spotMarkets.js +797 -0
- package/lib/browser/constants/txConstants.d.ts +1 -0
- package/lib/browser/constants/txConstants.js +4 -0
- package/lib/browser/constituentMap/constituentMap.d.ts +66 -0
- package/lib/browser/constituentMap/constituentMap.js +177 -0
- package/lib/browser/constituentMap/pollingConstituentAccountSubscriber.d.ts +24 -0
- package/lib/browser/constituentMap/pollingConstituentAccountSubscriber.js +60 -0
- package/lib/browser/constituentMap/webSocketConstituentAccountSubscriber.d.ts +24 -0
- package/lib/browser/constituentMap/webSocketConstituentAccountSubscriber.js +58 -0
- package/lib/browser/core/VelocityCore.d.ts +226 -0
- package/lib/browser/core/VelocityCore.js +138 -0
- package/lib/browser/core/index.d.ts +12 -0
- package/lib/browser/core/index.js +28 -0
- package/lib/browser/core/instructions/deposit.d.ts +19 -0
- package/lib/browser/core/instructions/deposit.js +19 -0
- package/lib/browser/core/instructions/fill.d.ts +13 -0
- package/lib/browser/core/instructions/fill.js +17 -0
- package/lib/browser/core/instructions/funding.d.ts +9 -0
- package/lib/browser/core/instructions/funding.js +13 -0
- package/lib/browser/core/instructions/liquidation.d.ts +15 -0
- package/lib/browser/core/instructions/liquidation.js +17 -0
- package/lib/browser/core/instructions/orders.d.ts +22 -0
- package/lib/browser/core/instructions/orders.js +27 -0
- package/lib/browser/core/instructions/perpOrders.d.ts +78 -0
- package/lib/browser/core/instructions/perpOrders.js +99 -0
- package/lib/browser/core/instructions/settlement.d.ts +11 -0
- package/lib/browser/core/instructions/settlement.js +15 -0
- package/lib/browser/core/instructions/trigger.d.ts +11 -0
- package/lib/browser/core/instructions/trigger.js +15 -0
- package/lib/browser/core/instructions/withdraw.d.ts +20 -0
- package/lib/browser/core/instructions/withdraw.js +20 -0
- package/lib/browser/core/remainingAccounts.d.ts +27 -0
- package/lib/browser/core/remainingAccounts.js +122 -0
- package/lib/browser/core/signedMsg.d.ts +17 -0
- package/lib/browser/core/signedMsg.js +39 -0
- package/lib/browser/decode/customCoder.d.ts +44 -0
- package/lib/browser/decode/customCoder.js +64 -0
- package/lib/browser/decode/user.d.ts +4 -0
- package/lib/browser/decode/user.js +337 -0
- package/lib/browser/dlob/DLOB.d.ts +253 -0
- package/lib/browser/dlob/DLOB.js +1137 -0
- package/lib/browser/dlob/DLOBNode.d.ts +70 -0
- package/lib/browser/dlob/DLOBNode.js +103 -0
- package/lib/browser/dlob/DLOBSubscriber.d.ts +57 -0
- package/lib/browser/dlob/DLOBSubscriber.js +143 -0
- package/lib/browser/dlob/NodeList.d.ts +27 -0
- package/lib/browser/dlob/NodeList.js +126 -0
- package/lib/browser/dlob/orderBookLevels.d.ts +77 -0
- package/lib/browser/dlob/orderBookLevels.js +404 -0
- package/lib/browser/dlob/types.d.ts +18 -0
- package/lib/browser/dlob/types.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 +55 -0
- package/lib/browser/events/eventSubscriber.js +229 -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 +8 -0
- package/lib/browser/events/parse.js +199 -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 +104 -0
- package/lib/browser/events/types.js +36 -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 +500 -0
- package/lib/browser/factory/oracleClient.d.ts +5 -0
- package/lib/browser/factory/oracleClient.js +53 -0
- package/lib/browser/idl/drift.d.ts +23894 -0
- package/lib/browser/idl/drift.js +2 -0
- package/lib/browser/idl/drift.json +18698 -0
- package/lib/browser/idl/pyth.d.ts +97 -0
- package/lib/browser/idl/pyth.js +2 -0
- package/lib/browser/idl/token_faucet.d.ts +197 -0
- package/lib/browser/idl/token_faucet.js +2 -0
- package/lib/browser/idl/token_faucet.json +229 -0
- package/lib/browser/index.d.ts +144 -0
- package/lib/browser/index.js +175 -0
- package/lib/browser/indicative-quotes/indicativeQuotesSender.d.ts +35 -0
- package/lib/browser/indicative-quotes/indicativeQuotesSender.js +192 -0
- package/lib/browser/isomorphic/anchor.browser.d.ts +24 -0
- package/lib/browser/isomorphic/anchor.browser.js +60 -0
- package/lib/browser/isomorphic/anchor.d.ts +24 -0
- package/lib/browser/isomorphic/anchor.js +60 -0
- package/lib/browser/isomorphic/anchor29.browser.d.ts +12 -0
- package/lib/browser/isomorphic/anchor29.browser.js +48 -0
- package/lib/browser/isomorphic/anchor29.d.ts +12 -0
- package/lib/browser/isomorphic/anchor29.js +48 -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 +291 -0
- package/lib/browser/jupiter/jupiterClient.js +164 -0
- package/lib/browser/keypair.d.ts +2 -0
- package/lib/browser/keypair.js +28 -0
- package/lib/browser/marginCalculation.d.ts +67 -0
- package/lib/browser/marginCalculation.js +176 -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 +671 -0
- package/lib/browser/math/auction.d.ts +65 -0
- package/lib/browser/math/auction.js +261 -0
- package/lib/browser/math/bankruptcy.d.ts +2 -0
- package/lib/browser/math/bankruptcy.js +32 -0
- package/lib/browser/math/builder.d.ts +5 -0
- package/lib/browser/math/builder.js +22 -0
- package/lib/browser/math/conversion.d.ts +4 -0
- package/lib/browser/math/conversion.js +21 -0
- package/lib/browser/math/exchangeStatus.d.ts +8 -0
- package/lib/browser/math/exchangeStatus.js +85 -0
- package/lib/browser/math/funding.d.ts +44 -0
- package/lib/browser/math/funding.js +260 -0
- package/lib/browser/math/insurance.d.ts +8 -0
- package/lib/browser/math/insurance.js +74 -0
- package/lib/browser/math/liquidation.d.ts +7 -0
- package/lib/browser/math/liquidation.js +134 -0
- package/lib/browser/math/margin.d.ts +45 -0
- package/lib/browser/math/margin.js +205 -0
- package/lib/browser/math/market.d.ts +50 -0
- package/lib/browser/math/market.js +234 -0
- package/lib/browser/math/oracles.d.ts +19 -0
- package/lib/browser/math/oracles.js +215 -0
- package/lib/browser/math/orders.d.ts +36 -0
- package/lib/browser/math/orders.js +294 -0
- package/lib/browser/math/position.d.ts +71 -0
- package/lib/browser/math/position.js +232 -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 +85 -0
- package/lib/browser/math/spotBalance.js +438 -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 +79 -0
- package/lib/browser/math/state.d.ts +8 -0
- package/lib/browser/math/state.js +44 -0
- package/lib/browser/math/superStake.d.ts +168 -0
- package/lib/browser/math/superStake.js +308 -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 +93 -0
- package/lib/browser/math/trade.js +503 -0
- package/lib/browser/math/utils.d.ts +23 -0
- package/lib/browser/math/utils.js +113 -0
- package/lib/browser/memcmp.d.ts +18 -0
- package/lib/browser/memcmp.js +162 -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 +9 -0
- package/lib/browser/oracles/oracleId.js +89 -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/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/types.d.ts +33 -0
- package/lib/browser/oracles/types.js +2 -0
- package/lib/browser/oracles/utils.d.ts +4 -0
- package/lib/browser/oracles/utils.js +8 -0
- package/lib/browser/orderParams.d.ts +29 -0
- package/lib/browser/orderParams.js +44 -0
- package/lib/browser/orderSubscriber/OrderSubscriber.d.ts +45 -0
- package/lib/browser/orderSubscriber/OrderSubscriber.js +193 -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 +75 -0
- package/lib/browser/orderSubscriber/index.d.ts +7 -0
- package/lib/browser/orderSubscriber/index.js +23 -0
- package/lib/browser/orderSubscriber/types.d.ts +35 -0
- package/lib/browser/orderSubscriber/types.js +2 -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/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 +16 -0
- package/lib/browser/priorityFee/index.js +32 -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 +48 -0
- package/lib/browser/priorityFee/priorityFeeSubscriber.js +193 -0
- package/lib/browser/priorityFee/priorityFeeSubscriberMap.d.ts +50 -0
- package/lib/browser/priorityFee/priorityFeeSubscriberMap.js +96 -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 +35 -0
- package/lib/browser/priorityFee/types.js +10 -0
- package/lib/browser/priorityFee/velocityPriorityFeeMethod.d.ts +21 -0
- package/lib/browser/priorityFee/velocityPriorityFeeMethod.js +28 -0
- package/lib/browser/pyth/constants.d.ts +3 -0
- package/lib/browser/pyth/constants.js +6 -0
- package/lib/browser/pyth/index.d.ts +4 -0
- package/lib/browser/pyth/index.js +12 -0
- package/lib/browser/pyth/pythLazerSubscriber.d.ts +91 -0
- package/lib/browser/pyth/pythLazerSubscriber.js +276 -0
- package/lib/browser/pyth/types.d.ts +2226 -0
- package/lib/browser/pyth/types.js +2224 -0
- package/lib/browser/pyth/utils.d.ts +2 -0
- package/lib/browser/pyth/utils.js +10 -0
- package/lib/browser/slot/SlotSubscriber.d.ts +27 -0
- package/lib/browser/slot/SlotSubscriber.js +76 -0
- package/lib/browser/slot/SlothashSubscriber.d.ts +25 -0
- package/lib/browser/slot/SlothashSubscriber.js +88 -0
- package/lib/browser/swap/UnifiedSwapClient.d.ts +120 -0
- package/lib/browser/swap/UnifiedSwapClient.js +179 -0
- package/lib/browser/swift/grpcSignedMsgUserAccountSubscriber.d.ts +22 -0
- package/lib/browser/swift/grpcSignedMsgUserAccountSubscriber.js +57 -0
- package/lib/browser/swift/index.d.ts +10 -0
- package/lib/browser/swift/index.js +26 -0
- package/lib/browser/swift/signedMsgUserAccountSubscriber.d.ts +42 -0
- package/lib/browser/swift/signedMsgUserAccountSubscriber.js +118 -0
- package/lib/browser/swift/swiftOrderSubscriber.d.ts +63 -0
- package/lib/browser/swift/swiftOrderSubscriber.js +187 -0
- package/lib/browser/testClient.d.ts +8 -0
- package/lib/browser/testClient.js +24 -0
- package/lib/browser/titan/titanClient.d.ts +90 -0
- package/lib/browser/titan/titanClient.js +227 -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 +292 -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 +173 -0
- package/lib/browser/tx/txHandler.js +522 -0
- package/lib/browser/tx/txParamProcessor.d.ts +26 -0
- package/lib/browser/tx/txParamProcessor.js +92 -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 +6 -0
- package/lib/browser/tx/utils.js +78 -0
- package/lib/browser/tx/whileValidTxSender.d.ts +45 -0
- package/lib/browser/tx/whileValidTxSender.js +168 -0
- package/lib/browser/types.d.ts +1747 -0
- package/lib/browser/types.js +427 -0
- package/lib/browser/user.d.ts +446 -0
- package/lib/browser/user.js +2372 -0
- package/lib/browser/userConfig.d.ts +31 -0
- package/lib/browser/userConfig.js +2 -0
- package/lib/browser/userMap/PollingSubscription.d.ts +15 -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 +184 -0
- package/lib/browser/userMap/revenueShareEscrowMap.d.ts +66 -0
- package/lib/browser/userMap/revenueShareEscrowMap.js +210 -0
- package/lib/browser/userMap/userMap.d.ts +114 -0
- package/lib/browser/userMap/userMap.js +486 -0
- package/lib/browser/userMap/userMapConfig.d.ts +40 -0
- package/lib/browser/userMap/userMapConfig.js +2 -0
- package/lib/browser/userMap/userStatsMap.d.ts +66 -0
- package/lib/browser/userMap/userStatsMap.js +266 -0
- package/lib/browser/userName.d.ts +5 -0
- package/lib/browser/userName.js +21 -0
- package/lib/browser/userStats.d.ts +24 -0
- package/lib/browser/userStats.js +70 -0
- package/lib/browser/userStatsConfig.d.ts +26 -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 +5 -0
- package/lib/browser/util/digest.js +19 -0
- package/lib/browser/util/ed25519Utils.d.ts +10 -0
- package/lib/browser/util/ed25519Utils.js +80 -0
- package/lib/browser/util/promiseTimeout.d.ts +1 -0
- package/lib/browser/util/promiseTimeout.js +14 -0
- package/lib/browser/util/tps.d.ts +2 -0
- package/lib/browser/util/tps.js +16 -0
- package/lib/browser/velocityClient.d.ts +1230 -0
- package/lib/browser/velocityClient.js +5778 -0
- package/lib/browser/velocityClientConfig.d.ts +84 -0
- package/lib/browser/velocityClientConfig.js +2 -0
- package/lib/browser/wallet.d.ts +16 -0
- package/lib/browser/wallet.js +46 -0
- package/lib/node/accounts/basicUserAccountSubscriber.d.ts +28 -0
- package/lib/node/accounts/basicUserAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/basicUserAccountSubscriber.js +38 -0
- package/lib/node/accounts/basicUserStatsAccountSubscriber.d.ts +28 -0
- package/lib/node/accounts/basicUserStatsAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/basicUserStatsAccountSubscriber.js +38 -0
- package/lib/node/accounts/bulkAccountLoader.d.ts +38 -0
- package/lib/node/accounts/bulkAccountLoader.d.ts.map +1 -0
- package/lib/node/accounts/bulkAccountLoader.js +222 -0
- package/lib/node/accounts/bulkUserStatsSubscription.d.ts +8 -0
- package/lib/node/accounts/bulkUserStatsSubscription.d.ts.map +1 -0
- package/lib/node/accounts/bulkUserStatsSubscription.js +21 -0
- package/lib/node/accounts/bulkUserSubscription.d.ts +8 -0
- package/lib/node/accounts/bulkUserSubscription.d.ts.map +1 -0
- package/lib/node/accounts/bulkUserSubscription.js +21 -0
- package/lib/node/accounts/customizedCadenceBulkAccountLoader.d.ts +45 -0
- package/lib/node/accounts/customizedCadenceBulkAccountLoader.d.ts.map +1 -0
- package/lib/node/accounts/customizedCadenceBulkAccountLoader.js +152 -0
- package/lib/node/accounts/fetch.d.ts +18 -0
- package/lib/node/accounts/fetch.d.ts.map +1 -0
- package/lib/node/accounts/fetch.js +60 -0
- package/lib/node/accounts/grpcAccountSubscriber.d.ts +18 -0
- package/lib/node/accounts/grpcAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/grpcAccountSubscriber.js +162 -0
- package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts +11 -0
- package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.js +31 -0
- package/lib/node/accounts/grpcMultiAccountSubscriber.d.ts +38 -0
- package/lib/node/accounts/grpcMultiAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/grpcMultiAccountSubscriber.js +378 -0
- package/lib/node/accounts/grpcMultiUserAccountSubscriber.d.ts +26 -0
- package/lib/node/accounts/grpcMultiUserAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/grpcMultiUserAccountSubscriber.js +203 -0
- package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts +19 -0
- package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/grpcProgramAccountSubscriber.js +179 -0
- package/lib/node/accounts/grpcUserAccountSubscriber.d.ts +11 -0
- package/lib/node/accounts/grpcUserAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/grpcUserAccountSubscriber.js +28 -0
- package/lib/node/accounts/grpcUserStatsAccountSubscriber.d.ts +11 -0
- package/lib/node/accounts/grpcUserStatsAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/grpcUserStatsAccountSubscriber.js +28 -0
- package/lib/node/accounts/grpcVelocityClientAccountSubscriber.d.ts +17 -0
- package/lib/node/accounts/grpcVelocityClientAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/grpcVelocityClientAccountSubscriber.js +101 -0
- package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.d.ts +70 -0
- package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.d.ts.map +1 -0
- package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.js +457 -0
- package/lib/node/accounts/laserProgramAccountSubscriber.d.ts +24 -0
- package/lib/node/accounts/laserProgramAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/laserProgramAccountSubscriber.js +162 -0
- package/lib/node/accounts/oneShotUserAccountSubscriber.d.ts +19 -0
- package/lib/node/accounts/oneShotUserAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/oneShotUserAccountSubscriber.js +48 -0
- package/lib/node/accounts/oneShotUserStatsAccountSubscriber.d.ts +19 -0
- package/lib/node/accounts/oneShotUserStatsAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/oneShotUserStatsAccountSubscriber.js +48 -0
- package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts +30 -0
- package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.js +110 -0
- package/lib/node/accounts/pollingOracleAccountSubscriber.d.ts +28 -0
- package/lib/node/accounts/pollingOracleAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/pollingOracleAccountSubscriber.js +78 -0
- package/lib/node/accounts/pollingTokenAccountSubscriber.d.ts +27 -0
- package/lib/node/accounts/pollingTokenAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/pollingTokenAccountSubscriber.js +78 -0
- package/lib/node/accounts/pollingUserAccountSubscriber.d.ts +30 -0
- package/lib/node/accounts/pollingUserAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/pollingUserAccountSubscriber.js +102 -0
- package/lib/node/accounts/pollingUserStatsAccountSubscriber.d.ts +28 -0
- package/lib/node/accounts/pollingUserStatsAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/pollingUserStatsAccountSubscriber.js +94 -0
- package/lib/node/accounts/pollingVelocityClientAccountSubscriber.d.ts +74 -0
- package/lib/node/accounts/pollingVelocityClientAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/pollingVelocityClientAccountSubscriber.js +420 -0
- package/lib/node/accounts/testBulkAccountLoader.d.ts +5 -0
- package/lib/node/accounts/testBulkAccountLoader.d.ts.map +1 -0
- package/lib/node/accounts/testBulkAccountLoader.js +43 -0
- package/lib/node/accounts/types.d.ts +206 -0
- package/lib/node/accounts/types.d.ts.map +1 -0
- package/lib/node/accounts/types.js +16 -0
- package/lib/node/accounts/utils.d.ts +9 -0
- package/lib/node/accounts/utils.d.ts.map +1 -0
- package/lib/node/accounts/utils.js +49 -0
- package/lib/node/accounts/webSocketAccountSubscriber.d.ts +30 -0
- package/lib/node/accounts/webSocketAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/webSocketAccountSubscriber.js +170 -0
- package/lib/node/accounts/webSocketAccountSubscriberV2.d.ts +110 -0
- package/lib/node/accounts/webSocketAccountSubscriberV2.d.ts.map +1 -0
- package/lib/node/accounts/webSocketAccountSubscriberV2.js +395 -0
- package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +24 -0
- package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.js +67 -0
- package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts +32 -0
- package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/webSocketProgramAccountSubscriber.js +120 -0
- package/lib/node/accounts/webSocketProgramAccountSubscriberV2.d.ts +146 -0
- package/lib/node/accounts/webSocketProgramAccountSubscriberV2.d.ts.map +1 -0
- package/lib/node/accounts/webSocketProgramAccountSubscriberV2.js +744 -0
- package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.d.ts +146 -0
- package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.d.ts.map +1 -0
- package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.js +744 -0
- package/lib/node/accounts/webSocketUserAccountSubscriber.d.ts +24 -0
- package/lib/node/accounts/webSocketUserAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/webSocketUserAccountSubscriber.js +61 -0
- package/lib/node/accounts/webSocketUserStatsAccountSubsriber.d.ts +23 -0
- package/lib/node/accounts/webSocketUserStatsAccountSubsriber.d.ts.map +1 -0
- package/lib/node/accounts/webSocketUserStatsAccountSubsriber.js +52 -0
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.d.ts +78 -0
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.js +400 -0
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts +92 -0
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts.map +1 -0
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.js +446 -0
- package/lib/node/accounts/websocketProgramUserAccountSubscriber.d.ts +23 -0
- package/lib/node/accounts/websocketProgramUserAccountSubscriber.d.ts.map +1 -0
- package/lib/node/accounts/websocketProgramUserAccountSubscriber.js +54 -0
- package/lib/node/addresses/marketAddresses.d.ts +3 -0
- package/lib/node/addresses/marketAddresses.d.ts.map +1 -0
- package/lib/node/addresses/marketAddresses.js +15 -0
- package/lib/node/addresses/pda.d.ts +48 -0
- package/lib/node/addresses/pda.d.ts.map +1 -0
- package/lib/node/addresses/pda.js +263 -0
- package/lib/node/adminClient.d.ts +403 -0
- package/lib/node/adminClient.d.ts.map +1 -0
- package/lib/node/adminClient.js +2798 -0
- package/lib/node/assert/assert.d.ts +2 -0
- package/lib/node/assert/assert.d.ts.map +1 -0
- package/lib/node/assert/assert.js +9 -0
- package/lib/node/auctionSubscriber/auctionSubscriber.d.ts +15 -0
- package/lib/node/auctionSubscriber/auctionSubscriber.d.ts.map +1 -0
- package/lib/node/auctionSubscriber/auctionSubscriber.js +32 -0
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts +16 -0
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts.map +1 -0
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.js +32 -0
- package/lib/node/auctionSubscriber/index.d.ts +4 -0
- package/lib/node/auctionSubscriber/index.d.ts.map +1 -0
- package/lib/node/auctionSubscriber/index.js +19 -0
- package/lib/node/auctionSubscriber/types.d.ts +15 -0
- package/lib/node/auctionSubscriber/types.d.ts.map +1 -0
- package/lib/node/auctionSubscriber/types.js +2 -0
- package/lib/node/bankrun/bankrunConnection.d.ts +77 -0
- package/lib/node/bankrun/bankrunConnection.d.ts.map +1 -0
- package/lib/node/bankrun/bankrunConnection.js +348 -0
- package/lib/node/blockhashSubscriber/BlockhashSubscriber.d.ts +28 -0
- package/lib/node/blockhashSubscriber/BlockhashSubscriber.d.ts.map +1 -0
- package/lib/node/blockhashSubscriber/BlockhashSubscriber.js +89 -0
- package/lib/node/blockhashSubscriber/index.d.ts +2 -0
- package/lib/node/blockhashSubscriber/index.d.ts.map +1 -0
- package/lib/node/blockhashSubscriber/index.js +17 -0
- package/lib/node/blockhashSubscriber/types.d.ts +8 -0
- package/lib/node/blockhashSubscriber/types.d.ts.map +1 -0
- package/lib/node/blockhashSubscriber/types.js +2 -0
- package/lib/node/clock/clockSubscriber.d.ts +32 -0
- package/lib/node/clock/clockSubscriber.d.ts.map +1 -0
- package/lib/node/clock/clockSubscriber.js +80 -0
- package/lib/node/config.d.ts +76 -0
- package/lib/node/config.d.ts.map +1 -0
- package/lib/node/config.js +164 -0
- package/lib/node/constants/index.d.ts +11 -0
- package/lib/node/constants/index.d.ts.map +1 -0
- package/lib/node/constants/index.js +26 -0
- package/lib/node/constants/insuranceFund.d.ts +6 -0
- package/lib/node/constants/insuranceFund.d.ts.map +1 -0
- package/lib/node/constants/insuranceFund.js +9 -0
- package/lib/node/constants/numericConstants.d.ts +74 -0
- package/lib/node/constants/numericConstants.d.ts.map +1 -0
- package/lib/node/constants/numericConstants.js +79 -0
- package/lib/node/constants/perpMarkets.d.ts +22 -0
- package/lib/node/constants/perpMarkets.d.ts.map +1 -0
- package/lib/node/constants/perpMarkets.js +971 -0
- package/lib/node/constants/spotMarkets.d.ts +25 -0
- package/lib/node/constants/spotMarkets.d.ts.map +1 -0
- package/lib/node/constants/spotMarkets.js +797 -0
- package/lib/node/constants/txConstants.d.ts +2 -0
- package/lib/node/constants/txConstants.d.ts.map +1 -0
- package/lib/node/constants/txConstants.js +4 -0
- package/lib/node/constituentMap/constituentMap.d.ts +67 -0
- package/lib/node/constituentMap/constituentMap.d.ts.map +1 -0
- package/lib/node/constituentMap/constituentMap.js +177 -0
- package/lib/node/constituentMap/pollingConstituentAccountSubscriber.d.ts +25 -0
- package/lib/node/constituentMap/pollingConstituentAccountSubscriber.d.ts.map +1 -0
- package/lib/node/constituentMap/pollingConstituentAccountSubscriber.js +60 -0
- package/lib/node/constituentMap/webSocketConstituentAccountSubscriber.d.ts +25 -0
- package/lib/node/constituentMap/webSocketConstituentAccountSubscriber.d.ts.map +1 -0
- package/lib/node/constituentMap/webSocketConstituentAccountSubscriber.js +58 -0
- package/lib/node/core/VelocityCore.d.ts +227 -0
- package/lib/node/core/VelocityCore.d.ts.map +1 -0
- package/lib/node/core/VelocityCore.js +138 -0
- package/lib/node/core/index.d.ts +13 -0
- package/lib/node/core/index.d.ts.map +1 -0
- package/lib/node/core/index.js +28 -0
- package/lib/node/core/instructions/deposit.d.ts +20 -0
- package/lib/node/core/instructions/deposit.d.ts.map +1 -0
- package/lib/node/core/instructions/deposit.js +19 -0
- package/lib/node/core/instructions/fill.d.ts +14 -0
- package/lib/node/core/instructions/fill.d.ts.map +1 -0
- package/lib/node/core/instructions/fill.js +17 -0
- package/lib/node/core/instructions/funding.d.ts +10 -0
- package/lib/node/core/instructions/funding.d.ts.map +1 -0
- package/lib/node/core/instructions/funding.js +13 -0
- package/lib/node/core/instructions/liquidation.d.ts +16 -0
- package/lib/node/core/instructions/liquidation.d.ts.map +1 -0
- package/lib/node/core/instructions/liquidation.js +17 -0
- package/lib/node/core/instructions/orders.d.ts +23 -0
- package/lib/node/core/instructions/orders.d.ts.map +1 -0
- package/lib/node/core/instructions/orders.js +27 -0
- package/lib/node/core/instructions/perpOrders.d.ts +79 -0
- package/lib/node/core/instructions/perpOrders.d.ts.map +1 -0
- package/lib/node/core/instructions/perpOrders.js +99 -0
- package/lib/node/core/instructions/settlement.d.ts +12 -0
- package/lib/node/core/instructions/settlement.d.ts.map +1 -0
- package/lib/node/core/instructions/settlement.js +15 -0
- package/lib/node/core/instructions/trigger.d.ts +12 -0
- package/lib/node/core/instructions/trigger.d.ts.map +1 -0
- package/lib/node/core/instructions/trigger.js +15 -0
- package/lib/node/core/instructions/withdraw.d.ts +21 -0
- package/lib/node/core/instructions/withdraw.d.ts.map +1 -0
- package/lib/node/core/instructions/withdraw.js +20 -0
- package/lib/node/core/remainingAccounts.d.ts +28 -0
- package/lib/node/core/remainingAccounts.d.ts.map +1 -0
- package/lib/node/core/remainingAccounts.js +122 -0
- package/lib/node/core/signedMsg.d.ts +18 -0
- package/lib/node/core/signedMsg.d.ts.map +1 -0
- package/lib/node/core/signedMsg.js +39 -0
- package/lib/node/decode/customCoder.d.ts +45 -0
- package/lib/node/decode/customCoder.d.ts.map +1 -0
- package/lib/node/decode/customCoder.js +64 -0
- package/lib/node/decode/user.d.ts +5 -0
- package/lib/node/decode/user.d.ts.map +1 -0
- package/lib/node/decode/user.js +337 -0
- package/lib/node/dlob/DLOB.d.ts +254 -0
- package/lib/node/dlob/DLOB.d.ts.map +1 -0
- package/lib/node/dlob/DLOB.js +1137 -0
- package/lib/node/dlob/DLOBNode.d.ts +71 -0
- package/lib/node/dlob/DLOBNode.d.ts.map +1 -0
- package/lib/node/dlob/DLOBNode.js +103 -0
- package/lib/node/dlob/DLOBSubscriber.d.ts +58 -0
- package/lib/node/dlob/DLOBSubscriber.d.ts.map +1 -0
- package/lib/node/dlob/DLOBSubscriber.js +143 -0
- package/lib/node/dlob/NodeList.d.ts +28 -0
- package/lib/node/dlob/NodeList.d.ts.map +1 -0
- package/lib/node/dlob/NodeList.js +126 -0
- package/lib/node/dlob/orderBookLevels.d.ts +78 -0
- package/lib/node/dlob/orderBookLevels.d.ts.map +1 -0
- package/lib/node/dlob/orderBookLevels.js +404 -0
- package/lib/node/dlob/types.d.ts +19 -0
- package/lib/node/dlob/types.d.ts.map +1 -0
- package/lib/node/dlob/types.js +2 -0
- package/lib/node/events/eventList.d.ts +23 -0
- package/lib/node/events/eventList.d.ts.map +1 -0
- package/lib/node/events/eventList.js +80 -0
- package/lib/node/events/eventSubscriber.d.ts +56 -0
- package/lib/node/events/eventSubscriber.d.ts.map +1 -0
- package/lib/node/events/eventSubscriber.js +229 -0
- package/lib/node/events/eventsServerLogProvider.d.ts +22 -0
- package/lib/node/events/eventsServerLogProvider.d.ts.map +1 -0
- package/lib/node/events/eventsServerLogProvider.js +121 -0
- package/lib/node/events/fetchLogs.d.ts +26 -0
- package/lib/node/events/fetchLogs.d.ts.map +1 -0
- package/lib/node/events/fetchLogs.js +99 -0
- package/lib/node/events/parse.d.ts +9 -0
- package/lib/node/events/parse.d.ts.map +1 -0
- package/lib/node/events/parse.js +199 -0
- package/lib/node/events/pollingLogProvider.d.ts +18 -0
- package/lib/node/events/pollingLogProvider.d.ts.map +1 -0
- package/lib/node/events/pollingLogProvider.js +58 -0
- package/lib/node/events/sort.d.ts +3 -0
- package/lib/node/events/sort.d.ts.map +1 -0
- package/lib/node/events/sort.js +24 -0
- package/lib/node/events/txEventCache.d.ts +25 -0
- package/lib/node/events/txEventCache.d.ts.map +1 -0
- package/lib/node/events/txEventCache.js +71 -0
- package/lib/node/events/types.d.ts +105 -0
- package/lib/node/events/types.d.ts.map +1 -0
- package/lib/node/events/types.js +36 -0
- package/lib/node/events/webSocketLogProvider.d.ts +25 -0
- package/lib/node/events/webSocketLogProvider.d.ts.map +1 -0
- package/lib/node/events/webSocketLogProvider.js +96 -0
- package/lib/node/factory/bigNum.d.ts +123 -0
- package/lib/node/factory/bigNum.d.ts.map +1 -0
- package/lib/node/factory/bigNum.js +500 -0
- package/lib/node/factory/oracleClient.d.ts +6 -0
- package/lib/node/factory/oracleClient.d.ts.map +1 -0
- package/lib/node/factory/oracleClient.js +53 -0
- package/lib/node/idl/drift.d.ts +23895 -0
- package/lib/node/idl/drift.d.ts.map +1 -0
- package/lib/node/idl/drift.js +2 -0
- package/lib/node/idl/drift.json +18698 -0
- package/lib/node/idl/pyth.d.ts +98 -0
- package/lib/node/idl/pyth.d.ts.map +1 -0
- package/lib/node/idl/pyth.js +2 -0
- package/lib/node/idl/token_faucet.d.ts +198 -0
- package/lib/node/idl/token_faucet.d.ts.map +1 -0
- package/lib/node/idl/token_faucet.js +2 -0
- package/lib/node/idl/token_faucet.json +229 -0
- package/lib/node/index.d.ts +145 -0
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/index.js +175 -0
- package/lib/node/indicative-quotes/indicativeQuotesSender.d.ts +36 -0
- package/lib/node/indicative-quotes/indicativeQuotesSender.d.ts.map +1 -0
- package/lib/node/indicative-quotes/indicativeQuotesSender.js +192 -0
- package/lib/node/isomorphic/anchor.browser.d.ts.map +1 -0
- package/lib/node/isomorphic/anchor.d.ts +2 -0
- package/lib/node/isomorphic/anchor.d.ts.map +1 -0
- package/lib/node/isomorphic/anchor.js +17 -0
- package/lib/node/isomorphic/anchor.node.d.ts +2 -0
- package/lib/node/isomorphic/anchor.node.d.ts.map +1 -0
- package/lib/node/isomorphic/anchor.node.js +17 -0
- package/lib/node/isomorphic/anchor29.browser.d.ts.map +1 -0
- package/lib/node/isomorphic/anchor29.d.ts +2 -0
- package/lib/node/isomorphic/anchor29.d.ts.map +1 -0
- package/lib/node/isomorphic/anchor29.js +17 -0
- package/lib/node/isomorphic/anchor29.node.d.ts +2 -0
- package/lib/node/isomorphic/anchor29.node.d.ts.map +1 -0
- package/lib/node/isomorphic/anchor29.node.js +17 -0
- package/lib/node/isomorphic/grpc.browser.d.ts.map +1 -0
- package/lib/node/isomorphic/grpc.d.ts +18 -0
- package/lib/node/isomorphic/grpc.d.ts.map +1 -0
- package/lib/node/isomorphic/grpc.js +109 -0
- package/lib/node/isomorphic/grpc.node.d.ts +18 -0
- package/lib/node/isomorphic/grpc.node.d.ts.map +1 -0
- package/lib/node/isomorphic/grpc.node.js +109 -0
- package/lib/node/jupiter/jupiterClient.d.ts +292 -0
- package/lib/node/jupiter/jupiterClient.d.ts.map +1 -0
- package/lib/node/jupiter/jupiterClient.js +164 -0
- package/lib/node/keypair.d.ts +3 -0
- package/lib/node/keypair.d.ts.map +1 -0
- package/lib/node/keypair.js +28 -0
- package/lib/node/marginCalculation.d.ts +68 -0
- package/lib/node/marginCalculation.d.ts.map +1 -0
- package/lib/node/marginCalculation.js +176 -0
- package/lib/node/marinade/index.d.ts +13 -0
- package/lib/node/marinade/index.d.ts.map +1 -0
- package/lib/node/marinade/index.js +36 -0
- package/lib/node/marinade/types.d.ts +1964 -0
- package/lib/node/marinade/types.d.ts.map +1 -0
- package/lib/node/marinade/types.js +1965 -0
- package/lib/node/math/amm.d.ts +99 -0
- package/lib/node/math/amm.d.ts.map +1 -0
- package/lib/node/math/amm.js +671 -0
- package/lib/node/math/auction.d.ts +66 -0
- package/lib/node/math/auction.d.ts.map +1 -0
- package/lib/node/math/auction.js +261 -0
- package/lib/node/math/bankruptcy.d.ts +3 -0
- package/lib/node/math/bankruptcy.d.ts.map +1 -0
- package/lib/node/math/bankruptcy.js +32 -0
- package/lib/node/math/builder.d.ts +6 -0
- package/lib/node/math/builder.d.ts.map +1 -0
- package/lib/node/math/builder.js +22 -0
- package/lib/node/math/conversion.d.ts +5 -0
- package/lib/node/math/conversion.d.ts.map +1 -0
- package/lib/node/math/conversion.js +21 -0
- package/lib/node/math/exchangeStatus.d.ts +9 -0
- package/lib/node/math/exchangeStatus.d.ts.map +1 -0
- package/lib/node/math/exchangeStatus.js +85 -0
- package/lib/node/math/funding.d.ts +45 -0
- package/lib/node/math/funding.d.ts.map +1 -0
- package/lib/node/math/funding.js +260 -0
- package/lib/node/math/insurance.d.ts +9 -0
- package/lib/node/math/insurance.d.ts.map +1 -0
- package/lib/node/math/insurance.js +74 -0
- package/lib/node/math/liquidation.d.ts +8 -0
- package/lib/node/math/liquidation.d.ts.map +1 -0
- package/lib/node/math/liquidation.js +134 -0
- package/lib/node/math/margin.d.ts +46 -0
- package/lib/node/math/margin.d.ts.map +1 -0
- package/lib/node/math/margin.js +205 -0
- package/lib/node/math/market.d.ts +51 -0
- package/lib/node/math/market.d.ts.map +1 -0
- package/lib/node/math/market.js +234 -0
- package/lib/node/math/oracles.d.ts +20 -0
- package/lib/node/math/oracles.d.ts.map +1 -0
- package/lib/node/math/oracles.js +215 -0
- package/lib/node/math/orders.d.ts +37 -0
- package/lib/node/math/orders.d.ts.map +1 -0
- package/lib/node/math/orders.js +294 -0
- package/lib/node/math/position.d.ts +72 -0
- package/lib/node/math/position.d.ts.map +1 -0
- package/lib/node/math/position.js +232 -0
- package/lib/node/math/repeg.d.ts +23 -0
- package/lib/node/math/repeg.d.ts.map +1 -0
- package/lib/node/math/repeg.js +164 -0
- package/lib/node/math/spotBalance.d.ts +86 -0
- package/lib/node/math/spotBalance.d.ts.map +1 -0
- package/lib/node/math/spotBalance.js +438 -0
- package/lib/node/math/spotMarket.d.ts +12 -0
- package/lib/node/math/spotMarket.d.ts.map +1 -0
- package/lib/node/math/spotMarket.js +49 -0
- package/lib/node/math/spotPosition.d.ts +20 -0
- package/lib/node/math/spotPosition.d.ts.map +1 -0
- package/lib/node/math/spotPosition.js +79 -0
- package/lib/node/math/state.d.ts +9 -0
- package/lib/node/math/state.d.ts.map +1 -0
- package/lib/node/math/state.js +44 -0
- package/lib/node/math/superStake.d.ts +169 -0
- package/lib/node/math/superStake.d.ts.map +1 -0
- package/lib/node/math/superStake.js +308 -0
- package/lib/node/math/tiers.d.ts +5 -0
- package/lib/node/math/tiers.d.ts.map +1 -0
- package/lib/node/math/tiers.js +52 -0
- package/lib/node/math/trade.d.ts +94 -0
- package/lib/node/math/trade.d.ts.map +1 -0
- package/lib/node/math/trade.js +503 -0
- package/lib/node/math/utils.d.ts +24 -0
- package/lib/node/math/utils.d.ts.map +1 -0
- package/lib/node/math/utils.js +113 -0
- package/lib/node/memcmp.d.ts +19 -0
- package/lib/node/memcmp.d.ts.map +1 -0
- package/lib/node/memcmp.js +162 -0
- package/lib/node/oracles/oracleClientCache.d.ts +10 -0
- package/lib/node/oracles/oracleClientCache.d.ts.map +1 -0
- package/lib/node/oracles/oracleClientCache.js +19 -0
- package/lib/node/oracles/oracleId.d.ts +10 -0
- package/lib/node/oracles/oracleId.d.ts.map +1 -0
- package/lib/node/oracles/oracleId.js +89 -0
- package/lib/node/oracles/prelaunchOracleClient.d.ts +13 -0
- package/lib/node/oracles/prelaunchOracleClient.d.ts.map +1 -0
- package/lib/node/oracles/prelaunchOracleClient.js +24 -0
- package/lib/node/oracles/pythClient.d.ts +15 -0
- package/lib/node/oracles/pythClient.d.ts.map +1 -0
- package/lib/node/oracles/pythClient.js +51 -0
- package/lib/node/oracles/pythLazerClient.d.ts +17 -0
- package/lib/node/oracles/pythLazerClient.d.ts.map +1 -0
- package/lib/node/oracles/pythLazerClient.js +61 -0
- package/lib/node/oracles/quoteAssetOracleClient.d.ts +11 -0
- package/lib/node/oracles/quoteAssetOracleClient.d.ts.map +1 -0
- package/lib/node/oracles/quoteAssetOracleClient.js +21 -0
- package/lib/node/oracles/strictOraclePrice.d.ts +10 -0
- package/lib/node/oracles/strictOraclePrice.d.ts.map +1 -0
- package/lib/node/oracles/strictOraclePrice.js +17 -0
- package/lib/node/oracles/types.d.ts +34 -0
- package/lib/node/oracles/types.d.ts.map +1 -0
- package/lib/node/oracles/types.js +2 -0
- package/lib/node/oracles/utils.d.ts +5 -0
- package/lib/node/oracles/utils.d.ts.map +1 -0
- package/lib/node/oracles/utils.js +8 -0
- package/lib/node/orderParams.d.ts +30 -0
- package/lib/node/orderParams.d.ts.map +1 -0
- package/lib/node/orderParams.js +44 -0
- package/lib/node/orderSubscriber/OrderSubscriber.d.ts +46 -0
- package/lib/node/orderSubscriber/OrderSubscriber.d.ts.map +1 -0
- package/lib/node/orderSubscriber/OrderSubscriber.js +193 -0
- package/lib/node/orderSubscriber/PollingSubscription.d.ts +13 -0
- package/lib/node/orderSubscriber/PollingSubscription.d.ts.map +1 -0
- package/lib/node/orderSubscriber/PollingSubscription.js +23 -0
- package/lib/node/orderSubscriber/WebsocketSubscription.d.ts +24 -0
- package/lib/node/orderSubscriber/WebsocketSubscription.d.ts.map +1 -0
- package/lib/node/orderSubscriber/WebsocketSubscription.js +67 -0
- package/lib/node/orderSubscriber/grpcSubscription.d.ts +23 -0
- package/lib/node/orderSubscriber/grpcSubscription.d.ts.map +1 -0
- package/lib/node/orderSubscriber/grpcSubscription.js +75 -0
- package/lib/node/orderSubscriber/index.d.ts +8 -0
- package/lib/node/orderSubscriber/index.d.ts.map +1 -0
- package/lib/node/orderSubscriber/index.js +23 -0
- package/lib/node/orderSubscriber/types.d.ts +36 -0
- package/lib/node/orderSubscriber/types.d.ts.map +1 -0
- package/lib/node/orderSubscriber/types.js +2 -0
- package/lib/node/priorityFee/averageOverSlotsStrategy.d.ts +6 -0
- package/lib/node/priorityFee/averageOverSlotsStrategy.d.ts.map +1 -0
- package/lib/node/priorityFee/averageOverSlotsStrategy.js +16 -0
- package/lib/node/priorityFee/averageStrategy.d.ts +6 -0
- package/lib/node/priorityFee/averageStrategy.d.ts.map +1 -0
- package/lib/node/priorityFee/averageStrategy.js +11 -0
- package/lib/node/priorityFee/ewmaStrategy.d.ts +12 -0
- package/lib/node/priorityFee/ewmaStrategy.d.ts.map +1 -0
- package/lib/node/priorityFee/ewmaStrategy.js +33 -0
- package/lib/node/priorityFee/heliusPriorityFeeMethod.d.ts +21 -0
- package/lib/node/priorityFee/heliusPriorityFeeMethod.d.ts.map +1 -0
- package/lib/node/priorityFee/heliusPriorityFeeMethod.js +46 -0
- package/lib/node/priorityFee/index.d.ts +17 -0
- package/lib/node/priorityFee/index.d.ts.map +1 -0
- package/lib/node/priorityFee/index.js +32 -0
- package/lib/node/priorityFee/maxOverSlotsStrategy.d.ts +6 -0
- package/lib/node/priorityFee/maxOverSlotsStrategy.d.ts.map +1 -0
- package/lib/node/priorityFee/maxOverSlotsStrategy.js +17 -0
- package/lib/node/priorityFee/maxStrategy.d.ts +8 -0
- package/lib/node/priorityFee/maxStrategy.d.ts.map +1 -0
- package/lib/node/priorityFee/maxStrategy.js +9 -0
- package/lib/node/priorityFee/priorityFeeSubscriber.d.ts +49 -0
- package/lib/node/priorityFee/priorityFeeSubscriber.d.ts.map +1 -0
- package/lib/node/priorityFee/priorityFeeSubscriber.js +193 -0
- package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts +51 -0
- package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts.map +1 -0
- package/lib/node/priorityFee/priorityFeeSubscriberMap.js +96 -0
- package/lib/node/priorityFee/solanaPriorityFeeMethod.d.ts +7 -0
- package/lib/node/priorityFee/solanaPriorityFeeMethod.d.ts.map +1 -0
- package/lib/node/priorityFee/solanaPriorityFeeMethod.js +21 -0
- package/lib/node/priorityFee/types.d.ts +36 -0
- package/lib/node/priorityFee/types.d.ts.map +1 -0
- package/lib/node/priorityFee/types.js +10 -0
- package/lib/node/priorityFee/velocityPriorityFeeMethod.d.ts +22 -0
- package/lib/node/priorityFee/velocityPriorityFeeMethod.d.ts.map +1 -0
- package/lib/node/priorityFee/velocityPriorityFeeMethod.js +28 -0
- package/lib/node/pyth/constants.d.ts +4 -0
- package/lib/node/pyth/constants.d.ts.map +1 -0
- package/lib/node/pyth/constants.js +6 -0
- package/lib/node/pyth/index.d.ts +5 -0
- package/lib/node/pyth/index.d.ts.map +1 -0
- package/lib/node/pyth/index.js +12 -0
- package/lib/node/pyth/pythLazerSubscriber.d.ts +92 -0
- package/lib/node/pyth/pythLazerSubscriber.d.ts.map +1 -0
- package/lib/node/pyth/pythLazerSubscriber.js +276 -0
- package/lib/node/pyth/types.d.ts +2227 -0
- package/lib/node/pyth/types.d.ts.map +1 -0
- package/lib/node/pyth/types.js +2224 -0
- package/lib/node/pyth/utils.d.ts +3 -0
- package/lib/node/pyth/utils.d.ts.map +1 -0
- package/lib/node/pyth/utils.js +10 -0
- package/lib/node/slot/SlotSubscriber.d.ts +28 -0
- package/lib/node/slot/SlotSubscriber.d.ts.map +1 -0
- package/lib/node/slot/SlotSubscriber.js +76 -0
- package/lib/node/slot/SlothashSubscriber.d.ts +26 -0
- package/lib/node/slot/SlothashSubscriber.d.ts.map +1 -0
- package/lib/node/slot/SlothashSubscriber.js +88 -0
- package/lib/node/swap/UnifiedSwapClient.d.ts +121 -0
- package/lib/node/swap/UnifiedSwapClient.d.ts.map +1 -0
- package/lib/node/swap/UnifiedSwapClient.js +179 -0
- package/lib/node/swift/grpcSignedMsgUserAccountSubscriber.d.ts +23 -0
- package/lib/node/swift/grpcSignedMsgUserAccountSubscriber.d.ts.map +1 -0
- package/lib/node/swift/grpcSignedMsgUserAccountSubscriber.js +57 -0
- package/lib/node/swift/index.d.ts +11 -0
- package/lib/node/swift/index.d.ts.map +1 -0
- package/lib/node/swift/index.js +26 -0
- package/lib/node/swift/signedMsgUserAccountSubscriber.d.ts +43 -0
- package/lib/node/swift/signedMsgUserAccountSubscriber.d.ts.map +1 -0
- package/lib/node/swift/signedMsgUserAccountSubscriber.js +118 -0
- package/lib/node/swift/swiftOrderSubscriber.d.ts +64 -0
- package/lib/node/swift/swiftOrderSubscriber.d.ts.map +1 -0
- package/lib/node/swift/swiftOrderSubscriber.js +187 -0
- package/lib/node/testClient.d.ts +9 -0
- package/lib/node/testClient.d.ts.map +1 -0
- package/lib/node/testClient.js +24 -0
- package/lib/node/titan/titanClient.d.ts +91 -0
- package/lib/node/titan/titanClient.d.ts.map +1 -0
- package/lib/node/titan/titanClient.js +227 -0
- package/lib/node/token/index.d.ts +6 -0
- package/lib/node/token/index.d.ts.map +1 -0
- package/lib/node/token/index.js +15 -0
- package/lib/node/tokenFaucet.d.ts +42 -0
- package/lib/node/tokenFaucet.d.ts.map +1 -0
- package/lib/node/tokenFaucet.js +188 -0
- package/lib/node/tx/baseTxSender.d.ts +60 -0
- package/lib/node/tx/baseTxSender.d.ts.map +1 -0
- package/lib/node/tx/baseTxSender.js +292 -0
- package/lib/node/tx/blockhashFetcher/baseBlockhashFetcher.d.ts +9 -0
- package/lib/node/tx/blockhashFetcher/baseBlockhashFetcher.d.ts.map +1 -0
- package/lib/node/tx/blockhashFetcher/baseBlockhashFetcher.js +13 -0
- package/lib/node/tx/blockhashFetcher/cachedBlockhashFetcher.d.ts +29 -0
- package/lib/node/tx/blockhashFetcher/cachedBlockhashFetcher.d.ts.map +1 -0
- package/lib/node/tx/blockhashFetcher/cachedBlockhashFetcher.js +73 -0
- package/lib/node/tx/blockhashFetcher/types.d.ts +5 -0
- package/lib/node/tx/blockhashFetcher/types.d.ts.map +1 -0
- package/lib/node/tx/blockhashFetcher/types.js +2 -0
- package/lib/node/tx/fastSingleTxSender.d.ts +42 -0
- package/lib/node/tx/fastSingleTxSender.d.ts.map +1 -0
- package/lib/node/tx/fastSingleTxSender.js +86 -0
- package/lib/node/tx/forwardOnlyTxSender.d.ts +38 -0
- package/lib/node/tx/forwardOnlyTxSender.d.ts.map +1 -0
- package/lib/node/tx/forwardOnlyTxSender.js +92 -0
- package/lib/node/tx/priorityFeeCalculator.d.ts +45 -0
- package/lib/node/tx/priorityFeeCalculator.d.ts.map +1 -0
- package/lib/node/tx/priorityFeeCalculator.js +85 -0
- package/lib/node/tx/reportTransactionError.d.ts +21 -0
- package/lib/node/tx/reportTransactionError.d.ts.map +1 -0
- package/lib/node/tx/reportTransactionError.js +103 -0
- package/lib/node/tx/retryTxSender.d.ts +38 -0
- package/lib/node/tx/retryTxSender.d.ts.map +1 -0
- package/lib/node/tx/retryTxSender.js +86 -0
- package/lib/node/tx/txHandler.d.ts +174 -0
- package/lib/node/tx/txHandler.d.ts.map +1 -0
- package/lib/node/tx/txHandler.js +522 -0
- package/lib/node/tx/txParamProcessor.d.ts +27 -0
- package/lib/node/tx/txParamProcessor.d.ts.map +1 -0
- package/lib/node/tx/txParamProcessor.js +92 -0
- package/lib/node/tx/types.d.ts +30 -0
- package/lib/node/tx/types.d.ts.map +1 -0
- package/lib/node/tx/types.js +20 -0
- package/lib/node/tx/utils.d.ts +7 -0
- package/lib/node/tx/utils.d.ts.map +1 -0
- package/lib/node/tx/utils.js +78 -0
- package/lib/node/tx/whileValidTxSender.d.ts +46 -0
- package/lib/node/tx/whileValidTxSender.d.ts.map +1 -0
- package/lib/node/tx/whileValidTxSender.js +168 -0
- package/lib/node/types.d.ts +1748 -0
- package/lib/node/types.d.ts.map +1 -0
- package/lib/node/types.js +427 -0
- package/lib/node/user.d.ts +447 -0
- package/lib/node/user.d.ts.map +1 -0
- package/lib/node/user.js +2372 -0
- package/lib/node/userConfig.d.ts +32 -0
- package/lib/node/userConfig.d.ts.map +1 -0
- package/lib/node/userConfig.js +2 -0
- package/lib/node/userMap/PollingSubscription.d.ts +16 -0
- package/lib/node/userMap/PollingSubscription.d.ts.map +1 -0
- package/lib/node/userMap/PollingSubscription.js +30 -0
- package/lib/node/userMap/WebsocketSubscription.d.ts +28 -0
- package/lib/node/userMap/WebsocketSubscription.d.ts.map +1 -0
- package/lib/node/userMap/WebsocketSubscription.js +45 -0
- package/lib/node/userMap/grpcSubscription.d.ts +28 -0
- package/lib/node/userMap/grpcSubscription.d.ts.map +1 -0
- package/lib/node/userMap/grpcSubscription.js +44 -0
- package/lib/node/userMap/referrerMap.d.ts +46 -0
- package/lib/node/userMap/referrerMap.d.ts.map +1 -0
- package/lib/node/userMap/referrerMap.js +184 -0
- package/lib/node/userMap/revenueShareEscrowMap.d.ts +67 -0
- package/lib/node/userMap/revenueShareEscrowMap.d.ts.map +1 -0
- package/lib/node/userMap/revenueShareEscrowMap.js +210 -0
- package/lib/node/userMap/userMap.d.ts +115 -0
- package/lib/node/userMap/userMap.d.ts.map +1 -0
- package/lib/node/userMap/userMap.js +486 -0
- package/lib/node/userMap/userMapConfig.d.ts +41 -0
- package/lib/node/userMap/userMapConfig.d.ts.map +1 -0
- package/lib/node/userMap/userMapConfig.js +2 -0
- package/lib/node/userMap/userStatsMap.d.ts +67 -0
- package/lib/node/userMap/userStatsMap.d.ts.map +1 -0
- package/lib/node/userMap/userStatsMap.js +266 -0
- package/lib/node/userName.d.ts +6 -0
- package/lib/node/userName.d.ts.map +1 -0
- package/lib/node/userName.js +21 -0
- package/lib/node/userStats.d.ts +25 -0
- package/lib/node/userStats.d.ts.map +1 -0
- package/lib/node/userStats.js +70 -0
- package/lib/node/userStatsConfig.d.ts +27 -0
- package/lib/node/userStatsConfig.d.ts.map +1 -0
- package/lib/node/userStatsConfig.js +2 -0
- package/lib/node/util/TransactionConfirmationManager.d.ts +17 -0
- package/lib/node/util/TransactionConfirmationManager.d.ts.map +1 -0
- package/lib/node/util/TransactionConfirmationManager.js +174 -0
- package/lib/node/util/chainClock.d.ts +18 -0
- package/lib/node/util/chainClock.d.ts.map +1 -0
- package/lib/node/util/chainClock.js +29 -0
- package/lib/node/util/computeUnits.d.ts +9 -0
- package/lib/node/util/computeUnits.d.ts.map +1 -0
- package/lib/node/util/computeUnits.js +48 -0
- package/lib/node/util/digest.d.ts +6 -0
- package/lib/node/util/digest.d.ts.map +1 -0
- package/lib/node/util/digest.js +19 -0
- package/lib/node/util/ed25519Utils.d.ts +11 -0
- package/lib/node/util/ed25519Utils.d.ts.map +1 -0
- package/lib/node/util/ed25519Utils.js +80 -0
- package/lib/node/util/promiseTimeout.d.ts +2 -0
- package/lib/node/util/promiseTimeout.d.ts.map +1 -0
- package/lib/node/util/promiseTimeout.js +14 -0
- package/lib/node/util/tps.d.ts +3 -0
- package/lib/node/util/tps.d.ts.map +1 -0
- package/lib/node/util/tps.js +16 -0
- package/lib/node/velocityClient.d.ts +1231 -0
- package/lib/node/velocityClient.d.ts.map +1 -0
- package/lib/node/velocityClient.js +5778 -0
- package/lib/node/velocityClientConfig.d.ts +85 -0
- package/lib/node/velocityClientConfig.d.ts.map +1 -0
- package/lib/node/velocityClientConfig.js +2 -0
- package/lib/node/wallet.d.ts +17 -0
- package/lib/node/wallet.d.ts.map +1 -0
- package/lib/node/wallet.js +46 -0
- package/package.json +157 -0
- package/scripts/deposit-isolated-positions.ts +110 -0
- package/scripts/find-flagged-users.ts +213 -0
- package/scripts/grpc-client-test-comparison.ts +372 -0
- package/scripts/grpc-multiuser-client-test-comparison.ts +158 -0
- package/scripts/postbuild.js +95 -0
- package/scripts/single-grpc-client-test.ts +284 -0
- package/scripts/updateVersion.js +28 -0
- package/scripts/withdraw-isolated-positions.ts +174 -0
- package/src/accounts/README_WebSocketAccountSubscriberV2.md +95 -0
- package/src/accounts/README_WebSocketProgramAccountSubscriberV2.md +135 -0
- package/src/accounts/basicUserAccountSubscriber.ts +59 -0
- package/src/accounts/basicUserStatsAccountSubscriber.ts +65 -0
- package/src/accounts/bulkAccountLoader.ts +293 -0
- package/src/accounts/bulkUserStatsSubscription.ts +33 -0
- package/src/accounts/bulkUserSubscription.ts +33 -0
- package/src/accounts/customizedCadenceBulkAccountLoader.ts +213 -0
- package/src/accounts/fetch.ts +143 -0
- package/src/accounts/grpcAccountSubscriber.ts +187 -0
- package/src/accounts/grpcInsuranceFundStakeAccountSubscriber.ts +57 -0
- package/src/accounts/grpcMultiAccountSubscriber.ts +476 -0
- package/src/accounts/grpcMultiUserAccountSubscriber.ts +281 -0
- package/src/accounts/grpcProgramAccountSubscriber.ts +223 -0
- package/src/accounts/grpcUserAccountSubscriber.ts +48 -0
- package/src/accounts/grpcUserStatsAccountSubscriber.ts +50 -0
- package/src/accounts/grpcVelocityClientAccountSubscriber.ts +213 -0
- package/src/accounts/grpcVelocityClientAccountSubscriberV2.ts +762 -0
- package/src/accounts/laserProgramAccountSubscriber.ts +229 -0
- package/src/accounts/oneShotUserAccountSubscriber.ts +67 -0
- package/src/accounts/oneShotUserStatsAccountSubscriber.ts +70 -0
- package/src/accounts/pollingInsuranceFundStakeAccountSubscriber.ts +186 -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/pollingVelocityClientAccountSubscriber.ts +652 -0
- package/src/accounts/testBulkAccountLoader.ts +51 -0
- package/src/accounts/types.ts +284 -0
- package/src/accounts/utils.ts +62 -0
- package/src/accounts/webSocketAccountSubscriber.ts +250 -0
- package/src/accounts/webSocketAccountSubscriberV2.ts +517 -0
- package/src/accounts/webSocketInsuranceFundStakeAccountSubscriber.ts +129 -0
- package/src/accounts/webSocketProgramAccountSubscriber.ts +183 -0
- package/src/accounts/webSocketProgramAccountSubscriberV2.ts +996 -0
- package/src/accounts/webSocketProgramAccountsSubscriberV2.ts +996 -0
- package/src/accounts/webSocketUserAccountSubscriber.ts +104 -0
- package/src/accounts/webSocketUserStatsAccountSubsriber.ts +98 -0
- package/src/accounts/webSocketVelocityClientAccountSubscriber.ts +719 -0
- package/src/accounts/webSocketVelocityClientAccountSubscriberV2.ts +755 -0
- package/src/accounts/websocketProgramUserAccountSubscriber.ts +94 -0
- package/src/addresses/marketAddresses.ts +17 -0
- package/src/addresses/pda.ts +439 -0
- package/src/adminClient.ts +5936 -0
- package/src/assert/assert.ts +5 -0
- package/src/auctionSubscriber/auctionSubscriber.ts +68 -0
- package/src/auctionSubscriber/auctionSubscriberGrpc.ts +72 -0
- package/src/auctionSubscriber/index.ts +3 -0
- package/src/auctionSubscriber/types.ts +20 -0
- package/src/bankrun/bankrunConnection.ts +560 -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 +268 -0
- package/src/constants/index.ts +10 -0
- package/src/constants/insuranceFund.ts +8 -0
- package/src/constants/numericConstants.ts +119 -0
- package/src/constants/perpMarkets.ts +1042 -0
- package/src/constants/spotMarkets.ts +874 -0
- package/src/constants/txConstants.ts +1 -0
- package/src/constituentMap/constituentMap.ts +294 -0
- package/src/constituentMap/pollingConstituentAccountSubscriber.ts +97 -0
- package/src/constituentMap/webSocketConstituentAccountSubscriber.ts +112 -0
- package/src/core/VelocityCore.ts +331 -0
- package/src/core/index.ts +12 -0
- package/src/core/instructions/deposit.ts +42 -0
- package/src/core/instructions/fill.ts +34 -0
- package/src/core/instructions/funding.ts +21 -0
- package/src/core/instructions/liquidation.ts +37 -0
- package/src/core/instructions/orders.ts +56 -0
- package/src/core/instructions/perpOrders.ts +192 -0
- package/src/core/instructions/settlement.ts +26 -0
- package/src/core/instructions/trigger.ts +26 -0
- package/src/core/instructions/withdraw.ts +44 -0
- package/src/core/remainingAccounts.ts +276 -0
- package/src/core/signedMsg.ts +71 -0
- package/src/decode/customCoder.ts +105 -0
- package/src/decode/user.ts +372 -0
- package/src/dlob/DLOB.ts +2098 -0
- package/src/dlob/DLOBNode.ts +193 -0
- package/src/dlob/DLOBSubscriber.ts +211 -0
- package/src/dlob/NodeList.ts +174 -0
- package/src/dlob/orderBookLevels.ts +575 -0
- package/src/dlob/types.ts +22 -0
- package/src/events/eventList.ts +97 -0
- package/src/events/eventSubscriber.ts +382 -0
- package/src/events/eventsServerLogProvider.ts +152 -0
- package/src/events/fetchLogs.ts +169 -0
- package/src/events/parse.ts +248 -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 +228 -0
- package/src/events/webSocketLogProvider.ts +121 -0
- package/src/factory/bigNum.ts +709 -0
- package/src/factory/oracleClient.ts +73 -0
- package/src/idl/drift.json +18698 -0
- package/src/idl/drift.ts +23894 -0
- package/src/idl/pyth.json +142 -0
- package/src/idl/pyth.ts +97 -0
- package/src/idl/pyth_solana_receiver.json +628 -0
- package/src/idl/token_faucet.json +229 -0
- package/src/idl/token_faucet.ts +197 -0
- package/src/index.ts +150 -0
- package/src/indicative-quotes/indicativeQuotesSender.ts +233 -0
- package/src/isomorphic/README.md +19 -0
- package/src/isomorphic/anchor.browser.ts +44 -0
- package/src/isomorphic/anchor.node.ts +1 -0
- package/src/isomorphic/anchor.ts +1 -0
- package/src/isomorphic/anchor29.browser.ts +24 -0
- package/src/isomorphic/anchor29.node.ts +1 -0
- package/src/isomorphic/anchor29.ts +1 -0
- package/src/isomorphic/grpc.browser.ts +4 -0
- package/src/isomorphic/grpc.node.ts +130 -0
- package/src/isomorphic/grpc.ts +1 -0
- package/src/jupiter/jupiterClient.ts +482 -0
- package/src/keypair.ts +24 -0
- package/src/margin/README.md +138 -0
- package/src/marginCalculation.ts +255 -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 +1246 -0
- package/src/math/auction.ts +374 -0
- package/src/math/bankruptcy.ts +35 -0
- package/src/math/builder.ts +20 -0
- package/src/math/conversion.ts +24 -0
- package/src/math/exchangeStatus.ts +136 -0
- package/src/math/funding.ts +436 -0
- package/src/math/insurance.ts +111 -0
- package/src/math/liquidation.ts +209 -0
- package/src/math/margin.ts +368 -0
- package/src/math/market.ts +438 -0
- package/src/math/oracles.ts +367 -0
- package/src/math/orders.ts +473 -0
- package/src/math/position.ts +340 -0
- package/src/math/repeg.ts +214 -0
- package/src/math/spotBalance.ts +752 -0
- package/src/math/spotMarket.ts +82 -0
- package/src/math/spotPosition.ts +191 -0
- package/src/math/state.ts +48 -0
- package/src/math/superStake.ts +528 -0
- package/src/math/tiers.ts +44 -0
- package/src/math/trade.ts +805 -0
- package/src/math/utils.ts +121 -0
- package/src/memcmp.ts +164 -0
- package/src/oracles/oracleClientCache.ts +25 -0
- package/src/oracles/oracleId.ts +66 -0
- package/src/oracles/prelaunchOracleClient.ts +38 -0
- package/src/oracles/pythClient.ts +85 -0
- package/src/oracles/pythLazerClient.ts +102 -0
- package/src/oracles/quoteAssetOracleClient.ts +25 -0
- package/src/oracles/strictOraclePrice.ts +19 -0
- package/src/oracles/types.ts +37 -0
- package/src/oracles/utils.ts +10 -0
- package/src/orderParams.ts +79 -0
- package/src/orderSubscriber/OrderSubscriber.ts +296 -0
- package/src/orderSubscriber/PollingSubscription.ts +39 -0
- package/src/orderSubscriber/WebsocketSubscription.ts +119 -0
- package/src/orderSubscriber/grpcSubscription.ts +139 -0
- package/src/orderSubscriber/index.ts +7 -0
- package/src/orderSubscriber/types.ts +55 -0
- package/src/priorityFee/averageOverSlotsStrategy.ts +16 -0
- package/src/priorityFee/averageStrategy.ts +12 -0
- package/src/priorityFee/ewmaStrategy.ts +41 -0
- package/src/priorityFee/heliusPriorityFeeMethod.ts +57 -0
- package/src/priorityFee/index.ts +16 -0
- package/src/priorityFee/maxOverSlotsStrategy.ts +17 -0
- package/src/priorityFee/maxStrategy.ts +7 -0
- package/src/priorityFee/priorityFeeSubscriber.ts +256 -0
- package/src/priorityFee/priorityFeeSubscriberMap.ts +125 -0
- package/src/priorityFee/solanaPriorityFeeMethod.ts +34 -0
- package/src/priorityFee/types.ts +64 -0
- package/src/priorityFee/velocityPriorityFeeMethod.ts +54 -0
- package/src/pyth/constants.ts +9 -0
- package/src/pyth/index.ts +15 -0
- package/src/pyth/pythLazerSubscriber.ts +365 -0
- package/src/pyth/types.ts +4453 -0
- package/src/pyth/utils.ts +13 -0
- package/src/slot/SlotSubscriber.ts +108 -0
- package/src/slot/SlothashSubscriber.ts +126 -0
- package/src/swap/UnifiedSwapClient.ts +315 -0
- package/src/swift/grpcSignedMsgUserAccountSubscriber.ts +95 -0
- package/src/swift/index.ts +10 -0
- package/src/swift/signedMsgUserAccountSubscriber.ts +241 -0
- package/src/swift/swiftOrderSubscriber.ts +347 -0
- package/src/testClient.ts +42 -0
- package/src/titan/titanClient.ts +438 -0
- package/src/token/index.ts +13 -0
- package/src/tokenFaucet.ts +274 -0
- package/src/tx/baseTxSender.ts +471 -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 +853 -0
- package/src/tx/txParamProcessor.ts +163 -0
- package/src/tx/types.ts +71 -0
- package/src/tx/utils.ts +107 -0
- package/src/tx/whileValidTxSender.ts +266 -0
- package/src/types.ts +1793 -0
- package/src/user.ts +4487 -0
- package/src/userConfig.ts +37 -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/revenueShareEscrowMap.ts +310 -0
- package/src/userMap/userMap.ts +683 -0
- package/src/userMap/userMapConfig.ts +66 -0
- package/src/userMap/userStatsMap.ts +358 -0
- package/src/userName.ts +21 -0
- package/src/userStats.ts +117 -0
- package/src/userStatsConfig.ts +32 -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 +16 -0
- package/src/util/ed25519Utils.ts +85 -0
- package/src/util/promiseTimeout.ts +14 -0
- package/src/util/tps.ts +27 -0
- package/src/velocityClient.ts +11364 -0
- package/src/velocityClientConfig.ts +144 -0
- package/src/wallet.ts +54 -0
- package/tests/DriftCore/decode.test.ts +16 -0
- package/tests/DriftCore/fill_trigger.test.ts +73 -0
- package/tests/DriftCore/instructions.test.ts +46 -0
- package/tests/DriftCore/pdas.test.ts +28 -0
- package/tests/DriftCore/perp_orders.test.ts +205 -0
- package/tests/DriftCore/remainingAccounts.test.ts +73 -0
- package/tests/DriftCore/settlement_liquidation.test.ts +69 -0
- package/tests/accounts/customizedCadenceBulkAccountLoader.test.ts +203 -0
- package/tests/amm/test.ts +2095 -0
- package/tests/auctions/test.ts +81 -0
- package/tests/bn/test.ts +355 -0
- package/tests/ci/verifyConstants.ts +396 -0
- package/tests/decode/phoenix.ts +71 -0
- package/tests/decode/test.ts +262 -0
- package/tests/decode/userAccountBufferStrings.ts +102 -0
- package/tests/dlob/helpers.ts +740 -0
- package/tests/dlob/test.ts +6920 -0
- package/tests/events/parseLogsForCuUsage.ts +139 -0
- package/tests/insurance/test.ts +40 -0
- package/tests/spot/test.ts +226 -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/getMarginCalculation.ts +361 -0
- package/tests/user/helpers.ts +185 -0
- package/tests/user/liquidations.ts +129 -0
- package/tests/user/marginCalculations.test.ts +321 -0
- package/tests/user/test.ts +826 -0
- package/tsconfig.browser.json +16 -0
- package/tsconfig.json +17 -0
|
@@ -0,0 +1,1230 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="bn.js" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
/// <reference types="node" />
|
|
5
|
+
/**
|
|
6
|
+
* VelocityClient — main SDK entry point for all trading and keeper operations.
|
|
7
|
+
*
|
|
8
|
+
* Responsibilities:
|
|
9
|
+
* - Builds and sends all on-chain instructions (place/cancel/fill orders, deposits, withdrawals,
|
|
10
|
+
* settle PnL, update funding rate, liquidations).
|
|
11
|
+
* - Manages the program account subscription lifecycle (markets, oracles, user accounts).
|
|
12
|
+
* - Provides oracle price reads, market config lookups, and PDA derivation helpers.
|
|
13
|
+
*
|
|
14
|
+
* Admin operations (market init, fee updates, oracle config) live in {@link AdminClient} (adminClient.ts).
|
|
15
|
+
* Read-only user account queries (margin, positions, PnL) live in {@link User} (user.ts).
|
|
16
|
+
*
|
|
17
|
+
* Instruction → on-chain handler mapping: see ARCHITECTURE.md § SDK↔Instruction Mapping.
|
|
18
|
+
*/
|
|
19
|
+
import { AnchorProvider, BN } from './isomorphic/anchor';
|
|
20
|
+
import type { ProgramAccount } from '@coral-xyz/anchor';
|
|
21
|
+
import { VelocityClientMetricsEvents, IWallet, MakerInfo, MappedRecord, MarketType, ModifyOrderPolicy, OptionalOrderParams, OracleSource, Order, OrderParams, OrderTriggerCondition, PerpMarketAccount, PerpMarketExtendedInfo, PlaceAndTakeOrderSuccessCondition, PositionDirection, ReferrerInfo, ReferrerNameAccount, ScaleOrderParams, SettlePnlMode, SignedTxData, SpotMarketAccount, SpotPosition, StateAccount, SwapReduceOnly, SignedMsgOrderParamsMessage, TxParams, UserAccount, UserStatsAccount, SignedMsgOrderParamsDelegateMessage, PostOnlyParams, LPPoolAccount, ConstituentAccount, ConstituentTargetBaseAccount, AmmCache } from './types';
|
|
22
|
+
import { AccountMeta, AddressLookupTableAccount, BlockhashWithExpiryBlockHeight, ConfirmOptions, Connection, Keypair, PublicKey, Signer, Transaction, TransactionInstruction, TransactionSignature, TransactionVersion, VersionedTransaction } from '@solana/web3.js';
|
|
23
|
+
import { TokenFaucet } from './tokenFaucet';
|
|
24
|
+
import { EventEmitter } from 'events';
|
|
25
|
+
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
26
|
+
import { DataAndSlot, VelocityClientAccountEvents, VelocityClientAccountSubscriber } from './accounts/types';
|
|
27
|
+
import { TxSender, TxSigAndSlot } from './tx/types';
|
|
28
|
+
import { MMOraclePriceData, OraclePriceData } from './oracles/types';
|
|
29
|
+
import { VelocityClientConfig } from './velocityClientConfig';
|
|
30
|
+
import { User } from './user';
|
|
31
|
+
import { UserSubscriptionConfig } from './userConfig';
|
|
32
|
+
import { VelocityEnv, VelocityProgram } from './config';
|
|
33
|
+
import { UserStats } from './userStats';
|
|
34
|
+
import { JupiterClient, QuoteResponse } from './jupiter/jupiterClient';
|
|
35
|
+
import { SwapMode, UnifiedQuoteResponse } from './swap/UnifiedSwapClient';
|
|
36
|
+
import { UserStatsSubscriptionConfig } from './userStatsConfig';
|
|
37
|
+
import { TxHandler } from './tx/txHandler';
|
|
38
|
+
import { SignedMsgOrderParams } from './types';
|
|
39
|
+
import { TakerInfo } from './types';
|
|
40
|
+
import { ConstituentMap } from './constituentMap/constituentMap';
|
|
41
|
+
import { RevenueShareEscrowMap } from './userMap/revenueShareEscrowMap';
|
|
42
|
+
import { TitanClient } from './titan/titanClient';
|
|
43
|
+
import { UnifiedSwapClient } from './swap/UnifiedSwapClient';
|
|
44
|
+
/**
|
|
45
|
+
* Union type for swap clients (Titan and Jupiter) - Legacy type
|
|
46
|
+
* @deprecated Use UnifiedSwapClient class instead
|
|
47
|
+
*/
|
|
48
|
+
export type SwapClient = TitanClient | JupiterClient;
|
|
49
|
+
type RemainingAccountParams = import('./core/remainingAccounts').RemainingAccountParams;
|
|
50
|
+
/**
|
|
51
|
+
* # VelocityClient
|
|
52
|
+
* This class is the main way to interact with Velocity Exchange. It allows you to subscribe to the various accounts where the Market's state is stored, as well as: opening positions, liquidating, settling funding, depositing & withdrawing, and more.
|
|
53
|
+
*/
|
|
54
|
+
export declare class VelocityClient {
|
|
55
|
+
connection: Connection;
|
|
56
|
+
wallet: IWallet;
|
|
57
|
+
program: VelocityProgram;
|
|
58
|
+
provider: AnchorProvider;
|
|
59
|
+
env: VelocityEnv;
|
|
60
|
+
opts?: ConfirmOptions;
|
|
61
|
+
useHotWalletAdmin?: boolean;
|
|
62
|
+
users: Map<string, User>;
|
|
63
|
+
userStats?: UserStats;
|
|
64
|
+
activeSubAccountId: number;
|
|
65
|
+
userAccountSubscriptionConfig: UserSubscriptionConfig;
|
|
66
|
+
userStatsAccountSubscriptionConfig: UserStatsSubscriptionConfig;
|
|
67
|
+
accountSubscriber: VelocityClientAccountSubscriber;
|
|
68
|
+
eventEmitter: StrictEventEmitter<EventEmitter, VelocityClientAccountEvents>;
|
|
69
|
+
metricsEventEmitter: StrictEventEmitter<EventEmitter, VelocityClientMetricsEvents>;
|
|
70
|
+
_isSubscribed: boolean;
|
|
71
|
+
txSender: TxSender;
|
|
72
|
+
perpMarketLastSlotCache: Map<number, number>;
|
|
73
|
+
spotMarketLastSlotCache: Map<number, number>;
|
|
74
|
+
mustIncludePerpMarketIndexes: Set<number>;
|
|
75
|
+
mustIncludeSpotMarketIndexes: Set<number>;
|
|
76
|
+
authority: PublicKey;
|
|
77
|
+
/** @deprecated use marketLookupTables */
|
|
78
|
+
marketLookupTable: PublicKey;
|
|
79
|
+
/** @deprecated use lookupTableAccounts */
|
|
80
|
+
lookupTableAccount: AddressLookupTableAccount;
|
|
81
|
+
marketLookupTables: PublicKey[];
|
|
82
|
+
lookupTableAccounts: AddressLookupTableAccount[];
|
|
83
|
+
includeDelegates?: boolean;
|
|
84
|
+
authoritySubAccountMap?: Map<string, number[]>;
|
|
85
|
+
skipLoadUsers?: boolean;
|
|
86
|
+
txVersion: TransactionVersion;
|
|
87
|
+
txParams: TxParams;
|
|
88
|
+
enableMetricsEvents?: boolean;
|
|
89
|
+
txHandler: TxHandler;
|
|
90
|
+
get isSubscribed(): boolean;
|
|
91
|
+
private getPrePlaceOrderIxs;
|
|
92
|
+
set isSubscribed(val: boolean);
|
|
93
|
+
constructor(config: VelocityClientConfig);
|
|
94
|
+
getUserMapKey(subAccountId: number, authority: PublicKey): string;
|
|
95
|
+
createUser(subAccountId: number, accountSubscriptionConfig: UserSubscriptionConfig, authority?: PublicKey): User;
|
|
96
|
+
subscribe(): Promise<boolean>;
|
|
97
|
+
subscribeUsers(): Promise<boolean>[];
|
|
98
|
+
/**
|
|
99
|
+
* Forces the accountSubscriber to fetch account updates from rpc
|
|
100
|
+
*/
|
|
101
|
+
fetchAccounts(): Promise<void>;
|
|
102
|
+
unsubscribe(): Promise<void>;
|
|
103
|
+
unsubscribeUsers(): Promise<void>[];
|
|
104
|
+
statePublicKey?: PublicKey;
|
|
105
|
+
getStatePublicKey(): Promise<PublicKey>;
|
|
106
|
+
signerPublicKey?: PublicKey;
|
|
107
|
+
getSignerPublicKey(): PublicKey;
|
|
108
|
+
getStateAccount(): StateAccount;
|
|
109
|
+
/**
|
|
110
|
+
* Forces a fetch to rpc before returning accounts. Useful for anchor tests.
|
|
111
|
+
*/
|
|
112
|
+
forceGetStateAccount(): Promise<StateAccount>;
|
|
113
|
+
getPerpMarketAccount(marketIndex: number): PerpMarketAccount | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* Forces a fetch to rpc before returning accounts. Useful for anchor tests.
|
|
116
|
+
* @param marketIndex
|
|
117
|
+
*/
|
|
118
|
+
forceGetPerpMarketAccount(marketIndex: number): Promise<PerpMarketAccount | undefined>;
|
|
119
|
+
getPerpMarketAccounts(): PerpMarketAccount[];
|
|
120
|
+
getSpotMarketAccount(marketIndex: number): SpotMarketAccount | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* Forces a fetch to rpc before returning accounts. Useful for anchor tests.
|
|
123
|
+
* @param marketIndex
|
|
124
|
+
*/
|
|
125
|
+
forceGetSpotMarketAccount(marketIndex: number): Promise<SpotMarketAccount | undefined>;
|
|
126
|
+
getSpotMarketAccounts(): SpotMarketAccount[];
|
|
127
|
+
getQuoteSpotMarketAccount(): SpotMarketAccount;
|
|
128
|
+
getOraclePriceDataAndSlot(oraclePublicKey: PublicKey, oracleSource: OracleSource): DataAndSlot<OraclePriceData> | undefined;
|
|
129
|
+
/** @deprecated use fetchAllLookupTableAccounts() */
|
|
130
|
+
fetchMarketLookupTableAccount(): Promise<AddressLookupTableAccount>;
|
|
131
|
+
fetchAllLookupTableAccounts(): Promise<AddressLookupTableAccount[]>;
|
|
132
|
+
private getTxVersionForNewWallet;
|
|
133
|
+
/**
|
|
134
|
+
* Update the wallet to use for drift transactions and linked user account
|
|
135
|
+
* @param newWallet
|
|
136
|
+
* @param subAccountIds
|
|
137
|
+
* @param activeSubAccountId
|
|
138
|
+
* @param includeDelegates
|
|
139
|
+
*/
|
|
140
|
+
updateWallet(newWallet: IWallet, subAccountIds?: number[], activeSubAccountId?: number, includeDelegates?: boolean, authoritySubaccountMap?: Map<string, number[]>): Promise<boolean>;
|
|
141
|
+
/**
|
|
142
|
+
* Update the subscribed accounts to a given authority, while leaving the
|
|
143
|
+
* connected wallet intact. This allows a user to emulate another user's
|
|
144
|
+
* account on the UI and sign permissionless transactions with their own wallet.
|
|
145
|
+
* @param emulateAuthority
|
|
146
|
+
*/
|
|
147
|
+
emulateAccount(emulateAuthority: PublicKey): Promise<boolean>;
|
|
148
|
+
switchActiveUser(subAccountId: number, authority?: PublicKey): Promise<void>;
|
|
149
|
+
addUser(subAccountId: number, authority?: PublicKey, userAccount?: UserAccount): Promise<boolean>;
|
|
150
|
+
/**
|
|
151
|
+
* Adds and subscribes to users based on params set by the constructor or by updateWallet.
|
|
152
|
+
*/
|
|
153
|
+
addAndSubscribeToUsers(authority?: PublicKey): Promise<boolean>;
|
|
154
|
+
/**
|
|
155
|
+
* Returns the instructions to initialize a user account and the public key of the user account.
|
|
156
|
+
* @param subAccountId
|
|
157
|
+
* @param name
|
|
158
|
+
* @param referrerInfo
|
|
159
|
+
* @returns [instructions, userAccountPublicKey]
|
|
160
|
+
*/
|
|
161
|
+
getInitializeUserAccountIxs(subAccountId?: number, name?: string, referrerInfo?: ReferrerInfo, poolId?: number): Promise<[TransactionInstruction[], PublicKey]>;
|
|
162
|
+
/**
|
|
163
|
+
* Initializes a user account and returns the transaction signature and the public key of the user account.
|
|
164
|
+
* @param subAccountId
|
|
165
|
+
* @param name
|
|
166
|
+
* @param referrerInfo
|
|
167
|
+
* @param txParams
|
|
168
|
+
* @returns [transactionSignature, userAccountPublicKey]
|
|
169
|
+
*/
|
|
170
|
+
initializeUserAccount(subAccountId?: number, name?: string, referrerInfo?: ReferrerInfo, txParams?: TxParams): Promise<[TransactionSignature, PublicKey]>;
|
|
171
|
+
getInitializeUserStatsIx(overrides?: {
|
|
172
|
+
/**
|
|
173
|
+
* Optional external wallet to use as payer. If provided, this wallet will pay
|
|
174
|
+
* for the account creation instead of the default wallet.
|
|
175
|
+
*/
|
|
176
|
+
externalWallet?: PublicKey;
|
|
177
|
+
}): Promise<TransactionInstruction>;
|
|
178
|
+
initializeSignedMsgUserOrders(authority: PublicKey, numOrders: number, txParams?: TxParams): Promise<[TransactionSignature, PublicKey]>;
|
|
179
|
+
getInitializeSignedMsgUserOrdersAccountIx(authority: PublicKey, numOrders: number, overrides?: {
|
|
180
|
+
/**
|
|
181
|
+
* Optional external wallet to use as payer. If provided, this wallet will pay
|
|
182
|
+
* for the account creation instead of the default wallet.
|
|
183
|
+
*/
|
|
184
|
+
externalWallet?: PublicKey;
|
|
185
|
+
}): Promise<[PublicKey, TransactionInstruction]>;
|
|
186
|
+
resizeSignedMsgUserOrders(authority: PublicKey, numOrders: number, userSubaccountId?: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
187
|
+
getResizeSignedMsgUserOrdersInstruction(authority: PublicKey, numOrders: number, userSubaccountId?: number): Promise<TransactionInstruction>;
|
|
188
|
+
initializeSignedMsgWsDelegatesAccount(authority: PublicKey, delegates?: PublicKey[], txParams?: TxParams): Promise<TransactionSignature>;
|
|
189
|
+
getInitializeSignedMsgWsDelegatesAccountIx(authority: PublicKey, delegates?: PublicKey[]): Promise<TransactionInstruction>;
|
|
190
|
+
initializeRevenueShare(authority: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
191
|
+
getInitializeRevenueShareIx(authority: PublicKey, overrides?: {
|
|
192
|
+
payer?: PublicKey;
|
|
193
|
+
}): Promise<TransactionInstruction>;
|
|
194
|
+
initializeRevenueShareEscrow(authority: PublicKey, numOrders: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
195
|
+
getInitializeRevenueShareEscrowIx(authority: PublicKey, numOrders: number, overrides?: {
|
|
196
|
+
payer?: PublicKey;
|
|
197
|
+
}): Promise<TransactionInstruction>;
|
|
198
|
+
migrateReferrer(authority: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
199
|
+
getMigrateReferrerIx(authority: PublicKey): Promise<TransactionInstruction>;
|
|
200
|
+
resizeRevenueShareEscrowOrders(authority: PublicKey, numOrders: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
201
|
+
getResizeRevenueShareEscrowOrdersIx(authority: PublicKey, numOrders: number): Promise<TransactionInstruction>;
|
|
202
|
+
/**
|
|
203
|
+
* Creates the transaction to add or update an approved builder.
|
|
204
|
+
* This allows the builder to receive revenue share from referrals.
|
|
205
|
+
*
|
|
206
|
+
* @param builder - The public key of the builder to add or update.
|
|
207
|
+
* @param maxFeeTenthBps - The maximum fee tenth bps to set for the builder.
|
|
208
|
+
* @param add - Whether to add or update the builder. If the builder already exists, `add = true` will update the `maxFeeTenthBps`, otherwise it will add the builder. If `add = false`, the builder's `maxFeeTenthBps` will be set to 0.
|
|
209
|
+
* @param txParams - The transaction parameters to use for the transaction.
|
|
210
|
+
* @returns The transaction to add or update an approved builder.
|
|
211
|
+
*/
|
|
212
|
+
changeApprovedBuilder(builder: PublicKey, maxFeeTenthBps: number, add: boolean, txParams?: TxParams): Promise<TransactionSignature>;
|
|
213
|
+
/**
|
|
214
|
+
* Creates the transaction instruction to add or update an approved builder.
|
|
215
|
+
* This allows the builder to receive revenue share from referrals.
|
|
216
|
+
*
|
|
217
|
+
* @param builder - The public key of the builder to add or update.
|
|
218
|
+
* @param maxFeeTenthBps - The maximum fee tenth bps to set for the builder.
|
|
219
|
+
* @param add - Whether to add or update the builder. If the builder already exists, `add = true` will update the `maxFeeTenthBps`, otherwise it will add the builder. If `add = false`, the builder's `maxFeeTenthBps` will be set to 0.
|
|
220
|
+
* @returns The transaction instruction to add or update an approved builder.
|
|
221
|
+
*/
|
|
222
|
+
getChangeApprovedBuilderIx(builder: PublicKey, maxFeeTenthBps: number, add: boolean, overrides?: {
|
|
223
|
+
authority?: PublicKey;
|
|
224
|
+
payer?: PublicKey;
|
|
225
|
+
}): Promise<TransactionInstruction>;
|
|
226
|
+
addSignedMsgWsDelegate(authority: PublicKey, delegate: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
227
|
+
getAddSignedMsgWsDelegateIx(authority: PublicKey, delegate: PublicKey): Promise<TransactionInstruction>;
|
|
228
|
+
removeSignedMsgWsDelegate(authority: PublicKey, delegate: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
229
|
+
getRemoveSignedMsgWsDelegateIx(authority: PublicKey, delegate: PublicKey): Promise<TransactionInstruction>;
|
|
230
|
+
private getInitializeUserInstructions;
|
|
231
|
+
getNextSubAccountId(): Promise<number>;
|
|
232
|
+
initializeReferrerName(name: string): Promise<TransactionSignature>;
|
|
233
|
+
updateUserName(name: string, subAccountId?: number): Promise<TransactionSignature>;
|
|
234
|
+
updateUserCustomMarginRatio(updates: {
|
|
235
|
+
marginRatio: number;
|
|
236
|
+
subAccountId: number;
|
|
237
|
+
}[], txParams?: TxParams): Promise<TransactionSignature>;
|
|
238
|
+
getUpdateUserCustomMarginRatioIx(marginRatio: number, subAccountId?: number): Promise<TransactionInstruction>;
|
|
239
|
+
getUpdateUserPerpPositionCustomMarginRatioIx(perpMarketIndex: number, marginRatio: number, subAccountId?: number, overrides?: {
|
|
240
|
+
userAccountPublicKey?: PublicKey;
|
|
241
|
+
authority?: PublicKey;
|
|
242
|
+
signingAuthority?: PublicKey;
|
|
243
|
+
}): Promise<TransactionInstruction>;
|
|
244
|
+
updateUserPerpPositionCustomMarginRatio(perpMarketIndex: number, marginRatio: number, subAccountId?: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
245
|
+
getUpdateUserMarginTradingEnabledIx(marginTradingEnabled: boolean, subAccountId?: number, userAccountPublicKey?: PublicKey): Promise<TransactionInstruction>;
|
|
246
|
+
updateUserMarginTradingEnabled(updates: {
|
|
247
|
+
marginTradingEnabled: boolean;
|
|
248
|
+
subAccountId: number;
|
|
249
|
+
}[]): Promise<TransactionSignature>;
|
|
250
|
+
getUpdateUserDelegateIx(delegate: PublicKey, overrides: {
|
|
251
|
+
subAccountId?: number;
|
|
252
|
+
userAccountPublicKey?: PublicKey;
|
|
253
|
+
authority?: PublicKey;
|
|
254
|
+
}): Promise<TransactionInstruction>;
|
|
255
|
+
updateUserDelegate(delegate: PublicKey, subAccountId?: number): Promise<TransactionSignature>;
|
|
256
|
+
updateUserAdvancedLp(updates: {
|
|
257
|
+
advancedLp: boolean;
|
|
258
|
+
subAccountId: number;
|
|
259
|
+
}[]): Promise<TransactionSignature>;
|
|
260
|
+
getUpdateAdvancedDlpIx(advancedLp: boolean, subAccountId: number): Promise<any>;
|
|
261
|
+
updateUserReduceOnly(updates: {
|
|
262
|
+
reduceOnly: boolean;
|
|
263
|
+
subAccountId: number;
|
|
264
|
+
}[]): Promise<TransactionSignature>;
|
|
265
|
+
getUpdateUserReduceOnlyIx(reduceOnly: boolean, subAccountId: number): Promise<TransactionInstruction>;
|
|
266
|
+
updateUserPoolId(updates: {
|
|
267
|
+
poolId: number;
|
|
268
|
+
subAccountId: number;
|
|
269
|
+
}[]): Promise<TransactionSignature>;
|
|
270
|
+
getUpdateUserPoolIdIx(poolId: number, subAccountId: number): Promise<TransactionInstruction>;
|
|
271
|
+
fetchAllUserAccounts(includeIdle?: boolean): Promise<ProgramAccount<UserAccount>[]>;
|
|
272
|
+
getUserAccountsForDelegate(delegate: PublicKey): Promise<UserAccount[]>;
|
|
273
|
+
getUserAccountsAndAddressesForAuthority(authority: PublicKey): Promise<ProgramAccount<UserAccount>[]>;
|
|
274
|
+
getUserAccountsForAuthority(authority: PublicKey): Promise<UserAccount[]>;
|
|
275
|
+
getReferredUserStatsAccountsByReferrer(referrer: PublicKey): Promise<UserStatsAccount[]>;
|
|
276
|
+
getReferrerNameAccountsForAuthority(authority: PublicKey): Promise<ReferrerNameAccount[]>;
|
|
277
|
+
deleteUser(subAccountId?: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
278
|
+
getUserDeletionIx(userAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
|
|
279
|
+
forceDeleteUser(userAccountPublicKey: PublicKey, userAccount: UserAccount, txParams?: TxParams): Promise<TransactionSignature>;
|
|
280
|
+
getForceDeleteUserIx(userAccountPublicKey: PublicKey, userAccount: UserAccount): Promise<TransactionInstruction>;
|
|
281
|
+
deleteSignedMsgUserOrders(txParams?: TxParams): Promise<TransactionSignature>;
|
|
282
|
+
getSignedMsgUserOrdersDeletionIx(authority: PublicKey): Promise<any>;
|
|
283
|
+
/**
|
|
284
|
+
* Checks if a SignedMsg User Orders account exists for the given authority.
|
|
285
|
+
* The account pubkey is derived using the program ID and authority as seeds.
|
|
286
|
+
* Makes an RPC call to check if the account exists on-chain.
|
|
287
|
+
*
|
|
288
|
+
* @param authority The authority public key to check for
|
|
289
|
+
* @returns Promise that resolves to true if the account exists, false otherwise
|
|
290
|
+
*/
|
|
291
|
+
isSignedMsgUserOrdersAccountInitialized(authority: PublicKey): Promise<boolean>;
|
|
292
|
+
reclaimRent(subAccountId?: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
293
|
+
getReclaimRentIx(userAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
|
|
294
|
+
getUser(subAccountId?: number, authority?: PublicKey): User;
|
|
295
|
+
hasUser(subAccountId?: number, authority?: PublicKey): boolean;
|
|
296
|
+
getUsers(): User[];
|
|
297
|
+
getUserStats(): UserStats;
|
|
298
|
+
fetchReferrerNameAccount(name: string): Promise<ReferrerNameAccount | undefined>;
|
|
299
|
+
userStatsAccountPublicKey: PublicKey;
|
|
300
|
+
getUserStatsAccountPublicKey(): PublicKey;
|
|
301
|
+
getUserAccountPublicKey(subAccountId?: number, authority?: PublicKey): Promise<PublicKey>;
|
|
302
|
+
getUserAccount(subAccountId?: number, authority?: PublicKey): UserAccount | undefined;
|
|
303
|
+
/**
|
|
304
|
+
* Forces a fetch to rpc before returning accounts. Useful for anchor tests.
|
|
305
|
+
* @param subAccountId
|
|
306
|
+
*/
|
|
307
|
+
forceGetUserAccount(subAccountId?: number, authority?: PublicKey): Promise<UserAccount | undefined>;
|
|
308
|
+
getUserAccountAndSlot(subAccountId?: number, authority?: PublicKey): DataAndSlot<UserAccount> | undefined;
|
|
309
|
+
getSpotPosition(marketIndex: number, subAccountId?: number): SpotPosition | undefined;
|
|
310
|
+
getQuoteAssetTokenAmount(): BN;
|
|
311
|
+
getIsolatedPerpPositionTokenAmount(perpMarketIndex: number, subAccountId?: number): BN;
|
|
312
|
+
/**
|
|
313
|
+
* Returns the token amount for a given market. The spot market precision is based on the token mint decimals.
|
|
314
|
+
* Positive if it is a deposit, negative if it is a borrow.
|
|
315
|
+
* @param marketIndex
|
|
316
|
+
*/
|
|
317
|
+
getTokenAmount(marketIndex: number): BN;
|
|
318
|
+
/**
|
|
319
|
+
* Converts an amount to the spot precision for a given market. The spot market precision is based on the token mint decimals.
|
|
320
|
+
* @param marketIndex
|
|
321
|
+
* @param amount
|
|
322
|
+
*/
|
|
323
|
+
convertToSpotPrecision(marketIndex: number, amount: BN | number): BN;
|
|
324
|
+
/**
|
|
325
|
+
* Converts an amount to the perp precision. The perp market precision is {@link BASE_PRECISION} (1e9).
|
|
326
|
+
* @param amount
|
|
327
|
+
*/
|
|
328
|
+
convertToPerpPrecision(amount: BN | number): BN;
|
|
329
|
+
/**
|
|
330
|
+
* Converts an amount to the price precision. The perp market precision is {@link PRICE_PRECISION} (1e6).
|
|
331
|
+
* @param amount
|
|
332
|
+
*/
|
|
333
|
+
convertToPricePrecision(amount: BN | number): BN;
|
|
334
|
+
/**
|
|
335
|
+
* Each drift instruction must include perp and sport market accounts in the ix remaining accounts.
|
|
336
|
+
* Use this function to force a subset of markets to be included in the remaining accounts for every ix
|
|
337
|
+
*
|
|
338
|
+
* @param perpMarketIndexes
|
|
339
|
+
* @param spotMarketIndexes
|
|
340
|
+
*/
|
|
341
|
+
mustIncludeMarketsInIx({ perpMarketIndexes, spotMarketIndexes, }: {
|
|
342
|
+
perpMarketIndexes: number[];
|
|
343
|
+
spotMarketIndexes: number[];
|
|
344
|
+
}): void;
|
|
345
|
+
getRemainingAccounts(params: RemainingAccountParams): AccountMeta[];
|
|
346
|
+
addPerpMarketToRemainingAccountMaps(marketIndex: number, writable: boolean, oracleAccountMap: Map<string, AccountMeta>, spotMarketAccountMap: Map<number, AccountMeta>, perpMarketAccountMap: Map<number, AccountMeta>): void;
|
|
347
|
+
addSpotMarketToRemainingAccountMaps(marketIndex: number, writable: boolean, oracleAccountMap: Map<string, AccountMeta>, spotMarketAccountMap: Map<number, AccountMeta>): void;
|
|
348
|
+
addBuilderToRemainingAccounts(builders: PublicKey[], remainingAccounts: AccountMeta[]): void;
|
|
349
|
+
getRemainingAccountMapsForUsers(userAccounts: UserAccount[]): {
|
|
350
|
+
oracleAccountMap: Map<string, AccountMeta>;
|
|
351
|
+
spotMarketAccountMap: Map<number, AccountMeta>;
|
|
352
|
+
perpMarketAccountMap: Map<number, AccountMeta>;
|
|
353
|
+
};
|
|
354
|
+
getOrder(orderId: number, subAccountId?: number): Order | undefined;
|
|
355
|
+
getOrderByUserId(userOrderId: number, subAccountId?: number): Order | undefined;
|
|
356
|
+
/**
|
|
357
|
+
* Get the associated token address for the given spot market
|
|
358
|
+
* @param marketIndex
|
|
359
|
+
* @param useNative
|
|
360
|
+
* @param tokenProgram
|
|
361
|
+
*/
|
|
362
|
+
getAssociatedTokenAccount(marketIndex: number, useNative?: boolean, tokenProgram?: PublicKey, authority?: PublicKey, allowOwnerOffCurve?: boolean): Promise<PublicKey>;
|
|
363
|
+
createAssociatedTokenAccountIdempotentInstruction(account: PublicKey, payer: PublicKey, owner: PublicKey, mint: PublicKey, tokenProgram?: PublicKey): TransactionInstruction;
|
|
364
|
+
getDepositTxnIx(amount: BN, marketIndex: number, associatedTokenAccount: PublicKey, subAccountId?: number, reduceOnly?: boolean, overrides?: {
|
|
365
|
+
authority?: PublicKey;
|
|
366
|
+
}): Promise<TransactionInstruction[]>;
|
|
367
|
+
buildSwiftDepositTx(signedOrderParams: SignedMsgOrderParams, takerInfo: {
|
|
368
|
+
taker: PublicKey;
|
|
369
|
+
takerStats: PublicKey;
|
|
370
|
+
takerUserAccount: UserAccount;
|
|
371
|
+
signingAuthority: PublicKey;
|
|
372
|
+
}, depositAmount: BN, depositSpotMarketIndex: number, tradePerpMarketIndex: number, subAccountId: number, takerAssociatedTokenAccount: PublicKey, initSwiftAccount?: boolean): Promise<void>;
|
|
373
|
+
createDepositTxn(amount: BN, marketIndex: number, associatedTokenAccount: PublicKey, subAccountId?: number, reduceOnly?: boolean, txParams?: TxParams, initSwiftAccount?: boolean, overrides?: {
|
|
374
|
+
authority?: PublicKey;
|
|
375
|
+
}): Promise<VersionedTransaction | Transaction>;
|
|
376
|
+
/**
|
|
377
|
+
* Deposit funds into the given spot market
|
|
378
|
+
*
|
|
379
|
+
* @param amount to deposit
|
|
380
|
+
* @param marketIndex spot market index to deposit into
|
|
381
|
+
* @param associatedTokenAccount can be the wallet public key if using native sol
|
|
382
|
+
* @param subAccountId subaccountId to deposit
|
|
383
|
+
* @param reduceOnly if true, deposit must not increase account risk
|
|
384
|
+
* @param txParams transaction parameters
|
|
385
|
+
* @param initSwiftAccount if true, initialize a swift account for the user
|
|
386
|
+
* @param overrides allows overriding authority for the deposit transaction
|
|
387
|
+
*/
|
|
388
|
+
deposit(amount: BN, marketIndex: number, associatedTokenAccount: PublicKey, subAccountId?: number, reduceOnly?: boolean, txParams?: TxParams, initSwiftAccount?: boolean, overrides?: {
|
|
389
|
+
authority?: PublicKey;
|
|
390
|
+
}): Promise<TransactionSignature>;
|
|
391
|
+
getDepositInstruction(amount: BN, marketIndex: number, userTokenAccount: PublicKey, subAccountId?: number, reduceOnly?: boolean, userInitialized?: boolean, overrides?: {
|
|
392
|
+
authority?: PublicKey;
|
|
393
|
+
}): Promise<TransactionInstruction>;
|
|
394
|
+
private checkIfAccountExists;
|
|
395
|
+
getWrappedSolAccountCreationIxs(amount: BN, includeRent?: boolean, overrides?: {
|
|
396
|
+
authority?: PublicKey;
|
|
397
|
+
}): Promise<{
|
|
398
|
+
ixs: TransactionInstruction[];
|
|
399
|
+
/** @deprecated - this array is always going to be empty, in the current implementation */
|
|
400
|
+
signers: Signer[];
|
|
401
|
+
pubkey: PublicKey;
|
|
402
|
+
}>;
|
|
403
|
+
getTokenProgramForSpotMarket(spotMarketAccount: SpotMarketAccount): PublicKey;
|
|
404
|
+
isToken2022(spotMarketAccount: SpotMarketAccount): boolean;
|
|
405
|
+
isTransferHook(spotMarketAccount: SpotMarketAccount): boolean;
|
|
406
|
+
addTokenMintToRemainingAccounts(spotMarketAccount: SpotMarketAccount, remainingAccounts: AccountMeta[]): void;
|
|
407
|
+
addExtraAccountMetasToRemainingAccounts(mint: PublicKey, remainingAccounts: AccountMeta[]): Promise<void>;
|
|
408
|
+
getAssociatedTokenAccountCreationIx(tokenMintAddress: PublicKey, associatedTokenAddress: PublicKey, tokenProgram: PublicKey): TransactionInstruction;
|
|
409
|
+
createInitializeUserAccountAndDepositCollateralIxs(amount: BN, userTokenAccount: PublicKey, marketIndex?: number, subAccountId?: number, name?: string, fromSubAccountId?: number, referrerInfo?: ReferrerInfo, donateAmount?: BN, customMaxMarginRatio?: number, poolId?: number, overrides?: {
|
|
410
|
+
/**
|
|
411
|
+
* Optional external wallet to deposit from. If provided, the deposit will be made
|
|
412
|
+
* from this wallet instead of the user's authority wallet.
|
|
413
|
+
*/
|
|
414
|
+
externalWallet?: PublicKey;
|
|
415
|
+
}): Promise<{
|
|
416
|
+
ixs: TransactionInstruction[];
|
|
417
|
+
userAccountPublicKey: PublicKey;
|
|
418
|
+
}>;
|
|
419
|
+
createInitializeUserAccountAndDepositCollateral(amount: BN, userTokenAccount: PublicKey, marketIndex?: number, subAccountId?: number, name?: string, fromSubAccountId?: number, referrerInfo?: ReferrerInfo, donateAmount?: BN, txParams?: TxParams, customMaxMarginRatio?: number, poolId?: number, overrides?: {
|
|
420
|
+
externalWallet?: PublicKey;
|
|
421
|
+
}): Promise<[Transaction | VersionedTransaction, PublicKey]>;
|
|
422
|
+
/**
|
|
423
|
+
* Creates the User account for a user, and deposits some initial collateral
|
|
424
|
+
* @param amount
|
|
425
|
+
* @param userTokenAccount
|
|
426
|
+
* @param marketIndex
|
|
427
|
+
* @param subAccountId
|
|
428
|
+
* @param name
|
|
429
|
+
* @param fromSubAccountId
|
|
430
|
+
* @param referrerInfo
|
|
431
|
+
* @param donateAmount
|
|
432
|
+
* @param txParams
|
|
433
|
+
* @param customMaxMarginRatio
|
|
434
|
+
* @param poolId
|
|
435
|
+
* @param overrides - Optional overrides including externalWallet for depositing from a different wallet
|
|
436
|
+
* @returns
|
|
437
|
+
*/
|
|
438
|
+
initializeUserAccountAndDepositCollateral(amount: BN, userTokenAccount: PublicKey, marketIndex?: number, subAccountId?: number, name?: string, fromSubAccountId?: number, referrerInfo?: ReferrerInfo, donateAmount?: BN, txParams?: TxParams, customMaxMarginRatio?: number, poolId?: number, overrides?: {
|
|
439
|
+
externalWallet?: PublicKey;
|
|
440
|
+
}): Promise<[TransactionSignature, PublicKey]>;
|
|
441
|
+
initializeUserAccountForDevnet(subAccountId: number, name: string, marketIndex: number, tokenFaucet: TokenFaucet, amount: BN, referrerInfo?: ReferrerInfo, txParams?: TxParams): Promise<[TransactionSignature, PublicKey]>;
|
|
442
|
+
getWithdrawalIxs(amount: BN, marketIndex: number, associatedTokenAddress: PublicKey, reduceOnly?: boolean, subAccountId?: number): Promise<TransactionInstruction[]>;
|
|
443
|
+
/**
|
|
444
|
+
* Withdraws from a user account. If deposit doesn't already exist, creates a borrow
|
|
445
|
+
* @param amount
|
|
446
|
+
* @param marketIndex
|
|
447
|
+
* @param associatedTokenAddress - the token account to withdraw to. can be the wallet public key if using native sol
|
|
448
|
+
* @param reduceOnly
|
|
449
|
+
*/
|
|
450
|
+
withdraw(amount: BN, marketIndex: number, associatedTokenAddress: PublicKey, reduceOnly?: boolean, subAccountId?: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
451
|
+
withdrawAllDustPositions(subAccountId?: number, txParams?: TxParams, opts?: {
|
|
452
|
+
dustPositionCountCallback?: (count: number) => void;
|
|
453
|
+
}): Promise<TransactionSignature | undefined>;
|
|
454
|
+
getWithdrawIx(amount: BN, marketIndex: number, userTokenAccount: PublicKey, reduceOnly?: boolean, subAccountId?: number): Promise<TransactionInstruction>;
|
|
455
|
+
/**
|
|
456
|
+
* Withdraws from the fromSubAccount and deposits into the toSubAccount
|
|
457
|
+
* @param amount
|
|
458
|
+
* @param marketIndex
|
|
459
|
+
* @param fromSubAccountId
|
|
460
|
+
* @param toSubAccountId
|
|
461
|
+
* @param txParams
|
|
462
|
+
*/
|
|
463
|
+
transferDeposit(amount: BN, marketIndex: number, fromSubAccountId: number, toSubAccountId: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
464
|
+
getTransferDepositIx(amount: BN, marketIndex: number, fromSubAccountId: number, toSubAccountId: number): Promise<TransactionInstruction>;
|
|
465
|
+
transferPools(depositFromMarketIndex: number, depositToMarketIndex: number, borrowFromMarketIndex: number, borrowToMarketIndex: number, depositAmount: BN | undefined, borrowAmount: BN | undefined, fromSubAccountId: number, toSubAccountId: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
466
|
+
getTransferPoolsIx(depositFromMarketIndex: number, depositToMarketIndex: number, borrowFromMarketIndex: number, borrowToMarketIndex: number, depositAmount: BN | undefined, borrowAmount: BN | undefined, fromSubAccountId: number, toSubAccountId: number, isToNewSubAccount?: boolean): Promise<TransactionInstruction>;
|
|
467
|
+
transferPerpPosition(fromSubAccountId: number, toSubAccountId: number, marketIndex: number, amount: BN, txParams?: TxParams): Promise<TransactionSignature>;
|
|
468
|
+
getTransferPerpPositionIx(fromSubAccountId: number, toSubAccountId: number, marketIndex: number, amount: BN): Promise<TransactionInstruction>;
|
|
469
|
+
specialTransferPerpPositionToVamm(userAccountPublicKey: PublicKey, marketIndex: number, amount?: BN, txParams?: TxParams): Promise<TransactionSignature>;
|
|
470
|
+
getSpecialTransferPerpPositionToVammIx(userAccountPublicKey: PublicKey, marketIndex: number, amount?: BN): Promise<TransactionInstruction>;
|
|
471
|
+
depositIntoIsolatedPerpPosition(amount: BN, perpMarketIndex: number, userTokenAccount: PublicKey, subAccountId?: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
472
|
+
getDepositIntoIsolatedPerpPositionIx(amount: BN, perpMarketIndex: number, userTokenAccount: PublicKey, subAccountId?: number): Promise<TransactionInstruction>;
|
|
473
|
+
transferIsolatedPerpPositionDeposit(amount: BN, perpMarketIndex: number, subAccountId?: number, txParams?: TxParams, trySettle?: boolean, noBuffer?: boolean): Promise<TransactionSignature>;
|
|
474
|
+
getTransferIsolatedPerpPositionDepositIx(amount: BN, perpMarketIndex: number, subAccountId?: number, noAmountBuffer?: boolean, signingAuthority?: PublicKey): Promise<TransactionInstruction>;
|
|
475
|
+
withdrawFromIsolatedPerpPosition(amount: BN, perpMarketIndex: number, userTokenAccount: PublicKey, subAccountId?: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
476
|
+
getWithdrawFromIsolatedPerpPositionIxsBundle(amount: BN, perpMarketIndex: number, subAccountId?: number, userTokenAccount?: PublicKey): Promise<TransactionInstruction[]>;
|
|
477
|
+
getWithdrawFromIsolatedPerpPositionIx(amount: BN, perpMarketIndex: number, userTokenAccount: PublicKey, subAccountId?: number): Promise<TransactionInstruction>;
|
|
478
|
+
updateSpotMarketCumulativeInterest(marketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
479
|
+
updateSpotMarketCumulativeInterestIx(marketIndex: number): Promise<TransactionInstruction>;
|
|
480
|
+
/**
|
|
481
|
+
* @deprecated use {@link placePerpOrder} or {@link placeAndTakePerpOrder} instead
|
|
482
|
+
*/
|
|
483
|
+
openPosition(direction: PositionDirection, amount: BN, marketIndex: number, limitPrice?: BN, subAccountId?: number): Promise<TransactionSignature>;
|
|
484
|
+
sendSignedTx(tx: Transaction | VersionedTransaction, opts?: ConfirmOptions): Promise<TransactionSignature>;
|
|
485
|
+
prepareMarketOrderTxs(orderParams: OptionalOrderParams, userAccountPublicKey: PublicKey, userAccount: UserAccount, makerInfo?: MakerInfo | MakerInfo[], txParams?: TxParams, bracketOrdersParams?: OptionalOrderParams[], referrerInfo?: ReferrerInfo, cancelExistingOrders?: boolean, settlePnl?: boolean, positionMaxLev?: number, isolatedPositionDepositAmount?: BN): Promise<{
|
|
486
|
+
cancelExistingOrdersTx?: Transaction | VersionedTransaction;
|
|
487
|
+
settlePnlTx?: Transaction | VersionedTransaction;
|
|
488
|
+
fillTx?: Transaction | VersionedTransaction;
|
|
489
|
+
marketOrderTx: Transaction | VersionedTransaction;
|
|
490
|
+
}>;
|
|
491
|
+
/**
|
|
492
|
+
* Sends a market order and returns a signed tx which can fill the order against the vamm, which the caller can use to fill their own order if required.
|
|
493
|
+
* @param orderParams
|
|
494
|
+
* @param userAccountPublicKey
|
|
495
|
+
* @param userAccount
|
|
496
|
+
* @param makerInfo
|
|
497
|
+
* @param txParams
|
|
498
|
+
* @param bracketOrdersParams
|
|
499
|
+
* @param cancelExistingOrders - Builds and returns an extra transaciton to cancel the existing orders in the same perp market. Intended use is to auto-cancel TP/SL orders when closing a position. Ignored if orderParams.marketType is not MarketType.PERP
|
|
500
|
+
* @returns
|
|
501
|
+
*/
|
|
502
|
+
sendMarketOrderAndGetSignedFillTx(orderParams: OptionalOrderParams, userAccountPublicKey: PublicKey, userAccount: UserAccount, makerInfo?: MakerInfo | MakerInfo[], txParams?: TxParams, bracketOrdersParams?: OptionalOrderParams[], referrerInfo?: ReferrerInfo, cancelExistingOrders?: boolean, settlePnl?: boolean): Promise<{
|
|
503
|
+
txSig: TransactionSignature;
|
|
504
|
+
signedFillTx?: Transaction;
|
|
505
|
+
signedCancelExistingOrdersTx?: Transaction;
|
|
506
|
+
signedSettlePnlTx?: Transaction;
|
|
507
|
+
}>;
|
|
508
|
+
placePerpOrder(orderParams: OptionalOrderParams, txParams?: TxParams, subAccountId?: number, isolatedPositionDepositAmount?: BN): Promise<TransactionSignature>;
|
|
509
|
+
getPlacePerpOrderIx(orderParams: OptionalOrderParams, subAccountId?: number, depositToTradeArgs?: {
|
|
510
|
+
isMakingNewAccount: boolean;
|
|
511
|
+
depositMarketIndex: number;
|
|
512
|
+
}): Promise<TransactionInstruction>;
|
|
513
|
+
updateAMMs(marketIndexes: number[], txParams?: TxParams): Promise<TransactionSignature>;
|
|
514
|
+
getUpdateAMMsIx(marketIndexes: number[]): Promise<TransactionInstruction>;
|
|
515
|
+
settleExpiredMarket(marketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
516
|
+
getSettleExpiredMarketIx(marketIndex: number): Promise<TransactionInstruction>;
|
|
517
|
+
settleExpiredMarketPoolsToRevenuePool(marketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
518
|
+
getSettleExpiredMarketPoolsToRevenuePoolIx(perpMarketIndex: number): Promise<TransactionInstruction>;
|
|
519
|
+
cancelOrder(orderId?: number, txParams?: TxParams, subAccountId?: number, overrides?: {
|
|
520
|
+
withdrawIsolatedDepositAmount?: BN;
|
|
521
|
+
}): Promise<TransactionSignature>;
|
|
522
|
+
getCancelOrderIx(orderId?: number, subAccountId?: number): Promise<TransactionInstruction>;
|
|
523
|
+
cancelOrderByUserId(userOrderId: number, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
|
|
524
|
+
getCancelOrderByUserIdIx(userOrderId: number, subAccountId?: number): Promise<TransactionInstruction>;
|
|
525
|
+
/**
|
|
526
|
+
* Sends a transaction to cancel the provided order ids.
|
|
527
|
+
*
|
|
528
|
+
* @param orderIds - The order ids to cancel.
|
|
529
|
+
* @param txParams - The transaction parameters.
|
|
530
|
+
* @param subAccountId - The sub account id to cancel the orders for.
|
|
531
|
+
* @param user - The user to cancel the orders for. If provided, it will be prioritized over the subAccountId.
|
|
532
|
+
* @returns The transaction signature.
|
|
533
|
+
*/
|
|
534
|
+
cancelOrdersByIds(orderIds?: number[], txParams?: TxParams, subAccountId?: number, user?: User, overrides?: {
|
|
535
|
+
authority?: PublicKey;
|
|
536
|
+
}): Promise<TransactionSignature>;
|
|
537
|
+
/**
|
|
538
|
+
* Returns the transaction instruction to cancel the provided order ids.
|
|
539
|
+
*
|
|
540
|
+
* @param orderIds - The order ids to cancel.
|
|
541
|
+
* @param subAccountId - The sub account id to cancel the orders for.
|
|
542
|
+
* @param user - The user to cancel the orders for. If provided, it will be prioritized over the subAccountId.
|
|
543
|
+
* @returns The transaction instruction to cancel the orders.
|
|
544
|
+
*/
|
|
545
|
+
getCancelOrdersByIdsIx(orderIds?: number[], subAccountId?: number, user?: User, overrides?: {
|
|
546
|
+
authority?: PublicKey;
|
|
547
|
+
}): Promise<TransactionInstruction>;
|
|
548
|
+
cancelOrders(marketType?: MarketType, marketIndex?: number, direction?: PositionDirection, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
|
|
549
|
+
getCancelOrdersIx(marketType: MarketType | null, marketIndex: number | null, direction: PositionDirection | null, subAccountId?: number): Promise<TransactionInstruction>;
|
|
550
|
+
cancelAndPlaceOrders(cancelOrderParams: {
|
|
551
|
+
marketType?: MarketType;
|
|
552
|
+
marketIndex?: number;
|
|
553
|
+
direction?: PositionDirection;
|
|
554
|
+
}, placeOrderParams: OrderParams[], txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
|
|
555
|
+
placeOrders(params: OrderParams[], txParams?: TxParams, subAccountId?: number, optionalIxs?: TransactionInstruction[], isolatedPositionDepositAmount?: BN): Promise<TransactionSignature>;
|
|
556
|
+
preparePlaceOrdersTx(params: OrderParams[], txParams?: TxParams, subAccountId?: number, optionalIxs?: TransactionInstruction[], isolatedPositionDepositAmount?: BN): Promise<{
|
|
557
|
+
placeOrdersTx: Transaction | VersionedTransaction;
|
|
558
|
+
}>;
|
|
559
|
+
getPlaceOrdersIx(params: OptionalOrderParams[], subAccountId?: number, overrides?: {
|
|
560
|
+
authority?: PublicKey;
|
|
561
|
+
}): Promise<TransactionInstruction>;
|
|
562
|
+
getPlaceOrdersAndSetPositionMaxLevIx(params: OptionalOrderParams[], positionMaxLev: number, subAccountId?: number): Promise<TransactionInstruction[]>;
|
|
563
|
+
/**
|
|
564
|
+
* Place scale orders: multiple limit orders distributed across a price range
|
|
565
|
+
* @param params Scale order parameters
|
|
566
|
+
* @param txParams Optional transaction parameters
|
|
567
|
+
* @param subAccountId Optional sub account ID
|
|
568
|
+
* @returns Transaction signature
|
|
569
|
+
*/
|
|
570
|
+
placeScaleOrders(params: ScaleOrderParams, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
|
|
571
|
+
preparePlaceScaleOrdersTx(params: ScaleOrderParams, txParams?: TxParams, subAccountId?: number): Promise<{
|
|
572
|
+
placeScaleOrdersTx: Transaction | VersionedTransaction;
|
|
573
|
+
}>;
|
|
574
|
+
getPlaceScaleOrdersIx(params: ScaleOrderParams, subAccountId?: number): Promise<TransactionInstruction>;
|
|
575
|
+
fillPerpOrder(userAccountPublicKey: PublicKey, user: UserAccount, order?: Pick<Order, 'marketIndex' | 'orderId'>, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, txParams?: TxParams, fillerSubAccountId?: number, fillerAuthority?: PublicKey, hasBuilderFee?: boolean): Promise<TransactionSignature>;
|
|
576
|
+
getFillPerpOrderIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, order: Pick<Order, 'marketIndex' | 'orderId'>, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, fillerSubAccountId?: number, isSignedMsg?: boolean, fillerAuthority?: PublicKey, hasBuilderFee?: boolean): Promise<TransactionInstruction>;
|
|
577
|
+
getRevertFillIx(fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
|
|
578
|
+
placeSpotOrder(_orderParams: OptionalOrderParams, _txParams?: TxParams, _subAccountId?: number): Promise<TransactionSignature>;
|
|
579
|
+
preparePlaceSpotOrderTx(_orderParams: OptionalOrderParams, _txParams?: TxParams, _subAccountId?: number): Promise<void>;
|
|
580
|
+
getPlaceSpotOrderIx(_orderParams: OptionalOrderParams, _subAccountId?: number, _overrides?: {
|
|
581
|
+
authority?: PublicKey;
|
|
582
|
+
}): Promise<TransactionInstruction>;
|
|
583
|
+
fillSpotOrder(_userAccountPublicKey: PublicKey, _user: UserAccount, _order?: Pick<Order, 'marketIndex' | 'orderId'>, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo | MakerInfo[], _referrerInfo?: ReferrerInfo, _txParams?: TxParams): Promise<TransactionSignature>;
|
|
584
|
+
getFillSpotOrderIx(_userAccountPublicKey: PublicKey, _userAccount: UserAccount, _order?: Pick<Order, 'marketIndex' | 'orderId'>, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo | MakerInfo[], _referrerInfo?: ReferrerInfo, _fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
|
|
585
|
+
/**
|
|
586
|
+
* Swap tokens in drift account using titan or jupiter
|
|
587
|
+
* @param swapClient swap client to find routes and instructions (Titan or Jupiter)
|
|
588
|
+
* @param jupiterClient @deprecated Use swapClient instead. Legacy parameter for backward compatibility
|
|
589
|
+
* @param outMarketIndex the market index of the token you're buying
|
|
590
|
+
* @param inMarketIndex the market index of the token you're selling
|
|
591
|
+
* @param outAssociatedTokenAccount the token account to receive the token being sold on the swap provider
|
|
592
|
+
* @param inAssociatedTokenAccount the token account to
|
|
593
|
+
* @param amount the amount of TokenIn, regardless of swapMode
|
|
594
|
+
* @param slippageBps the max slippage passed to the swap provider api
|
|
595
|
+
* @param swapMode swap provider swapMode (ExactIn or ExactOut), default is ExactIn
|
|
596
|
+
* @param route the swap provider route to use for the swap
|
|
597
|
+
* @param reduceOnly specify if In or Out token on the drift account must reduceOnly, checked at end of swap
|
|
598
|
+
* @param v6 pass in the quote response from swap provider quote's API (deprecated, use quote instead)
|
|
599
|
+
* @param quote pass in the quote response from swap provider quote's API
|
|
600
|
+
* @param txParams
|
|
601
|
+
*/
|
|
602
|
+
swap({ swapClient, jupiterClient, outMarketIndex, inMarketIndex, outAssociatedTokenAccount, inAssociatedTokenAccount, amount, slippageBps, swapMode, reduceOnly, txParams, v6, quote, onlyDirectRoutes, }: {
|
|
603
|
+
swapClient?: UnifiedSwapClient | SwapClient;
|
|
604
|
+
/** @deprecated Use swapClient instead. Legacy parameter for backward compatibility */
|
|
605
|
+
jupiterClient?: JupiterClient;
|
|
606
|
+
outMarketIndex: number;
|
|
607
|
+
inMarketIndex: number;
|
|
608
|
+
outAssociatedTokenAccount?: PublicKey;
|
|
609
|
+
inAssociatedTokenAccount?: PublicKey;
|
|
610
|
+
amount: BN;
|
|
611
|
+
slippageBps?: number;
|
|
612
|
+
swapMode?: SwapMode;
|
|
613
|
+
reduceOnly?: SwapReduceOnly;
|
|
614
|
+
txParams?: TxParams;
|
|
615
|
+
onlyDirectRoutes?: boolean;
|
|
616
|
+
v6?: {
|
|
617
|
+
quote?: QuoteResponse;
|
|
618
|
+
};
|
|
619
|
+
quote?: UnifiedQuoteResponse;
|
|
620
|
+
}): Promise<TransactionSignature>;
|
|
621
|
+
getTitanSwapIx({ titanClient, outMarketIndex, inMarketIndex, outAssociatedTokenAccount, inAssociatedTokenAccount, amount, slippageBps, swapMode, onlyDirectRoutes, reduceOnly, userAccountPublicKey, }: {
|
|
622
|
+
titanClient: TitanClient;
|
|
623
|
+
outMarketIndex: number;
|
|
624
|
+
inMarketIndex: number;
|
|
625
|
+
outAssociatedTokenAccount?: PublicKey;
|
|
626
|
+
inAssociatedTokenAccount?: PublicKey;
|
|
627
|
+
amount: BN;
|
|
628
|
+
slippageBps?: number;
|
|
629
|
+
swapMode?: string;
|
|
630
|
+
onlyDirectRoutes?: boolean;
|
|
631
|
+
reduceOnly?: SwapReduceOnly;
|
|
632
|
+
userAccountPublicKey?: PublicKey;
|
|
633
|
+
}): Promise<{
|
|
634
|
+
ixs: TransactionInstruction[];
|
|
635
|
+
lookupTables: AddressLookupTableAccount[];
|
|
636
|
+
}>;
|
|
637
|
+
getJupiterSwapIxV6({ jupiterClient, outMarketIndex, inMarketIndex, outAssociatedTokenAccount, inAssociatedTokenAccount, amount, slippageBps, swapMode, onlyDirectRoutes, quote, reduceOnly, userAccountPublicKey, }: {
|
|
638
|
+
jupiterClient: JupiterClient;
|
|
639
|
+
outMarketIndex: number;
|
|
640
|
+
inMarketIndex: number;
|
|
641
|
+
outAssociatedTokenAccount?: PublicKey;
|
|
642
|
+
inAssociatedTokenAccount?: PublicKey;
|
|
643
|
+
amount: BN;
|
|
644
|
+
slippageBps?: number;
|
|
645
|
+
swapMode?: SwapMode;
|
|
646
|
+
onlyDirectRoutes?: boolean;
|
|
647
|
+
quote?: QuoteResponse;
|
|
648
|
+
reduceOnly?: SwapReduceOnly;
|
|
649
|
+
userAccountPublicKey?: PublicKey;
|
|
650
|
+
}): Promise<{
|
|
651
|
+
ixs: TransactionInstruction[];
|
|
652
|
+
lookupTables: AddressLookupTableAccount[];
|
|
653
|
+
}>;
|
|
654
|
+
/**
|
|
655
|
+
* Get the drift begin_swap and end_swap instructions
|
|
656
|
+
*
|
|
657
|
+
* @param outMarketIndex the market index of the token you're buying
|
|
658
|
+
* @param inMarketIndex the market index of the token you're selling
|
|
659
|
+
* @param amountIn the amount of the token to sell
|
|
660
|
+
* @param inTokenAccount the token account to move the tokens being sold
|
|
661
|
+
* @param outTokenAccount the token account to receive the tokens being bought
|
|
662
|
+
* @param limitPrice the limit price of the swap
|
|
663
|
+
* @param reduceOnly
|
|
664
|
+
* @param userAccountPublicKey optional, specify a custom userAccountPublicKey to use instead of getting the current user account; can be helpful if the account is being created within the current tx
|
|
665
|
+
*/
|
|
666
|
+
getSwapIx({ outMarketIndex, inMarketIndex, amountIn, inTokenAccount, outTokenAccount, limitPrice, reduceOnly, userAccountPublicKey, }: {
|
|
667
|
+
outMarketIndex: number;
|
|
668
|
+
inMarketIndex: number;
|
|
669
|
+
amountIn: BN;
|
|
670
|
+
inTokenAccount: PublicKey;
|
|
671
|
+
outTokenAccount: PublicKey;
|
|
672
|
+
limitPrice?: BN;
|
|
673
|
+
reduceOnly?: SwapReduceOnly;
|
|
674
|
+
userAccountPublicKey?: PublicKey;
|
|
675
|
+
}): Promise<{
|
|
676
|
+
beginSwapIx: TransactionInstruction;
|
|
677
|
+
endSwapIx: TransactionInstruction;
|
|
678
|
+
}>;
|
|
679
|
+
getSwapIxV2({ swapClient, outMarketIndex, inMarketIndex, outAssociatedTokenAccount, inAssociatedTokenAccount, amount, slippageBps, swapMode, onlyDirectRoutes, reduceOnly, quote, v6, userAccountPublicKey, }: {
|
|
680
|
+
swapClient: UnifiedSwapClient;
|
|
681
|
+
outMarketIndex: number;
|
|
682
|
+
inMarketIndex: number;
|
|
683
|
+
outAssociatedTokenAccount?: PublicKey;
|
|
684
|
+
inAssociatedTokenAccount?: PublicKey;
|
|
685
|
+
amount: BN;
|
|
686
|
+
slippageBps?: number;
|
|
687
|
+
swapMode?: SwapMode;
|
|
688
|
+
onlyDirectRoutes?: boolean;
|
|
689
|
+
reduceOnly?: SwapReduceOnly;
|
|
690
|
+
quote?: UnifiedQuoteResponse;
|
|
691
|
+
v6?: {
|
|
692
|
+
quote?: QuoteResponse;
|
|
693
|
+
};
|
|
694
|
+
userAccountPublicKey?: PublicKey;
|
|
695
|
+
}): Promise<{
|
|
696
|
+
ixs: TransactionInstruction[];
|
|
697
|
+
lookupTables: AddressLookupTableAccount[];
|
|
698
|
+
}>;
|
|
699
|
+
stakeForMSOL({ amount }: {
|
|
700
|
+
amount: BN;
|
|
701
|
+
}): Promise<TxSigAndSlot>;
|
|
702
|
+
getStakeForMSOLIx({ amount, userAccountPublicKey, }: {
|
|
703
|
+
amount: BN;
|
|
704
|
+
userAccountPublicKey?: PublicKey;
|
|
705
|
+
}): Promise<TransactionInstruction[]>;
|
|
706
|
+
triggerOrder(userAccountPublicKey: PublicKey, user: UserAccount, order: Order, txParams?: TxParams, fillerPublicKey?: PublicKey): Promise<TransactionSignature>;
|
|
707
|
+
getTriggerOrderIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, order: Order, fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
|
|
708
|
+
forceCancelOrders(userAccountPublicKey: PublicKey, user: UserAccount, txParams?: TxParams, fillerPublicKey?: PublicKey): Promise<TransactionSignature>;
|
|
709
|
+
getForceCancelOrdersIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
|
|
710
|
+
updateUserIdle(userAccountPublicKey: PublicKey, user: UserAccount, txParams?: TxParams, fillerPublicKey?: PublicKey): Promise<TransactionSignature>;
|
|
711
|
+
getUpdateUserIdleIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
|
|
712
|
+
logUserBalances(userAccountPublicKey: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
713
|
+
getLogUserBalancesIx(userAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
|
|
714
|
+
updateUserStatsReferrerStatus(userAuthority: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
715
|
+
getUpdateUserStatsReferrerStatusIx(userAuthority: PublicKey): Promise<TransactionInstruction>;
|
|
716
|
+
updateUserOpenOrdersCount(userAccountPublicKey: PublicKey, user: UserAccount, txParams?: TxParams, fillerPublicKey?: PublicKey): Promise<TransactionSignature>;
|
|
717
|
+
getUpdateUserOpenOrdersCountIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
|
|
718
|
+
placeAndTakePerpOrder(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, successCondition?: PlaceAndTakeOrderSuccessCondition, auctionDurationPercentage?: number, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
|
|
719
|
+
preparePlaceAndTakePerpOrderWithAdditionalOrders(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, bracketOrdersParams?: OptionalOrderParams[], txParams?: TxParams, subAccountId?: number, cancelExistingOrders?: boolean, settlePnl?: boolean, exitEarlyIfSimFails?: boolean, auctionDurationPercentage?: number, optionalIxs?: TransactionInstruction[], isolatedPositionDepositAmount?: BN): Promise<{
|
|
720
|
+
placeAndTakeTx: Transaction | VersionedTransaction;
|
|
721
|
+
cancelExistingOrdersTx: Transaction | VersionedTransaction;
|
|
722
|
+
settlePnlTx: Transaction | VersionedTransaction;
|
|
723
|
+
}>;
|
|
724
|
+
placeAndTakePerpWithAdditionalOrders(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, bracketOrdersParams?: OptionalOrderParams[], txParams?: TxParams, subAccountId?: number, cancelExistingOrders?: boolean, settlePnl?: boolean, exitEarlyIfSimFails?: boolean): Promise<{
|
|
725
|
+
txSig: TransactionSignature;
|
|
726
|
+
signedCancelExistingOrdersTx?: Transaction;
|
|
727
|
+
signedSettlePnlTx?: Transaction;
|
|
728
|
+
}>;
|
|
729
|
+
getPlaceAndTakePerpOrderIx(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, successCondition?: PlaceAndTakeOrderSuccessCondition, auctionDurationPercentage?: number, subAccountId?: number, overrides?: {
|
|
730
|
+
authority?: PublicKey;
|
|
731
|
+
}): Promise<TransactionInstruction>;
|
|
732
|
+
placeAndMakePerpOrder(orderParams: OptionalOrderParams, takerInfo: TakerInfo, referrerInfo?: ReferrerInfo, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
|
|
733
|
+
getPlaceAndMakePerpOrderIx(orderParams: OptionalOrderParams, takerInfo: TakerInfo, referrerInfo?: ReferrerInfo, subAccountId?: number): Promise<TransactionInstruction>;
|
|
734
|
+
signSignedMsgOrderParamsMessage(orderParamsMessage: SignedMsgOrderParamsMessage | SignedMsgOrderParamsDelegateMessage, delegateSigner?: boolean): SignedMsgOrderParams;
|
|
735
|
+
/**
|
|
736
|
+
* Builds a deposit and place request for Swift service
|
|
737
|
+
*
|
|
738
|
+
* @param depositTx - The signed tx containing a drift deposit (e.g. see `buildSwiftDepositTx`)
|
|
739
|
+
* @param orderParamsMessage - The order parameters message to sign
|
|
740
|
+
* @param delegateSigner - Whether this is a delegate signer
|
|
741
|
+
*
|
|
742
|
+
* @returns request object for Swift service
|
|
743
|
+
*/
|
|
744
|
+
buildDepositAndPlaceSignedMsgOrderRequest(depositTx: VersionedTransaction, orderParamsMessage: SignedMsgOrderParamsMessage | SignedMsgOrderParamsDelegateMessage, delegateSigner?: boolean): {
|
|
745
|
+
deposit_tx: Buffer;
|
|
746
|
+
swift_order: SignedMsgOrderParams;
|
|
747
|
+
};
|
|
748
|
+
encodeSignedMsgOrderParamsMessage(orderParamsMessage: SignedMsgOrderParamsMessage | SignedMsgOrderParamsDelegateMessage, delegateSigner?: boolean): Buffer;
|
|
749
|
+
decodeSignedMsgOrderParamsMessage(encodedMessage: Buffer, delegateSigner?: boolean): SignedMsgOrderParamsMessage | SignedMsgOrderParamsDelegateMessage;
|
|
750
|
+
signMessage(message: Uint8Array, keypair?: Keypair): Buffer;
|
|
751
|
+
placeSignedMsgTakerOrder(signedSignedMsgOrderParams: SignedMsgOrderParams, marketIndex: number, takerInfo: {
|
|
752
|
+
taker: PublicKey;
|
|
753
|
+
takerStats: PublicKey;
|
|
754
|
+
takerUserAccount: UserAccount;
|
|
755
|
+
signingAuthority: PublicKey;
|
|
756
|
+
}, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
757
|
+
getPlaceSignedMsgTakerPerpOrderIxs(signedSignedMsgOrderParams: SignedMsgOrderParams, marketIndex: number, takerInfo: {
|
|
758
|
+
taker: PublicKey;
|
|
759
|
+
takerStats: PublicKey;
|
|
760
|
+
takerUserAccount: UserAccount;
|
|
761
|
+
signingAuthority: PublicKey;
|
|
762
|
+
}, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number): Promise<TransactionInstruction[]>;
|
|
763
|
+
placeAndMakeSignedMsgPerpOrder(signedSignedMsgOrderParams: SignedMsgOrderParams, signedMsgOrderUuid: Uint8Array, takerInfo: {
|
|
764
|
+
taker: PublicKey;
|
|
765
|
+
takerStats: PublicKey;
|
|
766
|
+
takerUserAccount: UserAccount;
|
|
767
|
+
signingAuthority: PublicKey;
|
|
768
|
+
}, orderParams: OptionalOrderParams, referrerInfo?: ReferrerInfo, txParams?: TxParams, subAccountId?: number, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number): Promise<TransactionSignature>;
|
|
769
|
+
getPlaceAndMakeSignedMsgPerpOrderIxs(signedSignedMsgOrderParams: SignedMsgOrderParams, signedMsgOrderUuid: Uint8Array, takerInfo: {
|
|
770
|
+
taker: PublicKey;
|
|
771
|
+
takerStats: PublicKey;
|
|
772
|
+
takerUserAccount: UserAccount;
|
|
773
|
+
signingAuthority: PublicKey;
|
|
774
|
+
}, orderParams: OptionalOrderParams, referrerInfo?: ReferrerInfo, subAccountId?: number, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number): Promise<TransactionInstruction[]>;
|
|
775
|
+
preparePlaceAndTakeSpotOrder(_orderParams: OptionalOrderParams, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo, _referrerInfo?: ReferrerInfo, _txParams?: TxParams, _subAccountId?: number): Promise<void>;
|
|
776
|
+
placeAndTakeSpotOrder(_orderParams: OptionalOrderParams, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo, _referrerInfo?: ReferrerInfo, _txParams?: TxParams, _subAccountId?: number): Promise<TransactionSignature>;
|
|
777
|
+
getPlaceAndTakeSpotOrderIx(_orderParams: OptionalOrderParams, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo, _referrerInfo?: ReferrerInfo, _subAccountId?: number): Promise<TransactionInstruction>;
|
|
778
|
+
placeAndMakeSpotOrder(_orderParams: OptionalOrderParams, _takerInfo: TakerInfo, _fulfillmentConfig?: unknown, _referrerInfo?: ReferrerInfo, _txParams?: TxParams, _subAccountId?: number): Promise<TransactionSignature>;
|
|
779
|
+
getPlaceAndMakeSpotOrderIx(_orderParams: OptionalOrderParams, _takerInfo: TakerInfo, _fulfillmentConfig?: unknown, _referrerInfo?: ReferrerInfo, _subAccountId?: number): Promise<TransactionInstruction>;
|
|
780
|
+
/**
|
|
781
|
+
* @deprecated use {@link placePerpOrder} or {@link placeAndTakePerpOrder} instead
|
|
782
|
+
*/
|
|
783
|
+
closePosition(marketIndex: number, limitPrice?: BN, subAccountId?: number): Promise<TransactionSignature>;
|
|
784
|
+
/**
|
|
785
|
+
* Modifies an open order by closing it and replacing it with a new order.
|
|
786
|
+
* @deprecated use modifyOrder instead
|
|
787
|
+
* @param orderId: The open order to modify
|
|
788
|
+
* @param newBaseAmount: The new base amount for the order. One of [newBaseAmount|newLimitPrice|newOraclePriceOffset] must be provided.
|
|
789
|
+
* @param newLimitPice: The new limit price for the order. One of [newBaseAmount|newLimitPrice|newOraclePriceOffset] must be provided.
|
|
790
|
+
* @param newOraclePriceOffset: The new oracle price offset for the order. One of [newBaseAmount|newLimitPrice|newOraclePriceOffset] must be provided.
|
|
791
|
+
* @returns
|
|
792
|
+
*/
|
|
793
|
+
modifyPerpOrder(orderId: number, newBaseAmount?: BN, newLimitPrice?: BN, newOraclePriceOffset?: number): Promise<TransactionSignature>;
|
|
794
|
+
/**
|
|
795
|
+
* Modifies an open order by closing it and replacing it with a new order.
|
|
796
|
+
* @deprecated use modifyOrderByUserOrderId instead
|
|
797
|
+
* @param userOrderId: The open order to modify
|
|
798
|
+
* @param newBaseAmount: The new base amount for the order. One of [newBaseAmount|newLimitPrice|newOraclePriceOffset] must be provided.
|
|
799
|
+
* @param newLimitPice: The new limit price for the order. One of [newBaseAmount|newLimitPrice|newOraclePriceOffset] must be provided.
|
|
800
|
+
* @param newOraclePriceOffset: The new oracle price offset for the order. One of [newBaseAmount|newLimitPrice|newOraclePriceOffset] must be provided.
|
|
801
|
+
* @returns
|
|
802
|
+
*/
|
|
803
|
+
modifyPerpOrderByUserOrderId(userOrderId: number, newBaseAmount?: BN, newLimitPrice?: BN, newOraclePriceOffset?: number): Promise<TransactionSignature>;
|
|
804
|
+
/**
|
|
805
|
+
* Modifies an open order (spot or perp) by closing it and replacing it with a new order.
|
|
806
|
+
* @param orderParams.orderId: The open order to modify
|
|
807
|
+
* @param orderParams.newDirection: The new direction for the order
|
|
808
|
+
* @param orderParams.newBaseAmount: The new base amount for the order
|
|
809
|
+
* @param orderParams.newLimitPice: The new limit price for the order
|
|
810
|
+
* @param orderParams.newOraclePriceOffset: The new oracle price offset for the order
|
|
811
|
+
* @param orderParams.newTriggerPrice: Optional - Thew new trigger price for the order.
|
|
812
|
+
* @param orderParams.auctionDuration:
|
|
813
|
+
* @param orderParams.auctionStartPrice:
|
|
814
|
+
* @param orderParams.auctionEndPrice:
|
|
815
|
+
* @param orderParams.reduceOnly:
|
|
816
|
+
* @param orderParams.postOnly:
|
|
817
|
+
* @param orderParams.bitFlags:
|
|
818
|
+
* @param orderParams.policy:
|
|
819
|
+
* @param orderParams.maxTs:
|
|
820
|
+
* @returns
|
|
821
|
+
*/
|
|
822
|
+
modifyOrder(orderParams: {
|
|
823
|
+
orderId: number;
|
|
824
|
+
newDirection?: PositionDirection;
|
|
825
|
+
newBaseAmount?: BN;
|
|
826
|
+
newLimitPrice?: BN;
|
|
827
|
+
newOraclePriceOffset?: number;
|
|
828
|
+
newTriggerPrice?: BN;
|
|
829
|
+
newTriggerCondition?: OrderTriggerCondition;
|
|
830
|
+
auctionDuration?: number;
|
|
831
|
+
auctionStartPrice?: BN;
|
|
832
|
+
auctionEndPrice?: BN;
|
|
833
|
+
reduceOnly?: boolean;
|
|
834
|
+
postOnly?: PostOnlyParams;
|
|
835
|
+
bitFlags?: number;
|
|
836
|
+
maxTs?: BN;
|
|
837
|
+
policy?: number;
|
|
838
|
+
}, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
|
|
839
|
+
/**
|
|
840
|
+
* @param orderParams: The parameters for the order to modify.
|
|
841
|
+
* @param subAccountId: Optional - The subaccount ID of the user to modify the order for.
|
|
842
|
+
* @param userPublicKey: Optional - The public key of the user to modify the order for. This takes precedence over subAccountId.
|
|
843
|
+
* @returns
|
|
844
|
+
*/
|
|
845
|
+
getModifyOrderIx({ orderId, newDirection, newBaseAmount, newLimitPrice, newOraclePriceOffset, newTriggerPrice, newTriggerCondition, auctionDuration, auctionStartPrice, auctionEndPrice, reduceOnly, postOnly, bitFlags, maxTs, policy, }: {
|
|
846
|
+
orderId: number;
|
|
847
|
+
newDirection?: PositionDirection;
|
|
848
|
+
newBaseAmount?: BN;
|
|
849
|
+
newLimitPrice?: BN;
|
|
850
|
+
newOraclePriceOffset?: number;
|
|
851
|
+
newTriggerPrice?: BN;
|
|
852
|
+
newTriggerCondition?: OrderTriggerCondition;
|
|
853
|
+
auctionDuration?: number;
|
|
854
|
+
auctionStartPrice?: BN;
|
|
855
|
+
auctionEndPrice?: BN;
|
|
856
|
+
reduceOnly?: boolean;
|
|
857
|
+
postOnly?: PostOnlyParams;
|
|
858
|
+
bitFlags?: number;
|
|
859
|
+
maxTs?: BN;
|
|
860
|
+
policy?: number;
|
|
861
|
+
}, subAccountId?: number, overrides?: {
|
|
862
|
+
user?: User;
|
|
863
|
+
authority?: PublicKey;
|
|
864
|
+
}): Promise<TransactionInstruction>;
|
|
865
|
+
/**
|
|
866
|
+
* Modifies an open order by closing it and replacing it with a new order.
|
|
867
|
+
* @param orderParams.userOrderId: The open order to modify
|
|
868
|
+
* @param orderParams.newDirection: The new direction for the order
|
|
869
|
+
* @param orderParams.newBaseAmount: The new base amount for the order
|
|
870
|
+
* @param orderParams.newLimitPice: The new limit price for the order
|
|
871
|
+
* @param orderParams.newOraclePriceOffset: The new oracle price offset for the order
|
|
872
|
+
* @param orderParams.newTriggerPrice: Optional - Thew new trigger price for the order.
|
|
873
|
+
* @param orderParams.auctionDuration: Only required if order type changed to market from something else
|
|
874
|
+
* @param orderParams.auctionStartPrice: Only required if order type changed to market from something else
|
|
875
|
+
* @param orderParams.auctionEndPrice: Only required if order type changed to market from something else
|
|
876
|
+
* @param orderParams.reduceOnly:
|
|
877
|
+
* @param orderParams.postOnly:
|
|
878
|
+
* @param orderParams.bitFlags:
|
|
879
|
+
* @param orderParams.policy:
|
|
880
|
+
* @param orderParams.maxTs:
|
|
881
|
+
* @returns
|
|
882
|
+
*/
|
|
883
|
+
modifyOrderByUserOrderId(orderParams: {
|
|
884
|
+
userOrderId: number;
|
|
885
|
+
newDirection?: PositionDirection;
|
|
886
|
+
newBaseAmount?: BN;
|
|
887
|
+
newLimitPrice?: BN;
|
|
888
|
+
newOraclePriceOffset?: number;
|
|
889
|
+
newTriggerPrice?: BN;
|
|
890
|
+
newTriggerCondition?: OrderTriggerCondition;
|
|
891
|
+
auctionDuration?: number;
|
|
892
|
+
auctionStartPrice?: BN;
|
|
893
|
+
auctionEndPrice?: BN;
|
|
894
|
+
reduceOnly?: boolean;
|
|
895
|
+
postOnly?: PostOnlyParams;
|
|
896
|
+
bitFlags?: number;
|
|
897
|
+
policy?: ModifyOrderPolicy;
|
|
898
|
+
maxTs?: BN;
|
|
899
|
+
}, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
|
|
900
|
+
getModifyOrderByUserIdIx({ userOrderId, newDirection, newBaseAmount, newLimitPrice, newOraclePriceOffset, newTriggerPrice, newTriggerCondition, auctionDuration, auctionStartPrice, auctionEndPrice, reduceOnly, postOnly, bitFlags, maxTs, policy, }: {
|
|
901
|
+
userOrderId: number;
|
|
902
|
+
newDirection?: PositionDirection;
|
|
903
|
+
newBaseAmount?: BN;
|
|
904
|
+
newLimitPrice?: BN;
|
|
905
|
+
newOraclePriceOffset?: number;
|
|
906
|
+
newTriggerPrice?: BN;
|
|
907
|
+
newTriggerCondition?: OrderTriggerCondition;
|
|
908
|
+
auctionDuration?: number;
|
|
909
|
+
auctionStartPrice?: BN;
|
|
910
|
+
auctionEndPrice?: BN;
|
|
911
|
+
reduceOnly?: boolean;
|
|
912
|
+
postOnly?: PostOnlyParams;
|
|
913
|
+
bitFlags?: number;
|
|
914
|
+
policy?: ModifyOrderPolicy;
|
|
915
|
+
maxTs?: BN;
|
|
916
|
+
}, subAccountId?: number): Promise<TransactionInstruction>;
|
|
917
|
+
settlePNLs(users: {
|
|
918
|
+
settleeUserAccountPublicKey: PublicKey;
|
|
919
|
+
settleeUserAccount: UserAccount;
|
|
920
|
+
}[], marketIndexes: number[], opts?: {
|
|
921
|
+
filterInvalidMarkets?: boolean;
|
|
922
|
+
}, txParams?: TxParams): Promise<TransactionSignature>;
|
|
923
|
+
getSettlePNLsIxs(users: {
|
|
924
|
+
settleeUserAccountPublicKey: PublicKey;
|
|
925
|
+
settleeUserAccount: UserAccount;
|
|
926
|
+
}[], marketIndexes: number[], revenueShareEscrowMap?: RevenueShareEscrowMap): Promise<Array<TransactionInstruction>>;
|
|
927
|
+
settlePNL(settleeUserAccountPublicKey: PublicKey, settleeUserAccount: UserAccount, marketIndex: number, txParams?: TxParams, optionalIxs?: TransactionInstruction[], revenueShareEscrowMap?: RevenueShareEscrowMap): Promise<TransactionSignature>;
|
|
928
|
+
settlePNLIx(settleeUserAccountPublicKey: PublicKey, settleeUserAccount: UserAccount, marketIndex: number, revenueShareEscrowMap?: RevenueShareEscrowMap): Promise<TransactionInstruction>;
|
|
929
|
+
settleMultiplePNLs(settleeUserAccountPublicKey: PublicKey, settleeUserAccount: UserAccount, marketIndexes: number[], mode: SettlePnlMode, revenueShareEscrowMap?: RevenueShareEscrowMap, txParams?: TxParams): Promise<TransactionSignature>;
|
|
930
|
+
settleMultiplePNLsMultipleTxs(settleeUserAccountPublicKey: PublicKey, settleeUserAccount: UserAccount, marketIndexes: number[], mode: SettlePnlMode, txParams?: TxParams, optionalIxs?: TransactionInstruction[], revenueShareEscrowMap?: RevenueShareEscrowMap): Promise<TransactionSignature[]>;
|
|
931
|
+
settleMultiplePNLsIx(settleeUserAccountPublicKey: PublicKey, settleeUserAccount: UserAccount, marketIndexes: number[], mode: SettlePnlMode, overrides?: {
|
|
932
|
+
authority?: PublicKey;
|
|
933
|
+
}, revenueShareEscrowMap?: RevenueShareEscrowMap): Promise<TransactionInstruction>;
|
|
934
|
+
getSetUserStatusToBeingLiquidatedIx(userAccountPublicKey: PublicKey, userAccount: UserAccount): Promise<TransactionInstruction>;
|
|
935
|
+
setUserStatusToBeingLiquidated(userAccountPublicKey: PublicKey, userAccount: UserAccount): Promise<TransactionSignature>;
|
|
936
|
+
liquidatePerp(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number, maxBaseAssetAmount: BN, limitPrice?: BN, txParams?: TxParams, liquidatorSubAccountId?: number): Promise<TransactionSignature>;
|
|
937
|
+
getLiquidatePerpIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number, maxBaseAssetAmount: BN, limitPrice?: BN, liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
|
|
938
|
+
liquidatePerpWithFill(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number, makerInfos: MakerInfo[], txParams?: TxParams, liquidatorSubAccountId?: number): Promise<TransactionSignature>;
|
|
939
|
+
getLiquidatePerpWithFillIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number, makerInfos: MakerInfo[], liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
|
|
940
|
+
liquidateSpot(userAccountPublicKey: PublicKey, userAccount: UserAccount, assetMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN, limitPrice?: BN, txParams?: TxParams, liquidatorSubAccountId?: number): Promise<TransactionSignature>;
|
|
941
|
+
getLiquidateSpotIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, assetMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN, limitPrice?: BN, liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
|
|
942
|
+
getJupiterLiquidateSpotWithSwapIxV6({ jupiterClient, liabilityMarketIndex, assetMarketIndex, swapAmount, assetTokenAccount, liabilityTokenAccount, slippageBps, swapMode, onlyDirectRoutes, quote, userAccount, userAccountPublicKey, userStatsAccountPublicKey, liquidatorSubAccountId, maxAccounts, }: {
|
|
943
|
+
jupiterClient: JupiterClient;
|
|
944
|
+
liabilityMarketIndex: number;
|
|
945
|
+
assetMarketIndex: number;
|
|
946
|
+
swapAmount: BN;
|
|
947
|
+
assetTokenAccount?: PublicKey;
|
|
948
|
+
liabilityTokenAccount?: PublicKey;
|
|
949
|
+
slippageBps?: number;
|
|
950
|
+
swapMode?: SwapMode;
|
|
951
|
+
onlyDirectRoutes?: boolean;
|
|
952
|
+
quote?: QuoteResponse;
|
|
953
|
+
userAccount: UserAccount;
|
|
954
|
+
userAccountPublicKey: PublicKey;
|
|
955
|
+
userStatsAccountPublicKey: PublicKey;
|
|
956
|
+
liquidatorSubAccountId?: number;
|
|
957
|
+
maxAccounts?: number;
|
|
958
|
+
}): Promise<{
|
|
959
|
+
ixs: TransactionInstruction[];
|
|
960
|
+
lookupTables: AddressLookupTableAccount[];
|
|
961
|
+
}>;
|
|
962
|
+
/**
|
|
963
|
+
* Get the drift liquidate_spot_with_swap instructions
|
|
964
|
+
*
|
|
965
|
+
* @param liabilityMarketIndex the market index of the token you're buying
|
|
966
|
+
* @param assetMarketIndex the market index of the token you're selling
|
|
967
|
+
* @param amountIn the amount of the token to sell
|
|
968
|
+
* @param assetTokenAccount the token account to move the tokens being sold
|
|
969
|
+
* @param liabilityTokenAccount the token account to receive the tokens being bought
|
|
970
|
+
* @param userAccount
|
|
971
|
+
* @param userAccountPublicKey
|
|
972
|
+
* @param userStatsAccountPublicKey
|
|
973
|
+
*/
|
|
974
|
+
getLiquidateSpotWithSwapIx({ liabilityMarketIndex, assetMarketIndex, swapAmount: swapAmount, assetTokenAccount, liabilityTokenAccount, userAccount, userAccountPublicKey, userStatsAccountPublicKey, liquidatorSubAccountId, }: {
|
|
975
|
+
liabilityMarketIndex: number;
|
|
976
|
+
assetMarketIndex: number;
|
|
977
|
+
swapAmount: BN;
|
|
978
|
+
assetTokenAccount: PublicKey;
|
|
979
|
+
liabilityTokenAccount: PublicKey;
|
|
980
|
+
userAccount: UserAccount;
|
|
981
|
+
userAccountPublicKey: PublicKey;
|
|
982
|
+
userStatsAccountPublicKey: PublicKey;
|
|
983
|
+
liquidatorSubAccountId?: number;
|
|
984
|
+
}): Promise<{
|
|
985
|
+
beginSwapIx: TransactionInstruction;
|
|
986
|
+
endSwapIx: TransactionInstruction;
|
|
987
|
+
}>;
|
|
988
|
+
getInsuranceFundSwapIx({ inMarketIndex, outMarketIndex, amountIn, inTokenAccount, outTokenAccount, }: {
|
|
989
|
+
inMarketIndex: number;
|
|
990
|
+
outMarketIndex: number;
|
|
991
|
+
amountIn: BN;
|
|
992
|
+
inTokenAccount: PublicKey;
|
|
993
|
+
outTokenAccount: PublicKey;
|
|
994
|
+
}): Promise<{
|
|
995
|
+
beginSwapIx: TransactionInstruction;
|
|
996
|
+
endSwapIx: TransactionInstruction;
|
|
997
|
+
}>;
|
|
998
|
+
liquidateBorrowForPerpPnl(userAccountPublicKey: PublicKey, userAccount: UserAccount, perpMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN, limitPrice?: BN, txParams?: TxParams, liquidatorSubAccountId?: number): Promise<TransactionSignature>;
|
|
999
|
+
getLiquidateBorrowForPerpPnlIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, perpMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN, limitPrice?: BN, liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
|
|
1000
|
+
liquidatePerpPnlForDeposit(userAccountPublicKey: PublicKey, userAccount: UserAccount, perpMarketIndex: number, assetMarketIndex: number, maxPnlTransfer: BN, limitPrice?: BN, txParams?: TxParams, liquidatorSubAccountId?: number): Promise<TransactionSignature>;
|
|
1001
|
+
getLiquidatePerpPnlForDepositIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, perpMarketIndex: number, assetMarketIndex: number, maxPnlTransfer: BN, limitPrice?: BN, liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
|
|
1002
|
+
resolvePerpBankruptcy(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number, txParams?: TxParams, liquidatorSubAccountId?: number): Promise<TransactionSignature>;
|
|
1003
|
+
getResolvePerpBankruptcyIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number, liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
|
|
1004
|
+
resolveSpotBankruptcy(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number, txParams?: TxParams, liquidatorSubAccountId?: number): Promise<TransactionSignature>;
|
|
1005
|
+
getResolveSpotBankruptcyIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number, liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
|
|
1006
|
+
updateFundingRate(perpMarketIndex: number, oracle: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
1007
|
+
getUpdateFundingRateIx(perpMarketIndex: number, oracle: PublicKey): Promise<TransactionInstruction>;
|
|
1008
|
+
updatePrelaunchOracle(perpMarketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
1009
|
+
getUpdatePrelaunchOracleIx(perpMarketIndex: number): Promise<TransactionInstruction>;
|
|
1010
|
+
updatePerpBidAskTwap(perpMarketIndex: number, makers: [PublicKey, PublicKey][], txParams?: TxParams): Promise<TransactionSignature>;
|
|
1011
|
+
getUpdatePerpBidAskTwapIx(perpMarketIndex: number, makers: [PublicKey, PublicKey][]): Promise<TransactionInstruction>;
|
|
1012
|
+
settleFundingPayment(userAccountPublicKey: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
1013
|
+
getSettleFundingPaymentIx(userAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
|
|
1014
|
+
triggerEvent(eventName: keyof VelocityClientAccountEvents, data?: any): void;
|
|
1015
|
+
getOracleDataForPerpMarket(marketIndex: number): OraclePriceData;
|
|
1016
|
+
getMMOracleDataForPerpMarket(marketIndex: number): MMOraclePriceData;
|
|
1017
|
+
getOracleDataForSpotMarket(marketIndex: number): OraclePriceData;
|
|
1018
|
+
initializeInsuranceFundStake(marketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
1019
|
+
getInitializeInsuranceFundStakeIx(marketIndex: number): Promise<TransactionInstruction>;
|
|
1020
|
+
getAddInsuranceFundStakeIx(marketIndex: number, amount: BN, collateralAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
|
|
1021
|
+
/**
|
|
1022
|
+
* Add to an insurance fund stake and optionally initialize the account
|
|
1023
|
+
*/
|
|
1024
|
+
addInsuranceFundStake({ marketIndex, amount, collateralAccountPublicKey, initializeStakeAccount, fromSubaccount, txParams, }: {
|
|
1025
|
+
/**
|
|
1026
|
+
* Spot market index
|
|
1027
|
+
*/
|
|
1028
|
+
marketIndex: number;
|
|
1029
|
+
amount: BN;
|
|
1030
|
+
/**
|
|
1031
|
+
* The account where the funds to stake come from. Usually an associated token account
|
|
1032
|
+
*/
|
|
1033
|
+
collateralAccountPublicKey: PublicKey;
|
|
1034
|
+
/**
|
|
1035
|
+
* Add instructions to initialize the staking account -- required if its the first time the currrent authority has staked in this market
|
|
1036
|
+
*/
|
|
1037
|
+
initializeStakeAccount?: boolean;
|
|
1038
|
+
/**
|
|
1039
|
+
* Optional -- withdraw from current subaccount to fund stake amount, instead of wallet balance
|
|
1040
|
+
*/
|
|
1041
|
+
fromSubaccount?: boolean;
|
|
1042
|
+
txParams?: TxParams;
|
|
1043
|
+
}): Promise<TransactionSignature>;
|
|
1044
|
+
/**
|
|
1045
|
+
* Get instructions to add to an insurance fund stake and optionally initialize the account
|
|
1046
|
+
*/
|
|
1047
|
+
getAddInsuranceFundStakeIxs({ marketIndex, amount, collateralAccountPublicKey, initializeStakeAccount, fromSubaccount, }: {
|
|
1048
|
+
/**
|
|
1049
|
+
* Spot market index
|
|
1050
|
+
*/
|
|
1051
|
+
marketIndex: number;
|
|
1052
|
+
amount: BN;
|
|
1053
|
+
/**
|
|
1054
|
+
* The account where the funds to stake come from. Usually an associated token account
|
|
1055
|
+
*/
|
|
1056
|
+
collateralAccountPublicKey: PublicKey;
|
|
1057
|
+
/**
|
|
1058
|
+
* Add instructions to initialize the staking account -- required if its the first time the currrent authority has staked in this market
|
|
1059
|
+
*/
|
|
1060
|
+
initializeStakeAccount?: boolean;
|
|
1061
|
+
/**
|
|
1062
|
+
* Optional -- withdraw from current subaccount to fund stake amount, instead of wallet balance
|
|
1063
|
+
*/
|
|
1064
|
+
fromSubaccount?: boolean;
|
|
1065
|
+
}): Promise<TransactionInstruction[]>;
|
|
1066
|
+
requestRemoveInsuranceFundStake(marketIndex: number, amount: BN, txParams?: TxParams): Promise<TransactionSignature>;
|
|
1067
|
+
cancelRequestRemoveInsuranceFundStake(marketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
1068
|
+
removeInsuranceFundStake(marketIndex: number, collateralAccountPublicKey: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
1069
|
+
updateUserQuoteAssetInsuranceStake(authority: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
1070
|
+
getUpdateUserQuoteAssetInsuranceStakeIx(authority: PublicKey): Promise<TransactionInstruction>;
|
|
1071
|
+
updateUserGovTokenInsuranceStake(authority: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
1072
|
+
getUpdateUserGovTokenInsuranceStakeIx(authority: PublicKey): Promise<TransactionInstruction>;
|
|
1073
|
+
settleRevenueToInsuranceFund(spotMarketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
1074
|
+
getSettleRevenueToInsuranceFundIx(spotMarketIndex: number): Promise<TransactionInstruction>;
|
|
1075
|
+
resolvePerpPnlDeficit(spotMarketIndex: number, perpMarketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
1076
|
+
getResolvePerpPnlDeficitIx(spotMarketIndex: number, perpMarketIndex: number): Promise<TransactionInstruction>;
|
|
1077
|
+
getDepositIntoSpotMarketRevenuePoolIx(marketIndex: number, amount: BN, userTokenAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
|
|
1078
|
+
/**
|
|
1079
|
+
* This ix will donate your funds to drift revenue pool. It does not deposit into your user account
|
|
1080
|
+
* @param marketIndex
|
|
1081
|
+
* @param amount
|
|
1082
|
+
* @param userTokenAccountPublicKey
|
|
1083
|
+
* @returns
|
|
1084
|
+
*/
|
|
1085
|
+
depositIntoSpotMarketRevenuePool(marketIndex: number, amount: BN, userTokenAccountPublicKey: PublicKey): Promise<TransactionSignature>;
|
|
1086
|
+
getPerpMarketExtendedInfo(marketIndex: number): PerpMarketExtendedInfo;
|
|
1087
|
+
/**
|
|
1088
|
+
* Calculates taker / maker fee (as a percentage, e.g. .001 = 10 basis points) for particular marketType
|
|
1089
|
+
* @param marketType
|
|
1090
|
+
* @param positionMarketIndex
|
|
1091
|
+
* @returns : {takerFee: number, makerFee: number} Precision None
|
|
1092
|
+
*/
|
|
1093
|
+
getMarketFees(marketType: MarketType, marketIndex?: number, user?: User): {
|
|
1094
|
+
takerFee: number;
|
|
1095
|
+
makerFee: number;
|
|
1096
|
+
};
|
|
1097
|
+
/**
|
|
1098
|
+
* Returns the market index and type for a given market name
|
|
1099
|
+
* E.g. "SOL-PERP" -> { marketIndex: 0, marketType: MarketType.PERP }
|
|
1100
|
+
*
|
|
1101
|
+
* @param name
|
|
1102
|
+
*/
|
|
1103
|
+
getMarketIndexAndType(name: string): {
|
|
1104
|
+
marketIndex: number;
|
|
1105
|
+
marketType: MarketType;
|
|
1106
|
+
} | undefined;
|
|
1107
|
+
postPythLazerOracleUpdate(feedIds: number[], pythMessageHex: string): Promise<string>;
|
|
1108
|
+
getPostPythLazerOracleUpdateIxs(feedIds: number[], pythMessageHex: string, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number): Promise<TransactionInstruction[]>;
|
|
1109
|
+
getPauseSpotMarketDepositWithdrawIx(spotMarketIndex: number): Promise<TransactionInstruction>;
|
|
1110
|
+
pauseSpotMarketDepositWithdraw(spotMarketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
1111
|
+
updateMmOracleNative(marketIndex: number, oraclePrice: BN, oracleSequenceId: BN): Promise<TransactionSignature>;
|
|
1112
|
+
getUpdateMmOracleNativeIx(marketIndex: number, oraclePrice: BN, oracleSequenceId: BN): Promise<TransactionInstruction>;
|
|
1113
|
+
updateAmmSpreadAdjustmentNative(marketIndex: number, ammSpreadAdjustment: number): Promise<TransactionSignature>;
|
|
1114
|
+
getUpdateAmmSpreadAdjustmentNativeIx(marketIndex: number, ammSpreadAdjustment: number): TransactionInstruction;
|
|
1115
|
+
getLpPoolAccount(lpPoolId: number): Promise<LPPoolAccount>;
|
|
1116
|
+
getConstituentTargetBaseAccount(lpPoolId: number): Promise<ConstituentTargetBaseAccount>;
|
|
1117
|
+
getAmmCache(): Promise<AmmCache>;
|
|
1118
|
+
updateLpConstituentTargetBase(lpPoolId: number, constituents: PublicKey[], txParams?: TxParams): Promise<TransactionSignature>;
|
|
1119
|
+
getUpdateLpConstituentTargetBaseIx(lpPoolId: number, constituents: PublicKey[]): Promise<TransactionInstruction>;
|
|
1120
|
+
updateLpPoolAum(lpPool: LPPoolAccount, spotMarketIndexOfConstituents: number[], txParams?: TxParams): Promise<TransactionSignature>;
|
|
1121
|
+
getUpdateLpPoolAumIxs(lpPool: LPPoolAccount, spotMarketIndexOfConstituents: number[]): Promise<TransactionInstruction>;
|
|
1122
|
+
updateAmmCache(perpMarketIndexes: number[], txParams?: TxParams): Promise<TransactionSignature>;
|
|
1123
|
+
getUpdateAmmCacheIx(perpMarketIndexes: number[]): Promise<TransactionInstruction>;
|
|
1124
|
+
updateConstituentOracleInfo(constituent: ConstituentAccount): Promise<TransactionSignature>;
|
|
1125
|
+
getUpdateConstituentOracleInfoIx(constituent: ConstituentAccount): Promise<TransactionInstruction>;
|
|
1126
|
+
lpPoolSwap(inMarketIndex: number, outMarketIndex: number, inAmount: BN, minOutAmount: BN, lpPool: PublicKey, userAuthority: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
1127
|
+
getLpPoolSwapIx(inMarketIndex: number, outMarketIndex: number, inAmount: BN, minOutAmount: BN, lpPool: PublicKey, userAuthority: PublicKey): Promise<TransactionInstruction>;
|
|
1128
|
+
viewLpPoolSwapFees(inMarketIndex: number, outMarketIndex: number, inAmount: BN, inTargetWeight: BN, outTargetWeight: BN, lpPool: PublicKey, constituentTargetBase: PublicKey, constituentInTokenAccount: PublicKey, constituentOutTokenAccount: PublicKey, inConstituent: PublicKey, outConstituent: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
1129
|
+
getViewLpPoolSwapFeesIx(inMarketIndex: number, outMarketIndex: number, inAmount: BN, inTargetWeight: BN, outTargetWeight: BN, lpPool: PublicKey, constituentTargetBase: PublicKey, constituentInTokenAccount: PublicKey, constituentOutTokenAccount: PublicKey, inConstituent: PublicKey, outConstituent: PublicKey): Promise<TransactionInstruction>;
|
|
1130
|
+
getCreateLpPoolTokenAccountIx(lpPool: LPPoolAccount): Promise<TransactionInstruction>;
|
|
1131
|
+
createLpPoolTokenAccount(lpPool: LPPoolAccount, txParams?: TxParams): Promise<TransactionSignature>;
|
|
1132
|
+
lpPoolAddLiquidity({ inMarketIndex, inAmount, minMintAmount, lpPool, txParams, }: {
|
|
1133
|
+
inMarketIndex: number;
|
|
1134
|
+
inAmount: BN;
|
|
1135
|
+
minMintAmount: BN;
|
|
1136
|
+
lpPool: LPPoolAccount;
|
|
1137
|
+
txParams?: TxParams;
|
|
1138
|
+
}): Promise<TransactionSignature>;
|
|
1139
|
+
getLpPoolAddLiquidityIx({ inMarketIndex, inAmount, minMintAmount, lpPool, }: {
|
|
1140
|
+
inMarketIndex: number;
|
|
1141
|
+
inAmount: BN;
|
|
1142
|
+
minMintAmount: BN;
|
|
1143
|
+
lpPool: LPPoolAccount;
|
|
1144
|
+
}): Promise<TransactionInstruction[]>;
|
|
1145
|
+
viewLpPoolAddLiquidityFees({ inMarketIndex, inAmount, lpPool, txParams, }: {
|
|
1146
|
+
inMarketIndex: number;
|
|
1147
|
+
inAmount: BN;
|
|
1148
|
+
lpPool: LPPoolAccount;
|
|
1149
|
+
txParams?: TxParams;
|
|
1150
|
+
}): Promise<TransactionSignature>;
|
|
1151
|
+
getViewLpPoolAddLiquidityFeesIx({ inMarketIndex, inAmount, lpPool, }: {
|
|
1152
|
+
inMarketIndex: number;
|
|
1153
|
+
inAmount: BN;
|
|
1154
|
+
lpPool: LPPoolAccount;
|
|
1155
|
+
}): Promise<TransactionInstruction>;
|
|
1156
|
+
lpPoolRemoveLiquidity({ outMarketIndex, lpToBurn, minAmountOut, lpPool, txParams, }: {
|
|
1157
|
+
outMarketIndex: number;
|
|
1158
|
+
lpToBurn: BN;
|
|
1159
|
+
minAmountOut: BN;
|
|
1160
|
+
lpPool: LPPoolAccount;
|
|
1161
|
+
txParams?: TxParams;
|
|
1162
|
+
}): Promise<TransactionSignature>;
|
|
1163
|
+
getLpPoolRemoveLiquidityIx({ outMarketIndex, lpToBurn, minAmountOut, lpPool, }: {
|
|
1164
|
+
outMarketIndex: number;
|
|
1165
|
+
lpToBurn: BN;
|
|
1166
|
+
minAmountOut: BN;
|
|
1167
|
+
lpPool: LPPoolAccount;
|
|
1168
|
+
}): Promise<TransactionInstruction[]>;
|
|
1169
|
+
viewLpPoolRemoveLiquidityFees({ outMarketIndex, lpToBurn, lpPool, txParams, }: {
|
|
1170
|
+
outMarketIndex: number;
|
|
1171
|
+
lpToBurn: BN;
|
|
1172
|
+
lpPool: LPPoolAccount;
|
|
1173
|
+
txParams?: TxParams;
|
|
1174
|
+
}): Promise<TransactionSignature>;
|
|
1175
|
+
getViewLpPoolRemoveLiquidityFeesIx({ outMarketIndex, lpToBurn, lpPool, }: {
|
|
1176
|
+
outMarketIndex: number;
|
|
1177
|
+
lpToBurn: BN;
|
|
1178
|
+
lpPool: LPPoolAccount;
|
|
1179
|
+
}): Promise<TransactionInstruction>;
|
|
1180
|
+
getAllLpPoolAddLiquidityIxs({ inMarketIndex, inAmount, minMintAmount, lpPool, }: {
|
|
1181
|
+
inMarketIndex: number;
|
|
1182
|
+
inAmount: BN;
|
|
1183
|
+
minMintAmount: BN;
|
|
1184
|
+
lpPool: LPPoolAccount;
|
|
1185
|
+
}, constituentMap: ConstituentMap, includeUpdateConstituentOracleInfo?: boolean, view?: boolean): Promise<TransactionInstruction[]>;
|
|
1186
|
+
getAllLpPoolRemoveLiquidityIxs({ outMarketIndex, lpToBurn, minAmountOut, lpPool, }: {
|
|
1187
|
+
outMarketIndex: number;
|
|
1188
|
+
lpToBurn: BN;
|
|
1189
|
+
minAmountOut: BN;
|
|
1190
|
+
lpPool: LPPoolAccount;
|
|
1191
|
+
}, constituentMap: ConstituentMap, includeUpdateConstituentOracleInfo?: boolean, view?: boolean): Promise<TransactionInstruction[]>;
|
|
1192
|
+
getAllUpdateLpPoolAumIxs(lpPool: LPPoolAccount, constituentMap: ConstituentMap, includeUpdateConstituentOracleInfo?: boolean): Promise<TransactionInstruction[]>;
|
|
1193
|
+
getAllUpdateConstituentTargetBaseIxs(perpMarketIndexes: number[], lpPool: LPPoolAccount, constituentMap: ConstituentMap, includeUpdateConstituentOracleInfo?: boolean): Promise<TransactionInstruction[]>;
|
|
1194
|
+
getAllLpPoolSwapIxs(lpPool: LPPoolAccount, constituentMap: ConstituentMap, inMarketIndex: number, outMarketIndex: number, inAmount: BN, minOutAmount: BN, userAuthority: PublicKey): Promise<TransactionInstruction[]>;
|
|
1195
|
+
settlePerpToLpPool(lpPoolId: number, perpMarketIndexes: number[]): Promise<TransactionSignature>;
|
|
1196
|
+
getSettlePerpToLpPoolIx(lpPoolId: number, perpMarketIndexes: number[]): Promise<TransactionInstruction>;
|
|
1197
|
+
getAllSettlePerpToLpPoolIxs(lpPoolId: number, marketIndexes: number[]): Promise<TransactionInstruction[]>;
|
|
1198
|
+
/**
|
|
1199
|
+
* Below here are the transaction sending functions
|
|
1200
|
+
*/
|
|
1201
|
+
private handleSignedTransaction;
|
|
1202
|
+
private handlePreSignedTransaction;
|
|
1203
|
+
private isVersionedTransaction;
|
|
1204
|
+
/**
|
|
1205
|
+
* Send a transaction.
|
|
1206
|
+
*
|
|
1207
|
+
* @param tx
|
|
1208
|
+
* @param additionalSigners
|
|
1209
|
+
* @param opts :: Will fallback to VelocityClient's opts if not provided
|
|
1210
|
+
* @param preSigned
|
|
1211
|
+
* @returns
|
|
1212
|
+
*/
|
|
1213
|
+
sendTransaction(tx: Transaction | VersionedTransaction, additionalSigners?: Array<Signer>, opts?: ConfirmOptions, preSigned?: boolean): Promise<TxSigAndSlot>;
|
|
1214
|
+
buildTransaction(instructions: TransactionInstruction | TransactionInstruction[], txParams?: TxParams, txVersion?: TransactionVersion, lookupTables?: AddressLookupTableAccount[], forceVersionedTransaction?: boolean, recentBlockhash?: BlockhashWithExpiryBlockHeight, optionalIxs?: TransactionInstruction[]): Promise<Transaction | VersionedTransaction>;
|
|
1215
|
+
buildBulkTransactions(instructions: (TransactionInstruction | TransactionInstruction[])[], txParams?: TxParams, txVersion?: TransactionVersion, lookupTables?: AddressLookupTableAccount[], forceVersionedTransaction?: boolean): Promise<(Transaction | VersionedTransaction)[]>;
|
|
1216
|
+
buildTransactionsMap(instructionsMap: Record<string, TransactionInstruction | TransactionInstruction[]>, txParams?: TxParams, txVersion?: TransactionVersion, lookupTables?: AddressLookupTableAccount[], forceVersionedTransaction?: boolean): Promise<MappedRecord<Record<string, TransactionInstruction | TransactionInstruction[]>, Transaction | VersionedTransaction>>;
|
|
1217
|
+
buildAndSignTransactionsMap(instructionsMap: Record<string, TransactionInstruction | TransactionInstruction[]>, txParams?: TxParams, txVersion?: TransactionVersion, lookupTables?: AddressLookupTableAccount[], forceVersionedTransaction?: boolean): Promise<{
|
|
1218
|
+
signedTxMap: Record<string, Transaction>;
|
|
1219
|
+
signedTxData: SignedTxData[];
|
|
1220
|
+
} | {
|
|
1221
|
+
signedTxMap: MappedRecord<Record<string, TransactionInstruction | TransactionInstruction[]>, Transaction | VersionedTransaction>;
|
|
1222
|
+
signedTxData: SignedTxData[];
|
|
1223
|
+
}>;
|
|
1224
|
+
isOrderIncreasingPosition(orderParams: OptionalOrderParams, subAccountId: number): boolean;
|
|
1225
|
+
}
|
|
1226
|
+
/** @deprecated Use `VelocityClient` instead. `DriftClient` will be removed in a future major. */
|
|
1227
|
+
export declare const DriftClient: typeof VelocityClient;
|
|
1228
|
+
/** @deprecated Use `VelocityClient` instead. `DriftClient` will be removed in a future major. */
|
|
1229
|
+
export type DriftClient = VelocityClient;
|
|
1230
|
+
export {};
|