@velocity-exchange/sdk 0.0.5 → 0.2.0
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 -1
- package/CHANGELOG.md +35 -0
- package/README.md +30 -30
- package/bun.lock +24 -2
- package/lib/browser/accounts/basicUserAccountSubscriber.d.ts +5 -3
- package/lib/browser/accounts/basicUserAccountSubscriber.js +4 -3
- package/lib/browser/accounts/basicUserStatsAccountSubscriber.d.ts +5 -3
- package/lib/browser/accounts/basicUserStatsAccountSubscriber.js +4 -3
- package/lib/browser/accounts/bulkAccountLoader.d.ts +5 -5
- package/lib/browser/accounts/bulkAccountLoader.js +12 -1
- package/lib/browser/accounts/grpcAccountSubscriber.d.ts +2 -1
- package/lib/browser/accounts/grpcAccountSubscriber.js +8 -2
- package/lib/browser/accounts/grpcMultiAccountSubscriber.d.ts +3 -2
- package/lib/browser/accounts/grpcMultiAccountSubscriber.js +13 -5
- package/lib/browser/accounts/grpcMultiUserAccountSubscriber.d.ts +2 -1
- package/lib/browser/accounts/grpcMultiUserAccountSubscriber.js +12 -8
- package/lib/browser/accounts/grpcProgramAccountSubscriber.d.ts +2 -1
- package/lib/browser/accounts/grpcProgramAccountSubscriber.js +9 -3
- package/lib/browser/accounts/grpcVelocityClientAccountSubscriber.d.ts +0 -4
- package/lib/browser/accounts/grpcVelocityClientAccountSubscriber.js +19 -6
- package/lib/browser/accounts/grpcVelocityClientAccountSubscriberV2.d.ts +1 -5
- package/lib/browser/accounts/grpcVelocityClientAccountSubscriberV2.js +44 -23
- package/lib/browser/accounts/laserProgramAccountSubscriber.js +4 -1
- package/lib/browser/accounts/oneShotUserAccountSubscriber.js +4 -3
- package/lib/browser/accounts/oneShotUserStatsAccountSubscriber.js +7 -3
- package/lib/browser/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts +4 -2
- package/lib/browser/accounts/pollingInsuranceFundStakeAccountSubscriber.js +3 -3
- package/lib/browser/accounts/pollingOracleAccountSubscriber.d.ts +0 -2
- package/lib/browser/accounts/pollingOracleAccountSubscriber.js +16 -5
- package/lib/browser/accounts/pollingTokenAccountSubscriber.d.ts +0 -2
- package/lib/browser/accounts/pollingTokenAccountSubscriber.js +16 -5
- package/lib/browser/accounts/pollingUserAccountSubscriber.d.ts +8 -4
- package/lib/browser/accounts/pollingUserAccountSubscriber.js +17 -11
- package/lib/browser/accounts/pollingUserStatsAccountSubscriber.d.ts +4 -2
- package/lib/browser/accounts/pollingUserStatsAccountSubscriber.js +6 -6
- package/lib/browser/accounts/pollingVelocityClientAccountSubscriber.d.ts +7 -5
- package/lib/browser/accounts/pollingVelocityClientAccountSubscriber.js +69 -35
- package/lib/browser/accounts/types.d.ts +6 -12
- package/lib/browser/accounts/utils.d.ts +1 -0
- package/lib/browser/accounts/utils.js +10 -3
- package/lib/browser/accounts/webSocketAccountSubscriber.d.ts +4 -2
- package/lib/browser/accounts/webSocketAccountSubscriber.js +17 -5
- package/lib/browser/accounts/webSocketAccountSubscriberV2.d.ts +4 -2
- package/lib/browser/accounts/webSocketAccountSubscriberV2.js +17 -6
- package/lib/browser/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +4 -2
- package/lib/browser/accounts/webSocketInsuranceFundStakeAccountSubscriber.js +9 -0
- package/lib/browser/accounts/webSocketProgramAccountSubscriber.d.ts +3 -1
- package/lib/browser/accounts/webSocketProgramAccountSubscriber.js +14 -3
- package/lib/browser/accounts/webSocketProgramAccountSubscriberV2.d.ts +3 -1
- package/lib/browser/accounts/webSocketProgramAccountSubscriberV2.js +15 -3
- package/lib/browser/accounts/webSocketProgramAccountsSubscriberV2.d.ts +3 -1
- package/lib/browser/accounts/webSocketProgramAccountsSubscriberV2.js +14 -4
- package/lib/browser/accounts/webSocketUserAccountSubscriber.d.ts +4 -2
- package/lib/browser/accounts/webSocketUserAccountSubscriber.js +9 -0
- package/lib/browser/accounts/webSocketUserStatsAccountSubsriber.d.ts +4 -2
- package/lib/browser/accounts/webSocketUserStatsAccountSubsriber.js +9 -0
- package/lib/browser/accounts/webSocketVelocityClientAccountSubscriber.d.ts +4 -8
- package/lib/browser/accounts/webSocketVelocityClientAccountSubscriber.js +52 -26
- package/lib/browser/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts +7 -7
- package/lib/browser/accounts/webSocketVelocityClientAccountSubscriberV2.js +49 -20
- package/lib/browser/accounts/websocketProgramUserAccountSubscriber.d.ts +1 -1
- package/lib/browser/accounts/websocketProgramUserAccountSubscriber.js +0 -3
- package/lib/browser/addresses/marketAddresses.js +3 -2
- package/lib/browser/addresses/pda.d.ts +1 -9
- package/lib/browser/addresses/pda.js +4 -23
- package/lib/browser/adminClient.d.ts +25 -29
- package/lib/browser/adminClient.js +168 -169
- package/lib/browser/auctionSubscriber/auctionSubscriber.d.ts +2 -4
- package/lib/browser/auctionSubscriber/auctionSubscriber.js +8 -10
- package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.d.ts +2 -4
- package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.js +11 -10
- package/lib/browser/auctionSubscriber/types.d.ts +3 -2
- package/lib/browser/bankrun/bankrunConnection.d.ts +6 -4
- package/lib/browser/bankrun/bankrunConnection.js +69 -31
- package/lib/browser/blockhashSubscriber/BlockhashSubscriber.d.ts +1 -1
- package/lib/browser/blockhashSubscriber/BlockhashSubscriber.js +3 -2
- package/lib/browser/clock/clockSubscriber.d.ts +6 -6
- package/lib/browser/clock/clockSubscriber.js +4 -3
- package/lib/browser/config.d.ts +11 -20
- package/lib/browser/config.js +13 -36
- package/lib/browser/constants/index.d.ts +1 -2
- package/lib/browser/constants/index.js +1 -2
- package/lib/browser/constants/numericConstants.d.ts +1 -3
- package/lib/browser/constants/numericConstants.js +3 -5
- package/lib/browser/constituentMap/constituentMap.d.ts +0 -2
- package/lib/browser/constituentMap/constituentMap.js +10 -6
- package/lib/browser/constituentMap/pollingConstituentAccountSubscriber.js +3 -2
- package/lib/browser/constituentMap/webSocketConstituentAccountSubscriber.d.ts +2 -3
- package/lib/browser/constituentMap/webSocketConstituentAccountSubscriber.js +10 -3
- package/lib/browser/core/VelocityCore.d.ts +9 -15
- package/lib/browser/core/VelocityCore.js +5 -7
- package/lib/browser/core/instructions/perpOrders.d.ts +14 -0
- package/lib/browser/core/instructions/perpOrders.js +14 -0
- package/lib/browser/core/instructions/withdraw.d.ts +1 -1
- package/lib/browser/core/instructions/withdraw.js +1 -1
- package/lib/browser/core/remainingAccounts.d.ts +2 -2
- package/lib/browser/core/remainingAccounts.js +5 -5
- package/lib/browser/decode/user.js +9 -1
- package/lib/browser/dlob/DLOB.d.ts +7 -2
- package/lib/browser/dlob/DLOB.js +205 -142
- package/lib/browser/dlob/DLOBNode.d.ts +5 -2
- package/lib/browser/dlob/DLOBNode.js +7 -0
- package/lib/browser/dlob/DLOBSubscriber.d.ts +0 -2
- package/lib/browser/dlob/DLOBSubscriber.js +39 -39
- package/lib/browser/dlob/NodeList.js +8 -7
- package/lib/browser/dlob/orderBookLevels.js +24 -17
- package/lib/browser/dlob/types.d.ts +0 -2
- package/lib/browser/events/eventList.js +4 -1
- package/lib/browser/events/eventSubscriber.d.ts +6 -3
- package/lib/browser/events/eventSubscriber.js +75 -26
- package/lib/browser/events/eventsServerLogProvider.d.ts +1 -1
- package/lib/browser/events/eventsServerLogProvider.js +17 -10
- package/lib/browser/events/fetchLogs.d.ts +1 -1
- package/lib/browser/events/fetchLogs.js +4 -2
- package/lib/browser/events/parse.js +14 -14
- package/lib/browser/events/pollingLogProvider.d.ts +1 -1
- package/lib/browser/events/pollingLogProvider.js +1 -0
- package/lib/browser/events/txEventCache.js +6 -2
- package/lib/browser/events/types.d.ts +3 -7
- package/lib/browser/events/types.js +1 -3
- package/lib/browser/events/webSocketLogProvider.d.ts +1 -1
- package/lib/browser/events/webSocketLogProvider.js +5 -2
- package/lib/browser/factory/bigNum.js +1 -1
- package/lib/{node/idl/drift.d.ts → browser/idl/velocity.d.ts} +2412 -2481
- package/lib/browser/idl/{drift.json → velocity.json} +2265 -2333
- package/lib/browser/index.d.ts +1 -3
- package/lib/browser/index.js +1 -4
- package/lib/browser/jupiter/jupiterClient.d.ts +1 -1
- package/lib/browser/jupiter/jupiterClient.js +18 -8
- package/lib/browser/marginCalculation.js +1 -0
- package/lib/browser/math/amm.d.ts +31 -13
- package/lib/browser/math/amm.js +87 -31
- package/lib/browser/math/auction.js +16 -12
- package/lib/browser/math/bankruptcy.js +1 -1
- package/lib/browser/math/builder.d.ts +18 -1
- package/lib/browser/math/builder.js +32 -1
- package/lib/browser/math/funding.js +30 -30
- package/lib/browser/math/insurance.d.ts +1 -1
- package/lib/browser/math/insurance.js +4 -5
- package/lib/browser/math/margin.d.ts +3 -11
- package/lib/browser/math/margin.js +10 -69
- package/lib/browser/math/market.d.ts +4 -12
- package/lib/browser/math/market.js +12 -46
- package/lib/browser/math/oracles.d.ts +4 -7
- package/lib/browser/math/oracles.js +24 -37
- package/lib/browser/math/orders.d.ts +2 -7
- package/lib/browser/math/orders.js +9 -81
- package/lib/browser/math/position.d.ts +0 -4
- package/lib/browser/math/position.js +6 -11
- package/lib/browser/math/repeg.d.ts +0 -1
- package/lib/browser/math/repeg.js +1 -23
- package/lib/browser/math/spotBalance.d.ts +4 -4
- package/lib/browser/math/spotBalance.js +6 -6
- package/lib/browser/math/spotMarket.d.ts +0 -6
- package/lib/browser/math/spotMarket.js +1 -16
- package/lib/browser/math/spotPosition.d.ts +4 -4
- package/lib/browser/math/state.d.ts +0 -2
- package/lib/browser/math/state.js +1 -9
- package/lib/browser/math/superStake.d.ts +11 -63
- package/lib/browser/math/superStake.js +29 -28
- package/lib/browser/math/trade.js +7 -7
- package/lib/browser/math/utils.d.ts +1 -1
- package/lib/browser/math/utils.js +1 -1
- package/lib/browser/memcmp.d.ts +0 -1
- package/lib/browser/memcmp.js +1 -10
- package/lib/browser/oracles/prelaunchOracleClient.js +3 -2
- package/lib/browser/oracles/pythClient.js +9 -3
- package/lib/browser/oracles/pythLazerClient.js +5 -4
- package/lib/browser/oracles/utils.d.ts +4 -0
- package/lib/browser/oracles/utils.js +9 -1
- package/lib/browser/orderSubscriber/OrderSubscriber.d.ts +1 -3
- package/lib/browser/orderSubscriber/OrderSubscriber.js +16 -14
- package/lib/browser/orderSubscriber/WebsocketSubscription.js +1 -1
- package/lib/browser/orderSubscriber/grpcSubscription.js +2 -2
- package/lib/browser/orderSubscriber/types.d.ts +0 -2
- package/lib/browser/priorityFee/heliusPriorityFeeMethod.d.ts +1 -1
- package/lib/browser/priorityFee/priorityFeeSubscriber.d.ts +2 -6
- package/lib/browser/priorityFee/priorityFeeSubscriber.js +34 -18
- package/lib/browser/priorityFee/priorityFeeSubscriberMap.d.ts +0 -4
- package/lib/browser/priorityFee/priorityFeeSubscriberMap.js +3 -11
- package/lib/browser/priorityFee/solanaPriorityFeeMethod.d.ts +1 -1
- package/lib/browser/priorityFee/types.d.ts +3 -8
- package/lib/browser/priorityFee/velocityPriorityFeeMethod.d.ts +0 -8
- package/lib/browser/priorityFee/velocityPriorityFeeMethod.js +1 -3
- package/lib/browser/pyth/pythLazerSubscriber.d.ts +1 -1
- package/lib/browser/pyth/pythLazerSubscriber.js +1 -1
- package/lib/browser/pyth/types.d.ts +0 -1
- package/lib/browser/slot/SlotSubscriber.d.ts +1 -1
- package/lib/browser/slot/SlotSubscriber.js +2 -1
- package/lib/browser/slot/SlothashSubscriber.d.ts +3 -2
- package/lib/browser/slot/SlothashSubscriber.js +11 -4
- package/lib/browser/swap/UnifiedSwapClient.js +1 -1
- package/lib/browser/swift/grpcSignedMsgUserAccountSubscriber.d.ts +0 -3
- package/lib/browser/swift/grpcSignedMsgUserAccountSubscriber.js +5 -5
- package/lib/browser/swift/signedMsgUserAccountSubscriber.d.ts +7 -7
- package/lib/browser/swift/signedMsgUserAccountSubscriber.js +14 -10
- package/lib/browser/swift/swiftOrderSubscriber.d.ts +7 -6
- package/lib/browser/swift/swiftOrderSubscriber.js +15 -16
- package/lib/browser/testClient.js +3 -2
- package/lib/browser/tokenFaucet.js +16 -2
- package/lib/browser/tx/baseTxSender.d.ts +4 -4
- package/lib/browser/tx/baseTxSender.js +5 -4
- package/lib/browser/tx/fastSingleTxSender.d.ts +3 -3
- package/lib/browser/tx/fastSingleTxSender.js +9 -5
- package/lib/browser/tx/reportTransactionError.d.ts +2 -2
- package/lib/browser/tx/reportTransactionError.js +5 -1
- package/lib/browser/tx/retryTxSender.d.ts +1 -1
- package/lib/browser/tx/retryTxSender.js +4 -2
- package/lib/browser/tx/txHandler.d.ts +7 -1
- package/lib/browser/tx/txHandler.js +54 -40
- package/lib/browser/tx/txParamProcessor.d.ts +4 -1
- package/lib/browser/tx/txParamProcessor.js +6 -0
- package/lib/browser/tx/types.d.ts +1 -1
- package/lib/browser/tx/whileValidTxSender.d.ts +1 -6
- package/lib/browser/tx/whileValidTxSender.js +35 -13
- package/lib/browser/types.d.ts +102 -157
- package/lib/browser/types.js +6 -2
- package/lib/browser/user.d.ts +22 -10
- package/lib/browser/user.js +174 -154
- package/lib/browser/userConfig.d.ts +3 -2
- package/lib/browser/userMap/WebsocketSubscription.d.ts +1 -1
- package/lib/browser/userMap/WebsocketSubscription.js +1 -1
- package/lib/browser/userMap/grpcSubscription.d.ts +1 -1
- package/lib/browser/userMap/grpcSubscription.js +1 -1
- package/lib/browser/userMap/referrerMap.d.ts +0 -2
- package/lib/browser/userMap/referrerMap.js +10 -7
- package/lib/browser/userMap/revenueShareEscrowMap.d.ts +0 -2
- package/lib/browser/userMap/revenueShareEscrowMap.js +4 -4
- package/lib/browser/userMap/userMap.d.ts +3 -5
- package/lib/browser/userMap/userMap.js +39 -30
- package/lib/browser/userMap/userMapConfig.d.ts +3 -2
- package/lib/browser/userMap/userStatsMap.d.ts +1 -3
- package/lib/browser/userMap/userStatsMap.js +18 -17
- package/lib/browser/userStats.d.ts +7 -4
- package/lib/browser/userStats.js +28 -18
- package/lib/browser/userStatsConfig.d.ts +3 -2
- package/lib/browser/util/TransactionConfirmationManager.js +4 -2
- package/lib/browser/util/chainClock.d.ts +1 -1
- package/lib/browser/util/computeUnits.d.ts +1 -1
- package/lib/browser/util/computeUnits.js +6 -1
- package/lib/browser/util/ed25519Utils.d.ts +1 -1
- package/lib/browser/util/ed25519Utils.js +1 -1
- package/lib/browser/velocityClient.d.ts +144 -71
- package/lib/browser/velocityClient.js +653 -457
- package/lib/browser/velocityClientConfig.d.ts +0 -8
- package/lib/node/accounts/basicUserAccountSubscriber.d.ts +5 -3
- package/lib/node/accounts/basicUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/basicUserAccountSubscriber.js +4 -3
- package/lib/node/accounts/basicUserStatsAccountSubscriber.d.ts +5 -3
- package/lib/node/accounts/basicUserStatsAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/basicUserStatsAccountSubscriber.js +4 -3
- package/lib/node/accounts/bulkAccountLoader.d.ts +5 -5
- package/lib/node/accounts/bulkAccountLoader.d.ts.map +1 -1
- package/lib/node/accounts/bulkAccountLoader.js +12 -1
- package/lib/node/accounts/grpcAccountSubscriber.d.ts +2 -1
- package/lib/node/accounts/grpcAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcAccountSubscriber.js +8 -2
- package/lib/node/accounts/grpcMultiAccountSubscriber.d.ts +3 -2
- package/lib/node/accounts/grpcMultiAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcMultiAccountSubscriber.js +13 -5
- package/lib/node/accounts/grpcMultiUserAccountSubscriber.d.ts +2 -1
- package/lib/node/accounts/grpcMultiUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcMultiUserAccountSubscriber.js +12 -8
- package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts +2 -1
- package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcProgramAccountSubscriber.js +9 -3
- package/lib/node/accounts/grpcVelocityClientAccountSubscriber.d.ts +0 -4
- package/lib/node/accounts/grpcVelocityClientAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcVelocityClientAccountSubscriber.js +19 -6
- package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.d.ts +1 -5
- package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.js +44 -23
- package/lib/node/accounts/laserProgramAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/laserProgramAccountSubscriber.js +4 -1
- package/lib/node/accounts/oneShotUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/oneShotUserAccountSubscriber.js +4 -3
- package/lib/node/accounts/oneShotUserStatsAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/oneShotUserStatsAccountSubscriber.js +7 -3
- package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts +4 -2
- package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.js +3 -3
- package/lib/node/accounts/pollingOracleAccountSubscriber.d.ts +0 -2
- package/lib/node/accounts/pollingOracleAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingOracleAccountSubscriber.js +16 -5
- package/lib/node/accounts/pollingTokenAccountSubscriber.d.ts +0 -2
- package/lib/node/accounts/pollingTokenAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingTokenAccountSubscriber.js +16 -5
- package/lib/node/accounts/pollingUserAccountSubscriber.d.ts +8 -4
- package/lib/node/accounts/pollingUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingUserAccountSubscriber.js +17 -11
- package/lib/node/accounts/pollingUserStatsAccountSubscriber.d.ts +4 -2
- package/lib/node/accounts/pollingUserStatsAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingUserStatsAccountSubscriber.js +6 -6
- package/lib/node/accounts/pollingVelocityClientAccountSubscriber.d.ts +7 -5
- package/lib/node/accounts/pollingVelocityClientAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingVelocityClientAccountSubscriber.js +69 -35
- package/lib/node/accounts/types.d.ts +6 -12
- package/lib/node/accounts/types.d.ts.map +1 -1
- package/lib/node/accounts/utils.d.ts +1 -0
- package/lib/node/accounts/utils.d.ts.map +1 -1
- package/lib/node/accounts/utils.js +10 -3
- package/lib/node/accounts/webSocketAccountSubscriber.d.ts +4 -2
- package/lib/node/accounts/webSocketAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketAccountSubscriber.js +17 -5
- package/lib/node/accounts/webSocketAccountSubscriberV2.d.ts +4 -2
- package/lib/node/accounts/webSocketAccountSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/webSocketAccountSubscriberV2.js +17 -6
- package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +4 -2
- package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.js +9 -0
- package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts +3 -1
- package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketProgramAccountSubscriber.js +14 -3
- package/lib/node/accounts/webSocketProgramAccountSubscriberV2.d.ts +3 -1
- package/lib/node/accounts/webSocketProgramAccountSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/webSocketProgramAccountSubscriberV2.js +15 -3
- package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.d.ts +3 -1
- package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.js +14 -4
- package/lib/node/accounts/webSocketUserAccountSubscriber.d.ts +4 -2
- package/lib/node/accounts/webSocketUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketUserAccountSubscriber.js +9 -0
- package/lib/node/accounts/webSocketUserStatsAccountSubsriber.d.ts +4 -2
- package/lib/node/accounts/webSocketUserStatsAccountSubsriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketUserStatsAccountSubsriber.js +9 -0
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.d.ts +4 -8
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.js +52 -26
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts +7 -7
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.js +49 -20
- package/lib/node/accounts/websocketProgramUserAccountSubscriber.d.ts +1 -1
- package/lib/node/accounts/websocketProgramUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/websocketProgramUserAccountSubscriber.js +0 -3
- package/lib/node/addresses/marketAddresses.d.ts.map +1 -1
- package/lib/node/addresses/marketAddresses.js +3 -2
- package/lib/node/addresses/pda.d.ts +1 -9
- package/lib/node/addresses/pda.d.ts.map +1 -1
- package/lib/node/addresses/pda.js +4 -23
- package/lib/node/adminClient.d.ts +25 -29
- package/lib/node/adminClient.d.ts.map +1 -1
- package/lib/node/adminClient.js +168 -169
- package/lib/node/auctionSubscriber/auctionSubscriber.d.ts +2 -4
- package/lib/node/auctionSubscriber/auctionSubscriber.d.ts.map +1 -1
- package/lib/node/auctionSubscriber/auctionSubscriber.js +8 -10
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts +2 -4
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts.map +1 -1
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.js +11 -10
- package/lib/node/auctionSubscriber/types.d.ts +3 -2
- package/lib/node/auctionSubscriber/types.d.ts.map +1 -1
- package/lib/node/bankrun/bankrunConnection.d.ts +6 -4
- package/lib/node/bankrun/bankrunConnection.d.ts.map +1 -1
- package/lib/node/bankrun/bankrunConnection.js +69 -31
- package/lib/node/blockhashSubscriber/BlockhashSubscriber.d.ts +1 -1
- package/lib/node/blockhashSubscriber/BlockhashSubscriber.d.ts.map +1 -1
- package/lib/node/blockhashSubscriber/BlockhashSubscriber.js +3 -2
- package/lib/node/clock/clockSubscriber.d.ts +6 -6
- package/lib/node/clock/clockSubscriber.d.ts.map +1 -1
- package/lib/node/clock/clockSubscriber.js +4 -3
- package/lib/node/config.d.ts +11 -20
- package/lib/node/config.d.ts.map +1 -1
- package/lib/node/config.js +13 -36
- package/lib/node/constants/index.d.ts +1 -2
- package/lib/node/constants/index.d.ts.map +1 -1
- package/lib/node/constants/index.js +1 -2
- package/lib/node/constants/numericConstants.d.ts +1 -3
- package/lib/node/constants/numericConstants.d.ts.map +1 -1
- package/lib/node/constants/numericConstants.js +3 -5
- package/lib/node/constituentMap/constituentMap.d.ts +0 -2
- package/lib/node/constituentMap/constituentMap.d.ts.map +1 -1
- package/lib/node/constituentMap/constituentMap.js +10 -6
- package/lib/node/constituentMap/pollingConstituentAccountSubscriber.d.ts.map +1 -1
- package/lib/node/constituentMap/pollingConstituentAccountSubscriber.js +3 -2
- package/lib/node/constituentMap/webSocketConstituentAccountSubscriber.d.ts +2 -3
- package/lib/node/constituentMap/webSocketConstituentAccountSubscriber.d.ts.map +1 -1
- package/lib/node/constituentMap/webSocketConstituentAccountSubscriber.js +10 -3
- package/lib/node/core/VelocityCore.d.ts +9 -15
- package/lib/node/core/VelocityCore.d.ts.map +1 -1
- package/lib/node/core/VelocityCore.js +5 -7
- package/lib/node/core/instructions/perpOrders.d.ts +14 -0
- package/lib/node/core/instructions/perpOrders.d.ts.map +1 -1
- package/lib/node/core/instructions/perpOrders.js +14 -0
- package/lib/node/core/instructions/withdraw.d.ts +1 -1
- package/lib/node/core/instructions/withdraw.d.ts.map +1 -1
- package/lib/node/core/instructions/withdraw.js +1 -1
- package/lib/node/core/remainingAccounts.d.ts +2 -2
- package/lib/node/core/remainingAccounts.d.ts.map +1 -1
- package/lib/node/core/remainingAccounts.js +5 -5
- package/lib/node/decode/user.d.ts.map +1 -1
- package/lib/node/decode/user.js +9 -1
- package/lib/node/dlob/DLOB.d.ts +7 -2
- package/lib/node/dlob/DLOB.d.ts.map +1 -1
- package/lib/node/dlob/DLOB.js +205 -142
- package/lib/node/dlob/DLOBNode.d.ts +5 -2
- package/lib/node/dlob/DLOBNode.d.ts.map +1 -1
- package/lib/node/dlob/DLOBNode.js +7 -0
- package/lib/node/dlob/DLOBSubscriber.d.ts +0 -2
- package/lib/node/dlob/DLOBSubscriber.d.ts.map +1 -1
- package/lib/node/dlob/DLOBSubscriber.js +39 -39
- package/lib/node/dlob/NodeList.d.ts.map +1 -1
- package/lib/node/dlob/NodeList.js +8 -7
- package/lib/node/dlob/orderBookLevels.d.ts.map +1 -1
- package/lib/node/dlob/orderBookLevels.js +24 -17
- package/lib/node/dlob/types.d.ts +0 -2
- package/lib/node/dlob/types.d.ts.map +1 -1
- package/lib/node/events/eventList.d.ts +3 -3
- package/lib/node/events/eventList.d.ts.map +1 -1
- package/lib/node/events/eventList.js +4 -1
- package/lib/node/events/eventSubscriber.d.ts +6 -3
- package/lib/node/events/eventSubscriber.d.ts.map +1 -1
- package/lib/node/events/eventSubscriber.js +75 -26
- package/lib/node/events/eventsServerLogProvider.d.ts +2 -2
- package/lib/node/events/eventsServerLogProvider.d.ts.map +1 -1
- package/lib/node/events/eventsServerLogProvider.js +17 -10
- package/lib/node/events/fetchLogs.d.ts +1 -1
- package/lib/node/events/fetchLogs.d.ts.map +1 -1
- package/lib/node/events/fetchLogs.js +4 -2
- package/lib/node/events/parse.d.ts.map +1 -1
- package/lib/node/events/parse.js +14 -14
- package/lib/node/events/pollingLogProvider.d.ts +2 -2
- package/lib/node/events/pollingLogProvider.d.ts.map +1 -1
- package/lib/node/events/pollingLogProvider.js +1 -0
- package/lib/node/events/txEventCache.d.ts +3 -3
- package/lib/node/events/txEventCache.d.ts.map +1 -1
- package/lib/node/events/txEventCache.js +6 -2
- package/lib/node/events/types.d.ts +3 -7
- package/lib/node/events/types.d.ts.map +1 -1
- package/lib/node/events/types.js +1 -3
- package/lib/node/events/webSocketLogProvider.d.ts +2 -2
- package/lib/node/events/webSocketLogProvider.d.ts.map +1 -1
- package/lib/node/events/webSocketLogProvider.js +5 -2
- package/lib/node/factory/bigNum.js +1 -1
- package/lib/{browser/idl/drift.d.ts → node/idl/velocity.d.ts} +2413 -2480
- package/lib/node/idl/velocity.d.ts.map +1 -0
- package/lib/node/idl/{drift.json → velocity.json} +2265 -2333
- package/lib/node/index.d.ts +1 -3
- package/lib/node/index.d.ts.map +1 -1
- package/lib/node/index.js +1 -4
- package/lib/node/jupiter/jupiterClient.d.ts +1 -1
- package/lib/node/jupiter/jupiterClient.d.ts.map +1 -1
- package/lib/node/jupiter/jupiterClient.js +18 -8
- package/lib/node/marginCalculation.d.ts.map +1 -1
- package/lib/node/marginCalculation.js +1 -0
- package/lib/node/math/amm.d.ts +31 -13
- package/lib/node/math/amm.d.ts.map +1 -1
- package/lib/node/math/amm.js +87 -31
- package/lib/node/math/auction.d.ts.map +1 -1
- package/lib/node/math/auction.js +16 -12
- package/lib/node/math/bankruptcy.js +1 -1
- package/lib/node/math/builder.d.ts +18 -1
- package/lib/node/math/builder.d.ts.map +1 -1
- package/lib/node/math/builder.js +32 -1
- package/lib/node/math/funding.d.ts.map +1 -1
- package/lib/node/math/funding.js +30 -30
- package/lib/node/math/insurance.d.ts +1 -1
- package/lib/node/math/insurance.d.ts.map +1 -1
- package/lib/node/math/insurance.js +4 -5
- package/lib/node/math/margin.d.ts +3 -11
- package/lib/node/math/margin.d.ts.map +1 -1
- package/lib/node/math/margin.js +10 -69
- package/lib/node/math/market.d.ts +4 -12
- package/lib/node/math/market.d.ts.map +1 -1
- package/lib/node/math/market.js +12 -46
- package/lib/node/math/oracles.d.ts +4 -7
- package/lib/node/math/oracles.d.ts.map +1 -1
- package/lib/node/math/oracles.js +24 -37
- package/lib/node/math/orders.d.ts +2 -7
- package/lib/node/math/orders.d.ts.map +1 -1
- package/lib/node/math/orders.js +9 -81
- package/lib/node/math/position.d.ts +1 -5
- package/lib/node/math/position.d.ts.map +1 -1
- package/lib/node/math/position.js +6 -11
- package/lib/node/math/repeg.d.ts +0 -1
- package/lib/node/math/repeg.d.ts.map +1 -1
- package/lib/node/math/repeg.js +1 -23
- package/lib/node/math/spotBalance.d.ts +4 -4
- package/lib/node/math/spotBalance.d.ts.map +1 -1
- package/lib/node/math/spotBalance.js +6 -6
- package/lib/node/math/spotMarket.d.ts +0 -6
- package/lib/node/math/spotMarket.d.ts.map +1 -1
- package/lib/node/math/spotMarket.js +1 -16
- package/lib/node/math/spotPosition.d.ts +4 -4
- package/lib/node/math/spotPosition.d.ts.map +1 -1
- package/lib/node/math/state.d.ts +0 -2
- package/lib/node/math/state.d.ts.map +1 -1
- package/lib/node/math/state.js +1 -9
- package/lib/node/math/superStake.d.ts +11 -63
- package/lib/node/math/superStake.d.ts.map +1 -1
- package/lib/node/math/superStake.js +29 -28
- package/lib/node/math/trade.d.ts +2 -2
- package/lib/node/math/trade.d.ts.map +1 -1
- package/lib/node/math/trade.js +7 -7
- package/lib/node/math/utils.d.ts +1 -1
- package/lib/node/math/utils.js +1 -1
- package/lib/node/memcmp.d.ts +0 -1
- package/lib/node/memcmp.d.ts.map +1 -1
- package/lib/node/memcmp.js +1 -10
- package/lib/node/oracles/oracleClientCache.d.ts +1 -1
- package/lib/node/oracles/prelaunchOracleClient.d.ts.map +1 -1
- package/lib/node/oracles/prelaunchOracleClient.js +3 -2
- package/lib/node/oracles/pythClient.d.ts.map +1 -1
- package/lib/node/oracles/pythClient.js +9 -3
- package/lib/node/oracles/pythLazerClient.d.ts.map +1 -1
- package/lib/node/oracles/pythLazerClient.js +5 -4
- package/lib/node/oracles/utils.d.ts +4 -0
- package/lib/node/oracles/utils.d.ts.map +1 -1
- package/lib/node/oracles/utils.js +9 -1
- package/lib/node/orderSubscriber/OrderSubscriber.d.ts +1 -3
- package/lib/node/orderSubscriber/OrderSubscriber.d.ts.map +1 -1
- package/lib/node/orderSubscriber/OrderSubscriber.js +16 -14
- package/lib/node/orderSubscriber/WebsocketSubscription.js +1 -1
- package/lib/node/orderSubscriber/grpcSubscription.js +2 -2
- package/lib/node/orderSubscriber/types.d.ts +0 -2
- package/lib/node/orderSubscriber/types.d.ts.map +1 -1
- package/lib/node/priorityFee/heliusPriorityFeeMethod.d.ts +1 -1
- package/lib/node/priorityFee/heliusPriorityFeeMethod.d.ts.map +1 -1
- package/lib/node/priorityFee/priorityFeeSubscriber.d.ts +2 -6
- package/lib/node/priorityFee/priorityFeeSubscriber.d.ts.map +1 -1
- package/lib/node/priorityFee/priorityFeeSubscriber.js +34 -18
- package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts +0 -4
- package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts.map +1 -1
- package/lib/node/priorityFee/priorityFeeSubscriberMap.js +3 -11
- package/lib/node/priorityFee/solanaPriorityFeeMethod.d.ts +1 -1
- package/lib/node/priorityFee/solanaPriorityFeeMethod.d.ts.map +1 -1
- package/lib/node/priorityFee/types.d.ts +3 -8
- package/lib/node/priorityFee/types.d.ts.map +1 -1
- package/lib/node/priorityFee/velocityPriorityFeeMethod.d.ts +0 -8
- package/lib/node/priorityFee/velocityPriorityFeeMethod.d.ts.map +1 -1
- package/lib/node/priorityFee/velocityPriorityFeeMethod.js +1 -3
- package/lib/node/pyth/pythLazerSubscriber.d.ts +1 -1
- package/lib/node/pyth/pythLazerSubscriber.js +1 -1
- package/lib/node/pyth/types.d.ts +0 -1
- package/lib/node/pyth/types.d.ts.map +1 -1
- package/lib/node/slot/SlotSubscriber.d.ts +1 -1
- package/lib/node/slot/SlotSubscriber.d.ts.map +1 -1
- package/lib/node/slot/SlotSubscriber.js +2 -1
- package/lib/node/slot/SlothashSubscriber.d.ts +3 -2
- package/lib/node/slot/SlothashSubscriber.d.ts.map +1 -1
- package/lib/node/slot/SlothashSubscriber.js +11 -4
- package/lib/node/swap/UnifiedSwapClient.js +1 -1
- package/lib/node/swift/grpcSignedMsgUserAccountSubscriber.d.ts +0 -3
- package/lib/node/swift/grpcSignedMsgUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/swift/grpcSignedMsgUserAccountSubscriber.js +5 -5
- package/lib/node/swift/signedMsgUserAccountSubscriber.d.ts +7 -7
- package/lib/node/swift/signedMsgUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/swift/signedMsgUserAccountSubscriber.js +14 -10
- package/lib/node/swift/swiftOrderSubscriber.d.ts +7 -6
- package/lib/node/swift/swiftOrderSubscriber.d.ts.map +1 -1
- package/lib/node/swift/swiftOrderSubscriber.js +15 -16
- package/lib/node/testClient.js +3 -2
- package/lib/node/tokenFaucet.d.ts.map +1 -1
- package/lib/node/tokenFaucet.js +16 -2
- package/lib/node/tx/baseTxSender.d.ts +4 -4
- package/lib/node/tx/baseTxSender.d.ts.map +1 -1
- package/lib/node/tx/baseTxSender.js +5 -4
- package/lib/node/tx/fastSingleTxSender.d.ts +3 -3
- package/lib/node/tx/fastSingleTxSender.d.ts.map +1 -1
- package/lib/node/tx/fastSingleTxSender.js +9 -5
- package/lib/node/tx/reportTransactionError.d.ts +2 -2
- package/lib/node/tx/reportTransactionError.d.ts.map +1 -1
- package/lib/node/tx/reportTransactionError.js +5 -1
- package/lib/node/tx/retryTxSender.d.ts +1 -1
- package/lib/node/tx/retryTxSender.d.ts.map +1 -1
- package/lib/node/tx/retryTxSender.js +4 -2
- package/lib/node/tx/txHandler.d.ts +9 -3
- package/lib/node/tx/txHandler.d.ts.map +1 -1
- package/lib/node/tx/txHandler.js +54 -40
- package/lib/node/tx/txParamProcessor.d.ts +4 -1
- package/lib/node/tx/txParamProcessor.d.ts.map +1 -1
- package/lib/node/tx/txParamProcessor.js +6 -0
- package/lib/node/tx/types.d.ts +1 -1
- package/lib/node/tx/types.d.ts.map +1 -1
- package/lib/node/tx/whileValidTxSender.d.ts +1 -6
- package/lib/node/tx/whileValidTxSender.d.ts.map +1 -1
- package/lib/node/tx/whileValidTxSender.js +35 -13
- package/lib/node/types.d.ts +100 -155
- package/lib/node/types.d.ts.map +1 -1
- package/lib/node/types.js +6 -2
- package/lib/node/user.d.ts +22 -10
- package/lib/node/user.d.ts.map +1 -1
- package/lib/node/user.js +174 -154
- package/lib/node/userConfig.d.ts +3 -2
- package/lib/node/userConfig.d.ts.map +1 -1
- package/lib/node/userMap/WebsocketSubscription.d.ts +1 -1
- package/lib/node/userMap/WebsocketSubscription.d.ts.map +1 -1
- package/lib/node/userMap/WebsocketSubscription.js +1 -1
- package/lib/node/userMap/grpcSubscription.d.ts +1 -1
- package/lib/node/userMap/grpcSubscription.d.ts.map +1 -1
- package/lib/node/userMap/grpcSubscription.js +1 -1
- package/lib/node/userMap/referrerMap.d.ts +0 -2
- package/lib/node/userMap/referrerMap.d.ts.map +1 -1
- package/lib/node/userMap/referrerMap.js +10 -7
- package/lib/node/userMap/revenueShareEscrowMap.d.ts +0 -2
- 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 +3 -5
- package/lib/node/userMap/userMap.d.ts.map +1 -1
- package/lib/node/userMap/userMap.js +39 -30
- package/lib/node/userMap/userMapConfig.d.ts +3 -2
- package/lib/node/userMap/userMapConfig.d.ts.map +1 -1
- package/lib/node/userMap/userStatsMap.d.ts +1 -3
- package/lib/node/userMap/userStatsMap.d.ts.map +1 -1
- package/lib/node/userMap/userStatsMap.js +18 -17
- package/lib/node/userStats.d.ts +7 -4
- package/lib/node/userStats.d.ts.map +1 -1
- package/lib/node/userStats.js +28 -18
- package/lib/node/userStatsConfig.d.ts +3 -2
- package/lib/node/userStatsConfig.d.ts.map +1 -1
- package/lib/node/util/TransactionConfirmationManager.d.ts.map +1 -1
- package/lib/node/util/TransactionConfirmationManager.js +4 -2
- package/lib/node/util/chainClock.d.ts +1 -1
- package/lib/node/util/chainClock.d.ts.map +1 -1
- package/lib/node/util/computeUnits.d.ts +1 -1
- package/lib/node/util/computeUnits.d.ts.map +1 -1
- package/lib/node/util/computeUnits.js +6 -1
- package/lib/node/util/ed25519Utils.d.ts +1 -1
- package/lib/node/util/ed25519Utils.js +1 -1
- package/lib/node/velocityClient.d.ts +145 -72
- package/lib/node/velocityClient.d.ts.map +1 -1
- package/lib/node/velocityClient.js +653 -457
- package/lib/node/velocityClientConfig.d.ts +0 -8
- package/lib/node/velocityClientConfig.d.ts.map +1 -1
- package/package.json +10 -9
- package/scripts/deposit-isolated-positions.ts +2 -2
- package/scripts/find-flagged-users.ts +1 -1
- package/scripts/grpc-client-test-comparison.ts +4 -4
- package/scripts/grpc-multiuser-client-test-comparison.ts +2 -2
- package/scripts/single-grpc-client-test.ts +3 -3
- package/scripts/updateVersion.js +4 -4
- package/scripts/withdraw-isolated-positions.ts +2 -2
- package/src/accounts/basicUserAccountSubscriber.ts +7 -5
- package/src/accounts/basicUserStatsAccountSubscriber.ts +9 -5
- package/src/accounts/bulkAccountLoader.ts +20 -7
- package/src/accounts/grpcAccountSubscriber.ts +11 -3
- package/src/accounts/grpcMultiAccountSubscriber.ts +24 -9
- package/src/accounts/grpcMultiUserAccountSubscriber.ts +16 -12
- package/src/accounts/grpcProgramAccountSubscriber.ts +12 -4
- package/src/accounts/grpcVelocityClientAccountSubscriber.ts +17 -14
- package/src/accounts/grpcVelocityClientAccountSubscriberV2.ts +69 -49
- package/src/accounts/laserProgramAccountSubscriber.ts +4 -1
- package/src/accounts/oneShotUserAccountSubscriber.ts +5 -3
- package/src/accounts/oneShotUserStatsAccountSubscriber.ts +8 -3
- package/src/accounts/pollingInsuranceFundStakeAccountSubscriber.ts +11 -5
- package/src/accounts/pollingOracleAccountSubscriber.ts +17 -10
- package/src/accounts/pollingTokenAccountSubscriber.ts +17 -10
- package/src/accounts/pollingUserAccountSubscriber.ts +26 -20
- package/src/accounts/pollingUserStatsAccountSubscriber.ts +12 -10
- package/src/accounts/pollingVelocityClientAccountSubscriber.ts +80 -41
- package/src/accounts/types.ts +8 -13
- package/src/accounts/utils.ts +12 -2
- package/src/accounts/webSocketAccountSubscriber.ts +23 -10
- package/src/accounts/webSocketAccountSubscriberV2.ts +23 -8
- package/src/accounts/webSocketInsuranceFundStakeAccountSubscriber.ts +17 -2
- package/src/accounts/webSocketProgramAccountSubscriber.ts +29 -4
- package/src/accounts/webSocketProgramAccountSubscriberV2.ts +30 -4
- package/src/accounts/webSocketProgramAccountsSubscriberV2.ts +29 -4
- package/src/accounts/webSocketUserAccountSubscriber.ts +11 -2
- package/src/accounts/webSocketUserStatsAccountSubsriber.ts +15 -2
- package/src/accounts/webSocketVelocityClientAccountSubscriber.ts +79 -58
- package/src/accounts/webSocketVelocityClientAccountSubscriberV2.ts +77 -45
- package/src/accounts/websocketProgramUserAccountSubscriber.ts +1 -6
- package/src/addresses/marketAddresses.ts +3 -2
- package/src/addresses/pda.ts +3 -38
- package/src/adminClient.ts +285 -315
- package/src/auctionSubscriber/auctionSubscriber.ts +8 -11
- package/src/auctionSubscriber/auctionSubscriberGrpc.ts +13 -11
- package/src/auctionSubscriber/types.ts +3 -3
- package/src/bankrun/bankrunConnection.ts +83 -39
- package/src/blockhashSubscriber/BlockhashSubscriber.ts +5 -4
- package/src/clock/clockSubscriber.ts +10 -9
- package/src/config.ts +16 -70
- package/src/constants/index.ts +1 -2
- package/src/constants/numericConstants.ts +3 -3
- package/src/constituentMap/constituentMap.ts +10 -7
- package/src/constituentMap/pollingConstituentAccountSubscriber.ts +4 -2
- package/src/constituentMap/webSocketConstituentAccountSubscriber.ts +13 -4
- package/src/core/VelocityCore.ts +11 -20
- package/src/core/instructions/perpOrders.ts +14 -0
- package/src/core/instructions/withdraw.ts +2 -2
- package/src/core/remainingAccounts.ts +7 -7
- package/src/decode/user.ts +8 -1
- package/src/dlob/DLOB.ts +300 -176
- package/src/dlob/DLOBNode.ts +23 -3
- package/src/dlob/DLOBSubscriber.ts +53 -42
- package/src/dlob/NodeList.ts +8 -7
- package/src/dlob/orderBookLevels.ts +51 -25
- package/src/dlob/types.ts +0 -2
- package/src/events/eventList.ts +4 -1
- package/src/events/eventSubscriber.ts +108 -50
- package/src/events/eventsServerLogProvider.ts +24 -15
- package/src/events/fetchLogs.ts +3 -3
- package/src/events/parse.ts +14 -14
- package/src/events/pollingLogProvider.ts +2 -2
- package/src/events/txEventCache.ts +8 -2
- package/src/events/types.ts +4 -15
- package/src/events/webSocketLogProvider.ts +5 -3
- package/src/factory/bigNum.ts +2 -2
- package/src/idl/{drift.json → velocity.json} +2265 -2333
- package/src/idl/{drift.ts → velocity.ts} +2267 -2335
- package/src/index.ts +1 -6
- package/src/jupiter/jupiterClient.ts +30 -10
- package/src/margin/README.md +2 -2
- package/src/marginCalculation.ts +1 -0
- package/src/math/amm.ts +217 -40
- package/src/math/auction.ts +16 -12
- package/src/math/bankruptcy.ts +1 -1
- package/src/math/builder.ts +45 -1
- package/src/math/funding.ts +51 -47
- package/src/math/insurance.ts +6 -8
- package/src/math/margin.ts +12 -119
- package/src/math/market.ts +16 -98
- package/src/math/oracles.ts +29 -43
- package/src/math/orders.ts +13 -109
- package/src/math/position.ts +6 -12
- package/src/math/repeg.ts +0 -29
- package/src/math/spotBalance.ts +14 -10
- package/src/math/spotMarket.ts +2 -28
- package/src/math/spotPosition.ts +4 -4
- package/src/math/state.ts +0 -8
- package/src/math/superStake.ts +36 -85
- package/src/math/trade.ts +7 -3
- package/src/math/utils.ts +1 -1
- package/src/memcmp.ts +0 -9
- package/src/oracles/prelaunchOracleClient.ts +7 -2
- package/src/oracles/pythClient.ts +12 -3
- package/src/oracles/pythLazerClient.ts +10 -5
- package/src/oracles/utils.ts +15 -0
- package/src/orderSubscriber/OrderSubscriber.ts +12 -12
- package/src/orderSubscriber/WebsocketSubscription.ts +1 -1
- package/src/orderSubscriber/grpcSubscription.ts +2 -2
- package/src/orderSubscriber/types.ts +0 -2
- package/src/priorityFee/heliusPriorityFeeMethod.ts +1 -1
- package/src/priorityFee/priorityFeeSubscriber.ts +50 -21
- package/src/priorityFee/priorityFeeSubscriberMap.ts +2 -10
- package/src/priorityFee/solanaPriorityFeeMethod.ts +1 -1
- package/src/priorityFee/types.ts +3 -13
- package/src/priorityFee/velocityPriorityFeeMethod.ts +0 -12
- package/src/pyth/pythLazerSubscriber.ts +1 -1
- package/src/pyth/types.ts +0 -2
- package/src/slot/SlotSubscriber.ts +3 -3
- package/src/slot/SlothashSubscriber.ts +17 -6
- package/src/swap/UnifiedSwapClient.ts +1 -1
- package/src/swift/grpcSignedMsgUserAccountSubscriber.ts +5 -6
- package/src/swift/signedMsgUserAccountSubscriber.ts +18 -16
- package/src/swift/swiftOrderSubscriber.ts +17 -21
- package/src/testClient.ts +2 -2
- package/src/tokenFaucet.ts +22 -3
- package/src/tx/baseTxSender.ts +10 -10
- package/src/tx/fastSingleTxSender.ts +12 -8
- package/src/tx/reportTransactionError.ts +12 -7
- package/src/tx/retryTxSender.ts +6 -4
- package/src/tx/txHandler.ts +88 -43
- package/src/tx/txParamProcessor.ts +18 -3
- package/src/tx/types.ts +1 -1
- package/src/tx/whileValidTxSender.ts +51 -22
- package/src/types.ts +119 -173
- package/src/user.ts +208 -165
- package/src/userConfig.ts +1 -3
- package/src/userMap/WebsocketSubscription.ts +2 -2
- package/src/userMap/grpcSubscription.ts +2 -2
- package/src/userMap/referrerMap.ts +13 -13
- package/src/userMap/revenueShareEscrowMap.ts +6 -5
- package/src/userMap/userMap.ts +46 -32
- package/src/userMap/userMapConfig.ts +3 -3
- package/src/userMap/userStatsMap.ts +32 -23
- package/src/userStats.ts +22 -13
- package/src/userStatsConfig.ts +3 -3
- package/src/util/TransactionConfirmationManager.ts +10 -2
- package/src/util/chainClock.ts +1 -1
- package/src/util/computeUnits.ts +7 -3
- package/src/util/ed25519Utils.ts +1 -1
- package/src/velocityClient.ts +867 -600
- package/src/velocityClientConfig.ts +0 -10
- package/tests/{DriftCore → VelocityCore}/decode.test.ts +1 -1
- package/tests/{DriftCore → VelocityCore}/fill_trigger.test.ts +1 -1
- package/tests/{DriftCore → VelocityCore}/instructions.test.ts +1 -1
- package/tests/{DriftCore → VelocityCore}/pdas.test.ts +4 -2
- package/tests/amm/test.ts +138 -0
- package/tests/ci/verifyConstants.ts +24 -27
- package/tests/decode/test.ts +2 -2
- package/tests/dlob/helpers.ts +11 -10
- package/tests/events/parseLogsForCuUsage.ts +15 -15
- package/tests/user/helpers.ts +9 -9
- package/tests/user/test.ts +13 -10
- package/tsconfig.json +1 -0
- package/lib/browser/constants/insuranceFund.d.ts +0 -5
- package/lib/browser/constants/insuranceFund.js +0 -9
- package/lib/browser/tx/forwardOnlyTxSender.d.ts +0 -37
- package/lib/browser/tx/forwardOnlyTxSender.js +0 -92
- package/lib/browser/util/deprecatedAlias.d.ts +0 -26
- package/lib/browser/util/deprecatedAlias.js +0 -10
- package/lib/browser/util/tps.d.ts +0 -2
- package/lib/browser/util/tps.js +0 -16
- package/lib/node/constants/insuranceFund.d.ts +0 -6
- package/lib/node/constants/insuranceFund.d.ts.map +0 -1
- package/lib/node/constants/insuranceFund.js +0 -9
- package/lib/node/idl/drift.d.ts.map +0 -1
- package/lib/node/tx/forwardOnlyTxSender.d.ts +0 -38
- package/lib/node/tx/forwardOnlyTxSender.d.ts.map +0 -1
- package/lib/node/tx/forwardOnlyTxSender.js +0 -92
- package/lib/node/util/deprecatedAlias.d.ts +0 -27
- package/lib/node/util/deprecatedAlias.d.ts.map +0 -1
- package/lib/node/util/deprecatedAlias.js +0 -10
- package/lib/node/util/tps.d.ts +0 -3
- package/lib/node/util/tps.d.ts.map +0 -1
- package/lib/node/util/tps.js +0 -16
- package/src/constants/insuranceFund.ts +0 -8
- package/src/tx/forwardOnlyTxSender.ts +0 -145
- package/src/util/deprecatedAlias.ts +0 -21
- package/src/util/tps.ts +0 -27
- /package/lib/browser/idl/{drift.js → velocity.js} +0 -0
- /package/lib/node/idl/{drift.js → velocity.js} +0 -0
- /package/tests/{DriftCore → VelocityCore}/perp_orders.test.ts +0 -0
- /package/tests/{DriftCore → VelocityCore}/remainingAccounts.test.ts +0 -0
- /package/tests/{DriftCore → VelocityCore}/settlement_liquidation.test.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.grpcVelocityClientAccountSubscriberV2 = void 0;
|
|
4
4
|
const events_1 = require("events");
|
|
5
5
|
const web3_js_1 = require("@solana/web3.js");
|
|
6
6
|
const config_1 = require("../config");
|
|
@@ -21,6 +21,8 @@ class grpcVelocityClientAccountSubscriberV2 {
|
|
|
21
21
|
this.spotOracleStringMap = new Map();
|
|
22
22
|
this.oracleIdToOracleDataMap = new Map();
|
|
23
23
|
this.oracleClientCache = new oracleClientCache_1.OracleClientCache();
|
|
24
|
+
this.subscriptionPromiseResolver = () => { };
|
|
25
|
+
this.subscriptionPromise = Promise.resolve(false);
|
|
24
26
|
this.chunks = (array, size) => {
|
|
25
27
|
return new Array(Math.ceil(array.length / size))
|
|
26
28
|
.fill(null)
|
|
@@ -75,11 +77,15 @@ class grpcVelocityClientAccountSubscriberV2 {
|
|
|
75
77
|
const oracleAccountPubkeyChunks = this.chunks(this.oracleInfos.map((oracleInfo) => oracleInfo.publicKey), 75);
|
|
76
78
|
const oracleAccountInfos = (await Promise.all(oracleAccountPubkeyChunks.map((oracleAccountPublicKeysChunk) => connection.getMultipleAccountsInfo(oracleAccountPublicKeysChunk)))).flat();
|
|
77
79
|
this.initialOraclePriceData = new Map(this.oracleInfos.reduce((result, oracleInfo, i) => {
|
|
78
|
-
|
|
80
|
+
const oracleAccountInfo = oracleAccountInfos[i];
|
|
81
|
+
if (!oracleAccountInfo) {
|
|
79
82
|
return result;
|
|
80
83
|
}
|
|
81
84
|
const oracleClient = this.oracleClientCache.get(oracleInfo.source, connection, this.program);
|
|
82
|
-
|
|
85
|
+
if (!oracleClient) {
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
const oraclePriceData = oracleClient.getOraclePriceDataFromBuffer(oracleAccountInfo.data);
|
|
83
89
|
result.push([
|
|
84
90
|
(0, oracleId_1.getOracleId)(oracleInfo.publicKey, oracleInfo.source),
|
|
85
91
|
oraclePriceData,
|
|
@@ -187,11 +193,19 @@ class grpcVelocityClientAccountSubscriberV2 {
|
|
|
187
193
|
}
|
|
188
194
|
getMarketAccountAndSlot(marketIndex) {
|
|
189
195
|
var _a;
|
|
190
|
-
|
|
196
|
+
const accountPubkey = this.perpMarketIndexToAccountPubkeyMap.get(marketIndex);
|
|
197
|
+
if (!accountPubkey) {
|
|
198
|
+
return undefined;
|
|
199
|
+
}
|
|
200
|
+
return (_a = this.perpMarketsSubscriber) === null || _a === void 0 ? void 0 : _a.getAccountData(accountPubkey);
|
|
191
201
|
}
|
|
192
202
|
getSpotMarketAccountAndSlot(marketIndex) {
|
|
193
203
|
var _a;
|
|
194
|
-
|
|
204
|
+
const accountPubkey = this.spotMarketIndexToAccountPubkeyMap.get(marketIndex);
|
|
205
|
+
if (!accountPubkey) {
|
|
206
|
+
return undefined;
|
|
207
|
+
}
|
|
208
|
+
return (_a = this.spotMarketsSubscriber) === null || _a === void 0 ? void 0 : _a.getAccountData(accountPubkey);
|
|
195
209
|
}
|
|
196
210
|
getOraclePriceDataAndSlot(oracleId) {
|
|
197
211
|
this.assertIsSubscribed();
|
|
@@ -206,8 +220,8 @@ class grpcVelocityClientAccountSubscriberV2 {
|
|
|
206
220
|
if (!perpMarketAccount || !oracleId) {
|
|
207
221
|
return undefined;
|
|
208
222
|
}
|
|
209
|
-
if (!perpMarketAccount.data.
|
|
210
|
-
// If the oracle has changed
|
|
223
|
+
if (!oracle || !perpMarketAccount.data.oracle.equals(oracle)) {
|
|
224
|
+
// If the oracle has changed (or not yet cached), update the oracle map in background
|
|
211
225
|
this.setPerpOracleMap();
|
|
212
226
|
}
|
|
213
227
|
return this.getOraclePriceDataAndSlot(oracleId);
|
|
@@ -219,16 +233,16 @@ class grpcVelocityClientAccountSubscriberV2 {
|
|
|
219
233
|
if (!spotMarketAccount || !oracleId) {
|
|
220
234
|
return undefined;
|
|
221
235
|
}
|
|
222
|
-
if (!spotMarketAccount.data.oracle.equals(oracle)) {
|
|
223
|
-
// If the oracle has changed
|
|
236
|
+
if (!oracle || !spotMarketAccount.data.oracle.equals(oracle)) {
|
|
237
|
+
// If the oracle has changed (or not yet cached), update the oracle map in background
|
|
224
238
|
this.setSpotOracleMap();
|
|
225
239
|
}
|
|
226
240
|
return this.getOraclePriceDataAndSlot(oracleId);
|
|
227
241
|
}
|
|
228
242
|
async setPerpOracleMap() {
|
|
229
|
-
var _a, _c;
|
|
243
|
+
var _a, _c, _d;
|
|
230
244
|
const perpMarketsMap = (_a = this.perpMarketsSubscriber) === null || _a === void 0 ? void 0 : _a.getAccountDataMap();
|
|
231
|
-
const perpMarkets = Array.from(perpMarketsMap.values());
|
|
245
|
+
const perpMarkets = Array.from((_c = perpMarketsMap === null || perpMarketsMap === void 0 ? void 0 : perpMarketsMap.values()) !== null && _c !== void 0 ? _c : []);
|
|
232
246
|
const addOraclePromises = [];
|
|
233
247
|
for (const perpMarket of perpMarkets) {
|
|
234
248
|
if (!perpMarket || !perpMarket.data) {
|
|
@@ -236,12 +250,12 @@ class grpcVelocityClientAccountSubscriberV2 {
|
|
|
236
250
|
}
|
|
237
251
|
const perpMarketAccount = perpMarket.data;
|
|
238
252
|
const perpMarketIndex = perpMarketAccount.marketIndex;
|
|
239
|
-
const oracle = perpMarketAccount.
|
|
240
|
-
const oracleId = (0, oracleId_1.getOracleId)(oracle, perpMarket.data.
|
|
241
|
-
if (!((
|
|
253
|
+
const oracle = perpMarketAccount.oracle;
|
|
254
|
+
const oracleId = (0, oracleId_1.getOracleId)(oracle, perpMarket.data.oracleSource);
|
|
255
|
+
if (!((_d = this.oracleMultiSubscriber) === null || _d === void 0 ? void 0 : _d.getAccountDataMap().has(oracleId))) {
|
|
242
256
|
addOraclePromises.push(this.addOracle({
|
|
243
257
|
publicKey: oracle,
|
|
244
|
-
source: perpMarket.data.
|
|
258
|
+
source: perpMarket.data.oracleSource,
|
|
245
259
|
}));
|
|
246
260
|
}
|
|
247
261
|
this.perpOracleMap.set(perpMarketIndex, oracle);
|
|
@@ -250,9 +264,9 @@ class grpcVelocityClientAccountSubscriberV2 {
|
|
|
250
264
|
await Promise.all(addOraclePromises);
|
|
251
265
|
}
|
|
252
266
|
async setSpotOracleMap() {
|
|
253
|
-
var _a, _c;
|
|
267
|
+
var _a, _c, _d;
|
|
254
268
|
const spotMarketsMap = (_a = this.spotMarketsSubscriber) === null || _a === void 0 ? void 0 : _a.getAccountDataMap();
|
|
255
|
-
const spotMarkets = Array.from(spotMarketsMap.values());
|
|
269
|
+
const spotMarkets = Array.from((_c = spotMarketsMap === null || spotMarketsMap === void 0 ? void 0 : spotMarketsMap.values()) !== null && _c !== void 0 ? _c : []);
|
|
256
270
|
const addOraclePromises = [];
|
|
257
271
|
for (const spotMarket of spotMarkets) {
|
|
258
272
|
if (!spotMarket || !spotMarket.data) {
|
|
@@ -262,7 +276,7 @@ class grpcVelocityClientAccountSubscriberV2 {
|
|
|
262
276
|
const spotMarketIndex = spotMarketAccount.marketIndex;
|
|
263
277
|
const oracle = spotMarketAccount.oracle;
|
|
264
278
|
const oracleId = (0, oracleId_1.getOracleId)(oracle, spotMarketAccount.oracleSource);
|
|
265
|
-
if (!((
|
|
279
|
+
if (!((_d = this.oracleMultiSubscriber) === null || _d === void 0 ? void 0 : _d.getAccountDataMap().has(oracleId))) {
|
|
266
280
|
addOraclePromises.push(this.addOracle({
|
|
267
281
|
publicKey: oracle,
|
|
268
282
|
source: spotMarketAccount.oracleSource,
|
|
@@ -361,7 +375,13 @@ class grpcVelocityClientAccountSubscriberV2 {
|
|
|
361
375
|
if (!pubkey) {
|
|
362
376
|
throw new Error('Oracle pubkey missing in decode');
|
|
363
377
|
}
|
|
378
|
+
if (!accountProps) {
|
|
379
|
+
throw new Error('Oracle accountProps missing in decode');
|
|
380
|
+
}
|
|
364
381
|
const client = this.oracleClientCache.get(accountProps.source, this.program.provider.connection, this.program);
|
|
382
|
+
if (!client) {
|
|
383
|
+
throw new Error('Oracle client missing in decode');
|
|
384
|
+
}
|
|
365
385
|
const price = client.getOraclePriceDataFromBuffer(buffer);
|
|
366
386
|
return price;
|
|
367
387
|
}, this.resubOpts, undefined, async () => {
|
|
@@ -385,6 +405,9 @@ class grpcVelocityClientAccountSubscriberV2 {
|
|
|
385
405
|
});
|
|
386
406
|
}
|
|
387
407
|
await this.oracleMultiSubscriber.subscribe(oraclePubkeys, (accountId, data, context, _b, accountProps) => {
|
|
408
|
+
if (accountProps === undefined) {
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
388
411
|
const oracleId = (0, oracleId_1.getOracleId)(accountId, accountProps.source);
|
|
389
412
|
this.oracleIdToOracleDataMap.set(oracleId, {
|
|
390
413
|
data,
|
|
@@ -396,7 +419,7 @@ class grpcVelocityClientAccountSubscriberV2 {
|
|
|
396
419
|
return true;
|
|
397
420
|
}
|
|
398
421
|
async handleDelistedMarkets() {
|
|
399
|
-
var _a, _c;
|
|
422
|
+
var _a, _c, _d, _e;
|
|
400
423
|
if (this.delistedMarketSetting === types_1.DelistedMarketSetting.Subscribe) {
|
|
401
424
|
return;
|
|
402
425
|
}
|
|
@@ -412,11 +435,11 @@ class grpcVelocityClientAccountSubscriberV2 {
|
|
|
412
435
|
const oraclePubkeysToRemove = oracles.map((oracle) => oracle.publicKey);
|
|
413
436
|
// Remove accounts in batches - perp markets
|
|
414
437
|
if (perpMarketPubkeysToRemove.length > 0) {
|
|
415
|
-
await this.perpMarketsSubscriber.removeAccounts(perpMarketPubkeysToRemove);
|
|
438
|
+
await ((_d = this.perpMarketsSubscriber) === null || _d === void 0 ? void 0 : _d.removeAccounts(perpMarketPubkeysToRemove));
|
|
416
439
|
}
|
|
417
440
|
// Remove accounts in batches - oracles
|
|
418
441
|
if (oraclePubkeysToRemove.length > 0) {
|
|
419
|
-
await this.oracleMultiSubscriber.removeAccounts(oraclePubkeysToRemove);
|
|
442
|
+
await ((_e = this.oracleMultiSubscriber) === null || _e === void 0 ? void 0 : _e.removeAccounts(oraclePubkeysToRemove));
|
|
420
443
|
}
|
|
421
444
|
}
|
|
422
445
|
removeInitialData() {
|
|
@@ -453,5 +476,3 @@ class grpcVelocityClientAccountSubscriberV2 {
|
|
|
453
476
|
}
|
|
454
477
|
}
|
|
455
478
|
exports.grpcVelocityClientAccountSubscriberV2 = grpcVelocityClientAccountSubscriberV2;
|
|
456
|
-
/** @deprecated Use `grpcVelocityClientAccountSubscriberV2` instead. `grpcDriftClientAccountSubscriberV2` will be removed in a future major. */
|
|
457
|
-
exports.grpcDriftClientAccountSubscriberV2 = grpcVelocityClientAccountSubscriberV2;
|
|
@@ -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,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,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,eAAe,EACxB,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;
|
|
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,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,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,eAAe,EACxB,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;IAyFH,WAAW,CAAC,OAAO,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBjD,iBAAiB,CACvB,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAChC,eAAe;CASlB"}
|
|
@@ -72,7 +72,7 @@ class LaserstreamProgramAccountSubscriber extends webSocketProgramAccountSubscri
|
|
|
72
72
|
const request = {
|
|
73
73
|
slots: {},
|
|
74
74
|
accounts: {
|
|
75
|
-
|
|
75
|
+
velocity: {
|
|
76
76
|
account: [],
|
|
77
77
|
owner: [this.program.programId.toBase58()],
|
|
78
78
|
filters,
|
|
@@ -94,6 +94,9 @@ class LaserstreamProgramAccountSubscriber extends webSocketProgramAccountSubscri
|
|
|
94
94
|
if (update.account) {
|
|
95
95
|
const slot = Number(update.account.slot);
|
|
96
96
|
const acc = update.account.account;
|
|
97
|
+
if (!acc) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
97
100
|
const accountInfo = {
|
|
98
101
|
owner: new web3_js_1.PublicKey(acc.owner),
|
|
99
102
|
lamports: Number(acc.lamports),
|
|
@@ -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,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,4BACZ,SAAQ,0BACR,YAAW,qBAAqB;IAEhC,OAAO,EAAE,eAAe,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;gBAGtB,OAAO,EAAE,eAAe,EACxB,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;
|
|
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,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,4BACZ,SAAQ,0BACR,YAAW,qBAAqB;IAEhC,OAAO,EAAE,eAAe,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;gBAGtB,OAAO,EAAE,eAAe,EACxB,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;CAmB5B"}
|
|
@@ -14,8 +14,9 @@ class OneShotUserAccountSubscriber extends basicUserAccountSubscriber_1.BasicUse
|
|
|
14
14
|
this.commitment = commitment !== null && commitment !== void 0 ? commitment : 'confirmed';
|
|
15
15
|
}
|
|
16
16
|
async subscribe(userAccount) {
|
|
17
|
+
var _a, _b;
|
|
17
18
|
if (userAccount) {
|
|
18
|
-
this.user = { data: userAccount, slot: this.user.slot };
|
|
19
|
+
this.user = { data: userAccount, slot: (_b = (_a = this.user) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : 0 };
|
|
19
20
|
return true;
|
|
20
21
|
}
|
|
21
22
|
await this.fetchIfUnloaded();
|
|
@@ -25,7 +26,7 @@ class OneShotUserAccountSubscriber extends basicUserAccountSubscriber_1.BasicUse
|
|
|
25
26
|
return true;
|
|
26
27
|
}
|
|
27
28
|
async fetchIfUnloaded() {
|
|
28
|
-
if (this.user
|
|
29
|
+
if (!this.user) {
|
|
29
30
|
await this.fetch();
|
|
30
31
|
}
|
|
31
32
|
}
|
|
@@ -41,7 +42,7 @@ class OneShotUserAccountSubscriber extends basicUserAccountSubscriber_1.BasicUse
|
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
catch (e) {
|
|
44
|
-
console.error(`OneShotUserAccountSubscriber.fetch() UserAccount does not exist: ${e.message}`);
|
|
45
|
+
console.error(`OneShotUserAccountSubscriber.fetch() UserAccount does not exist: ${e instanceof Error ? e.message : String(e)}`);
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
}
|
|
@@ -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,0BAA0B,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,iCACZ,SAAQ,+BACR,YAAW,0BAA0B;IAErC,OAAO,EAAE,eAAe,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;gBAGtB,OAAO,EAAE,eAAe,EACxB,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;
|
|
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,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,iCACZ,SAAQ,+BACR,YAAW,0BAA0B;IAErC,OAAO,EAAE,eAAe,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;gBAGtB,OAAO,EAAE,eAAe,EACxB,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;IAgBhE,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAMhC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAsB5B"}
|
|
@@ -14,8 +14,12 @@ class OneShotUserStatsAccountSubscriber extends basicUserStatsAccountSubscriber_
|
|
|
14
14
|
this.commitment = commitment !== null && commitment !== void 0 ? commitment : 'confirmed';
|
|
15
15
|
}
|
|
16
16
|
async subscribe(userStatsAccount) {
|
|
17
|
+
var _a, _b;
|
|
17
18
|
if (userStatsAccount) {
|
|
18
|
-
this.userStats = {
|
|
19
|
+
this.userStats = {
|
|
20
|
+
data: userStatsAccount,
|
|
21
|
+
slot: (_b = (_a = this.userStats) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : 0,
|
|
22
|
+
};
|
|
19
23
|
return true;
|
|
20
24
|
}
|
|
21
25
|
await this.fetchIfUnloaded();
|
|
@@ -25,7 +29,7 @@ class OneShotUserStatsAccountSubscriber extends basicUserStatsAccountSubscriber_
|
|
|
25
29
|
return true;
|
|
26
30
|
}
|
|
27
31
|
async fetchIfUnloaded() {
|
|
28
|
-
if (this.userStats
|
|
32
|
+
if (!this.userStats) {
|
|
29
33
|
await this.fetch();
|
|
30
34
|
}
|
|
31
35
|
}
|
|
@@ -41,7 +45,7 @@ class OneShotUserStatsAccountSubscriber extends basicUserStatsAccountSubscriber_
|
|
|
41
45
|
}
|
|
42
46
|
}
|
|
43
47
|
catch (e) {
|
|
44
|
-
console.error(`OneShotUserStatsAccountSubscriber.fetch() UserStatsAccount does not exist: ${e.message}`);
|
|
48
|
+
console.error(`OneShotUserStatsAccountSubscriber.fetch() UserStatsAccount does not exist: ${e instanceof Error ? e.message : String(e)}`);
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
}
|
|
@@ -20,10 +20,12 @@ export declare class PollingInsuranceFundStakeAccountSubscriber implements Insur
|
|
|
20
20
|
addToAccountLoader(): Promise<void>;
|
|
21
21
|
fetchIfUnloaded(): Promise<void>;
|
|
22
22
|
fetch(): Promise<void>;
|
|
23
|
-
doesAccountExist():
|
|
23
|
+
doesAccountExist(): this is {
|
|
24
|
+
insuranceFundStakeAccountAndSlot: DataAndSlot<InsuranceFundStake>;
|
|
25
|
+
};
|
|
24
26
|
unsubscribe(): Promise<void>;
|
|
25
27
|
assertIsSubscribed(): void;
|
|
26
|
-
getInsuranceFundStakeAccountAndSlot(): DataAndSlot<InsuranceFundStake
|
|
28
|
+
getInsuranceFundStakeAccountAndSlot(): DataAndSlot<InsuranceFundStake> | undefined;
|
|
27
29
|
didSubscriptionSucceed(): boolean;
|
|
28
30
|
updateData(insuranceFundStake: InsuranceFundStake, slot: number): void;
|
|
29
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pollingInsuranceFundStakeAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/pollingInsuranceFundStakeAccountSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EACN,WAAW,EAEX,+BAA+B,EAC/B,mCAAmC,EACnC,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C,qBAAa,0CACZ,YAAW,mCAAmC;IAE9C,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,eAAe,CAAC;IACzB,YAAY,EAAE,kBAAkB,CAC/B,YAAY,EACZ,+BAA+B,CAC/B,CAAC;IACF,kCAAkC,EAAE,SAAS,CAAC;IAE9C,aAAa,EAAE,iBAAiB,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,gCAAgC,CAAC,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC;gBAGlE,OAAO,EAAE,eAAe,EACxB,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,iBAAiB;IAS3B,SAAS,CAAC,kBAAkB,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAsBpE,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAkCnC,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAMhC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"pollingInsuranceFundStakeAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/pollingInsuranceFundStakeAccountSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EACN,WAAW,EAEX,+BAA+B,EAC/B,mCAAmC,EACnC,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C,qBAAa,0CACZ,YAAW,mCAAmC;IAE9C,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,eAAe,CAAC;IACzB,YAAY,EAAE,kBAAkB,CAC/B,YAAY,EACZ,+BAA+B,CAC/B,CAAC;IACF,kCAAkC,EAAE,SAAS,CAAC;IAE9C,aAAa,EAAE,iBAAiB,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,gCAAgC,CAAC,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC;gBAGlE,OAAO,EAAE,eAAe,EACxB,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,iBAAiB;IAS3B,SAAS,CAAC,kBAAkB,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAsBpE,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAkCnC,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAMhC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA0B5B,gBAAgB,IAAI,IAAI,IAAI;QAC3B,gCAAgC,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC;KAClE;IAIK,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAiBlC,kBAAkB,IAAI,IAAI;IAQnB,mCAAmC,IACvC,WAAW,CAAC,kBAAkB,CAAC,GAC/B,SAAS;IAKZ,sBAAsB,IAAI,OAAO;IAI1B,UAAU,CAChB,kBAAkB,EAAE,kBAAkB,EACtC,IAAI,EAAE,MAAM,GACV,IAAI;CAgBP"}
|
|
@@ -18,7 +18,7 @@ class PollingInsuranceFundStakeAccountSubscriber {
|
|
|
18
18
|
if (insuranceFundStake) {
|
|
19
19
|
this.insuranceFundStakeAccountAndSlot = {
|
|
20
20
|
data: insuranceFundStake,
|
|
21
|
-
slot:
|
|
21
|
+
slot: 0,
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
await this.addToAccountLoader();
|
|
@@ -50,7 +50,7 @@ class PollingInsuranceFundStakeAccountSubscriber {
|
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
async fetchIfUnloaded() {
|
|
53
|
-
if (this.
|
|
53
|
+
if (!this.doesAccountExist()) {
|
|
54
54
|
await this.fetch();
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -67,7 +67,7 @@ class PollingInsuranceFundStakeAccountSubscriber {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
catch (e) {
|
|
70
|
-
console.log(`PollingInsuranceFundStakeAccountSubscriber.fetch() InsuranceFundStake does not exist: ${e.message}`);
|
|
70
|
+
console.log(`PollingInsuranceFundStakeAccountSubscriber.fetch() InsuranceFundStake does not exist: ${e instanceof Error ? e.message : String(e)}`);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
doesAccountExist() {
|
|
@@ -5,10 +5,8 @@ import { EventEmitter } from 'events';
|
|
|
5
5
|
import { PublicKey } from '@solana/web3.js';
|
|
6
6
|
import { BulkAccountLoader } from './bulkAccountLoader';
|
|
7
7
|
import { OracleClient, OraclePriceData } from '../oracles/types';
|
|
8
|
-
import { VelocityProgram } from '../config';
|
|
9
8
|
export declare class PollingOracleAccountSubscriber implements OracleAccountSubscriber {
|
|
10
9
|
isSubscribed: boolean;
|
|
11
|
-
program: VelocityProgram;
|
|
12
10
|
eventEmitter: StrictEventEmitter<EventEmitter, OracleEvents>;
|
|
13
11
|
publicKey: PublicKey;
|
|
14
12
|
accountLoader: BulkAccountLoader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pollingOracleAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/pollingOracleAccountSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EACN,WAAW,EAEX,YAAY,EACZ,uBAAuB,EACvB,MAAM,SAAS,CAAC;AACjB,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"pollingOracleAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/pollingOracleAccountSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EACN,WAAW,EAEX,YAAY,EACZ,uBAAuB,EACvB,MAAM,SAAS,CAAC;AACjB,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEjE,qBAAa,8BAA+B,YAAW,uBAAuB;IAC7E,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,kBAAkB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IAC7D,SAAS,EAAE,SAAS,CAAC;IAErB,aAAa,EAAE,iBAAiB,CAAC;IACjC,YAAY,EAAE,YAAY,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,eAAe,CAAC,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;gBAG9C,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,iBAAiB;IAS3B,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAuB7B,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAsBnC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBtB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAkBlC,kBAAkB,IAAI,IAAI;IAQnB,kBAAkB,IAAI,WAAW,CAAC,eAAe,CAAC;IAKzD,sBAAsB,IAAI,OAAO;CAGjC"}
|
|
@@ -46,7 +46,14 @@ class PollingOracleAccountSubscriber {
|
|
|
46
46
|
}
|
|
47
47
|
async fetch() {
|
|
48
48
|
await this.accountLoader.load();
|
|
49
|
-
const
|
|
49
|
+
const bufferAndSlot = this.accountLoader.getBufferAndSlot(this.publicKey);
|
|
50
|
+
if (!bufferAndSlot) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const { buffer, slot } = bufferAndSlot;
|
|
54
|
+
if (!buffer) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
50
57
|
this.oraclePriceData = {
|
|
51
58
|
data: await this.oracleClient.getOraclePriceDataFromBuffer(buffer),
|
|
52
59
|
slot,
|
|
@@ -56,10 +63,14 @@ class PollingOracleAccountSubscriber {
|
|
|
56
63
|
if (!this.isSubscribed) {
|
|
57
64
|
return;
|
|
58
65
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
if (this.callbackId) {
|
|
67
|
+
this.accountLoader.removeAccount(this.publicKey, this.callbackId);
|
|
68
|
+
this.callbackId = undefined;
|
|
69
|
+
}
|
|
70
|
+
if (this.errorCallbackId) {
|
|
71
|
+
this.accountLoader.removeErrorCallbacks(this.errorCallbackId);
|
|
72
|
+
this.errorCallbackId = undefined;
|
|
73
|
+
}
|
|
63
74
|
this.isSubscribed = false;
|
|
64
75
|
}
|
|
65
76
|
assertIsSubscribed() {
|
|
@@ -5,10 +5,8 @@ import { EventEmitter } from 'events';
|
|
|
5
5
|
import { PublicKey } from '@solana/web3.js';
|
|
6
6
|
import { BulkAccountLoader } from './bulkAccountLoader';
|
|
7
7
|
import { Account } from '@solana/spl-token';
|
|
8
|
-
import { VelocityProgram } from '../config';
|
|
9
8
|
export declare class PollingTokenAccountSubscriber implements TokenAccountSubscriber {
|
|
10
9
|
isSubscribed: boolean;
|
|
11
|
-
program: VelocityProgram;
|
|
12
10
|
eventEmitter: StrictEventEmitter<EventEmitter, TokenAccountEvents>;
|
|
13
11
|
publicKey: PublicKey;
|
|
14
12
|
accountLoader: BulkAccountLoader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pollingTokenAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/pollingTokenAccountSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EACN,WAAW,EAEX,kBAAkB,EAClB,sBAAsB,EACtB,MAAM,SAAS,CAAC;AACjB,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"pollingTokenAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/pollingTokenAccountSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EACN,WAAW,EAEX,kBAAkB,EAClB,sBAAsB,EACtB,MAAM,SAAS,CAAC;AACjB,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,qBAAa,6BAA8B,YAAW,sBAAsB;IAC3E,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,kBAAkB,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;IACnE,SAAS,EAAE,SAAS,CAAC;IAErB,aAAa,EAAE,iBAAiB,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,mBAAmB,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;gBAExB,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,iBAAiB;IAOnE,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAsB7B,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAqBnC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBtB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAkBlC,kBAAkB,IAAI,IAAI;IAQnB,sBAAsB,IAAI,WAAW,CAAC,OAAO,CAAC;IAKrD,sBAAsB,IAAI,OAAO;CAGjC"}
|
|
@@ -46,7 +46,14 @@ class PollingTokenAccountSubscriber {
|
|
|
46
46
|
}
|
|
47
47
|
async fetch() {
|
|
48
48
|
await this.accountLoader.load();
|
|
49
|
-
const
|
|
49
|
+
const bufferAndSlot = this.accountLoader.getBufferAndSlot(this.publicKey);
|
|
50
|
+
if (!bufferAndSlot) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const { buffer, slot } = bufferAndSlot;
|
|
54
|
+
if (!buffer) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
50
57
|
this.tokenAccountAndSlot = {
|
|
51
58
|
data: (0, token_1.parseTokenAccount)(buffer, this.publicKey),
|
|
52
59
|
slot,
|
|
@@ -56,10 +63,14 @@ class PollingTokenAccountSubscriber {
|
|
|
56
63
|
if (!this.isSubscribed) {
|
|
57
64
|
return;
|
|
58
65
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
if (this.callbackId) {
|
|
67
|
+
this.accountLoader.removeAccount(this.publicKey, this.callbackId);
|
|
68
|
+
this.callbackId = undefined;
|
|
69
|
+
}
|
|
70
|
+
if (this.errorCallbackId) {
|
|
71
|
+
this.accountLoader.removeErrorCallbacks(this.errorCallbackId);
|
|
72
|
+
this.errorCallbackId = undefined;
|
|
73
|
+
}
|
|
63
74
|
this.isSubscribed = false;
|
|
64
75
|
}
|
|
65
76
|
assertIsSubscribed() {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
2
4
|
import { DataAndSlot, UserAccountEvents, UserAccountSubscriber } from './types';
|
|
3
5
|
import { Connection } from '../bankrun/bankrunConnection';
|
|
4
6
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
@@ -14,17 +16,19 @@ export declare class PollingUserAccountSubscriber implements UserAccountSubscrib
|
|
|
14
16
|
accountLoader: BulkAccountLoader;
|
|
15
17
|
callbackId?: string;
|
|
16
18
|
errorCallbackId?: string;
|
|
17
|
-
decode: (name:
|
|
19
|
+
decode: (name: string, buffer: Buffer) => UserAccount;
|
|
18
20
|
user?: DataAndSlot<UserAccount>;
|
|
19
|
-
constructor(connection: Connection, userAccountPublicKey: PublicKey, accountLoader: BulkAccountLoader, decode: (name:
|
|
21
|
+
constructor(connection: Connection, userAccountPublicKey: PublicKey, accountLoader: BulkAccountLoader, decode: (name: string, buffer: Buffer) => UserAccount);
|
|
20
22
|
subscribe(userAccount?: UserAccount): Promise<boolean>;
|
|
21
23
|
addToAccountLoader(): Promise<void>;
|
|
22
24
|
fetchIfUnloaded(): Promise<void>;
|
|
23
25
|
fetch(): Promise<void>;
|
|
24
|
-
doesAccountExist():
|
|
26
|
+
doesAccountExist(): this is {
|
|
27
|
+
user: DataAndSlot<UserAccount>;
|
|
28
|
+
};
|
|
25
29
|
unsubscribe(): Promise<void>;
|
|
26
30
|
assertIsSubscribed(): void;
|
|
27
|
-
getUserAccountAndSlot(): DataAndSlot<UserAccount
|
|
31
|
+
getUserAccountAndSlot(): DataAndSlot<UserAccount> | undefined;
|
|
28
32
|
updateData(userAccount: UserAccount, slot: number): void;
|
|
29
33
|
}
|
|
30
34
|
//# sourceMappingURL=pollingUserAccountSubscriber.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pollingUserAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/pollingUserAccountSubscriber.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pollingUserAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/pollingUserAccountSubscriber.ts"],"names":[],"mappings":";;;AAAA,OAAO,EACN,WAAW,EAEX,iBAAiB,EACjB,qBAAqB,EACrB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,qBAAa,4BAA6B,YAAW,qBAAqB;IACzE,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;IACvB,YAAY,EAAE,kBAAkB,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;IAClE,oBAAoB,EAAE,SAAS,CAAC;IAEhC,aAAa,EAAE,iBAAiB,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,WAAW,CAAC;IAEtD,IAAI,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;gBAG/B,UAAU,EAAE,UAAU,EACtB,oBAAoB,EAAE,SAAS,EAC/B,aAAa,EAAE,iBAAiB,EAChC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,WAAW;IAUhD,SAAS,CAAC,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IAsBtD,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IA4BnC,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAMhC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAuB5B,gBAAgB,IAAI,IAAI,IAAI;QAAE,IAAI,EAAE,WAAW,CAAC,WAAW,CAAC,CAAA;KAAE;IAIxD,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAqBlC,kBAAkB,IAAI,IAAI;IAQnB,qBAAqB,IAAI,WAAW,CAAC,WAAW,CAAC,GAAG,SAAS;IAK7D,UAAU,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;CAO/D"}
|
|
@@ -17,7 +17,9 @@ class PollingUserAccountSubscriber {
|
|
|
17
17
|
return true;
|
|
18
18
|
}
|
|
19
19
|
if (userAccount) {
|
|
20
|
-
|
|
20
|
+
// `slot: 0` keeps {data, slot} atomic: a seeded account always carries a
|
|
21
|
+
// slot (0 = oldest-possible sentinel, overwritten by the first real fetch).
|
|
22
|
+
this.user = { data: userAccount, slot: 0 };
|
|
21
23
|
}
|
|
22
24
|
await this.addToAccountLoader();
|
|
23
25
|
await this.fetchIfUnloaded();
|
|
@@ -48,7 +50,7 @@ class PollingUserAccountSubscriber {
|
|
|
48
50
|
});
|
|
49
51
|
}
|
|
50
52
|
async fetchIfUnloaded() {
|
|
51
|
-
if (this.
|
|
53
|
+
if (!this.doesAccountExist()) {
|
|
52
54
|
await this.fetch();
|
|
53
55
|
}
|
|
54
56
|
}
|
|
@@ -56,7 +58,8 @@ class PollingUserAccountSubscriber {
|
|
|
56
58
|
var _a, _b;
|
|
57
59
|
try {
|
|
58
60
|
const dataAndContext = await this.connection.getAccountInfoAndContext(this.userAccountPublicKey, this.accountLoader.commitment);
|
|
59
|
-
if (dataAndContext.
|
|
61
|
+
if (dataAndContext.value !== null &&
|
|
62
|
+
dataAndContext.context.slot > ((_b = (_a = this.user) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : 0)) {
|
|
60
63
|
this.user = {
|
|
61
64
|
data: this.decode('user', dataAndContext.value.data),
|
|
62
65
|
slot: dataAndContext.context.slot,
|
|
@@ -64,7 +67,8 @@ class PollingUserAccountSubscriber {
|
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
69
|
catch (e) {
|
|
67
|
-
|
|
70
|
+
const err = e instanceof Error ? e : new Error(String(e));
|
|
71
|
+
console.log(`PollingUserAccountSubscriber.fetch() UserAccount does not exist: ${err.message}-${err.stack}`);
|
|
68
72
|
}
|
|
69
73
|
}
|
|
70
74
|
doesAccountExist() {
|
|
@@ -74,10 +78,14 @@ class PollingUserAccountSubscriber {
|
|
|
74
78
|
if (!this.isSubscribed) {
|
|
75
79
|
return;
|
|
76
80
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
if (this.callbackId) {
|
|
82
|
+
this.accountLoader.removeAccount(this.userAccountPublicKey, this.callbackId);
|
|
83
|
+
this.callbackId = undefined;
|
|
84
|
+
}
|
|
85
|
+
if (this.errorCallbackId) {
|
|
86
|
+
this.accountLoader.removeErrorCallbacks(this.errorCallbackId);
|
|
87
|
+
this.errorCallbackId = undefined;
|
|
88
|
+
}
|
|
81
89
|
this.isSubscribed = false;
|
|
82
90
|
}
|
|
83
91
|
assertIsSubscribed() {
|
|
@@ -86,9 +94,7 @@ class PollingUserAccountSubscriber {
|
|
|
86
94
|
}
|
|
87
95
|
}
|
|
88
96
|
getUserAccountAndSlot() {
|
|
89
|
-
|
|
90
|
-
throw new types_1.NotSubscribedError('You must call `subscribe` or `fetch` before using this function');
|
|
91
|
-
}
|
|
97
|
+
this.assertIsSubscribed();
|
|
92
98
|
return this.user;
|
|
93
99
|
}
|
|
94
100
|
updateData(userAccount, slot) {
|
|
@@ -20,9 +20,11 @@ export declare class PollingUserStatsAccountSubscriber implements UserStatsAccou
|
|
|
20
20
|
addToAccountLoader(): Promise<void>;
|
|
21
21
|
fetchIfUnloaded(): Promise<void>;
|
|
22
22
|
fetch(): Promise<void>;
|
|
23
|
-
doesAccountExist():
|
|
23
|
+
doesAccountExist(): this is {
|
|
24
|
+
userStats: DataAndSlot<UserStatsAccount>;
|
|
25
|
+
};
|
|
24
26
|
unsubscribe(): Promise<void>;
|
|
25
27
|
assertIsSubscribed(): void;
|
|
26
|
-
getUserStatsAccountAndSlot(): DataAndSlot<UserStatsAccount
|
|
28
|
+
getUserStatsAccountAndSlot(): DataAndSlot<UserStatsAccount> | undefined;
|
|
27
29
|
}
|
|
28
30
|
//# sourceMappingURL=pollingUserStatsAccountSubscriber.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pollingUserStatsAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/pollingUserStatsAccountSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EACN,WAAW,EAEX,0BAA0B,EAC1B,sBAAsB,EACtB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,qBAAa,iCACZ,YAAW,0BAA0B;IAErC,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,eAAe,CAAC;IACzB,YAAY,EAAE,kBAAkB,CAAC,YAAY,EAAE,sBAAsB,CAAC,CAAC;IACvE,yBAAyB,EAAE,SAAS,CAAC;IAErC,aAAa,EAAE,iBAAiB,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,SAAS,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,CAAC;gBAGzC,OAAO,EAAE,eAAe,EACxB,yBAAyB,EAAE,SAAS,EACpC,aAAa,EAAE,iBAAiB;IAS3B,SAAS,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"pollingUserStatsAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/pollingUserStatsAccountSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EACN,WAAW,EAEX,0BAA0B,EAC1B,sBAAsB,EACtB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,qBAAa,iCACZ,YAAW,0BAA0B;IAErC,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,eAAe,CAAC;IACzB,YAAY,EAAE,kBAAkB,CAAC,YAAY,EAAE,sBAAsB,CAAC,CAAC;IACvE,yBAAyB,EAAE,SAAS,CAAC;IAErC,aAAa,EAAE,iBAAiB,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,SAAS,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,CAAC;gBAGzC,OAAO,EAAE,eAAe,EACxB,yBAAyB,EAAE,SAAS,EACpC,aAAa,EAAE,iBAAiB;IAS3B,SAAS,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IAuBhE,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IA+BnC,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAMhC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAuB5B,gBAAgB,IAAI,IAAI,IAAI;QAAE,SAAS,EAAE,WAAW,CAAC,gBAAgB,CAAC,CAAA;KAAE;IAIlE,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAiBlC,kBAAkB,IAAI,IAAI;IAQnB,0BAA0B,IAC9B,WAAW,CAAC,gBAAgB,CAAC,GAC7B,SAAS;CAIZ"}
|
|
@@ -16,7 +16,9 @@ class PollingUserStatsAccountSubscriber {
|
|
|
16
16
|
return true;
|
|
17
17
|
}
|
|
18
18
|
if (userStatsAccount) {
|
|
19
|
-
|
|
19
|
+
// `slot: 0` keeps {data, slot} atomic: a seeded account always carries a
|
|
20
|
+
// slot (0 = oldest-possible sentinel, overwritten by the first real fetch).
|
|
21
|
+
this.userStats = { data: userStatsAccount, slot: 0 };
|
|
20
22
|
}
|
|
21
23
|
await this.addToAccountLoader();
|
|
22
24
|
await this.fetchIfUnloaded();
|
|
@@ -47,7 +49,7 @@ class PollingUserStatsAccountSubscriber {
|
|
|
47
49
|
});
|
|
48
50
|
}
|
|
49
51
|
async fetchIfUnloaded() {
|
|
50
|
-
if (this.
|
|
52
|
+
if (!this.doesAccountExist()) {
|
|
51
53
|
await this.fetch();
|
|
52
54
|
}
|
|
53
55
|
}
|
|
@@ -63,7 +65,7 @@ class PollingUserStatsAccountSubscriber {
|
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
catch (e) {
|
|
66
|
-
console.log(`PollingUserStatsAccountSubscriber.fetch() UserStatsAccount does not exist: ${e.message}`);
|
|
68
|
+
console.log(`PollingUserStatsAccountSubscriber.fetch() UserStatsAccount does not exist: ${e instanceof Error ? e.message : String(e)}`);
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
doesAccountExist() {
|
|
@@ -85,9 +87,7 @@ class PollingUserStatsAccountSubscriber {
|
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
89
|
getUserStatsAccountAndSlot() {
|
|
88
|
-
|
|
89
|
-
throw new types_1.NotSubscribedError('You must call `subscribe` or `fetch` before using this function');
|
|
90
|
-
}
|
|
90
|
+
this.assertIsSubscribed();
|
|
91
91
|
return this.userStats;
|
|
92
92
|
}
|
|
93
93
|
}
|