@drift-labs/sdk-browser 2.162.0-beta.2 → 2.163.0-beta.9
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 +25708 -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 +25709 -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 +25708 -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/src/adminClient.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AdminClient — governance and protocol administration instruction builders.
|
|
3
|
+
* Extends {@link DriftClient}; all trading/keeper methods are also available.
|
|
4
|
+
*
|
|
5
|
+
* Covers: perp/spot market initialization and updates, oracle guard rail config,
|
|
6
|
+
* fee structure updates, insurance fund operations, vault management, IF rebalancing,
|
|
7
|
+
* pause/unpause exchange, and all ~126 admin instruction handlers in `instructions/admin.rs`.
|
|
8
|
+
*/
|
|
1
9
|
import {
|
|
2
10
|
AddressLookupTableAccount,
|
|
3
11
|
Keypair,
|
|
@@ -24,6 +32,7 @@ import {
|
|
|
24
32
|
InitializeConstituentParams,
|
|
25
33
|
ConstituentStatus,
|
|
26
34
|
LPPoolAccount,
|
|
35
|
+
TransferFeeAndPnlPoolDirection,
|
|
27
36
|
} from './types';
|
|
28
37
|
import { DEFAULT_MARKET_NAME, encodeName } from './userName';
|
|
29
38
|
import { BN } from '@coral-xyz/anchor';
|
|
@@ -41,7 +50,6 @@ import {
|
|
|
41
50
|
getPrelaunchOraclePublicKey,
|
|
42
51
|
getOpenbookV2FulfillmentConfigPublicKey,
|
|
43
52
|
getUserStatsAccountPublicKey,
|
|
44
|
-
getHighLeverageModeConfigPublicKey,
|
|
45
53
|
getPythLazerOraclePublicKey,
|
|
46
54
|
getProtectedMakerModeConfigPublicKey,
|
|
47
55
|
getFuelOverflowAccountPublicKey,
|
|
@@ -538,7 +546,7 @@ export class AdminClient extends DriftClient {
|
|
|
538
546
|
quoteAssetReserve: BN,
|
|
539
547
|
periodicity: BN,
|
|
540
548
|
pegMultiplier: BN = PEG_PRECISION,
|
|
541
|
-
oracleSource: OracleSource = OracleSource.
|
|
549
|
+
oracleSource: OracleSource = OracleSource.PYTH_LAZER,
|
|
542
550
|
contractTier: ContractTier = ContractTier.SPECULATIVE,
|
|
543
551
|
marginRatioInitial = 2000,
|
|
544
552
|
marginRatioMaintenance = 500,
|
|
@@ -616,7 +624,7 @@ export class AdminClient extends DriftClient {
|
|
|
616
624
|
quoteAssetReserve: BN,
|
|
617
625
|
periodicity: BN,
|
|
618
626
|
pegMultiplier: BN = PEG_PRECISION,
|
|
619
|
-
oracleSource: OracleSource = OracleSource.
|
|
627
|
+
oracleSource: OracleSource = OracleSource.PYTH_LAZER,
|
|
620
628
|
contractTier: ContractTier = ContractTier.SPECULATIVE,
|
|
621
629
|
marginRatioInitial = 2000,
|
|
622
630
|
marginRatioMaintenance = 500,
|
|
@@ -881,7 +889,7 @@ export class AdminClient extends DriftClient {
|
|
|
881
889
|
}
|
|
882
890
|
|
|
883
891
|
public async getResetAmmCacheIx(): Promise<TransactionInstruction> {
|
|
884
|
-
return this.program.instruction.resetAmmCache({
|
|
892
|
+
return (this.program.instruction as any).resetAmmCache({
|
|
885
893
|
accounts: {
|
|
886
894
|
state: await this.getStatePublicKey(),
|
|
887
895
|
admin: this.useHotWalletAdmin
|
|
@@ -893,36 +901,6 @@ export class AdminClient extends DriftClient {
|
|
|
893
901
|
});
|
|
894
902
|
}
|
|
895
903
|
|
|
896
|
-
public async initializePredictionMarket(
|
|
897
|
-
perpMarketIndex: number
|
|
898
|
-
): Promise<TransactionSignature> {
|
|
899
|
-
const updatePerpMarketConcentrationCoefIx =
|
|
900
|
-
await this.getInitializePredictionMarketIx(perpMarketIndex);
|
|
901
|
-
|
|
902
|
-
const tx = await this.buildTransaction(updatePerpMarketConcentrationCoefIx);
|
|
903
|
-
|
|
904
|
-
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
905
|
-
|
|
906
|
-
return txSig;
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
public async getInitializePredictionMarketIx(
|
|
910
|
-
perpMarketIndex: number
|
|
911
|
-
): Promise<TransactionInstruction> {
|
|
912
|
-
return await this.program.instruction.initializePredictionMarket({
|
|
913
|
-
accounts: {
|
|
914
|
-
state: await this.getStatePublicKey(),
|
|
915
|
-
admin: this.isSubscribed
|
|
916
|
-
? this.getStateAccount().admin
|
|
917
|
-
: this.wallet.publicKey,
|
|
918
|
-
perpMarket: await getPerpMarketPublicKey(
|
|
919
|
-
this.program.programId,
|
|
920
|
-
perpMarketIndex
|
|
921
|
-
),
|
|
922
|
-
},
|
|
923
|
-
});
|
|
924
|
-
}
|
|
925
|
-
|
|
926
904
|
public async deleteInitializedPerpMarket(
|
|
927
905
|
marketIndex: number
|
|
928
906
|
): Promise<TransactionSignature> {
|
|
@@ -1723,21 +1701,20 @@ export class AdminClient extends DriftClient {
|
|
|
1723
1701
|
perpMarketIndex: number,
|
|
1724
1702
|
targetBaseAssetAmountPerLP: number
|
|
1725
1703
|
): Promise<TransactionInstruction> {
|
|
1726
|
-
return await
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
);
|
|
1704
|
+
return await (
|
|
1705
|
+
this.program.instruction as any
|
|
1706
|
+
).updatePerpMarketTargetBaseAssetAmountPerLp(targetBaseAssetAmountPerLP, {
|
|
1707
|
+
accounts: {
|
|
1708
|
+
admin: this.isSubscribed
|
|
1709
|
+
? this.getStateAccount().admin
|
|
1710
|
+
: this.wallet.publicKey,
|
|
1711
|
+
state: await this.getStatePublicKey(),
|
|
1712
|
+
perpMarket: await getPerpMarketPublicKey(
|
|
1713
|
+
this.program.programId,
|
|
1714
|
+
perpMarketIndex
|
|
1715
|
+
),
|
|
1716
|
+
},
|
|
1717
|
+
});
|
|
1741
1718
|
}
|
|
1742
1719
|
|
|
1743
1720
|
public async updatePerpMarketMarginRatio(
|
|
@@ -1782,50 +1759,6 @@ export class AdminClient extends DriftClient {
|
|
|
1782
1759
|
);
|
|
1783
1760
|
}
|
|
1784
1761
|
|
|
1785
|
-
public async updatePerpMarketHighLeverageMarginRatio(
|
|
1786
|
-
perpMarketIndex: number,
|
|
1787
|
-
marginRatioInitial: number,
|
|
1788
|
-
marginRatioMaintenance: number
|
|
1789
|
-
): Promise<TransactionSignature> {
|
|
1790
|
-
const updatePerpMarketHighLeverageMarginRatioIx =
|
|
1791
|
-
await this.getUpdatePerpMarketHighLeverageMarginRatioIx(
|
|
1792
|
-
perpMarketIndex,
|
|
1793
|
-
marginRatioInitial,
|
|
1794
|
-
marginRatioMaintenance
|
|
1795
|
-
);
|
|
1796
|
-
|
|
1797
|
-
const tx = await this.buildTransaction(
|
|
1798
|
-
updatePerpMarketHighLeverageMarginRatioIx
|
|
1799
|
-
);
|
|
1800
|
-
|
|
1801
|
-
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1802
|
-
|
|
1803
|
-
return txSig;
|
|
1804
|
-
}
|
|
1805
|
-
|
|
1806
|
-
public async getUpdatePerpMarketHighLeverageMarginRatioIx(
|
|
1807
|
-
perpMarketIndex: number,
|
|
1808
|
-
marginRatioInitial: number,
|
|
1809
|
-
marginRatioMaintenance: number
|
|
1810
|
-
): Promise<TransactionInstruction> {
|
|
1811
|
-
return await this.program.instruction.updatePerpMarketHighLeverageMarginRatio(
|
|
1812
|
-
marginRatioInitial,
|
|
1813
|
-
marginRatioMaintenance,
|
|
1814
|
-
{
|
|
1815
|
-
accounts: {
|
|
1816
|
-
admin: this.isSubscribed
|
|
1817
|
-
? this.getStateAccount().admin
|
|
1818
|
-
: this.wallet.publicKey,
|
|
1819
|
-
state: await this.getStatePublicKey(),
|
|
1820
|
-
perpMarket: await getPerpMarketPublicKey(
|
|
1821
|
-
this.program.programId,
|
|
1822
|
-
perpMarketIndex
|
|
1823
|
-
),
|
|
1824
|
-
},
|
|
1825
|
-
}
|
|
1826
|
-
);
|
|
1827
|
-
}
|
|
1828
|
-
|
|
1829
1762
|
public async updatePerpMarketImfFactor(
|
|
1830
1763
|
perpMarketIndex: number,
|
|
1831
1764
|
imfFactor: number,
|
|
@@ -2067,15 +2000,18 @@ export class AdminClient extends DriftClient {
|
|
|
2067
2000
|
perpMarketIndex
|
|
2068
2001
|
);
|
|
2069
2002
|
|
|
2070
|
-
return await this.program.instruction.updatePerpMarketPerLpBase(
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
: this.
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2003
|
+
return await (this.program.instruction as any).updatePerpMarketPerLpBase(
|
|
2004
|
+
perLpBase,
|
|
2005
|
+
{
|
|
2006
|
+
accounts: {
|
|
2007
|
+
admin: this.isSubscribed
|
|
2008
|
+
? this.getStateAccount().admin
|
|
2009
|
+
: this.wallet.publicKey,
|
|
2010
|
+
state: await this.getStatePublicKey(),
|
|
2011
|
+
perpMarket: perpMarketPublicKey,
|
|
2012
|
+
},
|
|
2013
|
+
}
|
|
2014
|
+
);
|
|
2079
2015
|
}
|
|
2080
2016
|
|
|
2081
2017
|
public async updatePerpMarketMaxSpread(
|
|
@@ -2667,14 +2603,17 @@ export class AdminClient extends DriftClient {
|
|
|
2667
2603
|
public async getUpdateLpCooldownTimeIx(
|
|
2668
2604
|
cooldownTime: BN
|
|
2669
2605
|
): Promise<TransactionInstruction> {
|
|
2670
|
-
return await this.program.instruction.updateLpCooldownTime(
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
: this.
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2606
|
+
return await (this.program.instruction as any).updateLpCooldownTime(
|
|
2607
|
+
cooldownTime,
|
|
2608
|
+
{
|
|
2609
|
+
accounts: {
|
|
2610
|
+
admin: this.isSubscribed
|
|
2611
|
+
? this.getStateAccount().admin
|
|
2612
|
+
: this.wallet.publicKey,
|
|
2613
|
+
state: await this.getStatePublicKey(),
|
|
2614
|
+
},
|
|
2615
|
+
}
|
|
2616
|
+
);
|
|
2678
2617
|
}
|
|
2679
2618
|
|
|
2680
2619
|
public async updatePerpMarketOracle(
|
|
@@ -3180,14 +3119,17 @@ export class AdminClient extends DriftClient {
|
|
|
3180
3119
|
public async getUpdateWhitelistMintIx(
|
|
3181
3120
|
whitelistMint?: PublicKey
|
|
3182
3121
|
): Promise<TransactionInstruction> {
|
|
3183
|
-
return await this.program.instruction.updateWhitelistMint(
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
: this.
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3122
|
+
return await (this.program.instruction as any).updateWhitelistMint(
|
|
3123
|
+
whitelistMint,
|
|
3124
|
+
{
|
|
3125
|
+
accounts: {
|
|
3126
|
+
admin: this.isSubscribed
|
|
3127
|
+
? this.getStateAccount().admin
|
|
3128
|
+
: this.wallet.publicKey,
|
|
3129
|
+
state: await this.getStatePublicKey(),
|
|
3130
|
+
},
|
|
3131
|
+
}
|
|
3132
|
+
);
|
|
3191
3133
|
}
|
|
3192
3134
|
|
|
3193
3135
|
public async updateDiscountMint(
|
|
@@ -3518,7 +3460,7 @@ export class AdminClient extends DriftClient {
|
|
|
3518
3460
|
perpMarketIndex: number,
|
|
3519
3461
|
contractTier: ContractTier
|
|
3520
3462
|
): Promise<TransactionInstruction> {
|
|
3521
|
-
return await this.program.instruction.updatePerpMarketContractTier(
|
|
3463
|
+
return await (this.program.instruction as any).updatePerpMarketContractTier(
|
|
3522
3464
|
contractTier,
|
|
3523
3465
|
{
|
|
3524
3466
|
accounts: {
|
|
@@ -3681,7 +3623,7 @@ export class AdminClient extends DriftClient {
|
|
|
3681
3623
|
perpMarketIndex: number,
|
|
3682
3624
|
maxSlippageRatio: number
|
|
3683
3625
|
): Promise<TransactionInstruction> {
|
|
3684
|
-
return await this.program.instruction.updateMaxSlippageRatio(
|
|
3626
|
+
return await (this.program.instruction as any).updateMaxSlippageRatio(
|
|
3685
3627
|
maxSlippageRatio,
|
|
3686
3628
|
{
|
|
3687
3629
|
accounts: {
|
|
@@ -3956,7 +3898,7 @@ export class AdminClient extends DriftClient {
|
|
|
3956
3898
|
public async getUpdateSerumVaultIx(
|
|
3957
3899
|
srmVault: PublicKey
|
|
3958
3900
|
): Promise<TransactionInstruction> {
|
|
3959
|
-
return await this.program.instruction.updateSerumVault(srmVault, {
|
|
3901
|
+
return await (this.program.instruction as any).updateSerumVault(srmVault, {
|
|
3960
3902
|
accounts: {
|
|
3961
3903
|
admin: this.isSubscribed
|
|
3962
3904
|
? this.getStateAccount().admin
|
|
@@ -4065,20 +4007,20 @@ export class AdminClient extends DriftClient {
|
|
|
4065
4007
|
}
|
|
4066
4008
|
|
|
4067
4009
|
public async getInitializeProtocolIfSharesTransferConfigIx(): Promise<TransactionInstruction> {
|
|
4068
|
-
return await
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
}
|
|
4081
|
-
);
|
|
4010
|
+
return await (
|
|
4011
|
+
this.program.instruction as any
|
|
4012
|
+
).initializeProtocolIfSharesTransferConfig({
|
|
4013
|
+
accounts: {
|
|
4014
|
+
admin: this.isSubscribed
|
|
4015
|
+
? this.getStateAccount().admin
|
|
4016
|
+
: this.wallet.publicKey,
|
|
4017
|
+
state: await this.getStatePublicKey(),
|
|
4018
|
+
rent: SYSVAR_RENT_PUBKEY,
|
|
4019
|
+
systemProgram: anchor.web3.SystemProgram.programId,
|
|
4020
|
+
protocolIfSharesTransferConfig:
|
|
4021
|
+
getProtocolIfSharesTransferConfigPublicKey(this.program.programId),
|
|
4022
|
+
},
|
|
4023
|
+
});
|
|
4082
4024
|
}
|
|
4083
4025
|
|
|
4084
4026
|
public async updateProtocolIfSharesTransferConfig(
|
|
@@ -4104,7 +4046,9 @@ export class AdminClient extends DriftClient {
|
|
|
4104
4046
|
whitelistedSigners?: PublicKey[],
|
|
4105
4047
|
maxTransferPerEpoch?: BN
|
|
4106
4048
|
): Promise<TransactionInstruction> {
|
|
4107
|
-
return await
|
|
4049
|
+
return await (
|
|
4050
|
+
this.program.instruction as any
|
|
4051
|
+
).updateProtocolIfSharesTransferConfig(
|
|
4108
4052
|
whitelistedSigners || null,
|
|
4109
4053
|
maxTransferPerEpoch,
|
|
4110
4054
|
{
|
|
@@ -4413,7 +4357,7 @@ export class AdminClient extends DriftClient {
|
|
|
4413
4357
|
spotMarketIndex
|
|
4414
4358
|
);
|
|
4415
4359
|
|
|
4416
|
-
return await this.program.instruction.updateSpotMarketFuel(
|
|
4360
|
+
return await (this.program.instruction as any).updateSpotMarketFuel(
|
|
4417
4361
|
fuelBoostDeposits ?? null,
|
|
4418
4362
|
fuelBoostBorrows ?? null,
|
|
4419
4363
|
fuelBoostTaker ?? null,
|
|
@@ -4461,7 +4405,7 @@ export class AdminClient extends DriftClient {
|
|
|
4461
4405
|
perpMarketIndex
|
|
4462
4406
|
);
|
|
4463
4407
|
|
|
4464
|
-
return await this.program.instruction.updatePerpMarketFuel(
|
|
4408
|
+
return await (this.program.instruction as any).updatePerpMarketFuel(
|
|
4465
4409
|
fuelBoostTaker ?? null,
|
|
4466
4410
|
fuelBoostMaker ?? null,
|
|
4467
4411
|
fuelBoostPosition ?? null,
|
|
@@ -4721,7 +4665,7 @@ export class AdminClient extends DriftClient {
|
|
|
4721
4665
|
authority
|
|
4722
4666
|
);
|
|
4723
4667
|
|
|
4724
|
-
return await this.program.instruction.initUserFuel(
|
|
4668
|
+
return await (this.program.instruction as any).initUserFuel(
|
|
4725
4669
|
fuelBonusDeposits || null,
|
|
4726
4670
|
fuelBonusBorrows || null,
|
|
4727
4671
|
fuelBonusTaker || null,
|
|
@@ -4773,7 +4717,7 @@ export class AdminClient extends DriftClient {
|
|
|
4773
4717
|
isWritable: true,
|
|
4774
4718
|
});
|
|
4775
4719
|
}
|
|
4776
|
-
return this.program.instruction.resetFuelSeason({
|
|
4720
|
+
return (this.program.instruction as any).resetFuelSeason({
|
|
4777
4721
|
accounts: {
|
|
4778
4722
|
userStats: getUserStatsAccountPublicKey(
|
|
4779
4723
|
this.program.programId,
|
|
@@ -4820,82 +4764,6 @@ export class AdminClient extends DriftClient {
|
|
|
4820
4764
|
});
|
|
4821
4765
|
}
|
|
4822
4766
|
|
|
4823
|
-
public async initializeHighLeverageModeConfig(
|
|
4824
|
-
maxUsers: number
|
|
4825
|
-
): Promise<TransactionSignature> {
|
|
4826
|
-
const initializeHighLeverageModeConfigIx =
|
|
4827
|
-
await this.getInitializeHighLeverageModeConfigIx(maxUsers);
|
|
4828
|
-
|
|
4829
|
-
const tx = await this.buildTransaction(initializeHighLeverageModeConfigIx);
|
|
4830
|
-
|
|
4831
|
-
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
4832
|
-
|
|
4833
|
-
return txSig;
|
|
4834
|
-
}
|
|
4835
|
-
|
|
4836
|
-
public async getInitializeHighLeverageModeConfigIx(
|
|
4837
|
-
maxUsers: number
|
|
4838
|
-
): Promise<TransactionInstruction> {
|
|
4839
|
-
return await this.program.instruction.initializeHighLeverageModeConfig(
|
|
4840
|
-
maxUsers,
|
|
4841
|
-
{
|
|
4842
|
-
accounts: {
|
|
4843
|
-
admin: this.isSubscribed
|
|
4844
|
-
? this.getStateAccount().admin
|
|
4845
|
-
: this.wallet.publicKey,
|
|
4846
|
-
state: await this.getStatePublicKey(),
|
|
4847
|
-
rent: SYSVAR_RENT_PUBKEY,
|
|
4848
|
-
systemProgram: anchor.web3.SystemProgram.programId,
|
|
4849
|
-
highLeverageModeConfig: getHighLeverageModeConfigPublicKey(
|
|
4850
|
-
this.program.programId
|
|
4851
|
-
),
|
|
4852
|
-
},
|
|
4853
|
-
}
|
|
4854
|
-
);
|
|
4855
|
-
}
|
|
4856
|
-
|
|
4857
|
-
public async updateUpdateHighLeverageModeConfig(
|
|
4858
|
-
maxUsers: number,
|
|
4859
|
-
reduceOnly: boolean,
|
|
4860
|
-
currentUsers?: number
|
|
4861
|
-
): Promise<TransactionSignature> {
|
|
4862
|
-
const updateHighLeverageModeConfigIx =
|
|
4863
|
-
await this.getUpdateHighLeverageModeConfigIx(
|
|
4864
|
-
maxUsers,
|
|
4865
|
-
reduceOnly,
|
|
4866
|
-
currentUsers
|
|
4867
|
-
);
|
|
4868
|
-
|
|
4869
|
-
const tx = await this.buildTransaction(updateHighLeverageModeConfigIx);
|
|
4870
|
-
|
|
4871
|
-
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
4872
|
-
|
|
4873
|
-
return txSig;
|
|
4874
|
-
}
|
|
4875
|
-
|
|
4876
|
-
public async getUpdateHighLeverageModeConfigIx(
|
|
4877
|
-
maxUsers: number,
|
|
4878
|
-
reduceOnly: boolean,
|
|
4879
|
-
currentUsers?: number
|
|
4880
|
-
): Promise<TransactionInstruction> {
|
|
4881
|
-
return await this.program.instruction.updateHighLeverageModeConfig(
|
|
4882
|
-
maxUsers,
|
|
4883
|
-
reduceOnly,
|
|
4884
|
-
currentUsers,
|
|
4885
|
-
{
|
|
4886
|
-
accounts: {
|
|
4887
|
-
admin: this.isSubscribed
|
|
4888
|
-
? this.getStateAccount().admin
|
|
4889
|
-
: this.wallet.publicKey,
|
|
4890
|
-
state: await this.getStatePublicKey(),
|
|
4891
|
-
highLeverageModeConfig: getHighLeverageModeConfigPublicKey(
|
|
4892
|
-
this.program.programId
|
|
4893
|
-
),
|
|
4894
|
-
},
|
|
4895
|
-
}
|
|
4896
|
-
);
|
|
4897
|
-
}
|
|
4898
|
-
|
|
4899
4767
|
public async initializeProtectedMakerModeConfig(
|
|
4900
4768
|
maxUsers: number,
|
|
4901
4769
|
stateAdmin?: boolean
|
|
@@ -5129,17 +4997,16 @@ export class AdminClient extends DriftClient {
|
|
|
5129
4997
|
public async getUpdateFeatureBitFlagsBuilderReferralIx(
|
|
5130
4998
|
enable: boolean
|
|
5131
4999
|
): Promise<TransactionInstruction> {
|
|
5132
|
-
return
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
);
|
|
5000
|
+
return (
|
|
5001
|
+
this.program.instruction as any
|
|
5002
|
+
).updateFeatureBitFlagsBuilderReferral(enable, {
|
|
5003
|
+
accounts: {
|
|
5004
|
+
admin: this.useHotWalletAdmin
|
|
5005
|
+
? this.wallet.publicKey
|
|
5006
|
+
: this.getStateAccount().admin,
|
|
5007
|
+
state: await this.getStatePublicKey(),
|
|
5008
|
+
},
|
|
5009
|
+
});
|
|
5143
5010
|
}
|
|
5144
5011
|
|
|
5145
5012
|
public async updateFeatureBitFlagsMedianTriggerPrice(
|
|
@@ -5205,17 +5072,18 @@ export class AdminClient extends DriftClient {
|
|
|
5205
5072
|
authority
|
|
5206
5073
|
);
|
|
5207
5074
|
|
|
5208
|
-
const ix =
|
|
5209
|
-
this.program.instruction
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
}
|
|
5075
|
+
const ix = (
|
|
5076
|
+
this.program.instruction as any
|
|
5077
|
+
).getUpdateDelegateUserGovTokenInsuranceStakeIx({
|
|
5078
|
+
accounts: {
|
|
5079
|
+
state: await this.getStatePublicKey(),
|
|
5080
|
+
spotMarket: spotMarket.pubkey,
|
|
5081
|
+
insuranceFundStake: ifStakeAccountPublicKey,
|
|
5082
|
+
userStats: userStatsPublicKey,
|
|
5083
|
+
signer: this.wallet.publicKey,
|
|
5084
|
+
insuranceFundVault: spotMarket.insuranceFund.vault,
|
|
5085
|
+
},
|
|
5086
|
+
});
|
|
5219
5087
|
|
|
5220
5088
|
return ix;
|
|
5221
5089
|
}
|
|
@@ -5810,7 +5678,7 @@ export class AdminClient extends DriftClient {
|
|
|
5810
5678
|
lpPool
|
|
5811
5679
|
);
|
|
5812
5680
|
return [
|
|
5813
|
-
this.program.instruction.addAmmConstituentMappingData(
|
|
5681
|
+
(this.program.instruction as any).addAmmConstituentMappingData(
|
|
5814
5682
|
addAmmConstituentMappingData,
|
|
5815
5683
|
{
|
|
5816
5684
|
accounts: {
|
|
@@ -6637,4 +6505,51 @@ export class AdminClient extends DriftClient {
|
|
|
6637
6505
|
},
|
|
6638
6506
|
});
|
|
6639
6507
|
}
|
|
6508
|
+
|
|
6509
|
+
public async transferFeeAndPnlPool(
|
|
6510
|
+
perpMarketIndexWithFeePool: number,
|
|
6511
|
+
perpMarketIndexWithPnlPool: number,
|
|
6512
|
+
amount: BN,
|
|
6513
|
+
direction: TransferFeeAndPnlPoolDirection
|
|
6514
|
+
): Promise<TransactionSignature> {
|
|
6515
|
+
const transferFeeAndPnlPoolIx = await this.getTransferFeeAndPnlPoolIx(
|
|
6516
|
+
perpMarketIndexWithFeePool,
|
|
6517
|
+
perpMarketIndexWithPnlPool,
|
|
6518
|
+
amount,
|
|
6519
|
+
direction
|
|
6520
|
+
);
|
|
6521
|
+
const tx = await this.buildTransaction(transferFeeAndPnlPoolIx);
|
|
6522
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
6523
|
+
return txSig;
|
|
6524
|
+
}
|
|
6525
|
+
|
|
6526
|
+
public async getTransferFeeAndPnlPoolIx(
|
|
6527
|
+
perpMarketIndexWithFeePool: number,
|
|
6528
|
+
perpMarketIndexWithPnlPool: number,
|
|
6529
|
+
amount: BN,
|
|
6530
|
+
direction: TransferFeeAndPnlPoolDirection
|
|
6531
|
+
): Promise<TransactionInstruction> {
|
|
6532
|
+
return await this.program.instruction.transferFeeAndPnlPool(
|
|
6533
|
+
amount,
|
|
6534
|
+
direction,
|
|
6535
|
+
{
|
|
6536
|
+
accounts: {
|
|
6537
|
+
admin: this.isSubscribed
|
|
6538
|
+
? this.getStateAccount().admin
|
|
6539
|
+
: this.wallet.publicKey,
|
|
6540
|
+
state: await this.getStatePublicKey(),
|
|
6541
|
+
perpMarketWithFeePool: await getPerpMarketPublicKey(
|
|
6542
|
+
this.program.programId,
|
|
6543
|
+
perpMarketIndexWithFeePool
|
|
6544
|
+
),
|
|
6545
|
+
perpMarketWithPnlPool: await getPerpMarketPublicKey(
|
|
6546
|
+
this.program.programId,
|
|
6547
|
+
perpMarketIndexWithPnlPool
|
|
6548
|
+
),
|
|
6549
|
+
spotMarket: this.getQuoteSpotMarketAccount().pubkey,
|
|
6550
|
+
spotMarketVault: this.getQuoteSpotMarketAccount().vault,
|
|
6551
|
+
},
|
|
6552
|
+
}
|
|
6553
|
+
);
|
|
6554
|
+
}
|
|
6640
6555
|
}
|
|
@@ -32,10 +32,12 @@ export class AuctionSubscriber {
|
|
|
32
32
|
if (!this.subscriber) {
|
|
33
33
|
this.subscriber = new WebSocketProgramAccountSubscriber<UserAccount>(
|
|
34
34
|
'AuctionSubscriber',
|
|
35
|
-
'
|
|
35
|
+
'user',
|
|
36
36
|
this.driftClient.program,
|
|
37
|
-
|
|
38
|
-
this.driftClient.program.account
|
|
37
|
+
(
|
|
38
|
+
this.driftClient.program.account as any
|
|
39
|
+
).user.coder.accounts.decode.bind(
|
|
40
|
+
(this.driftClient.program.account as any).user.coder.accounts
|
|
39
41
|
),
|
|
40
42
|
{
|
|
41
43
|
filters: [getUserFilter(), getUserWithAuctionFilter()],
|
|
@@ -37,10 +37,12 @@ export class AuctionSubscriberGrpc {
|
|
|
37
37
|
this.subscriber = await grpcProgramAccountSubscriber.create<UserAccount>(
|
|
38
38
|
this.grpcConfigs,
|
|
39
39
|
'AuctionSubscriber',
|
|
40
|
-
'
|
|
40
|
+
'user',
|
|
41
41
|
this.driftClient.program,
|
|
42
|
-
|
|
43
|
-
this.driftClient.program.account
|
|
42
|
+
(
|
|
43
|
+
this.driftClient.program.account as any
|
|
44
|
+
).user.coder.accounts.decode.bind(
|
|
45
|
+
(this.driftClient.program.account as any).user.coder.accounts
|
|
44
46
|
),
|
|
45
47
|
{
|
|
46
48
|
filters: [getUserFilter(), getUserWithAuctionFilter()],
|