@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
|
@@ -52,7 +52,7 @@ class RevenueShareEscrowMap {
|
|
|
52
52
|
try {
|
|
53
53
|
const accountInfo = await this.driftClient.connection.getAccountInfo(escrowAccountPublicKey, 'processed');
|
|
54
54
|
if (accountInfo && accountInfo.data) {
|
|
55
|
-
const escrow = this.driftClient.program.account.revenueShareEscrow.coder.accounts.decode('
|
|
55
|
+
const escrow = this.driftClient.program.account.revenueShareEscrow.coder.accounts.decode('revenueShareEscrow', accountInfo.data);
|
|
56
56
|
this.authorityEscrowMap.set(authority, escrow);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -89,7 +89,7 @@ class RevenueShareEscrowMap {
|
|
|
89
89
|
}
|
|
90
90
|
for (const authority of this.authorityEscrowMap.keys()) {
|
|
91
91
|
const accountInfo = await this.driftClient.connection.getAccountInfo((0, pda_1.getRevenueShareEscrowAccountPublicKey)(this.driftClient.program.programId, new web3_js_1.PublicKey(authority)), 'confirmed');
|
|
92
|
-
const escrowNew = this.driftClient.program.account.revenueShareEscrow.coder.accounts.decode('
|
|
92
|
+
const escrowNew = this.driftClient.program.account.revenueShareEscrow.coder.accounts.decode('revenueShareEscrow', accountInfo.data);
|
|
93
93
|
this.authorityEscrowMap.set(authority, escrowNew);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -115,7 +115,7 @@ class RevenueShareEscrowMap {
|
|
|
115
115
|
try {
|
|
116
116
|
// @ts-ignore
|
|
117
117
|
const buffer = Buffer.from(programAccount.account.data[0], programAccount.account.data[1]);
|
|
118
|
-
const escrow = this.driftClient.program.account.revenueShareEscrow.coder.accounts.decode('
|
|
118
|
+
const escrow = this.driftClient.program.account.revenueShareEscrow.coder.accounts.decode('revenueShareEscrow', buffer);
|
|
119
119
|
// Extract authority from the account data
|
|
120
120
|
const authorityKey = escrow.authority.toBase58();
|
|
121
121
|
this.authorityEscrowMap.set(authorityKey, escrow);
|
|
@@ -130,7 +130,7 @@ class RevenueShareEscrowMap {
|
|
|
130
130
|
try {
|
|
131
131
|
// @ts-ignore
|
|
132
132
|
const buffer = Buffer.from(programAccount.account.data[0], programAccount.account.data[1]);
|
|
133
|
-
const escrow = this.driftClient.program.account.revenueShareEscrow.coder.accounts.decode('
|
|
133
|
+
const escrow = this.driftClient.program.account.revenueShareEscrow.coder.accounts.decode('revenueShareEscrow', buffer);
|
|
134
134
|
// Extract authority from the account data
|
|
135
135
|
const authorityKey = escrow.authority.toBase58();
|
|
136
136
|
this.authorityEscrowMap.set(authorityKey, escrow);
|
|
@@ -50,8 +50,7 @@ class UserMap {
|
|
|
50
50
|
decodeFn = (name, buffer) => (0, user_2.decodeUser)(buffer);
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
|
-
decodeFn =
|
|
54
|
-
this.driftClient.program.account.user.coder.accounts.decodeUnchecked.bind(this.driftClient.program.account.user.coder.accounts);
|
|
53
|
+
decodeFn = this.driftClient.program.account.user.coder.accounts.decodeUnchecked.bind(this.driftClient.program.account.user.coder.accounts);
|
|
55
54
|
}
|
|
56
55
|
this.decode = decodeFn;
|
|
57
56
|
if (config.subscriptionConfig.type === 'polling') {
|
|
@@ -323,12 +322,12 @@ class UserMap {
|
|
|
323
322
|
const currAccountWithSlot = this.getWithSlot(key);
|
|
324
323
|
if (currAccountWithSlot) {
|
|
325
324
|
if (slot >= currAccountWithSlot.slot) {
|
|
326
|
-
const userAccount = this.decode('
|
|
325
|
+
const userAccount = this.decode('user', buffer);
|
|
327
326
|
this.updateUserAccount(key, userAccount, slot);
|
|
328
327
|
}
|
|
329
328
|
}
|
|
330
329
|
else {
|
|
331
|
-
const userAccount = this.decode('
|
|
330
|
+
const userAccount = this.decode('user', buffer);
|
|
332
331
|
await this.addPubkey(new web3_js_1.PublicKey(key), userAccount, slot);
|
|
333
332
|
}
|
|
334
333
|
})());
|
|
@@ -413,7 +412,7 @@ class UserMap {
|
|
|
413
412
|
const publicKeyString = chunk[j].toString();
|
|
414
413
|
const buffer = buffer_1.Buffer.from(accountInfo.data);
|
|
415
414
|
programAccountBufferMap.set(publicKeyString, buffer);
|
|
416
|
-
const decodedUser = this.decode('
|
|
415
|
+
const decodedUser = this.decode('user', buffer);
|
|
417
416
|
const currAccountWithSlot = this.getWithSlot(publicKeyString);
|
|
418
417
|
if (currAccountWithSlot &&
|
|
419
418
|
currAccountWithSlot.slot <= accountInfosSlot) {
|
|
@@ -26,8 +26,7 @@ class UserStatsMap {
|
|
|
26
26
|
this.syncConfig = syncConfig !== null && syncConfig !== void 0 ? syncConfig : {
|
|
27
27
|
type: 'default',
|
|
28
28
|
};
|
|
29
|
-
this.decode =
|
|
30
|
-
this.driftClient.program.account.userStats.coder.accounts.decodeUnchecked.bind(this.driftClient.program.account.userStats.coder.accounts);
|
|
29
|
+
this.decode = this.driftClient.program.account.userStats.coder.accounts.decodeUnchecked.bind(this.driftClient.program.account.userStats.coder.accounts);
|
|
31
30
|
}
|
|
32
31
|
async subscribe(authorities) {
|
|
33
32
|
if (this.size() > 0) {
|
|
@@ -235,7 +234,7 @@ class UserStatsMap {
|
|
|
235
234
|
const publicKeyString = chunk[j].toString();
|
|
236
235
|
if (!this.has(publicKeyString)) {
|
|
237
236
|
const buffer = Buffer.from(accountInfo.data);
|
|
238
|
-
const decodedUserStats = this.decode('
|
|
237
|
+
const decodedUserStats = this.decode('userStats', buffer);
|
|
239
238
|
programAccountBufferMap.add(decodedUserStats.authority.toBase58());
|
|
240
239
|
this.addUserStat(decodedUserStats.authority, decodedUserStats, false);
|
|
241
240
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
|
+
/**
|
|
3
|
+
* UserStats — abstraction over the on-chain `UserStats` account.
|
|
4
|
+
* Tracks referral links, 30-day maker/taker volume, fuel rewards, and IF staking stats.
|
|
5
|
+
* One `UserStats` account exists per authority (shared across all subaccounts).
|
|
6
|
+
*/
|
|
2
7
|
import { DriftClient } from './driftClient';
|
|
3
8
|
import { PublicKey } from '@solana/web3.js';
|
|
4
9
|
import { DataAndSlot, UserStatsAccountSubscriber } from './accounts/types';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Connection, PublicKey } from '@solana/web3.js';
|
|
2
2
|
import { RevenueShareAccount, RevenueShareEscrowAccount, UserAccount, UserStatsAccount } from '../types';
|
|
3
|
-
import {
|
|
4
|
-
export declare function fetchUserAccounts(connection: Connection, program:
|
|
5
|
-
export declare function fetchUserAccountsUsingKeys(connection: Connection, program:
|
|
6
|
-
export declare function fetchUserStatsAccount(connection: Connection, program:
|
|
7
|
-
export declare function fetchRevenueShareAccount(connection: Connection, program:
|
|
8
|
-
export declare function fetchRevenueShareEscrowAccount(connection: Connection, program:
|
|
3
|
+
import { DriftProgram } from '../config';
|
|
4
|
+
export declare function fetchUserAccounts(connection: Connection, program: DriftProgram, authority: PublicKey, limit?: number): Promise<(UserAccount | undefined)[]>;
|
|
5
|
+
export declare function fetchUserAccountsUsingKeys(connection: Connection, program: DriftProgram, userAccountPublicKeys: PublicKey[]): Promise<(UserAccount | undefined)[]>;
|
|
6
|
+
export declare function fetchUserStatsAccount(connection: Connection, program: DriftProgram, authority: PublicKey): Promise<UserStatsAccount | undefined>;
|
|
7
|
+
export declare function fetchRevenueShareAccount(connection: Connection, program: DriftProgram, authority: PublicKey): Promise<RevenueShareAccount | null>;
|
|
8
|
+
export declare function fetchRevenueShareEscrowAccount(connection: Connection, program: DriftProgram, authority: PublicKey): Promise<RevenueShareEscrowAccount | null>;
|
|
9
9
|
//# sourceMappingURL=fetch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/accounts/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACN,mBAAmB,EACnB,yBAAyB,EACzB,WAAW,EACX,gBAAgB,EAChB,MAAM,UAAU,CAAC;AAOlB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/accounts/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACN,mBAAmB,EACnB,yBAAyB,EACzB,WAAW,EACX,gBAAgB,EAChB,MAAM,UAAU,CAAC;AAOlB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,wBAAsB,iBAAiB,CACtC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,YAAY,EACrB,SAAS,EAAE,SAAS,EACpB,KAAK,SAAI,GACP,OAAO,CAAC,CAAC,WAAW,GAAG,SAAS,CAAC,EAAE,CAAC,CAStC;AAED,wBAAsB,0BAA0B,CAC/C,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,YAAY,EACrB,qBAAqB,EAAE,SAAS,EAAE,GAChC,OAAO,CAAC,CAAC,WAAW,GAAG,SAAS,CAAC,EAAE,CAAC,CAetC;AAED,wBAAsB,qBAAqB,CAC1C,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,YAAY,EACrB,SAAS,EAAE,SAAS,GAClB,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAgBvC;AAED,wBAAsB,wBAAwB,CAC7C,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,YAAY,EACrB,SAAS,EAAE,SAAS,GAClB,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAarC;AAED,wBAAsB,8BAA8B,CACnD,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,YAAY,EACrB,SAAS,EAAE,SAAS,GAClB,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAkB3C"}
|
|
@@ -16,7 +16,7 @@ async function fetchUserAccountsUsingKeys(connection, program, userAccountPublic
|
|
|
16
16
|
if (!accountInfo) {
|
|
17
17
|
return undefined;
|
|
18
18
|
}
|
|
19
|
-
return program.account.user.coder.accounts.decodeUnchecked('
|
|
19
|
+
return program.account.user.coder.accounts.decodeUnchecked('user', accountInfo.data);
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
exports.fetchUserAccountsUsingKeys = fetchUserAccountsUsingKeys;
|
|
@@ -24,7 +24,7 @@ async function fetchUserStatsAccount(connection, program, authority) {
|
|
|
24
24
|
const userStatsPublicKey = (0, pda_1.getUserStatsAccountPublicKey)(program.programId, authority);
|
|
25
25
|
const accountInfo = await connection.getAccountInfo(userStatsPublicKey, 'confirmed');
|
|
26
26
|
return accountInfo
|
|
27
|
-
? program.account.user.coder.accounts.decodeUnchecked('
|
|
27
|
+
? program.account.user.coder.accounts.decodeUnchecked('userStats', accountInfo.data)
|
|
28
28
|
: undefined;
|
|
29
29
|
}
|
|
30
30
|
exports.fetchUserStatsAccount = fetchUserStatsAccount;
|
|
@@ -33,7 +33,7 @@ async function fetchRevenueShareAccount(connection, program, authority) {
|
|
|
33
33
|
const accountInfo = await connection.getAccountInfo(revenueShareAccountPublicKey);
|
|
34
34
|
if (!accountInfo)
|
|
35
35
|
return null;
|
|
36
|
-
return program.account.revenueShare.coder.accounts.decode('
|
|
36
|
+
return program.account.revenueShare.coder.accounts.decode('revenueShare', accountInfo.data);
|
|
37
37
|
}
|
|
38
38
|
exports.fetchRevenueShareAccount = fetchRevenueShareAccount;
|
|
39
39
|
async function fetchRevenueShareEscrowAccount(connection, program, authority) {
|
|
@@ -41,7 +41,7 @@ async function fetchRevenueShareEscrowAccount(connection, program, authority) {
|
|
|
41
41
|
const escrow = await connection.getAccountInfo(revenueShareEscrowPubKey);
|
|
42
42
|
if (!escrow)
|
|
43
43
|
return null;
|
|
44
|
-
const escrowAccount = program.account.revenueShareEscrow.coder.accounts.decode('
|
|
44
|
+
const escrowAccount = program.account.revenueShareEscrow.coder.accounts.decode('revenueShareEscrow', escrow.data);
|
|
45
45
|
return escrowAccount;
|
|
46
46
|
}
|
|
47
47
|
exports.fetchRevenueShareEscrowAccount = fetchRevenueShareEscrowAccount;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { ResubOpts, GrpcConfigs } from './types';
|
|
3
|
-
import { Program } from '@coral-xyz/anchor';
|
|
4
3
|
import { PublicKey } from '@solana/web3.js';
|
|
4
|
+
import { DriftProgram } from '../config';
|
|
5
5
|
import { WebSocketAccountSubscriber } from './webSocketAccountSubscriber';
|
|
6
6
|
import { Client } from '../isomorphic/grpc';
|
|
7
7
|
export declare class grpcAccountSubscriber<T> extends WebSocketAccountSubscriber<T> {
|
|
@@ -10,7 +10,7 @@ export declare class grpcAccountSubscriber<T> extends WebSocketAccountSubscriber
|
|
|
10
10
|
private commitmentLevel;
|
|
11
11
|
listenerId?: number;
|
|
12
12
|
private constructor();
|
|
13
|
-
static create<U>(grpcConfigs: GrpcConfigs, accountName: string, program:
|
|
13
|
+
static create<U>(grpcConfigs: GrpcConfigs, accountName: string, program: DriftProgram, accountPublicKey: PublicKey, decodeBuffer?: (buffer: Buffer) => U, resubOpts?: ResubOpts, clientProp?: Client): Promise<grpcAccountSubscriber<U>>;
|
|
14
14
|
subscribe(onChange: (data: T) => void): Promise<void>;
|
|
15
15
|
unsubscribe(onResub?: boolean): Promise<void>;
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpcAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcAccountSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"grpcAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcAccountSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EACN,MAAM,EAMN,MAAM,oBAAoB,CAAC;AAE5B,qBAAa,qBAAqB,CAAC,CAAC,CAAE,SAAQ,0BAA0B,CAAC,CAAC,CAAC;IAC1E,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,eAAe,CAAkB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IAE3B,OAAO;WAca,MAAM,CAAC,CAAC,EAC3B,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,YAAY,EACrB,gBAAgB,EAAE,SAAS,EAC3B,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,CAAC,EACpC,SAAS,CAAC,EAAE,SAAS,EACrB,UAAU,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAuBrB,SAAS,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAkFrD,WAAW,CAAC,OAAO,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAsC1D"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { WebSocketDriftClientAccountSubscriber } from './webSocketDriftClientAccountSubscriber';
|
|
2
2
|
import { OracleInfo } from '../oracles/types';
|
|
3
|
-
import {
|
|
3
|
+
import { DriftProgram } from '../config';
|
|
4
4
|
import { DelistedMarketSetting, GrpcConfigs, ResubOpts } from './types';
|
|
5
5
|
export declare class grpcDriftClientAccountSubscriber extends WebSocketDriftClientAccountSubscriber {
|
|
6
6
|
private grpcConfigs;
|
|
7
|
-
constructor(grpcConfigs: GrpcConfigs, program:
|
|
7
|
+
constructor(grpcConfigs: GrpcConfigs, program: DriftProgram, perpMarketIndexes: number[], spotMarketIndexes: number[], oracleInfos: OracleInfo[], shouldFindAllMarketsAndOracles: boolean, delistedMarketSetting: DelistedMarketSetting, resubOpts?: ResubOpts);
|
|
8
8
|
subscribe(): Promise<boolean>;
|
|
9
9
|
subscribeToSpotMarketAccount(marketIndex: number): Promise<boolean>;
|
|
10
10
|
subscribeToPerpMarketAccount(marketIndex: number): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpcDriftClientAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcDriftClientAccountSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,yCAAyC,CAAC;AAChG,OAAO,EAAE,UAAU,EAAmB,MAAM,kBAAkB,CAAC;AAC/D,OAAO,
|
|
1
|
+
{"version":3,"file":"grpcDriftClientAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcDriftClientAccountSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,yCAAyC,CAAC;AAChG,OAAO,EAAE,UAAU,EAAmB,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAA2B,YAAY,EAAE,MAAM,WAAW,CAAC;AAMlE,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAKxE,qBAAa,gCAAiC,SAAQ,qCAAqC;IAC1F,OAAO,CAAC,WAAW,CAAc;gBAGhC,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,YAAY,EACrB,iBAAiB,EAAE,MAAM,EAAE,EAC3B,iBAAiB,EAAE,MAAM,EAAE,EAC3B,WAAW,EAAE,UAAU,EAAE,EACzB,8BAA8B,EAAE,OAAO,EACvC,qBAAqB,EAAE,qBAAqB,EAC5C,SAAS,CAAC,EAAE,SAAS;IAcT,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAmF3B,4BAA4B,CAC1C,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,OAAO,CAAC;IAyBb,4BAA4B,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAyBnE,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC;CAgCjE"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
3
3
|
import { EventEmitter } from 'events';
|
|
4
4
|
import { OracleInfo, OraclePriceData } from '../oracles/types';
|
|
5
|
-
import { Program } from '@coral-xyz/anchor';
|
|
6
5
|
import { PublicKey } from '@solana/web3.js';
|
|
6
|
+
import { DriftProgram } from '../config';
|
|
7
7
|
import { AccountSubscriber, DataAndSlot, DelistedMarketSetting, DriftClientAccountEvents, DriftClientAccountSubscriber, GrpcConfigs, ResubOpts } from './types';
|
|
8
8
|
import { PerpMarketAccount, SpotMarketAccount, StateAccount } from '../types';
|
|
9
9
|
import { OracleClientCache } from '../oracles/oracleClientCache';
|
|
@@ -18,7 +18,7 @@ export declare class grpcDriftClientAccountSubscriberV2 implements DriftClientAc
|
|
|
18
18
|
eventEmitter: StrictEventEmitter<EventEmitter, DriftClientAccountEvents>;
|
|
19
19
|
isSubscribed: boolean;
|
|
20
20
|
isSubscribing: boolean;
|
|
21
|
-
program:
|
|
21
|
+
program: DriftProgram;
|
|
22
22
|
perpMarketIndexes: number[];
|
|
23
23
|
spotMarketIndexes: number[];
|
|
24
24
|
shouldFindAllMarketsAndOracles: boolean;
|
|
@@ -36,7 +36,7 @@ export declare class grpcDriftClientAccountSubscriberV2 implements DriftClientAc
|
|
|
36
36
|
private resubOpts?;
|
|
37
37
|
private subscriptionPromise;
|
|
38
38
|
protected subscriptionPromiseResolver: (val: boolean) => void;
|
|
39
|
-
constructor(grpcConfigs: GrpcConfigs, program:
|
|
39
|
+
constructor(grpcConfigs: GrpcConfigs, program: DriftProgram, perpMarketIndexes: number[], spotMarketIndexes: number[], oracleInfos: OracleInfo[], shouldFindAllMarketsAndOracles: boolean, delistedMarketSetting: DelistedMarketSetting, resubOpts?: ResubOpts);
|
|
40
40
|
chunks: <T>(array: readonly T[], size: number) => T[][];
|
|
41
41
|
setInitialData(): Promise<void>;
|
|
42
42
|
addPerpMarket(_marketIndex: number): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpcDriftClientAccountSubscriberV2.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcDriftClientAccountSubscriberV2.ts"],"names":[],"mappings":";AAAA,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"grpcDriftClientAccountSubscriberV2.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcDriftClientAccountSubscriberV2.ts"],"names":[],"mappings":"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"}
|
|
@@ -56,7 +56,7 @@ class grpcDriftClientAccountSubscriberV2 {
|
|
|
56
56
|
this.initialPerpMarketAccountData = new Map(perpMarketAccountInfos
|
|
57
57
|
.filter((accountInfo) => !!accountInfo)
|
|
58
58
|
.map((accountInfo) => {
|
|
59
|
-
const perpMarket = this.program.coder.accounts.decode('
|
|
59
|
+
const perpMarket = this.program.coder.accounts.decode('perpMarket', accountInfo.data);
|
|
60
60
|
return [perpMarket.marketIndex, perpMarket];
|
|
61
61
|
}));
|
|
62
62
|
}
|
|
@@ -68,7 +68,7 @@ class grpcDriftClientAccountSubscriberV2 {
|
|
|
68
68
|
this.initialSpotMarketAccountData = new Map(spotMarketAccountInfos
|
|
69
69
|
.filter((accountInfo) => !!accountInfo)
|
|
70
70
|
.map((accountInfo) => {
|
|
71
|
-
const spotMarket = this.program.coder.accounts.decode('
|
|
71
|
+
const spotMarket = this.program.coder.accounts.decode('spotMarket', accountInfo.data);
|
|
72
72
|
return [spotMarket.marketIndex, spotMarket];
|
|
73
73
|
}));
|
|
74
74
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { GrpcConfigs } from './types';
|
|
2
|
-
import { Program } from '@coral-xyz/anchor';
|
|
3
2
|
import { PublicKey } from '@solana/web3.js';
|
|
4
3
|
import { InsuranceFundStake } from '../types';
|
|
5
4
|
import { WebSocketInsuranceFundStakeAccountSubscriber } from './webSocketInsuranceFundStakeAccountSubscriber';
|
|
5
|
+
import { DriftProgram } from '../config';
|
|
6
6
|
export declare class grpcInsuranceFundStakeAccountSubscriber extends WebSocketInsuranceFundStakeAccountSubscriber {
|
|
7
7
|
private grpcConfigs;
|
|
8
|
-
constructor(grpcConfigs: GrpcConfigs, program:
|
|
8
|
+
constructor(grpcConfigs: GrpcConfigs, program: DriftProgram, insuranceFundStakeAccountPublicKey: PublicKey, resubTimeoutMs?: number);
|
|
9
9
|
subscribe(insuranceFundStakeAccount?: InsuranceFundStake): Promise<boolean>;
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=grpcInsuranceFundStakeAccountSubscriber.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpcInsuranceFundStakeAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcInsuranceFundStakeAccountSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"grpcInsuranceFundStakeAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcInsuranceFundStakeAccountSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,4CAA4C,EAAE,MAAM,gDAAgD,CAAC;AAE9G,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,qBAAa,uCAAwC,SAAQ,4CAA4C;IACxG,OAAO,CAAC,WAAW,CAAc;gBAGhC,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,YAAY,EACrB,kCAAkC,EAAE,SAAS,EAC7C,cAAc,CAAC,EAAE,MAAM;IAMlB,SAAS,CACd,yBAAyB,CAAC,EAAE,kBAAkB,GAC5C,OAAO,CAAC,OAAO,CAAC;CAkCnB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { Program } from '@coral-xyz/anchor';
|
|
3
2
|
import { Context, PublicKey } from '@solana/web3.js';
|
|
3
|
+
import { DriftProgram } from '../config';
|
|
4
4
|
import { Client } from '../isomorphic/grpc';
|
|
5
5
|
import { DataAndSlot, GrpcConfigs, ResubOpts } from './types';
|
|
6
6
|
export declare class grpcMultiAccountSubscriber<T, U = undefined> {
|
|
@@ -22,7 +22,7 @@ export declare class grpcMultiAccountSubscriber<T, U = undefined> {
|
|
|
22
22
|
private accountPropsMap;
|
|
23
23
|
private bufferMap;
|
|
24
24
|
private constructor();
|
|
25
|
-
static create<T, U = undefined>(grpcConfigs: GrpcConfigs, accountName: string, program:
|
|
25
|
+
static create<T, U = undefined>(grpcConfigs: GrpcConfigs, accountName: string, program: DriftProgram, decodeBuffer?: (buffer: Buffer, pubkey?: string, accountProps?: U) => T, resubOpts?: ResubOpts, clientProp?: Client, onUnsubscribe?: () => Promise<void>, accountPropsMap?: Map<string, U | Array<U>>): Promise<grpcMultiAccountSubscriber<T, U>>;
|
|
26
26
|
setAccountData(accountPubkey: string, data: T, slot?: number): void;
|
|
27
27
|
getAccountData(accountPubkey: string): DataAndSlot<T> | undefined;
|
|
28
28
|
getAccountDataMap(): Map<string, DataAndSlot<T>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpcMultiAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcMultiAccountSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"grpcMultiAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcMultiAccountSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EAAc,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAIzC,OAAO,EACN,MAAM,EAMN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAiB,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAyB7E,qBAAa,0BAA0B,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS;IACvD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,cAAc,CAAC,CAIhB;IACP,OAAO,CAAC,SAAS,CAAC,CAAY;IAC9B,OAAO,CAAC,aAAa,CAAC,CAAsB;IAErC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,UAAS;IAC/B,OAAO,CAAC,SAAS,CAAC,CAAgC;IAClD,OAAO,CAAC,aAAa,CAAS;IAE9B,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,WAAW,CAGf;IAEJ,OAAO,CAAC,OAAO,CAAqC;IACpD,OAAO,CAAC,eAAe,CAAmC;IAC1D,OAAO,CAAC,SAAS,CAAoC;IAErD,OAAO;WAoBa,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,EAC1C,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,YAAY,EACrB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,KAAK,CAAC,EACvE,SAAS,CAAC,EAAE,SAAS,EACrB,UAAU,CAAC,EAAE,MAAM,EACnB,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EACnC,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,GACzC,OAAO,CAAC,0BAA0B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAwB5C,cAAc,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;IAInE,cAAc,CAAC,aAAa,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS;IAIjE,iBAAiB,IAAI,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IAI1C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAoEtB,SAAS,CACd,QAAQ,EAAE,SAAS,EAAE,EACrB,QAAQ,EAAE,CACT,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,CAAC,KACX,IAAI,GACP,OAAO,CAAC,IAAI,CAAC;IAsIV,WAAW,CAAC,QAAQ,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAkCjD,cAAc,CAAC,QAAQ,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAmCpD,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IA4ClC,OAAO,CAAC,UAAU;IAelB,OAAO,CAAC,UAAU;CAIlB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GrpcConfigs, ResubOpts, UserAccountSubscriber } from './types';
|
|
2
2
|
import { PublicKey } from '@solana/web3.js';
|
|
3
|
-
import { Program } from '@coral-xyz/anchor';
|
|
4
3
|
import { UserAccount } from '../types';
|
|
4
|
+
import { DriftProgram } from '../config';
|
|
5
5
|
import { grpcMultiAccountSubscriber } from './grpcMultiAccountSubscriber';
|
|
6
6
|
export declare class grpcMultiUserAccountSubscriber {
|
|
7
7
|
private program;
|
|
@@ -17,7 +17,7 @@ export declare class grpcMultiUserAccountSubscriber {
|
|
|
17
17
|
private grpcConfigs;
|
|
18
18
|
resubOpts?: ResubOpts;
|
|
19
19
|
private handleAccountChange;
|
|
20
|
-
constructor(program:
|
|
20
|
+
constructor(program: DriftProgram, grpcConfigs: GrpcConfigs, resubOpts?: ResubOpts, multiSubscriber?: grpcMultiAccountSubscriber<UserAccount>);
|
|
21
21
|
subscribe(): Promise<void>;
|
|
22
22
|
forUser(userAccountPublicKey: PublicKey): UserAccountSubscriber;
|
|
23
23
|
private scheduleFlush;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpcMultiUserAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcMultiUserAccountSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,WAAW,EAEX,SAAS,EAET,qBAAqB,EACrB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAW,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"grpcMultiUserAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcMultiUserAccountSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,WAAW,EAEX,SAAS,EAET,qBAAqB,EACrB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAW,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,qBAAa,8BAA8B;IAC1C,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,eAAe,CAA0C;IAEjE,OAAO,CAAC,QAAQ,CAA+C;IAC/D,OAAO,CAAC,SAAS,CAGb;IACJ,OAAO,CAAC,OAAO,CAAgC;IAC/C,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,aAAa,CAAC,CAAgC;IACtD,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,sBAAsB,CAA4C;IAC1E,OAAO,CAAC,WAAW,CAAc;IACjC,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB,OAAO,CAAC,mBAAmB,CAgBzB;gBAGD,OAAO,EAAE,YAAY,EACrB,WAAW,EAAE,WAAW,EACxB,SAAS,CAAC,EAAE,SAAS,EACrB,eAAe,CAAC,EAAE,0BAA0B,CAAC,WAAW,CAAC;IAQ7C,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IA0ChC,OAAO,CAAC,oBAAoB,EAAE,SAAS,GAAG,qBAAqB;IAqGtE,OAAO,CAAC,aAAa;YAOP,YAAY;CAmE1B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { ResubOpts, GrpcConfigs } from './types';
|
|
3
|
-
import { Program } from '@coral-xyz/anchor';
|
|
4
3
|
import { Context, MemcmpFilter, PublicKey } from '@solana/web3.js';
|
|
4
|
+
import { DriftProgram } from '../config';
|
|
5
5
|
import { WebSocketProgramAccountSubscriber } from './webSocketProgramAccountSubscriber';
|
|
6
6
|
export declare class grpcProgramAccountSubscriber<T> extends WebSocketProgramAccountSubscriber<T> {
|
|
7
7
|
private client;
|
|
@@ -9,7 +9,7 @@ export declare class grpcProgramAccountSubscriber<T> extends WebSocketProgramAcc
|
|
|
9
9
|
private commitmentLevel;
|
|
10
10
|
listenerId?: number;
|
|
11
11
|
private constructor();
|
|
12
|
-
static create<U>(grpcConfigs: GrpcConfigs, subscriptionName: string, accountDiscriminator: string, program:
|
|
12
|
+
static create<U>(grpcConfigs: GrpcConfigs, subscriptionName: string, accountDiscriminator: string, program: DriftProgram, decodeBufferFn: (accountName: string, ix: Buffer) => U, options?: {
|
|
13
13
|
filters: MemcmpFilter[];
|
|
14
14
|
}, resubOpts?: ResubOpts): Promise<grpcProgramAccountSubscriber<U>>;
|
|
15
15
|
subscribe(onChange: (accountId: PublicKey, data: T, context: Context, buffer: Buffer) => void): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpcProgramAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcProgramAccountSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"grpcProgramAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcProgramAccountSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AASxF,qBAAa,4BAA4B,CACxC,CAAC,CACA,SAAQ,iCAAiC,CAAC,CAAC,CAAC;IAC7C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAA2C;IACzD,OAAO,CAAC,eAAe,CAAkB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IAE3B,OAAO;WAwBa,MAAM,CAAC,CAAC,EAC3B,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,MAAM,EACxB,oBAAoB,EAAE,MAAM,EAC5B,OAAO,EAAE,YAAY,EACrB,cAAc,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,CAAC,EACtD,OAAO,GAAE;QAAE,OAAO,EAAE,YAAY,EAAE,CAAA;KAEjC,EACD,SAAS,CAAC,EAAE,SAAS,GACnB,OAAO,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC;IA2BrC,SAAS,CACd,QAAQ,EAAE,CACT,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,KACV,IAAI,GACP,OAAO,CAAC,IAAI,CAAC;IA+FH,WAAW,CAAC,OAAO,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAsCxD"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ResubOpts, GrpcConfigs } from './types';
|
|
2
|
-
import { Program } from '@coral-xyz/anchor';
|
|
3
2
|
import { PublicKey } from '@solana/web3.js';
|
|
4
3
|
import { UserAccount } from '../types';
|
|
5
4
|
import { WebSocketUserAccountSubscriber } from './webSocketUserAccountSubscriber';
|
|
5
|
+
import { DriftProgram } from '../config';
|
|
6
6
|
export declare class grpcUserAccountSubscriber extends WebSocketUserAccountSubscriber {
|
|
7
7
|
private grpcConfigs;
|
|
8
|
-
constructor(grpcConfigs: GrpcConfigs, program:
|
|
8
|
+
constructor(grpcConfigs: GrpcConfigs, program: DriftProgram, userAccountPublicKey: PublicKey, resubOpts?: ResubOpts);
|
|
9
9
|
subscribe(userAccount?: UserAccount): Promise<boolean>;
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=grpcUserAccountSubscriber.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpcUserAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcUserAccountSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"grpcUserAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcUserAccountSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAElF,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,qBAAa,yBAA0B,SAAQ,8BAA8B;IAC5E,OAAO,CAAC,WAAW,CAAc;gBAGhC,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,YAAY,EACrB,oBAAoB,EAAE,SAAS,EAC/B,SAAS,CAAC,EAAE,SAAS;IAMhB,SAAS,CAAC,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;CA2B5D"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ResubOpts, GrpcConfigs } from './types';
|
|
2
|
-
import { Program } from '@coral-xyz/anchor';
|
|
3
2
|
import { PublicKey } from '@solana/web3.js';
|
|
4
3
|
import { UserStatsAccount } from '../types';
|
|
5
4
|
import { WebSocketUserStatsAccountSubscriber } from './webSocketUserStatsAccountSubsriber';
|
|
5
|
+
import { DriftProgram } from '../config';
|
|
6
6
|
export declare class grpcUserStatsAccountSubscriber extends WebSocketUserStatsAccountSubscriber {
|
|
7
7
|
private grpcConfigs;
|
|
8
|
-
constructor(grpcConfigs: GrpcConfigs, program:
|
|
8
|
+
constructor(grpcConfigs: GrpcConfigs, program: DriftProgram, userStatsAccountPublicKey: PublicKey, resubOpts?: ResubOpts);
|
|
9
9
|
subscribe(userStatsAccount?: UserStatsAccount): Promise<boolean>;
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=grpcUserStatsAccountSubscriber.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpcUserStatsAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcUserStatsAccountSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"grpcUserStatsAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcUserStatsAccountSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,mCAAmC,EAAE,MAAM,sCAAsC,CAAC;AAE3F,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,qBAAa,8BAA+B,SAAQ,mCAAmC;IACtF,OAAO,CAAC,WAAW,CAAc;gBAGhC,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,YAAY,EACrB,yBAAyB,EAAE,SAAS,EACpC,SAAS,CAAC,EAAE,SAAS;IAMhB,SAAS,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;CA6BtE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { LaserGrpcConfigs, ResubOpts } from './types';
|
|
3
|
-
import { Program } from '@coral-xyz/anchor';
|
|
4
3
|
import { Context, MemcmpFilter, PublicKey } from '@solana/web3.js';
|
|
4
|
+
import { DriftProgram } from '../config';
|
|
5
5
|
import { WebSocketProgramAccountSubscriber } from './webSocketProgramAccountSubscriber';
|
|
6
6
|
import { LaserCommitmentLevel } from '../isomorphic/grpc';
|
|
7
7
|
type LaserCommitment = (typeof LaserCommitmentLevel)[keyof typeof LaserCommitmentLevel];
|
|
@@ -12,7 +12,7 @@ export declare class LaserstreamProgramAccountSubscriber<T> extends WebSocketPro
|
|
|
12
12
|
private readonly laserConfig;
|
|
13
13
|
private readonly laserCommitmentLevel;
|
|
14
14
|
private constructor();
|
|
15
|
-
static create<U>(grpcConfigs: LaserGrpcConfigs, subscriptionName: string, accountDiscriminator: string, program:
|
|
15
|
+
static create<U>(grpcConfigs: LaserGrpcConfigs, subscriptionName: string, accountDiscriminator: string, program: DriftProgram, decodeBufferFn: (accountName: string, ix: Buffer) => U, options?: {
|
|
16
16
|
filters: MemcmpFilter[];
|
|
17
17
|
}, resubOpts?: ResubOpts): Promise<LaserstreamProgramAccountSubscriber<U>>;
|
|
18
18
|
subscribe(onChange: (accountId: PublicKey, data: T, context: Context, buffer: Buffer) => void): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"laserProgramAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/laserProgramAccountSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"laserProgramAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/laserProgramAccountSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AAExF,OAAO,EACN,oBAAoB,EAQpB,MAAM,oBAAoB,CAAC;AAE5B,KAAK,eAAe,GACnB,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC;AAElE,qBAAa,mCAAmC,CAC/C,CAAC,CACA,SAAQ,iCAAiC,CAAC,CAAC,CAAC;IAC7C,OAAO,CAAC,MAAM,CAMD;IAEb,OAAO,CAAC,eAAe,CAAkB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IAE3B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAoB;IAChD,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAA8B;IAEnE,OAAO;WAwBa,MAAM,CAAC,CAAC,EAC3B,WAAW,EAAE,gBAAgB,EAC7B,gBAAgB,EAAE,MAAM,EACxB,oBAAoB,EAAE,MAAM,EAC5B,OAAO,EAAE,YAAY,EACrB,cAAc,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,CAAC,EACtD,OAAO,GAAE;QAAE,OAAO,EAAE,YAAY,EAAE,CAAA;KAEjC,EACD,SAAS,CAAC,EAAE,SAAS,GACnB,OAAO,CAAC,mCAAmC,CAAC,CAAC,CAAC,CAAC;IAiC5C,SAAS,CACd,QAAQ,EAAE,CACT,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,KACV,IAAI,GACP,OAAO,CAAC,IAAI,CAAC;IAsFH,WAAW,CAAC,OAAO,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBjD,iBAAiB,CACvB,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAChC,eAAe;CASlB"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { Commitment, PublicKey } from '@solana/web3.js';
|
|
2
2
|
import { UserAccount } from '../types';
|
|
3
3
|
import { BasicUserAccountSubscriber } from './basicUserAccountSubscriber';
|
|
4
|
-
import { Program } from '@coral-xyz/anchor';
|
|
5
4
|
import { UserAccountSubscriber } from './types';
|
|
5
|
+
import { DriftProgram } from '../config';
|
|
6
6
|
/**
|
|
7
7
|
* Simple implementation of UserAccountSubscriber. It will fetch the UserAccount
|
|
8
8
|
* date on subscribe (or call to fetch) if no account data is provided on init.
|
|
9
9
|
* Expect to use only 1 RPC call unless you call fetch repeatedly.
|
|
10
10
|
*/
|
|
11
11
|
export declare class OneShotUserAccountSubscriber extends BasicUserAccountSubscriber implements UserAccountSubscriber {
|
|
12
|
-
program:
|
|
12
|
+
program: DriftProgram;
|
|
13
13
|
commitment: Commitment;
|
|
14
|
-
constructor(program:
|
|
14
|
+
constructor(program: DriftProgram, userAccountPublicKey: PublicKey, data?: UserAccount, slot?: number, commitment?: Commitment);
|
|
15
15
|
subscribe(userAccount?: UserAccount): Promise<boolean>;
|
|
16
16
|
fetchIfUnloaded(): Promise<void>;
|
|
17
17
|
fetch(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oneShotUserAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/oneShotUserAccountSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"oneShotUserAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/oneShotUserAccountSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;GAIG;AACH,qBAAa,4BACZ,SAAQ,0BACR,YAAW,qBAAqB;IAEhC,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;gBAGtB,OAAO,EAAE,YAAY,EACrB,oBAAoB,EAAE,SAAS,EAC/B,IAAI,CAAC,EAAE,WAAW,EAClB,IAAI,CAAC,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,UAAU;IAOlB,SAAS,CAAC,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IAatD,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAMhC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAiB5B"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { Commitment, PublicKey } from '@solana/web3.js';
|
|
2
2
|
import { UserStatsAccount } from '../types';
|
|
3
3
|
import { BasicUserStatsAccountSubscriber } from './basicUserStatsAccountSubscriber';
|
|
4
|
-
import { Program } from '@coral-xyz/anchor';
|
|
5
4
|
import { UserStatsAccountSubscriber } from './types';
|
|
5
|
+
import { DriftProgram } from '../config';
|
|
6
6
|
/**
|
|
7
7
|
* Simple implementation of UserStatsAccountSubscriber. It will fetch the UserStatsAccount
|
|
8
8
|
* data on subscribe (or call to fetch) if no account data is provided on init.
|
|
9
9
|
* Expect to use only 1 RPC call unless you call fetch repeatedly.
|
|
10
10
|
*/
|
|
11
11
|
export declare class OneShotUserStatsAccountSubscriber extends BasicUserStatsAccountSubscriber implements UserStatsAccountSubscriber {
|
|
12
|
-
program:
|
|
12
|
+
program: DriftProgram;
|
|
13
13
|
commitment: Commitment;
|
|
14
|
-
constructor(program:
|
|
14
|
+
constructor(program: DriftProgram, userStatsAccountPublicKey: PublicKey, data?: UserStatsAccount, slot?: number, commitment?: Commitment);
|
|
15
15
|
subscribe(userStatsAccount?: UserStatsAccount): Promise<boolean>;
|
|
16
16
|
fetchIfUnloaded(): Promise<void>;
|
|
17
17
|
fetch(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oneShotUserStatsAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/oneShotUserStatsAccountSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"oneShotUserStatsAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/oneShotUserStatsAccountSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;GAIG;AACH,qBAAa,iCACZ,SAAQ,+BACR,YAAW,0BAA0B;IAErC,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;gBAGtB,OAAO,EAAE,YAAY,EACrB,yBAAyB,EAAE,SAAS,EACpC,IAAI,CAAC,EAAE,gBAAgB,EACvB,IAAI,CAAC,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,UAAU;IAOlB,SAAS,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IAahE,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAMhC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAoB5B"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { AccountToPoll, DataAndSlot, DelistedMarketSetting, DriftClientAccountEvents, DriftClientAccountSubscriber, OraclesToPoll } from './types';
|
|
3
|
-
import { Program } from '@coral-xyz/anchor';
|
|
4
3
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
5
4
|
import { EventEmitter } from 'events';
|
|
6
5
|
import { PerpMarketAccount, SpotMarketAccount, StateAccount, UserAccount } from '../types';
|
|
@@ -8,9 +7,10 @@ import { BulkAccountLoader } from './bulkAccountLoader';
|
|
|
8
7
|
import { PublicKey } from '@solana/web3.js';
|
|
9
8
|
import { OracleInfo, OraclePriceData } from '../oracles/types';
|
|
10
9
|
import { OracleClientCache } from '../oracles/oracleClientCache';
|
|
10
|
+
import { DriftProgram } from '../config';
|
|
11
11
|
export declare class PollingDriftClientAccountSubscriber implements DriftClientAccountSubscriber {
|
|
12
12
|
isSubscribed: boolean;
|
|
13
|
-
program:
|
|
13
|
+
program: DriftProgram;
|
|
14
14
|
perpMarketIndexes: number[];
|
|
15
15
|
spotMarketIndexes: number[];
|
|
16
16
|
oracleInfos: OracleInfo[];
|
|
@@ -34,7 +34,7 @@ export declare class PollingDriftClientAccountSubscriber implements DriftClientA
|
|
|
34
34
|
private isSubscribing;
|
|
35
35
|
private subscriptionPromise;
|
|
36
36
|
private subscriptionPromiseResolver;
|
|
37
|
-
constructor(program:
|
|
37
|
+
constructor(program: DriftProgram, accountLoader: BulkAccountLoader, perpMarketIndexes: number[], spotMarketIndexes: number[], oracleInfos: OracleInfo[], shouldFindAllMarketsAndOracles: boolean, delistedMarketSetting: DelistedMarketSetting);
|
|
38
38
|
subscribe(): Promise<boolean>;
|
|
39
39
|
updateAccountsToPoll(): Promise<void>;
|
|
40
40
|
updatePerpMarketAccountsToPoll(): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pollingDriftClientAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/pollingDriftClientAccountSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EACN,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,wBAAwB,EACxB,4BAA4B,EAE5B,aAAa,EACb,MAAM,SAAS,CAAC;AACjB,OAAO,
|
|
1
|
+
{"version":3,"file":"pollingDriftClientAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/pollingDriftClientAccountSubscriber.ts"],"names":[],"mappings":"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"}
|
|
@@ -152,7 +152,7 @@ class PollingDriftClientAccountSubscriber {
|
|
|
152
152
|
accountToPoll.callbackId = await this.accountLoader.addAccount(accountToPoll.publicKey, (buffer, slot) => {
|
|
153
153
|
if (!buffer)
|
|
154
154
|
return;
|
|
155
|
-
const account = this.program.
|
|
155
|
+
const account = this.program.coder.accounts.decodeUnchecked(accountToPoll.key, buffer);
|
|
156
156
|
const dataAndSlot = {
|
|
157
157
|
data: account,
|
|
158
158
|
slot,
|
|
@@ -196,7 +196,7 @@ class PollingDriftClientAccountSubscriber {
|
|
|
196
196
|
}
|
|
197
197
|
const { buffer, slot } = bufferAndSlot;
|
|
198
198
|
if (buffer) {
|
|
199
|
-
const account = this.program.
|
|
199
|
+
const account = this.program.coder.accounts.decodeUnchecked(accountToPoll.key, buffer);
|
|
200
200
|
if (accountToPoll.mapKey != undefined) {
|
|
201
201
|
this[accountToPoll.key].set(accountToPoll.mapKey, {
|
|
202
202
|
data: account,
|