@drift-labs/sdk 2.97.0-beta.21 → 2.97.0-beta.23
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/VERSION +1 -1
- package/bun.lockb +0 -0
- package/lib/{accounts → browser/accounts}/bulkAccountLoader.d.ts +1 -0
- package/lib/browser/accounts/grpcAccountSubscriber.d.ts +16 -0
- package/lib/browser/accounts/grpcAccountSubscriber.js +154 -0
- package/lib/browser/accounts/grpcDriftClientAccountSubscriber.d.ts +12 -0
- package/lib/browser/accounts/grpcDriftClientAccountSubscriber.js +97 -0
- package/lib/browser/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts +10 -0
- package/lib/browser/accounts/grpcInsuranceFundStakeAccountSubscriber.js +30 -0
- package/lib/browser/accounts/grpcProgramAccountSubscriber.d.ts +18 -0
- package/lib/browser/accounts/grpcProgramAccountSubscriber.js +171 -0
- package/lib/browser/accounts/grpcUserAccountSubscriber.d.ts +10 -0
- package/lib/browser/accounts/grpcUserAccountSubscriber.js +28 -0
- package/lib/browser/accounts/grpcUserStatsAccountSubscriber.d.ts +10 -0
- package/lib/browser/accounts/grpcUserStatsAccountSubscriber.js +28 -0
- package/lib/{accounts → browser/accounts}/types.d.ts +8 -0
- package/lib/{accounts → browser/accounts}/webSocketAccountSubscriber.d.ts +2 -1
- package/lib/{accounts → browser/accounts}/webSocketDriftClientAccountSubscriber.d.ts +3 -3
- package/lib/{accounts → browser/accounts}/webSocketProgramAccountSubscriber.d.ts +2 -1
- package/lib/{addresses → browser/addresses}/pda.d.ts +1 -0
- package/lib/{addresses → browser/addresses}/pda.js +8 -1
- package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.d.ts +15 -0
- package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.js +32 -0
- package/lib/{auctionSubscriber → browser/auctionSubscriber}/index.d.ts +1 -0
- package/lib/browser/auctionSubscriber/index.js +19 -0
- package/lib/{auctionSubscriber → browser/auctionSubscriber}/types.d.ts +2 -0
- package/lib/{bankrun → browser/bankrun}/bankrunConnection.d.ts +1 -0
- package/lib/{decode → browser/decode}/phoenix.d.ts +1 -0
- package/lib/{decode → browser/decode}/user.d.ts +1 -0
- package/lib/{dlob → browser/dlob}/DLOBOrders.d.ts +1 -0
- package/lib/{driftClient.d.ts → browser/driftClient.d.ts} +11 -5
- package/lib/{driftClient.js → browser/driftClient.js} +132 -34
- package/lib/{driftClientConfig.d.ts → browser/driftClientConfig.d.ts} +6 -1
- package/lib/{idl → browser/idl}/drift.json +256 -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/isomorphic/grpc.node.d.ts +5 -0
- package/lib/{math → browser/math}/oracles.d.ts +1 -0
- package/lib/{oracles → browser/oracles}/prelaunchOracleClient.d.ts +1 -0
- package/lib/{oracles → browser/oracles}/pythClient.d.ts +1 -0
- package/lib/{oracles → browser/oracles}/pythPullClient.d.ts +1 -0
- package/lib/{oracles → browser/oracles}/quoteAssetOracleClient.d.ts +1 -0
- package/lib/{oracles → browser/oracles}/switchboardClient.d.ts +1 -0
- package/lib/{oracles → browser/oracles}/switchboardOnDemandClient.d.ts +1 -0
- package/lib/{oracles → browser/oracles}/types.d.ts +1 -0
- package/lib/{orderSubscriber → browser/orderSubscriber}/OrderSubscriber.d.ts +3 -1
- package/lib/{orderSubscriber → browser/orderSubscriber}/OrderSubscriber.js +18 -4
- package/lib/browser/orderSubscriber/grpcSubscription.d.ts +22 -0
- package/lib/browser/orderSubscriber/grpcSubscription.js +66 -0
- package/lib/{orderSubscriber → browser/orderSubscriber}/types.d.ts +9 -0
- package/lib/{token → browser/token}/index.d.ts +1 -0
- package/lib/{tx → browser/tx}/baseTxSender.d.ts +1 -0
- package/lib/{tx → browser/tx}/fastSingleTxSender.d.ts +1 -0
- package/lib/{tx → browser/tx}/forwardOnlyTxSender.d.ts +1 -0
- package/lib/{tx → browser/tx}/retryTxSender.d.ts +1 -0
- package/lib/{tx → browser/tx}/types.d.ts +1 -0
- package/lib/{tx → browser/tx}/whileValidTxSender.d.ts +1 -0
- package/lib/{types.d.ts → browser/types.d.ts} +20 -0
- package/lib/{user.js → browser/user.js} +11 -4
- package/lib/{userConfig.d.ts → browser/userConfig.d.ts} +6 -1
- package/lib/{userMap → browser/userMap}/WebsocketSubscription.d.ts +1 -0
- package/lib/browser/userMap/grpcSubscription.d.ts +24 -0
- package/lib/browser/userMap/grpcSubscription.js +40 -0
- package/lib/{userMap → browser/userMap}/userMap.js +17 -1
- package/lib/{userMap → browser/userMap}/userMapConfig.d.ts +6 -0
- package/lib/{userStats.js → browser/userStats.js} +11 -4
- package/lib/{userStatsConfig.d.ts → browser/userStatsConfig.d.ts} +6 -0
- package/lib/node/accounts/basicUserAccountSubscriber.d.ts +27 -0
- package/lib/node/accounts/basicUserAccountSubscriber.js +38 -0
- package/lib/node/accounts/bulkAccountLoader.d.ts +37 -0
- package/lib/node/accounts/bulkAccountLoader.js +222 -0
- package/lib/node/accounts/bulkUserStatsSubscription.d.ts +7 -0
- package/lib/node/accounts/bulkUserStatsSubscription.js +21 -0
- package/lib/node/accounts/bulkUserSubscription.d.ts +7 -0
- package/lib/node/accounts/bulkUserSubscription.js +21 -0
- package/lib/node/accounts/fetch.d.ts +6 -0
- package/lib/node/accounts/fetch.js +30 -0
- package/lib/node/accounts/grpcAccountSubscriber.d.ts +16 -0
- package/lib/node/accounts/grpcAccountSubscriber.js +154 -0
- package/lib/node/accounts/grpcDriftClientAccountSubscriber.d.ts +12 -0
- package/lib/node/accounts/grpcDriftClientAccountSubscriber.js +97 -0
- package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts +10 -0
- package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.js +30 -0
- package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts +18 -0
- package/lib/node/accounts/grpcProgramAccountSubscriber.js +171 -0
- package/lib/node/accounts/grpcUserAccountSubscriber.d.ts +10 -0
- package/lib/node/accounts/grpcUserAccountSubscriber.js +28 -0
- package/lib/node/accounts/grpcUserStatsAccountSubscriber.d.ts +10 -0
- package/lib/node/accounts/grpcUserStatsAccountSubscriber.js +28 -0
- package/lib/node/accounts/oneShotUserAccountSubscriber.d.ts +18 -0
- package/lib/node/accounts/oneShotUserAccountSubscriber.js +48 -0
- package/lib/node/accounts/pollingDriftClientAccountSubscriber.d.ts +69 -0
- package/lib/node/accounts/pollingDriftClientAccountSubscriber.js +415 -0
- package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts +29 -0
- package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.js +110 -0
- package/lib/node/accounts/pollingOracleAccountSubscriber.d.ts +27 -0
- package/lib/node/accounts/pollingOracleAccountSubscriber.js +78 -0
- package/lib/node/accounts/pollingTokenAccountSubscriber.d.ts +26 -0
- package/lib/node/accounts/pollingTokenAccountSubscriber.js +78 -0
- package/lib/node/accounts/pollingUserAccountSubscriber.d.ts +29 -0
- package/lib/node/accounts/pollingUserAccountSubscriber.js +102 -0
- package/lib/node/accounts/pollingUserStatsAccountSubscriber.d.ts +27 -0
- package/lib/node/accounts/pollingUserStatsAccountSubscriber.js +94 -0
- package/lib/node/accounts/testBulkAccountLoader.d.ts +4 -0
- package/lib/node/accounts/testBulkAccountLoader.js +45 -0
- package/lib/node/accounts/types.d.ts +155 -0
- package/lib/node/accounts/types.js +16 -0
- package/lib/node/accounts/utils.d.ts +8 -0
- package/lib/node/accounts/utils.js +39 -0
- package/lib/node/accounts/webSocketAccountSubscriber.d.ts +29 -0
- package/lib/node/accounts/webSocketAccountSubscriber.js +149 -0
- package/lib/node/accounts/webSocketDriftClientAccountSubscriber.d.ts +66 -0
- package/lib/node/accounts/webSocketDriftClientAccountSubscriber.js +352 -0
- package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +23 -0
- package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.js +67 -0
- package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts +34 -0
- package/lib/node/accounts/webSocketProgramAccountSubscriber.js +127 -0
- package/lib/node/accounts/webSocketUserAccountSubscriber.d.ts +23 -0
- package/lib/node/accounts/webSocketUserAccountSubscriber.js +61 -0
- package/lib/node/accounts/webSocketUserStatsAccountSubsriber.d.ts +22 -0
- package/lib/node/accounts/webSocketUserStatsAccountSubsriber.js +52 -0
- package/lib/node/addresses/marketAddresses.d.ts +2 -0
- package/lib/node/addresses/marketAddresses.js +15 -0
- package/lib/node/addresses/pda.d.ts +30 -0
- package/lib/node/addresses/pda.js +193 -0
- package/lib/node/adminClient.d.ts +202 -0
- package/lib/node/adminClient.js +1826 -0
- package/lib/node/assert/assert.d.ts +1 -0
- package/lib/node/assert/assert.js +9 -0
- package/lib/node/auctionSubscriber/auctionSubscriber.d.ts +14 -0
- package/lib/node/auctionSubscriber/auctionSubscriber.js +32 -0
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts +15 -0
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.js +32 -0
- package/lib/node/auctionSubscriber/index.d.ts +3 -0
- package/lib/node/auctionSubscriber/index.js +19 -0
- package/lib/node/auctionSubscriber/types.d.ts +14 -0
- package/lib/node/auctionSubscriber/types.js +2 -0
- package/lib/node/bankrun/bankrunConnection.d.ts +74 -0
- package/lib/node/bankrun/bankrunConnection.js +318 -0
- package/lib/node/blockhashSubscriber/BlockhashSubscriber.d.ts +27 -0
- package/lib/node/blockhashSubscriber/BlockhashSubscriber.js +89 -0
- package/lib/node/blockhashSubscriber/index.d.ts +1 -0
- package/lib/node/blockhashSubscriber/index.js +17 -0
- package/lib/node/blockhashSubscriber/types.d.ts +7 -0
- package/lib/node/blockhashSubscriber/types.js +2 -0
- package/lib/node/clock/clockSubscriber.d.ts +31 -0
- package/lib/node/clock/clockSubscriber.js +80 -0
- package/lib/node/config.d.ts +58 -0
- package/lib/node/config.js +126 -0
- package/lib/node/constants/numericConstants.d.ts +71 -0
- package/lib/node/constants/numericConstants.js +75 -0
- package/lib/node/constants/perpMarkets.d.ts +19 -0
- package/lib/node/constants/perpMarkets.js +868 -0
- package/lib/node/constants/spotMarkets.d.ts +23 -0
- package/lib/node/constants/spotMarkets.js +361 -0
- package/lib/node/constants/txConstants.d.ts +1 -0
- package/lib/node/constants/txConstants.js +4 -0
- package/lib/node/decode/phoenix.d.ts +7 -0
- package/lib/node/decode/phoenix.js +159 -0
- package/lib/node/decode/user.d.ts +4 -0
- package/lib/node/decode/user.js +339 -0
- package/lib/node/dlob/DLOB.d.ts +166 -0
- package/lib/node/dlob/DLOB.js +1142 -0
- package/lib/node/dlob/DLOBApiClient.d.ts +14 -0
- package/lib/node/dlob/DLOBApiClient.js +34 -0
- package/lib/node/dlob/DLOBNode.d.ts +57 -0
- package/lib/node/dlob/DLOBNode.js +86 -0
- package/lib/node/dlob/DLOBOrders.d.ts +17 -0
- package/lib/node/dlob/DLOBOrders.js +40 -0
- package/lib/node/dlob/DLOBSubscriber.d.ts +54 -0
- package/lib/node/dlob/DLOBSubscriber.js +139 -0
- package/lib/node/dlob/NodeList.d.ts +27 -0
- package/lib/node/dlob/NodeList.js +141 -0
- package/lib/node/dlob/dlobIdl.json +248 -0
- package/lib/node/dlob/orderBookLevels.d.ts +72 -0
- package/lib/node/dlob/orderBookLevels.js +438 -0
- package/lib/node/dlob/types.d.ts +18 -0
- package/lib/node/dlob/types.js +2 -0
- package/lib/node/driftClient.d.ts +820 -0
- package/lib/node/driftClient.js +4487 -0
- package/lib/node/driftClientConfig.d.ts +49 -0
- package/lib/node/driftClientConfig.js +2 -0
- package/lib/node/events/eventList.d.ts +22 -0
- package/lib/node/events/eventList.js +80 -0
- package/lib/node/events/eventSubscriber.d.ts +46 -0
- package/lib/node/events/eventSubscriber.js +223 -0
- package/lib/node/events/eventsServerLogProvider.d.ts +21 -0
- package/lib/node/events/eventsServerLogProvider.js +121 -0
- package/lib/node/events/fetchLogs.d.ts +25 -0
- package/lib/node/events/fetchLogs.js +99 -0
- package/lib/node/events/parse.d.ts +6 -0
- package/lib/node/events/parse.js +106 -0
- package/lib/node/events/pollingLogProvider.d.ts +17 -0
- package/lib/node/events/pollingLogProvider.js +58 -0
- package/lib/node/events/sort.d.ts +2 -0
- package/lib/node/events/sort.js +24 -0
- package/lib/node/events/txEventCache.d.ts +24 -0
- package/lib/node/events/txEventCache.js +71 -0
- package/lib/node/events/types.d.ts +77 -0
- package/lib/node/events/types.js +30 -0
- package/lib/node/events/webSocketLogProvider.d.ts +24 -0
- package/lib/node/events/webSocketLogProvider.js +96 -0
- package/lib/node/factory/bigNum.d.ts +122 -0
- package/lib/node/factory/bigNum.js +457 -0
- package/lib/node/factory/oracleClient.d.ts +5 -0
- package/lib/node/factory/oracleClient.js +52 -0
- package/lib/node/idl/drift.json +13651 -0
- package/lib/node/idl/openbook.json +3854 -0
- package/lib/node/idl/pyth_solana_receiver.json +628 -0
- package/lib/node/idl/switchboard.json +8354 -0
- package/lib/node/idl/switchboard_on_demand_30.json +4541 -0
- package/lib/node/idl/token_faucet.json +142 -0
- package/lib/node/index.d.ts +112 -0
- package/lib/node/index.js +134 -0
- package/lib/node/isomorphic/grpc.browser.d.ts +1 -0
- package/lib/node/isomorphic/grpc.d.ts +1 -0
- package/lib/node/isomorphic/grpc.js +17 -0
- package/lib/node/isomorphic/grpc.node.d.ts +5 -0
- package/lib/node/isomorphic/grpc.node.js +17 -0
- package/lib/node/jupiter/jupiterClient.d.ts +296 -0
- package/lib/node/jupiter/jupiterClient.js +178 -0
- package/lib/node/keypair.d.ts +2 -0
- package/lib/node/keypair.js +28 -0
- package/lib/node/marinade/index.d.ts +12 -0
- package/lib/node/marinade/index.js +36 -0
- package/lib/node/marinade/types.d.ts +1963 -0
- package/lib/node/marinade/types.js +1965 -0
- package/lib/node/math/amm.d.ts +98 -0
- package/lib/node/math/amm.js +626 -0
- package/lib/node/math/auction.d.ts +23 -0
- package/lib/node/math/auction.js +127 -0
- package/lib/node/math/bankruptcy.d.ts +2 -0
- package/lib/node/math/bankruptcy.js +31 -0
- package/lib/node/math/conversion.d.ts +2 -0
- package/lib/node/math/conversion.js +11 -0
- package/lib/node/math/exchangeStatus.d.ts +6 -0
- package/lib/node/math/exchangeStatus.js +77 -0
- package/lib/node/math/fuel.d.ts +6 -0
- package/lib/node/math/fuel.js +55 -0
- package/lib/node/math/funding.d.ts +34 -0
- package/lib/node/math/funding.js +209 -0
- package/lib/node/math/insurance.d.ts +7 -0
- package/lib/node/math/insurance.js +73 -0
- package/lib/node/math/margin.d.ts +39 -0
- package/lib/node/math/margin.js +184 -0
- package/lib/node/math/market.d.ts +39 -0
- package/lib/node/math/market.js +163 -0
- package/lib/node/math/oracles.d.ts +14 -0
- package/lib/node/math/oracles.js +134 -0
- package/lib/node/math/orders.d.ts +23 -0
- package/lib/node/math/orders.js +216 -0
- package/lib/node/math/position.d.ts +54 -0
- package/lib/node/math/position.js +198 -0
- package/lib/node/math/repeg.d.ts +22 -0
- package/lib/node/math/repeg.js +164 -0
- package/lib/node/math/spotBalance.d.ts +83 -0
- package/lib/node/math/spotBalance.js +373 -0
- package/lib/node/math/spotMarket.d.ts +11 -0
- package/lib/node/math/spotMarket.js +49 -0
- package/lib/node/math/spotPosition.d.ts +19 -0
- package/lib/node/math/spotPosition.js +78 -0
- package/lib/node/math/state.d.ts +5 -0
- package/lib/node/math/state.js +30 -0
- package/lib/node/math/superStake.d.ts +167 -0
- package/lib/node/math/superStake.js +306 -0
- package/lib/node/math/tiers.d.ts +4 -0
- package/lib/node/math/tiers.js +52 -0
- package/lib/node/math/trade.d.ts +117 -0
- package/lib/node/math/trade.js +637 -0
- package/lib/node/math/utils.d.ts +23 -0
- package/lib/node/math/utils.js +112 -0
- package/lib/node/memcmp.d.ts +7 -0
- package/lib/node/memcmp.js +63 -0
- package/lib/node/openbook/openbookV2FulfillmentConfigMap.d.ts +10 -0
- package/lib/node/openbook/openbookV2FulfillmentConfigMap.js +17 -0
- package/lib/node/openbook/openbookV2Subscriber.d.ts +36 -0
- package/lib/node/openbook/openbookV2Subscriber.js +104 -0
- package/lib/node/oracles/oracleClientCache.d.ts +9 -0
- package/lib/node/oracles/oracleClientCache.js +19 -0
- package/lib/node/oracles/prelaunchOracleClient.d.ts +12 -0
- package/lib/node/oracles/prelaunchOracleClient.js +24 -0
- package/lib/node/oracles/pythClient.d.ts +15 -0
- package/lib/node/oracles/pythClient.js +52 -0
- package/lib/node/oracles/pythPullClient.d.ts +19 -0
- package/lib/node/oracles/pythPullClient.js +60 -0
- package/lib/node/oracles/quoteAssetOracleClient.d.ts +10 -0
- package/lib/node/oracles/quoteAssetOracleClient.js +21 -0
- package/lib/node/oracles/strictOraclePrice.d.ts +9 -0
- package/lib/node/oracles/strictOraclePrice.js +17 -0
- package/lib/node/oracles/switchboardClient.d.ts +12 -0
- package/lib/node/oracles/switchboardClient.js +40 -0
- package/lib/node/oracles/switchboardOnDemandClient.d.ts +12 -0
- package/lib/node/oracles/switchboardOnDemandClient.js +32 -0
- package/lib/node/oracles/types.d.ts +23 -0
- package/lib/node/oracles/types.js +2 -0
- package/lib/node/orderParams.d.ts +29 -0
- package/lib/node/orderParams.js +44 -0
- package/lib/node/orderSubscriber/OrderSubscriber.d.ts +42 -0
- package/lib/node/orderSubscriber/OrderSubscriber.js +179 -0
- package/lib/node/orderSubscriber/PollingSubscription.d.ts +12 -0
- package/lib/node/orderSubscriber/PollingSubscription.js +23 -0
- package/lib/node/orderSubscriber/WebsocketSubscription.d.ts +23 -0
- package/lib/node/orderSubscriber/WebsocketSubscription.js +67 -0
- package/lib/node/orderSubscriber/grpcSubscription.d.ts +22 -0
- package/lib/node/orderSubscriber/grpcSubscription.js +66 -0
- package/lib/node/orderSubscriber/index.d.ts +2 -0
- package/lib/{auctionSubscriber → node/orderSubscriber}/index.js +1 -1
- package/lib/node/orderSubscriber/types.d.ts +34 -0
- package/lib/node/orderSubscriber/types.js +2 -0
- package/lib/node/phoenix/phoenixFulfillmentConfigMap.d.ts +10 -0
- package/lib/node/phoenix/phoenixFulfillmentConfigMap.js +17 -0
- package/lib/node/phoenix/phoenixSubscriber.d.ts +41 -0
- package/lib/node/phoenix/phoenixSubscriber.js +152 -0
- package/lib/node/priorityFee/averageOverSlotsStrategy.d.ts +5 -0
- package/lib/node/priorityFee/averageOverSlotsStrategy.js +16 -0
- package/lib/node/priorityFee/averageStrategy.d.ts +5 -0
- package/lib/node/priorityFee/averageStrategy.js +11 -0
- package/lib/node/priorityFee/driftPriorityFeeMethod.d.ts +13 -0
- package/lib/node/priorityFee/driftPriorityFeeMethod.js +26 -0
- package/lib/node/priorityFee/ewmaStrategy.d.ts +11 -0
- package/lib/node/priorityFee/ewmaStrategy.js +33 -0
- package/lib/node/priorityFee/heliusPriorityFeeMethod.d.ts +20 -0
- package/lib/node/priorityFee/heliusPriorityFeeMethod.js +46 -0
- package/lib/node/priorityFee/index.d.ts +11 -0
- package/lib/node/priorityFee/index.js +27 -0
- package/lib/node/priorityFee/maxOverSlotsStrategy.d.ts +5 -0
- package/lib/node/priorityFee/maxOverSlotsStrategy.js +17 -0
- package/lib/node/priorityFee/maxStrategy.d.ts +7 -0
- package/lib/node/priorityFee/maxStrategy.js +9 -0
- package/lib/node/priorityFee/priorityFeeSubscriber.d.ts +46 -0
- package/lib/node/priorityFee/priorityFeeSubscriber.js +188 -0
- package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts +48 -0
- package/lib/node/priorityFee/priorityFeeSubscriberMap.js +88 -0
- package/lib/node/priorityFee/solanaPriorityFeeMethod.d.ts +6 -0
- package/lib/node/priorityFee/solanaPriorityFeeMethod.js +21 -0
- package/lib/node/priorityFee/types.d.ts +31 -0
- package/lib/node/priorityFee/types.js +10 -0
- package/lib/node/serum/serumFulfillmentConfigMap.d.ts +10 -0
- package/lib/node/serum/serumFulfillmentConfigMap.js +17 -0
- package/lib/node/serum/serumSubscriber.d.ts +32 -0
- package/lib/node/serum/serumSubscriber.js +107 -0
- package/lib/node/serum/types.d.ts +13 -0
- package/lib/node/serum/types.js +2 -0
- package/lib/node/slot/SlotSubscriber.d.ts +27 -0
- package/lib/node/slot/SlotSubscriber.js +71 -0
- package/lib/node/testClient.d.ts +8 -0
- package/lib/node/testClient.js +23 -0
- package/lib/node/token/index.d.ts +5 -0
- package/lib/node/token/index.js +15 -0
- package/lib/node/tokenFaucet.d.ts +41 -0
- package/lib/node/tokenFaucet.js +188 -0
- package/lib/node/tx/baseTxSender.d.ts +55 -0
- package/lib/node/tx/baseTxSender.js +288 -0
- package/lib/node/tx/blockhashFetcher/baseBlockhashFetcher.d.ts +8 -0
- package/lib/node/tx/blockhashFetcher/baseBlockhashFetcher.js +13 -0
- package/lib/node/tx/blockhashFetcher/cachedBlockhashFetcher.d.ts +28 -0
- package/lib/node/tx/blockhashFetcher/cachedBlockhashFetcher.js +73 -0
- package/lib/node/tx/blockhashFetcher/types.d.ts +4 -0
- package/lib/node/tx/blockhashFetcher/types.js +2 -0
- package/lib/node/tx/fastSingleTxSender.d.ts +40 -0
- package/lib/node/tx/fastSingleTxSender.js +85 -0
- package/lib/node/tx/forwardOnlyTxSender.d.ts +36 -0
- package/lib/node/tx/forwardOnlyTxSender.js +91 -0
- package/lib/node/tx/priorityFeeCalculator.d.ts +44 -0
- package/lib/node/tx/priorityFeeCalculator.js +85 -0
- package/lib/node/tx/reportTransactionError.d.ts +20 -0
- package/lib/node/tx/reportTransactionError.js +103 -0
- package/lib/node/tx/retryTxSender.d.ts +36 -0
- package/lib/node/tx/retryTxSender.js +85 -0
- package/lib/node/tx/txHandler.d.ts +154 -0
- package/lib/node/tx/txHandler.js +453 -0
- package/lib/node/tx/txParamProcessor.d.ts +25 -0
- package/lib/node/tx/txParamProcessor.js +88 -0
- package/lib/node/tx/types.d.ts +29 -0
- package/lib/node/tx/types.js +20 -0
- package/lib/node/tx/utils.d.ts +2 -0
- package/lib/node/tx/utils.js +10 -0
- package/lib/node/tx/whileValidTxSender.d.ts +43 -0
- package/lib/node/tx/whileValidTxSender.js +165 -0
- package/lib/node/types.d.ts +1351 -0
- package/lib/node/types.js +347 -0
- package/lib/node/user.d.ts +411 -0
- package/lib/node/user.js +2161 -0
- package/lib/node/userConfig.d.ts +26 -0
- package/lib/node/userConfig.js +2 -0
- package/lib/node/userMap/PollingSubscription.d.ts +16 -0
- package/lib/node/userMap/PollingSubscription.js +30 -0
- package/lib/node/userMap/WebsocketSubscription.d.ts +25 -0
- package/lib/node/userMap/WebsocketSubscription.js +41 -0
- package/lib/node/userMap/grpcSubscription.d.ts +24 -0
- package/lib/node/userMap/grpcSubscription.js +40 -0
- package/lib/node/userMap/userMap.d.ts +88 -0
- package/lib/node/userMap/userMap.js +455 -0
- package/lib/node/userMap/userMapConfig.d.ts +37 -0
- package/lib/node/userMap/userMapConfig.js +2 -0
- package/lib/node/userMap/userStatsMap.d.ts +46 -0
- package/lib/node/userMap/userStatsMap.js +165 -0
- package/lib/node/userName.d.ts +5 -0
- package/lib/node/userName.js +21 -0
- package/lib/node/userStats.d.ts +19 -0
- package/lib/node/userStats.js +65 -0
- package/lib/node/userStatsConfig.d.ts +25 -0
- package/lib/node/userStatsConfig.js +2 -0
- package/lib/node/util/TransactionConfirmationManager.d.ts +16 -0
- package/lib/node/util/TransactionConfirmationManager.js +174 -0
- package/lib/node/util/chainClock.d.ts +17 -0
- package/lib/node/util/chainClock.js +29 -0
- package/lib/node/util/computeUnits.d.ts +8 -0
- package/lib/node/util/computeUnits.js +46 -0
- package/lib/node/util/promiseTimeout.d.ts +1 -0
- package/lib/node/util/promiseTimeout.js +14 -0
- package/lib/node/util/pythPullOracleUtils.d.ts +2 -0
- package/lib/node/util/pythPullOracleUtils.js +15 -0
- package/lib/node/util/tps.d.ts +2 -0
- package/lib/node/util/tps.js +16 -0
- package/lib/node/wallet.d.ts +11 -0
- package/lib/node/wallet.js +32 -0
- package/package.json +8 -4
- package/scripts/postbuild.js +61 -0
- package/src/accounts/grpcAccountSubscriber.ts +160 -0
- package/src/accounts/grpcDriftClientAccountSubscriber.ts +197 -0
- package/src/accounts/grpcInsuranceFundStakeAccountSubscriber.ts +56 -0
- package/src/accounts/grpcProgramAccountSubscriber.ts +190 -0
- package/src/accounts/grpcUserAccountSubscriber.ts +48 -0
- package/src/accounts/grpcUserStatsAccountSubscriber.ts +50 -0
- package/src/accounts/types.ts +8 -0
- package/src/accounts/webSocketAccountSubscriber.ts +1 -1
- package/src/accounts/webSocketDriftClientAccountSubscriber.ts +3 -3
- package/src/accounts/webSocketProgramAccountSubscriber.ts +1 -1
- package/src/addresses/pda.ts +13 -0
- package/src/auctionSubscriber/auctionSubscriberGrpc.ts +70 -0
- package/src/auctionSubscriber/index.ts +1 -0
- package/src/auctionSubscriber/types.ts +2 -0
- package/src/driftClient.ts +175 -24
- package/src/driftClientConfig.ts +7 -1
- package/src/idl/drift.json +256 -0
- package/src/isomorphic/README.md +19 -0
- package/src/isomorphic/grpc.browser.ts +4 -0
- package/src/isomorphic/grpc.node.ts +23 -0
- package/src/isomorphic/grpc.ts +1 -0
- package/src/orderSubscriber/OrderSubscriber.ts +14 -1
- package/src/orderSubscriber/grpcSubscription.ts +121 -0
- package/src/orderSubscriber/types.ts +10 -0
- package/src/types.ts +23 -0
- package/src/user.ts +11 -0
- package/src/userConfig.ts +7 -1
- package/src/userMap/grpcSubscription.ts +78 -0
- package/src/userMap/userMap.ts +21 -2
- package/src/userMap/userMapConfig.ts +7 -0
- package/src/userStats.ts +11 -0
- package/src/userStatsConfig.ts +7 -0
- package/tsconfig.browser.json +13 -0
- package/tsconfig.json +1 -1
- /package/lib/{accounts → browser/accounts}/basicUserAccountSubscriber.d.ts +0 -0
- /package/lib/{accounts → browser/accounts}/basicUserAccountSubscriber.js +0 -0
- /package/lib/{accounts → browser/accounts}/bulkAccountLoader.js +0 -0
- /package/lib/{accounts → browser/accounts}/bulkUserStatsSubscription.d.ts +0 -0
- /package/lib/{accounts → browser/accounts}/bulkUserStatsSubscription.js +0 -0
- /package/lib/{accounts → browser/accounts}/bulkUserSubscription.d.ts +0 -0
- /package/lib/{accounts → browser/accounts}/bulkUserSubscription.js +0 -0
- /package/lib/{accounts → browser/accounts}/fetch.d.ts +0 -0
- /package/lib/{accounts → browser/accounts}/fetch.js +0 -0
- /package/lib/{accounts → browser/accounts}/oneShotUserAccountSubscriber.d.ts +0 -0
- /package/lib/{accounts → browser/accounts}/oneShotUserAccountSubscriber.js +0 -0
- /package/lib/{accounts → browser/accounts}/pollingDriftClientAccountSubscriber.d.ts +0 -0
- /package/lib/{accounts → browser/accounts}/pollingDriftClientAccountSubscriber.js +0 -0
- /package/lib/{accounts → browser/accounts}/pollingInsuranceFundStakeAccountSubscriber.d.ts +0 -0
- /package/lib/{accounts → browser/accounts}/pollingInsuranceFundStakeAccountSubscriber.js +0 -0
- /package/lib/{accounts → browser/accounts}/pollingOracleAccountSubscriber.d.ts +0 -0
- /package/lib/{accounts → browser/accounts}/pollingOracleAccountSubscriber.js +0 -0
- /package/lib/{accounts → browser/accounts}/pollingTokenAccountSubscriber.d.ts +0 -0
- /package/lib/{accounts → browser/accounts}/pollingTokenAccountSubscriber.js +0 -0
- /package/lib/{accounts → browser/accounts}/pollingUserAccountSubscriber.d.ts +0 -0
- /package/lib/{accounts → browser/accounts}/pollingUserAccountSubscriber.js +0 -0
- /package/lib/{accounts → browser/accounts}/pollingUserStatsAccountSubscriber.d.ts +0 -0
- /package/lib/{accounts → browser/accounts}/pollingUserStatsAccountSubscriber.js +0 -0
- /package/lib/{accounts → browser/accounts}/testBulkAccountLoader.d.ts +0 -0
- /package/lib/{accounts → browser/accounts}/testBulkAccountLoader.js +0 -0
- /package/lib/{accounts → browser/accounts}/types.js +0 -0
- /package/lib/{accounts → browser/accounts}/utils.d.ts +0 -0
- /package/lib/{accounts → browser/accounts}/utils.js +0 -0
- /package/lib/{accounts → browser/accounts}/webSocketAccountSubscriber.js +0 -0
- /package/lib/{accounts → browser/accounts}/webSocketDriftClientAccountSubscriber.js +0 -0
- /package/lib/{accounts → browser/accounts}/webSocketInsuranceFundStakeAccountSubscriber.d.ts +0 -0
- /package/lib/{accounts → browser/accounts}/webSocketInsuranceFundStakeAccountSubscriber.js +0 -0
- /package/lib/{accounts → browser/accounts}/webSocketProgramAccountSubscriber.js +0 -0
- /package/lib/{accounts → browser/accounts}/webSocketUserAccountSubscriber.d.ts +0 -0
- /package/lib/{accounts → browser/accounts}/webSocketUserAccountSubscriber.js +0 -0
- /package/lib/{accounts → browser/accounts}/webSocketUserStatsAccountSubsriber.d.ts +0 -0
- /package/lib/{accounts → browser/accounts}/webSocketUserStatsAccountSubsriber.js +0 -0
- /package/lib/{addresses → browser/addresses}/marketAddresses.d.ts +0 -0
- /package/lib/{addresses → browser/addresses}/marketAddresses.js +0 -0
- /package/lib/{adminClient.d.ts → browser/adminClient.d.ts} +0 -0
- /package/lib/{adminClient.js → browser/adminClient.js} +0 -0
- /package/lib/{assert → browser/assert}/assert.d.ts +0 -0
- /package/lib/{assert → browser/assert}/assert.js +0 -0
- /package/lib/{auctionSubscriber → browser/auctionSubscriber}/auctionSubscriber.d.ts +0 -0
- /package/lib/{auctionSubscriber → browser/auctionSubscriber}/auctionSubscriber.js +0 -0
- /package/lib/{auctionSubscriber → browser/auctionSubscriber}/types.js +0 -0
- /package/lib/{bankrun → browser/bankrun}/bankrunConnection.js +0 -0
- /package/lib/{blockhashSubscriber → browser/blockhashSubscriber}/BlockhashSubscriber.d.ts +0 -0
- /package/lib/{blockhashSubscriber → browser/blockhashSubscriber}/BlockhashSubscriber.js +0 -0
- /package/lib/{blockhashSubscriber → browser/blockhashSubscriber}/index.d.ts +0 -0
- /package/lib/{blockhashSubscriber → browser/blockhashSubscriber}/index.js +0 -0
- /package/lib/{blockhashSubscriber → browser/blockhashSubscriber}/types.d.ts +0 -0
- /package/lib/{blockhashSubscriber → browser/blockhashSubscriber}/types.js +0 -0
- /package/lib/{clock → browser/clock}/clockSubscriber.d.ts +0 -0
- /package/lib/{clock → browser/clock}/clockSubscriber.js +0 -0
- /package/lib/{config.d.ts → browser/config.d.ts} +0 -0
- /package/lib/{config.js → browser/config.js} +0 -0
- /package/lib/{constants → browser/constants}/numericConstants.d.ts +0 -0
- /package/lib/{constants → browser/constants}/numericConstants.js +0 -0
- /package/lib/{constants → browser/constants}/perpMarkets.d.ts +0 -0
- /package/lib/{constants → browser/constants}/perpMarkets.js +0 -0
- /package/lib/{constants → browser/constants}/spotMarkets.d.ts +0 -0
- /package/lib/{constants → browser/constants}/spotMarkets.js +0 -0
- /package/lib/{constants → browser/constants}/txConstants.d.ts +0 -0
- /package/lib/{constants → browser/constants}/txConstants.js +0 -0
- /package/lib/{decode → browser/decode}/phoenix.js +0 -0
- /package/lib/{decode → browser/decode}/user.js +0 -0
- /package/lib/{dlob → browser/dlob}/DLOB.d.ts +0 -0
- /package/lib/{dlob → browser/dlob}/DLOB.js +0 -0
- /package/lib/{dlob → browser/dlob}/DLOBApiClient.d.ts +0 -0
- /package/lib/{dlob → browser/dlob}/DLOBApiClient.js +0 -0
- /package/lib/{dlob → browser/dlob}/DLOBNode.d.ts +0 -0
- /package/lib/{dlob → browser/dlob}/DLOBNode.js +0 -0
- /package/lib/{dlob → browser/dlob}/DLOBOrders.js +0 -0
- /package/lib/{dlob → browser/dlob}/DLOBSubscriber.d.ts +0 -0
- /package/lib/{dlob → browser/dlob}/DLOBSubscriber.js +0 -0
- /package/lib/{dlob → browser/dlob}/NodeList.d.ts +0 -0
- /package/lib/{dlob → browser/dlob}/NodeList.js +0 -0
- /package/lib/{dlob → browser/dlob}/dlobIdl.json +0 -0
- /package/lib/{dlob → browser/dlob}/orderBookLevels.d.ts +0 -0
- /package/lib/{dlob → browser/dlob}/orderBookLevels.js +0 -0
- /package/lib/{dlob → browser/dlob}/types.d.ts +0 -0
- /package/lib/{dlob → browser/dlob}/types.js +0 -0
- /package/lib/{driftClientConfig.js → browser/driftClientConfig.js} +0 -0
- /package/lib/{events → browser/events}/eventList.d.ts +0 -0
- /package/lib/{events → browser/events}/eventList.js +0 -0
- /package/lib/{events → browser/events}/eventSubscriber.d.ts +0 -0
- /package/lib/{events → browser/events}/eventSubscriber.js +0 -0
- /package/lib/{events → browser/events}/eventsServerLogProvider.d.ts +0 -0
- /package/lib/{events → browser/events}/eventsServerLogProvider.js +0 -0
- /package/lib/{events → browser/events}/fetchLogs.d.ts +0 -0
- /package/lib/{events → browser/events}/fetchLogs.js +0 -0
- /package/lib/{events → browser/events}/parse.d.ts +0 -0
- /package/lib/{events → browser/events}/parse.js +0 -0
- /package/lib/{events → browser/events}/pollingLogProvider.d.ts +0 -0
- /package/lib/{events → browser/events}/pollingLogProvider.js +0 -0
- /package/lib/{events → browser/events}/sort.d.ts +0 -0
- /package/lib/{events → browser/events}/sort.js +0 -0
- /package/lib/{events → browser/events}/txEventCache.d.ts +0 -0
- /package/lib/{events → browser/events}/txEventCache.js +0 -0
- /package/lib/{events → browser/events}/types.d.ts +0 -0
- /package/lib/{events → browser/events}/types.js +0 -0
- /package/lib/{events → browser/events}/webSocketLogProvider.d.ts +0 -0
- /package/lib/{events → browser/events}/webSocketLogProvider.js +0 -0
- /package/lib/{factory → browser/factory}/bigNum.d.ts +0 -0
- /package/lib/{factory → browser/factory}/bigNum.js +0 -0
- /package/lib/{factory → browser/factory}/oracleClient.d.ts +0 -0
- /package/lib/{factory → browser/factory}/oracleClient.js +0 -0
- /package/lib/{idl → browser/idl}/openbook.json +0 -0
- /package/lib/{idl → browser/idl}/pyth_solana_receiver.json +0 -0
- /package/lib/{idl → browser/idl}/switchboard.json +0 -0
- /package/lib/{idl → browser/idl}/switchboard_on_demand_30.json +0 -0
- /package/lib/{idl → browser/idl}/token_faucet.json +0 -0
- /package/lib/{index.d.ts → browser/index.d.ts} +0 -0
- /package/lib/{index.js → browser/index.js} +0 -0
- /package/lib/{jupiter → browser/jupiter}/jupiterClient.d.ts +0 -0
- /package/lib/{jupiter → browser/jupiter}/jupiterClient.js +0 -0
- /package/lib/{keypair.d.ts → browser/keypair.d.ts} +0 -0
- /package/lib/{keypair.js → browser/keypair.js} +0 -0
- /package/lib/{marinade → browser/marinade}/index.d.ts +0 -0
- /package/lib/{marinade → browser/marinade}/index.js +0 -0
- /package/lib/{marinade → browser/marinade}/types.d.ts +0 -0
- /package/lib/{marinade → browser/marinade}/types.js +0 -0
- /package/lib/{math → browser/math}/amm.d.ts +0 -0
- /package/lib/{math → browser/math}/amm.js +0 -0
- /package/lib/{math → browser/math}/auction.d.ts +0 -0
- /package/lib/{math → browser/math}/auction.js +0 -0
- /package/lib/{math → browser/math}/bankruptcy.d.ts +0 -0
- /package/lib/{math → browser/math}/bankruptcy.js +0 -0
- /package/lib/{math → browser/math}/conversion.d.ts +0 -0
- /package/lib/{math → browser/math}/conversion.js +0 -0
- /package/lib/{math → browser/math}/exchangeStatus.d.ts +0 -0
- /package/lib/{math → browser/math}/exchangeStatus.js +0 -0
- /package/lib/{math → browser/math}/fuel.d.ts +0 -0
- /package/lib/{math → browser/math}/fuel.js +0 -0
- /package/lib/{math → browser/math}/funding.d.ts +0 -0
- /package/lib/{math → browser/math}/funding.js +0 -0
- /package/lib/{math → browser/math}/insurance.d.ts +0 -0
- /package/lib/{math → browser/math}/insurance.js +0 -0
- /package/lib/{math → browser/math}/margin.d.ts +0 -0
- /package/lib/{math → browser/math}/margin.js +0 -0
- /package/lib/{math → browser/math}/market.d.ts +0 -0
- /package/lib/{math → browser/math}/market.js +0 -0
- /package/lib/{math → browser/math}/oracles.js +0 -0
- /package/lib/{math → browser/math}/orders.d.ts +0 -0
- /package/lib/{math → browser/math}/orders.js +0 -0
- /package/lib/{math → browser/math}/position.d.ts +0 -0
- /package/lib/{math → browser/math}/position.js +0 -0
- /package/lib/{math → browser/math}/repeg.d.ts +0 -0
- /package/lib/{math → browser/math}/repeg.js +0 -0
- /package/lib/{math → browser/math}/spotBalance.d.ts +0 -0
- /package/lib/{math → browser/math}/spotBalance.js +0 -0
- /package/lib/{math → browser/math}/spotMarket.d.ts +0 -0
- /package/lib/{math → browser/math}/spotMarket.js +0 -0
- /package/lib/{math → browser/math}/spotPosition.d.ts +0 -0
- /package/lib/{math → browser/math}/spotPosition.js +0 -0
- /package/lib/{math → browser/math}/state.d.ts +0 -0
- /package/lib/{math → browser/math}/state.js +0 -0
- /package/lib/{math → browser/math}/superStake.d.ts +0 -0
- /package/lib/{math → browser/math}/superStake.js +0 -0
- /package/lib/{math → browser/math}/tiers.d.ts +0 -0
- /package/lib/{math → browser/math}/tiers.js +0 -0
- /package/lib/{math → browser/math}/trade.d.ts +0 -0
- /package/lib/{math → browser/math}/trade.js +0 -0
- /package/lib/{math → browser/math}/utils.d.ts +0 -0
- /package/lib/{math → browser/math}/utils.js +0 -0
- /package/lib/{memcmp.d.ts → browser/memcmp.d.ts} +0 -0
- /package/lib/{memcmp.js → browser/memcmp.js} +0 -0
- /package/lib/{openbook → browser/openbook}/openbookV2FulfillmentConfigMap.d.ts +0 -0
- /package/lib/{openbook → browser/openbook}/openbookV2FulfillmentConfigMap.js +0 -0
- /package/lib/{openbook → browser/openbook}/openbookV2Subscriber.d.ts +0 -0
- /package/lib/{openbook → browser/openbook}/openbookV2Subscriber.js +0 -0
- /package/lib/{oracles → browser/oracles}/oracleClientCache.d.ts +0 -0
- /package/lib/{oracles → browser/oracles}/oracleClientCache.js +0 -0
- /package/lib/{oracles → browser/oracles}/prelaunchOracleClient.js +0 -0
- /package/lib/{oracles → browser/oracles}/pythClient.js +0 -0
- /package/lib/{oracles → browser/oracles}/pythPullClient.js +0 -0
- /package/lib/{oracles → browser/oracles}/quoteAssetOracleClient.js +0 -0
- /package/lib/{oracles → browser/oracles}/strictOraclePrice.d.ts +0 -0
- /package/lib/{oracles → browser/oracles}/strictOraclePrice.js +0 -0
- /package/lib/{oracles → browser/oracles}/switchboardClient.js +0 -0
- /package/lib/{oracles → browser/oracles}/switchboardOnDemandClient.js +0 -0
- /package/lib/{oracles → browser/oracles}/types.js +0 -0
- /package/lib/{orderParams.d.ts → browser/orderParams.d.ts} +0 -0
- /package/lib/{orderParams.js → browser/orderParams.js} +0 -0
- /package/lib/{orderSubscriber → browser/orderSubscriber}/PollingSubscription.d.ts +0 -0
- /package/lib/{orderSubscriber → browser/orderSubscriber}/PollingSubscription.js +0 -0
- /package/lib/{orderSubscriber → browser/orderSubscriber}/WebsocketSubscription.d.ts +0 -0
- /package/lib/{orderSubscriber → browser/orderSubscriber}/WebsocketSubscription.js +0 -0
- /package/lib/{orderSubscriber → browser/orderSubscriber}/index.d.ts +0 -0
- /package/lib/{orderSubscriber → browser/orderSubscriber}/index.js +0 -0
- /package/lib/{orderSubscriber → browser/orderSubscriber}/types.js +0 -0
- /package/lib/{phoenix → browser/phoenix}/phoenixFulfillmentConfigMap.d.ts +0 -0
- /package/lib/{phoenix → browser/phoenix}/phoenixFulfillmentConfigMap.js +0 -0
- /package/lib/{phoenix → browser/phoenix}/phoenixSubscriber.d.ts +0 -0
- /package/lib/{phoenix → browser/phoenix}/phoenixSubscriber.js +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/averageOverSlotsStrategy.d.ts +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/averageOverSlotsStrategy.js +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/averageStrategy.d.ts +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/averageStrategy.js +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/driftPriorityFeeMethod.d.ts +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/driftPriorityFeeMethod.js +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/ewmaStrategy.d.ts +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/ewmaStrategy.js +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/heliusPriorityFeeMethod.d.ts +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/heliusPriorityFeeMethod.js +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/index.d.ts +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/index.js +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/maxOverSlotsStrategy.d.ts +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/maxOverSlotsStrategy.js +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/maxStrategy.d.ts +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/maxStrategy.js +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/priorityFeeSubscriber.d.ts +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/priorityFeeSubscriber.js +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/priorityFeeSubscriberMap.d.ts +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/priorityFeeSubscriberMap.js +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/solanaPriorityFeeMethod.d.ts +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/solanaPriorityFeeMethod.js +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/types.d.ts +0 -0
- /package/lib/{priorityFee → browser/priorityFee}/types.js +0 -0
- /package/lib/{serum → browser/serum}/serumFulfillmentConfigMap.d.ts +0 -0
- /package/lib/{serum → browser/serum}/serumFulfillmentConfigMap.js +0 -0
- /package/lib/{serum → browser/serum}/serumSubscriber.d.ts +0 -0
- /package/lib/{serum → browser/serum}/serumSubscriber.js +0 -0
- /package/lib/{serum → browser/serum}/types.d.ts +0 -0
- /package/lib/{serum → browser/serum}/types.js +0 -0
- /package/lib/{slot → browser/slot}/SlotSubscriber.d.ts +0 -0
- /package/lib/{slot → browser/slot}/SlotSubscriber.js +0 -0
- /package/lib/{testClient.d.ts → browser/testClient.d.ts} +0 -0
- /package/lib/{testClient.js → browser/testClient.js} +0 -0
- /package/lib/{token → browser/token}/index.js +0 -0
- /package/lib/{tokenFaucet.d.ts → browser/tokenFaucet.d.ts} +0 -0
- /package/lib/{tokenFaucet.js → browser/tokenFaucet.js} +0 -0
- /package/lib/{tx → browser/tx}/baseTxSender.js +0 -0
- /package/lib/{tx → browser/tx}/blockhashFetcher/baseBlockhashFetcher.d.ts +0 -0
- /package/lib/{tx → browser/tx}/blockhashFetcher/baseBlockhashFetcher.js +0 -0
- /package/lib/{tx → browser/tx}/blockhashFetcher/cachedBlockhashFetcher.d.ts +0 -0
- /package/lib/{tx → browser/tx}/blockhashFetcher/cachedBlockhashFetcher.js +0 -0
- /package/lib/{tx → browser/tx}/blockhashFetcher/types.d.ts +0 -0
- /package/lib/{tx → browser/tx}/blockhashFetcher/types.js +0 -0
- /package/lib/{tx → browser/tx}/fastSingleTxSender.js +0 -0
- /package/lib/{tx → browser/tx}/forwardOnlyTxSender.js +0 -0
- /package/lib/{tx → browser/tx}/priorityFeeCalculator.d.ts +0 -0
- /package/lib/{tx → browser/tx}/priorityFeeCalculator.js +0 -0
- /package/lib/{tx → browser/tx}/reportTransactionError.d.ts +0 -0
- /package/lib/{tx → browser/tx}/reportTransactionError.js +0 -0
- /package/lib/{tx → browser/tx}/retryTxSender.js +0 -0
- /package/lib/{tx → browser/tx}/txHandler.d.ts +0 -0
- /package/lib/{tx → browser/tx}/txHandler.js +0 -0
- /package/lib/{tx → browser/tx}/txParamProcessor.d.ts +0 -0
- /package/lib/{tx → browser/tx}/txParamProcessor.js +0 -0
- /package/lib/{tx → browser/tx}/types.js +0 -0
- /package/lib/{tx → browser/tx}/utils.d.ts +0 -0
- /package/lib/{tx → browser/tx}/utils.js +0 -0
- /package/lib/{tx → browser/tx}/whileValidTxSender.js +0 -0
- /package/lib/{types.js → browser/types.js} +0 -0
- /package/lib/{user.d.ts → browser/user.d.ts} +0 -0
- /package/lib/{userConfig.js → browser/userConfig.js} +0 -0
- /package/lib/{userMap → browser/userMap}/PollingSubscription.d.ts +0 -0
- /package/lib/{userMap → browser/userMap}/PollingSubscription.js +0 -0
- /package/lib/{userMap → browser/userMap}/WebsocketSubscription.js +0 -0
- /package/lib/{userMap → browser/userMap}/userMap.d.ts +0 -0
- /package/lib/{userMap → browser/userMap}/userMapConfig.js +0 -0
- /package/lib/{userMap → browser/userMap}/userStatsMap.d.ts +0 -0
- /package/lib/{userMap → browser/userMap}/userStatsMap.js +0 -0
- /package/lib/{userName.d.ts → browser/userName.d.ts} +0 -0
- /package/lib/{userName.js → browser/userName.js} +0 -0
- /package/lib/{userStats.d.ts → browser/userStats.d.ts} +0 -0
- /package/lib/{userStatsConfig.js → browser/userStatsConfig.js} +0 -0
- /package/lib/{util → browser/util}/TransactionConfirmationManager.d.ts +0 -0
- /package/lib/{util → browser/util}/TransactionConfirmationManager.js +0 -0
- /package/lib/{util → browser/util}/chainClock.d.ts +0 -0
- /package/lib/{util → browser/util}/chainClock.js +0 -0
- /package/lib/{util → browser/util}/computeUnits.d.ts +0 -0
- /package/lib/{util → browser/util}/computeUnits.js +0 -0
- /package/lib/{util → browser/util}/promiseTimeout.d.ts +0 -0
- /package/lib/{util → browser/util}/promiseTimeout.js +0 -0
- /package/lib/{util → browser/util}/pythPullOracleUtils.d.ts +0 -0
- /package/lib/{util → browser/util}/pythPullOracleUtils.js +0 -0
- /package/lib/{util → browser/util}/tps.d.ts +0 -0
- /package/lib/{util → browser/util}/tps.js +0 -0
- /package/lib/{wallet.d.ts → browser/wallet.d.ts} +0 -0
- /package/lib/{wallet.js → browser/wallet.js} +0 -0
package/src/driftClient.ts
CHANGED
|
@@ -40,6 +40,8 @@ import {
|
|
|
40
40
|
PositionDirection,
|
|
41
41
|
ReferrerInfo,
|
|
42
42
|
ReferrerNameAccount,
|
|
43
|
+
RFQMakerOrderParams,
|
|
44
|
+
RFQMatch,
|
|
43
45
|
SerumV3FulfillmentConfigAccount,
|
|
44
46
|
SettlePnlMode,
|
|
45
47
|
SignedTxData,
|
|
@@ -90,6 +92,7 @@ import {
|
|
|
90
92
|
getPhoenixFulfillmentConfigPublicKey,
|
|
91
93
|
getPythPullOraclePublicKey,
|
|
92
94
|
getReferrerNamePublicKeySync,
|
|
95
|
+
getRFQUserAccountPublicKey,
|
|
93
96
|
getSerumFulfillmentConfigPublicKey,
|
|
94
97
|
getSerumSignerPublicKey,
|
|
95
98
|
getSpotMarketPublicKey,
|
|
@@ -164,7 +167,8 @@ import { getFeedIdUint8Array, trimFeedId } from './util/pythPullOracleUtils';
|
|
|
164
167
|
import { isVersionedTransaction } from './tx/utils';
|
|
165
168
|
import pythSolanaReceiverIdl from './idl/pyth_solana_receiver.json';
|
|
166
169
|
import { asV0Tx, PullFeed } from '@switchboard-xyz/on-demand';
|
|
167
|
-
import
|
|
170
|
+
import { gprcDriftClientAccountSubscriber } from './accounts/grpcDriftClientAccountSubscriber';
|
|
171
|
+
import nacl from 'tweetnacl';
|
|
168
172
|
|
|
169
173
|
type RemainingAccountParams = {
|
|
170
174
|
userAccounts: UserAccount[];
|
|
@@ -309,6 +313,19 @@ export class DriftClient {
|
|
|
309
313
|
type: 'polling',
|
|
310
314
|
accountLoader: config.accountSubscription.accountLoader,
|
|
311
315
|
};
|
|
316
|
+
} else if (config.accountSubscription?.type === 'grpc') {
|
|
317
|
+
this.userAccountSubscriptionConfig = {
|
|
318
|
+
type: 'grpc',
|
|
319
|
+
resubTimeoutMs: config.accountSubscription?.resubTimeoutMs,
|
|
320
|
+
logResubMessages: config.accountSubscription?.logResubMessages,
|
|
321
|
+
grpcConfigs: config.accountSubscription?.grpcConfigs,
|
|
322
|
+
};
|
|
323
|
+
this.userStatsAccountSubscriptionConfig = {
|
|
324
|
+
type: 'grpc',
|
|
325
|
+
grpcConfigs: config.accountSubscription?.grpcConfigs,
|
|
326
|
+
resubTimeoutMs: config.accountSubscription?.resubTimeoutMs,
|
|
327
|
+
logResubMessages: config.accountSubscription?.logResubMessages,
|
|
328
|
+
};
|
|
312
329
|
} else {
|
|
313
330
|
this.userAccountSubscriptionConfig = {
|
|
314
331
|
type: 'websocket',
|
|
@@ -358,6 +375,20 @@ export class DriftClient {
|
|
|
358
375
|
noMarketsAndOraclesSpecified,
|
|
359
376
|
delistedMarketSetting
|
|
360
377
|
);
|
|
378
|
+
} else if (config.accountSubscription?.type === 'grpc') {
|
|
379
|
+
this.accountSubscriber = new gprcDriftClientAccountSubscriber(
|
|
380
|
+
config.accountSubscription.grpcConfigs,
|
|
381
|
+
this.program,
|
|
382
|
+
config.perpMarketIndexes ?? [],
|
|
383
|
+
config.spotMarketIndexes ?? [],
|
|
384
|
+
config.oracleInfos ?? [],
|
|
385
|
+
noMarketsAndOraclesSpecified,
|
|
386
|
+
delistedMarketSetting,
|
|
387
|
+
{
|
|
388
|
+
resubTimeoutMs: config.accountSubscription?.resubTimeoutMs,
|
|
389
|
+
logResubMessages: config.accountSubscription?.logResubMessages,
|
|
390
|
+
}
|
|
391
|
+
);
|
|
361
392
|
} else {
|
|
362
393
|
this.accountSubscriber = new WebSocketDriftClientAccountSubscriber(
|
|
363
394
|
this.program,
|
|
@@ -940,6 +971,56 @@ export class DriftClient {
|
|
|
940
971
|
return [txSig, userAccountPublicKey];
|
|
941
972
|
}
|
|
942
973
|
|
|
974
|
+
async getInitializeUserStatsIx(): Promise<TransactionInstruction> {
|
|
975
|
+
return await this.program.instruction.initializeUserStats({
|
|
976
|
+
accounts: {
|
|
977
|
+
userStats: this.getUserStatsAccountPublicKey(),
|
|
978
|
+
authority: this.wallet.publicKey,
|
|
979
|
+
payer: this.wallet.publicKey,
|
|
980
|
+
rent: anchor.web3.SYSVAR_RENT_PUBKEY,
|
|
981
|
+
systemProgram: anchor.web3.SystemProgram.programId,
|
|
982
|
+
state: await this.getStatePublicKey(),
|
|
983
|
+
},
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
public async initializeRFQUser(
|
|
988
|
+
userAccountPublicKey: PublicKey,
|
|
989
|
+
txParams?: TxParams
|
|
990
|
+
): Promise<[TransactionSignature, PublicKey]> {
|
|
991
|
+
const initializeIxs = [];
|
|
992
|
+
|
|
993
|
+
const [rfqUserAccountPublicKey, initializeUserAccountIx] =
|
|
994
|
+
await this.getInitializeRFQUserInstruction(userAccountPublicKey);
|
|
995
|
+
initializeIxs.push(initializeUserAccountIx);
|
|
996
|
+
const tx = await this.buildTransaction(initializeIxs, txParams);
|
|
997
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
998
|
+
|
|
999
|
+
return [txSig, rfqUserAccountPublicKey];
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
async getInitializeRFQUserInstruction(
|
|
1003
|
+
userAccountPublicKey: PublicKey
|
|
1004
|
+
): Promise<[PublicKey, TransactionInstruction]> {
|
|
1005
|
+
const rfqUserAccountPublicKey = getRFQUserAccountPublicKey(
|
|
1006
|
+
this.program.programId,
|
|
1007
|
+
userAccountPublicKey
|
|
1008
|
+
);
|
|
1009
|
+
const initializeUserAccountIx =
|
|
1010
|
+
await this.program.instruction.initializeRfqUser({
|
|
1011
|
+
accounts: {
|
|
1012
|
+
rfqUser: rfqUserAccountPublicKey,
|
|
1013
|
+
authority: this.wallet.publicKey,
|
|
1014
|
+
user: userAccountPublicKey,
|
|
1015
|
+
payer: this.wallet.publicKey,
|
|
1016
|
+
rent: anchor.web3.SYSVAR_RENT_PUBKEY,
|
|
1017
|
+
systemProgram: anchor.web3.SystemProgram.programId,
|
|
1018
|
+
},
|
|
1019
|
+
});
|
|
1020
|
+
|
|
1021
|
+
return [rfqUserAccountPublicKey, initializeUserAccountIx];
|
|
1022
|
+
}
|
|
1023
|
+
|
|
943
1024
|
async getInitializeUserInstructions(
|
|
944
1025
|
subAccountId = 0,
|
|
945
1026
|
name?: string,
|
|
@@ -1004,19 +1085,6 @@ export class DriftClient {
|
|
|
1004
1085
|
return [userAccountPublicKey, initializeUserAccountIx];
|
|
1005
1086
|
}
|
|
1006
1087
|
|
|
1007
|
-
async getInitializeUserStatsIx(): Promise<TransactionInstruction> {
|
|
1008
|
-
return await this.program.instruction.initializeUserStats({
|
|
1009
|
-
accounts: {
|
|
1010
|
-
userStats: this.getUserStatsAccountPublicKey(),
|
|
1011
|
-
authority: this.wallet.publicKey,
|
|
1012
|
-
payer: this.wallet.publicKey,
|
|
1013
|
-
rent: anchor.web3.SYSVAR_RENT_PUBKEY,
|
|
1014
|
-
systemProgram: anchor.web3.SystemProgram.programId,
|
|
1015
|
-
state: await this.getStatePublicKey(),
|
|
1016
|
-
},
|
|
1017
|
-
});
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
1088
|
async getNextSubAccountId(): Promise<number> {
|
|
1021
1089
|
const userStats = this.getUserStats();
|
|
1022
1090
|
let userStatsAccount: UserStatsAccount;
|
|
@@ -5475,22 +5543,20 @@ export class DriftClient {
|
|
|
5475
5543
|
};
|
|
5476
5544
|
}
|
|
5477
5545
|
|
|
5478
|
-
public
|
|
5479
|
-
message: SwiftServerMessage
|
|
5480
|
-
): Promise<Buffer> {
|
|
5546
|
+
public signSwiftServerMessage(message: SwiftServerMessage): Buffer {
|
|
5481
5547
|
const swiftServerMessage = Uint8Array.from(
|
|
5482
5548
|
this.encodeSwiftServerMessage(message)
|
|
5483
5549
|
);
|
|
5484
|
-
return
|
|
5550
|
+
return this.signMessage(swiftServerMessage);
|
|
5485
5551
|
}
|
|
5486
5552
|
|
|
5487
|
-
public
|
|
5553
|
+
public signSwiftOrderParamsMessage(
|
|
5488
5554
|
orderParamsMessage: SwiftOrderParamsMessage
|
|
5489
|
-
):
|
|
5555
|
+
): Buffer {
|
|
5490
5556
|
const takerOrderParamsMessage = Uint8Array.from(
|
|
5491
5557
|
this.encodeSwiftOrderParamsMessage(orderParamsMessage)
|
|
5492
5558
|
);
|
|
5493
|
-
return
|
|
5559
|
+
return this.signMessage(takerOrderParamsMessage);
|
|
5494
5560
|
}
|
|
5495
5561
|
|
|
5496
5562
|
public encodeSwiftOrderParamsMessage(
|
|
@@ -5511,11 +5577,11 @@ export class DriftClient {
|
|
|
5511
5577
|
);
|
|
5512
5578
|
}
|
|
5513
5579
|
|
|
5514
|
-
public
|
|
5580
|
+
public signMessage(
|
|
5515
5581
|
message: Uint8Array,
|
|
5516
5582
|
keypair: Keypair = this.wallet.payer
|
|
5517
|
-
):
|
|
5518
|
-
return Buffer.from(
|
|
5583
|
+
): Buffer {
|
|
5584
|
+
return Buffer.from(nacl.sign.detached(message, keypair.secretKey));
|
|
5519
5585
|
}
|
|
5520
5586
|
|
|
5521
5587
|
public async placeSwiftTakerOrder(
|
|
@@ -5718,6 +5784,91 @@ export class DriftClient {
|
|
|
5718
5784
|
];
|
|
5719
5785
|
}
|
|
5720
5786
|
|
|
5787
|
+
public encodeRFQMakerOrderParams(message: RFQMakerOrderParams): Buffer {
|
|
5788
|
+
return this.program.coder.types.encode('RFQMakerOrderParams', message);
|
|
5789
|
+
}
|
|
5790
|
+
|
|
5791
|
+
public async placeAndMatchRFQOrders(
|
|
5792
|
+
rfqMatches: RFQMatch[],
|
|
5793
|
+
txParams?: TxParams
|
|
5794
|
+
): Promise<TransactionSignature> {
|
|
5795
|
+
const ixs = await this.getPlaceAndMatchRFQOrdersIxs(rfqMatches);
|
|
5796
|
+
const { txSig } = await this.sendTransaction(
|
|
5797
|
+
await this.buildTransaction(ixs, txParams),
|
|
5798
|
+
[],
|
|
5799
|
+
this.opts
|
|
5800
|
+
);
|
|
5801
|
+
return txSig;
|
|
5802
|
+
}
|
|
5803
|
+
|
|
5804
|
+
public async getPlaceAndMatchRFQOrdersIxs(
|
|
5805
|
+
rfqMatches: RFQMatch[]
|
|
5806
|
+
): Promise<TransactionInstruction[]> {
|
|
5807
|
+
const remainingAccounts = this.getRemainingAccounts({
|
|
5808
|
+
userAccounts: [this.getUserAccount()],
|
|
5809
|
+
useMarketLastSlotCache: true,
|
|
5810
|
+
writablePerpMarketIndexes: [rfqMatches[0].makerOrderParams.marketIndex],
|
|
5811
|
+
});
|
|
5812
|
+
|
|
5813
|
+
const makerAccountMetas = [];
|
|
5814
|
+
const verifyIxs = [];
|
|
5815
|
+
for (const match of rfqMatches) {
|
|
5816
|
+
const verifyIx = Ed25519Program.createInstructionWithPublicKey({
|
|
5817
|
+
publicKey: match.makerOrderParams.authority.toBytes(),
|
|
5818
|
+
signature: match.makerSignature,
|
|
5819
|
+
message: Uint8Array.from(
|
|
5820
|
+
this.encodeRFQMakerOrderParams(match.makerOrderParams)
|
|
5821
|
+
),
|
|
5822
|
+
});
|
|
5823
|
+
verifyIxs.push(verifyIx);
|
|
5824
|
+
|
|
5825
|
+
const userAccountPubkey = await getUserAccountPublicKey(
|
|
5826
|
+
this.program.programId,
|
|
5827
|
+
match.makerOrderParams.authority,
|
|
5828
|
+
match.makerOrderParams.subAccountId
|
|
5829
|
+
);
|
|
5830
|
+
makerAccountMetas.push({
|
|
5831
|
+
pubkey: userAccountPubkey,
|
|
5832
|
+
isWritable: true,
|
|
5833
|
+
isSigner: false,
|
|
5834
|
+
});
|
|
5835
|
+
|
|
5836
|
+
makerAccountMetas.push({
|
|
5837
|
+
pubkey: getUserStatsAccountPublicKey(
|
|
5838
|
+
this.program.programId,
|
|
5839
|
+
match.makerOrderParams.authority
|
|
5840
|
+
),
|
|
5841
|
+
isWritable: true,
|
|
5842
|
+
isSigner: false,
|
|
5843
|
+
});
|
|
5844
|
+
|
|
5845
|
+
makerAccountMetas.push({
|
|
5846
|
+
pubkey: getRFQUserAccountPublicKey(
|
|
5847
|
+
this.program.programId,
|
|
5848
|
+
userAccountPubkey
|
|
5849
|
+
),
|
|
5850
|
+
isWritable: true,
|
|
5851
|
+
isSigner: false,
|
|
5852
|
+
});
|
|
5853
|
+
}
|
|
5854
|
+
remainingAccounts.push(...makerAccountMetas);
|
|
5855
|
+
|
|
5856
|
+
const userStatsPublicKey = this.getUserStatsAccountPublicKey();
|
|
5857
|
+
const user = await this.getUserAccountPublicKey();
|
|
5858
|
+
const placeAndMatchRFQOrdersIx =
|
|
5859
|
+
await this.program.instruction.placeAndMatchRfqOrders(rfqMatches, {
|
|
5860
|
+
accounts: {
|
|
5861
|
+
state: await this.getStatePublicKey(),
|
|
5862
|
+
user,
|
|
5863
|
+
userStats: userStatsPublicKey,
|
|
5864
|
+
authority: this.wallet.publicKey,
|
|
5865
|
+
ixSysvar: SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
5866
|
+
},
|
|
5867
|
+
remainingAccounts,
|
|
5868
|
+
});
|
|
5869
|
+
return [...verifyIxs, placeAndMatchRFQOrdersIx];
|
|
5870
|
+
}
|
|
5871
|
+
|
|
5721
5872
|
public async preparePlaceAndTakeSpotOrder(
|
|
5722
5873
|
orderParams: OptionalOrderParams,
|
|
5723
5874
|
fulfillmentConfig?: SerumV3FulfillmentConfigAccount,
|
package/src/driftClientConfig.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { BulkAccountLoader } from './accounts/bulkAccountLoader';
|
|
|
11
11
|
import { DriftEnv } from './config';
|
|
12
12
|
import { TxSender } from './tx/types';
|
|
13
13
|
import { TxHandler, TxHandlerConfig } from './tx/txHandler';
|
|
14
|
-
import { DelistedMarketSetting } from './accounts/types';
|
|
14
|
+
import { DelistedMarketSetting, GrpcConfigs } from './accounts/types';
|
|
15
15
|
|
|
16
16
|
export type DriftClientConfig = {
|
|
17
17
|
connection: Connection;
|
|
@@ -42,6 +42,12 @@ export type DriftClientConfig = {
|
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
export type DriftClientSubscriptionConfig =
|
|
45
|
+
| {
|
|
46
|
+
type: 'grpc';
|
|
47
|
+
grpcConfigs: GrpcConfigs;
|
|
48
|
+
resubTimeoutMs?: number;
|
|
49
|
+
logResubMessages?: boolean;
|
|
50
|
+
}
|
|
45
51
|
| {
|
|
46
52
|
type: 'websocket';
|
|
47
53
|
resubTimeoutMs?: number;
|
package/src/idl/drift.json
CHANGED
|
@@ -93,6 +93,42 @@
|
|
|
93
93
|
],
|
|
94
94
|
"args": []
|
|
95
95
|
},
|
|
96
|
+
{
|
|
97
|
+
"name": "initializeRfqUser",
|
|
98
|
+
"accounts": [
|
|
99
|
+
{
|
|
100
|
+
"name": "rfqUser",
|
|
101
|
+
"isMut": true,
|
|
102
|
+
"isSigner": false
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"name": "authority",
|
|
106
|
+
"isMut": false,
|
|
107
|
+
"isSigner": true
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"name": "user",
|
|
111
|
+
"isMut": true,
|
|
112
|
+
"isSigner": false
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "payer",
|
|
116
|
+
"isMut": true,
|
|
117
|
+
"isSigner": true
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"name": "rent",
|
|
121
|
+
"isMut": false,
|
|
122
|
+
"isSigner": false
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"name": "systemProgram",
|
|
126
|
+
"isMut": false,
|
|
127
|
+
"isSigner": false
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"args": []
|
|
131
|
+
},
|
|
96
132
|
{
|
|
97
133
|
"name": "initializeReferrerName",
|
|
98
134
|
"accounts": [
|
|
@@ -662,6 +698,51 @@
|
|
|
662
698
|
}
|
|
663
699
|
]
|
|
664
700
|
},
|
|
701
|
+
{
|
|
702
|
+
"name": "placeAndMatchRfqOrders",
|
|
703
|
+
"accounts": [
|
|
704
|
+
{
|
|
705
|
+
"name": "state",
|
|
706
|
+
"isMut": false,
|
|
707
|
+
"isSigner": false
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
"name": "user",
|
|
711
|
+
"isMut": true,
|
|
712
|
+
"isSigner": false
|
|
713
|
+
},
|
|
714
|
+
{
|
|
715
|
+
"name": "userStats",
|
|
716
|
+
"isMut": true,
|
|
717
|
+
"isSigner": false
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
"name": "authority",
|
|
721
|
+
"isMut": false,
|
|
722
|
+
"isSigner": true
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
"name": "ixSysvar",
|
|
726
|
+
"isMut": false,
|
|
727
|
+
"isSigner": false,
|
|
728
|
+
"docs": [
|
|
729
|
+
"the supplied Sysvar could be anything else.",
|
|
730
|
+
"The Instruction Sysvar has not been implemented",
|
|
731
|
+
"in the Anchor framework yet, so this is the safe approach."
|
|
732
|
+
]
|
|
733
|
+
}
|
|
734
|
+
],
|
|
735
|
+
"args": [
|
|
736
|
+
{
|
|
737
|
+
"name": "rfqMatches",
|
|
738
|
+
"type": {
|
|
739
|
+
"vec": {
|
|
740
|
+
"defined": "RFQMatch"
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
]
|
|
745
|
+
},
|
|
665
746
|
{
|
|
666
747
|
"name": "placeSpotOrder",
|
|
667
748
|
"accounts": [
|
|
@@ -6752,6 +6833,29 @@
|
|
|
6752
6833
|
]
|
|
6753
6834
|
}
|
|
6754
6835
|
},
|
|
6836
|
+
{
|
|
6837
|
+
"name": "RFQUser",
|
|
6838
|
+
"type": {
|
|
6839
|
+
"kind": "struct",
|
|
6840
|
+
"fields": [
|
|
6841
|
+
{
|
|
6842
|
+
"name": "userPubkey",
|
|
6843
|
+
"type": "publicKey"
|
|
6844
|
+
},
|
|
6845
|
+
{
|
|
6846
|
+
"name": "rfqOrderData",
|
|
6847
|
+
"type": {
|
|
6848
|
+
"array": [
|
|
6849
|
+
{
|
|
6850
|
+
"defined": "RFQOrderId"
|
|
6851
|
+
},
|
|
6852
|
+
32
|
|
6853
|
+
]
|
|
6854
|
+
}
|
|
6855
|
+
}
|
|
6856
|
+
]
|
|
6857
|
+
}
|
|
6858
|
+
},
|
|
6755
6859
|
{
|
|
6756
6860
|
"name": "SpotMarket",
|
|
6757
6861
|
"type": {
|
|
@@ -8407,6 +8511,109 @@
|
|
|
8407
8511
|
]
|
|
8408
8512
|
}
|
|
8409
8513
|
},
|
|
8514
|
+
{
|
|
8515
|
+
"name": "RFQMakerOrderParams",
|
|
8516
|
+
"type": {
|
|
8517
|
+
"kind": "struct",
|
|
8518
|
+
"fields": [
|
|
8519
|
+
{
|
|
8520
|
+
"name": "uuid",
|
|
8521
|
+
"type": {
|
|
8522
|
+
"array": [
|
|
8523
|
+
"u8",
|
|
8524
|
+
8
|
|
8525
|
+
]
|
|
8526
|
+
}
|
|
8527
|
+
},
|
|
8528
|
+
{
|
|
8529
|
+
"name": "authority",
|
|
8530
|
+
"type": "publicKey"
|
|
8531
|
+
},
|
|
8532
|
+
{
|
|
8533
|
+
"name": "subAccountId",
|
|
8534
|
+
"type": "u16"
|
|
8535
|
+
},
|
|
8536
|
+
{
|
|
8537
|
+
"name": "marketIndex",
|
|
8538
|
+
"type": "u16"
|
|
8539
|
+
},
|
|
8540
|
+
{
|
|
8541
|
+
"name": "marketType",
|
|
8542
|
+
"type": {
|
|
8543
|
+
"defined": "MarketType"
|
|
8544
|
+
}
|
|
8545
|
+
},
|
|
8546
|
+
{
|
|
8547
|
+
"name": "baseAssetAmount",
|
|
8548
|
+
"type": "u64"
|
|
8549
|
+
},
|
|
8550
|
+
{
|
|
8551
|
+
"name": "price",
|
|
8552
|
+
"type": "u64"
|
|
8553
|
+
},
|
|
8554
|
+
{
|
|
8555
|
+
"name": "direction",
|
|
8556
|
+
"type": {
|
|
8557
|
+
"defined": "PositionDirection"
|
|
8558
|
+
}
|
|
8559
|
+
},
|
|
8560
|
+
{
|
|
8561
|
+
"name": "maxTs",
|
|
8562
|
+
"type": "i64"
|
|
8563
|
+
}
|
|
8564
|
+
]
|
|
8565
|
+
}
|
|
8566
|
+
},
|
|
8567
|
+
{
|
|
8568
|
+
"name": "RFQMakerMessage",
|
|
8569
|
+
"type": {
|
|
8570
|
+
"kind": "struct",
|
|
8571
|
+
"fields": [
|
|
8572
|
+
{
|
|
8573
|
+
"name": "orderParams",
|
|
8574
|
+
"type": {
|
|
8575
|
+
"defined": "RFQMakerOrderParams"
|
|
8576
|
+
}
|
|
8577
|
+
},
|
|
8578
|
+
{
|
|
8579
|
+
"name": "signature",
|
|
8580
|
+
"type": {
|
|
8581
|
+
"array": [
|
|
8582
|
+
"u8",
|
|
8583
|
+
64
|
|
8584
|
+
]
|
|
8585
|
+
}
|
|
8586
|
+
}
|
|
8587
|
+
]
|
|
8588
|
+
}
|
|
8589
|
+
},
|
|
8590
|
+
{
|
|
8591
|
+
"name": "RFQMatch",
|
|
8592
|
+
"type": {
|
|
8593
|
+
"kind": "struct",
|
|
8594
|
+
"fields": [
|
|
8595
|
+
{
|
|
8596
|
+
"name": "baseAssetAmount",
|
|
8597
|
+
"type": "u64"
|
|
8598
|
+
},
|
|
8599
|
+
{
|
|
8600
|
+
"name": "makerOrderParams",
|
|
8601
|
+
"type": {
|
|
8602
|
+
"defined": "RFQMakerOrderParams"
|
|
8603
|
+
}
|
|
8604
|
+
},
|
|
8605
|
+
{
|
|
8606
|
+
"name": "makerSignature",
|
|
8607
|
+
"type": {
|
|
8608
|
+
"array": [
|
|
8609
|
+
"u8",
|
|
8610
|
+
64
|
|
8611
|
+
]
|
|
8612
|
+
}
|
|
8613
|
+
}
|
|
8614
|
+
]
|
|
8615
|
+
}
|
|
8616
|
+
},
|
|
8410
8617
|
{
|
|
8411
8618
|
"name": "ModifyOrderParams",
|
|
8412
8619
|
"type": {
|
|
@@ -9226,6 +9433,27 @@
|
|
|
9226
9433
|
]
|
|
9227
9434
|
}
|
|
9228
9435
|
},
|
|
9436
|
+
{
|
|
9437
|
+
"name": "RFQOrderId",
|
|
9438
|
+
"type": {
|
|
9439
|
+
"kind": "struct",
|
|
9440
|
+
"fields": [
|
|
9441
|
+
{
|
|
9442
|
+
"name": "uuid",
|
|
9443
|
+
"type": {
|
|
9444
|
+
"array": [
|
|
9445
|
+
"u8",
|
|
9446
|
+
8
|
|
9447
|
+
]
|
|
9448
|
+
}
|
|
9449
|
+
},
|
|
9450
|
+
{
|
|
9451
|
+
"name": "maxTs",
|
|
9452
|
+
"type": "i64"
|
|
9453
|
+
}
|
|
9454
|
+
]
|
|
9455
|
+
}
|
|
9456
|
+
},
|
|
9229
9457
|
{
|
|
9230
9458
|
"name": "InsuranceFund",
|
|
9231
9459
|
"type": {
|
|
@@ -10326,6 +10554,9 @@
|
|
|
10326
10554
|
},
|
|
10327
10555
|
{
|
|
10328
10556
|
"name": "Liquidation"
|
|
10557
|
+
},
|
|
10558
|
+
{
|
|
10559
|
+
"name": "RFQ"
|
|
10329
10560
|
}
|
|
10330
10561
|
]
|
|
10331
10562
|
}
|
|
@@ -13387,6 +13618,31 @@
|
|
|
13387
13618
|
"code": 6290,
|
|
13388
13619
|
"name": "InvalidHighLeverageModeConfig",
|
|
13389
13620
|
"msg": "Invalid High Leverage Mode Config"
|
|
13621
|
+
},
|
|
13622
|
+
{
|
|
13623
|
+
"code": 6291,
|
|
13624
|
+
"name": "InvalidRFQUserAccount",
|
|
13625
|
+
"msg": "Invalid RFQ User Account"
|
|
13626
|
+
},
|
|
13627
|
+
{
|
|
13628
|
+
"code": 6292,
|
|
13629
|
+
"name": "RFQUserAccountWrongMutability",
|
|
13630
|
+
"msg": "RFQUserAccount should be mutable"
|
|
13631
|
+
},
|
|
13632
|
+
{
|
|
13633
|
+
"code": 6293,
|
|
13634
|
+
"name": "RFQUserAccountFull",
|
|
13635
|
+
"msg": "RFQUserAccount has too many active RFQs"
|
|
13636
|
+
},
|
|
13637
|
+
{
|
|
13638
|
+
"code": 6294,
|
|
13639
|
+
"name": "RFQOrderNotFilled",
|
|
13640
|
+
"msg": "RFQ order not filled as expected"
|
|
13641
|
+
},
|
|
13642
|
+
{
|
|
13643
|
+
"code": 6295,
|
|
13644
|
+
"name": "InvalidRFQOrder",
|
|
13645
|
+
"msg": "RFQ orders must be jit makers"
|
|
13390
13646
|
}
|
|
13391
13647
|
],
|
|
13392
13648
|
"metadata": {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Isomorphic Code Explanation
|
|
2
|
+
|
|
3
|
+
Soem of the features you might want to add to the SDK may only be compatible with particular execution environments (usually a non-browser one). To get that working without breaking the SDK for people in other environments, you need to get your code working in an isomorphic way.
|
|
4
|
+
|
|
5
|
+
This README will try explain how to do this, and you should be able to follow the example of other pieces of isomorphic code in this folder.
|
|
6
|
+
|
|
7
|
+
## High Level Explanation
|
|
8
|
+
|
|
9
|
+
At a high level, we just want to make sure that we're not importing any incompatible code into the final compiled .js output files. The only real way this can "get done" is by importing types or by importing classes/methods/values out of an offending packages. The goal of our isomorphic seperation is to ensure that we have SDK-Side code which is still properly typed and easy for devs to work with, without putting anything bad into the output code. We will do this with some typescript magic and a simple but handy postbuild script.
|
|
10
|
+
|
|
11
|
+
## Step-by-step isomorphic code:
|
|
12
|
+
|
|
13
|
+
1. Create [your-package-name].d.ts, [your-package-name].browser.ts, and [your-package-name].node.ts files.
|
|
14
|
+
2. Remove any imports of an offending library which aren't going through our dedicated isomorphic files. Instead import the TYPES of these and place them in the `.d.ts` file (definition file). Note to import ONLY THE TYPES you use `import type {stuff}` instead of just `import {stuff}`.
|
|
15
|
+
3. The definition file should be exporting types only, and the files that were previously importing things directly from the library should be able to import from the definition file now instead. You might see some typescript issues when you import things from this definition file because typescript thinks it's "just a type" -- you can safely @ts-ignore these errors, but the types SHOULD at least be correct when you are using them.
|
|
16
|
+
4. For concrete classes, methods, constants, etc. that you need to make available - you will place them in the `.browser` and `.node` files. You should be able to pretty flexibly export them however you want, just make sure the definition file has a matching type for how you're doing it. See `grpc.d.ts` and `grpc.node.ts` to look at how we're doing this for `createClient`. For the "bad" isomorphic file it's probably best to throw an error so that the consumer knows they shouldn't be using this particular feature.
|
|
17
|
+
5. Note about enums :: they're weird and annoying. If you follow how the enum type `CommitmentLevel` was exported for the grpc package though you should be fine.
|
|
18
|
+
6. Add the name of your package to `postbuild.js`.
|
|
19
|
+
7. when you run `build` it will build the node version of all of these packages. You can run `build:browser` to build the browser side ones instead.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Client from '@triton-one/yellowstone-grpc';
|
|
2
|
+
import {
|
|
3
|
+
SubscribeRequest,
|
|
4
|
+
SubscribeUpdate,
|
|
5
|
+
CommitmentLevel,
|
|
6
|
+
} from '@triton-one/yellowstone-grpc';
|
|
7
|
+
import { ClientDuplexStream, ChannelOptions } from '@grpc/grpc-js';
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
ClientDuplexStream,
|
|
11
|
+
ChannelOptions,
|
|
12
|
+
SubscribeRequest,
|
|
13
|
+
SubscribeUpdate,
|
|
14
|
+
CommitmentLevel,
|
|
15
|
+
Client,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// Export a function to create a new Client instance
|
|
19
|
+
export function createClient(
|
|
20
|
+
...args: ConstructorParameters<typeof Client>
|
|
21
|
+
): Client {
|
|
22
|
+
return new Client(...args);
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './grpc.node';
|
|
@@ -11,11 +11,12 @@ import StrictEventEmitter from 'strict-event-emitter-types';
|
|
|
11
11
|
import { EventEmitter } from 'events';
|
|
12
12
|
import { BN } from '../index';
|
|
13
13
|
import { decodeUser } from '../decode/user';
|
|
14
|
+
import { grpcSubscription } from './grpcSubscription';
|
|
14
15
|
|
|
15
16
|
export class OrderSubscriber {
|
|
16
17
|
driftClient: DriftClient;
|
|
17
18
|
usersAccounts = new Map<string, { slot: number; userAccount: UserAccount }>();
|
|
18
|
-
subscription: PollingSubscription | WebsocketSubscription;
|
|
19
|
+
subscription: PollingSubscription | WebsocketSubscription | grpcSubscription;
|
|
19
20
|
commitment: Commitment;
|
|
20
21
|
eventEmitter: StrictEventEmitter<EventEmitter, OrderSubscriberEvents>;
|
|
21
22
|
|
|
@@ -34,6 +35,18 @@ export class OrderSubscriber {
|
|
|
34
35
|
orderSubscriber: this,
|
|
35
36
|
frequency: config.subscriptionConfig.frequency,
|
|
36
37
|
});
|
|
38
|
+
} else if (config.subscriptionConfig.type === 'grpc') {
|
|
39
|
+
this.subscription = new grpcSubscription({
|
|
40
|
+
orderSubscriber: this,
|
|
41
|
+
grpcConfigs: config.subscriptionConfig.grpcConfigs,
|
|
42
|
+
skipInitialLoad: config.subscriptionConfig.skipInitialLoad,
|
|
43
|
+
resubOpts: {
|
|
44
|
+
resubTimeoutMs: config.subscriptionConfig?.resubTimeoutMs,
|
|
45
|
+
logResubMessages: config.subscriptionConfig?.logResubMessages,
|
|
46
|
+
},
|
|
47
|
+
resyncIntervalMs: config.subscriptionConfig.resyncIntervalMs,
|
|
48
|
+
decoded: config.decodeData,
|
|
49
|
+
});
|
|
37
50
|
} else {
|
|
38
51
|
this.subscription = new WebsocketSubscription({
|
|
39
52
|
orderSubscriber: this,
|