@drift-labs/sdk-browser 2.162.0-beta.2 → 2.163.0-beta.10
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 +2 -2
- package/VERSION +1 -1
- package/bun.lock +47 -79
- package/lib/browser/accounts/fetch.d.ts +6 -6
- package/lib/browser/accounts/fetch.js +4 -4
- package/lib/browser/accounts/grpcAccountSubscriber.d.ts +2 -2
- package/lib/browser/accounts/grpcDriftClientAccountSubscriber.d.ts +2 -2
- package/lib/browser/accounts/grpcDriftClientAccountSubscriberV2.d.ts +3 -3
- package/lib/browser/accounts/grpcDriftClientAccountSubscriberV2.js +2 -2
- package/lib/browser/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts +2 -2
- package/lib/browser/accounts/grpcMultiAccountSubscriber.d.ts +2 -2
- package/lib/browser/accounts/grpcMultiUserAccountSubscriber.d.ts +2 -2
- package/lib/browser/accounts/grpcProgramAccountSubscriber.d.ts +2 -2
- package/lib/browser/accounts/grpcUserAccountSubscriber.d.ts +2 -2
- package/lib/browser/accounts/grpcUserStatsAccountSubscriber.d.ts +2 -2
- package/lib/browser/accounts/laserProgramAccountSubscriber.d.ts +2 -2
- package/lib/browser/accounts/oneShotUserAccountSubscriber.d.ts +3 -3
- package/lib/browser/accounts/oneShotUserStatsAccountSubscriber.d.ts +3 -3
- package/lib/browser/accounts/pollingDriftClientAccountSubscriber.d.ts +3 -3
- package/lib/browser/accounts/pollingDriftClientAccountSubscriber.js +2 -2
- package/lib/browser/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts +3 -3
- package/lib/browser/accounts/pollingInsuranceFundStakeAccountSubscriber.js +1 -1
- package/lib/browser/accounts/pollingOracleAccountSubscriber.d.ts +2 -2
- package/lib/browser/accounts/pollingTokenAccountSubscriber.d.ts +2 -2
- package/lib/browser/accounts/pollingUserAccountSubscriber.js +2 -2
- package/lib/browser/accounts/pollingUserStatsAccountSubscriber.d.ts +3 -3
- package/lib/browser/accounts/pollingUserStatsAccountSubscriber.js +1 -1
- package/lib/browser/accounts/testBulkAccountLoader.js +3 -5
- package/lib/browser/accounts/types.d.ts +11 -14
- package/lib/browser/accounts/webSocketAccountSubscriber.d.ts +3 -3
- package/lib/browser/accounts/webSocketAccountSubscriber.js +1 -2
- package/lib/browser/accounts/webSocketAccountSubscriberV2.d.ts +3 -3
- package/lib/browser/accounts/webSocketDriftClientAccountSubscriber.d.ts +5 -5
- package/lib/browser/accounts/webSocketDriftClientAccountSubscriber.js +2 -2
- package/lib/browser/accounts/webSocketDriftClientAccountSubscriberV2.d.ts +3 -3
- package/lib/browser/accounts/webSocketDriftClientAccountSubscriberV2.js +2 -2
- package/lib/browser/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +3 -3
- package/lib/browser/accounts/webSocketProgramAccountSubscriber.d.ts +3 -3
- package/lib/browser/accounts/webSocketProgramAccountSubscriberV2.d.ts +3 -3
- package/lib/browser/accounts/webSocketProgramAccountsSubscriberV2.d.ts +3 -3
- package/lib/browser/accounts/webSocketUserAccountSubscriber.d.ts +3 -3
- package/lib/browser/accounts/webSocketUserStatsAccountSubsriber.d.ts +3 -3
- package/lib/browser/accounts/websocketProgramUserAccountSubscriber.d.ts +2 -2
- package/lib/browser/addresses/pda.d.ts +6 -2
- package/lib/browser/addresses/pda.js +7 -12
- package/lib/browser/adminClient.d.ts +11 -9
- package/lib/browser/adminClient.js +30 -72
- package/lib/browser/auctionSubscriber/auctionSubscriber.js +1 -1
- package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.js +1 -1
- package/lib/browser/config.d.ts +7 -3
- package/lib/browser/config.js +9 -7
- package/lib/browser/constants/index.d.ts +5 -0
- package/lib/browser/constants/index.js +5 -0
- package/lib/browser/constants/numericConstants.d.ts +1 -1
- package/lib/browser/constants/numericConstants.js +3 -3
- package/lib/browser/constants/perpMarkets.js +3 -412
- package/lib/browser/constants/spotMarkets.js +7 -91
- package/lib/browser/constituentMap/constituentMap.js +2 -2
- package/lib/browser/constituentMap/pollingConstituentAccountSubscriber.d.ts +3 -3
- package/lib/browser/constituentMap/webSocketConstituentAccountSubscriber.d.ts +3 -3
- package/lib/browser/constituentMap/webSocketConstituentAccountSubscriber.js +1 -1
- package/lib/browser/decode/customCoder.d.ts +7 -9
- package/lib/browser/decode/customCoder.js +17 -28
- package/lib/browser/decode/user.js +7 -25
- package/lib/browser/dlob/DLOB.d.ts +12 -0
- package/lib/browser/dlob/DLOB.js +12 -0
- package/lib/browser/dlob/orderBookLevels.js +1 -1
- package/lib/browser/driftClient.d.ts +32 -59
- package/lib/browser/driftClient.js +85 -562
- package/lib/browser/driftClientConfig.d.ts +7 -0
- package/lib/browser/events/eventSubscriber.d.ts +8 -0
- package/lib/browser/events/eventSubscriber.js +5 -2
- package/lib/browser/events/parse.d.ts +1 -1
- package/lib/browser/factory/oracleClient.d.ts +2 -2
- package/lib/browser/factory/oracleClient.js +9 -21
- package/lib/browser/idl/drift.d.ts +21406 -0
- package/lib/browser/idl/drift.js +2 -0
- package/lib/browser/idl/drift.json +20850 -15287
- 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 +148 -61
- package/lib/browser/index.d.ts +13 -6
- package/lib/browser/index.js +12 -5
- package/lib/browser/marinade/index.d.ts +1 -1
- package/lib/browser/marinade/index.js +2 -2
- package/lib/browser/math/amm.d.ts +4 -5
- package/lib/browser/math/amm.js +8 -35
- package/lib/browser/math/funding.js +6 -1
- package/lib/browser/math/margin.d.ts +3 -4
- package/lib/browser/math/margin.js +16 -47
- package/lib/browser/math/market.d.ts +2 -2
- package/lib/browser/math/market.js +10 -42
- package/lib/browser/math/oracles.js +14 -19
- package/lib/browser/math/position.js +1 -1
- package/lib/browser/math/trade.js +4 -4
- package/lib/browser/memcmp.js +8 -8
- package/lib/browser/openbook/openbookV2Subscriber.d.ts +1 -1
- package/lib/browser/openbook/openbookV2Subscriber.js +3 -3
- package/lib/browser/oracles/oracleClientCache.d.ts +2 -2
- package/lib/browser/oracles/prelaunchOracleClient.d.ts +2 -2
- package/lib/browser/oracles/prelaunchOracleClient.js +1 -1
- package/lib/browser/oracles/pythLazerClient.js +3 -5
- package/lib/browser/oracles/types.d.ts +6 -0
- package/lib/browser/orderParams.d.ts +0 -1
- package/lib/browser/orderParams.js +1 -5
- package/lib/browser/orderSubscriber/OrderSubscriber.js +3 -4
- package/lib/browser/orderSubscriber/WebsocketSubscription.js +1 -1
- package/lib/browser/orderSubscriber/grpcSubscription.js +2 -2
- package/lib/browser/orderSubscriber/index.d.ts +5 -0
- package/lib/browser/orderSubscriber/index.js +5 -0
- package/lib/browser/priorityFee/index.d.ts +5 -0
- package/lib/browser/priorityFee/index.js +5 -0
- package/lib/browser/pyth/index.d.ts +2 -2
- package/lib/browser/pyth/types.d.ts +1 -1
- package/lib/browser/swift/grpcSignedMsgUserAccountSubscriber.js +1 -1
- package/lib/browser/swift/index.d.ts +7 -0
- package/lib/browser/swift/index.js +7 -0
- package/lib/browser/swift/signedMsgUserAccountSubscriber.js +4 -3
- package/lib/browser/tokenFaucet.d.ts +2 -2
- package/lib/browser/tokenFaucet.js +4 -4
- package/lib/browser/tx/txHandler.d.ts +12 -0
- package/lib/browser/tx/txHandler.js +12 -0
- package/lib/browser/types.d.ts +19 -31
- package/lib/browser/types.js +6 -11
- package/lib/browser/user.d.ts +27 -18
- package/lib/browser/user.js +64 -100
- package/lib/browser/userMap/WebsocketSubscription.js +1 -1
- package/lib/browser/userMap/grpcSubscription.js +1 -1
- package/lib/browser/userMap/revenueShareEscrowMap.js +4 -4
- package/lib/browser/userMap/userMap.js +4 -5
- package/lib/browser/userMap/userStatsMap.js +2 -3
- package/lib/browser/userStats.d.ts +5 -0
- package/lib/node/accounts/fetch.d.ts +6 -6
- package/lib/node/accounts/fetch.d.ts.map +1 -1
- package/lib/node/accounts/fetch.js +4 -4
- package/lib/node/accounts/grpcAccountSubscriber.d.ts +2 -2
- package/lib/node/accounts/grpcAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcDriftClientAccountSubscriber.d.ts +2 -2
- package/lib/node/accounts/grpcDriftClientAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcDriftClientAccountSubscriberV2.d.ts +3 -3
- package/lib/node/accounts/grpcDriftClientAccountSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/grpcDriftClientAccountSubscriberV2.js +2 -2
- package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts +2 -2
- package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcMultiAccountSubscriber.d.ts +2 -2
- package/lib/node/accounts/grpcMultiAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcMultiUserAccountSubscriber.d.ts +2 -2
- package/lib/node/accounts/grpcMultiUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts +2 -2
- package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcUserAccountSubscriber.d.ts +2 -2
- package/lib/node/accounts/grpcUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcUserStatsAccountSubscriber.d.ts +2 -2
- package/lib/node/accounts/grpcUserStatsAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/laserProgramAccountSubscriber.d.ts +2 -2
- package/lib/node/accounts/laserProgramAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/oneShotUserAccountSubscriber.d.ts +3 -3
- package/lib/node/accounts/oneShotUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/oneShotUserStatsAccountSubscriber.d.ts +3 -3
- package/lib/node/accounts/oneShotUserStatsAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingDriftClientAccountSubscriber.d.ts +3 -3
- package/lib/node/accounts/pollingDriftClientAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingDriftClientAccountSubscriber.js +2 -2
- package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts +3 -3
- package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.js +1 -1
- package/lib/node/accounts/pollingOracleAccountSubscriber.d.ts +2 -2
- package/lib/node/accounts/pollingOracleAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingTokenAccountSubscriber.d.ts +2 -2
- package/lib/node/accounts/pollingTokenAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingUserAccountSubscriber.js +2 -2
- package/lib/node/accounts/pollingUserStatsAccountSubscriber.d.ts +3 -3
- package/lib/node/accounts/pollingUserStatsAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingUserStatsAccountSubscriber.js +1 -1
- package/lib/node/accounts/testBulkAccountLoader.d.ts.map +1 -1
- package/lib/node/accounts/testBulkAccountLoader.js +3 -5
- package/lib/node/accounts/types.d.ts +11 -14
- package/lib/node/accounts/types.d.ts.map +1 -1
- package/lib/node/accounts/webSocketAccountSubscriber.d.ts +3 -3
- package/lib/node/accounts/webSocketAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketAccountSubscriber.js +1 -2
- package/lib/node/accounts/webSocketAccountSubscriberV2.d.ts +3 -3
- package/lib/node/accounts/webSocketAccountSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/webSocketDriftClientAccountSubscriber.d.ts +5 -5
- package/lib/node/accounts/webSocketDriftClientAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketDriftClientAccountSubscriber.js +2 -2
- package/lib/node/accounts/webSocketDriftClientAccountSubscriberV2.d.ts +3 -3
- package/lib/node/accounts/webSocketDriftClientAccountSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/webSocketDriftClientAccountSubscriberV2.js +2 -2
- package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +3 -3
- package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts +3 -3
- package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketProgramAccountSubscriberV2.d.ts +3 -3
- package/lib/node/accounts/webSocketProgramAccountSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.d.ts +3 -3
- package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/webSocketUserAccountSubscriber.d.ts +3 -3
- package/lib/node/accounts/webSocketUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketUserStatsAccountSubsriber.d.ts +3 -3
- package/lib/node/accounts/webSocketUserStatsAccountSubsriber.d.ts.map +1 -1
- package/lib/node/accounts/websocketProgramUserAccountSubscriber.d.ts +2 -2
- package/lib/node/accounts/websocketProgramUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/addresses/pda.d.ts +6 -2
- package/lib/node/addresses/pda.d.ts.map +1 -1
- package/lib/node/addresses/pda.js +7 -12
- package/lib/node/adminClient.d.ts +11 -9
- package/lib/node/adminClient.d.ts.map +1 -1
- package/lib/node/adminClient.js +30 -72
- package/lib/node/auctionSubscriber/auctionSubscriber.d.ts.map +1 -1
- package/lib/node/auctionSubscriber/auctionSubscriber.js +1 -1
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts.map +1 -1
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.js +1 -1
- package/lib/node/config.d.ts +7 -3
- package/lib/node/config.d.ts.map +1 -1
- package/lib/node/config.js +9 -7
- package/lib/node/constants/index.d.ts +5 -0
- package/lib/node/constants/index.d.ts.map +1 -1
- package/lib/node/constants/index.js +5 -0
- package/lib/node/constants/numericConstants.d.ts +1 -1
- package/lib/node/constants/numericConstants.d.ts.map +1 -1
- package/lib/node/constants/numericConstants.js +3 -3
- package/lib/node/constants/perpMarkets.d.ts.map +1 -1
- package/lib/node/constants/perpMarkets.js +3 -412
- package/lib/node/constants/spotMarkets.d.ts.map +1 -1
- package/lib/node/constants/spotMarkets.js +7 -91
- package/lib/node/constituentMap/constituentMap.d.ts.map +1 -1
- package/lib/node/constituentMap/constituentMap.js +2 -2
- package/lib/node/constituentMap/pollingConstituentAccountSubscriber.d.ts +3 -3
- package/lib/node/constituentMap/pollingConstituentAccountSubscriber.d.ts.map +1 -1
- package/lib/node/constituentMap/webSocketConstituentAccountSubscriber.d.ts +3 -3
- package/lib/node/constituentMap/webSocketConstituentAccountSubscriber.d.ts.map +1 -1
- package/lib/node/constituentMap/webSocketConstituentAccountSubscriber.js +1 -1
- package/lib/node/decode/customCoder.d.ts +7 -9
- package/lib/node/decode/customCoder.d.ts.map +1 -1
- package/lib/node/decode/customCoder.js +17 -28
- package/lib/node/decode/user.d.ts.map +1 -1
- package/lib/node/decode/user.js +7 -25
- package/lib/node/dlob/DLOB.d.ts +12 -0
- package/lib/node/dlob/DLOB.d.ts.map +1 -1
- package/lib/node/dlob/DLOB.js +12 -0
- package/lib/node/dlob/orderBookLevels.d.ts.map +1 -1
- package/lib/node/dlob/orderBookLevels.js +1 -1
- package/lib/node/driftClient.d.ts +32 -59
- package/lib/node/driftClient.d.ts.map +1 -1
- package/lib/node/driftClient.js +85 -562
- package/lib/node/driftClientConfig.d.ts +7 -0
- package/lib/node/driftClientConfig.d.ts.map +1 -1
- package/lib/node/events/eventSubscriber.d.ts +8 -0
- package/lib/node/events/eventSubscriber.d.ts.map +1 -1
- package/lib/node/events/eventSubscriber.js +5 -2
- package/lib/node/events/parse.d.ts +1 -1
- package/lib/node/events/parse.d.ts.map +1 -1
- package/lib/node/factory/oracleClient.d.ts +2 -2
- package/lib/node/factory/oracleClient.d.ts.map +1 -1
- package/lib/node/factory/oracleClient.js +9 -21
- package/lib/node/idl/drift.d.ts +21407 -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 +20850 -15287
- 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 +148 -61
- package/lib/node/index.d.ts +13 -6
- package/lib/node/index.d.ts.map +1 -1
- package/lib/node/index.js +12 -5
- package/lib/node/marinade/index.d.ts +1 -1
- package/lib/node/marinade/index.d.ts.map +1 -1
- package/lib/node/marinade/index.js +2 -2
- package/lib/node/math/amm.d.ts +4 -5
- package/lib/node/math/amm.d.ts.map +1 -1
- package/lib/node/math/amm.js +8 -35
- package/lib/node/math/funding.d.ts.map +1 -1
- package/lib/node/math/funding.js +6 -1
- package/lib/node/math/margin.d.ts +3 -4
- package/lib/node/math/margin.d.ts.map +1 -1
- package/lib/node/math/margin.js +16 -47
- package/lib/node/math/market.d.ts +2 -2
- package/lib/node/math/market.d.ts.map +1 -1
- package/lib/node/math/market.js +10 -42
- package/lib/node/math/oracles.d.ts.map +1 -1
- package/lib/node/math/oracles.js +14 -19
- package/lib/node/math/position.d.ts.map +1 -1
- package/lib/node/math/position.js +1 -1
- package/lib/node/math/trade.d.ts.map +1 -1
- package/lib/node/math/trade.js +4 -4
- package/lib/node/memcmp.js +8 -8
- package/lib/node/openbook/openbookV2Subscriber.d.ts +1 -1
- package/lib/node/openbook/openbookV2Subscriber.d.ts.map +1 -1
- package/lib/node/openbook/openbookV2Subscriber.js +3 -3
- package/lib/node/oracles/oracleClientCache.d.ts +2 -2
- package/lib/node/oracles/oracleClientCache.d.ts.map +1 -1
- package/lib/node/oracles/prelaunchOracleClient.d.ts +2 -2
- package/lib/node/oracles/prelaunchOracleClient.d.ts.map +1 -1
- package/lib/node/oracles/prelaunchOracleClient.js +1 -1
- package/lib/node/oracles/pythLazerClient.d.ts.map +1 -1
- package/lib/node/oracles/pythLazerClient.js +3 -5
- package/lib/node/oracles/types.d.ts +6 -0
- package/lib/node/oracles/types.d.ts.map +1 -1
- package/lib/node/orderParams.d.ts +0 -1
- package/lib/node/orderParams.d.ts.map +1 -1
- package/lib/node/orderParams.js +1 -5
- package/lib/node/orderSubscriber/OrderSubscriber.d.ts.map +1 -1
- package/lib/node/orderSubscriber/OrderSubscriber.js +3 -4
- package/lib/node/orderSubscriber/WebsocketSubscription.js +1 -1
- package/lib/node/orderSubscriber/grpcSubscription.js +2 -2
- package/lib/node/orderSubscriber/index.d.ts +5 -0
- package/lib/node/orderSubscriber/index.d.ts.map +1 -1
- package/lib/node/orderSubscriber/index.js +5 -0
- package/lib/node/priorityFee/index.d.ts +5 -0
- package/lib/node/priorityFee/index.d.ts.map +1 -1
- package/lib/node/priorityFee/index.js +5 -0
- package/lib/node/pyth/index.d.ts +2 -2
- package/lib/node/pyth/index.d.ts.map +1 -1
- package/lib/node/pyth/types.d.ts +1 -1
- package/lib/node/pyth/types.d.ts.map +1 -1
- package/lib/node/swift/grpcSignedMsgUserAccountSubscriber.js +1 -1
- package/lib/node/swift/index.d.ts +7 -0
- package/lib/node/swift/index.d.ts.map +1 -1
- package/lib/node/swift/index.js +7 -0
- package/lib/node/swift/signedMsgUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/swift/signedMsgUserAccountSubscriber.js +4 -3
- package/lib/node/tokenFaucet.d.ts +2 -2
- package/lib/node/tokenFaucet.d.ts.map +1 -1
- package/lib/node/tokenFaucet.js +4 -4
- package/lib/node/tx/txHandler.d.ts +12 -0
- package/lib/node/tx/txHandler.d.ts.map +1 -1
- package/lib/node/tx/txHandler.js +12 -0
- package/lib/node/types.d.ts +19 -31
- package/lib/node/types.d.ts.map +1 -1
- package/lib/node/types.js +6 -11
- package/lib/node/user.d.ts +27 -18
- package/lib/node/user.d.ts.map +1 -1
- package/lib/node/user.js +64 -100
- package/lib/node/userMap/WebsocketSubscription.js +1 -1
- package/lib/node/userMap/grpcSubscription.js +1 -1
- package/lib/node/userMap/revenueShareEscrowMap.d.ts.map +1 -1
- package/lib/node/userMap/revenueShareEscrowMap.js +4 -4
- package/lib/node/userMap/userMap.d.ts.map +1 -1
- package/lib/node/userMap/userMap.js +4 -5
- package/lib/node/userMap/userStatsMap.d.ts.map +1 -1
- package/lib/node/userMap/userStatsMap.js +2 -3
- package/lib/node/userStats.d.ts +5 -0
- package/lib/node/userStats.d.ts.map +1 -1
- package/package.json +5 -7
- package/src/accounts/fetch.ts +18 -17
- package/src/accounts/grpcAccountSubscriber.ts +3 -3
- package/src/accounts/grpcDriftClientAccountSubscriber.ts +2 -3
- package/src/accounts/grpcDriftClientAccountSubscriberV2.ts +5 -6
- package/src/accounts/grpcInsuranceFundStakeAccountSubscriber.ts +2 -2
- package/src/accounts/grpcMultiAccountSubscriber.ts +4 -4
- package/src/accounts/grpcMultiUserAccountSubscriber.ts +4 -4
- package/src/accounts/grpcProgramAccountSubscriber.ts +3 -3
- package/src/accounts/grpcUserAccountSubscriber.ts +2 -2
- package/src/accounts/grpcUserStatsAccountSubscriber.ts +2 -2
- package/src/accounts/laserProgramAccountSubscriber.ts +3 -3
- package/src/accounts/oneShotUserAccountSubscriber.ts +6 -7
- package/src/accounts/oneShotUserStatsAccountSubscriber.ts +10 -9
- package/src/accounts/pollingDriftClientAccountSubscriber.ts +12 -11
- package/src/accounts/pollingInsuranceFundStakeAccountSubscriber.ts +11 -10
- package/src/accounts/pollingOracleAccountSubscriber.ts +2 -2
- package/src/accounts/pollingTokenAccountSubscriber.ts +2 -2
- package/src/accounts/pollingUserAccountSubscriber.ts +2 -2
- package/src/accounts/pollingUserStatsAccountSubscriber.ts +14 -14
- package/src/accounts/testBulkAccountLoader.ts +3 -5
- package/src/accounts/types.ts +10 -25
- package/src/accounts/webSocketAccountSubscriber.ts +5 -5
- package/src/accounts/webSocketAccountSubscriberV2.ts +4 -3
- package/src/accounts/webSocketDriftClientAccountSubscriber.ts +9 -10
- package/src/accounts/webSocketDriftClientAccountSubscriberV2.ts +13 -10
- package/src/accounts/webSocketInsuranceFundStakeAccountSubscriber.ts +3 -3
- package/src/accounts/webSocketProgramAccountSubscriber.ts +4 -3
- package/src/accounts/webSocketProgramAccountSubscriberV2.ts +4 -3
- package/src/accounts/webSocketProgramAccountsSubscriberV2.ts +4 -3
- package/src/accounts/webSocketUserAccountSubscriber.ts +3 -3
- package/src/accounts/webSocketUserStatsAccountSubsriber.ts +3 -3
- package/src/accounts/websocketProgramUserAccountSubscriber.ts +4 -4
- package/src/addresses/pda.ts +6 -22
- package/src/adminClient.ts +154 -239
- package/src/auctionSubscriber/auctionSubscriber.ts +5 -3
- package/src/auctionSubscriber/auctionSubscriberGrpc.ts +5 -3
- package/src/config.ts +24 -16
- package/src/constants/index.ts +5 -0
- package/src/constants/numericConstants.ts +2 -3
- package/src/constants/perpMarkets.ts +3 -445
- package/src/constants/spotMarkets.ts +7 -102
- package/src/constituentMap/constituentMap.ts +5 -6
- package/src/constituentMap/pollingConstituentAccountSubscriber.ts +3 -3
- package/src/constituentMap/webSocketConstituentAccountSubscriber.ts +6 -6
- package/src/decode/customCoder.ts +26 -35
- package/src/decode/user.ts +7 -25
- package/src/dlob/DLOB.ts +12 -0
- package/src/dlob/orderBookLevels.ts +0 -1
- package/src/driftClient.ts +245 -1091
- package/src/driftClientConfig.ts +7 -0
- package/src/events/eventSubscriber.ts +14 -2
- package/src/events/parse.ts +2 -2
- package/src/factory/oracleClient.ts +17 -28
- package/src/idl/drift.json +20850 -15287
- package/src/idl/drift.ts +21406 -0
- package/src/idl/pyth.ts +97 -0
- package/src/idl/token_faucet.json +148 -61
- package/src/idl/token_faucet.ts +197 -0
- package/src/index.ts +13 -12
- package/src/margin/README.md +0 -1
- package/src/marinade/index.ts +2 -2
- package/src/math/amm.ts +2 -48
- package/src/math/funding.ts +8 -3
- package/src/math/margin.ts +12 -67
- package/src/math/market.ts +15 -69
- package/src/math/oracles.ts +14 -30
- package/src/math/position.ts +0 -1
- package/src/math/trade.ts +0 -4
- package/src/memcmp.ts +1 -1
- package/src/openbook/openbookV2Subscriber.ts +1 -1
- package/src/oracles/oracleClientCache.ts +2 -2
- package/src/oracles/prelaunchOracleClient.ts +9 -8
- package/src/oracles/pythLazerClient.ts +10 -12
- package/src/oracles/types.ts +6 -0
- package/src/orderParams.ts +0 -5
- package/src/orderSubscriber/OrderSubscriber.ts +7 -6
- package/src/orderSubscriber/WebsocketSubscription.ts +1 -1
- package/src/orderSubscriber/grpcSubscription.ts +2 -2
- package/src/orderSubscriber/index.ts +5 -0
- package/src/priorityFee/index.ts +5 -0
- package/src/pyth/index.ts +4 -4
- package/src/pyth/types.ts +1 -1
- package/src/swift/grpcSignedMsgUserAccountSubscriber.ts +1 -1
- package/src/swift/index.ts +7 -0
- package/src/swift/signedMsgUserAccountSubscriber.ts +7 -4
- package/src/tokenFaucet.ts +8 -4
- package/src/tx/txHandler.ts +12 -0
- package/src/types.ts +16 -20
- package/src/user.ts +66 -144
- package/src/userMap/WebsocketSubscription.ts +1 -1
- package/src/userMap/grpcSubscription.ts +1 -1
- package/src/userMap/revenueShareEscrowMap.ts +24 -20
- package/src/userMap/userMap.ts +8 -7
- package/src/userMap/userStatsMap.ts +6 -5
- package/src/userStats.ts +5 -0
- package/tests/accounts/customizedCadenceBulkAccountLoader.test.ts +5 -4
- package/tests/amm/test.ts +45 -64
- package/tests/ci/verifyConstants.ts +23 -26
- package/tests/decode/test.ts +2 -4
- package/tests/dlob/helpers.ts +8 -15
- package/tests/user/helpers.ts +0 -2
- package/tests/user/marginCalculations.test.ts +2 -3
- package/tests/user/test.ts +18 -15
- package/lib/browser/accounts/pollingHighLeverageModeConfigAccountSubscriber.d.ts +0 -29
- package/lib/browser/accounts/pollingHighLeverageModeConfigAccountSubscriber.js +0 -111
- package/lib/browser/accounts/webSocketHighLeverageModeConfigAccountSubscriber.d.ts +0 -23
- package/lib/browser/accounts/webSocketHighLeverageModeConfigAccountSubscriber.js +0 -69
- package/lib/browser/idl/pyth_solana_receiver.json +0 -628
- package/lib/browser/idl/switchboard.json +0 -8354
- package/lib/browser/idl/switchboard_on_demand_30.json +0 -5849
- package/lib/browser/oracles/pythPullClient.d.ts +0 -19
- package/lib/browser/oracles/pythPullClient.js +0 -65
- package/lib/browser/oracles/switchboardClient.d.ts +0 -12
- package/lib/browser/oracles/switchboardClient.js +0 -40
- package/lib/browser/oracles/switchboardOnDemandClient.d.ts +0 -12
- package/lib/browser/oracles/switchboardOnDemandClient.js +0 -33
- package/lib/browser/util/pythOracleUtils.d.ts +0 -2
- package/lib/browser/util/pythOracleUtils.js +0 -15
- package/lib/node/accounts/pollingHighLeverageModeConfigAccountSubscriber.d.ts +0 -30
- package/lib/node/accounts/pollingHighLeverageModeConfigAccountSubscriber.d.ts.map +0 -1
- package/lib/node/accounts/pollingHighLeverageModeConfigAccountSubscriber.js +0 -111
- package/lib/node/accounts/webSocketHighLeverageModeConfigAccountSubscriber.d.ts +0 -24
- package/lib/node/accounts/webSocketHighLeverageModeConfigAccountSubscriber.d.ts.map +0 -1
- package/lib/node/accounts/webSocketHighLeverageModeConfigAccountSubscriber.js +0 -69
- package/lib/node/idl/pyth_solana_receiver.json +0 -628
- package/lib/node/idl/switchboard.json +0 -8354
- package/lib/node/idl/switchboard_on_demand_30.json +0 -5849
- package/lib/node/oracles/pythPullClient.d.ts +0 -20
- package/lib/node/oracles/pythPullClient.d.ts.map +0 -1
- package/lib/node/oracles/pythPullClient.js +0 -65
- package/lib/node/oracles/switchboardClient.d.ts +0 -13
- package/lib/node/oracles/switchboardClient.d.ts.map +0 -1
- package/lib/node/oracles/switchboardClient.js +0 -40
- package/lib/node/oracles/switchboardOnDemandClient.d.ts +0 -13
- package/lib/node/oracles/switchboardOnDemandClient.d.ts.map +0 -1
- package/lib/node/oracles/switchboardOnDemandClient.js +0 -33
- package/lib/node/util/pythOracleUtils.d.ts +0 -3
- package/lib/node/util/pythOracleUtils.d.ts.map +0 -1
- package/lib/node/util/pythOracleUtils.js +0 -15
- package/src/accounts/pollingHighLeverageModeConfigAccountSubscriber.ts +0 -189
- package/src/accounts/webSocketHighLeverageModeConfigAccountSubscriber.ts +0 -131
- package/src/idl/switchboard.json +0 -8354
- package/src/idl/switchboard_on_demand_30.json +0 -5849
- package/src/oracles/pythPullClient.ts +0 -112
- package/src/oracles/switchboardClient.ts +0 -77
- package/src/oracles/switchboardOnDemandClient.ts +0 -64
- package/src/util/pythOracleUtils.ts +0 -11
package/lib/browser/memcmp.js
CHANGED
|
@@ -5,13 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getConstituentLpPoolFilter = exports.getConstituentFilter = exports.getRevenueShareEscrowFilter = exports.getSpotMarketAccountsFilter = exports.getPerpMarketAccountsFilter = exports.getSignedMsgUserOrdersFilter = exports.getUserStatsIsReferredOrReferrerFilter = exports.getUserStatsIsReferredFilter = exports.getUserStatsFilter = exports.getUsersWithPoolId = exports.getUserWithName = exports.getUserThatHasBeenLP = exports.getUserWithAuctionFilter = exports.getUserWithoutOrderFilter = exports.getUserWithOrderFilter = exports.getNonIdleUserFilter = exports.getUserFilter = void 0;
|
|
7
7
|
const bs58_1 = __importDefault(require("bs58"));
|
|
8
|
-
const
|
|
8
|
+
const anchor_29_1 = require("@coral-xyz/anchor-29");
|
|
9
9
|
const userName_1 = require("./userName");
|
|
10
10
|
function getUserFilter() {
|
|
11
11
|
return {
|
|
12
12
|
memcmp: {
|
|
13
13
|
offset: 0,
|
|
14
|
-
bytes: bs58_1.default.encode(
|
|
14
|
+
bytes: bs58_1.default.encode(anchor_29_1.BorshAccountsCoder.accountDiscriminator('User')),
|
|
15
15
|
},
|
|
16
16
|
};
|
|
17
17
|
}
|
|
@@ -83,7 +83,7 @@ function getUserStatsFilter() {
|
|
|
83
83
|
return {
|
|
84
84
|
memcmp: {
|
|
85
85
|
offset: 0,
|
|
86
|
-
bytes: bs58_1.default.encode(
|
|
86
|
+
bytes: bs58_1.default.encode(anchor_29_1.BorshAccountsCoder.accountDiscriminator('UserStats')),
|
|
87
87
|
},
|
|
88
88
|
};
|
|
89
89
|
}
|
|
@@ -110,7 +110,7 @@ function getSignedMsgUserOrdersFilter() {
|
|
|
110
110
|
return {
|
|
111
111
|
memcmp: {
|
|
112
112
|
offset: 0,
|
|
113
|
-
bytes: bs58_1.default.encode(
|
|
113
|
+
bytes: bs58_1.default.encode(anchor_29_1.BorshAccountsCoder.accountDiscriminator('SignedMsgUserOrders')),
|
|
114
114
|
},
|
|
115
115
|
};
|
|
116
116
|
}
|
|
@@ -119,7 +119,7 @@ function getPerpMarketAccountsFilter() {
|
|
|
119
119
|
return {
|
|
120
120
|
memcmp: {
|
|
121
121
|
offset: 0,
|
|
122
|
-
bytes: bs58_1.default.encode(
|
|
122
|
+
bytes: bs58_1.default.encode(anchor_29_1.BorshAccountsCoder.accountDiscriminator('PerpMarket')),
|
|
123
123
|
},
|
|
124
124
|
};
|
|
125
125
|
}
|
|
@@ -128,7 +128,7 @@ function getSpotMarketAccountsFilter() {
|
|
|
128
128
|
return {
|
|
129
129
|
memcmp: {
|
|
130
130
|
offset: 0,
|
|
131
|
-
bytes: bs58_1.default.encode(
|
|
131
|
+
bytes: bs58_1.default.encode(anchor_29_1.BorshAccountsCoder.accountDiscriminator('SpotMarket')),
|
|
132
132
|
},
|
|
133
133
|
};
|
|
134
134
|
}
|
|
@@ -137,7 +137,7 @@ function getRevenueShareEscrowFilter() {
|
|
|
137
137
|
return {
|
|
138
138
|
memcmp: {
|
|
139
139
|
offset: 0,
|
|
140
|
-
bytes: bs58_1.default.encode(
|
|
140
|
+
bytes: bs58_1.default.encode(anchor_29_1.BorshAccountsCoder.accountDiscriminator('RevenueShareEscrow')),
|
|
141
141
|
},
|
|
142
142
|
};
|
|
143
143
|
}
|
|
@@ -146,7 +146,7 @@ function getConstituentFilter() {
|
|
|
146
146
|
return {
|
|
147
147
|
memcmp: {
|
|
148
148
|
offset: 0,
|
|
149
|
-
bytes: bs58_1.default.encode(
|
|
149
|
+
bytes: bs58_1.default.encode(anchor_29_1.BorshAccountsCoder.accountDiscriminator('Constituent')),
|
|
150
150
|
},
|
|
151
151
|
};
|
|
152
152
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
2
|
import { Connection, PublicKey } from '@solana/web3.js';
|
|
3
3
|
import { BulkAccountLoader } from '../accounts/bulkAccountLoader';
|
|
4
|
-
import { BN } from '@coral-xyz/anchor';
|
|
4
|
+
import { BN } from '@coral-xyz/anchor-29';
|
|
5
5
|
import { L2Level, L2OrderBookGenerator } from '../dlob/orderBookLevels';
|
|
6
6
|
import { Market, OpenBookV2Client } from '@openbook-dex/openbook-v2';
|
|
7
7
|
export type OpenbookV2SubscriberConfig = {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.OpenbookV2Subscriber = void 0;
|
|
7
7
|
const web3_js_1 = require("@solana/web3.js");
|
|
8
8
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
9
|
-
const
|
|
9
|
+
const anchor_29_1 = require("@coral-xyz/anchor-29");
|
|
10
10
|
const openbook_v2_1 = require("@openbook-dex/openbook-v2");
|
|
11
11
|
const openbook_json_1 = __importDefault(require("../idl/openbook.json"));
|
|
12
12
|
class OpenbookV2Subscriber {
|
|
@@ -27,8 +27,8 @@ class OpenbookV2Subscriber {
|
|
|
27
27
|
if (this.subscribed === true) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
const anchorProvider = new
|
|
31
|
-
const openbookV2Program = new
|
|
30
|
+
const anchorProvider = new anchor_29_1.AnchorProvider(this.connection, new anchor_29_1.Wallet(web3_js_1.Keypair.generate()), {});
|
|
31
|
+
const openbookV2Program = new anchor_29_1.Program(openbook_json_1.default, this.programId, anchorProvider);
|
|
32
32
|
this.client = new openbook_v2_1.OpenBookV2Client(anchorProvider);
|
|
33
33
|
const market = await openbook_v2_1.Market.load(this.client, this.marketAddress);
|
|
34
34
|
this.market = await market.loadOrderBook();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { OracleClient } from './types';
|
|
2
2
|
import { OracleSource } from '../types';
|
|
3
3
|
import { Connection } from '@solana/web3.js';
|
|
4
|
-
import {
|
|
4
|
+
import { DriftProgram } from '../config';
|
|
5
5
|
export declare class OracleClientCache {
|
|
6
6
|
cache: Map<string, OracleClient>;
|
|
7
7
|
constructor();
|
|
8
|
-
get(oracleSource: OracleSource, connection: Connection, program:
|
|
8
|
+
get(oracleSource: OracleSource, connection: Connection, program: DriftProgram): OracleClient;
|
|
9
9
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import { Connection, PublicKey } from '@solana/web3.js';
|
|
4
4
|
import { OracleClient, OraclePriceData } from './types';
|
|
5
|
-
import {
|
|
5
|
+
import { DriftProgram } from '../config';
|
|
6
6
|
export declare class PrelaunchOracleClient implements OracleClient {
|
|
7
7
|
private connection;
|
|
8
8
|
private program;
|
|
9
|
-
constructor(connection: Connection, program:
|
|
9
|
+
constructor(connection: Connection, program: DriftProgram);
|
|
10
10
|
getOraclePriceData(pricePublicKey: PublicKey): Promise<OraclePriceData>;
|
|
11
11
|
getOraclePriceDataFromBuffer(buffer: Buffer): OraclePriceData;
|
|
12
12
|
}
|
|
@@ -11,7 +11,7 @@ class PrelaunchOracleClient {
|
|
|
11
11
|
return this.getOraclePriceDataFromBuffer(accountInfo.data);
|
|
12
12
|
}
|
|
13
13
|
getOraclePriceDataFromBuffer(buffer) {
|
|
14
|
-
const prelaunchOracle = this.program.account.prelaunchOracle.coder.accounts.decodeUnchecked('
|
|
14
|
+
const prelaunchOracle = this.program.account.prelaunchOracle.coder.accounts.decodeUnchecked('prelaunchOracle', buffer);
|
|
15
15
|
return {
|
|
16
16
|
price: prelaunchOracle.price,
|
|
17
17
|
slot: prelaunchOracle.ammLastUpdateSlot,
|
|
@@ -7,7 +7,6 @@ exports.PythLazerClient = void 0;
|
|
|
7
7
|
const web3_js_1 = require("@solana/web3.js");
|
|
8
8
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
9
9
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
10
|
-
const config_1 = require("../config");
|
|
11
10
|
const wallet_1 = require("../wallet");
|
|
12
11
|
const drift_json_1 = __importDefault(require("../idl/drift.json"));
|
|
13
12
|
class PythLazerClient {
|
|
@@ -20,16 +19,15 @@ class PythLazerClient {
|
|
|
20
19
|
new wallet_1.Wallet(new web3_js_1.Keypair()), {
|
|
21
20
|
commitment: connection.commitment,
|
|
22
21
|
});
|
|
23
|
-
this.program = new anchor_1.Program(drift_json_1.default,
|
|
24
|
-
this.decodeFunc =
|
|
25
|
-
this.program.account.pythLazerOracle.coder.accounts.decodeUnchecked.bind(this.program.account.pythLazerOracle.coder.accounts);
|
|
22
|
+
this.program = new anchor_1.Program(drift_json_1.default, provider);
|
|
23
|
+
this.decodeFunc = this.program.account.pythLazerOracle.coder.accounts.decodeUnchecked.bind(this.program.account.pythLazerOracle.coder.accounts);
|
|
26
24
|
}
|
|
27
25
|
async getOraclePriceData(pricePublicKey) {
|
|
28
26
|
const accountInfo = await this.connection.getAccountInfo(pricePublicKey);
|
|
29
27
|
return this.getOraclePriceDataFromBuffer(accountInfo.data);
|
|
30
28
|
}
|
|
31
29
|
getOraclePriceDataFromBuffer(buffer) {
|
|
32
|
-
const priceData = this.decodeFunc('
|
|
30
|
+
const priceData = this.decodeFunc('pythLazerOracle', buffer);
|
|
33
31
|
const confidence = convertPythPrice(priceData.conf, priceData.exponent, this.multiple);
|
|
34
32
|
let price = convertPythPrice(priceData.price, priceData.exponent, this.multiple);
|
|
35
33
|
if (this.stableCoin) {
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
/// <reference types="node" />
|
|
4
|
+
/**
|
|
5
|
+
* Oracle types and the OraclePriceData interface used throughout the SDK.
|
|
6
|
+
* Each oracle source (Pyth, Switchboard, Pyth Lazer, Prelaunch) has a client adapter
|
|
7
|
+
* in this directory that fetches and normalises prices into OraclePriceData.
|
|
8
|
+
* Oracle client selection is configured via DriftClientConfig and cached in OracleClientCache.
|
|
9
|
+
*/
|
|
4
10
|
import { BN } from '@coral-xyz/anchor';
|
|
5
11
|
import { PublicKey } from '@solana/web3.js';
|
|
6
12
|
import { OracleSource } from '../types';
|
|
@@ -27,4 +27,3 @@ export declare function getMarketOrderParams(params: Omit<OptionalOrderParams, '
|
|
|
27
27
|
* @returns
|
|
28
28
|
*/
|
|
29
29
|
export declare function getOrderParams(optionalOrderParams: OptionalOrderParams, overridingParams?: Record<string, any>): OrderParams;
|
|
30
|
-
export declare function isUpdateHighLeverageMode(bitFlags: number): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getOrderParams = exports.getMarketOrderParams = exports.getTriggerLimitOrderParams = exports.getTriggerMarketOrderParams = exports.getLimitOrderParams = void 0;
|
|
4
4
|
const types_1 = require("./types");
|
|
5
5
|
function getLimitOrderParams(params) {
|
|
6
6
|
return getOrderParams(Object.assign({}, params, {
|
|
@@ -42,7 +42,3 @@ function getOrderParams(optionalOrderParams, overridingParams = {}) {
|
|
|
42
42
|
return Object.assign({}, types_1.DefaultOrderParams, optionalOrderParams, overridingParams);
|
|
43
43
|
}
|
|
44
44
|
exports.getOrderParams = getOrderParams;
|
|
45
|
-
function isUpdateHighLeverageMode(bitFlags) {
|
|
46
|
-
return (bitFlags & types_1.OrderParamsBitFlag.UpdateHighLeverageMode) !== 0;
|
|
47
|
-
}
|
|
48
|
-
exports.isUpdateHighLeverageMode = isUpdateHighLeverageMode;
|
|
@@ -56,8 +56,7 @@ class OrderSubscriber {
|
|
|
56
56
|
this.decodeFn = (name, data) => (0, user_1.decodeUser)(data);
|
|
57
57
|
}
|
|
58
58
|
else {
|
|
59
|
-
this.decodeFn =
|
|
60
|
-
this.driftClient.program.account.user.coder.accounts.decodeUnchecked.bind(this.driftClient.program.account.user.coder.accounts);
|
|
59
|
+
this.decodeFn = this.driftClient.program.account.user.coder.accounts.decodeUnchecked.bind(this.driftClient.program.account.user.coder.accounts);
|
|
61
60
|
}
|
|
62
61
|
this.eventEmitter = new events_1.EventEmitter();
|
|
63
62
|
this.fetchAllNonIdleUsers = config.fetchAllNonIdleUsers;
|
|
@@ -122,7 +121,7 @@ class OrderSubscriber {
|
|
|
122
121
|
slotAndUserAccount.userAccount.lastActiveSlot.gt(newLastActiveSlot)) {
|
|
123
122
|
return;
|
|
124
123
|
}
|
|
125
|
-
userAccount = this.decodeFn('
|
|
124
|
+
userAccount = this.decodeFn('user', buffer);
|
|
126
125
|
}
|
|
127
126
|
else if (dataType === 'buffer') {
|
|
128
127
|
const buffer = data;
|
|
@@ -131,7 +130,7 @@ class OrderSubscriber {
|
|
|
131
130
|
slotAndUserAccount.userAccount.lastActiveSlot.gt(newLastActiveSlot)) {
|
|
132
131
|
return;
|
|
133
132
|
}
|
|
134
|
-
userAccount = this.decodeFn('
|
|
133
|
+
userAccount = this.decodeFn('user', data);
|
|
135
134
|
}
|
|
136
135
|
else {
|
|
137
136
|
userAccount = data;
|
|
@@ -16,7 +16,7 @@ class WebsocketSubscription {
|
|
|
16
16
|
if (this.subscriber) {
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
this.subscriber = new webSocketProgramAccountSubscriber_1.WebSocketProgramAccountSubscriber('OrderSubscriber', '
|
|
19
|
+
this.subscriber = new webSocketProgramAccountSubscriber_1.WebSocketProgramAccountSubscriber('OrderSubscriber', 'user', this.orderSubscriber.driftClient.program, this.orderSubscriber.decodeFn, {
|
|
20
20
|
filters: [(0, memcmp_1.getUserFilter)(), (0, memcmp_1.getNonIdleUserFilter)()],
|
|
21
21
|
commitment: this.commitment,
|
|
22
22
|
}, this.resubOpts);
|
|
@@ -19,12 +19,12 @@ class grpcSubscription {
|
|
|
19
19
|
}
|
|
20
20
|
if (this.grpcConfigs.client === 'laser') {
|
|
21
21
|
this.subscriber =
|
|
22
|
-
await laserProgramAccountSubscriber_1.LaserstreamProgramAccountSubscriber.create(this.grpcConfigs, 'OrderSubscriber', '
|
|
22
|
+
await laserProgramAccountSubscriber_1.LaserstreamProgramAccountSubscriber.create(this.grpcConfigs, 'OrderSubscriber', 'user', this.orderSubscriber.driftClient.program, this.orderSubscriber.decodeFn, {
|
|
23
23
|
filters: [(0, memcmp_1.getUserFilter)(), (0, memcmp_1.getNonIdleUserFilter)()],
|
|
24
24
|
}, this.resubOpts);
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
this.subscriber = await grpcProgramAccountSubscriber_1.grpcProgramAccountSubscriber.create(this.grpcConfigs, 'OrderSubscriber', '
|
|
27
|
+
this.subscriber = await grpcProgramAccountSubscriber_1.grpcProgramAccountSubscriber.create(this.grpcConfigs, 'OrderSubscriber', 'user', this.orderSubscriber.driftClient.program, this.orderSubscriber.decodeFn, {
|
|
28
28
|
filters: [(0, memcmp_1.getUserFilter)(), (0, memcmp_1.getNonIdleUserFilter)()],
|
|
29
29
|
}, this.resubOpts);
|
|
30
30
|
}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OrderSubscriber — streams all open orders across all users from on-chain state.
|
|
3
|
+
* Used by keeper bots and the DLOB to maintain a live view of the full order book
|
|
4
|
+
* without subscribing to every individual User account separately.
|
|
5
|
+
*/
|
|
1
6
|
export * from './OrderSubscriber';
|
|
2
7
|
export * from './types';
|
|
@@ -14,5 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/**
|
|
18
|
+
* OrderSubscriber — streams all open orders across all users from on-chain state.
|
|
19
|
+
* Used by keeper bots and the DLOB to maintain a live view of the full order book
|
|
20
|
+
* without subscribing to every individual User account separately.
|
|
21
|
+
*/
|
|
17
22
|
__exportStar(require("./OrderSubscriber"), exports);
|
|
18
23
|
__exportStar(require("./types"), exports);
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Priority fee estimation strategies for Solana transactions.
|
|
3
|
+
* Implementations: average, EWMA, max-over-slots, max. Injected via DriftClientConfig.
|
|
4
|
+
* Select a strategy based on congestion tolerance vs. cost sensitivity.
|
|
5
|
+
*/
|
|
1
6
|
export * from './averageOverSlotsStrategy';
|
|
2
7
|
export * from './averageStrategy';
|
|
3
8
|
export * from './ewmaStrategy';
|
|
@@ -14,6 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/**
|
|
18
|
+
* Priority fee estimation strategies for Solana transactions.
|
|
19
|
+
* Implementations: average, EWMA, max-over-slots, max. Injected via DriftClientConfig.
|
|
20
|
+
* Select a strategy based on congestion tolerance vs. cost sensitivity.
|
|
21
|
+
*/
|
|
17
22
|
__exportStar(require("./averageOverSlotsStrategy"), exports);
|
|
18
23
|
__exportStar(require("./averageStrategy"), exports);
|
|
19
24
|
__exportStar(require("./ewmaStrategy"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { WormholeCoreBridgeSolana, WORMHOLE_CORE_BRIDGE_SOLANA_IDL, PythSolanaReceiver, PriceUpdateAccount, } from './types';
|
|
1
|
+
export { type WormholeCoreBridgeSolana, WORMHOLE_CORE_BRIDGE_SOLANA_IDL, type PythSolanaReceiver, type PriceUpdateAccount, } from './types';
|
|
2
2
|
export { DEFAULT_WORMHOLE_PROGRAM_ID, DEFAULT_RECEIVER_PROGRAM_ID, } from './constants';
|
|
3
3
|
export { getGuardianSetPda } from './utils';
|
|
4
|
-
export { PythLazerSubscriber, PythLazerPriceFeedArray, } from './pythLazerSubscriber';
|
|
4
|
+
export { PythLazerSubscriber, type PythLazerPriceFeedArray, } from './pythLazerSubscriber';
|
|
@@ -18,7 +18,7 @@ class grpcSignedMsgUserOrdersAccountSubscriber extends signedMsgUserAccountSubsc
|
|
|
18
18
|
async subscribe() {
|
|
19
19
|
if (!this.subscriber) {
|
|
20
20
|
this.subscriber =
|
|
21
|
-
await grpcProgramAccountSubscriber_1.grpcProgramAccountSubscriber.create(this.grpcConfigs, 'SingedMsgUserOrdersAccountMap', '
|
|
21
|
+
await grpcProgramAccountSubscriber_1.grpcProgramAccountSubscriber.create(this.grpcConfigs, 'SingedMsgUserOrdersAccountMap', 'signedMsgUserOrders', this.driftClient.program, this.decodeFn, {
|
|
22
22
|
filters: [(0, memcmp_1.getSignedMsgUserOrdersFilter)()],
|
|
23
23
|
}, this.resubOpts);
|
|
24
24
|
}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Swift / signed-message order infrastructure.
|
|
3
|
+
* Supports off-chain signed order messages that are matched and settled on-chain without
|
|
4
|
+
* a separate place-order transaction. Used for low-latency taker flows.
|
|
5
|
+
* `swiftOrderSubscriber.ts` — subscribes to incoming Swift orders via gRPC or WebSocket.
|
|
6
|
+
* `signedMsgUserAccountSubscriber.ts` — caches signed-message user account state.
|
|
7
|
+
*/
|
|
1
8
|
export * from './swiftOrderSubscriber';
|
|
2
9
|
export * from './signedMsgUserAccountSubscriber';
|
|
3
10
|
export * from './grpcSignedMsgUserAccountSubscriber';
|
|
@@ -14,6 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/**
|
|
18
|
+
* Swift / signed-message order infrastructure.
|
|
19
|
+
* Supports off-chain signed order messages that are matched and settled on-chain without
|
|
20
|
+
* a separate place-order transaction. Used for low-latency taker flows.
|
|
21
|
+
* `swiftOrderSubscriber.ts` — subscribes to incoming Swift orders via gRPC or WebSocket.
|
|
22
|
+
* `signedMsgUserAccountSubscriber.ts` — caches signed-message user account state.
|
|
23
|
+
*/
|
|
17
24
|
__exportStar(require("./swiftOrderSubscriber"), exports);
|
|
18
25
|
__exportStar(require("./signedMsgUserAccountSubscriber"), exports);
|
|
19
26
|
__exportStar(require("./grpcSignedMsgUserAccountSubscriber"), exports);
|
|
@@ -11,7 +11,8 @@ class SignedMsgUserOrdersAccountSubscriber {
|
|
|
11
11
|
this.resubOpts = resubOpts;
|
|
12
12
|
this.driftClient = driftClient;
|
|
13
13
|
this.decodeFn =
|
|
14
|
-
decodeFn !== null && decodeFn !== void 0 ? decodeFn : this.driftClient.program.account.signedMsgUserOrders.coder.accounts.decodeUnchecked.bind(this.driftClient.program.account.signedMsgUserOrders.coder
|
|
14
|
+
decodeFn !== null && decodeFn !== void 0 ? decodeFn : this.driftClient.program.account.signedMsgUserOrders.coder.accounts.decodeUnchecked.bind(this.driftClient.program.account.signedMsgUserOrders.coder
|
|
15
|
+
.accounts);
|
|
15
16
|
this.resyncIntervalMs = resyncIntervalMs;
|
|
16
17
|
this.eventEmitter = new events_1.EventEmitter();
|
|
17
18
|
this.resubOpts = resubOpts;
|
|
@@ -20,7 +21,7 @@ class SignedMsgUserOrdersAccountSubscriber {
|
|
|
20
21
|
if (!this.subscriber) {
|
|
21
22
|
const filters = [(0, memcmp_1.getSignedMsgUserOrdersFilter)()];
|
|
22
23
|
this.subscriber =
|
|
23
|
-
new webSocketProgramAccountSubscriber_1.WebSocketProgramAccountSubscriber('SingedMsgUserOrdersAccountMap', '
|
|
24
|
+
new webSocketProgramAccountSubscriber_1.WebSocketProgramAccountSubscriber('SingedMsgUserOrdersAccountMap', 'signedMsgUserOrders', this.driftClient.program, this.decodeFn, {
|
|
24
25
|
filters,
|
|
25
26
|
commitment: this.commitment,
|
|
26
27
|
}, this.resubOpts);
|
|
@@ -82,7 +83,7 @@ class SignedMsgUserOrdersAccountSubscriber {
|
|
|
82
83
|
this.mostRecentSlot = slot;
|
|
83
84
|
}
|
|
84
85
|
const signedMsgUserOrdersAccount = dataType === 'buffer'
|
|
85
|
-
? this.decodeFn('
|
|
86
|
+
? this.decodeFn('signedMsgUserOrders', data)
|
|
86
87
|
: data;
|
|
87
88
|
const key = signedMsgUserOrdersAccount.authorityPubkey.toBase58();
|
|
88
89
|
const slotAndSignedMsgUserOrdersAccount = this.signedMsgUserOrderAccounts.get(key);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
|
-
import * as anchor from '@coral-xyz/anchor';
|
|
3
|
-
import { AnchorProvider, Program } from '@coral-xyz/anchor';
|
|
2
|
+
import * as anchor from '@coral-xyz/anchor-29';
|
|
3
|
+
import { AnchorProvider, Program } from '@coral-xyz/anchor-29';
|
|
4
4
|
import { Account } from '@solana/spl-token';
|
|
5
5
|
import { ConfirmOptions, Connection, PublicKey, TransactionInstruction, TransactionSignature } from '@solana/web3.js';
|
|
6
6
|
import { IWallet } from './types';
|
|
@@ -27,8 +27,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.TokenFaucet = void 0;
|
|
30
|
-
const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
31
|
-
const
|
|
30
|
+
const anchor = __importStar(require("@coral-xyz/anchor-29"));
|
|
31
|
+
const anchor_29_1 = require("@coral-xyz/anchor-29");
|
|
32
32
|
const spl_token_1 = require("@solana/spl-token");
|
|
33
33
|
const web3_js_1 = require("@solana/web3.js");
|
|
34
34
|
const token_faucet_json_1 = __importDefault(require("./idl/token_faucet.json"));
|
|
@@ -40,11 +40,11 @@ class TokenFaucet {
|
|
|
40
40
|
this.wallet = wallet;
|
|
41
41
|
this.opts = opts || config_1.DEFAULT_CONFIRMATION_OPTS;
|
|
42
42
|
// @ts-ignore
|
|
43
|
-
const provider = new
|
|
43
|
+
const provider = new anchor_29_1.AnchorProvider(context ? context.connection.toConnection() : this.connection,
|
|
44
44
|
// @ts-ignore
|
|
45
45
|
wallet, this.opts);
|
|
46
46
|
this.provider = provider;
|
|
47
|
-
this.program = new
|
|
47
|
+
this.program = new anchor_29_1.Program(token_faucet_json_1.default, programId, provider);
|
|
48
48
|
this.mint = mint;
|
|
49
49
|
}
|
|
50
50
|
async getFaucetConfigPublicKeyAndNonce() {
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transaction building and sending infrastructure.
|
|
3
|
+
*
|
|
4
|
+
* `txHandler.ts` — base class for building versioned/legacy transactions with ALT support.
|
|
5
|
+
* `retryTxSender.ts` — retry loop with confirmation polling (default for most clients).
|
|
6
|
+
* `fastSingleTxSender.ts` — fire-and-forget path for latency-sensitive keeper bots.
|
|
7
|
+
* `priorityFeeCalculator.ts` — computes dynamic priority fees from recent fee estimates.
|
|
8
|
+
* `txParamProcessor.ts` — resolves CU limits and priority fees before send.
|
|
9
|
+
*
|
|
10
|
+
* Transaction sender is injected via DriftClientConfig; swap implementations to tune
|
|
11
|
+
* confirmation strategy without changing instruction-building code.
|
|
12
|
+
*/
|
|
1
13
|
import { AddressLookupTableAccount, BlockhashWithExpiryBlockHeight, Commitment, ConfirmOptions, Connection, Signer, SimulatedTransactionResponse, Transaction, TransactionInstruction, TransactionVersion, VersionedTransaction } from '@solana/web3.js';
|
|
2
14
|
import { DriftClientMetricsEvents, IWallet, MappedRecord, SignedTxData, TxParams } from '../types';
|
|
3
15
|
export declare const COMPUTE_UNITS_DEFAULT = 200000;
|
|
@@ -4,6 +4,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.TxHandler = exports.COMPUTE_UNITS_DEFAULT = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Transaction building and sending infrastructure.
|
|
9
|
+
*
|
|
10
|
+
* `txHandler.ts` — base class for building versioned/legacy transactions with ALT support.
|
|
11
|
+
* `retryTxSender.ts` — retry loop with confirmation polling (default for most clients).
|
|
12
|
+
* `fastSingleTxSender.ts` — fire-and-forget path for latency-sensitive keeper bots.
|
|
13
|
+
* `priorityFeeCalculator.ts` — computes dynamic priority fees from recent fee estimates.
|
|
14
|
+
* `txParamProcessor.ts` — resolves CU limits and priority fees before send.
|
|
15
|
+
*
|
|
16
|
+
* Transaction sender is injected via DriftClientConfig; swap implementations to tune
|
|
17
|
+
* confirmation strategy without changing instruction-building code.
|
|
18
|
+
*/
|
|
7
19
|
const web3_js_1 = require("@solana/web3.js");
|
|
8
20
|
const txParamProcessor_1 = require("./txParamProcessor");
|
|
9
21
|
const bs58_1 = __importDefault(require("bs58"));
|
package/lib/browser/types.d.ts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
/// <reference types="node" />
|
|
4
|
+
/**
|
|
5
|
+
* Shared TypeScript types for the Drift SDK.
|
|
6
|
+
*
|
|
7
|
+
* Contains TypeScript mirrors of all on-chain account structs (UserAccount, PerpMarketAccount,
|
|
8
|
+
* SpotMarketAccount, StateAccount, OracleData, etc.), instruction parameter types (OrderParams,
|
|
9
|
+
* ModifyOrderParams), enums (MarketType, OrderType, PositionDirection, OracleSource), and
|
|
10
|
+
* precision constants used throughout the SDK.
|
|
11
|
+
*
|
|
12
|
+
* The authoritative layout source is `sdk/src/idl/drift.json` (generated from the program).
|
|
13
|
+
* Do not edit struct shapes here without a corresponding on-chain change.
|
|
14
|
+
*/
|
|
4
15
|
import { Keypair, PublicKey, Transaction, TransactionVersion, VersionedTransaction } from '@solana/web3.js';
|
|
5
16
|
import { BN } from '@coral-xyz/anchor';
|
|
6
17
|
export type MappedRecord<A extends Record<string, unknown>, B> = {
|
|
@@ -31,18 +42,6 @@ export declare class MarketStatus {
|
|
|
31
42
|
static readonly ACTIVE: {
|
|
32
43
|
active: {};
|
|
33
44
|
};
|
|
34
|
-
static readonly FUNDING_PAUSED: {
|
|
35
|
-
fundingPaused: {};
|
|
36
|
-
};
|
|
37
|
-
static readonly AMM_PAUSED: {
|
|
38
|
-
ammPaused: {};
|
|
39
|
-
};
|
|
40
|
-
static readonly FILL_PAUSED: {
|
|
41
|
-
fillPaused: {};
|
|
42
|
-
};
|
|
43
|
-
static readonly WITHDRAW_PAUSED: {
|
|
44
|
-
withdrawPaused: {};
|
|
45
|
-
};
|
|
46
45
|
static readonly REDUCE_ONLY: {
|
|
47
46
|
reduceOnly: {};
|
|
48
47
|
};
|
|
@@ -94,12 +93,6 @@ export declare class MarginMode {
|
|
|
94
93
|
static readonly DEFAULT: {
|
|
95
94
|
default: {};
|
|
96
95
|
};
|
|
97
|
-
static readonly HIGH_LEVERAGE: {
|
|
98
|
-
highLeverage: {};
|
|
99
|
-
};
|
|
100
|
-
static readonly HIGH_LEVERAGE_MAINTENANCE: {
|
|
101
|
-
highLeverageMaintenance: {};
|
|
102
|
-
};
|
|
103
96
|
}
|
|
104
97
|
export declare class ContractType {
|
|
105
98
|
static readonly PERPETUAL: {
|
|
@@ -108,9 +101,6 @@ export declare class ContractType {
|
|
|
108
101
|
static readonly FUTURE: {
|
|
109
102
|
future: {};
|
|
110
103
|
};
|
|
111
|
-
static readonly PREDICTION: {
|
|
112
|
-
prediction: {};
|
|
113
|
-
};
|
|
114
104
|
}
|
|
115
105
|
export declare class ContractTier {
|
|
116
106
|
static readonly A: {
|
|
@@ -993,8 +983,6 @@ export type PerpMarketAccount = {
|
|
|
993
983
|
fuelBoostTaker: number;
|
|
994
984
|
fuelBoostMaker: number;
|
|
995
985
|
fuelBoostPosition: number;
|
|
996
|
-
highLeverageMarginRatioInitial: number;
|
|
997
|
-
highLeverageMarginRatioMaintenance: number;
|
|
998
986
|
protectedMakerLimitPriceDivisor: number;
|
|
999
987
|
protectedMakerDynamicDivisor: number;
|
|
1000
988
|
lastFillPrice: BN;
|
|
@@ -1202,7 +1190,6 @@ export type PerpPosition = {
|
|
|
1202
1190
|
remainderBaseAssetAmount: number;
|
|
1203
1191
|
maxMarginRatio: number;
|
|
1204
1192
|
lastQuoteAssetAmountPerLp: BN;
|
|
1205
|
-
perLpBase: number;
|
|
1206
1193
|
positionFlag: number;
|
|
1207
1194
|
isolatedPositionScaledBalance: BN;
|
|
1208
1195
|
};
|
|
@@ -1277,7 +1264,6 @@ export type UserAccount = {
|
|
|
1277
1264
|
openAuctions: number;
|
|
1278
1265
|
hasOpenAuction: boolean;
|
|
1279
1266
|
lastFuelBonusUpdateTs: number;
|
|
1280
|
-
marginMode: MarginMode;
|
|
1281
1267
|
poolId: number;
|
|
1282
1268
|
};
|
|
1283
1269
|
export type SpotPosition = {
|
|
@@ -1392,7 +1378,6 @@ export type ScaleOrderParams = {
|
|
|
1392
1378
|
};
|
|
1393
1379
|
export declare class OrderParamsBitFlag {
|
|
1394
1380
|
static readonly ImmediateOrCancel = 1;
|
|
1395
|
-
static readonly UpdateHighLeverageMode = 2;
|
|
1396
1381
|
}
|
|
1397
1382
|
export declare class PositionFlag {
|
|
1398
1383
|
static readonly IsolatedPosition = 1;
|
|
@@ -1664,11 +1649,6 @@ export type SignedTxData = {
|
|
|
1664
1649
|
lastValidBlockHeight?: number;
|
|
1665
1650
|
blockHash: string;
|
|
1666
1651
|
};
|
|
1667
|
-
export type HighLeverageModeConfig = {
|
|
1668
|
-
maxUsers: number;
|
|
1669
|
-
currentUsers: number;
|
|
1670
|
-
reduceOnly: boolean;
|
|
1671
|
-
};
|
|
1672
1652
|
export type ProtectedMakerModeConfig = {
|
|
1673
1653
|
maxUsers: number;
|
|
1674
1654
|
currentUsers: number;
|
|
@@ -1921,4 +1901,12 @@ export type AccountLiquidatableStatus = {
|
|
|
1921
1901
|
marginRequirement: BN;
|
|
1922
1902
|
totalCollateral: BN;
|
|
1923
1903
|
};
|
|
1904
|
+
export declare class TransferFeeAndPnlPoolDirection {
|
|
1905
|
+
static readonly FEE_TO_PNL_POOL: {
|
|
1906
|
+
feeToPnlPool: {};
|
|
1907
|
+
};
|
|
1908
|
+
static readonly PNL_TO_FEE_POOL: {
|
|
1909
|
+
pnlToFeePool: {};
|
|
1910
|
+
};
|
|
1911
|
+
}
|
|
1924
1912
|
export {};
|
package/lib/browser/types.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PlaceAndTakeOrderSuccessCondition = exports.FuelOverflowStatus = exports.ReferrerStatus = exports.DefaultOrderParams = exports.ModifyOrderPolicy = exports.PositionFlag = exports.OrderParamsBitFlag = exports.SizeDistribution = exports.PostOnlyParams = exports.LiquidationBitFlag = exports.LiquidationType = exports.LPAction = exports.TradeSide = exports.getVariant = exports.isOneOfVariant = exports.isVariant = exports.SettlePnlMode = exports.StakeAction = exports.SpotFulfillmentConfigStatus = exports.SettlePnlExplanation = exports.DepositExplanation = exports.SpotFulfillmentStatus = exports.SpotFulfillmentType = exports.OrderTriggerCondition = exports.OrderActionExplanation = exports.OrderAction = exports.OrderBitFlag = exports.OrderStatus = exports.MarketType = exports.OrderType = exports.OracleSourceNum = exports.OracleSource = exports.DepositDirection = exports.PositionDirection = exports.SpotBalanceType = exports.SwapDirection = exports.TokenProgramFlag = exports.AssetTier = exports.ContractTier = exports.ContractType = exports.MarginMode = exports.MarketConfigFlag = exports.UserStatsPausedOperation = exports.UserStatus = exports.InsuranceFundOperation = exports.SpotOperation = exports.PerpOperation = exports.MarketStatus = exports.FeatureBitFlags = exports.ExchangeStatus = void 0;
|
|
4
|
-
exports.ConstituentLpOperation = exports.ConstituentStatus = exports.OracleValidity = exports.SwapReduceOnly = void 0;
|
|
4
|
+
exports.TransferFeeAndPnlPoolDirection = exports.ConstituentLpOperation = exports.ConstituentStatus = exports.OracleValidity = exports.SwapReduceOnly = void 0;
|
|
5
5
|
const numericConstants_1 = require("./constants/numericConstants");
|
|
6
6
|
// # Utility Types / Enums / Constants
|
|
7
7
|
var ExchangeStatus;
|
|
@@ -29,10 +29,6 @@ class MarketStatus {
|
|
|
29
29
|
exports.MarketStatus = MarketStatus;
|
|
30
30
|
MarketStatus.INITIALIZED = { initialized: {} };
|
|
31
31
|
MarketStatus.ACTIVE = { active: {} };
|
|
32
|
-
MarketStatus.FUNDING_PAUSED = { fundingPaused: {} };
|
|
33
|
-
MarketStatus.AMM_PAUSED = { ammPaused: {} };
|
|
34
|
-
MarketStatus.FILL_PAUSED = { fillPaused: {} };
|
|
35
|
-
MarketStatus.WITHDRAW_PAUSED = { withdrawPaused: {} };
|
|
36
32
|
MarketStatus.REDUCE_ONLY = { reduceOnly: {} };
|
|
37
33
|
MarketStatus.SETTLEMENT = { settlement: {} };
|
|
38
34
|
MarketStatus.DELISTED = { delisted: {} };
|
|
@@ -83,16 +79,11 @@ class MarginMode {
|
|
|
83
79
|
}
|
|
84
80
|
exports.MarginMode = MarginMode;
|
|
85
81
|
MarginMode.DEFAULT = { default: {} };
|
|
86
|
-
MarginMode.HIGH_LEVERAGE = { highLeverage: {} };
|
|
87
|
-
MarginMode.HIGH_LEVERAGE_MAINTENANCE = {
|
|
88
|
-
highLeverageMaintenance: {},
|
|
89
|
-
};
|
|
90
82
|
class ContractType {
|
|
91
83
|
}
|
|
92
84
|
exports.ContractType = ContractType;
|
|
93
85
|
ContractType.PERPETUAL = { perpetual: {} };
|
|
94
86
|
ContractType.FUTURE = { future: {} };
|
|
95
|
-
ContractType.PREDICTION = { prediction: {} };
|
|
96
87
|
class ContractTier {
|
|
97
88
|
}
|
|
98
89
|
exports.ContractTier = ContractTier;
|
|
@@ -388,7 +379,6 @@ class OrderParamsBitFlag {
|
|
|
388
379
|
}
|
|
389
380
|
exports.OrderParamsBitFlag = OrderParamsBitFlag;
|
|
390
381
|
OrderParamsBitFlag.ImmediateOrCancel = 1;
|
|
391
|
-
OrderParamsBitFlag.UpdateHighLeverageMode = 2;
|
|
392
382
|
class PositionFlag {
|
|
393
383
|
}
|
|
394
384
|
exports.PositionFlag = PositionFlag;
|
|
@@ -461,3 +451,8 @@ var ConstituentLpOperation;
|
|
|
461
451
|
ConstituentLpOperation[ConstituentLpOperation["Deposit"] = 2] = "Deposit";
|
|
462
452
|
ConstituentLpOperation[ConstituentLpOperation["Withdraw"] = 4] = "Withdraw";
|
|
463
453
|
})(ConstituentLpOperation || (exports.ConstituentLpOperation = ConstituentLpOperation = {}));
|
|
454
|
+
class TransferFeeAndPnlPoolDirection {
|
|
455
|
+
}
|
|
456
|
+
exports.TransferFeeAndPnlPoolDirection = TransferFeeAndPnlPoolDirection;
|
|
457
|
+
TransferFeeAndPnlPoolDirection.FEE_TO_PNL_POOL = { feeToPnlPool: {} };
|
|
458
|
+
TransferFeeAndPnlPoolDirection.PNL_TO_FEE_POOL = { pnlToFeePool: {} };
|