@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
package/src/idl/pyth.ts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Program IDL in camelCase format in order to be used in JS/TS.
|
|
3
|
+
*
|
|
4
|
+
* Note that this is only a type helper and is not the actual IDL. The original
|
|
5
|
+
* IDL can be found at `target/idl/pyth.json`.
|
|
6
|
+
*/
|
|
7
|
+
export type Pyth = {
|
|
8
|
+
address: 'FsJ3A3u2vn5cTVofAjvy6y5kwABJAqYWpe4975bi2epH';
|
|
9
|
+
metadata: {
|
|
10
|
+
name: 'pyth';
|
|
11
|
+
version: '0.1.0';
|
|
12
|
+
spec: '0.1.0';
|
|
13
|
+
description: 'Created with Anchor';
|
|
14
|
+
};
|
|
15
|
+
instructions: [
|
|
16
|
+
{
|
|
17
|
+
name: 'initialize';
|
|
18
|
+
discriminator: [175, 175, 109, 31, 13, 152, 155, 237];
|
|
19
|
+
accounts: [
|
|
20
|
+
{
|
|
21
|
+
name: 'price';
|
|
22
|
+
writable: true;
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
args: [
|
|
26
|
+
{
|
|
27
|
+
name: 'price';
|
|
28
|
+
type: 'i64';
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'expo';
|
|
32
|
+
type: 'i32';
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'conf';
|
|
36
|
+
type: 'u64';
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'setPrice';
|
|
42
|
+
discriminator: [16, 19, 182, 8, 149, 83, 72, 181];
|
|
43
|
+
accounts: [
|
|
44
|
+
{
|
|
45
|
+
name: 'price';
|
|
46
|
+
writable: true;
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
args: [
|
|
50
|
+
{
|
|
51
|
+
name: 'price';
|
|
52
|
+
type: 'i64';
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'setPriceInfo';
|
|
58
|
+
discriminator: [52, 225, 243, 132, 19, 89, 254, 181];
|
|
59
|
+
accounts: [
|
|
60
|
+
{
|
|
61
|
+
name: 'price';
|
|
62
|
+
writable: true;
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
args: [
|
|
66
|
+
{
|
|
67
|
+
name: 'price';
|
|
68
|
+
type: 'i64';
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'conf';
|
|
72
|
+
type: 'u64';
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'slot';
|
|
76
|
+
type: 'u64';
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'setTwap';
|
|
82
|
+
discriminator: [10, 194, 43, 204, 120, 214, 177, 206];
|
|
83
|
+
accounts: [
|
|
84
|
+
{
|
|
85
|
+
name: 'price';
|
|
86
|
+
writable: true;
|
|
87
|
+
},
|
|
88
|
+
];
|
|
89
|
+
args: [
|
|
90
|
+
{
|
|
91
|
+
name: 'twap';
|
|
92
|
+
type: 'i64';
|
|
93
|
+
},
|
|
94
|
+
];
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
};
|
|
@@ -1,70 +1,109 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
2
|
+
"address": "V4v1mQiAdLz4qwckEb45WqHYceYizoib39cDBHSWfaB",
|
|
3
|
+
"metadata": {
|
|
4
|
+
"name": "token_faucet",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"spec": "0.1.0",
|
|
7
|
+
"description": "Created with Anchor"
|
|
8
|
+
},
|
|
4
9
|
"instructions": [
|
|
5
10
|
{
|
|
6
11
|
"name": "initialize",
|
|
12
|
+
"discriminator": [
|
|
13
|
+
175,
|
|
14
|
+
175,
|
|
15
|
+
109,
|
|
16
|
+
31,
|
|
17
|
+
13,
|
|
18
|
+
152,
|
|
19
|
+
155,
|
|
20
|
+
237
|
|
21
|
+
],
|
|
7
22
|
"accounts": [
|
|
8
23
|
{
|
|
9
|
-
"name": "
|
|
10
|
-
"
|
|
11
|
-
"
|
|
24
|
+
"name": "faucet_config",
|
|
25
|
+
"writable": true,
|
|
26
|
+
"pda": {
|
|
27
|
+
"seeds": [
|
|
28
|
+
{
|
|
29
|
+
"kind": "const",
|
|
30
|
+
"value": [
|
|
31
|
+
102,
|
|
32
|
+
97,
|
|
33
|
+
117,
|
|
34
|
+
99,
|
|
35
|
+
101,
|
|
36
|
+
116,
|
|
37
|
+
95,
|
|
38
|
+
99,
|
|
39
|
+
111,
|
|
40
|
+
110,
|
|
41
|
+
102,
|
|
42
|
+
105,
|
|
43
|
+
103
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"kind": "account",
|
|
48
|
+
"path": "mint_account"
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
12
52
|
},
|
|
13
53
|
{
|
|
14
54
|
"name": "admin",
|
|
15
|
-
"
|
|
16
|
-
"
|
|
55
|
+
"writable": true,
|
|
56
|
+
"signer": true
|
|
17
57
|
},
|
|
18
58
|
{
|
|
19
|
-
"name": "
|
|
20
|
-
"
|
|
21
|
-
"isSigner": false
|
|
59
|
+
"name": "mint_account",
|
|
60
|
+
"writable": true
|
|
22
61
|
},
|
|
23
62
|
{
|
|
24
63
|
"name": "rent",
|
|
25
|
-
"
|
|
26
|
-
"isSigner": false
|
|
64
|
+
"address": "SysvarRent111111111111111111111111111111111"
|
|
27
65
|
},
|
|
28
66
|
{
|
|
29
|
-
"name": "
|
|
30
|
-
"
|
|
31
|
-
"isSigner": false
|
|
67
|
+
"name": "system_program",
|
|
68
|
+
"address": "11111111111111111111111111111111"
|
|
32
69
|
},
|
|
33
70
|
{
|
|
34
|
-
"name": "
|
|
35
|
-
"
|
|
36
|
-
"isSigner": false
|
|
71
|
+
"name": "token_program",
|
|
72
|
+
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
37
73
|
}
|
|
38
74
|
],
|
|
39
75
|
"args": []
|
|
40
76
|
},
|
|
41
77
|
{
|
|
42
|
-
"name": "
|
|
78
|
+
"name": "mint_to_user",
|
|
79
|
+
"discriminator": [
|
|
80
|
+
75,
|
|
81
|
+
194,
|
|
82
|
+
44,
|
|
83
|
+
77,
|
|
84
|
+
10,
|
|
85
|
+
65,
|
|
86
|
+
232,
|
|
87
|
+
85
|
|
88
|
+
],
|
|
43
89
|
"accounts": [
|
|
44
90
|
{
|
|
45
|
-
"name": "
|
|
46
|
-
"isMut": false,
|
|
47
|
-
"isSigner": false
|
|
91
|
+
"name": "faucet_config"
|
|
48
92
|
},
|
|
49
93
|
{
|
|
50
|
-
"name": "
|
|
51
|
-
"
|
|
52
|
-
"isSigner": false
|
|
94
|
+
"name": "mint_account",
|
|
95
|
+
"writable": true
|
|
53
96
|
},
|
|
54
97
|
{
|
|
55
|
-
"name": "
|
|
56
|
-
"
|
|
57
|
-
"isSigner": false
|
|
98
|
+
"name": "user_token_account",
|
|
99
|
+
"writable": true
|
|
58
100
|
},
|
|
59
101
|
{
|
|
60
|
-
"name": "
|
|
61
|
-
"isMut": false,
|
|
62
|
-
"isSigner": false
|
|
102
|
+
"name": "mint_authority"
|
|
63
103
|
},
|
|
64
104
|
{
|
|
65
|
-
"name": "
|
|
66
|
-
"
|
|
67
|
-
"isSigner": false
|
|
105
|
+
"name": "token_program",
|
|
106
|
+
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
68
107
|
}
|
|
69
108
|
],
|
|
70
109
|
"args": [
|
|
@@ -75,38 +114,93 @@
|
|
|
75
114
|
]
|
|
76
115
|
},
|
|
77
116
|
{
|
|
78
|
-
"name": "
|
|
117
|
+
"name": "transfer_mint_authority",
|
|
118
|
+
"discriminator": [
|
|
119
|
+
87,
|
|
120
|
+
237,
|
|
121
|
+
187,
|
|
122
|
+
84,
|
|
123
|
+
168,
|
|
124
|
+
175,
|
|
125
|
+
241,
|
|
126
|
+
75
|
|
127
|
+
],
|
|
79
128
|
"accounts": [
|
|
80
129
|
{
|
|
81
|
-
"name": "
|
|
82
|
-
"
|
|
83
|
-
|
|
130
|
+
"name": "faucet_config",
|
|
131
|
+
"pda": {
|
|
132
|
+
"seeds": [
|
|
133
|
+
{
|
|
134
|
+
"kind": "const",
|
|
135
|
+
"value": [
|
|
136
|
+
102,
|
|
137
|
+
97,
|
|
138
|
+
117,
|
|
139
|
+
99,
|
|
140
|
+
101,
|
|
141
|
+
116,
|
|
142
|
+
95,
|
|
143
|
+
99,
|
|
144
|
+
111,
|
|
145
|
+
110,
|
|
146
|
+
102,
|
|
147
|
+
105,
|
|
148
|
+
103
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"kind": "account",
|
|
153
|
+
"path": "mint_account"
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
}
|
|
84
157
|
},
|
|
85
158
|
{
|
|
86
159
|
"name": "admin",
|
|
87
|
-
"
|
|
88
|
-
"
|
|
160
|
+
"writable": true,
|
|
161
|
+
"signer": true,
|
|
162
|
+
"relations": [
|
|
163
|
+
"faucet_config"
|
|
164
|
+
]
|
|
89
165
|
},
|
|
90
166
|
{
|
|
91
|
-
"name": "
|
|
92
|
-
"
|
|
93
|
-
"isSigner": false
|
|
167
|
+
"name": "mint_account",
|
|
168
|
+
"writable": true
|
|
94
169
|
},
|
|
95
170
|
{
|
|
96
|
-
"name": "
|
|
97
|
-
"isMut": false,
|
|
98
|
-
"isSigner": false
|
|
171
|
+
"name": "mint_authority"
|
|
99
172
|
},
|
|
100
173
|
{
|
|
101
|
-
"name": "
|
|
102
|
-
"
|
|
103
|
-
"isSigner": false
|
|
174
|
+
"name": "token_program",
|
|
175
|
+
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
104
176
|
}
|
|
105
177
|
],
|
|
106
178
|
"args": []
|
|
107
179
|
}
|
|
108
180
|
],
|
|
109
181
|
"accounts": [
|
|
182
|
+
{
|
|
183
|
+
"name": "FaucetConfig",
|
|
184
|
+
"discriminator": [
|
|
185
|
+
216,
|
|
186
|
+
31,
|
|
187
|
+
49,
|
|
188
|
+
154,
|
|
189
|
+
106,
|
|
190
|
+
125,
|
|
191
|
+
143,
|
|
192
|
+
142
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
"errors": [
|
|
197
|
+
{
|
|
198
|
+
"code": 6000,
|
|
199
|
+
"name": "InvalidMintAccountAuthority",
|
|
200
|
+
"msg": "Program not mint authority"
|
|
201
|
+
}
|
|
202
|
+
],
|
|
203
|
+
"types": [
|
|
110
204
|
{
|
|
111
205
|
"name": "FaucetConfig",
|
|
112
206
|
"type": {
|
|
@@ -114,29 +208,22 @@
|
|
|
114
208
|
"fields": [
|
|
115
209
|
{
|
|
116
210
|
"name": "admin",
|
|
117
|
-
"type": "
|
|
211
|
+
"type": "pubkey"
|
|
118
212
|
},
|
|
119
213
|
{
|
|
120
214
|
"name": "mint",
|
|
121
|
-
"type": "
|
|
215
|
+
"type": "pubkey"
|
|
122
216
|
},
|
|
123
217
|
{
|
|
124
|
-
"name": "
|
|
125
|
-
"type": "
|
|
218
|
+
"name": "mint_authority",
|
|
219
|
+
"type": "pubkey"
|
|
126
220
|
},
|
|
127
221
|
{
|
|
128
|
-
"name": "
|
|
222
|
+
"name": "mint_authority_nonce",
|
|
129
223
|
"type": "u8"
|
|
130
224
|
}
|
|
131
225
|
]
|
|
132
226
|
}
|
|
133
227
|
}
|
|
134
|
-
],
|
|
135
|
-
"errors": [
|
|
136
|
-
{
|
|
137
|
-
"code": 6000,
|
|
138
|
-
"name": "InvalidMintAccountAuthority",
|
|
139
|
-
"msg": "Program not mint authority"
|
|
140
|
-
}
|
|
141
228
|
]
|
|
142
229
|
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Program IDL in camelCase format in order to be used in JS/TS.
|
|
3
|
+
*
|
|
4
|
+
* Note that this is only a type helper and is not the actual IDL. The original
|
|
5
|
+
* IDL can be found at `target/idl/token_faucet.json`.
|
|
6
|
+
*/
|
|
7
|
+
export type TokenFaucet = {
|
|
8
|
+
address: 'V4v1mQiAdLz4qwckEb45WqHYceYizoib39cDBHSWfaB';
|
|
9
|
+
metadata: {
|
|
10
|
+
name: 'tokenFaucet';
|
|
11
|
+
version: '0.1.0';
|
|
12
|
+
spec: '0.1.0';
|
|
13
|
+
description: 'Created with Anchor';
|
|
14
|
+
};
|
|
15
|
+
instructions: [
|
|
16
|
+
{
|
|
17
|
+
name: 'initialize';
|
|
18
|
+
discriminator: [175, 175, 109, 31, 13, 152, 155, 237];
|
|
19
|
+
accounts: [
|
|
20
|
+
{
|
|
21
|
+
name: 'faucetConfig';
|
|
22
|
+
writable: true;
|
|
23
|
+
pda: {
|
|
24
|
+
seeds: [
|
|
25
|
+
{
|
|
26
|
+
kind: 'const';
|
|
27
|
+
value: [
|
|
28
|
+
102,
|
|
29
|
+
97,
|
|
30
|
+
117,
|
|
31
|
+
99,
|
|
32
|
+
101,
|
|
33
|
+
116,
|
|
34
|
+
95,
|
|
35
|
+
99,
|
|
36
|
+
111,
|
|
37
|
+
110,
|
|
38
|
+
102,
|
|
39
|
+
105,
|
|
40
|
+
103,
|
|
41
|
+
];
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
kind: 'account';
|
|
45
|
+
path: 'mintAccount';
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'admin';
|
|
52
|
+
writable: true;
|
|
53
|
+
signer: true;
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'mintAccount';
|
|
57
|
+
writable: true;
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'rent';
|
|
61
|
+
address: 'SysvarRent111111111111111111111111111111111';
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'systemProgram';
|
|
65
|
+
address: '11111111111111111111111111111111';
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'tokenProgram';
|
|
69
|
+
address: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
args: [];
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'mintToUser';
|
|
76
|
+
discriminator: [75, 194, 44, 77, 10, 65, 232, 85];
|
|
77
|
+
accounts: [
|
|
78
|
+
{
|
|
79
|
+
name: 'faucetConfig';
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'mintAccount';
|
|
83
|
+
writable: true;
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'userTokenAccount';
|
|
87
|
+
writable: true;
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'mintAuthority';
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: 'tokenProgram';
|
|
94
|
+
address: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
args: [
|
|
98
|
+
{
|
|
99
|
+
name: 'amount';
|
|
100
|
+
type: 'u64';
|
|
101
|
+
},
|
|
102
|
+
];
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: 'transferMintAuthority';
|
|
106
|
+
discriminator: [87, 237, 187, 84, 168, 175, 241, 75];
|
|
107
|
+
accounts: [
|
|
108
|
+
{
|
|
109
|
+
name: 'faucetConfig';
|
|
110
|
+
pda: {
|
|
111
|
+
seeds: [
|
|
112
|
+
{
|
|
113
|
+
kind: 'const';
|
|
114
|
+
value: [
|
|
115
|
+
102,
|
|
116
|
+
97,
|
|
117
|
+
117,
|
|
118
|
+
99,
|
|
119
|
+
101,
|
|
120
|
+
116,
|
|
121
|
+
95,
|
|
122
|
+
99,
|
|
123
|
+
111,
|
|
124
|
+
110,
|
|
125
|
+
102,
|
|
126
|
+
105,
|
|
127
|
+
103,
|
|
128
|
+
];
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
kind: 'account';
|
|
132
|
+
path: 'mintAccount';
|
|
133
|
+
},
|
|
134
|
+
];
|
|
135
|
+
};
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: 'admin';
|
|
139
|
+
writable: true;
|
|
140
|
+
signer: true;
|
|
141
|
+
relations: ['faucetConfig'];
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: 'mintAccount';
|
|
145
|
+
writable: true;
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: 'mintAuthority';
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: 'tokenProgram';
|
|
152
|
+
address: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
153
|
+
},
|
|
154
|
+
];
|
|
155
|
+
args: [];
|
|
156
|
+
},
|
|
157
|
+
];
|
|
158
|
+
accounts: [
|
|
159
|
+
{
|
|
160
|
+
name: 'faucetConfig';
|
|
161
|
+
discriminator: [216, 31, 49, 154, 106, 125, 143, 142];
|
|
162
|
+
},
|
|
163
|
+
];
|
|
164
|
+
errors: [
|
|
165
|
+
{
|
|
166
|
+
code: 6000;
|
|
167
|
+
name: 'invalidMintAccountAuthority';
|
|
168
|
+
msg: 'Program not mint authority';
|
|
169
|
+
},
|
|
170
|
+
];
|
|
171
|
+
types: [
|
|
172
|
+
{
|
|
173
|
+
name: 'faucetConfig';
|
|
174
|
+
type: {
|
|
175
|
+
kind: 'struct';
|
|
176
|
+
fields: [
|
|
177
|
+
{
|
|
178
|
+
name: 'admin';
|
|
179
|
+
type: 'pubkey';
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: 'mint';
|
|
183
|
+
type: 'pubkey';
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: 'mintAuthority';
|
|
187
|
+
type: 'pubkey';
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: 'mintAuthorityNonce';
|
|
191
|
+
type: 'u8';
|
|
192
|
+
},
|
|
193
|
+
];
|
|
194
|
+
};
|
|
195
|
+
},
|
|
196
|
+
];
|
|
197
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @drift-labs/sdk
|
|
3
|
+
* Main package barrel — re-exports all public SDK types, classes, and utilities.
|
|
4
|
+
*
|
|
5
|
+
* Primary entry points:
|
|
6
|
+
* {@link DriftClient} — trading and keeper instruction builders (driftClient.ts)
|
|
7
|
+
* {@link AdminClient} — governance/admin instruction builders (adminClient.ts)
|
|
8
|
+
* {@link User} — user account abstraction: margin queries, position accessors (user.ts)
|
|
9
|
+
* {@link DLOB} — decentralized limit order book (dlob/DLOB.ts)
|
|
10
|
+
*
|
|
11
|
+
* Key re-exported namespaces: types, addresses/pda, accounts (subscribers), math, events, oracles, constants.
|
|
12
|
+
*/
|
|
1
13
|
import { BN } from '@coral-xyz/anchor';
|
|
2
14
|
import { PublicKey } from '@solana/web3.js';
|
|
3
15
|
import pyth from '@pythnetwork/client';
|
|
@@ -10,7 +22,6 @@ export * from './types';
|
|
|
10
22
|
export * from './accounts/fetch';
|
|
11
23
|
export * from './accounts/webSocketDriftClientAccountSubscriber';
|
|
12
24
|
export * from './accounts/webSocketInsuranceFundStakeAccountSubscriber';
|
|
13
|
-
export * from './accounts/webSocketHighLeverageModeConfigAccountSubscriber';
|
|
14
25
|
export { WebSocketAccountSubscriberV2 } from './accounts/webSocketAccountSubscriberV2';
|
|
15
26
|
export { WebSocketProgramAccountSubscriber } from './accounts/webSocketProgramAccountSubscriber';
|
|
16
27
|
export { WebSocketProgramUserAccountSubscriber } from './accounts/websocketProgramUserAccountSubscriber';
|
|
@@ -26,7 +37,6 @@ export * from './accounts/pollingTokenAccountSubscriber';
|
|
|
26
37
|
export * from './accounts/pollingUserAccountSubscriber';
|
|
27
38
|
export * from './accounts/pollingUserStatsAccountSubscriber';
|
|
28
39
|
export * from './accounts/pollingInsuranceFundStakeAccountSubscriber';
|
|
29
|
-
export * from './accounts/pollingHighLeverageModeConfigAccountSubscriber';
|
|
30
40
|
export * from './accounts/basicUserAccountSubscriber';
|
|
31
41
|
export * from './accounts/oneShotUserAccountSubscriber';
|
|
32
42
|
export * from './accounts/oneShotUserStatsAccountSubscriber';
|
|
@@ -34,13 +44,7 @@ export * from './accounts/types';
|
|
|
34
44
|
export * from './addresses/pda';
|
|
35
45
|
export * from './adminClient';
|
|
36
46
|
export * from './assert/assert';
|
|
37
|
-
export {
|
|
38
|
-
PythLazerSubscriber,
|
|
39
|
-
PythLazerPriceFeedArray,
|
|
40
|
-
PriceUpdateAccount,
|
|
41
|
-
PythSolanaReceiver,
|
|
42
|
-
WormholeCoreBridgeSolana,
|
|
43
|
-
} from './pyth';
|
|
47
|
+
export { PythLazerSubscriber, type PythLazerPriceFeedArray } from './pyth';
|
|
44
48
|
export * from './testClient';
|
|
45
49
|
export * from './user';
|
|
46
50
|
export * from './userConfig';
|
|
@@ -100,9 +104,7 @@ export * from './phoenix/phoenixFulfillmentConfigMap';
|
|
|
100
104
|
export * from './openbook/openbookV2Subscriber';
|
|
101
105
|
export * from './openbook/openbookV2FulfillmentConfigMap';
|
|
102
106
|
export * from './oracles/pythClient';
|
|
103
|
-
export * from './oracles/pythPullClient';
|
|
104
107
|
export * from './oracles/pythLazerClient';
|
|
105
|
-
export * from './oracles/switchboardOnDemandClient';
|
|
106
108
|
export * from './oracles/oracleId';
|
|
107
109
|
export * from './oracles/utils';
|
|
108
110
|
export * from './swift/swiftOrderSubscriber';
|
|
@@ -120,7 +122,6 @@ export * from './util/computeUnits';
|
|
|
120
122
|
export * from './util/digest';
|
|
121
123
|
export * from './util/tps';
|
|
122
124
|
export * from './util/promiseTimeout';
|
|
123
|
-
export * from './util/pythOracleUtils';
|
|
124
125
|
export * from './math/spotBalance';
|
|
125
126
|
export * from './driftClientConfig';
|
|
126
127
|
export * from './dlob/DLOB';
|
package/src/margin/README.md
CHANGED
|
@@ -109,7 +109,6 @@ public getMarginCalculation(
|
|
|
109
109
|
opts?: {
|
|
110
110
|
strict?: boolean; // mirror StrictOraclePrice application
|
|
111
111
|
includeOpenOrders?: boolean; // include open orders in margin calc
|
|
112
|
-
enteringHighLeverage?: boolean; // entering high leverage mode
|
|
113
112
|
liquidationBufferMap?: Map<number | 'cross', BN>; // margin buffer for liquidation mode
|
|
114
113
|
}
|
|
115
114
|
): MarginCalculation;
|
package/src/marinade/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnchorProvider, BN, Program } from '@coral-xyz/anchor';
|
|
1
|
+
import { AnchorProvider, BN, Program } from '@coral-xyz/anchor-29';
|
|
2
2
|
import { MarinadeFinance, IDL } from './types';
|
|
3
3
|
import {
|
|
4
4
|
PublicKey,
|
|
@@ -57,7 +57,7 @@ export function getMarinadeDepositIx({
|
|
|
57
57
|
export async function getMarinadeMSolPrice(
|
|
58
58
|
program: Program<MarinadeFinance>
|
|
59
59
|
): Promise<number> {
|
|
60
|
-
const state = await program.account.state.fetch(
|
|
60
|
+
const state = await (program.account as any).state.fetch(
|
|
61
61
|
new PublicKey('8szGkuLTAux9XMgZ2vtY39jVSowEcpBfFfD8hXSEqdGC')
|
|
62
62
|
);
|
|
63
63
|
return state.msolPrice.toNumber() / 0x1_0000_0000;
|