@drift-labs/sdk 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
|
@@ -4,17 +4,17 @@ import {
|
|
|
4
4
|
TokenAccountEvents,
|
|
5
5
|
TokenAccountSubscriber,
|
|
6
6
|
} from './types';
|
|
7
|
-
import { Program } from '@coral-xyz/anchor';
|
|
8
7
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
9
8
|
import { EventEmitter } from 'events';
|
|
10
9
|
import { PublicKey } from '@solana/web3.js';
|
|
11
10
|
import { BulkAccountLoader } from './bulkAccountLoader';
|
|
12
11
|
import { Account } from '@solana/spl-token';
|
|
13
12
|
import { parseTokenAccount } from '../token';
|
|
13
|
+
import { DriftProgram } from '../config';
|
|
14
14
|
|
|
15
15
|
export class PollingTokenAccountSubscriber implements TokenAccountSubscriber {
|
|
16
16
|
isSubscribed: boolean;
|
|
17
|
-
program:
|
|
17
|
+
program: DriftProgram;
|
|
18
18
|
eventEmitter: StrictEventEmitter<EventEmitter, TokenAccountEvents>;
|
|
19
19
|
publicKey: PublicKey;
|
|
20
20
|
|
|
@@ -75,7 +75,7 @@ export class PollingUserAccountSubscriber implements UserAccountSubscriber {
|
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
const account = this.decode('
|
|
78
|
+
const account = this.decode('user', buffer);
|
|
79
79
|
this.user = { data: account, slot };
|
|
80
80
|
this.eventEmitter.emit('userAccountUpdate', account);
|
|
81
81
|
this.eventEmitter.emit('update');
|
|
@@ -101,7 +101,7 @@ export class PollingUserAccountSubscriber implements UserAccountSubscriber {
|
|
|
101
101
|
);
|
|
102
102
|
if (dataAndContext.context.slot > (this.user?.slot ?? 0)) {
|
|
103
103
|
this.user = {
|
|
104
|
-
data: this.decode('
|
|
104
|
+
data: this.decode('user', dataAndContext.value.data),
|
|
105
105
|
slot: dataAndContext.context.slot,
|
|
106
106
|
};
|
|
107
107
|
}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
UserStatsAccountSubscriber,
|
|
5
5
|
UserStatsAccountEvents,
|
|
6
6
|
} from './types';
|
|
7
|
-
import {
|
|
7
|
+
import { DriftProgram } from '../config';
|
|
8
8
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
9
9
|
import { EventEmitter } from 'events';
|
|
10
10
|
import { PublicKey } from '@solana/web3.js';
|
|
@@ -15,7 +15,7 @@ export class PollingUserStatsAccountSubscriber
|
|
|
15
15
|
implements UserStatsAccountSubscriber
|
|
16
16
|
{
|
|
17
17
|
isSubscribed: boolean;
|
|
18
|
-
program:
|
|
18
|
+
program: DriftProgram;
|
|
19
19
|
eventEmitter: StrictEventEmitter<EventEmitter, UserStatsAccountEvents>;
|
|
20
20
|
userStatsAccountPublicKey: PublicKey;
|
|
21
21
|
|
|
@@ -26,7 +26,7 @@ export class PollingUserStatsAccountSubscriber
|
|
|
26
26
|
userStats?: DataAndSlot<UserStatsAccount>;
|
|
27
27
|
|
|
28
28
|
public constructor(
|
|
29
|
-
program:
|
|
29
|
+
program: DriftProgram,
|
|
30
30
|
userStatsAccountPublicKey: PublicKey,
|
|
31
31
|
accountLoader: BulkAccountLoader
|
|
32
32
|
) {
|
|
@@ -74,11 +74,10 @@ export class PollingUserStatsAccountSubscriber
|
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
const account =
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
);
|
|
77
|
+
const account = this.program.coder.accounts.decodeUnchecked(
|
|
78
|
+
'userStats',
|
|
79
|
+
buffer
|
|
80
|
+
);
|
|
82
81
|
this.userStats = { data: account, slot };
|
|
83
82
|
this.eventEmitter.emit('userStatsAccountUpdate', account);
|
|
84
83
|
this.eventEmitter.emit('update');
|
|
@@ -98,14 +97,15 @@ export class PollingUserStatsAccountSubscriber
|
|
|
98
97
|
|
|
99
98
|
async fetch(): Promise<void> {
|
|
100
99
|
try {
|
|
101
|
-
const dataAndContext =
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
100
|
+
const dataAndContext = await (
|
|
101
|
+
this.program.account as any
|
|
102
|
+
).userStats.fetchAndContext(
|
|
103
|
+
this.userStatsAccountPublicKey,
|
|
104
|
+
this.accountLoader.commitment
|
|
105
|
+
);
|
|
106
106
|
if (dataAndContext.context.slot > (this.userStats?.slot ?? 0)) {
|
|
107
107
|
this.userStats = {
|
|
108
|
-
data: dataAndContext.data as UserStatsAccount,
|
|
108
|
+
data: dataAndContext.data as unknown as UserStatsAccount,
|
|
109
109
|
slot: dataAndContext.context.slot,
|
|
110
110
|
};
|
|
111
111
|
}
|
|
@@ -6,28 +6,26 @@ export class TestBulkAccountLoader extends BulkAccountLoader {
|
|
|
6
6
|
return;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
const accounts = [];
|
|
10
9
|
for (const accountsToLoadChunk of accountsToLoadChunks) {
|
|
11
10
|
for (const accountToLoad of accountsToLoadChunk) {
|
|
12
11
|
const account = await this.connection.getAccountInfoAndContext(
|
|
13
12
|
accountToLoad.publicKey,
|
|
14
13
|
this.commitment
|
|
15
14
|
);
|
|
16
|
-
accounts.push(account);
|
|
17
15
|
const newSlot = account.context.slot;
|
|
18
16
|
if (newSlot > this.mostRecentSlot) {
|
|
19
17
|
this.mostRecentSlot = newSlot;
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
if (accountToLoad.callbacks.size === 0) {
|
|
23
|
-
|
|
21
|
+
continue;
|
|
24
22
|
}
|
|
25
23
|
|
|
26
24
|
const key = accountToLoad.publicKey.toBase58();
|
|
27
25
|
const prev = this.bufferAndSlotMap.get(key);
|
|
28
26
|
|
|
29
27
|
if (prev && newSlot < prev.slot) {
|
|
30
|
-
|
|
28
|
+
continue;
|
|
31
29
|
}
|
|
32
30
|
|
|
33
31
|
let newBuffer: Buffer | undefined = undefined;
|
|
@@ -39,7 +37,7 @@ export class TestBulkAccountLoader extends BulkAccountLoader {
|
|
|
39
37
|
if (!prev) {
|
|
40
38
|
this.bufferAndSlotMap.set(key, { slot: newSlot, buffer: newBuffer });
|
|
41
39
|
this.handleAccountCallbacks(accountToLoad, newBuffer, newSlot);
|
|
42
|
-
|
|
40
|
+
continue;
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
const oldBuffer = prev.buffer;
|
package/src/accounts/types.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account subscription interfaces and types.
|
|
3
|
+
*
|
|
4
|
+
* DriftClient uses a `DriftClientAccountSubscriber` (WebSocket or polling) to keep
|
|
5
|
+
* market, oracle, and state accounts cached in memory. `User` uses a `UserAccountSubscriber`
|
|
6
|
+
* for the individual User account. All subscribers implement the interfaces defined here.
|
|
7
|
+
*
|
|
8
|
+
* Implementations: `webSocketDriftClientAccountSubscriber.ts` (default),
|
|
9
|
+
* `pollingDriftClientAccountSubscriber.ts`, `bulkAccountLoader.ts` (batched RPC).
|
|
10
|
+
*/
|
|
1
11
|
import {
|
|
2
12
|
SpotMarketAccount,
|
|
3
13
|
PerpMarketAccount,
|
|
@@ -7,7 +17,6 @@ import {
|
|
|
7
17
|
UserStatsAccount,
|
|
8
18
|
InsuranceFundStake,
|
|
9
19
|
ConstituentAccount,
|
|
10
|
-
HighLeverageModeConfig,
|
|
11
20
|
} from '../types';
|
|
12
21
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
13
22
|
import { EventEmitter } from 'events';
|
|
@@ -248,30 +257,6 @@ export type LaserGrpcConfigs = BaseGrpcConfigs & {
|
|
|
248
257
|
|
|
249
258
|
export type GrpcConfigs = YellowstoneGrpcConfigs | LaserGrpcConfigs;
|
|
250
259
|
|
|
251
|
-
export interface HighLeverageModeConfigAccountSubscriber {
|
|
252
|
-
eventEmitter: StrictEventEmitter<
|
|
253
|
-
EventEmitter,
|
|
254
|
-
HighLeverageModeConfigAccountEvents
|
|
255
|
-
>;
|
|
256
|
-
isSubscribed: boolean;
|
|
257
|
-
|
|
258
|
-
subscribe(
|
|
259
|
-
highLeverageModeConfigAccount?: HighLeverageModeConfig
|
|
260
|
-
): Promise<boolean>;
|
|
261
|
-
fetch(): Promise<void>;
|
|
262
|
-
unsubscribe(): Promise<void>;
|
|
263
|
-
|
|
264
|
-
getHighLeverageModeConfigAccountAndSlot(): DataAndSlot<HighLeverageModeConfig>;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
export interface HighLeverageModeConfigAccountEvents {
|
|
268
|
-
highLeverageModeConfigAccountUpdate: (
|
|
269
|
-
payload: HighLeverageModeConfig
|
|
270
|
-
) => void;
|
|
271
|
-
update: void;
|
|
272
|
-
error: (e: Error) => void;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
260
|
export interface ConstituentAccountSubscriber {
|
|
276
261
|
eventEmitter: StrictEventEmitter<EventEmitter, ConstituentAccountEvents>;
|
|
277
262
|
isSubscribed: boolean;
|
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
AccountSubscriber,
|
|
5
5
|
ResubOpts,
|
|
6
6
|
} from './types';
|
|
7
|
-
import { AnchorProvider
|
|
7
|
+
import { AnchorProvider } from '@coral-xyz/anchor';
|
|
8
8
|
import { AccountInfo, Commitment, Context, PublicKey } from '@solana/web3.js';
|
|
9
|
-
import {
|
|
9
|
+
import { DriftProgram } from '../config';
|
|
10
10
|
import * as Buffer from 'buffer';
|
|
11
11
|
|
|
12
12
|
export class WebSocketAccountSubscriber<T> implements AccountSubscriber<T> {
|
|
@@ -14,7 +14,7 @@ export class WebSocketAccountSubscriber<T> implements AccountSubscriber<T> {
|
|
|
14
14
|
bufferAndSlot?: BufferAndSlot;
|
|
15
15
|
accountName: string;
|
|
16
16
|
logAccountName: string;
|
|
17
|
-
program:
|
|
17
|
+
program: DriftProgram;
|
|
18
18
|
accountPublicKey: PublicKey;
|
|
19
19
|
decodeBufferFn: (buffer: Buffer) => T;
|
|
20
20
|
onChange: (data: T) => void;
|
|
@@ -31,7 +31,7 @@ export class WebSocketAccountSubscriber<T> implements AccountSubscriber<T> {
|
|
|
31
31
|
|
|
32
32
|
public constructor(
|
|
33
33
|
accountName: string,
|
|
34
|
-
program:
|
|
34
|
+
program: DriftProgram,
|
|
35
35
|
accountPublicKey: PublicKey,
|
|
36
36
|
decodeBuffer?: (buffer: Buffer) => T,
|
|
37
37
|
resubOpts?: ResubOpts,
|
|
@@ -199,7 +199,7 @@ export class WebSocketAccountSubscriber<T> implements AccountSubscriber<T> {
|
|
|
199
199
|
return this.decodeBufferFn(buffer);
|
|
200
200
|
} else {
|
|
201
201
|
return this.program.account[this.accountName].coder.accounts.decode(
|
|
202
|
-
|
|
202
|
+
this.accountName,
|
|
203
203
|
buffer
|
|
204
204
|
);
|
|
205
205
|
}
|
|
@@ -4,7 +4,8 @@ import {
|
|
|
4
4
|
ResubOpts,
|
|
5
5
|
BufferAndSlot,
|
|
6
6
|
} from './types';
|
|
7
|
-
import { AnchorProvider
|
|
7
|
+
import { AnchorProvider } from '@coral-xyz/anchor';
|
|
8
|
+
import { DriftProgram } from '../config';
|
|
8
9
|
import { capitalize } from './utils';
|
|
9
10
|
import {
|
|
10
11
|
AccountInfoBase,
|
|
@@ -74,7 +75,7 @@ export class WebSocketAccountSubscriberV2<T> implements AccountSubscriber<T> {
|
|
|
74
75
|
bufferAndSlot?: BufferAndSlot;
|
|
75
76
|
accountName: string;
|
|
76
77
|
logAccountName: string;
|
|
77
|
-
program:
|
|
78
|
+
program: DriftProgram;
|
|
78
79
|
accountPublicKey: PublicKey;
|
|
79
80
|
decodeBufferFn: (buffer: Buffer) => T;
|
|
80
81
|
onChange: (data: T) => void;
|
|
@@ -112,7 +113,7 @@ export class WebSocketAccountSubscriberV2<T> implements AccountSubscriber<T> {
|
|
|
112
113
|
*/
|
|
113
114
|
public constructor(
|
|
114
115
|
accountName: string,
|
|
115
|
-
program:
|
|
116
|
+
program: DriftProgram,
|
|
116
117
|
accountPublicKey: PublicKey,
|
|
117
118
|
decodeBuffer?: (buffer: Buffer) => T,
|
|
118
119
|
resubOpts?: ResubOpts,
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
ResubOpts,
|
|
9
9
|
} from './types';
|
|
10
10
|
import { PerpMarketAccount, SpotMarketAccount, StateAccount } from '../types';
|
|
11
|
-
import { Program } from '@coral-xyz/anchor';
|
|
12
11
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
13
12
|
import { EventEmitter } from 'events';
|
|
14
13
|
import {
|
|
@@ -24,7 +23,7 @@ import { OracleInfo, OraclePriceData } from '../oracles/types';
|
|
|
24
23
|
import { OracleClientCache } from '../oracles/oracleClientCache';
|
|
25
24
|
import * as Buffer from 'buffer';
|
|
26
25
|
import { QUOTE_ORACLE_PRICE_DATA } from '../oracles/quoteAssetOracleClient';
|
|
27
|
-
import { findAllMarketAndOracles } from '../config';
|
|
26
|
+
import { findAllMarketAndOracles, DriftProgram } from '../config';
|
|
28
27
|
import { findDelistedPerpMarketsAndOracles } from './utils';
|
|
29
28
|
import { getOracleId } from '../oracles/oracleId';
|
|
30
29
|
import { OracleSource } from '../types';
|
|
@@ -39,7 +38,7 @@ export class WebSocketDriftClientAccountSubscriber
|
|
|
39
38
|
implements DriftClientAccountSubscriber
|
|
40
39
|
{
|
|
41
40
|
isSubscribed: boolean;
|
|
42
|
-
program:
|
|
41
|
+
program: DriftProgram;
|
|
43
42
|
commitment?: Commitment;
|
|
44
43
|
perpMarketIndexes: number[];
|
|
45
44
|
spotMarketIndexes: number[];
|
|
@@ -71,7 +70,7 @@ export class WebSocketDriftClientAccountSubscriber
|
|
|
71
70
|
initialOraclePriceData: Map<string, OraclePriceData>;
|
|
72
71
|
customPerpMarketAccountSubscriber?: new (
|
|
73
72
|
accountName: string,
|
|
74
|
-
program:
|
|
73
|
+
program: DriftProgram,
|
|
75
74
|
accountPublicKey: PublicKey,
|
|
76
75
|
decodeBuffer?: (buffer: Buffer) => any,
|
|
77
76
|
resubOpts?: ResubOpts,
|
|
@@ -79,7 +78,7 @@ export class WebSocketDriftClientAccountSubscriber
|
|
|
79
78
|
) => AccountSubscriber<any>;
|
|
80
79
|
customOracleAccountSubscriber?: new (
|
|
81
80
|
accountName: string,
|
|
82
|
-
program:
|
|
81
|
+
program: DriftProgram,
|
|
83
82
|
accountPublicKey: PublicKey,
|
|
84
83
|
decodeBuffer?: (buffer: Buffer) => any,
|
|
85
84
|
resubOpts?: ResubOpts,
|
|
@@ -91,7 +90,7 @@ export class WebSocketDriftClientAccountSubscriber
|
|
|
91
90
|
protected subscriptionPromiseResolver: (val: boolean) => void;
|
|
92
91
|
|
|
93
92
|
public constructor(
|
|
94
|
-
program:
|
|
93
|
+
program: DriftProgram,
|
|
95
94
|
perpMarketIndexes: number[],
|
|
96
95
|
spotMarketIndexes: number[],
|
|
97
96
|
oracleInfos: OracleInfo[],
|
|
@@ -101,7 +100,7 @@ export class WebSocketDriftClientAccountSubscriber
|
|
|
101
100
|
commitment?: Commitment,
|
|
102
101
|
customPerpMarketAccountSubscriber?: new (
|
|
103
102
|
accountName: string,
|
|
104
|
-
program:
|
|
103
|
+
program: DriftProgram,
|
|
105
104
|
accountPublicKey: PublicKey,
|
|
106
105
|
decodeBuffer?: (buffer: Buffer) => any,
|
|
107
106
|
resubOpts?: ResubOpts,
|
|
@@ -109,7 +108,7 @@ export class WebSocketDriftClientAccountSubscriber
|
|
|
109
108
|
) => WebSocketAccountSubscriberV2<any> | WebSocketAccountSubscriber<any>,
|
|
110
109
|
customOracleAccountSubscriber?: new (
|
|
111
110
|
accountName: string,
|
|
112
|
-
program:
|
|
111
|
+
program: DriftProgram,
|
|
113
112
|
accountPublicKey: PublicKey,
|
|
114
113
|
decodeBuffer?: (buffer: Buffer) => any,
|
|
115
114
|
resubOpts?: ResubOpts,
|
|
@@ -238,7 +237,7 @@ export class WebSocketDriftClientAccountSubscriber
|
|
|
238
237
|
.filter((accountInfo) => !!accountInfo)
|
|
239
238
|
.map((accountInfo) => {
|
|
240
239
|
const perpMarket = this.program.coder.accounts.decode(
|
|
241
|
-
'
|
|
240
|
+
'perpMarket',
|
|
242
241
|
accountInfo.data
|
|
243
242
|
);
|
|
244
243
|
return [perpMarket.marketIndex, perpMarket];
|
|
@@ -263,7 +262,7 @@ export class WebSocketDriftClientAccountSubscriber
|
|
|
263
262
|
.filter((accountInfo) => !!accountInfo)
|
|
264
263
|
.map((accountInfo) => {
|
|
265
264
|
const spotMarket = this.program.coder.accounts.decode(
|
|
266
|
-
'
|
|
265
|
+
'spotMarket',
|
|
267
266
|
accountInfo.data
|
|
268
267
|
);
|
|
269
268
|
return [spotMarket.marketIndex, spotMarket];
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
SpotMarketAccount,
|
|
14
14
|
StateAccount,
|
|
15
15
|
} from '../types';
|
|
16
|
-
import { Program } from '@coral-xyz/anchor';
|
|
17
16
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
18
17
|
import { EventEmitter } from 'events';
|
|
19
18
|
import {
|
|
@@ -32,7 +31,7 @@ import {
|
|
|
32
31
|
import { OracleInfo, OraclePriceData } from '../oracles/types';
|
|
33
32
|
import { OracleClientCache } from '../oracles/oracleClientCache';
|
|
34
33
|
import { QUOTE_ORACLE_PRICE_DATA } from '../oracles/quoteAssetOracleClient';
|
|
35
|
-
import { findAllMarketAndOracles } from '../config';
|
|
34
|
+
import { DriftProgram, findAllMarketAndOracles } from '../config';
|
|
36
35
|
import { findDelistedPerpMarketsAndOracles } from './utils';
|
|
37
36
|
import {
|
|
38
37
|
getOracleId,
|
|
@@ -54,7 +53,7 @@ export class WebSocketDriftClientAccountSubscriberV2
|
|
|
54
53
|
implements DriftClientAccountSubscriber
|
|
55
54
|
{
|
|
56
55
|
isSubscribed: boolean;
|
|
57
|
-
program:
|
|
56
|
+
program: DriftProgram;
|
|
58
57
|
commitment?: Commitment;
|
|
59
58
|
perpMarketIndexes: number[];
|
|
60
59
|
spotMarketIndexes: number[];
|
|
@@ -97,7 +96,7 @@ export class WebSocketDriftClientAccountSubscriberV2
|
|
|
97
96
|
string;
|
|
98
97
|
|
|
99
98
|
public constructor(
|
|
100
|
-
program:
|
|
99
|
+
program: DriftProgram,
|
|
101
100
|
perpMarketIndexes: number[],
|
|
102
101
|
spotMarketIndexes: number[],
|
|
103
102
|
oracleInfos: OracleInfo[],
|
|
@@ -203,10 +202,12 @@ export class WebSocketDriftClientAccountSubscriberV2
|
|
|
203
202
|
this.perpMarketAllAccountsSubscriber =
|
|
204
203
|
new WebSocketProgramAccountsSubscriberV2<PerpMarketAccount>(
|
|
205
204
|
'PerpMarketAccountsSubscriber',
|
|
206
|
-
'
|
|
205
|
+
'perpMarket',
|
|
207
206
|
this.program,
|
|
208
|
-
|
|
209
|
-
this.program.account
|
|
207
|
+
(
|
|
208
|
+
this.program.account as any
|
|
209
|
+
).perpMarket.coder.accounts.decodeUnchecked.bind(
|
|
210
|
+
(this.program.account as any).perpMarket.coder.accounts
|
|
210
211
|
),
|
|
211
212
|
{
|
|
212
213
|
filters: [getPerpMarketAccountsFilter()],
|
|
@@ -219,10 +220,12 @@ export class WebSocketDriftClientAccountSubscriberV2
|
|
|
219
220
|
this.spotMarketAllAccountsSubscriber =
|
|
220
221
|
new WebSocketProgramAccountsSubscriberV2<SpotMarketAccount>(
|
|
221
222
|
'SpotMarketAccountsSubscriber',
|
|
222
|
-
'
|
|
223
|
+
'spotMarket',
|
|
223
224
|
this.program,
|
|
224
|
-
|
|
225
|
-
this.program.account
|
|
225
|
+
(
|
|
226
|
+
this.program.account as any
|
|
227
|
+
).spotMarket.coder.accounts.decodeUnchecked.bind(
|
|
228
|
+
(this.program.account as any).spotMarket.coder.accounts
|
|
226
229
|
),
|
|
227
230
|
{
|
|
228
231
|
filters: [getSpotMarketAccountsFilter()],
|
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
InsuranceFundStakeAccountEvents,
|
|
6
6
|
InsuranceFundStakeAccountSubscriber,
|
|
7
7
|
} from './types';
|
|
8
|
-
import { Program } from '@coral-xyz/anchor';
|
|
9
8
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
10
9
|
import { EventEmitter } from 'events';
|
|
11
10
|
import { Commitment, PublicKey } from '@solana/web3.js';
|
|
12
11
|
import { WebSocketAccountSubscriber } from './webSocketAccountSubscriber';
|
|
13
12
|
import { InsuranceFundStake } from '../types';
|
|
13
|
+
import { DriftProgram } from '../config';
|
|
14
14
|
|
|
15
15
|
export class WebSocketInsuranceFundStakeAccountSubscriber
|
|
16
16
|
implements InsuranceFundStakeAccountSubscriber
|
|
@@ -18,7 +18,7 @@ export class WebSocketInsuranceFundStakeAccountSubscriber
|
|
|
18
18
|
isSubscribed: boolean;
|
|
19
19
|
resubTimeoutMs?: number;
|
|
20
20
|
commitment?: Commitment;
|
|
21
|
-
program:
|
|
21
|
+
program: DriftProgram;
|
|
22
22
|
eventEmitter: StrictEventEmitter<
|
|
23
23
|
EventEmitter,
|
|
24
24
|
InsuranceFundStakeAccountEvents
|
|
@@ -28,7 +28,7 @@ export class WebSocketInsuranceFundStakeAccountSubscriber
|
|
|
28
28
|
insuranceFundStakeDataAccountSubscriber: AccountSubscriber<InsuranceFundStake>;
|
|
29
29
|
|
|
30
30
|
public constructor(
|
|
31
|
-
program:
|
|
31
|
+
program: DriftProgram,
|
|
32
32
|
insuranceFundStakeAccountPublicKey: PublicKey,
|
|
33
33
|
resubTimeoutMs?: number,
|
|
34
34
|
commitment?: Commitment
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BufferAndSlot, ProgramAccountSubscriber, ResubOpts } from './types';
|
|
2
|
-
import { AnchorProvider
|
|
2
|
+
import { AnchorProvider } from '@coral-xyz/anchor';
|
|
3
3
|
import {
|
|
4
4
|
Commitment,
|
|
5
5
|
Context,
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
MemcmpFilter,
|
|
8
8
|
PublicKey,
|
|
9
9
|
} from '@solana/web3.js';
|
|
10
|
+
import { DriftProgram } from '../config';
|
|
10
11
|
import * as Buffer from 'buffer';
|
|
11
12
|
|
|
12
13
|
export class WebSocketProgramAccountSubscriber<T>
|
|
@@ -16,7 +17,7 @@ export class WebSocketProgramAccountSubscriber<T>
|
|
|
16
17
|
accountDiscriminator: string;
|
|
17
18
|
bufferAndSlot?: BufferAndSlot;
|
|
18
19
|
bufferAndSlotMap: Map<string, BufferAndSlot> = new Map();
|
|
19
|
-
program:
|
|
20
|
+
program: DriftProgram;
|
|
20
21
|
decodeBuffer: (accountName: string, ix: Buffer) => T;
|
|
21
22
|
onChange: (
|
|
22
23
|
accountId: PublicKey,
|
|
@@ -35,7 +36,7 @@ export class WebSocketProgramAccountSubscriber<T>
|
|
|
35
36
|
public constructor(
|
|
36
37
|
subscriptionName: string,
|
|
37
38
|
accountDiscriminator: string,
|
|
38
|
-
program:
|
|
39
|
+
program: DriftProgram,
|
|
39
40
|
decodeBufferFn: (accountName: string, ix: Buffer) => T,
|
|
40
41
|
options: { filters: MemcmpFilter[]; commitment?: Commitment } = {
|
|
41
42
|
filters: [],
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BufferAndSlot, ProgramAccountSubscriber, ResubOpts } from './types';
|
|
2
|
-
import { AnchorProvider
|
|
2
|
+
import { AnchorProvider } from '@coral-xyz/anchor';
|
|
3
|
+
import { DriftProgram } from '../config';
|
|
3
4
|
import { Commitment, Context, MemcmpFilter, PublicKey } from '@solana/web3.js';
|
|
4
5
|
import {
|
|
5
6
|
AccountInfoBase,
|
|
@@ -98,7 +99,7 @@ export class WebSocketProgramAccountsSubscriberV2<T>
|
|
|
98
99
|
subscriptionName: string;
|
|
99
100
|
accountDiscriminator: string;
|
|
100
101
|
bufferAndSlotMap: Map<string, BufferAndSlot> = new Map();
|
|
101
|
-
program:
|
|
102
|
+
program: DriftProgram;
|
|
102
103
|
decodeBuffer: (accountName: string, ix: Buffer) => T;
|
|
103
104
|
onChange: (
|
|
104
105
|
accountId: PublicKey,
|
|
@@ -142,7 +143,7 @@ export class WebSocketProgramAccountsSubscriberV2<T>
|
|
|
142
143
|
public constructor(
|
|
143
144
|
subscriptionName: string,
|
|
144
145
|
accountDiscriminator: string,
|
|
145
|
-
program:
|
|
146
|
+
program: DriftProgram,
|
|
146
147
|
decodeBufferFn: (accountName: string, ix: Buffer) => T,
|
|
147
148
|
options: { filters: MemcmpFilter[]; commitment?: Commitment } = {
|
|
148
149
|
filters: [],
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BufferAndSlot, ProgramAccountSubscriber, ResubOpts } from './types';
|
|
2
|
-
import { AnchorProvider
|
|
2
|
+
import { AnchorProvider } from '@coral-xyz/anchor';
|
|
3
|
+
import { DriftProgram } from '../config';
|
|
3
4
|
import { Commitment, Context, MemcmpFilter, PublicKey } from '@solana/web3.js';
|
|
4
5
|
import {
|
|
5
6
|
AccountInfoBase,
|
|
@@ -98,7 +99,7 @@ export class WebSocketProgramAccountsSubscriberV2<T>
|
|
|
98
99
|
subscriptionName: string;
|
|
99
100
|
accountDiscriminator: string;
|
|
100
101
|
bufferAndSlotMap: Map<string, BufferAndSlot> = new Map();
|
|
101
|
-
program:
|
|
102
|
+
program: DriftProgram;
|
|
102
103
|
decodeBuffer: (accountName: string, ix: Buffer) => T;
|
|
103
104
|
onChange: (
|
|
104
105
|
accountId: PublicKey,
|
|
@@ -142,7 +143,7 @@ export class WebSocketProgramAccountsSubscriberV2<T>
|
|
|
142
143
|
public constructor(
|
|
143
144
|
subscriptionName: string,
|
|
144
145
|
accountDiscriminator: string,
|
|
145
|
-
program:
|
|
146
|
+
program: DriftProgram,
|
|
146
147
|
decodeBufferFn: (accountName: string, ix: Buffer) => T,
|
|
147
148
|
options: { filters: MemcmpFilter[]; commitment?: Commitment } = {
|
|
148
149
|
filters: [],
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
UserAccountSubscriber,
|
|
7
7
|
ResubOpts,
|
|
8
8
|
} from './types';
|
|
9
|
-
import {
|
|
9
|
+
import { DriftProgram } from '../config';
|
|
10
10
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
11
11
|
import { EventEmitter } from 'events';
|
|
12
12
|
import { Commitment, PublicKey } from '@solana/web3.js';
|
|
@@ -17,14 +17,14 @@ export class WebSocketUserAccountSubscriber implements UserAccountSubscriber {
|
|
|
17
17
|
isSubscribed: boolean;
|
|
18
18
|
resubOpts?: ResubOpts;
|
|
19
19
|
commitment?: Commitment;
|
|
20
|
-
program:
|
|
20
|
+
program: DriftProgram;
|
|
21
21
|
eventEmitter: StrictEventEmitter<EventEmitter, UserAccountEvents>;
|
|
22
22
|
userAccountPublicKey: PublicKey;
|
|
23
23
|
|
|
24
24
|
userDataAccountSubscriber: AccountSubscriber<UserAccount>;
|
|
25
25
|
|
|
26
26
|
public constructor(
|
|
27
|
-
program:
|
|
27
|
+
program: DriftProgram,
|
|
28
28
|
userAccountPublicKey: PublicKey,
|
|
29
29
|
resubOpts?: ResubOpts,
|
|
30
30
|
commitment?: Commitment
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
UserStatsAccountEvents,
|
|
7
7
|
ResubOpts,
|
|
8
8
|
} from './types';
|
|
9
|
-
import {
|
|
9
|
+
import { DriftProgram } from '../config';
|
|
10
10
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
11
11
|
import { EventEmitter } from 'events';
|
|
12
12
|
import { Commitment, PublicKey } from '@solana/web3.js';
|
|
@@ -19,14 +19,14 @@ export class WebSocketUserStatsAccountSubscriber
|
|
|
19
19
|
isSubscribed: boolean;
|
|
20
20
|
resubOpts?: ResubOpts;
|
|
21
21
|
commitment?: Commitment;
|
|
22
|
-
program:
|
|
22
|
+
program: DriftProgram;
|
|
23
23
|
eventEmitter: StrictEventEmitter<EventEmitter, UserStatsAccountEvents>;
|
|
24
24
|
userStatsAccountPublicKey: PublicKey;
|
|
25
25
|
|
|
26
26
|
userStatsAccountSubscriber: AccountSubscriber<UserStatsAccount>;
|
|
27
27
|
|
|
28
28
|
public constructor(
|
|
29
|
-
program:
|
|
29
|
+
program: DriftProgram,
|
|
30
30
|
userStatsAccountPublicKey: PublicKey,
|
|
31
31
|
resubOpts?: ResubOpts,
|
|
32
32
|
commitment?: Commitment
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
UserAccountEvents,
|
|
5
5
|
UserAccountSubscriber,
|
|
6
6
|
} from './types';
|
|
7
|
-
import {
|
|
7
|
+
import { DriftProgram } from '../config';
|
|
8
8
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
9
9
|
import { EventEmitter } from 'events';
|
|
10
10
|
import { Context, PublicKey } from '@solana/web3.js';
|
|
@@ -18,12 +18,12 @@ export class WebSocketProgramUserAccountSubscriber
|
|
|
18
18
|
eventEmitter: StrictEventEmitter<EventEmitter, UserAccountEvents>;
|
|
19
19
|
|
|
20
20
|
private userAccountPublicKey: PublicKey;
|
|
21
|
-
private program:
|
|
21
|
+
private program: DriftProgram;
|
|
22
22
|
private programSubscriber: WebSocketProgramAccountSubscriber<UserAccount>;
|
|
23
23
|
private userAccountAndSlot?: DataAndSlot<UserAccount>;
|
|
24
24
|
|
|
25
25
|
public constructor(
|
|
26
|
-
program:
|
|
26
|
+
program: DriftProgram,
|
|
27
27
|
userAccountPublicKey: PublicKey,
|
|
28
28
|
programSubscriber: WebSocketProgramAccountSubscriber<UserAccount>
|
|
29
29
|
) {
|
|
@@ -66,7 +66,7 @@ export class WebSocketProgramUserAccountSubscriber
|
|
|
66
66
|
);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
const account = await this.program.account.user.fetch(
|
|
69
|
+
const account = await (this.program.account as any).user.fetch(
|
|
70
70
|
this.userAccountPublicKey
|
|
71
71
|
);
|
|
72
72
|
this.updateData(account as UserAccount, 0);
|
package/src/addresses/pda.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PDA derivation helpers for all Drift protocol accounts.
|
|
3
|
+
* Covers: User, UserStats, PerpMarket, SpotMarket, InsuranceFundStake,
|
|
4
|
+
* ProtectedMakerModeConfig, HighLeverageModeConfig, State, and vault PDAs.
|
|
5
|
+
* All functions are pure (no RPC calls).
|
|
6
|
+
*/
|
|
1
7
|
import { PublicKey } from '@solana/web3.js';
|
|
2
8
|
import * as anchor from '@coral-xyz/anchor';
|
|
3
9
|
import { BN } from '@coral-xyz/anchor';
|
|
@@ -323,19 +329,6 @@ export function getPrelaunchOraclePublicKey(
|
|
|
323
329
|
)[0];
|
|
324
330
|
}
|
|
325
331
|
|
|
326
|
-
export function getPythPullOraclePublicKey(
|
|
327
|
-
progarmId: PublicKey,
|
|
328
|
-
feedId: Uint8Array
|
|
329
|
-
): PublicKey {
|
|
330
|
-
return PublicKey.findProgramAddressSync(
|
|
331
|
-
[
|
|
332
|
-
Buffer.from(anchor.utils.bytes.utf8.encode('pyth_pull')),
|
|
333
|
-
Buffer.from(feedId),
|
|
334
|
-
],
|
|
335
|
-
progarmId
|
|
336
|
-
)[0];
|
|
337
|
-
}
|
|
338
|
-
|
|
339
332
|
export function getPythLazerOraclePublicKey(
|
|
340
333
|
progarmId: PublicKey,
|
|
341
334
|
feedId: number
|
|
@@ -362,15 +355,6 @@ export function getTokenProgramForSpotMarket(
|
|
|
362
355
|
return TOKEN_PROGRAM_ID;
|
|
363
356
|
}
|
|
364
357
|
|
|
365
|
-
export function getHighLeverageModeConfigPublicKey(
|
|
366
|
-
programId: PublicKey
|
|
367
|
-
): PublicKey {
|
|
368
|
-
return PublicKey.findProgramAddressSync(
|
|
369
|
-
[Buffer.from(anchor.utils.bytes.utf8.encode('high_leverage_mode_config'))],
|
|
370
|
-
programId
|
|
371
|
-
)[0];
|
|
372
|
-
}
|
|
373
|
-
|
|
374
358
|
export function getProtectedMakerModeConfigPublicKey(
|
|
375
359
|
programId: PublicKey
|
|
376
360
|
): PublicKey {
|