@velocity-exchange/sdk 0.3.0 → 0.4.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/CHANGELOG.md +51 -0
- package/lib/browser/accounts/basicUserAccountSubscriber.d.ts +18 -0
- package/lib/browser/accounts/basicUserAccountSubscriber.js +18 -0
- package/lib/browser/accounts/basicUserStatsAccountSubscriber.d.ts +18 -0
- package/lib/browser/accounts/basicUserStatsAccountSubscriber.js +18 -0
- package/lib/browser/accounts/bulkAccountLoader.d.ts +52 -0
- package/lib/browser/accounts/bulkAccountLoader.js +51 -0
- package/lib/browser/accounts/bulkUserStatsSubscription.d.ts +9 -2
- package/lib/browser/accounts/bulkUserStatsSubscription.js +9 -2
- package/lib/browser/accounts/bulkUserSubscription.d.ts +8 -2
- package/lib/browser/accounts/bulkUserSubscription.js +8 -2
- package/lib/browser/accounts/customizedCadenceBulkAccountLoader.d.ts +37 -0
- package/lib/browser/accounts/customizedCadenceBulkAccountLoader.js +37 -0
- package/lib/browser/accounts/fetch.d.ts +59 -2
- package/lib/browser/accounts/fetch.js +57 -2
- package/lib/browser/accounts/grpcAccountSubscriber.d.ts +30 -0
- package/lib/browser/accounts/grpcAccountSubscriber.js +30 -0
- package/lib/browser/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts +16 -0
- package/lib/browser/accounts/grpcInsuranceFundStakeAccountSubscriber.js +16 -0
- package/lib/browser/accounts/grpcMultiAccountSubscriber.d.ts +60 -1
- package/lib/browser/accounts/grpcMultiAccountSubscriber.js +118 -37
- package/lib/browser/accounts/grpcMultiUserAccountSubscriber.d.ts +32 -0
- package/lib/browser/accounts/grpcMultiUserAccountSubscriber.js +40 -12
- package/lib/browser/accounts/grpcProgramAccountSubscriber.d.ts +33 -0
- package/lib/browser/accounts/grpcProgramAccountSubscriber.js +33 -0
- package/lib/browser/accounts/grpcUserAccountSubscriber.d.ts +15 -0
- package/lib/browser/accounts/grpcUserAccountSubscriber.js +15 -0
- package/lib/browser/accounts/grpcUserStatsAccountSubscriber.d.ts +15 -0
- package/lib/browser/accounts/grpcUserStatsAccountSubscriber.js +15 -0
- package/lib/browser/accounts/grpcVelocityClientAccountSubscriber.d.ts +41 -0
- package/lib/browser/accounts/grpcVelocityClientAccountSubscriber.js +41 -0
- package/lib/browser/accounts/grpcVelocityClientAccountSubscriberV2.d.ts +116 -0
- package/lib/browser/accounts/grpcVelocityClientAccountSubscriberV2.js +152 -1
- package/lib/browser/accounts/laserProgramAccountSubscriber.d.ts +34 -0
- package/lib/browser/accounts/laserProgramAccountSubscriber.js +34 -0
- package/lib/browser/accounts/oneShotUserAccountSubscriber.d.ts +19 -0
- package/lib/browser/accounts/oneShotUserAccountSubscriber.js +19 -0
- package/lib/browser/accounts/oneShotUserStatsAccountSubscriber.d.ts +19 -0
- package/lib/browser/accounts/oneShotUserStatsAccountSubscriber.js +19 -0
- package/lib/browser/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts +31 -0
- package/lib/browser/accounts/pollingInsuranceFundStakeAccountSubscriber.js +31 -0
- package/lib/browser/accounts/pollingOracleAccountSubscriber.d.ts +19 -0
- package/lib/browser/accounts/pollingOracleAccountSubscriber.js +21 -2
- package/lib/browser/accounts/pollingTokenAccountSubscriber.d.ts +22 -0
- package/lib/browser/accounts/pollingTokenAccountSubscriber.js +22 -0
- package/lib/browser/accounts/pollingUserAccountSubscriber.d.ts +32 -0
- package/lib/browser/accounts/pollingUserAccountSubscriber.js +32 -0
- package/lib/browser/accounts/pollingUserStatsAccountSubscriber.d.ts +22 -0
- package/lib/browser/accounts/pollingUserStatsAccountSubscriber.js +22 -0
- package/lib/browser/accounts/pollingVelocityClientAccountSubscriber.d.ts +83 -0
- package/lib/browser/accounts/pollingVelocityClientAccountSubscriber.js +84 -1
- package/lib/browser/accounts/testBulkAccountLoader.d.ts +8 -0
- package/lib/browser/accounts/testBulkAccountLoader.js +8 -0
- package/lib/browser/accounts/types.d.ts +149 -0
- package/lib/browser/accounts/types.js +13 -0
- package/lib/browser/accounts/utils.d.ts +18 -0
- package/lib/browser/accounts/utils.js +32 -16
- package/lib/browser/accounts/webSocketAccountSubscriber.d.ts +41 -0
- package/lib/browser/accounts/webSocketAccountSubscriber.js +41 -0
- package/lib/browser/accounts/webSocketAccountSubscriberV2.d.ts +31 -0
- package/lib/browser/accounts/webSocketAccountSubscriberV2.js +31 -23
- package/lib/browser/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +27 -0
- package/lib/browser/accounts/webSocketInsuranceFundStakeAccountSubscriber.js +27 -0
- package/lib/browser/accounts/webSocketProgramAccountSubscriber.d.ts +36 -0
- package/lib/browser/accounts/webSocketProgramAccountSubscriber.js +36 -0
- package/lib/browser/accounts/webSocketProgramAccountSubscriberV2.d.ts +21 -0
- package/lib/browser/accounts/webSocketProgramAccountSubscriberV2.js +25 -0
- package/lib/browser/accounts/webSocketProgramAccountsSubscriberV2.d.ts +21 -0
- package/lib/browser/accounts/webSocketProgramAccountsSubscriberV2.js +21 -0
- package/lib/browser/accounts/webSocketUserAccountSubscriber.d.ts +26 -0
- package/lib/browser/accounts/webSocketUserAccountSubscriber.js +26 -0
- package/lib/browser/accounts/webSocketUserStatsAccountSubsriber.d.ts +20 -0
- package/lib/browser/accounts/webSocketUserStatsAccountSubsriber.js +20 -0
- package/lib/browser/accounts/webSocketVelocityClientAccountSubscriber.d.ts +121 -0
- package/lib/browser/accounts/webSocketVelocityClientAccountSubscriber.js +123 -2
- package/lib/browser/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts +96 -0
- package/lib/browser/accounts/webSocketVelocityClientAccountSubscriberV2.js +108 -0
- package/lib/browser/accounts/websocketProgramUserAccountSubscriber.d.ts +28 -0
- package/lib/browser/accounts/websocketProgramUserAccountSubscriber.js +33 -0
- package/lib/browser/addresses/marketAddresses.d.ts +10 -0
- package/lib/browser/addresses/marketAddresses.js +10 -0
- package/lib/browser/addresses/pda.d.ts +214 -2
- package/lib/browser/addresses/pda.js +217 -5
- package/lib/browser/adminClient.d.ts +2136 -4
- package/lib/browser/adminClient.js +2150 -4
- package/lib/browser/auctionSubscriber/auctionSubscriber.d.ts +15 -0
- package/lib/browser/auctionSubscriber/auctionSubscriber.js +15 -0
- package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.d.ts +19 -0
- package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.js +19 -0
- package/lib/browser/auctionSubscriber/index.d.ts +6 -0
- package/lib/browser/auctionSubscriber/index.js +6 -0
- package/lib/browser/auctionSubscriber/types.d.ts +7 -0
- package/lib/browser/blockhashSubscriber/BlockhashSubscriber.d.ts +33 -0
- package/lib/browser/blockhashSubscriber/BlockhashSubscriber.js +33 -0
- package/lib/browser/blockhashSubscriber/index.d.ts +5 -0
- package/lib/browser/blockhashSubscriber/index.js +5 -0
- package/lib/browser/blockhashSubscriber/types.d.ts +5 -0
- package/lib/browser/clock/clockSubscriber.d.ts +24 -0
- package/lib/browser/clock/clockSubscriber.js +22 -0
- package/lib/browser/config.d.ts +58 -4
- package/lib/browser/config.js +88 -21
- package/lib/browser/constants/numericConstants.d.ts +67 -0
- package/lib/browser/constants/numericConstants.js +68 -1
- package/lib/browser/constants/perpMarkets.d.ts +10 -0
- package/lib/browser/constants/perpMarkets.js +40 -908
- package/lib/browser/constants/spotMarkets.d.ts +13 -0
- package/lib/browser/constants/spotMarkets.js +16 -742
- package/lib/browser/constants/txConstants.d.ts +1 -0
- package/lib/browser/constants/txConstants.js +1 -0
- package/lib/browser/core/VelocityCore.d.ts +285 -8
- package/lib/browser/core/VelocityCore.js +281 -8
- package/lib/browser/core/instructions/deposit.d.ts +22 -0
- package/lib/browser/core/instructions/deposit.js +22 -0
- package/lib/browser/core/instructions/fill.d.ts +17 -0
- package/lib/browser/core/instructions/fill.js +17 -0
- package/lib/browser/core/instructions/funding.d.ts +12 -0
- package/lib/browser/core/instructions/funding.js +12 -0
- package/lib/browser/core/instructions/liquidation.d.ts +18 -0
- package/lib/browser/core/instructions/liquidation.js +18 -0
- package/lib/browser/core/instructions/orders.d.ts +28 -0
- package/lib/browser/core/instructions/orders.js +28 -0
- package/lib/browser/core/instructions/perpOrders.d.ts +106 -0
- package/lib/browser/core/instructions/perpOrders.js +106 -0
- package/lib/browser/core/instructions/settlement.d.ts +14 -0
- package/lib/browser/core/instructions/settlement.js +14 -0
- package/lib/browser/core/instructions/trigger.d.ts +15 -0
- package/lib/browser/core/instructions/trigger.js +15 -0
- package/lib/browser/core/instructions/withdraw.d.ts +21 -0
- package/lib/browser/core/instructions/withdraw.js +21 -0
- package/lib/browser/core/remainingAccounts.d.ts +47 -3
- package/lib/browser/core/remainingAccounts.js +20 -0
- package/lib/browser/core/signedMsg.d.ts +38 -0
- package/lib/browser/core/signedMsg.js +33 -0
- package/lib/browser/decode/customCoder.d.ts +39 -3
- package/lib/browser/decode/customCoder.js +45 -3
- package/lib/browser/decode/user.d.ts +22 -0
- package/lib/browser/decode/user.js +22 -0
- package/lib/browser/dlob/DLOB.d.ts +502 -53
- package/lib/browser/dlob/DLOB.js +540 -98
- package/lib/browser/dlob/DLOBNode.d.ts +86 -4
- package/lib/browser/dlob/DLOBNode.js +37 -4
- package/lib/browser/dlob/DLOBSubscriber.d.ts +39 -12
- package/lib/browser/dlob/DLOBSubscriber.js +42 -12
- package/lib/browser/dlob/NodeList.d.ts +69 -0
- package/lib/browser/dlob/NodeList.js +66 -0
- package/lib/browser/dlob/orderBookLevels.d.ts +106 -13
- package/lib/browser/dlob/orderBookLevels.js +84 -14
- package/lib/browser/dlob/types.d.ts +15 -0
- package/lib/browser/events/eventList.d.ts +14 -0
- package/lib/browser/events/eventList.js +14 -0
- package/lib/browser/events/eventSubscriber.d.ts +87 -10
- package/lib/browser/events/eventSubscriber.js +93 -8
- package/lib/browser/events/eventsServerLogProvider.d.ts +22 -0
- package/lib/browser/events/eventsServerLogProvider.js +27 -0
- package/lib/browser/events/fetchLogs.d.ts +31 -0
- package/lib/browser/events/fetchLogs.js +46 -1
- package/lib/browser/events/parse.d.ts +23 -0
- package/lib/browser/events/parse.js +23 -0
- package/lib/browser/events/pollingLogProvider.d.ts +24 -0
- package/lib/browser/events/pollingLogProvider.js +24 -0
- package/lib/browser/events/sort.d.ts +11 -0
- package/lib/browser/events/sort.js +12 -0
- package/lib/browser/events/txEventCache.d.ts +13 -3
- package/lib/browser/events/txEventCache.js +19 -7
- package/lib/browser/events/types.d.ts +118 -2
- package/lib/browser/events/types.js +11 -0
- package/lib/browser/events/webSocketLogProvider.d.ts +23 -0
- package/lib/browser/events/webSocketLogProvider.js +28 -0
- package/lib/browser/factory/oracleClient.js +2 -2
- package/lib/browser/idl/velocity.d.ts +4 -4
- package/lib/browser/idl/velocity.json +4 -4
- package/lib/browser/keypair.d.ts +8 -0
- package/lib/browser/keypair.js +8 -0
- package/lib/browser/marginCalculation.d.ts +134 -2
- package/lib/browser/marginCalculation.js +121 -0
- package/lib/browser/math/amm.d.ts +348 -29
- package/lib/browser/math/amm.js +310 -32
- package/lib/browser/math/auction.d.ts +95 -19
- package/lib/browser/math/auction.js +118 -28
- package/lib/browser/math/bankruptcy.d.ts +46 -0
- package/lib/browser/math/bankruptcy.js +89 -1
- package/lib/browser/math/builder.d.ts +64 -8
- package/lib/browser/math/builder.js +71 -9
- package/lib/browser/math/conversion.d.ts +21 -0
- package/lib/browser/math/conversion.js +21 -0
- package/lib/browser/math/exchangeStatus.d.ts +91 -0
- package/lib/browser/math/exchangeStatus.js +106 -3
- package/lib/browser/math/funding.d.ts +57 -20
- package/lib/browser/math/funding.js +63 -23
- package/lib/browser/math/insurance.d.ts +62 -0
- package/lib/browser/math/insurance.js +62 -0
- package/lib/browser/math/liquidation.d.ts +127 -11
- package/lib/browser/math/liquidation.js +182 -19
- package/lib/browser/math/margin.d.ts +79 -13
- package/lib/browser/math/margin.js +80 -14
- package/lib/browser/math/market.d.ts +135 -15
- package/lib/browser/math/market.js +145 -17
- package/lib/browser/math/oracles.d.ts +113 -0
- package/lib/browser/math/oracles.js +118 -1
- package/lib/browser/math/orders.d.ts +115 -10
- package/lib/browser/math/orders.js +130 -19
- package/lib/browser/math/position.d.ts +80 -33
- package/lib/browser/math/position.js +80 -33
- package/lib/browser/math/repeg.d.ts +48 -10
- package/lib/browser/math/repeg.js +48 -10
- package/lib/browser/math/spotBalance.d.ts +200 -5
- package/lib/browser/math/spotBalance.js +239 -10
- package/lib/browser/math/spotMarket.d.ts +36 -3
- package/lib/browser/math/spotMarket.js +36 -3
- package/lib/browser/math/spotPosition.d.ts +72 -0
- package/lib/browser/math/spotPosition.js +62 -0
- package/lib/browser/math/state.d.ts +31 -0
- package/lib/browser/math/state.js +31 -0
- package/lib/browser/math/superStake.d.ts +126 -2
- package/lib/browser/math/superStake.js +123 -3
- package/lib/browser/math/tiers.d.ts +29 -0
- package/lib/browser/math/tiers.js +29 -0
- package/lib/browser/math/trade.d.ts +102 -51
- package/lib/browser/math/trade.js +101 -55
- package/lib/browser/math/utils.d.ts +71 -9
- package/lib/browser/math/utils.js +71 -9
- package/lib/browser/memcmp.d.ts +94 -0
- package/lib/browser/memcmp.js +103 -2
- package/lib/browser/oracles/oracleClientCache.d.ts +16 -0
- package/lib/browser/oracles/oracleClientCache.js +16 -0
- package/lib/browser/oracles/oracleId.d.ts +31 -0
- package/lib/browser/oracles/oracleId.js +39 -8
- package/lib/browser/oracles/prelaunchOracleClient.d.ts +20 -0
- package/lib/browser/oracles/prelaunchOracleClient.js +20 -0
- package/lib/browser/oracles/pythClient.d.ts +31 -0
- package/lib/browser/oracles/pythClient.js +32 -1
- package/lib/browser/oracles/pythLazerClient.d.ts +34 -0
- package/lib/browser/oracles/pythLazerClient.js +35 -1
- package/lib/browser/oracles/quoteAssetOracleClient.d.ts +18 -0
- package/lib/browser/oracles/quoteAssetOracleClient.js +18 -0
- package/lib/browser/oracles/strictOraclePrice.d.ts +21 -0
- package/lib/browser/oracles/strictOraclePrice.js +21 -0
- package/lib/browser/oracles/types.d.ts +45 -0
- package/lib/browser/oracles/utils.d.ts +20 -0
- package/lib/browser/oracles/utils.js +20 -0
- package/lib/browser/orderParams.d.ts +42 -4
- package/lib/browser/orderParams.js +42 -4
- package/lib/browser/orderSubscriber/OrderSubscriber.d.ts +56 -0
- package/lib/browser/orderSubscriber/OrderSubscriber.js +56 -0
- package/lib/browser/orderSubscriber/PollingSubscription.d.ts +11 -0
- package/lib/browser/orderSubscriber/PollingSubscription.js +11 -0
- package/lib/browser/orderSubscriber/WebsocketSubscription.d.ts +18 -0
- package/lib/browser/orderSubscriber/WebsocketSubscription.js +18 -0
- package/lib/browser/orderSubscriber/grpcSubscription.d.ts +16 -0
- package/lib/browser/orderSubscriber/grpcSubscription.js +16 -0
- package/lib/browser/orderSubscriber/types.d.ts +9 -0
- package/lib/browser/priorityFee/averageOverSlotsStrategy.d.ts +1 -0
- package/lib/browser/priorityFee/averageOverSlotsStrategy.js +1 -0
- package/lib/browser/priorityFee/averageStrategy.d.ts +1 -0
- package/lib/browser/priorityFee/averageStrategy.js +1 -0
- package/lib/browser/priorityFee/ewmaStrategy.d.ts +10 -0
- package/lib/browser/priorityFee/ewmaStrategy.js +10 -0
- package/lib/browser/priorityFee/heliusPriorityFeeMethod.d.ts +13 -0
- package/lib/browser/priorityFee/heliusPriorityFeeMethod.js +9 -2
- package/lib/browser/priorityFee/maxOverSlotsStrategy.d.ts +1 -0
- package/lib/browser/priorityFee/maxOverSlotsStrategy.js +1 -0
- package/lib/browser/priorityFee/maxStrategy.d.ts +1 -0
- package/lib/browser/priorityFee/maxStrategy.js +1 -0
- package/lib/browser/priorityFee/priorityFeeSubscriber.d.ts +39 -0
- package/lib/browser/priorityFee/priorityFeeSubscriber.js +39 -0
- package/lib/browser/priorityFee/priorityFeeSubscriberMap.d.ts +20 -1
- package/lib/browser/priorityFee/priorityFeeSubscriberMap.js +21 -2
- package/lib/browser/priorityFee/solanaPriorityFeeMethod.d.ts +12 -0
- package/lib/browser/priorityFee/solanaPriorityFeeMethod.js +10 -0
- package/lib/browser/priorityFee/types.d.ts +32 -0
- package/lib/browser/priorityFee/types.js +5 -0
- package/lib/browser/priorityFee/velocityPriorityFeeMethod.d.ts +11 -0
- package/lib/browser/priorityFee/velocityPriorityFeeMethod.js +8 -0
- package/lib/browser/slot/SlotSubscriber.d.ts +18 -0
- package/lib/browser/slot/SlotSubscriber.js +16 -0
- package/lib/browser/slot/SlothashSubscriber.d.ts +26 -0
- package/lib/browser/slot/SlothashSubscriber.js +25 -1
- package/lib/browser/tx/baseTxSender.d.ts +163 -0
- package/lib/browser/tx/baseTxSender.js +174 -6
- package/lib/browser/tx/blockhashFetcher/baseBlockhashFetcher.d.ts +12 -0
- package/lib/browser/tx/blockhashFetcher/baseBlockhashFetcher.js +12 -0
- package/lib/browser/tx/blockhashFetcher/cachedBlockhashFetcher.d.ts +15 -0
- package/lib/browser/tx/blockhashFetcher/cachedBlockhashFetcher.js +15 -0
- package/lib/browser/tx/blockhashFetcher/types.d.ts +4 -0
- package/lib/browser/tx/fastSingleTxSender.d.ts +47 -0
- package/lib/browser/tx/fastSingleTxSender.js +48 -1
- package/lib/browser/tx/forwardOnlyTxSender.d.ts +48 -0
- package/lib/browser/tx/forwardOnlyTxSender.js +48 -0
- package/lib/browser/tx/reportTransactionError.d.ts +18 -6
- package/lib/browser/tx/reportTransactionError.js +18 -6
- package/lib/browser/tx/retryTxSender.d.ts +40 -0
- package/lib/browser/tx/retryTxSender.js +39 -0
- package/lib/browser/tx/txHandler.d.ts +146 -35
- package/lib/browser/tx/txHandler.js +132 -32
- package/lib/browser/tx/txParamProcessor.d.ts +47 -0
- package/lib/browser/tx/txParamProcessor.js +47 -0
- package/lib/browser/tx/types.d.ts +46 -0
- package/lib/browser/tx/types.js +5 -0
- package/lib/browser/tx/utils.d.ts +26 -0
- package/lib/browser/tx/utils.js +26 -0
- package/lib/browser/tx/whileValidTxSender.d.ts +82 -0
- package/lib/browser/tx/whileValidTxSender.js +81 -0
- package/lib/browser/types.d.ts +781 -13
- package/lib/browser/types.js +126 -9
- package/lib/browser/user.d.ts +645 -84
- package/lib/browser/user.js +779 -96
- package/lib/browser/userMap/PollingSubscription.d.ts +10 -0
- package/lib/browser/userMap/PollingSubscription.js +14 -2
- package/lib/browser/userMap/WebsocketSubscription.d.ts +9 -0
- package/lib/browser/userMap/WebsocketSubscription.js +9 -0
- package/lib/browser/userMap/grpcSubscription.d.ts +8 -0
- package/lib/browser/userMap/grpcSubscription.js +8 -0
- package/lib/browser/userMap/referrerMap.d.ts +72 -2
- package/lib/browser/userMap/referrerMap.js +84 -2
- package/lib/browser/userMap/revenueShareEscrowMap.d.ts +37 -10
- package/lib/browser/userMap/revenueShareEscrowMap.js +38 -11
- package/lib/browser/userMap/userMap.d.ts +81 -3
- package/lib/browser/userMap/userMap.js +81 -4
- package/lib/browser/userMap/userMapConfig.d.ts +23 -0
- package/lib/browser/userMap/userStatsMap.d.ts +22 -0
- package/lib/browser/userMap/userStatsMap.js +22 -0
- package/lib/browser/userName.d.ts +16 -0
- package/lib/browser/userName.js +16 -0
- package/lib/browser/userStats.d.ts +28 -1
- package/lib/browser/userStats.js +28 -1
- package/lib/browser/util/TransactionConfirmationManager.d.ts +33 -0
- package/lib/browser/util/TransactionConfirmationManager.js +33 -0
- package/lib/browser/util/chainClock.d.ts +24 -0
- package/lib/browser/util/chainClock.js +20 -0
- package/lib/browser/util/computeUnits.d.ts +32 -0
- package/lib/browser/util/computeUnits.js +32 -0
- package/lib/browser/util/digest.d.ts +17 -0
- package/lib/browser/util/digest.js +17 -0
- package/lib/browser/util/ed25519Utils.d.ts +12 -2
- package/lib/browser/util/ed25519Utils.js +12 -2
- package/lib/browser/util/promiseTimeout.d.ts +9 -0
- package/lib/browser/util/promiseTimeout.js +9 -0
- package/lib/browser/velocityClient.d.ts +3322 -215
- package/lib/browser/velocityClient.js +3412 -245
- package/lib/browser/wallet.d.ts +37 -0
- package/lib/browser/wallet.js +37 -0
- package/lib/node/accounts/basicUserAccountSubscriber.d.ts +18 -0
- package/lib/node/accounts/basicUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/basicUserAccountSubscriber.js +18 -0
- package/lib/node/accounts/basicUserStatsAccountSubscriber.d.ts +18 -0
- package/lib/node/accounts/basicUserStatsAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/basicUserStatsAccountSubscriber.js +18 -0
- package/lib/node/accounts/bulkAccountLoader.d.ts +52 -0
- package/lib/node/accounts/bulkAccountLoader.d.ts.map +1 -1
- package/lib/node/accounts/bulkAccountLoader.js +51 -0
- package/lib/node/accounts/bulkUserStatsSubscription.d.ts +9 -2
- package/lib/node/accounts/bulkUserStatsSubscription.d.ts.map +1 -1
- package/lib/node/accounts/bulkUserStatsSubscription.js +9 -2
- package/lib/node/accounts/bulkUserSubscription.d.ts +8 -2
- package/lib/node/accounts/bulkUserSubscription.d.ts.map +1 -1
- package/lib/node/accounts/bulkUserSubscription.js +8 -2
- package/lib/node/accounts/customizedCadenceBulkAccountLoader.d.ts +37 -0
- package/lib/node/accounts/customizedCadenceBulkAccountLoader.d.ts.map +1 -1
- package/lib/node/accounts/customizedCadenceBulkAccountLoader.js +37 -0
- package/lib/node/accounts/fetch.d.ts +59 -2
- package/lib/node/accounts/fetch.d.ts.map +1 -1
- package/lib/node/accounts/fetch.js +57 -2
- package/lib/node/accounts/grpcAccountSubscriber.d.ts +30 -0
- package/lib/node/accounts/grpcAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcAccountSubscriber.js +30 -0
- package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts +16 -0
- package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.js +16 -0
- package/lib/node/accounts/grpcMultiAccountSubscriber.d.ts +60 -1
- package/lib/node/accounts/grpcMultiAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcMultiAccountSubscriber.js +118 -37
- package/lib/node/accounts/grpcMultiUserAccountSubscriber.d.ts +32 -0
- package/lib/node/accounts/grpcMultiUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcMultiUserAccountSubscriber.js +40 -12
- package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts +33 -0
- package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcProgramAccountSubscriber.js +33 -0
- package/lib/node/accounts/grpcUserAccountSubscriber.d.ts +15 -0
- package/lib/node/accounts/grpcUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcUserAccountSubscriber.js +15 -0
- package/lib/node/accounts/grpcUserStatsAccountSubscriber.d.ts +15 -0
- package/lib/node/accounts/grpcUserStatsAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcUserStatsAccountSubscriber.js +15 -0
- package/lib/node/accounts/grpcVelocityClientAccountSubscriber.d.ts +41 -0
- package/lib/node/accounts/grpcVelocityClientAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcVelocityClientAccountSubscriber.js +41 -0
- package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.d.ts +116 -0
- package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.js +152 -1
- package/lib/node/accounts/laserProgramAccountSubscriber.d.ts +34 -0
- package/lib/node/accounts/laserProgramAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/laserProgramAccountSubscriber.js +34 -0
- package/lib/node/accounts/oneShotUserAccountSubscriber.d.ts +19 -0
- package/lib/node/accounts/oneShotUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/oneShotUserAccountSubscriber.js +19 -0
- package/lib/node/accounts/oneShotUserStatsAccountSubscriber.d.ts +19 -0
- package/lib/node/accounts/oneShotUserStatsAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/oneShotUserStatsAccountSubscriber.js +19 -0
- package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts +31 -0
- package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.js +31 -0
- package/lib/node/accounts/pollingOracleAccountSubscriber.d.ts +19 -0
- package/lib/node/accounts/pollingOracleAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingOracleAccountSubscriber.js +21 -2
- package/lib/node/accounts/pollingTokenAccountSubscriber.d.ts +22 -0
- package/lib/node/accounts/pollingTokenAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingTokenAccountSubscriber.js +22 -0
- package/lib/node/accounts/pollingUserAccountSubscriber.d.ts +32 -0
- package/lib/node/accounts/pollingUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingUserAccountSubscriber.js +32 -0
- package/lib/node/accounts/pollingUserStatsAccountSubscriber.d.ts +22 -0
- package/lib/node/accounts/pollingUserStatsAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingUserStatsAccountSubscriber.js +22 -0
- package/lib/node/accounts/pollingVelocityClientAccountSubscriber.d.ts +83 -0
- package/lib/node/accounts/pollingVelocityClientAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingVelocityClientAccountSubscriber.js +84 -1
- package/lib/node/accounts/testBulkAccountLoader.d.ts +8 -0
- package/lib/node/accounts/testBulkAccountLoader.d.ts.map +1 -1
- package/lib/node/accounts/testBulkAccountLoader.js +8 -0
- package/lib/node/accounts/types.d.ts +149 -0
- package/lib/node/accounts/types.d.ts.map +1 -1
- package/lib/node/accounts/types.js +13 -0
- package/lib/node/accounts/utils.d.ts +18 -0
- package/lib/node/accounts/utils.d.ts.map +1 -1
- package/lib/node/accounts/utils.js +32 -16
- package/lib/node/accounts/webSocketAccountSubscriber.d.ts +41 -0
- package/lib/node/accounts/webSocketAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketAccountSubscriber.js +41 -0
- package/lib/node/accounts/webSocketAccountSubscriberV2.d.ts +31 -0
- package/lib/node/accounts/webSocketAccountSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/webSocketAccountSubscriberV2.js +31 -23
- package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +27 -0
- package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.js +27 -0
- package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts +36 -0
- package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketProgramAccountSubscriber.js +36 -0
- package/lib/node/accounts/webSocketProgramAccountSubscriberV2.d.ts +21 -0
- package/lib/node/accounts/webSocketProgramAccountSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/webSocketProgramAccountSubscriberV2.js +25 -0
- package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.d.ts +21 -0
- package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.js +21 -0
- package/lib/node/accounts/webSocketUserAccountSubscriber.d.ts +26 -0
- package/lib/node/accounts/webSocketUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketUserAccountSubscriber.js +26 -0
- package/lib/node/accounts/webSocketUserStatsAccountSubsriber.d.ts +20 -0
- package/lib/node/accounts/webSocketUserStatsAccountSubsriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketUserStatsAccountSubsriber.js +20 -0
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.d.ts +121 -0
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.js +123 -2
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts +96 -0
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.js +108 -0
- package/lib/node/accounts/websocketProgramUserAccountSubscriber.d.ts +28 -0
- package/lib/node/accounts/websocketProgramUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/websocketProgramUserAccountSubscriber.js +33 -0
- package/lib/node/addresses/marketAddresses.d.ts +10 -0
- package/lib/node/addresses/marketAddresses.d.ts.map +1 -1
- package/lib/node/addresses/marketAddresses.js +10 -0
- package/lib/node/addresses/pda.d.ts +214 -2
- package/lib/node/addresses/pda.d.ts.map +1 -1
- package/lib/node/addresses/pda.js +217 -5
- package/lib/node/adminClient.d.ts +2136 -4
- package/lib/node/adminClient.d.ts.map +1 -1
- package/lib/node/adminClient.js +2150 -4
- package/lib/node/auctionSubscriber/auctionSubscriber.d.ts +15 -0
- package/lib/node/auctionSubscriber/auctionSubscriber.d.ts.map +1 -1
- package/lib/node/auctionSubscriber/auctionSubscriber.js +15 -0
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts +19 -0
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts.map +1 -1
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.js +19 -0
- package/lib/node/auctionSubscriber/index.d.ts +6 -0
- package/lib/node/auctionSubscriber/index.d.ts.map +1 -1
- package/lib/node/auctionSubscriber/index.js +6 -0
- package/lib/node/auctionSubscriber/types.d.ts +7 -0
- package/lib/node/auctionSubscriber/types.d.ts.map +1 -1
- package/lib/node/blockhashSubscriber/BlockhashSubscriber.d.ts +33 -0
- package/lib/node/blockhashSubscriber/BlockhashSubscriber.d.ts.map +1 -1
- package/lib/node/blockhashSubscriber/BlockhashSubscriber.js +33 -0
- package/lib/node/blockhashSubscriber/index.d.ts +5 -0
- package/lib/node/blockhashSubscriber/index.d.ts.map +1 -1
- package/lib/node/blockhashSubscriber/index.js +5 -0
- package/lib/node/blockhashSubscriber/types.d.ts +5 -0
- package/lib/node/blockhashSubscriber/types.d.ts.map +1 -1
- package/lib/node/clock/clockSubscriber.d.ts +24 -0
- package/lib/node/clock/clockSubscriber.d.ts.map +1 -1
- package/lib/node/clock/clockSubscriber.js +22 -0
- package/lib/node/config.d.ts +58 -4
- package/lib/node/config.d.ts.map +1 -1
- package/lib/node/config.js +88 -21
- package/lib/node/constants/numericConstants.d.ts +67 -0
- package/lib/node/constants/numericConstants.d.ts.map +1 -1
- package/lib/node/constants/numericConstants.js +68 -1
- package/lib/node/constants/perpMarkets.d.ts +10 -0
- package/lib/node/constants/perpMarkets.d.ts.map +1 -1
- package/lib/node/constants/perpMarkets.js +40 -908
- package/lib/node/constants/spotMarkets.d.ts +13 -0
- package/lib/node/constants/spotMarkets.d.ts.map +1 -1
- package/lib/node/constants/spotMarkets.js +16 -742
- package/lib/node/constants/txConstants.d.ts +1 -0
- package/lib/node/constants/txConstants.d.ts.map +1 -1
- package/lib/node/constants/txConstants.js +1 -0
- package/lib/node/core/VelocityCore.d.ts +285 -8
- package/lib/node/core/VelocityCore.d.ts.map +1 -1
- package/lib/node/core/VelocityCore.js +281 -8
- package/lib/node/core/instructions/deposit.d.ts +22 -0
- package/lib/node/core/instructions/deposit.d.ts.map +1 -1
- package/lib/node/core/instructions/deposit.js +22 -0
- package/lib/node/core/instructions/fill.d.ts +17 -0
- package/lib/node/core/instructions/fill.d.ts.map +1 -1
- package/lib/node/core/instructions/fill.js +17 -0
- package/lib/node/core/instructions/funding.d.ts +12 -0
- package/lib/node/core/instructions/funding.d.ts.map +1 -1
- package/lib/node/core/instructions/funding.js +12 -0
- package/lib/node/core/instructions/liquidation.d.ts +18 -0
- package/lib/node/core/instructions/liquidation.d.ts.map +1 -1
- package/lib/node/core/instructions/liquidation.js +18 -0
- package/lib/node/core/instructions/orders.d.ts +28 -0
- package/lib/node/core/instructions/orders.d.ts.map +1 -1
- package/lib/node/core/instructions/orders.js +28 -0
- package/lib/node/core/instructions/perpOrders.d.ts +106 -0
- package/lib/node/core/instructions/perpOrders.d.ts.map +1 -1
- package/lib/node/core/instructions/perpOrders.js +106 -0
- package/lib/node/core/instructions/settlement.d.ts +14 -0
- package/lib/node/core/instructions/settlement.d.ts.map +1 -1
- package/lib/node/core/instructions/settlement.js +14 -0
- package/lib/node/core/instructions/trigger.d.ts +15 -0
- package/lib/node/core/instructions/trigger.d.ts.map +1 -1
- package/lib/node/core/instructions/trigger.js +15 -0
- package/lib/node/core/instructions/withdraw.d.ts +21 -0
- package/lib/node/core/instructions/withdraw.d.ts.map +1 -1
- package/lib/node/core/instructions/withdraw.js +21 -0
- package/lib/node/core/remainingAccounts.d.ts +47 -3
- package/lib/node/core/remainingAccounts.d.ts.map +1 -1
- package/lib/node/core/remainingAccounts.js +20 -0
- package/lib/node/core/signedMsg.d.ts +38 -0
- package/lib/node/core/signedMsg.d.ts.map +1 -1
- package/lib/node/core/signedMsg.js +33 -0
- package/lib/node/decode/customCoder.d.ts +39 -3
- package/lib/node/decode/customCoder.d.ts.map +1 -1
- package/lib/node/decode/customCoder.js +45 -3
- package/lib/node/decode/user.d.ts +22 -0
- package/lib/node/decode/user.d.ts.map +1 -1
- package/lib/node/decode/user.js +22 -0
- package/lib/node/dlob/DLOB.d.ts +502 -53
- package/lib/node/dlob/DLOB.d.ts.map +1 -1
- package/lib/node/dlob/DLOB.js +540 -98
- package/lib/node/dlob/DLOBNode.d.ts +86 -4
- package/lib/node/dlob/DLOBNode.d.ts.map +1 -1
- package/lib/node/dlob/DLOBNode.js +37 -4
- package/lib/node/dlob/DLOBSubscriber.d.ts +39 -12
- package/lib/node/dlob/DLOBSubscriber.d.ts.map +1 -1
- package/lib/node/dlob/DLOBSubscriber.js +42 -12
- package/lib/node/dlob/NodeList.d.ts +69 -0
- package/lib/node/dlob/NodeList.d.ts.map +1 -1
- package/lib/node/dlob/NodeList.js +66 -0
- package/lib/node/dlob/orderBookLevels.d.ts +106 -13
- package/lib/node/dlob/orderBookLevels.d.ts.map +1 -1
- package/lib/node/dlob/orderBookLevels.js +84 -14
- package/lib/node/dlob/types.d.ts +15 -0
- package/lib/node/dlob/types.d.ts.map +1 -1
- package/lib/node/events/eventList.d.ts +14 -0
- package/lib/node/events/eventList.d.ts.map +1 -1
- package/lib/node/events/eventList.js +14 -0
- package/lib/node/events/eventSubscriber.d.ts +87 -10
- package/lib/node/events/eventSubscriber.d.ts.map +1 -1
- package/lib/node/events/eventSubscriber.js +93 -8
- package/lib/node/events/eventsServerLogProvider.d.ts +22 -0
- package/lib/node/events/eventsServerLogProvider.d.ts.map +1 -1
- package/lib/node/events/eventsServerLogProvider.js +27 -0
- package/lib/node/events/fetchLogs.d.ts +31 -0
- package/lib/node/events/fetchLogs.d.ts.map +1 -1
- package/lib/node/events/fetchLogs.js +46 -1
- package/lib/node/events/parse.d.ts +23 -0
- package/lib/node/events/parse.d.ts.map +1 -1
- package/lib/node/events/parse.js +23 -0
- package/lib/node/events/pollingLogProvider.d.ts +24 -0
- package/lib/node/events/pollingLogProvider.d.ts.map +1 -1
- package/lib/node/events/pollingLogProvider.js +24 -0
- package/lib/node/events/sort.d.ts +11 -0
- package/lib/node/events/sort.d.ts.map +1 -1
- package/lib/node/events/sort.js +12 -0
- package/lib/node/events/txEventCache.d.ts +13 -3
- package/lib/node/events/txEventCache.d.ts.map +1 -1
- package/lib/node/events/txEventCache.js +19 -7
- package/lib/node/events/types.d.ts +118 -2
- package/lib/node/events/types.d.ts.map +1 -1
- package/lib/node/events/types.js +11 -0
- package/lib/node/events/webSocketLogProvider.d.ts +23 -0
- package/lib/node/events/webSocketLogProvider.d.ts.map +1 -1
- package/lib/node/events/webSocketLogProvider.js +28 -0
- package/lib/node/factory/oracleClient.js +2 -2
- package/lib/node/idl/velocity.d.ts +4 -4
- package/lib/node/idl/velocity.d.ts.map +1 -1
- package/lib/node/idl/velocity.json +4 -4
- package/lib/node/keypair.d.ts +8 -0
- package/lib/node/keypair.d.ts.map +1 -1
- package/lib/node/keypair.js +8 -0
- package/lib/node/marginCalculation.d.ts +134 -2
- package/lib/node/marginCalculation.d.ts.map +1 -1
- package/lib/node/marginCalculation.js +121 -0
- package/lib/node/math/amm.d.ts +348 -29
- package/lib/node/math/amm.d.ts.map +1 -1
- package/lib/node/math/amm.js +310 -32
- package/lib/node/math/auction.d.ts +95 -19
- package/lib/node/math/auction.d.ts.map +1 -1
- package/lib/node/math/auction.js +118 -28
- package/lib/node/math/bankruptcy.d.ts +46 -0
- package/lib/node/math/bankruptcy.d.ts.map +1 -1
- package/lib/node/math/bankruptcy.js +89 -1
- package/lib/node/math/builder.d.ts +64 -8
- package/lib/node/math/builder.d.ts.map +1 -1
- package/lib/node/math/builder.js +71 -9
- package/lib/node/math/conversion.d.ts +21 -0
- package/lib/node/math/conversion.d.ts.map +1 -1
- package/lib/node/math/conversion.js +21 -0
- package/lib/node/math/exchangeStatus.d.ts +91 -0
- package/lib/node/math/exchangeStatus.d.ts.map +1 -1
- package/lib/node/math/exchangeStatus.js +106 -3
- package/lib/node/math/funding.d.ts +57 -20
- package/lib/node/math/funding.d.ts.map +1 -1
- package/lib/node/math/funding.js +63 -23
- package/lib/node/math/insurance.d.ts +62 -0
- package/lib/node/math/insurance.d.ts.map +1 -1
- package/lib/node/math/insurance.js +62 -0
- package/lib/node/math/liquidation.d.ts +127 -11
- package/lib/node/math/liquidation.d.ts.map +1 -1
- package/lib/node/math/liquidation.js +182 -19
- package/lib/node/math/margin.d.ts +79 -13
- package/lib/node/math/margin.d.ts.map +1 -1
- package/lib/node/math/margin.js +80 -14
- package/lib/node/math/market.d.ts +135 -15
- package/lib/node/math/market.d.ts.map +1 -1
- package/lib/node/math/market.js +145 -17
- package/lib/node/math/oracles.d.ts +113 -0
- package/lib/node/math/oracles.d.ts.map +1 -1
- package/lib/node/math/oracles.js +118 -1
- package/lib/node/math/orders.d.ts +115 -10
- package/lib/node/math/orders.d.ts.map +1 -1
- package/lib/node/math/orders.js +130 -19
- package/lib/node/math/position.d.ts +80 -33
- package/lib/node/math/position.d.ts.map +1 -1
- package/lib/node/math/position.js +80 -33
- package/lib/node/math/repeg.d.ts +48 -10
- package/lib/node/math/repeg.d.ts.map +1 -1
- package/lib/node/math/repeg.js +48 -10
- package/lib/node/math/spotBalance.d.ts +200 -5
- package/lib/node/math/spotBalance.d.ts.map +1 -1
- package/lib/node/math/spotBalance.js +239 -10
- package/lib/node/math/spotMarket.d.ts +36 -3
- package/lib/node/math/spotMarket.d.ts.map +1 -1
- package/lib/node/math/spotMarket.js +36 -3
- package/lib/node/math/spotPosition.d.ts +72 -0
- package/lib/node/math/spotPosition.d.ts.map +1 -1
- package/lib/node/math/spotPosition.js +62 -0
- package/lib/node/math/state.d.ts +31 -0
- package/lib/node/math/state.d.ts.map +1 -1
- package/lib/node/math/state.js +31 -0
- package/lib/node/math/superStake.d.ts +126 -2
- package/lib/node/math/superStake.d.ts.map +1 -1
- package/lib/node/math/superStake.js +123 -3
- package/lib/node/math/tiers.d.ts +29 -0
- package/lib/node/math/tiers.d.ts.map +1 -1
- package/lib/node/math/tiers.js +29 -0
- package/lib/node/math/trade.d.ts +102 -51
- package/lib/node/math/trade.d.ts.map +1 -1
- package/lib/node/math/trade.js +101 -55
- package/lib/node/math/utils.d.ts +71 -9
- package/lib/node/math/utils.d.ts.map +1 -1
- package/lib/node/math/utils.js +71 -9
- package/lib/node/memcmp.d.ts +94 -0
- package/lib/node/memcmp.d.ts.map +1 -1
- package/lib/node/memcmp.js +103 -2
- package/lib/node/oracles/oracleClientCache.d.ts +16 -0
- package/lib/node/oracles/oracleClientCache.d.ts.map +1 -1
- package/lib/node/oracles/oracleClientCache.js +16 -0
- package/lib/node/oracles/oracleId.d.ts +31 -0
- package/lib/node/oracles/oracleId.d.ts.map +1 -1
- package/lib/node/oracles/oracleId.js +39 -8
- package/lib/node/oracles/prelaunchOracleClient.d.ts +20 -0
- package/lib/node/oracles/prelaunchOracleClient.d.ts.map +1 -1
- package/lib/node/oracles/prelaunchOracleClient.js +20 -0
- package/lib/node/oracles/pythClient.d.ts +31 -0
- package/lib/node/oracles/pythClient.d.ts.map +1 -1
- package/lib/node/oracles/pythClient.js +32 -1
- package/lib/node/oracles/pythLazerClient.d.ts +34 -0
- package/lib/node/oracles/pythLazerClient.d.ts.map +1 -1
- package/lib/node/oracles/pythLazerClient.js +35 -1
- package/lib/node/oracles/quoteAssetOracleClient.d.ts +18 -0
- package/lib/node/oracles/quoteAssetOracleClient.d.ts.map +1 -1
- package/lib/node/oracles/quoteAssetOracleClient.js +18 -0
- package/lib/node/oracles/strictOraclePrice.d.ts +21 -0
- package/lib/node/oracles/strictOraclePrice.d.ts.map +1 -1
- package/lib/node/oracles/strictOraclePrice.js +21 -0
- package/lib/node/oracles/types.d.ts +45 -0
- package/lib/node/oracles/types.d.ts.map +1 -1
- package/lib/node/oracles/utils.d.ts +20 -0
- package/lib/node/oracles/utils.d.ts.map +1 -1
- package/lib/node/oracles/utils.js +20 -0
- package/lib/node/orderParams.d.ts +42 -4
- package/lib/node/orderParams.d.ts.map +1 -1
- package/lib/node/orderParams.js +42 -4
- package/lib/node/orderSubscriber/OrderSubscriber.d.ts +56 -0
- package/lib/node/orderSubscriber/OrderSubscriber.d.ts.map +1 -1
- package/lib/node/orderSubscriber/OrderSubscriber.js +56 -0
- package/lib/node/orderSubscriber/PollingSubscription.d.ts +11 -0
- package/lib/node/orderSubscriber/PollingSubscription.d.ts.map +1 -1
- package/lib/node/orderSubscriber/PollingSubscription.js +11 -0
- package/lib/node/orderSubscriber/WebsocketSubscription.d.ts +18 -0
- package/lib/node/orderSubscriber/WebsocketSubscription.d.ts.map +1 -1
- package/lib/node/orderSubscriber/WebsocketSubscription.js +18 -0
- package/lib/node/orderSubscriber/grpcSubscription.d.ts +16 -0
- package/lib/node/orderSubscriber/grpcSubscription.d.ts.map +1 -1
- package/lib/node/orderSubscriber/grpcSubscription.js +16 -0
- package/lib/node/orderSubscriber/types.d.ts +9 -0
- package/lib/node/orderSubscriber/types.d.ts.map +1 -1
- package/lib/node/priorityFee/averageOverSlotsStrategy.d.ts +1 -0
- package/lib/node/priorityFee/averageOverSlotsStrategy.d.ts.map +1 -1
- package/lib/node/priorityFee/averageOverSlotsStrategy.js +1 -0
- package/lib/node/priorityFee/averageStrategy.d.ts +1 -0
- package/lib/node/priorityFee/averageStrategy.d.ts.map +1 -1
- package/lib/node/priorityFee/averageStrategy.js +1 -0
- package/lib/node/priorityFee/ewmaStrategy.d.ts +10 -0
- package/lib/node/priorityFee/ewmaStrategy.d.ts.map +1 -1
- package/lib/node/priorityFee/ewmaStrategy.js +10 -0
- package/lib/node/priorityFee/heliusPriorityFeeMethod.d.ts +13 -0
- package/lib/node/priorityFee/heliusPriorityFeeMethod.d.ts.map +1 -1
- package/lib/node/priorityFee/heliusPriorityFeeMethod.js +9 -2
- package/lib/node/priorityFee/maxOverSlotsStrategy.d.ts +1 -0
- package/lib/node/priorityFee/maxOverSlotsStrategy.d.ts.map +1 -1
- package/lib/node/priorityFee/maxOverSlotsStrategy.js +1 -0
- package/lib/node/priorityFee/maxStrategy.d.ts +1 -0
- package/lib/node/priorityFee/maxStrategy.d.ts.map +1 -1
- package/lib/node/priorityFee/maxStrategy.js +1 -0
- package/lib/node/priorityFee/priorityFeeSubscriber.d.ts +39 -0
- package/lib/node/priorityFee/priorityFeeSubscriber.d.ts.map +1 -1
- package/lib/node/priorityFee/priorityFeeSubscriber.js +39 -0
- package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts +20 -1
- package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts.map +1 -1
- package/lib/node/priorityFee/priorityFeeSubscriberMap.js +21 -2
- package/lib/node/priorityFee/solanaPriorityFeeMethod.d.ts +12 -0
- package/lib/node/priorityFee/solanaPriorityFeeMethod.d.ts.map +1 -1
- package/lib/node/priorityFee/solanaPriorityFeeMethod.js +10 -0
- package/lib/node/priorityFee/types.d.ts +32 -0
- package/lib/node/priorityFee/types.d.ts.map +1 -1
- package/lib/node/priorityFee/types.js +5 -0
- package/lib/node/priorityFee/velocityPriorityFeeMethod.d.ts +11 -0
- package/lib/node/priorityFee/velocityPriorityFeeMethod.d.ts.map +1 -1
- package/lib/node/priorityFee/velocityPriorityFeeMethod.js +8 -0
- package/lib/node/slot/SlotSubscriber.d.ts +18 -0
- package/lib/node/slot/SlotSubscriber.d.ts.map +1 -1
- package/lib/node/slot/SlotSubscriber.js +16 -0
- package/lib/node/slot/SlothashSubscriber.d.ts +26 -0
- package/lib/node/slot/SlothashSubscriber.d.ts.map +1 -1
- package/lib/node/slot/SlothashSubscriber.js +25 -1
- package/lib/node/tx/baseTxSender.d.ts +163 -0
- package/lib/node/tx/baseTxSender.d.ts.map +1 -1
- package/lib/node/tx/baseTxSender.js +174 -6
- package/lib/node/tx/blockhashFetcher/baseBlockhashFetcher.d.ts +12 -0
- package/lib/node/tx/blockhashFetcher/baseBlockhashFetcher.d.ts.map +1 -1
- package/lib/node/tx/blockhashFetcher/baseBlockhashFetcher.js +12 -0
- package/lib/node/tx/blockhashFetcher/cachedBlockhashFetcher.d.ts +15 -0
- package/lib/node/tx/blockhashFetcher/cachedBlockhashFetcher.d.ts.map +1 -1
- package/lib/node/tx/blockhashFetcher/cachedBlockhashFetcher.js +15 -0
- package/lib/node/tx/blockhashFetcher/types.d.ts +4 -0
- package/lib/node/tx/blockhashFetcher/types.d.ts.map +1 -1
- package/lib/node/tx/fastSingleTxSender.d.ts +47 -0
- package/lib/node/tx/fastSingleTxSender.d.ts.map +1 -1
- package/lib/node/tx/fastSingleTxSender.js +48 -1
- package/lib/node/tx/forwardOnlyTxSender.d.ts +48 -0
- package/lib/node/tx/forwardOnlyTxSender.d.ts.map +1 -1
- package/lib/node/tx/forwardOnlyTxSender.js +48 -0
- package/lib/node/tx/reportTransactionError.d.ts +18 -6
- package/lib/node/tx/reportTransactionError.d.ts.map +1 -1
- package/lib/node/tx/reportTransactionError.js +18 -6
- package/lib/node/tx/retryTxSender.d.ts +40 -0
- package/lib/node/tx/retryTxSender.d.ts.map +1 -1
- package/lib/node/tx/retryTxSender.js +39 -0
- package/lib/node/tx/txHandler.d.ts +146 -35
- package/lib/node/tx/txHandler.d.ts.map +1 -1
- package/lib/node/tx/txHandler.js +132 -32
- package/lib/node/tx/txParamProcessor.d.ts +47 -0
- package/lib/node/tx/txParamProcessor.d.ts.map +1 -1
- package/lib/node/tx/txParamProcessor.js +47 -0
- package/lib/node/tx/types.d.ts +46 -0
- package/lib/node/tx/types.d.ts.map +1 -1
- package/lib/node/tx/types.js +5 -0
- package/lib/node/tx/utils.d.ts +26 -0
- package/lib/node/tx/utils.d.ts.map +1 -1
- package/lib/node/tx/utils.js +26 -0
- package/lib/node/tx/whileValidTxSender.d.ts +82 -0
- package/lib/node/tx/whileValidTxSender.d.ts.map +1 -1
- package/lib/node/tx/whileValidTxSender.js +81 -0
- package/lib/node/types.d.ts +781 -13
- package/lib/node/types.d.ts.map +1 -1
- package/lib/node/types.js +126 -9
- package/lib/node/user.d.ts +645 -84
- package/lib/node/user.d.ts.map +1 -1
- package/lib/node/user.js +779 -96
- package/lib/node/userMap/PollingSubscription.d.ts +10 -0
- package/lib/node/userMap/PollingSubscription.d.ts.map +1 -1
- package/lib/node/userMap/PollingSubscription.js +14 -2
- package/lib/node/userMap/WebsocketSubscription.d.ts +9 -0
- package/lib/node/userMap/WebsocketSubscription.d.ts.map +1 -1
- package/lib/node/userMap/WebsocketSubscription.js +9 -0
- package/lib/node/userMap/grpcSubscription.d.ts +8 -0
- package/lib/node/userMap/grpcSubscription.d.ts.map +1 -1
- package/lib/node/userMap/grpcSubscription.js +8 -0
- package/lib/node/userMap/referrerMap.d.ts +72 -2
- package/lib/node/userMap/referrerMap.d.ts.map +1 -1
- package/lib/node/userMap/referrerMap.js +84 -2
- package/lib/node/userMap/revenueShareEscrowMap.d.ts +37 -10
- package/lib/node/userMap/revenueShareEscrowMap.d.ts.map +1 -1
- package/lib/node/userMap/revenueShareEscrowMap.js +38 -11
- package/lib/node/userMap/userMap.d.ts +81 -3
- package/lib/node/userMap/userMap.d.ts.map +1 -1
- package/lib/node/userMap/userMap.js +81 -4
- package/lib/node/userMap/userMapConfig.d.ts +23 -0
- package/lib/node/userMap/userMapConfig.d.ts.map +1 -1
- package/lib/node/userMap/userStatsMap.d.ts +22 -0
- package/lib/node/userMap/userStatsMap.d.ts.map +1 -1
- package/lib/node/userMap/userStatsMap.js +22 -0
- package/lib/node/userName.d.ts +16 -0
- package/lib/node/userName.d.ts.map +1 -1
- package/lib/node/userName.js +16 -0
- package/lib/node/userStats.d.ts +28 -1
- package/lib/node/userStats.d.ts.map +1 -1
- package/lib/node/userStats.js +28 -1
- package/lib/node/util/TransactionConfirmationManager.d.ts +33 -0
- package/lib/node/util/TransactionConfirmationManager.d.ts.map +1 -1
- package/lib/node/util/TransactionConfirmationManager.js +33 -0
- package/lib/node/util/chainClock.d.ts +24 -0
- package/lib/node/util/chainClock.d.ts.map +1 -1
- package/lib/node/util/chainClock.js +20 -0
- package/lib/node/util/computeUnits.d.ts +32 -0
- package/lib/node/util/computeUnits.d.ts.map +1 -1
- package/lib/node/util/computeUnits.js +32 -0
- package/lib/node/util/digest.d.ts +17 -0
- package/lib/node/util/digest.d.ts.map +1 -1
- package/lib/node/util/digest.js +17 -0
- package/lib/node/util/ed25519Utils.d.ts +12 -2
- package/lib/node/util/ed25519Utils.d.ts.map +1 -1
- package/lib/node/util/ed25519Utils.js +12 -2
- package/lib/node/util/promiseTimeout.d.ts +9 -0
- package/lib/node/util/promiseTimeout.d.ts.map +1 -1
- package/lib/node/util/promiseTimeout.js +9 -0
- package/lib/node/velocityClient.d.ts +3322 -215
- package/lib/node/velocityClient.d.ts.map +1 -1
- package/lib/node/velocityClient.js +3412 -245
- package/lib/node/wallet.d.ts +37 -0
- package/lib/node/wallet.d.ts.map +1 -1
- package/lib/node/wallet.js +37 -0
- package/package.json +2 -1
- package/src/accounts/basicUserAccountSubscriber.ts +18 -0
- package/src/accounts/basicUserStatsAccountSubscriber.ts +18 -0
- package/src/accounts/bulkAccountLoader.ts +52 -0
- package/src/accounts/bulkUserStatsSubscription.ts +9 -2
- package/src/accounts/bulkUserSubscription.ts +8 -2
- package/src/accounts/customizedCadenceBulkAccountLoader.ts +37 -0
- package/src/accounts/fetch.ts +59 -2
- package/src/accounts/grpcAccountSubscriber.ts +30 -0
- package/src/accounts/grpcInsuranceFundStakeAccountSubscriber.ts +16 -0
- package/src/accounts/grpcMultiAccountSubscriber.ts +121 -38
- package/src/accounts/grpcMultiUserAccountSubscriber.ts +49 -11
- package/src/accounts/grpcProgramAccountSubscriber.ts +33 -0
- package/src/accounts/grpcUserAccountSubscriber.ts +15 -0
- package/src/accounts/grpcUserStatsAccountSubscriber.ts +15 -0
- package/src/accounts/grpcVelocityClientAccountSubscriber.ts +41 -0
- package/src/accounts/grpcVelocityClientAccountSubscriberV2.ts +160 -1
- package/src/accounts/laserProgramAccountSubscriber.ts +34 -0
- package/src/accounts/oneShotUserAccountSubscriber.ts +19 -0
- package/src/accounts/oneShotUserStatsAccountSubscriber.ts +19 -0
- package/src/accounts/pollingInsuranceFundStakeAccountSubscriber.ts +31 -0
- package/src/accounts/pollingOracleAccountSubscriber.ts +21 -2
- package/src/accounts/pollingTokenAccountSubscriber.ts +22 -0
- package/src/accounts/pollingUserAccountSubscriber.ts +32 -0
- package/src/accounts/pollingUserStatsAccountSubscriber.ts +22 -0
- package/src/accounts/pollingVelocityClientAccountSubscriber.ts +84 -1
- package/src/accounts/testBulkAccountLoader.ts +8 -0
- package/src/accounts/types.ts +149 -0
- package/src/accounts/utils.ts +42 -24
- package/src/accounts/webSocketAccountSubscriber.ts +41 -0
- package/src/accounts/webSocketAccountSubscriberV2.ts +31 -23
- package/src/accounts/webSocketInsuranceFundStakeAccountSubscriber.ts +27 -0
- package/src/accounts/webSocketProgramAccountSubscriber.ts +36 -0
- package/src/accounts/webSocketProgramAccountSubscriberV2.ts +26 -0
- package/src/accounts/webSocketProgramAccountsSubscriberV2.ts +21 -0
- package/src/accounts/webSocketUserAccountSubscriber.ts +26 -0
- package/src/accounts/webSocketUserStatsAccountSubsriber.ts +20 -0
- package/src/accounts/webSocketVelocityClientAccountSubscriber.ts +127 -2
- package/src/accounts/webSocketVelocityClientAccountSubscriberV2.ts +110 -0
- package/src/accounts/websocketProgramUserAccountSubscriber.ts +33 -0
- package/src/addresses/marketAddresses.ts +10 -0
- package/src/addresses/pda.ts +228 -12
- package/src/adminClient.ts +2156 -4
- package/src/auctionSubscriber/auctionSubscriber.ts +15 -0
- package/src/auctionSubscriber/auctionSubscriberGrpc.ts +19 -0
- package/src/auctionSubscriber/index.ts +6 -0
- package/src/auctionSubscriber/types.ts +7 -0
- package/src/blockhashSubscriber/BlockhashSubscriber.ts +33 -0
- package/src/blockhashSubscriber/index.ts +5 -0
- package/src/blockhashSubscriber/types.ts +5 -4
- package/src/clock/clockSubscriber.ts +24 -0
- package/src/config.ts +109 -22
- package/src/constants/numericConstants.ts +70 -0
- package/src/constants/perpMarkets.ts +45 -960
- package/src/constants/spotMarkets.ts +23 -793
- package/src/constants/txConstants.ts +1 -0
- package/src/core/VelocityCore.ts +286 -8
- package/src/core/instructions/deposit.ts +22 -0
- package/src/core/instructions/fill.ts +17 -0
- package/src/core/instructions/funding.ts +12 -0
- package/src/core/instructions/liquidation.ts +18 -0
- package/src/core/instructions/orders.ts +28 -0
- package/src/core/instructions/perpOrders.ts +106 -0
- package/src/core/instructions/settlement.ts +14 -0
- package/src/core/instructions/trigger.ts +15 -0
- package/src/core/instructions/withdraw.ts +21 -0
- package/src/core/remainingAccounts.ts +47 -3
- package/src/core/signedMsg.ts +38 -0
- package/src/decode/customCoder.ts +46 -3
- package/src/decode/user.ts +22 -0
- package/src/dlob/DLOB.ts +668 -97
- package/src/dlob/DLOBNode.ts +98 -6
- package/src/dlob/DLOBSubscriber.ts +49 -12
- package/src/dlob/NodeList.ts +69 -0
- package/src/dlob/orderBookLevels.ts +108 -14
- package/src/dlob/types.ts +15 -0
- package/src/events/eventList.ts +14 -0
- package/src/events/eventSubscriber.ts +100 -19
- package/src/events/eventsServerLogProvider.ts +28 -0
- package/src/events/fetchLogs.ts +52 -2
- package/src/events/parse.ts +23 -0
- package/src/events/pollingLogProvider.ts +24 -0
- package/src/events/sort.ts +12 -0
- package/src/events/txEventCache.ts +19 -7
- package/src/events/types.ts +131 -11
- package/src/events/webSocketLogProvider.ts +29 -0
- package/src/factory/oracleClient.ts +2 -2
- package/src/idl/velocity.json +4 -4
- package/src/idl/velocity.ts +4 -4
- package/src/keypair.ts +8 -0
- package/src/marginCalculation.ts +153 -2
- package/src/math/amm.ts +371 -36
- package/src/math/auction.ts +139 -30
- package/src/math/bankruptcy.ts +104 -1
- package/src/math/builder.ts +74 -8
- package/src/math/conversion.ts +21 -0
- package/src/math/exchangeStatus.ts +117 -2
- package/src/math/funding.ts +63 -23
- package/src/math/insurance.ts +62 -0
- package/src/math/liquidation.ts +227 -17
- package/src/math/margin.ts +80 -14
- package/src/math/market.ts +148 -17
- package/src/math/oracles.ts +124 -0
- package/src/math/orders.ts +141 -19
- package/src/math/position.ts +80 -33
- package/src/math/repeg.ts +48 -10
- package/src/math/spotBalance.ts +252 -12
- package/src/math/spotMarket.ts +36 -3
- package/src/math/spotPosition.ts +72 -0
- package/src/math/state.ts +31 -0
- package/src/math/superStake.ts +126 -3
- package/src/math/tiers.ts +29 -0
- package/src/math/trade.ts +125 -55
- package/src/math/utils.ts +71 -9
- package/src/memcmp.ts +104 -2
- package/src/oracles/oracleClientCache.ts +16 -0
- package/src/oracles/oracleId.ts +39 -6
- package/src/oracles/prelaunchOracleClient.ts +20 -0
- package/src/oracles/pythClient.ts +32 -1
- package/src/oracles/pythLazerClient.ts +35 -1
- package/src/oracles/quoteAssetOracleClient.ts +18 -0
- package/src/oracles/strictOraclePrice.ts +21 -0
- package/src/oracles/types.ts +45 -0
- package/src/oracles/utils.ts +20 -0
- package/src/orderParams.ts +42 -4
- package/src/orderSubscriber/OrderSubscriber.ts +56 -0
- package/src/orderSubscriber/PollingSubscription.ts +11 -0
- package/src/orderSubscriber/WebsocketSubscription.ts +18 -0
- package/src/orderSubscriber/grpcSubscription.ts +16 -0
- package/src/orderSubscriber/types.ts +9 -0
- package/src/priorityFee/averageOverSlotsStrategy.ts +1 -0
- package/src/priorityFee/averageStrategy.ts +1 -0
- package/src/priorityFee/ewmaStrategy.ts +10 -0
- package/src/priorityFee/heliusPriorityFeeMethod.ts +13 -2
- package/src/priorityFee/maxOverSlotsStrategy.ts +1 -0
- package/src/priorityFee/maxStrategy.ts +1 -0
- package/src/priorityFee/priorityFeeSubscriber.ts +39 -0
- package/src/priorityFee/priorityFeeSubscriberMap.ts +21 -2
- package/src/priorityFee/solanaPriorityFeeMethod.ts +12 -0
- package/src/priorityFee/types.ts +33 -15
- package/src/priorityFee/velocityPriorityFeeMethod.ts +11 -0
- package/src/slot/SlotSubscriber.ts +18 -0
- package/src/slot/SlothashSubscriber.ts +27 -1
- package/src/tx/baseTxSender.ts +185 -5
- package/src/tx/blockhashFetcher/baseBlockhashFetcher.ts +12 -0
- package/src/tx/blockhashFetcher/cachedBlockhashFetcher.ts +15 -0
- package/src/tx/blockhashFetcher/types.ts +4 -0
- package/src/tx/fastSingleTxSender.ts +58 -4
- package/src/tx/forwardOnlyTxSender.ts +48 -0
- package/src/tx/reportTransactionError.ts +18 -6
- package/src/tx/retryTxSender.ts +40 -0
- package/src/tx/txHandler.ts +146 -35
- package/src/tx/txParamProcessor.ts +47 -0
- package/src/tx/types.ts +46 -0
- package/src/tx/utils.ts +26 -0
- package/src/tx/whileValidTxSender.ts +82 -0
- package/src/types.ts +777 -24
- package/src/user.ts +869 -110
- package/src/userMap/PollingSubscription.ts +16 -2
- package/src/userMap/WebsocketSubscription.ts +9 -0
- package/src/userMap/grpcSubscription.ts +8 -0
- package/src/userMap/referrerMap.ts +92 -3
- package/src/userMap/revenueShareEscrowMap.ts +38 -11
- package/src/userMap/userMap.ts +82 -4
- package/src/userMap/userMapConfig.ts +23 -10
- package/src/userMap/userStatsMap.ts +22 -0
- package/src/userName.ts +16 -0
- package/src/userStats.ts +28 -1
- package/src/util/TransactionConfirmationManager.ts +33 -0
- package/src/util/chainClock.ts +24 -0
- package/src/util/computeUnits.ts +32 -0
- package/src/util/digest.ts +17 -0
- package/src/util/ed25519Utils.ts +12 -2
- package/src/util/promiseTimeout.ts +9 -0
- package/src/velocityClient.ts +3439 -249
- package/src/wallet.ts +37 -0
- package/tests/VelocityCore/builder_escrow.test.ts +121 -0
- package/tests/amm/test.ts +102 -0
- package/tests/builder/builderFee.test.ts +42 -0
- package/tests/dlob/tickSizeStandardization.ts +545 -0
- package/tests/exchangeStatus/test.ts +45 -0
- package/tests/liquidation/test.ts +125 -0
- package/tests/oracles/mmOracleGate.test.ts +379 -0
- package/tests/oracles/pythPegSnap.test.ts +76 -0
- package/tests/sdkParity/enumParity.test.ts +84 -0
- package/tests/sdkParity/marginCategoryFill.test.ts +143 -0
- package/tests/sdkParity/memcmpOffsets.test.ts +139 -0
- package/tests/spot/test.ts +55 -0
- package/tests/user/bankruptcy.ts +165 -0
- package/tests/user/feeAndWithdrawLimits.ts +284 -0
- package/tests/user/getMarginCalculation.ts +226 -1
- package/tests/user/test.ts +8 -4
|
@@ -43,6 +43,15 @@ function commitmentLevelToCommitment(commitmentLevel) {
|
|
|
43
43
|
return 'confirmed';
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Multiplexes many accounts of the same Anchor type onto a single gRPC Geyser subscribe stream,
|
|
48
|
+
* rather than one `grpcAccountSubscriber` per account. Optional generic `U` ("account props")
|
|
49
|
+
* lets a caller attach metadata (e.g. `OracleInfo`) per pubkey — or per **array** of `U` values
|
|
50
|
+
* for a pubkey backing multiple logical entries (see `accountPropsMap`, used when several oracle
|
|
51
|
+
* ids share one underlying account). Construct via the static `create` factory, not the
|
|
52
|
+
* constructor directly, since establishing the gRPC client is asynchronous. Accounts can be added/
|
|
53
|
+
* removed from an already-open stream via `addAccounts`/`removeAccounts` without a full resubscribe.
|
|
54
|
+
*/
|
|
46
55
|
class grpcMultiAccountSubscriber {
|
|
47
56
|
get stream() {
|
|
48
57
|
if (!this._stream) {
|
|
@@ -69,6 +78,18 @@ class grpcMultiAccountSubscriber {
|
|
|
69
78
|
this.accountPropsMap = accountPropsMap;
|
|
70
79
|
}
|
|
71
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Creates a gRPC client (or reuses `clientProp`) and constructs a `grpcMultiAccountSubscriber`.
|
|
83
|
+
* Does not itself start streaming — call `subscribe(accounts, onChange)` on the result.
|
|
84
|
+
* @param grpcConfigs gRPC Geyser endpoint/token/commitment config (Yellowstone or LaserStream).
|
|
85
|
+
* @param accountName Anchor account type name all multiplexed accounts share, used for decoding via the program coder absent `decodeBuffer`.
|
|
86
|
+
* @param program Anchor program providing the connection (for `fetch()`) and coder.
|
|
87
|
+
* @param decodeBuffer Optional custom decode function receiving the buffer, the account's base58 pubkey, and its `accountProps` entry (or one element of it, if an array); defaults to `program.coder.accounts.decode(accountName, buffer)`.
|
|
88
|
+
* @param resubOpts Resubscription watchdog options; `resubTimeoutMs` triggers a full unsubscribe on inactivity (no automatic resubscribe here — see `onUnsubscribe`).
|
|
89
|
+
* @param clientProp Optional existing gRPC client to reuse instead of creating a new connection.
|
|
90
|
+
* @param onUnsubscribe Optional callback invoked after `unsubscribe()` completes (or the resub-timeout-driven unsubscribe fires), typically used by callers to drive their own resubscribe logic.
|
|
91
|
+
* @param accountPropsMap Optional per-pubkey metadata (or array of metadata, for a shared pubkey) passed through to `decodeBuffer` and the `subscribe`/`addAccounts` change callback.
|
|
92
|
+
*/
|
|
72
93
|
static async create(grpcConfigs, accountName, program, decodeBuffer, resubOpts, clientProp, onUnsubscribe, accountPropsMap) {
|
|
73
94
|
var _a, _b;
|
|
74
95
|
const client = clientProp
|
|
@@ -79,15 +100,31 @@ class grpcMultiAccountSubscriber {
|
|
|
79
100
|
(_b = grpcConfigs.commitmentLevel) !== null && _b !== void 0 ? _b : grpc_1.CommitmentLevel.CONFIRMED;
|
|
80
101
|
return new grpcMultiAccountSubscriber(client, commitmentLevel, accountName, program, decodeBuffer, resubOpts, onUnsubscribe, accountPropsMap);
|
|
81
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Seeds or overwrites the cached data for one account, bypassing gRPC/RPC. Used to inject
|
|
105
|
+
* data the caller already has (e.g. from an initial batch fetch) before the stream delivers
|
|
106
|
+
* live updates.
|
|
107
|
+
* @param accountPubkey Base58 pubkey of the account.
|
|
108
|
+
* @param data Decoded account data to store.
|
|
109
|
+
* @param slot Slot the data was observed at; defaults to 0 (the seeded sentinel) if omitted.
|
|
110
|
+
*/
|
|
82
111
|
setAccountData(accountPubkey, data, slot) {
|
|
83
112
|
this.dataMap.set(accountPubkey, { data, slot: slot !== null && slot !== void 0 ? slot : 0 });
|
|
84
113
|
}
|
|
114
|
+
/** Returns the cached data/slot for one account, or undefined if not yet loaded. */
|
|
85
115
|
getAccountData(accountPubkey) {
|
|
86
116
|
return this.dataMap.get(accountPubkey);
|
|
87
117
|
}
|
|
118
|
+
/** Returns the full map of base58 pubkey to cached data/slot for every multiplexed account. */
|
|
88
119
|
getAccountDataMap() {
|
|
89
120
|
return this.dataMap;
|
|
90
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Fetches every subscribed account once via chunked `getMultipleAccountsInfoAndContext` calls
|
|
124
|
+
* (100 pubkeys per chunk, processed concurrently), updating `dataMap`/`bufferMap` for any
|
|
125
|
+
* account whose buffer changed at a non-decreasing slot. Errors are logged (if
|
|
126
|
+
* `resubOpts.logResubMessages`) and swallowed rather than thrown.
|
|
127
|
+
*/
|
|
91
128
|
async fetch() {
|
|
92
129
|
var _a;
|
|
93
130
|
try {
|
|
@@ -100,6 +137,7 @@ class grpcMultiAccountSubscriber {
|
|
|
100
137
|
}
|
|
101
138
|
// Process all chunks concurrently
|
|
102
139
|
await Promise.all(chunks.map(async (chunk) => {
|
|
140
|
+
var _a;
|
|
103
141
|
const accountAddresses = chunk.map((accountId) => new web3_js_1.PublicKey(accountId));
|
|
104
142
|
const rpcResponseAndContext = await this.program.provider.connection.getMultipleAccountsInfoAndContext(accountAddresses, {
|
|
105
143
|
commitment: commitmentLevelToCommitment(this.commitmentLevel),
|
|
@@ -125,7 +163,18 @@ class grpcMultiAccountSubscriber {
|
|
|
125
163
|
buffer: newBuffer,
|
|
126
164
|
slot: currentSlot,
|
|
127
165
|
});
|
|
128
|
-
|
|
166
|
+
// decode via the injected decoder (with accountProps) so backfill
|
|
167
|
+
// matches the live-update decode path — the stock program coder
|
|
168
|
+
// can't decode custom-decoder accounts (e.g. oracle buffers). For a
|
|
169
|
+
// pubkey backing multiple props, seed from the first (dataMap is
|
|
170
|
+
// keyed by pubkey; see the accountPropsMap notes above).
|
|
171
|
+
const accountProps = (_a = this.accountPropsMap) === null || _a === void 0 ? void 0 : _a.get(accountId);
|
|
172
|
+
const decodeProps = Array.isArray(accountProps)
|
|
173
|
+
? accountProps[0]
|
|
174
|
+
: accountProps;
|
|
175
|
+
const accountDecoded = this.decodeBufferFn
|
|
176
|
+
? this.decodeBufferFn(newBuffer, accountId, decodeProps)
|
|
177
|
+
: this.program.coder.accounts.decode(this.accountName, newBuffer);
|
|
129
178
|
this.setAccountData(accountId, accountDecoded, currentSlot);
|
|
130
179
|
}
|
|
131
180
|
}
|
|
@@ -137,6 +186,13 @@ class grpcMultiAccountSubscriber {
|
|
|
137
186
|
}
|
|
138
187
|
}
|
|
139
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* Opens a single gRPC subscribe stream covering all of `accounts`. Each update is decoded and
|
|
191
|
+
* cached (via `setAccountData`) before `onChange` is invoked. Idempotent: a no-op if already
|
|
192
|
+
* subscribed or mid-unsubscribe.
|
|
193
|
+
* @param accounts Pubkeys to include in the stream filter.
|
|
194
|
+
* @param onChange Invoked once per changed account with its pubkey, decoded data, the notification's `Context` (including `slot`), the raw buffer, and any `accountProps` metadata registered for that pubkey.
|
|
195
|
+
*/
|
|
140
196
|
async subscribe(accounts, onChange) {
|
|
141
197
|
var _a;
|
|
142
198
|
if ((_a = this.resubOpts) === null || _a === void 0 ? void 0 : _a.logResubMessages) {
|
|
@@ -254,10 +310,24 @@ class grpcMultiAccountSubscriber {
|
|
|
254
310
|
throw reason;
|
|
255
311
|
});
|
|
256
312
|
}
|
|
257
|
-
|
|
313
|
+
/**
|
|
314
|
+
* Extends the already-open stream's filter to include `accounts` (re-writing the full
|
|
315
|
+
* accumulated filter set, since the gRPC protocol has no incremental "add" primitive), then
|
|
316
|
+
* immediately calls `fetch()` to backfill their initial data.
|
|
317
|
+
* @param accounts Additional pubkeys to start tracking.
|
|
318
|
+
* @param accountProps Optional per-pubkey metadata to merge into `accountPropsMap` so the
|
|
319
|
+
* injected decoder can decode the newly added accounts (without it, a new `(pubkey, source)`
|
|
320
|
+
* oracle would decode with missing `accountProps` and throw).
|
|
321
|
+
*/
|
|
322
|
+
async addAccounts(accounts, accountProps) {
|
|
258
323
|
for (const pk of accounts) {
|
|
259
324
|
this.subscribedAccounts.add(pk.toBase58());
|
|
260
325
|
}
|
|
326
|
+
if (accountProps) {
|
|
327
|
+
for (const [key, props] of accountProps.entries()) {
|
|
328
|
+
this.accountPropsMap.set(key, props);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
261
331
|
const request = {
|
|
262
332
|
slots: {},
|
|
263
333
|
accounts: {
|
|
@@ -287,6 +357,11 @@ class grpcMultiAccountSubscriber {
|
|
|
287
357
|
});
|
|
288
358
|
await this.fetch();
|
|
289
359
|
}
|
|
360
|
+
/**
|
|
361
|
+
* Removes `accounts` from `subscribedAccounts`/`onChangeMap` and re-writes the stream's filter
|
|
362
|
+
* to exclude them. Does not clear their cached data from `dataMap`/`bufferMap`.
|
|
363
|
+
* @param accounts Pubkeys to stop tracking.
|
|
364
|
+
*/
|
|
290
365
|
async removeAccounts(accounts) {
|
|
291
366
|
for (const pk of accounts) {
|
|
292
367
|
const k = pk.toBase58();
|
|
@@ -321,49 +396,55 @@ class grpcMultiAccountSubscriber {
|
|
|
321
396
|
});
|
|
322
397
|
});
|
|
323
398
|
}
|
|
399
|
+
/** Writes an empty subscribe request to clear the stream's account filter, cancels any pending resub timeout, and invokes `onUnsubscribe` if one was registered at construction. */
|
|
324
400
|
async unsubscribe() {
|
|
325
401
|
this.isUnsubscribing = true;
|
|
326
402
|
clearTimeout(this.timeoutId);
|
|
327
403
|
this.timeoutId = undefined;
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
404
|
+
try {
|
|
405
|
+
if (this.listenerId != null) {
|
|
406
|
+
await new Promise((resolve, reject) => {
|
|
407
|
+
const request = {
|
|
408
|
+
slots: {},
|
|
409
|
+
accounts: {},
|
|
410
|
+
transactions: {},
|
|
411
|
+
blocks: {},
|
|
412
|
+
blocksMeta: {},
|
|
413
|
+
accountsDataSlice: [],
|
|
414
|
+
entry: {},
|
|
415
|
+
transactionsStatus: {},
|
|
416
|
+
};
|
|
417
|
+
this.stream.write(request, (err) => {
|
|
418
|
+
if (err === null || err === undefined) {
|
|
419
|
+
this.listenerId = undefined;
|
|
420
|
+
resolve();
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
reject(err);
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
}).catch((reason) => {
|
|
427
|
+
console.error(reason);
|
|
428
|
+
throw reason;
|
|
349
429
|
});
|
|
350
|
-
}).catch((reason) => {
|
|
351
|
-
console.error(reason);
|
|
352
|
-
throw reason;
|
|
353
|
-
});
|
|
354
|
-
return promise;
|
|
355
|
-
}
|
|
356
|
-
else {
|
|
357
|
-
this.isUnsubscribing = false;
|
|
358
|
-
}
|
|
359
|
-
if (this.onUnsubscribe) {
|
|
360
|
-
try {
|
|
361
|
-
await this.onUnsubscribe();
|
|
362
430
|
}
|
|
363
|
-
|
|
364
|
-
|
|
431
|
+
// invoke onUnsubscribe on the normal path too (previously it only ran when
|
|
432
|
+
// listenerId was already null, so the resubscribe hook never fired on the
|
|
433
|
+
// standard unsubscribe path)
|
|
434
|
+
if (this.onUnsubscribe) {
|
|
435
|
+
try {
|
|
436
|
+
await this.onUnsubscribe();
|
|
437
|
+
}
|
|
438
|
+
catch (e) {
|
|
439
|
+
console.error(e);
|
|
440
|
+
}
|
|
365
441
|
}
|
|
366
442
|
}
|
|
443
|
+
finally {
|
|
444
|
+
// clear the flag on every exit path, including a failed stream.write, so
|
|
445
|
+
// the instance isn't wedged and can resubscribe
|
|
446
|
+
this.isUnsubscribing = false;
|
|
447
|
+
}
|
|
367
448
|
}
|
|
368
449
|
setTimeout() {
|
|
369
450
|
var _a;
|
|
@@ -3,6 +3,13 @@ import { PublicKey } from '@solana/web3.js';
|
|
|
3
3
|
import { UserAccount } from '../types';
|
|
4
4
|
import { VelocityProgram } from '../config';
|
|
5
5
|
import { grpcMultiAccountSubscriber } from './grpcMultiAccountSubscriber';
|
|
6
|
+
/**
|
|
7
|
+
* Multiplexes many `UserAccount` subscriptions onto a single `grpcMultiAccountSubscriber`,
|
|
8
|
+
* exposing a per-user `UserAccountSubscriber` facade via `forUser()` so callers (e.g. `User`
|
|
9
|
+
* instances) can interact with it as if each had its own subscription. New `forUser()` keys
|
|
10
|
+
* registered while already subscribed are debounced (`debounceMs`, 20ms) and flushed in a single
|
|
11
|
+
* batched `addAccounts` call rather than one gRPC round trip per user.
|
|
12
|
+
*/
|
|
6
13
|
export declare class grpcMultiUserAccountSubscriber {
|
|
7
14
|
private program;
|
|
8
15
|
private _multiSubscriber?;
|
|
@@ -13,13 +20,38 @@ export declare class grpcMultiUserAccountSubscriber {
|
|
|
13
20
|
private pendingAddKeys;
|
|
14
21
|
private debounceTimer?;
|
|
15
22
|
private debounceMs;
|
|
23
|
+
/** Maximum time to wait in `subscribe()` for every registered user key to appear in the multi-subscriber's data map before giving up. */
|
|
24
|
+
private static readonly SUBSCRIBE_DATA_TIMEOUT_MS;
|
|
16
25
|
private isMultiSubscribed;
|
|
17
26
|
private userAccountSubscribers;
|
|
18
27
|
private grpcConfigs;
|
|
19
28
|
resubOpts?: ResubOpts;
|
|
20
29
|
private handleAccountChange;
|
|
30
|
+
/**
|
|
31
|
+
* @param program Anchor program used for the per-user `fetch()` fallback.
|
|
32
|
+
* @param grpcConfigs gRPC Geyser endpoint/token/commitment config (Yellowstone or LaserStream).
|
|
33
|
+
* @param resubOpts Resubscription watchdog options passed to the underlying `grpcMultiAccountSubscriber`.
|
|
34
|
+
* @param multiSubscriber Optional pre-constructed `grpcMultiAccountSubscriber` to reuse instead of creating a new one in `subscribe()`.
|
|
35
|
+
*/
|
|
21
36
|
constructor(program: VelocityProgram, grpcConfigs: GrpcConfigs, resubOpts?: ResubOpts, multiSubscriber?: grpcMultiAccountSubscriber<UserAccount>);
|
|
37
|
+
/**
|
|
38
|
+
* Creates the shared `grpcMultiAccountSubscriber` (if not injected at construction),
|
|
39
|
+
* subscribes every per-user facade already registered via `forUser()`, flushes any pending
|
|
40
|
+
* user keys into the underlying gRPC stream, and blocks until the multi-subscriber's account
|
|
41
|
+
* data map contains an entry for every registered user key (polling at `debounceMs` intervals),
|
|
42
|
+
* up to `SUBSCRIBE_DATA_TIMEOUT_MS`.
|
|
43
|
+
* @throws if any registered user key is still missing from the data map once the timeout elapses.
|
|
44
|
+
*/
|
|
22
45
|
subscribe(): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Returns a `UserAccountSubscriber` facade for `userAccountPublicKey`, creating one on first
|
|
48
|
+
* call (subsequent calls for the same pubkey return the same instance). The facade's
|
|
49
|
+
* `subscribe()`/`unsubscribe()` register/deregister interest in this shared multi-subscriber
|
|
50
|
+
* rather than opening their own gRPC stream; the underlying account is only actually removed
|
|
51
|
+
* from the shared stream once every facade sharing that key has unsubscribed. Its `fetch()`
|
|
52
|
+
* bypasses the shared stream and issues a direct one-off `program.account.user.fetch` call.
|
|
53
|
+
* @param userAccountPublicKey Address of the `UserAccount` to get (or create) a facade for.
|
|
54
|
+
*/
|
|
23
55
|
forUser(userAccountPublicKey: PublicKey): UserAccountSubscriber;
|
|
24
56
|
private scheduleFlush;
|
|
25
57
|
private flushPending;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpcMultiUserAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcMultiUserAccountSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,WAAW,EAEX,SAAS,EAET,qBAAqB,EACrB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAW,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,qBAAa,8BAA8B;IAC1C,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,gBAAgB,CAAC,CAA0C;IACnE,OAAO,KAAK,eAAe,GAO1B;IAED,OAAO,CAAC,QAAQ,CAA+C;IAC/D,OAAO,CAAC,SAAS,CAGb;IACJ,OAAO,CAAC,OAAO,CAAgC;IAC/C,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,aAAa,CAAC,CAAgC;IACtD,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,sBAAsB,CAA4C;IAC1E,OAAO,CAAC,WAAW,CAAc;IACjC,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB,OAAO,CAAC,mBAAmB,CAgBzB;
|
|
1
|
+
{"version":3,"file":"grpcMultiUserAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcMultiUserAccountSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,WAAW,EAEX,SAAS,EAET,qBAAqB,EACrB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAW,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E;;;;;;GAMG;AACH,qBAAa,8BAA8B;IAC1C,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,gBAAgB,CAAC,CAA0C;IACnE,OAAO,KAAK,eAAe,GAO1B;IAED,OAAO,CAAC,QAAQ,CAA+C;IAC/D,OAAO,CAAC,SAAS,CAGb;IACJ,OAAO,CAAC,OAAO,CAAgC;IAC/C,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,aAAa,CAAC,CAAgC;IACtD,OAAO,CAAC,UAAU,CAAM;IACxB,yIAAyI;IACzI,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,yBAAyB,CAAU;IAC3D,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,sBAAsB,CAA4C;IAC1E,OAAO,CAAC,WAAW,CAAc;IACjC,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB,OAAO,CAAC,mBAAmB,CAgBzB;IAEF;;;;;OAKG;gBAEF,OAAO,EAAE,eAAe,EACxB,WAAW,EAAE,WAAW,EACxB,SAAS,CAAC,EAAE,SAAS,EACrB,eAAe,CAAC,EAAE,0BAA0B,CAAC,WAAW,CAAC;IAU1D;;;;;;;OAOG;IACU,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAgDvC;;;;;;;;OAQG;IACI,OAAO,CAAC,oBAAoB,EAAE,SAAS,GAAG,qBAAqB;IAoGtE,OAAO,CAAC,aAAa;YAOP,YAAY;CAmE1B"}
|
|
@@ -5,6 +5,13 @@ const types_1 = require("./types");
|
|
|
5
5
|
const events_1 = require("events");
|
|
6
6
|
const web3_js_1 = require("@solana/web3.js");
|
|
7
7
|
const grpcMultiAccountSubscriber_1 = require("./grpcMultiAccountSubscriber");
|
|
8
|
+
/**
|
|
9
|
+
* Multiplexes many `UserAccount` subscriptions onto a single `grpcMultiAccountSubscriber`,
|
|
10
|
+
* exposing a per-user `UserAccountSubscriber` facade via `forUser()` so callers (e.g. `User`
|
|
11
|
+
* instances) can interact with it as if each had its own subscription. New `forUser()` keys
|
|
12
|
+
* registered while already subscribed are debounced (`debounceMs`, 20ms) and flushed in a single
|
|
13
|
+
* batched `addAccounts` call rather than one gRPC round trip per user.
|
|
14
|
+
*/
|
|
8
15
|
class grpcMultiUserAccountSubscriber {
|
|
9
16
|
get multiSubscriber() {
|
|
10
17
|
if (!this._multiSubscriber) {
|
|
@@ -12,6 +19,12 @@ class grpcMultiUserAccountSubscriber {
|
|
|
12
19
|
}
|
|
13
20
|
return this._multiSubscriber;
|
|
14
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* @param program Anchor program used for the per-user `fetch()` fallback.
|
|
24
|
+
* @param grpcConfigs gRPC Geyser endpoint/token/commitment config (Yellowstone or LaserStream).
|
|
25
|
+
* @param resubOpts Resubscription watchdog options passed to the underlying `grpcMultiAccountSubscriber`.
|
|
26
|
+
* @param multiSubscriber Optional pre-constructed `grpcMultiAccountSubscriber` to reuse instead of creating a new one in `subscribe()`.
|
|
27
|
+
*/
|
|
15
28
|
constructor(program, grpcConfigs, resubOpts, multiSubscriber) {
|
|
16
29
|
this.userData = new Map();
|
|
17
30
|
this.listeners = new Map();
|
|
@@ -38,6 +51,14 @@ class grpcMultiUserAccountSubscriber {
|
|
|
38
51
|
this.grpcConfigs = grpcConfigs;
|
|
39
52
|
this.resubOpts = resubOpts;
|
|
40
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Creates the shared `grpcMultiAccountSubscriber` (if not injected at construction),
|
|
56
|
+
* subscribes every per-user facade already registered via `forUser()`, flushes any pending
|
|
57
|
+
* user keys into the underlying gRPC stream, and blocks until the multi-subscriber's account
|
|
58
|
+
* data map contains an entry for every registered user key (polling at `debounceMs` intervals),
|
|
59
|
+
* up to `SUBSCRIBE_DATA_TIMEOUT_MS`.
|
|
60
|
+
* @throws if any registered user key is still missing from the data map once the timeout elapses.
|
|
61
|
+
*/
|
|
41
62
|
async subscribe() {
|
|
42
63
|
if (!this._multiSubscriber) {
|
|
43
64
|
this._multiSubscriber =
|
|
@@ -53,23 +74,28 @@ class grpcMultiUserAccountSubscriber {
|
|
|
53
74
|
const targetKeys = Array.from(this.listeners.keys());
|
|
54
75
|
if (targetKeys.length === 0)
|
|
55
76
|
return;
|
|
56
|
-
// Poll until all keys are present in dataMap
|
|
77
|
+
// Poll until all keys are present in dataMap, bounded by a deadline so a key that never
|
|
78
|
+
// arrives (e.g. dropped subscription) fails loudly instead of hanging forever.
|
|
57
79
|
// Use debounceMs as the polling cadence to avoid introducing new magic numbers
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if (!map.has(k)) {
|
|
64
|
-
allPresent = false;
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
80
|
+
const deadline = Date.now() + grpcMultiUserAccountSubscriber.SUBSCRIBE_DATA_TIMEOUT_MS;
|
|
81
|
+
let missingKeys = targetKeys.filter((k) => !this.multiSubscriber.getAccountDataMap().has(k));
|
|
82
|
+
while (missingKeys.length > 0) {
|
|
83
|
+
if (Date.now() >= deadline) {
|
|
84
|
+
throw new Error(`grpcMultiUserAccountSubscriber: timed out after ${grpcMultiUserAccountSubscriber.SUBSCRIBE_DATA_TIMEOUT_MS}ms waiting for account data for keys: ${missingKeys.join(', ')}`);
|
|
67
85
|
}
|
|
68
|
-
if (allPresent)
|
|
69
|
-
break;
|
|
70
86
|
await new Promise((resolve) => setTimeout(resolve, this.debounceMs));
|
|
87
|
+
missingKeys = targetKeys.filter((k) => !this.multiSubscriber.getAccountDataMap().has(k));
|
|
71
88
|
}
|
|
72
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Returns a `UserAccountSubscriber` facade for `userAccountPublicKey`, creating one on first
|
|
92
|
+
* call (subsequent calls for the same pubkey return the same instance). The facade's
|
|
93
|
+
* `subscribe()`/`unsubscribe()` register/deregister interest in this shared multi-subscriber
|
|
94
|
+
* rather than opening their own gRPC stream; the underlying account is only actually removed
|
|
95
|
+
* from the shared stream once every facade sharing that key has unsubscribed. Its `fetch()`
|
|
96
|
+
* bypasses the shared stream and issues a direct one-off `program.account.user.fetch` call.
|
|
97
|
+
* @param userAccountPublicKey Address of the `UserAccount` to get (or create) a facade for.
|
|
98
|
+
*/
|
|
73
99
|
forUser(userAccountPublicKey) {
|
|
74
100
|
if (this.userAccountSubscribers.has(userAccountPublicKey.toBase58())) {
|
|
75
101
|
return this.userAccountSubscribers.get(userAccountPublicKey.toBase58());
|
|
@@ -208,3 +234,5 @@ class grpcMultiUserAccountSubscriber {
|
|
|
208
234
|
}
|
|
209
235
|
}
|
|
210
236
|
exports.grpcMultiUserAccountSubscriber = grpcMultiUserAccountSubscriber;
|
|
237
|
+
/** Maximum time to wait in `subscribe()` for every registered user key to appear in the multi-subscriber's data map before giving up. */
|
|
238
|
+
grpcMultiUserAccountSubscriber.SUBSCRIBE_DATA_TIMEOUT_MS = 30000;
|
|
@@ -4,6 +4,14 @@ import { ResubOpts, GrpcConfigs } from './types';
|
|
|
4
4
|
import { Context, MemcmpFilter, PublicKey } from '@solana/web3.js';
|
|
5
5
|
import { VelocityProgram } from '../config';
|
|
6
6
|
import { WebSocketProgramAccountSubscriber } from './webSocketProgramAccountSubscriber';
|
|
7
|
+
/**
|
|
8
|
+
* `ProgramAccountSubscriber` that streams every account owned by the program (optionally
|
|
9
|
+
* filtered by `memcmp`) via a gRPC Geyser plugin instead of `connection.onProgramAccountChange`.
|
|
10
|
+
* Extends `WebSocketProgramAccountSubscriber` to reuse its per-account buffering/decode/resub-
|
|
11
|
+
* timer logic — only the transport (`subscribe`/`unsubscribe`) is replaced. Construct via the
|
|
12
|
+
* static `create` factory, not the constructor directly, since establishing the gRPC client is
|
|
13
|
+
* asynchronous.
|
|
14
|
+
*/
|
|
7
15
|
export declare class grpcProgramAccountSubscriber<T> extends WebSocketProgramAccountSubscriber<T> {
|
|
8
16
|
private client;
|
|
9
17
|
private _stream?;
|
|
@@ -11,10 +19,35 @@ export declare class grpcProgramAccountSubscriber<T> extends WebSocketProgramAcc
|
|
|
11
19
|
private commitmentLevel;
|
|
12
20
|
listenerId?: number;
|
|
13
21
|
private constructor();
|
|
22
|
+
/**
|
|
23
|
+
* Creates a gRPC client and constructs a `grpcProgramAccountSubscriber`. Forces zstd
|
|
24
|
+
* compression and an adaptive HTTP/2 window on the channel (in addition to any caller-supplied
|
|
25
|
+
* `channelOptions`), since program-wide account streams can be high-volume. Does not itself
|
|
26
|
+
* start streaming — call `subscribe(onChange)` on the result.
|
|
27
|
+
* @param grpcConfigs gRPC Geyser endpoint/token/commitment config (Yellowstone or LaserStream).
|
|
28
|
+
* @param subscriptionName Human-readable name for logging.
|
|
29
|
+
* @param accountDiscriminator Anchor account type name passed to `decodeBufferFn` for each update.
|
|
30
|
+
* @param program Anchor program whose accounts to stream (filtered to `program.programId` as owner).
|
|
31
|
+
* @param decodeBufferFn Decode function for each account's raw buffer.
|
|
32
|
+
* @param options `filters.memcmp` filters narrowing which program accounts are streamed; empty streams every account owned by the program.
|
|
33
|
+
* @param resubOpts Resubscription watchdog options; omit to disable the inactivity timer.
|
|
34
|
+
*/
|
|
14
35
|
static create<U>(grpcConfigs: GrpcConfigs, subscriptionName: string, accountDiscriminator: string, program: VelocityProgram, decodeBufferFn: (accountName: string, ix: Buffer) => U, options?: {
|
|
15
36
|
filters: MemcmpFilter[];
|
|
16
37
|
}, resubOpts?: ResubOpts): Promise<grpcProgramAccountSubscriber<U>>;
|
|
38
|
+
/**
|
|
39
|
+
* Opens a gRPC subscribe stream filtered to accounts owned by `program.programId` (further
|
|
40
|
+
* narrowed by the `filters` passed to `create`). Idempotent: a no-op if already subscribed or
|
|
41
|
+
* mid-unsubscribe. Unlike `grpcAccountSubscriber`, does not perform an initial `fetch()` — the
|
|
42
|
+
* caller must fetch any pre-existing matching accounts separately if needed.
|
|
43
|
+
* @param onChange Invoked once per changed account with its pubkey, decoded data, the notification's `Context`, and the raw buffer.
|
|
44
|
+
*/
|
|
17
45
|
subscribe(onChange: (accountId: PublicKey, data: T, context: Context, buffer: Buffer) => void): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Writes an empty subscribe request to clear the stream's filter and cancels any pending
|
|
48
|
+
* resub timeout.
|
|
49
|
+
* @param onResub Internal flag set to `true` when called as part of an automatic resubscribe cycle, which preserves `resubOpts.resubTimeoutMs` instead of clearing it. Callers should omit this.
|
|
50
|
+
*/
|
|
18
51
|
unsubscribe(onResub?: boolean): Promise<void>;
|
|
19
52
|
}
|
|
20
53
|
//# sourceMappingURL=grpcProgramAccountSubscriber.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpcProgramAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcProgramAccountSubscriber.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AASxF,qBAAa,4BAA4B,CACxC,CAAC,CACA,SAAQ,iCAAiC,CAAC,CAAC,CAAC;IAC7C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAC,CAA2C;IAC3D,OAAO,KAAK,MAAM,GAOjB;IACD,OAAO,CAAC,eAAe,CAAkB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IAE3B,OAAO;
|
|
1
|
+
{"version":3,"file":"grpcProgramAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcProgramAccountSubscriber.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AASxF;;;;;;;GAOG;AACH,qBAAa,4BAA4B,CACxC,CAAC,CACA,SAAQ,iCAAiC,CAAC,CAAC,CAAC;IAC7C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAC,CAA2C;IAC3D,OAAO,KAAK,MAAM,GAOjB;IACD,OAAO,CAAC,eAAe,CAAkB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IAE3B,OAAO;IAwBP;;;;;;;;;;;;OAYG;WACiB,MAAM,CAAC,CAAC,EAC3B,WAAW,EAAE,WAAW,EACxB,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,4BAA4B,CAAC,CAAC,CAAC,CAAC;IA2B3C;;;;;;OAMG;IACG,SAAS,CACd,QAAQ,EAAE,CACT,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,KACV,IAAI,GACP,OAAO,CAAC,IAAI,CAAC;IA+FhB;;;;OAIG;IACU,WAAW,CAAC,OAAO,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAsCxD"}
|
|
@@ -28,6 +28,14 @@ const web3_js_1 = require("@solana/web3.js");
|
|
|
28
28
|
const Buffer = __importStar(require("buffer"));
|
|
29
29
|
const webSocketProgramAccountSubscriber_1 = require("./webSocketProgramAccountSubscriber");
|
|
30
30
|
const grpc_1 = require("../isomorphic/grpc");
|
|
31
|
+
/**
|
|
32
|
+
* `ProgramAccountSubscriber` that streams every account owned by the program (optionally
|
|
33
|
+
* filtered by `memcmp`) via a gRPC Geyser plugin instead of `connection.onProgramAccountChange`.
|
|
34
|
+
* Extends `WebSocketProgramAccountSubscriber` to reuse its per-account buffering/decode/resub-
|
|
35
|
+
* timer logic — only the transport (`subscribe`/`unsubscribe`) is replaced. Construct via the
|
|
36
|
+
* static `create` factory, not the constructor directly, since establishing the gRPC client is
|
|
37
|
+
* asynchronous.
|
|
38
|
+
*/
|
|
31
39
|
class grpcProgramAccountSubscriber extends webSocketProgramAccountSubscriber_1.WebSocketProgramAccountSubscriber {
|
|
32
40
|
get stream() {
|
|
33
41
|
if (!this._stream) {
|
|
@@ -42,6 +50,19 @@ class grpcProgramAccountSubscriber extends webSocketProgramAccountSubscriber_1.W
|
|
|
42
50
|
this.client = client;
|
|
43
51
|
this.commitmentLevel = commitmentLevel;
|
|
44
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Creates a gRPC client and constructs a `grpcProgramAccountSubscriber`. Forces zstd
|
|
55
|
+
* compression and an adaptive HTTP/2 window on the channel (in addition to any caller-supplied
|
|
56
|
+
* `channelOptions`), since program-wide account streams can be high-volume. Does not itself
|
|
57
|
+
* start streaming — call `subscribe(onChange)` on the result.
|
|
58
|
+
* @param grpcConfigs gRPC Geyser endpoint/token/commitment config (Yellowstone or LaserStream).
|
|
59
|
+
* @param subscriptionName Human-readable name for logging.
|
|
60
|
+
* @param accountDiscriminator Anchor account type name passed to `decodeBufferFn` for each update.
|
|
61
|
+
* @param program Anchor program whose accounts to stream (filtered to `program.programId` as owner).
|
|
62
|
+
* @param decodeBufferFn Decode function for each account's raw buffer.
|
|
63
|
+
* @param options `filters.memcmp` filters narrowing which program accounts are streamed; empty streams every account owned by the program.
|
|
64
|
+
* @param resubOpts Resubscription watchdog options; omit to disable the inactivity timer.
|
|
65
|
+
*/
|
|
45
66
|
static async create(grpcConfigs, subscriptionName, accountDiscriminator, program, decodeBufferFn, options = {
|
|
46
67
|
filters: [],
|
|
47
68
|
}, resubOpts) {
|
|
@@ -57,6 +78,13 @@ class grpcProgramAccountSubscriber extends webSocketProgramAccountSubscriber_1.W
|
|
|
57
78
|
(_b = grpcConfigs.commitmentLevel) !== null && _b !== void 0 ? _b : grpc_1.CommitmentLevel.CONFIRMED;
|
|
58
79
|
return new grpcProgramAccountSubscriber(client, commitmentLevel, subscriptionName, accountDiscriminator, program, decodeBufferFn, options, resubOpts);
|
|
59
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Opens a gRPC subscribe stream filtered to accounts owned by `program.programId` (further
|
|
83
|
+
* narrowed by the `filters` passed to `create`). Idempotent: a no-op if already subscribed or
|
|
84
|
+
* mid-unsubscribe. Unlike `grpcAccountSubscriber`, does not perform an initial `fetch()` — the
|
|
85
|
+
* caller must fetch any pre-existing matching accounts separately if needed.
|
|
86
|
+
* @param onChange Invoked once per changed account with its pubkey, decoded data, the notification's `Context`, and the raw buffer.
|
|
87
|
+
*/
|
|
60
88
|
async subscribe(onChange) {
|
|
61
89
|
if (this.listenerId != null || this.isUnsubscribing) {
|
|
62
90
|
return;
|
|
@@ -142,6 +170,11 @@ class grpcProgramAccountSubscriber extends webSocketProgramAccountSubscriber_1.W
|
|
|
142
170
|
throw reason;
|
|
143
171
|
});
|
|
144
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Writes an empty subscribe request to clear the stream's filter and cancels any pending
|
|
175
|
+
* resub timeout.
|
|
176
|
+
* @param onResub Internal flag set to `true` when called as part of an automatic resubscribe cycle, which preserves `resubOpts.resubTimeoutMs` instead of clearing it. Callers should omit this.
|
|
177
|
+
*/
|
|
145
178
|
async unsubscribe(onResub = false) {
|
|
146
179
|
if (!onResub && this.resubOpts) {
|
|
147
180
|
this.resubOpts.resubTimeoutMs = undefined;
|
|
@@ -3,9 +3,24 @@ import { PublicKey } from '@solana/web3.js';
|
|
|
3
3
|
import { UserAccount } from '../types';
|
|
4
4
|
import { WebSocketUserAccountSubscriber } from './webSocketUserAccountSubscriber';
|
|
5
5
|
import { VelocityProgram } from '../config';
|
|
6
|
+
/**
|
|
7
|
+
* `UserAccountSubscriber` variant of `WebSocketUserAccountSubscriber` that tracks the
|
|
8
|
+
* `UserAccount` via a `grpcAccountSubscriber` (gRPC Geyser stream) instead of `connection.onAccountChange`.
|
|
9
|
+
*/
|
|
6
10
|
export declare class grpcUserAccountSubscriber extends WebSocketUserAccountSubscriber {
|
|
7
11
|
private grpcConfigs;
|
|
12
|
+
/**
|
|
13
|
+
* @param grpcConfigs gRPC Geyser endpoint/token/commitment config (Yellowstone or LaserStream).
|
|
14
|
+
* @param program Anchor program providing the connection and coder.
|
|
15
|
+
* @param userAccountPublicKey Address of the `UserAccount` to track.
|
|
16
|
+
* @param resubOpts Resubscription watchdog options passed to the underlying `grpcAccountSubscriber`.
|
|
17
|
+
*/
|
|
8
18
|
constructor(grpcConfigs: GrpcConfigs, program: VelocityProgram, userAccountPublicKey: PublicKey, resubOpts?: ResubOpts);
|
|
19
|
+
/**
|
|
20
|
+
* Creates the underlying `grpcAccountSubscriber` and subscribes it. Idempotent: a no-op
|
|
21
|
+
* (returns `true`) if already subscribed.
|
|
22
|
+
* @param userAccount Optional pre-fetched account data to seed the subscriber with, skipping the initial RPC fetch.
|
|
23
|
+
*/
|
|
9
24
|
subscribe(userAccount?: UserAccount): Promise<boolean>;
|
|
10
25
|
}
|
|
11
26
|
//# sourceMappingURL=grpcUserAccountSubscriber.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpcUserAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcUserAccountSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAElF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,qBAAa,yBAA0B,SAAQ,8BAA8B;IAC5E,OAAO,CAAC,WAAW,CAAc;
|
|
1
|
+
{"version":3,"file":"grpcUserAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcUserAccountSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAElF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C;;;GAGG;AACH,qBAAa,yBAA0B,SAAQ,8BAA8B;IAC5E,OAAO,CAAC,WAAW,CAAc;IAEjC;;;;;OAKG;gBAEF,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,eAAe,EACxB,oBAAoB,EAAE,SAAS,EAC/B,SAAS,CAAC,EAAE,SAAS;IAMtB;;;;OAIG;IACG,SAAS,CAAC,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;CA2B5D"}
|
|
@@ -3,11 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.grpcUserAccountSubscriber = void 0;
|
|
4
4
|
const webSocketUserAccountSubscriber_1 = require("./webSocketUserAccountSubscriber");
|
|
5
5
|
const grpcAccountSubscriber_1 = require("./grpcAccountSubscriber");
|
|
6
|
+
/**
|
|
7
|
+
* `UserAccountSubscriber` variant of `WebSocketUserAccountSubscriber` that tracks the
|
|
8
|
+
* `UserAccount` via a `grpcAccountSubscriber` (gRPC Geyser stream) instead of `connection.onAccountChange`.
|
|
9
|
+
*/
|
|
6
10
|
class grpcUserAccountSubscriber extends webSocketUserAccountSubscriber_1.WebSocketUserAccountSubscriber {
|
|
11
|
+
/**
|
|
12
|
+
* @param grpcConfigs gRPC Geyser endpoint/token/commitment config (Yellowstone or LaserStream).
|
|
13
|
+
* @param program Anchor program providing the connection and coder.
|
|
14
|
+
* @param userAccountPublicKey Address of the `UserAccount` to track.
|
|
15
|
+
* @param resubOpts Resubscription watchdog options passed to the underlying `grpcAccountSubscriber`.
|
|
16
|
+
*/
|
|
7
17
|
constructor(grpcConfigs, program, userAccountPublicKey, resubOpts) {
|
|
8
18
|
super(program, userAccountPublicKey, resubOpts);
|
|
9
19
|
this.grpcConfigs = grpcConfigs;
|
|
10
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates the underlying `grpcAccountSubscriber` and subscribes it. Idempotent: a no-op
|
|
23
|
+
* (returns `true`) if already subscribed.
|
|
24
|
+
* @param userAccount Optional pre-fetched account data to seed the subscriber with, skipping the initial RPC fetch.
|
|
25
|
+
*/
|
|
11
26
|
async subscribe(userAccount) {
|
|
12
27
|
if (this.isSubscribed) {
|
|
13
28
|
return true;
|
|
@@ -3,9 +3,24 @@ import { PublicKey } from '@solana/web3.js';
|
|
|
3
3
|
import { UserStatsAccount } from '../types';
|
|
4
4
|
import { WebSocketUserStatsAccountSubscriber } from './webSocketUserStatsAccountSubsriber';
|
|
5
5
|
import { VelocityProgram } from '../config';
|
|
6
|
+
/**
|
|
7
|
+
* `UserStatsAccountSubscriber` variant of `WebSocketUserStatsAccountSubscriber` that tracks the
|
|
8
|
+
* `UserStatsAccount` via a `grpcAccountSubscriber` (gRPC Geyser stream) instead of `connection.onAccountChange`.
|
|
9
|
+
*/
|
|
6
10
|
export declare class grpcUserStatsAccountSubscriber extends WebSocketUserStatsAccountSubscriber {
|
|
7
11
|
private grpcConfigs;
|
|
12
|
+
/**
|
|
13
|
+
* @param grpcConfigs gRPC Geyser endpoint/token/commitment config (Yellowstone or LaserStream).
|
|
14
|
+
* @param program Anchor program providing the connection and coder.
|
|
15
|
+
* @param userStatsAccountPublicKey Address of the `UserStatsAccount` to track.
|
|
16
|
+
* @param resubOpts Resubscription watchdog options passed to the underlying `grpcAccountSubscriber`.
|
|
17
|
+
*/
|
|
8
18
|
constructor(grpcConfigs: GrpcConfigs, program: VelocityProgram, userStatsAccountPublicKey: PublicKey, resubOpts?: ResubOpts);
|
|
19
|
+
/**
|
|
20
|
+
* Creates the underlying `grpcAccountSubscriber` and subscribes it. Idempotent: a no-op
|
|
21
|
+
* (returns `true`) if already subscribed.
|
|
22
|
+
* @param userStatsAccount Optional pre-fetched account data to seed the subscriber with, skipping the initial RPC fetch.
|
|
23
|
+
*/
|
|
9
24
|
subscribe(userStatsAccount?: UserStatsAccount): Promise<boolean>;
|
|
10
25
|
}
|
|
11
26
|
//# sourceMappingURL=grpcUserStatsAccountSubscriber.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpcUserStatsAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcUserStatsAccountSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,mCAAmC,EAAE,MAAM,sCAAsC,CAAC;AAE3F,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,qBAAa,8BAA+B,SAAQ,mCAAmC;IACtF,OAAO,CAAC,WAAW,CAAc;
|
|
1
|
+
{"version":3,"file":"grpcUserStatsAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcUserStatsAccountSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,mCAAmC,EAAE,MAAM,sCAAsC,CAAC;AAE3F,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C;;;GAGG;AACH,qBAAa,8BAA+B,SAAQ,mCAAmC;IACtF,OAAO,CAAC,WAAW,CAAc;IAEjC;;;;;OAKG;gBAEF,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,eAAe,EACxB,yBAAyB,EAAE,SAAS,EACpC,SAAS,CAAC,EAAE,SAAS;IAMtB;;;;OAIG;IACG,SAAS,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;CA6BtE"}
|
|
@@ -3,11 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.grpcUserStatsAccountSubscriber = void 0;
|
|
4
4
|
const webSocketUserStatsAccountSubsriber_1 = require("./webSocketUserStatsAccountSubsriber");
|
|
5
5
|
const grpcAccountSubscriber_1 = require("./grpcAccountSubscriber");
|
|
6
|
+
/**
|
|
7
|
+
* `UserStatsAccountSubscriber` variant of `WebSocketUserStatsAccountSubscriber` that tracks the
|
|
8
|
+
* `UserStatsAccount` via a `grpcAccountSubscriber` (gRPC Geyser stream) instead of `connection.onAccountChange`.
|
|
9
|
+
*/
|
|
6
10
|
class grpcUserStatsAccountSubscriber extends webSocketUserStatsAccountSubsriber_1.WebSocketUserStatsAccountSubscriber {
|
|
11
|
+
/**
|
|
12
|
+
* @param grpcConfigs gRPC Geyser endpoint/token/commitment config (Yellowstone or LaserStream).
|
|
13
|
+
* @param program Anchor program providing the connection and coder.
|
|
14
|
+
* @param userStatsAccountPublicKey Address of the `UserStatsAccount` to track.
|
|
15
|
+
* @param resubOpts Resubscription watchdog options passed to the underlying `grpcAccountSubscriber`.
|
|
16
|
+
*/
|
|
7
17
|
constructor(grpcConfigs, program, userStatsAccountPublicKey, resubOpts) {
|
|
8
18
|
super(program, userStatsAccountPublicKey, resubOpts);
|
|
9
19
|
this.grpcConfigs = grpcConfigs;
|
|
10
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates the underlying `grpcAccountSubscriber` and subscribes it. Idempotent: a no-op
|
|
23
|
+
* (returns `true`) if already subscribed.
|
|
24
|
+
* @param userStatsAccount Optional pre-fetched account data to seed the subscriber with, skipping the initial RPC fetch.
|
|
25
|
+
*/
|
|
11
26
|
async subscribe(userStatsAccount) {
|
|
12
27
|
if (this.isSubscribed) {
|
|
13
28
|
return true;
|