@velocity-exchange/sdk 0.1.0 → 0.2.1
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 +4 -32
- package/lib/browser/accounts/basicUserAccountSubscriber.d.ts +5 -3
- package/lib/browser/accounts/basicUserAccountSubscriber.js +4 -3
- package/lib/browser/accounts/basicUserStatsAccountSubscriber.d.ts +5 -3
- package/lib/browser/accounts/basicUserStatsAccountSubscriber.js +4 -3
- package/lib/browser/accounts/bulkAccountLoader.d.ts +5 -5
- package/lib/browser/accounts/bulkAccountLoader.js +12 -1
- package/lib/browser/accounts/grpcAccountSubscriber.d.ts +2 -1
- package/lib/browser/accounts/grpcAccountSubscriber.js +8 -2
- package/lib/browser/accounts/grpcMultiAccountSubscriber.d.ts +3 -2
- package/lib/browser/accounts/grpcMultiAccountSubscriber.js +13 -5
- package/lib/browser/accounts/grpcMultiUserAccountSubscriber.d.ts +2 -1
- package/lib/browser/accounts/grpcMultiUserAccountSubscriber.js +12 -8
- package/lib/browser/accounts/grpcProgramAccountSubscriber.d.ts +2 -1
- package/lib/browser/accounts/grpcProgramAccountSubscriber.js +8 -2
- package/lib/browser/accounts/grpcVelocityClientAccountSubscriber.js +18 -3
- package/lib/browser/accounts/grpcVelocityClientAccountSubscriberV2.d.ts +1 -1
- package/lib/browser/accounts/grpcVelocityClientAccountSubscriberV2.js +40 -17
- package/lib/browser/accounts/laserProgramAccountSubscriber.js +3 -0
- package/lib/browser/accounts/oneShotUserAccountSubscriber.js +4 -3
- package/lib/browser/accounts/oneShotUserStatsAccountSubscriber.js +7 -3
- package/lib/browser/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts +4 -2
- package/lib/browser/accounts/pollingInsuranceFundStakeAccountSubscriber.js +3 -3
- package/lib/browser/accounts/pollingOracleAccountSubscriber.d.ts +0 -2
- package/lib/browser/accounts/pollingOracleAccountSubscriber.js +16 -5
- package/lib/browser/accounts/pollingTokenAccountSubscriber.d.ts +0 -2
- package/lib/browser/accounts/pollingTokenAccountSubscriber.js +16 -5
- package/lib/browser/accounts/pollingUserAccountSubscriber.d.ts +8 -4
- package/lib/browser/accounts/pollingUserAccountSubscriber.js +17 -11
- package/lib/browser/accounts/pollingUserStatsAccountSubscriber.d.ts +4 -2
- package/lib/browser/accounts/pollingUserStatsAccountSubscriber.js +6 -6
- package/lib/browser/accounts/pollingVelocityClientAccountSubscriber.d.ts +7 -1
- package/lib/browser/accounts/pollingVelocityClientAccountSubscriber.js +64 -28
- package/lib/browser/accounts/types.d.ts +4 -4
- package/lib/browser/accounts/utils.d.ts +1 -0
- package/lib/browser/accounts/utils.js +8 -1
- package/lib/browser/accounts/webSocketAccountSubscriber.d.ts +4 -2
- package/lib/browser/accounts/webSocketAccountSubscriber.js +17 -5
- package/lib/browser/accounts/webSocketAccountSubscriberV2.d.ts +4 -2
- package/lib/browser/accounts/webSocketAccountSubscriberV2.js +17 -6
- package/lib/browser/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +4 -2
- package/lib/browser/accounts/webSocketInsuranceFundStakeAccountSubscriber.js +9 -0
- package/lib/browser/accounts/webSocketProgramAccountSubscriber.d.ts +3 -1
- package/lib/browser/accounts/webSocketProgramAccountSubscriber.js +14 -3
- package/lib/browser/accounts/webSocketProgramAccountSubscriberV2.d.ts +3 -1
- package/lib/browser/accounts/webSocketProgramAccountSubscriberV2.js +15 -3
- package/lib/browser/accounts/webSocketProgramAccountsSubscriberV2.d.ts +3 -1
- package/lib/browser/accounts/webSocketProgramAccountsSubscriberV2.js +14 -4
- package/lib/browser/accounts/webSocketUserAccountSubscriber.d.ts +4 -2
- package/lib/browser/accounts/webSocketUserAccountSubscriber.js +9 -0
- package/lib/browser/accounts/webSocketUserStatsAccountSubsriber.d.ts +4 -2
- package/lib/browser/accounts/webSocketUserStatsAccountSubsriber.js +9 -0
- package/lib/browser/accounts/webSocketVelocityClientAccountSubscriber.d.ts +4 -4
- package/lib/browser/accounts/webSocketVelocityClientAccountSubscriber.js +48 -20
- package/lib/browser/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts +7 -3
- package/lib/browser/accounts/webSocketVelocityClientAccountSubscriberV2.js +45 -14
- package/lib/browser/accounts/websocketProgramUserAccountSubscriber.d.ts +1 -1
- package/lib/browser/accounts/websocketProgramUserAccountSubscriber.js +0 -3
- package/lib/browser/addresses/marketAddresses.js +3 -2
- package/lib/browser/addresses/pda.d.ts +0 -2
- package/lib/browser/addresses/pda.js +1 -14
- package/lib/browser/adminClient.d.ts +24 -29
- package/lib/browser/adminClient.js +156 -157
- package/lib/browser/auctionSubscriber/auctionSubscriber.d.ts +1 -1
- package/lib/browser/auctionSubscriber/auctionSubscriber.js +6 -4
- package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.d.ts +1 -1
- package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.js +9 -4
- package/lib/browser/bankrun/bankrunConnection.d.ts +8 -5
- package/lib/browser/bankrun/bankrunConnection.js +92 -32
- package/lib/browser/blockhashSubscriber/BlockhashSubscriber.d.ts +1 -1
- package/lib/browser/blockhashSubscriber/BlockhashSubscriber.js +3 -2
- package/lib/browser/clock/clockSubscriber.d.ts +6 -6
- package/lib/browser/clock/clockSubscriber.js +4 -3
- package/lib/browser/config.d.ts +1 -1
- package/lib/browser/config.js +8 -4
- package/lib/browser/constants/index.d.ts +1 -2
- package/lib/browser/constants/index.js +1 -2
- package/lib/browser/constants/numericConstants.d.ts +1 -2
- package/lib/browser/constants/numericConstants.js +7 -5
- package/lib/browser/constants/spotMarkets.d.ts +0 -1
- package/lib/browser/constituentMap/constituentMap.js +5 -1
- package/lib/browser/constituentMap/pollingConstituentAccountSubscriber.js +3 -2
- package/lib/browser/constituentMap/webSocketConstituentAccountSubscriber.d.ts +2 -3
- package/lib/browser/constituentMap/webSocketConstituentAccountSubscriber.js +10 -3
- package/lib/browser/core/VelocityCore.d.ts +0 -1
- package/lib/browser/core/instructions/deposit.d.ts +0 -1
- package/lib/browser/core/instructions/perpOrders.d.ts +14 -0
- package/lib/browser/core/instructions/perpOrders.js +14 -0
- package/lib/browser/core/instructions/withdraw.d.ts +0 -1
- package/lib/browser/core/remainingAccounts.d.ts +2 -2
- package/lib/browser/core/remainingAccounts.js +2 -2
- package/lib/browser/decode/user.js +9 -1
- package/lib/browser/dlob/DLOB.d.ts +6 -2
- package/lib/browser/dlob/DLOB.js +201 -138
- package/lib/browser/dlob/DLOBNode.d.ts +5 -3
- package/lib/browser/dlob/DLOBNode.js +7 -0
- package/lib/browser/dlob/DLOBSubscriber.d.ts +0 -1
- package/lib/browser/dlob/DLOBSubscriber.js +37 -32
- package/lib/browser/dlob/NodeList.d.ts +0 -1
- package/lib/browser/dlob/NodeList.js +8 -7
- package/lib/browser/dlob/orderBookLevels.d.ts +0 -1
- package/lib/browser/dlob/orderBookLevels.js +19 -12
- package/lib/browser/events/eventList.d.ts +3 -3
- package/lib/browser/events/eventList.js +4 -1
- package/lib/browser/events/eventSubscriber.d.ts +5 -2
- package/lib/browser/events/eventSubscriber.js +75 -26
- package/lib/browser/events/eventsServerLogProvider.d.ts +2 -2
- package/lib/browser/events/eventsServerLogProvider.js +15 -8
- package/lib/browser/events/fetchLogs.d.ts +1 -1
- package/lib/browser/events/fetchLogs.js +4 -2
- package/lib/browser/events/pollingLogProvider.d.ts +2 -2
- package/lib/browser/events/pollingLogProvider.js +1 -0
- package/lib/browser/events/txEventCache.d.ts +3 -3
- package/lib/browser/events/txEventCache.js +6 -2
- package/lib/browser/events/types.d.ts +2 -4
- package/lib/browser/events/types.js +0 -2
- package/lib/browser/events/webSocketLogProvider.d.ts +2 -2
- package/lib/browser/events/webSocketLogProvider.js +5 -2
- package/lib/browser/factory/bigNum.d.ts +0 -1
- package/lib/browser/factory/bigNum.js +1 -1
- package/lib/browser/idl/velocity.d.ts +1243 -1586
- package/lib/browser/idl/velocity.json +1234 -1577
- package/lib/browser/index.d.ts +0 -2
- package/lib/browser/index.js +0 -2
- package/lib/browser/indicative-quotes/indicativeQuotesSender.d.ts +0 -1
- package/lib/browser/jupiter/jupiterClient.d.ts +1 -2
- package/lib/browser/jupiter/jupiterClient.js +18 -8
- package/lib/browser/marginCalculation.d.ts +0 -1
- package/lib/browser/marginCalculation.js +1 -0
- package/lib/browser/marinade/index.d.ts +2 -3
- package/lib/browser/marinade/index.js +5 -0
- package/lib/browser/math/amm.d.ts +31 -14
- package/lib/browser/math/amm.js +77 -22
- package/lib/browser/math/auction.d.ts +0 -1
- package/lib/browser/math/bankruptcy.js +1 -1
- package/lib/browser/math/conversion.d.ts +0 -1
- package/lib/browser/math/funding.d.ts +0 -1
- package/lib/browser/math/funding.js +6 -6
- package/lib/browser/math/insurance.d.ts +1 -2
- package/lib/browser/math/insurance.js +4 -5
- package/lib/browser/math/liquidation.d.ts +0 -1
- package/lib/browser/math/margin.d.ts +1 -10
- package/lib/browser/math/margin.js +3 -62
- package/lib/browser/math/market.d.ts +4 -13
- package/lib/browser/math/market.js +6 -40
- package/lib/browser/math/oracles.d.ts +0 -4
- package/lib/browser/math/oracles.js +1 -14
- package/lib/browser/math/orders.d.ts +0 -6
- package/lib/browser/math/orders.js +2 -74
- package/lib/browser/math/position.d.ts +1 -6
- package/lib/browser/math/position.js +5 -10
- package/lib/browser/math/repeg.d.ts +0 -2
- package/lib/browser/math/repeg.js +1 -23
- package/lib/browser/math/spotBalance.d.ts +4 -5
- package/lib/browser/math/spotBalance.js +6 -6
- package/lib/browser/math/spotMarket.d.ts +0 -7
- package/lib/browser/math/spotMarket.js +1 -16
- package/lib/browser/math/spotPosition.d.ts +4 -5
- package/lib/browser/math/state.d.ts +0 -3
- package/lib/browser/math/state.js +1 -9
- package/lib/browser/math/superStake.d.ts +3 -54
- package/lib/browser/math/superStake.js +16 -13
- package/lib/browser/math/trade.d.ts +2 -3
- package/lib/browser/math/trade.js +6 -6
- package/lib/browser/math/utils.d.ts +0 -1
- package/lib/browser/memcmp.d.ts +0 -1
- package/lib/browser/memcmp.js +1 -10
- package/lib/browser/oracles/oracleClientCache.d.ts +1 -1
- package/lib/browser/oracles/prelaunchOracleClient.js +3 -2
- package/lib/browser/oracles/pythClient.d.ts +0 -1
- package/lib/browser/oracles/pythClient.js +9 -3
- package/lib/browser/oracles/pythLazerClient.d.ts +0 -1
- package/lib/browser/oracles/pythLazerClient.js +3 -2
- package/lib/browser/oracles/strictOraclePrice.d.ts +0 -1
- package/lib/browser/oracles/types.d.ts +0 -1
- package/lib/browser/oracles/utils.d.ts +4 -1
- package/lib/browser/oracles/utils.js +9 -1
- package/lib/browser/orderParams.d.ts +0 -1
- package/lib/browser/orderSubscriber/OrderSubscriber.d.ts +1 -1
- package/lib/browser/orderSubscriber/OrderSubscriber.js +8 -2
- package/lib/browser/priorityFee/heliusPriorityFeeMethod.d.ts +1 -1
- package/lib/browser/priorityFee/priorityFeeSubscriber.d.ts +1 -1
- package/lib/browser/priorityFee/priorityFeeSubscriber.js +32 -8
- package/lib/browser/priorityFee/solanaPriorityFeeMethod.d.ts +1 -1
- package/lib/browser/pyth/types.d.ts +0 -1
- package/lib/browser/slot/SlotSubscriber.d.ts +1 -1
- package/lib/browser/slot/SlotSubscriber.js +2 -1
- package/lib/browser/slot/SlothashSubscriber.d.ts +3 -2
- package/lib/browser/slot/SlothashSubscriber.js +11 -4
- package/lib/browser/swap/UnifiedSwapClient.d.ts +0 -1
- package/lib/browser/swift/grpcSignedMsgUserAccountSubscriber.d.ts +0 -3
- package/lib/browser/swift/grpcSignedMsgUserAccountSubscriber.js +5 -5
- package/lib/browser/swift/signedMsgUserAccountSubscriber.d.ts +3 -2
- package/lib/browser/swift/signedMsgUserAccountSubscriber.js +13 -5
- package/lib/browser/swift/swiftOrderSubscriber.d.ts +1 -1
- package/lib/browser/swift/swiftOrderSubscriber.js +10 -5
- package/lib/browser/testClient.js +3 -2
- package/lib/browser/titan/titanClient.d.ts +0 -1
- package/lib/browser/tokenFaucet.d.ts +0 -1
- package/lib/browser/tokenFaucet.js +16 -2
- package/lib/browser/tx/baseTxSender.d.ts +4 -4
- package/lib/browser/tx/baseTxSender.js +5 -4
- package/lib/browser/tx/fastSingleTxSender.d.ts +3 -3
- package/lib/browser/tx/fastSingleTxSender.js +9 -5
- package/lib/browser/tx/reportTransactionError.d.ts +2 -2
- package/lib/browser/tx/reportTransactionError.js +5 -1
- package/lib/browser/tx/retryTxSender.d.ts +1 -1
- package/lib/browser/tx/retryTxSender.js +4 -2
- package/lib/browser/tx/txHandler.d.ts +9 -3
- package/lib/browser/tx/txHandler.js +54 -40
- package/lib/browser/tx/txParamProcessor.d.ts +4 -1
- package/lib/browser/tx/txParamProcessor.js +6 -0
- package/lib/browser/tx/types.d.ts +1 -1
- package/lib/browser/tx/whileValidTxSender.d.ts +1 -6
- package/lib/browser/tx/whileValidTxSender.js +35 -13
- package/lib/browser/types.d.ts +25 -69
- package/lib/browser/types.js +2 -2
- package/lib/browser/user.d.ts +21 -8
- package/lib/browser/user.js +156 -132
- package/lib/browser/userMap/WebsocketSubscription.d.ts +1 -1
- package/lib/browser/userMap/grpcSubscription.d.ts +1 -1
- package/lib/browser/userMap/referrerMap.js +10 -3
- package/lib/browser/userMap/revenueShareEscrowMap.js +4 -0
- package/lib/browser/userMap/userMap.d.ts +1 -1
- package/lib/browser/userMap/userMap.js +36 -23
- package/lib/browser/userMap/userStatsMap.d.ts +1 -1
- package/lib/browser/userMap/userStatsMap.js +18 -13
- package/lib/browser/userStats.d.ts +7 -2
- package/lib/browser/userStats.js +18 -4
- package/lib/browser/util/TransactionConfirmationManager.js +4 -2
- package/lib/browser/util/chainClock.d.ts +1 -1
- package/lib/browser/util/computeUnits.d.ts +1 -1
- package/lib/browser/util/computeUnits.js +6 -1
- package/lib/browser/velocityClient.d.ts +93 -36
- package/lib/browser/velocityClient.js +414 -280
- package/lib/node/accounts/basicUserAccountSubscriber.d.ts +5 -3
- package/lib/node/accounts/basicUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/basicUserAccountSubscriber.js +4 -3
- package/lib/node/accounts/basicUserStatsAccountSubscriber.d.ts +5 -3
- package/lib/node/accounts/basicUserStatsAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/basicUserStatsAccountSubscriber.js +4 -3
- package/lib/node/accounts/bulkAccountLoader.d.ts +5 -5
- package/lib/node/accounts/bulkAccountLoader.d.ts.map +1 -1
- package/lib/node/accounts/bulkAccountLoader.js +12 -1
- package/lib/node/accounts/grpcAccountSubscriber.d.ts +2 -1
- package/lib/node/accounts/grpcAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcAccountSubscriber.js +8 -2
- package/lib/node/accounts/grpcMultiAccountSubscriber.d.ts +3 -2
- package/lib/node/accounts/grpcMultiAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcMultiAccountSubscriber.js +13 -5
- package/lib/node/accounts/grpcMultiUserAccountSubscriber.d.ts +2 -1
- package/lib/node/accounts/grpcMultiUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcMultiUserAccountSubscriber.js +12 -8
- package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts +2 -1
- package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcProgramAccountSubscriber.js +8 -2
- package/lib/node/accounts/grpcVelocityClientAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcVelocityClientAccountSubscriber.js +18 -3
- package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.d.ts +1 -1
- package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.js +40 -17
- package/lib/node/accounts/laserProgramAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/laserProgramAccountSubscriber.js +3 -0
- package/lib/node/accounts/oneShotUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/oneShotUserAccountSubscriber.js +4 -3
- package/lib/node/accounts/oneShotUserStatsAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/oneShotUserStatsAccountSubscriber.js +7 -3
- package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts +4 -2
- package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.js +3 -3
- package/lib/node/accounts/pollingOracleAccountSubscriber.d.ts +0 -2
- package/lib/node/accounts/pollingOracleAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingOracleAccountSubscriber.js +16 -5
- package/lib/node/accounts/pollingTokenAccountSubscriber.d.ts +0 -2
- package/lib/node/accounts/pollingTokenAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingTokenAccountSubscriber.js +16 -5
- package/lib/node/accounts/pollingUserAccountSubscriber.d.ts +8 -4
- package/lib/node/accounts/pollingUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingUserAccountSubscriber.js +17 -11
- package/lib/node/accounts/pollingUserStatsAccountSubscriber.d.ts +4 -2
- package/lib/node/accounts/pollingUserStatsAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingUserStatsAccountSubscriber.js +6 -6
- package/lib/node/accounts/pollingVelocityClientAccountSubscriber.d.ts +7 -1
- package/lib/node/accounts/pollingVelocityClientAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingVelocityClientAccountSubscriber.js +64 -28
- package/lib/node/accounts/types.d.ts +4 -4
- package/lib/node/accounts/types.d.ts.map +1 -1
- package/lib/node/accounts/utils.d.ts +1 -0
- package/lib/node/accounts/utils.d.ts.map +1 -1
- package/lib/node/accounts/utils.js +8 -1
- package/lib/node/accounts/webSocketAccountSubscriber.d.ts +4 -2
- package/lib/node/accounts/webSocketAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketAccountSubscriber.js +17 -5
- package/lib/node/accounts/webSocketAccountSubscriberV2.d.ts +4 -2
- package/lib/node/accounts/webSocketAccountSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/webSocketAccountSubscriberV2.js +17 -6
- package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +4 -2
- package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.js +9 -0
- package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts +3 -1
- package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketProgramAccountSubscriber.js +14 -3
- package/lib/node/accounts/webSocketProgramAccountSubscriberV2.d.ts +3 -1
- package/lib/node/accounts/webSocketProgramAccountSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/webSocketProgramAccountSubscriberV2.js +15 -3
- package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.d.ts +3 -1
- package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.js +14 -4
- package/lib/node/accounts/webSocketUserAccountSubscriber.d.ts +4 -2
- package/lib/node/accounts/webSocketUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketUserAccountSubscriber.js +9 -0
- package/lib/node/accounts/webSocketUserStatsAccountSubsriber.d.ts +4 -2
- package/lib/node/accounts/webSocketUserStatsAccountSubsriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketUserStatsAccountSubsriber.js +9 -0
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.d.ts +4 -4
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.js +48 -20
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts +7 -3
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.js +45 -14
- package/lib/node/accounts/websocketProgramUserAccountSubscriber.d.ts +1 -1
- package/lib/node/accounts/websocketProgramUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/websocketProgramUserAccountSubscriber.js +0 -3
- package/lib/node/addresses/marketAddresses.d.ts.map +1 -1
- package/lib/node/addresses/marketAddresses.js +3 -2
- package/lib/node/addresses/pda.d.ts +0 -2
- package/lib/node/addresses/pda.d.ts.map +1 -1
- package/lib/node/addresses/pda.js +1 -14
- package/lib/node/adminClient.d.ts +24 -29
- package/lib/node/adminClient.d.ts.map +1 -1
- package/lib/node/adminClient.js +156 -157
- package/lib/node/auctionSubscriber/auctionSubscriber.d.ts +1 -1
- package/lib/node/auctionSubscriber/auctionSubscriber.d.ts.map +1 -1
- package/lib/node/auctionSubscriber/auctionSubscriber.js +6 -4
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts +1 -1
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts.map +1 -1
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.js +9 -4
- package/lib/node/bankrun/bankrunConnection.d.ts +8 -5
- package/lib/node/bankrun/bankrunConnection.d.ts.map +1 -1
- package/lib/node/bankrun/bankrunConnection.js +92 -32
- package/lib/node/blockhashSubscriber/BlockhashSubscriber.d.ts +1 -1
- package/lib/node/blockhashSubscriber/BlockhashSubscriber.d.ts.map +1 -1
- package/lib/node/blockhashSubscriber/BlockhashSubscriber.js +3 -2
- package/lib/node/clock/clockSubscriber.d.ts +6 -6
- package/lib/node/clock/clockSubscriber.d.ts.map +1 -1
- package/lib/node/clock/clockSubscriber.js +4 -3
- package/lib/node/config.d.ts +1 -1
- package/lib/node/config.d.ts.map +1 -1
- package/lib/node/config.js +8 -4
- package/lib/node/constants/index.d.ts +1 -2
- package/lib/node/constants/index.d.ts.map +1 -1
- package/lib/node/constants/index.js +1 -2
- package/lib/node/constants/numericConstants.d.ts +1 -2
- package/lib/node/constants/numericConstants.d.ts.map +1 -1
- package/lib/node/constants/numericConstants.js +7 -5
- package/lib/node/constants/spotMarkets.d.ts +0 -1
- package/lib/node/constants/spotMarkets.d.ts.map +1 -1
- package/lib/node/constituentMap/constituentMap.d.ts.map +1 -1
- package/lib/node/constituentMap/constituentMap.js +5 -1
- package/lib/node/constituentMap/pollingConstituentAccountSubscriber.d.ts.map +1 -1
- package/lib/node/constituentMap/pollingConstituentAccountSubscriber.js +3 -2
- package/lib/node/constituentMap/webSocketConstituentAccountSubscriber.d.ts +2 -3
- package/lib/node/constituentMap/webSocketConstituentAccountSubscriber.d.ts.map +1 -1
- package/lib/node/constituentMap/webSocketConstituentAccountSubscriber.js +10 -3
- package/lib/node/core/VelocityCore.d.ts +0 -1
- package/lib/node/core/VelocityCore.d.ts.map +1 -1
- package/lib/node/core/instructions/deposit.d.ts +0 -1
- package/lib/node/core/instructions/deposit.d.ts.map +1 -1
- package/lib/node/core/instructions/perpOrders.d.ts +14 -0
- package/lib/node/core/instructions/perpOrders.d.ts.map +1 -1
- package/lib/node/core/instructions/perpOrders.js +14 -0
- package/lib/node/core/instructions/withdraw.d.ts +0 -1
- package/lib/node/core/instructions/withdraw.d.ts.map +1 -1
- package/lib/node/core/remainingAccounts.d.ts +2 -2
- package/lib/node/core/remainingAccounts.d.ts.map +1 -1
- package/lib/node/core/remainingAccounts.js +2 -2
- package/lib/node/decode/user.d.ts.map +1 -1
- package/lib/node/decode/user.js +9 -1
- package/lib/node/dlob/DLOB.d.ts +6 -2
- package/lib/node/dlob/DLOB.d.ts.map +1 -1
- package/lib/node/dlob/DLOB.js +201 -138
- package/lib/node/dlob/DLOBNode.d.ts +5 -3
- package/lib/node/dlob/DLOBNode.d.ts.map +1 -1
- package/lib/node/dlob/DLOBNode.js +7 -0
- package/lib/node/dlob/DLOBSubscriber.d.ts +0 -1
- package/lib/node/dlob/DLOBSubscriber.d.ts.map +1 -1
- package/lib/node/dlob/DLOBSubscriber.js +37 -32
- package/lib/node/dlob/NodeList.d.ts +0 -1
- package/lib/node/dlob/NodeList.d.ts.map +1 -1
- package/lib/node/dlob/NodeList.js +8 -7
- package/lib/node/dlob/orderBookLevels.d.ts +0 -1
- package/lib/node/dlob/orderBookLevels.d.ts.map +1 -1
- package/lib/node/dlob/orderBookLevels.js +19 -12
- package/lib/node/events/eventList.d.ts +3 -3
- package/lib/node/events/eventList.d.ts.map +1 -1
- package/lib/node/events/eventList.js +4 -1
- package/lib/node/events/eventSubscriber.d.ts +5 -2
- package/lib/node/events/eventSubscriber.d.ts.map +1 -1
- package/lib/node/events/eventSubscriber.js +75 -26
- package/lib/node/events/eventsServerLogProvider.d.ts +2 -2
- package/lib/node/events/eventsServerLogProvider.d.ts.map +1 -1
- package/lib/node/events/eventsServerLogProvider.js +15 -8
- package/lib/node/events/fetchLogs.d.ts +1 -1
- package/lib/node/events/fetchLogs.d.ts.map +1 -1
- package/lib/node/events/fetchLogs.js +4 -2
- package/lib/node/events/pollingLogProvider.d.ts +2 -2
- package/lib/node/events/pollingLogProvider.d.ts.map +1 -1
- package/lib/node/events/pollingLogProvider.js +1 -0
- package/lib/node/events/txEventCache.d.ts +3 -3
- package/lib/node/events/txEventCache.d.ts.map +1 -1
- package/lib/node/events/txEventCache.js +6 -2
- package/lib/node/events/types.d.ts +2 -4
- package/lib/node/events/types.d.ts.map +1 -1
- package/lib/node/events/types.js +0 -2
- package/lib/node/events/webSocketLogProvider.d.ts +2 -2
- package/lib/node/events/webSocketLogProvider.d.ts.map +1 -1
- package/lib/node/events/webSocketLogProvider.js +5 -2
- package/lib/node/factory/bigNum.d.ts +0 -1
- package/lib/node/factory/bigNum.d.ts.map +1 -1
- package/lib/node/factory/bigNum.js +1 -1
- package/lib/node/idl/velocity.d.ts +1243 -1586
- package/lib/node/idl/velocity.d.ts.map +1 -1
- package/lib/node/idl/velocity.json +1234 -1577
- package/lib/node/index.d.ts +0 -2
- package/lib/node/index.d.ts.map +1 -1
- package/lib/node/index.js +0 -2
- package/lib/node/indicative-quotes/indicativeQuotesSender.d.ts +0 -1
- package/lib/node/indicative-quotes/indicativeQuotesSender.d.ts.map +1 -1
- package/lib/node/jupiter/jupiterClient.d.ts +1 -2
- package/lib/node/jupiter/jupiterClient.d.ts.map +1 -1
- package/lib/node/jupiter/jupiterClient.js +18 -8
- package/lib/node/marginCalculation.d.ts +0 -1
- package/lib/node/marginCalculation.d.ts.map +1 -1
- package/lib/node/marginCalculation.js +1 -0
- package/lib/node/marinade/index.d.ts +2 -3
- package/lib/node/marinade/index.d.ts.map +1 -1
- package/lib/node/marinade/index.js +5 -0
- package/lib/node/math/amm.d.ts +31 -14
- package/lib/node/math/amm.d.ts.map +1 -1
- package/lib/node/math/amm.js +77 -22
- package/lib/node/math/auction.d.ts +0 -1
- package/lib/node/math/auction.d.ts.map +1 -1
- package/lib/node/math/bankruptcy.js +1 -1
- package/lib/node/math/conversion.d.ts +0 -1
- package/lib/node/math/conversion.d.ts.map +1 -1
- package/lib/node/math/funding.d.ts +0 -1
- package/lib/node/math/funding.d.ts.map +1 -1
- package/lib/node/math/funding.js +6 -6
- package/lib/node/math/insurance.d.ts +1 -2
- package/lib/node/math/insurance.d.ts.map +1 -1
- package/lib/node/math/insurance.js +4 -5
- package/lib/node/math/liquidation.d.ts +0 -1
- package/lib/node/math/liquidation.d.ts.map +1 -1
- package/lib/node/math/margin.d.ts +1 -10
- package/lib/node/math/margin.d.ts.map +1 -1
- package/lib/node/math/margin.js +3 -62
- package/lib/node/math/market.d.ts +4 -13
- package/lib/node/math/market.d.ts.map +1 -1
- package/lib/node/math/market.js +6 -40
- package/lib/node/math/oracles.d.ts +0 -4
- package/lib/node/math/oracles.d.ts.map +1 -1
- package/lib/node/math/oracles.js +1 -14
- package/lib/node/math/orders.d.ts +0 -6
- package/lib/node/math/orders.d.ts.map +1 -1
- package/lib/node/math/orders.js +2 -74
- package/lib/node/math/position.d.ts +1 -6
- package/lib/node/math/position.d.ts.map +1 -1
- package/lib/node/math/position.js +5 -10
- package/lib/node/math/repeg.d.ts +0 -2
- package/lib/node/math/repeg.d.ts.map +1 -1
- package/lib/node/math/repeg.js +1 -23
- package/lib/node/math/spotBalance.d.ts +4 -5
- package/lib/node/math/spotBalance.d.ts.map +1 -1
- package/lib/node/math/spotBalance.js +6 -6
- package/lib/node/math/spotMarket.d.ts +0 -7
- package/lib/node/math/spotMarket.d.ts.map +1 -1
- package/lib/node/math/spotMarket.js +1 -16
- package/lib/node/math/spotPosition.d.ts +4 -5
- package/lib/node/math/spotPosition.d.ts.map +1 -1
- package/lib/node/math/state.d.ts +0 -3
- package/lib/node/math/state.d.ts.map +1 -1
- package/lib/node/math/state.js +1 -9
- package/lib/node/math/superStake.d.ts +3 -54
- package/lib/node/math/superStake.d.ts.map +1 -1
- package/lib/node/math/superStake.js +16 -13
- package/lib/node/math/trade.d.ts +2 -3
- package/lib/node/math/trade.d.ts.map +1 -1
- package/lib/node/math/trade.js +6 -6
- package/lib/node/math/utils.d.ts +0 -1
- package/lib/node/math/utils.d.ts.map +1 -1
- package/lib/node/memcmp.d.ts +0 -1
- package/lib/node/memcmp.d.ts.map +1 -1
- package/lib/node/memcmp.js +1 -10
- package/lib/node/oracles/oracleClientCache.d.ts +1 -1
- package/lib/node/oracles/prelaunchOracleClient.d.ts.map +1 -1
- package/lib/node/oracles/prelaunchOracleClient.js +3 -2
- package/lib/node/oracles/pythClient.d.ts +0 -1
- package/lib/node/oracles/pythClient.d.ts.map +1 -1
- package/lib/node/oracles/pythClient.js +9 -3
- package/lib/node/oracles/pythLazerClient.d.ts +0 -1
- package/lib/node/oracles/pythLazerClient.d.ts.map +1 -1
- package/lib/node/oracles/pythLazerClient.js +3 -2
- package/lib/node/oracles/strictOraclePrice.d.ts +0 -1
- package/lib/node/oracles/strictOraclePrice.d.ts.map +1 -1
- package/lib/node/oracles/types.d.ts +0 -1
- package/lib/node/oracles/types.d.ts.map +1 -1
- package/lib/node/oracles/utils.d.ts +4 -1
- package/lib/node/oracles/utils.d.ts.map +1 -1
- package/lib/node/oracles/utils.js +9 -1
- package/lib/node/orderParams.d.ts +0 -1
- package/lib/node/orderParams.d.ts.map +1 -1
- package/lib/node/orderSubscriber/OrderSubscriber.d.ts +1 -1
- package/lib/node/orderSubscriber/OrderSubscriber.d.ts.map +1 -1
- package/lib/node/orderSubscriber/OrderSubscriber.js +8 -2
- package/lib/node/priorityFee/heliusPriorityFeeMethod.d.ts +1 -1
- package/lib/node/priorityFee/heliusPriorityFeeMethod.d.ts.map +1 -1
- package/lib/node/priorityFee/priorityFeeSubscriber.d.ts +1 -1
- package/lib/node/priorityFee/priorityFeeSubscriber.d.ts.map +1 -1
- package/lib/node/priorityFee/priorityFeeSubscriber.js +32 -8
- package/lib/node/priorityFee/solanaPriorityFeeMethod.d.ts +1 -1
- package/lib/node/priorityFee/solanaPriorityFeeMethod.d.ts.map +1 -1
- package/lib/node/pyth/types.d.ts +0 -1
- package/lib/node/pyth/types.d.ts.map +1 -1
- package/lib/node/slot/SlotSubscriber.d.ts +1 -1
- package/lib/node/slot/SlotSubscriber.d.ts.map +1 -1
- package/lib/node/slot/SlotSubscriber.js +2 -1
- package/lib/node/slot/SlothashSubscriber.d.ts +3 -2
- package/lib/node/slot/SlothashSubscriber.d.ts.map +1 -1
- package/lib/node/slot/SlothashSubscriber.js +11 -4
- package/lib/node/swap/UnifiedSwapClient.d.ts +0 -1
- package/lib/node/swap/UnifiedSwapClient.d.ts.map +1 -1
- package/lib/node/swift/grpcSignedMsgUserAccountSubscriber.d.ts +0 -3
- package/lib/node/swift/grpcSignedMsgUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/swift/grpcSignedMsgUserAccountSubscriber.js +5 -5
- package/lib/node/swift/signedMsgUserAccountSubscriber.d.ts +3 -2
- package/lib/node/swift/signedMsgUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/swift/signedMsgUserAccountSubscriber.js +13 -5
- package/lib/node/swift/swiftOrderSubscriber.d.ts +1 -1
- package/lib/node/swift/swiftOrderSubscriber.d.ts.map +1 -1
- package/lib/node/swift/swiftOrderSubscriber.js +10 -5
- package/lib/node/testClient.js +3 -2
- package/lib/node/titan/titanClient.d.ts +0 -1
- package/lib/node/titan/titanClient.d.ts.map +1 -1
- package/lib/node/tokenFaucet.d.ts +0 -1
- package/lib/node/tokenFaucet.d.ts.map +1 -1
- package/lib/node/tokenFaucet.js +16 -2
- package/lib/node/tx/baseTxSender.d.ts +4 -4
- package/lib/node/tx/baseTxSender.d.ts.map +1 -1
- package/lib/node/tx/baseTxSender.js +5 -4
- package/lib/node/tx/fastSingleTxSender.d.ts +3 -3
- package/lib/node/tx/fastSingleTxSender.d.ts.map +1 -1
- package/lib/node/tx/fastSingleTxSender.js +9 -5
- package/lib/node/tx/reportTransactionError.d.ts +2 -2
- package/lib/node/tx/reportTransactionError.d.ts.map +1 -1
- package/lib/node/tx/reportTransactionError.js +5 -1
- package/lib/node/tx/retryTxSender.d.ts +1 -1
- package/lib/node/tx/retryTxSender.d.ts.map +1 -1
- package/lib/node/tx/retryTxSender.js +4 -2
- package/lib/node/tx/txHandler.d.ts +9 -3
- package/lib/node/tx/txHandler.d.ts.map +1 -1
- package/lib/node/tx/txHandler.js +54 -40
- package/lib/node/tx/txParamProcessor.d.ts +4 -1
- package/lib/node/tx/txParamProcessor.d.ts.map +1 -1
- package/lib/node/tx/txParamProcessor.js +6 -0
- package/lib/node/tx/types.d.ts +1 -1
- package/lib/node/tx/types.d.ts.map +1 -1
- package/lib/node/tx/whileValidTxSender.d.ts +1 -6
- package/lib/node/tx/whileValidTxSender.d.ts.map +1 -1
- package/lib/node/tx/whileValidTxSender.js +35 -13
- package/lib/node/types.d.ts +25 -69
- package/lib/node/types.d.ts.map +1 -1
- package/lib/node/types.js +2 -2
- package/lib/node/user.d.ts +21 -8
- package/lib/node/user.d.ts.map +1 -1
- package/lib/node/user.js +156 -132
- package/lib/node/userMap/WebsocketSubscription.d.ts +1 -1
- package/lib/node/userMap/WebsocketSubscription.d.ts.map +1 -1
- package/lib/node/userMap/grpcSubscription.d.ts +1 -1
- package/lib/node/userMap/grpcSubscription.d.ts.map +1 -1
- package/lib/node/userMap/referrerMap.d.ts.map +1 -1
- package/lib/node/userMap/referrerMap.js +10 -3
- package/lib/node/userMap/revenueShareEscrowMap.d.ts.map +1 -1
- package/lib/node/userMap/revenueShareEscrowMap.js +4 -0
- package/lib/node/userMap/userMap.d.ts +1 -1
- package/lib/node/userMap/userMap.d.ts.map +1 -1
- package/lib/node/userMap/userMap.js +36 -23
- package/lib/node/userMap/userStatsMap.d.ts +1 -1
- package/lib/node/userMap/userStatsMap.d.ts.map +1 -1
- package/lib/node/userMap/userStatsMap.js +18 -13
- package/lib/node/userStats.d.ts +7 -2
- package/lib/node/userStats.d.ts.map +1 -1
- package/lib/node/userStats.js +18 -4
- package/lib/node/util/TransactionConfirmationManager.d.ts.map +1 -1
- package/lib/node/util/TransactionConfirmationManager.js +4 -2
- package/lib/node/util/chainClock.d.ts +1 -1
- package/lib/node/util/chainClock.d.ts.map +1 -1
- package/lib/node/util/computeUnits.d.ts +1 -1
- package/lib/node/util/computeUnits.d.ts.map +1 -1
- package/lib/node/util/computeUnits.js +6 -1
- package/lib/node/velocityClient.d.ts +93 -36
- package/lib/node/velocityClient.d.ts.map +1 -1
- package/lib/node/velocityClient.js +414 -280
- package/package.json +15 -8
- package/src/accounts/basicUserAccountSubscriber.ts +7 -5
- package/src/accounts/basicUserStatsAccountSubscriber.ts +9 -5
- package/src/accounts/bulkAccountLoader.ts +20 -7
- package/src/accounts/grpcAccountSubscriber.ts +11 -3
- package/src/accounts/grpcMultiAccountSubscriber.ts +24 -9
- package/src/accounts/grpcMultiUserAccountSubscriber.ts +16 -12
- package/src/accounts/grpcProgramAccountSubscriber.ts +11 -3
- package/src/accounts/grpcVelocityClientAccountSubscriber.ts +17 -7
- package/src/accounts/grpcVelocityClientAccountSubscriberV2.ts +66 -39
- package/src/accounts/laserProgramAccountSubscriber.ts +3 -0
- package/src/accounts/oneShotUserAccountSubscriber.ts +5 -3
- package/src/accounts/oneShotUserStatsAccountSubscriber.ts +8 -3
- package/src/accounts/pollingInsuranceFundStakeAccountSubscriber.ts +11 -5
- package/src/accounts/pollingOracleAccountSubscriber.ts +17 -10
- package/src/accounts/pollingTokenAccountSubscriber.ts +17 -10
- package/src/accounts/pollingUserAccountSubscriber.ts +26 -20
- package/src/accounts/pollingUserStatsAccountSubscriber.ts +12 -10
- package/src/accounts/pollingVelocityClientAccountSubscriber.ts +76 -30
- package/src/accounts/types.ts +6 -4
- package/src/accounts/utils.ts +10 -0
- package/src/accounts/webSocketAccountSubscriber.ts +23 -10
- package/src/accounts/webSocketAccountSubscriberV2.ts +23 -8
- package/src/accounts/webSocketInsuranceFundStakeAccountSubscriber.ts +17 -2
- package/src/accounts/webSocketProgramAccountSubscriber.ts +29 -4
- package/src/accounts/webSocketProgramAccountSubscriberV2.ts +30 -4
- package/src/accounts/webSocketProgramAccountsSubscriberV2.ts +29 -4
- package/src/accounts/webSocketUserAccountSubscriber.ts +11 -2
- package/src/accounts/webSocketUserStatsAccountSubsriber.ts +15 -2
- package/src/accounts/webSocketVelocityClientAccountSubscriber.ts +76 -48
- package/src/accounts/webSocketVelocityClientAccountSubscriberV2.ts +74 -35
- package/src/accounts/websocketProgramUserAccountSubscriber.ts +1 -6
- package/src/addresses/marketAddresses.ts +3 -2
- package/src/addresses/pda.ts +0 -25
- package/src/adminClient.ts +273 -303
- package/src/auctionSubscriber/auctionSubscriber.ts +7 -5
- package/src/auctionSubscriber/auctionSubscriberGrpc.ts +12 -5
- package/src/bankrun/bankrunConnection.ts +110 -40
- package/src/blockhashSubscriber/BlockhashSubscriber.ts +5 -4
- package/src/clock/clockSubscriber.ts +10 -9
- package/src/config.ts +8 -3
- package/src/constants/index.ts +1 -2
- package/src/constants/numericConstants.ts +8 -4
- package/src/constituentMap/constituentMap.ts +8 -1
- package/src/constituentMap/pollingConstituentAccountSubscriber.ts +4 -2
- package/src/constituentMap/webSocketConstituentAccountSubscriber.ts +13 -4
- package/src/core/instructions/perpOrders.ts +14 -0
- package/src/core/remainingAccounts.ts +4 -4
- package/src/decode/user.ts +8 -1
- package/src/dlob/DLOB.ts +296 -172
- package/src/dlob/DLOBNode.ts +23 -3
- package/src/dlob/DLOBSubscriber.ts +51 -34
- package/src/dlob/NodeList.ts +8 -7
- package/src/dlob/orderBookLevels.ts +45 -25
- package/src/events/eventList.ts +4 -1
- package/src/events/eventSubscriber.ts +107 -49
- package/src/events/eventsServerLogProvider.ts +22 -13
- package/src/events/fetchLogs.ts +3 -3
- package/src/events/pollingLogProvider.ts +2 -2
- package/src/events/txEventCache.ts +8 -2
- package/src/events/types.ts +0 -8
- package/src/events/webSocketLogProvider.ts +5 -3
- package/src/factory/bigNum.ts +2 -2
- package/src/idl/velocity.json +1234 -1577
- package/src/idl/velocity.ts +1234 -1577
- package/src/index.ts +0 -2
- package/src/jupiter/jupiterClient.ts +30 -10
- package/src/marginCalculation.ts +1 -0
- package/src/marinade/index.ts +11 -2
- package/src/math/amm.ts +188 -33
- package/src/math/bankruptcy.ts +1 -1
- package/src/math/funding.ts +7 -6
- package/src/math/insurance.ts +6 -8
- package/src/math/margin.ts +5 -112
- package/src/math/market.ts +6 -96
- package/src/math/oracles.ts +0 -17
- package/src/math/orders.ts +1 -110
- package/src/math/position.ts +4 -16
- package/src/math/repeg.ts +0 -29
- package/src/math/spotBalance.ts +14 -10
- package/src/math/spotMarket.ts +2 -28
- package/src/math/spotPosition.ts +4 -4
- package/src/math/state.ts +0 -8
- package/src/math/superStake.ts +19 -65
- package/src/math/trade.ts +2 -6
- package/src/memcmp.ts +0 -9
- package/src/oracles/prelaunchOracleClient.ts +7 -2
- package/src/oracles/pythClient.ts +12 -3
- package/src/oracles/pythLazerClient.ts +7 -2
- package/src/oracles/utils.ts +15 -0
- package/src/orderSubscriber/OrderSubscriber.ts +10 -4
- package/src/priorityFee/heliusPriorityFeeMethod.ts +1 -1
- package/src/priorityFee/priorityFeeSubscriber.ts +45 -9
- package/src/priorityFee/solanaPriorityFeeMethod.ts +1 -1
- package/src/pyth/types.ts +0 -2
- package/src/slot/SlotSubscriber.ts +3 -3
- package/src/slot/SlothashSubscriber.ts +17 -6
- package/src/swift/grpcSignedMsgUserAccountSubscriber.ts +5 -6
- package/src/swift/signedMsgUserAccountSubscriber.ts +16 -8
- package/src/swift/swiftOrderSubscriber.ts +10 -9
- package/src/testClient.ts +2 -2
- package/src/tokenFaucet.ts +22 -3
- package/src/tx/baseTxSender.ts +10 -10
- package/src/tx/fastSingleTxSender.ts +12 -8
- package/src/tx/reportTransactionError.ts +12 -7
- package/src/tx/retryTxSender.ts +6 -4
- package/src/tx/txHandler.ts +88 -43
- package/src/tx/txParamProcessor.ts +18 -3
- package/src/tx/types.ts +1 -1
- package/src/tx/whileValidTxSender.ts +51 -22
- package/src/types.ts +39 -75
- package/src/user.ts +200 -152
- package/src/userMap/WebsocketSubscription.ts +1 -1
- package/src/userMap/grpcSubscription.ts +1 -1
- package/src/userMap/referrerMap.ts +14 -10
- package/src/userMap/revenueShareEscrowMap.ts +8 -3
- package/src/userMap/userMap.ts +43 -25
- package/src/userMap/userStatsMap.ts +32 -19
- package/src/userStats.ts +21 -8
- package/src/util/TransactionConfirmationManager.ts +10 -2
- package/src/util/chainClock.ts +1 -1
- package/src/util/computeUnits.ts +7 -3
- package/src/velocityClient.ts +536 -383
- package/tests/VelocityCore/remainingAccounts.test.ts +4 -5
- package/tests/accounts/customizedCadenceBulkAccountLoader.test.ts +19 -11
- package/tests/amm/test.ts +300 -95
- package/tests/decode/userAccountBufferStrings.ts +100 -100
- package/tests/dlob/helpers.ts +162 -173
- package/tests/dlob/test.ts +155 -106
- package/tests/tx/TransactionConfirmationManager.test.ts +9 -2
- package/tests/user/getMarginCalculation.ts +1 -1
- package/tests/user/helpers.ts +3 -4
- package/tests/user/marginCalculations.test.ts +2 -2
- package/tests/user/test.ts +3 -3
- package/tsconfig.browser.json +3 -1
- package/tsconfig.json +21 -2
- package/.yarn/install-state.gz +0 -0
- package/VERSION +0 -1
- package/bun.lock +0 -1885
- package/lib/browser/constants/insuranceFund.d.ts +0 -5
- package/lib/browser/constants/insuranceFund.js +0 -9
- package/lib/browser/tx/forwardOnlyTxSender.d.ts +0 -37
- package/lib/browser/tx/forwardOnlyTxSender.js +0 -92
- package/lib/browser/util/tps.d.ts +0 -2
- package/lib/browser/util/tps.js +0 -16
- package/lib/node/constants/insuranceFund.d.ts +0 -6
- package/lib/node/constants/insuranceFund.d.ts.map +0 -1
- package/lib/node/constants/insuranceFund.js +0 -9
- package/lib/node/tx/forwardOnlyTxSender.d.ts +0 -38
- package/lib/node/tx/forwardOnlyTxSender.d.ts.map +0 -1
- package/lib/node/tx/forwardOnlyTxSender.js +0 -92
- package/lib/node/util/tps.d.ts +0 -3
- package/lib/node/util/tps.d.ts.map +0 -1
- package/lib/node/util/tps.js +0 -16
- package/scripts/updateVersion.js +0 -28
- package/src/constants/insuranceFund.ts +0 -8
- package/src/tx/forwardOnlyTxSender.ts +0 -145
- package/src/util/tps.ts +0 -27
- package/tests/decode/phoenix.ts +0 -71
|
@@ -7,7 +7,7 @@ export declare class AuctionSubscriber {
|
|
|
7
7
|
private opts;
|
|
8
8
|
private resubOpts?;
|
|
9
9
|
eventEmitter: StrictEventEmitter<EventEmitter, AuctionSubscriberEvents>;
|
|
10
|
-
private subscriber
|
|
10
|
+
private subscriber?;
|
|
11
11
|
constructor({ velocityClient, opts, resubTimeoutMs, logResubMessages, }: AuctionSubscriberConfig);
|
|
12
12
|
subscribe(): Promise<void>;
|
|
13
13
|
unsubscribe(): Promise<void>;
|
|
@@ -8,18 +8,20 @@ class AuctionSubscriber {
|
|
|
8
8
|
constructor({ velocityClient, opts, resubTimeoutMs, logResubMessages, }) {
|
|
9
9
|
// Type-system guarantees at least one of the two is supplied.
|
|
10
10
|
this.velocityClient = velocityClient;
|
|
11
|
-
this.opts = opts || this.velocityClient.opts;
|
|
11
|
+
this.opts = opts || this.velocityClient.opts || {};
|
|
12
12
|
this.eventEmitter = new events_1.EventEmitter();
|
|
13
13
|
this.resubOpts = { resubTimeoutMs, logResubMessages };
|
|
14
14
|
}
|
|
15
15
|
async subscribe() {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
let subscriber = this.subscriber;
|
|
17
|
+
if (!subscriber) {
|
|
18
|
+
subscriber = new webSocketProgramAccountSubscriber_1.WebSocketProgramAccountSubscriber('AuctionSubscriber', 'user', this.velocityClient.program, this.velocityClient.program.account.user.coder.accounts.decode.bind(this.velocityClient.program.account.user.coder.accounts), {
|
|
18
19
|
filters: [(0, memcmp_1.getUserFilter)(), (0, memcmp_1.getUserWithAuctionFilter)()],
|
|
19
20
|
commitment: this.opts.commitment,
|
|
20
21
|
}, this.resubOpts);
|
|
22
|
+
this.subscriber = subscriber;
|
|
21
23
|
}
|
|
22
|
-
await
|
|
24
|
+
await subscriber.subscribe((accountId, data, context) => {
|
|
23
25
|
this.eventEmitter.emit('onAccountUpdate', data, accountId, context.slot);
|
|
24
26
|
});
|
|
25
27
|
}
|
|
@@ -8,7 +8,7 @@ export declare class AuctionSubscriberGrpc {
|
|
|
8
8
|
private resubOpts?;
|
|
9
9
|
private grpcConfigs?;
|
|
10
10
|
eventEmitter: StrictEventEmitter<EventEmitter, AuctionSubscriberEvents>;
|
|
11
|
-
private subscriber
|
|
11
|
+
private subscriber?;
|
|
12
12
|
constructor({ velocityClient, opts, grpcConfigs, resubTimeoutMs, logResubMessages, }: AuctionSubscriberConfig);
|
|
13
13
|
subscribe(): Promise<void>;
|
|
14
14
|
unsubscribe(): Promise<void>;
|
|
@@ -8,18 +8,23 @@ class AuctionSubscriberGrpc {
|
|
|
8
8
|
constructor({ velocityClient, opts, grpcConfigs, resubTimeoutMs, logResubMessages, }) {
|
|
9
9
|
// Type-system guarantees at least one of the two is supplied.
|
|
10
10
|
this.velocityClient = velocityClient;
|
|
11
|
-
this.opts = opts || this.velocityClient.opts;
|
|
11
|
+
this.opts = opts || this.velocityClient.opts || {};
|
|
12
12
|
this.eventEmitter = new events_1.EventEmitter();
|
|
13
13
|
this.resubOpts = { resubTimeoutMs, logResubMessages };
|
|
14
14
|
this.grpcConfigs = grpcConfigs;
|
|
15
15
|
}
|
|
16
16
|
async subscribe() {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
let subscriber = this.subscriber;
|
|
18
|
+
if (!subscriber) {
|
|
19
|
+
if (!this.grpcConfigs) {
|
|
20
|
+
throw new Error('grpcConfigs must be provided to use AuctionSubscriberGrpc');
|
|
21
|
+
}
|
|
22
|
+
subscriber = await grpcProgramAccountSubscriber_1.grpcProgramAccountSubscriber.create(this.grpcConfigs, 'AuctionSubscriber', 'user', this.velocityClient.program, this.velocityClient.program.account.user.coder.accounts.decode.bind(this.velocityClient.program.account.user.coder.accounts), {
|
|
19
23
|
filters: [(0, memcmp_1.getUserFilter)(), (0, memcmp_1.getUserWithAuctionFilter)()],
|
|
20
24
|
}, this.resubOpts);
|
|
25
|
+
this.subscriber = subscriber;
|
|
21
26
|
}
|
|
22
|
-
await
|
|
27
|
+
await subscriber.subscribe((accountId, data, context) => {
|
|
23
28
|
this.eventEmitter.emit('onAccountUpdate', data, accountId, context.slot);
|
|
24
29
|
});
|
|
25
30
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
/// <reference types="bn.js" />
|
|
4
3
|
import { AccountInfo, Keypair, PublicKey, Transaction, RpcResponseAndContext, Commitment, TransactionSignature, SignatureStatusConfig, SignatureStatus, GetVersionedTransactionConfig, GetTransactionConfig, VersionedTransaction, SimulateTransactionConfig, SimulatedTransactionResponse, TransactionError, SignatureResultCallback, Connection as SolanaConnection, Blockhash, LogsFilter, LogsCallback, AccountChangeCallback, AddressLookupTableAccount } from '@solana/web3.js';
|
|
5
4
|
import { ProgramTestContext, BanksClient } from 'solana-bankrun';
|
|
6
5
|
import { BankrunProvider } from 'anchor-bankrun';
|
|
@@ -10,7 +9,7 @@ export type ClientSubscriptionId = number;
|
|
|
10
9
|
export type Connection = SolanaConnection | BankrunConnection;
|
|
11
10
|
type BankrunTransactionMetaNormalized = {
|
|
12
11
|
logMessages: string[];
|
|
13
|
-
err: TransactionError;
|
|
12
|
+
err: TransactionError | null;
|
|
14
13
|
};
|
|
15
14
|
type BankrunTransactionRespose = {
|
|
16
15
|
slot: number;
|
|
@@ -34,7 +33,8 @@ export declare class BankrunConnection {
|
|
|
34
33
|
private readonly _banksClient;
|
|
35
34
|
private readonly context;
|
|
36
35
|
private transactionToMeta;
|
|
37
|
-
private
|
|
36
|
+
private _clock?;
|
|
37
|
+
private get clock();
|
|
38
38
|
private nextClientSubscriptionId;
|
|
39
39
|
private onLogCallbacks;
|
|
40
40
|
private onAccountChangeCallbacks;
|
|
@@ -43,14 +43,16 @@ export declare class BankrunConnection {
|
|
|
43
43
|
getSlot(): Promise<bigint>;
|
|
44
44
|
toConnection(): SolanaConnection;
|
|
45
45
|
getTokenAccount(publicKey: PublicKey): Promise<Account>;
|
|
46
|
-
|
|
46
|
+
getTokenAccountBalance(publicKey: PublicKey, _commitment?: Commitment): Promise<Account>;
|
|
47
|
+
getBalance(publicKey: PublicKey): Promise<bigint>;
|
|
48
|
+
getMultipleAccountsInfo(publicKeys: PublicKey[], _commitmentOrConfig?: Commitment): Promise<(AccountInfo<Buffer> | null)[]>;
|
|
47
49
|
getAccountInfo(publicKey: PublicKey): Promise<null | AccountInfo<Buffer>>;
|
|
48
50
|
getAccountInfoAndContext(publicKey: PublicKey, _commitment?: Commitment): Promise<RpcResponseAndContext<null | AccountInfo<Buffer>>>;
|
|
49
51
|
sendRawTransaction(rawTransaction: Buffer | Uint8Array | Array<number>, _options?: any): Promise<TransactionSignature>;
|
|
50
52
|
sendTransaction(tx: Transaction | VersionedTransaction): Promise<TransactionSignature>;
|
|
51
53
|
updateSlotAndClock(): Promise<void>;
|
|
52
54
|
getTime(): number;
|
|
53
|
-
getParsedAccountInfo(publicKey: PublicKey): Promise<RpcResponseAndContext<AccountInfo<Buffer>>>;
|
|
55
|
+
getParsedAccountInfo(publicKey: PublicKey): Promise<RpcResponseAndContext<null | AccountInfo<Buffer>>>;
|
|
54
56
|
getLatestBlockhash(commitment?: Commitment): Promise<Readonly<{
|
|
55
57
|
blockhash: string;
|
|
56
58
|
lastValidBlockHeight: number;
|
|
@@ -61,6 +63,7 @@ export declare class BankrunConnection {
|
|
|
61
63
|
* There's really no direct equivalent to getTransaction exposed by SolanaProgramTest, so we do the best that we can here - it's a little hacky.
|
|
62
64
|
*/
|
|
63
65
|
getTransaction(signature: string, _rawConfig?: GetTransactionConfig | GetVersionedTransactionConfig): Promise<BankrunTransactionRespose | null>;
|
|
66
|
+
private getTransactionMetaOrThrow;
|
|
64
67
|
findComputeUnitConsumption(signature: string): bigint;
|
|
65
68
|
printTxLogs(signature: string): void;
|
|
66
69
|
simulateTransaction(transaction: Transaction | VersionedTransaction, _config?: SimulateTransactionConfig): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
|
|
@@ -78,6 +78,12 @@ class BankrunContextWrapper {
|
|
|
78
78
|
}
|
|
79
79
|
exports.BankrunContextWrapper = BankrunContextWrapper;
|
|
80
80
|
class BankrunConnection {
|
|
81
|
+
get clock() {
|
|
82
|
+
if (!this._clock) {
|
|
83
|
+
throw new Error('BankrunConnection: clock accessed before updateSlotAndClock()');
|
|
84
|
+
}
|
|
85
|
+
return this._clock;
|
|
86
|
+
}
|
|
81
87
|
constructor(banksClient, context, verifySignatures = true) {
|
|
82
88
|
this.transactionToMeta = new Map();
|
|
83
89
|
this.nextClientSubscriptionId = 0;
|
|
@@ -95,8 +101,22 @@ class BankrunConnection {
|
|
|
95
101
|
}
|
|
96
102
|
async getTokenAccount(publicKey) {
|
|
97
103
|
const info = await this.getAccountInfo(publicKey);
|
|
104
|
+
if (info === null) {
|
|
105
|
+
throw new Error(`Account not found: ${publicKey.toBase58()}`);
|
|
106
|
+
}
|
|
98
107
|
return (0, spl_token_1.unpackAccount)(publicKey, info, info.owner);
|
|
99
108
|
}
|
|
109
|
+
// Mirrors the drift-vaults bankrun helper: returns the decoded SPL token
|
|
110
|
+
// Account (with .amount), not web3.js's { value: { amount } } shape. The
|
|
111
|
+
// vaults tests read `.amount` off the result directly.
|
|
112
|
+
async getTokenAccountBalance(publicKey, _commitment) {
|
|
113
|
+
return this.getTokenAccount(publicKey);
|
|
114
|
+
}
|
|
115
|
+
// SOL lamport balance, straight off the BanksClient. Returns a bigint like
|
|
116
|
+
// the drift-vaults bankrun helper (callers wrap with Number()).
|
|
117
|
+
async getBalance(publicKey) {
|
|
118
|
+
return this._banksClient.getBalance(publicKey);
|
|
119
|
+
}
|
|
100
120
|
async getMultipleAccountsInfo(publicKeys, _commitmentOrConfig) {
|
|
101
121
|
const accountInfos = [];
|
|
102
122
|
for (const publicKey of publicKeys) {
|
|
@@ -115,7 +135,18 @@ class BankrunConnection {
|
|
|
115
135
|
async sendRawTransaction(rawTransaction,
|
|
116
136
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
117
137
|
_options) {
|
|
118
|
-
|
|
138
|
+
// Raw bytes may encode either a legacy or a versioned (v0) transaction.
|
|
139
|
+
// sendTransaction handles both, but they must be deserialized with the
|
|
140
|
+
// matching type: legacy parses with Transaction.from, versioned needs
|
|
141
|
+
// VersionedTransaction.deserialize. Versioned-tx clients (e.g. the vaults
|
|
142
|
+
// VaultClient) always send v0, so fall back when the legacy parse throws.
|
|
143
|
+
let tx;
|
|
144
|
+
try {
|
|
145
|
+
tx = web3_js_1.Transaction.from(rawTransaction);
|
|
146
|
+
}
|
|
147
|
+
catch (e) {
|
|
148
|
+
tx = web3_js_1.VersionedTransaction.deserialize(rawTransaction);
|
|
149
|
+
}
|
|
119
150
|
const signature = await this.sendTransaction(tx);
|
|
120
151
|
return signature;
|
|
121
152
|
}
|
|
@@ -132,9 +163,17 @@ class BankrunConnection {
|
|
|
132
163
|
? await internal.tryProcessVersionedTransaction(serialized)
|
|
133
164
|
: await internal.tryProcessLegacyTransaction(serialized);
|
|
134
165
|
const banksTransactionMeta = new solana_bankrun_1.BanksTransactionResultWithMeta(inner);
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
166
|
+
let signature;
|
|
167
|
+
if (isVersioned) {
|
|
168
|
+
signature = bs58_1.default.encode(tx.signatures[0]);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
const legacySignature = tx.signatures[0].signature;
|
|
172
|
+
if (legacySignature === null) {
|
|
173
|
+
throw new Error('BankrunConnection: transaction is missing its first signature');
|
|
174
|
+
}
|
|
175
|
+
signature = bs58_1.default.encode(legacySignature);
|
|
176
|
+
}
|
|
138
177
|
if (banksTransactionMeta.result) {
|
|
139
178
|
if (!banksTransactionMeta.result
|
|
140
179
|
.toString()
|
|
@@ -151,9 +190,12 @@ class BankrunConnection {
|
|
|
151
190
|
}
|
|
152
191
|
let finalizedCount = 0;
|
|
153
192
|
while (finalizedCount < 10) {
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
193
|
+
const statusValue = (await this.getSignatureStatus(signature)).value;
|
|
194
|
+
if (statusValue === null) {
|
|
195
|
+
throw new Error(`BankrunConnection: no signature status for ${signature}`);
|
|
196
|
+
}
|
|
197
|
+
const signatureStatus = statusValue.confirmationStatus;
|
|
198
|
+
if ((signatureStatus === null || signatureStatus === void 0 ? void 0 : signatureStatus.toString()) == '"finalized"') {
|
|
157
199
|
finalizedCount += 1;
|
|
158
200
|
}
|
|
159
201
|
}
|
|
@@ -167,18 +209,23 @@ class BankrunConnection {
|
|
|
167
209
|
}
|
|
168
210
|
if (this.onLogCallbacks.size > 0) {
|
|
169
211
|
const transaction = await this.getTransaction(signature);
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
logs
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
logCallback(
|
|
212
|
+
if (transaction !== null) {
|
|
213
|
+
const context = { slot: transaction.slot };
|
|
214
|
+
const logs = {
|
|
215
|
+
logs: transaction.meta.logMessages,
|
|
216
|
+
err: transaction.meta.err,
|
|
217
|
+
signature,
|
|
218
|
+
};
|
|
219
|
+
for (const logCallback of this.onLogCallbacks.values()) {
|
|
220
|
+
logCallback(logs, context);
|
|
221
|
+
}
|
|
178
222
|
}
|
|
179
223
|
}
|
|
180
224
|
for (const [publicKey, callback,] of this.onAccountChangeCallbacks.values()) {
|
|
181
225
|
const accountInfo = await this.getParsedAccountInfo(publicKey);
|
|
226
|
+
if (accountInfo.value === null) {
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
182
229
|
callback(accountInfo.value, accountInfo.context);
|
|
183
230
|
}
|
|
184
231
|
return signature;
|
|
@@ -190,7 +237,7 @@ class BankrunConnection {
|
|
|
190
237
|
const currentClock = await this._banksClient.getClock();
|
|
191
238
|
const newClock = new solana_bankrun_1.Clock(nextSlot, currentClock.epochStartTimestamp, currentClock.epoch, currentClock.leaderScheduleEpoch, currentClock.unixTimestamp + BigInt(1));
|
|
192
239
|
this.context.setClock(newClock);
|
|
193
|
-
this.
|
|
240
|
+
this._clock = newClock;
|
|
194
241
|
}
|
|
195
242
|
getTime() {
|
|
196
243
|
return Number(this.clock.unixTimestamp);
|
|
@@ -212,6 +259,9 @@ class BankrunConnection {
|
|
|
212
259
|
}
|
|
213
260
|
async getLatestBlockhash(commitment) {
|
|
214
261
|
const blockhashAndBlockheight = await this._banksClient.getLatestBlockhash(commitment);
|
|
262
|
+
if (blockhashAndBlockheight === null) {
|
|
263
|
+
throw new Error('Failed to get latest blockhash');
|
|
264
|
+
}
|
|
215
265
|
return {
|
|
216
266
|
blockhash: blockhashAndBlockheight[0],
|
|
217
267
|
lastValidBlockHeight: Number(blockhashAndBlockheight[1]),
|
|
@@ -258,6 +308,9 @@ class BankrunConnection {
|
|
|
258
308
|
return null;
|
|
259
309
|
}
|
|
260
310
|
const transactionStatus = await this._banksClient.getTransactionStatus(signature);
|
|
311
|
+
if (transactionStatus === null) {
|
|
312
|
+
throw new Error(`tx has no status: ${signature}`);
|
|
313
|
+
}
|
|
261
314
|
if (txMeta.meta === null) {
|
|
262
315
|
throw new Error(`tx has no meta: ${JSON.stringify(txMeta)}`);
|
|
263
316
|
}
|
|
@@ -270,36 +323,43 @@ class BankrunConnection {
|
|
|
270
323
|
meta,
|
|
271
324
|
};
|
|
272
325
|
}
|
|
273
|
-
|
|
326
|
+
getTransactionMetaOrThrow(signature) {
|
|
274
327
|
const txMeta = this.transactionToMeta.get(signature);
|
|
275
328
|
if (txMeta === undefined) {
|
|
276
329
|
throw new Error('Transaction not found');
|
|
277
330
|
}
|
|
278
|
-
|
|
331
|
+
if (txMeta.meta === null) {
|
|
332
|
+
throw new Error(`tx has no meta: ${JSON.stringify(txMeta)}`);
|
|
333
|
+
}
|
|
334
|
+
return txMeta.meta;
|
|
335
|
+
}
|
|
336
|
+
findComputeUnitConsumption(signature) {
|
|
337
|
+
return this.getTransactionMetaOrThrow(signature).computeUnitsConsumed;
|
|
279
338
|
}
|
|
280
339
|
printTxLogs(signature) {
|
|
281
|
-
|
|
282
|
-
if (txMeta === undefined) {
|
|
283
|
-
throw new Error('Transaction not found');
|
|
284
|
-
}
|
|
285
|
-
console.log(txMeta.meta.logMessages);
|
|
340
|
+
console.log(this.getTransactionMetaOrThrow(signature).logMessages);
|
|
286
341
|
}
|
|
287
342
|
async simulateTransaction(transaction, _config) {
|
|
288
|
-
var _a, _b, _c, _d;
|
|
289
343
|
const simulationResult = await this._banksClient.simulateTransaction(transaction);
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
344
|
+
const meta = simulationResult.meta;
|
|
345
|
+
if (meta === null) {
|
|
346
|
+
throw new Error('BankrunConnection: simulation returned no meta');
|
|
347
|
+
}
|
|
348
|
+
let returnData;
|
|
349
|
+
if (meta.returnData !== null) {
|
|
350
|
+
const returnDataNormalized = Buffer.from(meta.returnData.data).toString('base64');
|
|
351
|
+
returnData = {
|
|
352
|
+
programId: meta.returnData.programId.toBase58(),
|
|
353
|
+
data: [returnDataNormalized, 'base64'],
|
|
354
|
+
};
|
|
355
|
+
}
|
|
296
356
|
return {
|
|
297
357
|
context: { slot: Number(await this._banksClient.getSlot()) },
|
|
298
358
|
value: {
|
|
299
359
|
err: simulationResult.result,
|
|
300
|
-
logs:
|
|
360
|
+
logs: meta.logMessages,
|
|
301
361
|
accounts: undefined,
|
|
302
|
-
unitsConsumed: Number(
|
|
362
|
+
unitsConsumed: Number(meta.computeUnitsConsumed),
|
|
303
363
|
returnData,
|
|
304
364
|
},
|
|
305
365
|
};
|
|
@@ -11,7 +11,7 @@ export declare class BlockhashSubscriber {
|
|
|
11
11
|
private updateIntervalMs;
|
|
12
12
|
constructor(config: BlockhashSubscriberConfig);
|
|
13
13
|
getBlockhashCacheSize(): number;
|
|
14
|
-
getLatestBlockHeight(): number;
|
|
14
|
+
getLatestBlockHeight(): number | undefined;
|
|
15
15
|
getLatestBlockHeightContext(): Context | undefined;
|
|
16
16
|
/**
|
|
17
17
|
* Returns the latest cached blockhash, based on an offset from the latest obtained
|
|
@@ -40,8 +40,9 @@ class BlockhashSubscriber {
|
|
|
40
40
|
return this.blockhashes[this.blockhashes.length - 1 - clampedOffset];
|
|
41
41
|
}
|
|
42
42
|
pruneBlockhashes() {
|
|
43
|
-
if (this.latestBlockHeight) {
|
|
44
|
-
|
|
43
|
+
if (this.latestBlockHeight !== undefined) {
|
|
44
|
+
const latestBlockHeight = this.latestBlockHeight;
|
|
45
|
+
this.blockhashes = this.blockhashes.filter((blockhash) => blockhash.lastValidBlockHeight > latestBlockHeight);
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
async updateBlockhash() {
|
|
@@ -11,13 +11,13 @@ export interface ClockSubscriberEvent {
|
|
|
11
11
|
}
|
|
12
12
|
export declare class ClockSubscriber {
|
|
13
13
|
private connection;
|
|
14
|
-
private _latestSlot
|
|
15
|
-
private _currentTs
|
|
16
|
-
private subscriptionId
|
|
14
|
+
private _latestSlot?;
|
|
15
|
+
private _currentTs?;
|
|
16
|
+
private subscriptionId?;
|
|
17
17
|
commitment: Commitment;
|
|
18
18
|
eventEmitter: StrictEventEmitter<EventEmitter, ClockSubscriberEvent>;
|
|
19
|
-
get latestSlot(): number;
|
|
20
|
-
get currentTs(): number;
|
|
19
|
+
get latestSlot(): number | undefined;
|
|
20
|
+
get currentTs(): number | undefined;
|
|
21
21
|
private timeoutId?;
|
|
22
22
|
private resubTimeoutMs?;
|
|
23
23
|
private isUnsubscribing;
|
|
@@ -25,7 +25,7 @@ export declare class ClockSubscriber {
|
|
|
25
25
|
constructor(connection: Connection, config?: ClockSubscriberConfig);
|
|
26
26
|
subscribe(): Promise<void>;
|
|
27
27
|
private setTimeout;
|
|
28
|
-
getUnixTs(): number;
|
|
28
|
+
getUnixTs(): number | undefined;
|
|
29
29
|
unsubscribe(onResub?: boolean): Promise<void>;
|
|
30
30
|
}
|
|
31
31
|
export {};
|
|
@@ -18,7 +18,7 @@ class ClockSubscriber {
|
|
|
18
18
|
this.eventEmitter = new events_1.EventEmitter();
|
|
19
19
|
this.resubTimeoutMs = config === null || config === void 0 ? void 0 : config.resubTimeoutMs;
|
|
20
20
|
this.commitment = (config === null || config === void 0 ? void 0 : config.commitment) || 'confirmed';
|
|
21
|
-
if (this.resubTimeoutMs < 1000) {
|
|
21
|
+
if (this.resubTimeoutMs !== undefined && this.resubTimeoutMs < 1000) {
|
|
22
22
|
console.log('resubTimeoutMs should be at least 1000ms to avoid spamming resub');
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -34,8 +34,9 @@ class ClockSubscriber {
|
|
|
34
34
|
this.setTimeout();
|
|
35
35
|
}
|
|
36
36
|
this._latestSlot = context.slot;
|
|
37
|
-
|
|
38
|
-
this.
|
|
37
|
+
const currentTs = new anchor_1.BN(acctInfo.data.subarray(32, 39), undefined, 'le').toNumber();
|
|
38
|
+
this._currentTs = currentTs;
|
|
39
|
+
this.eventEmitter.emit('clockUpdate', currentTs);
|
|
39
40
|
}
|
|
40
41
|
}, this.commitment);
|
|
41
42
|
if (this.resubTimeoutMs) {
|
package/lib/browser/config.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export interface VelocityConfig {
|
|
|
27
27
|
export declare const VELOCITY_PROGRAM_ID = "vELoC1audYbSYVRXn1vPaV8Axoa9oU6BYmNGZZBDZ1P";
|
|
28
28
|
export declare const VELOCITY_DEVNET_PROGRAM_ID = "vELoC1audYbSYVRXn1vPaV8Axoa9oU6BYmNGZZBDZ1P";
|
|
29
29
|
export declare const VELOCITY_ORACLE_RECEIVER_ID = "G6EoTTTgpkNBtVXo96EQp2m6uwwVh2Kt6YidjkmQqoha";
|
|
30
|
-
export declare const
|
|
30
|
+
export declare const PYTH_LAZER_PROGRAM_ID = "pytd2yyk641x7ak7mkaasSJVXh6YYZnC7wTmtgAyxPt";
|
|
31
31
|
export declare const SB_ON_DEMAND_DEVNET_PID: PublicKey;
|
|
32
32
|
export declare const SB_ON_DEMAND_MAINNET_PID: PublicKey;
|
|
33
33
|
export declare const PYTH_LAZER_STORAGE_ACCOUNT_KEY: PublicKey;
|
package/lib/browser/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findAllMarketAndOracles = exports.getMarketsAndOraclesForSubscription = exports.initialize = exports.getConfig = exports.configs = exports.DEFAULT_CONFIRMATION_OPTS = exports.PYTH_LAZER_STORAGE_ACCOUNT_KEY = exports.SB_ON_DEMAND_MAINNET_PID = exports.SB_ON_DEMAND_DEVNET_PID = exports.
|
|
3
|
+
exports.findAllMarketAndOracles = exports.getMarketsAndOraclesForSubscription = exports.initialize = exports.getConfig = exports.configs = exports.DEFAULT_CONFIRMATION_OPTS = exports.PYTH_LAZER_STORAGE_ACCOUNT_KEY = exports.SB_ON_DEMAND_MAINNET_PID = exports.SB_ON_DEMAND_DEVNET_PID = exports.PYTH_LAZER_PROGRAM_ID = exports.VELOCITY_ORACLE_RECEIVER_ID = exports.VELOCITY_DEVNET_PROGRAM_ID = exports.VELOCITY_PROGRAM_ID = void 0;
|
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
|
5
5
|
const perpMarkets_1 = require("./constants/perpMarkets");
|
|
6
6
|
const spotMarkets_1 = require("./constants/spotMarkets");
|
|
@@ -8,7 +8,7 @@ const oracleId_1 = require("./oracles/oracleId");
|
|
|
8
8
|
exports.VELOCITY_PROGRAM_ID = 'vELoC1audYbSYVRXn1vPaV8Axoa9oU6BYmNGZZBDZ1P';
|
|
9
9
|
exports.VELOCITY_DEVNET_PROGRAM_ID = 'vELoC1audYbSYVRXn1vPaV8Axoa9oU6BYmNGZZBDZ1P';
|
|
10
10
|
exports.VELOCITY_ORACLE_RECEIVER_ID = 'G6EoTTTgpkNBtVXo96EQp2m6uwwVh2Kt6YidjkmQqoha';
|
|
11
|
-
exports.
|
|
11
|
+
exports.PYTH_LAZER_PROGRAM_ID = 'pytd2yyk641x7ak7mkaasSJVXh6YYZnC7wTmtgAyxPt';
|
|
12
12
|
exports.SB_ON_DEMAND_DEVNET_PID = new web3_js_1.PublicKey('Aio4gaXjXzJNVLtzwtNVmSqGKpANtXhybbkhtAC94ji2');
|
|
13
13
|
exports.SB_ON_DEMAND_MAINNET_PID = new web3_js_1.PublicKey('SBondMDrcV3K4kxZR1HNVT7osZxAHVHgYXL5Ze1oMUv');
|
|
14
14
|
exports.PYTH_LAZER_STORAGE_ACCOUNT_KEY = new web3_js_1.PublicKey('3rdJbqfnagQ4yx9HXJViD4zc4xpiSqmFsKpPuSCQVyQL');
|
|
@@ -70,8 +70,12 @@ const initialize = (props) => {
|
|
|
70
70
|
};
|
|
71
71
|
exports.initialize = initialize;
|
|
72
72
|
function getMarketsAndOraclesForSubscription(env, perpMarkets, spotMarkets) {
|
|
73
|
-
const perpMarketsToUse =
|
|
74
|
-
|
|
73
|
+
const perpMarketsToUse = perpMarkets !== undefined && perpMarkets.length > 0
|
|
74
|
+
? perpMarkets
|
|
75
|
+
: perpMarkets_1.PerpMarkets[env];
|
|
76
|
+
const spotMarketsToUse = spotMarkets !== undefined && spotMarkets.length > 0
|
|
77
|
+
? spotMarkets
|
|
78
|
+
: spotMarkets_1.SpotMarkets[env];
|
|
75
79
|
const perpMarketIndexes = [];
|
|
76
80
|
const spotMarketIndexes = [];
|
|
77
81
|
const oracleInfos = new Map();
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Protocol constants: numeric precision bases, market indices, transaction size limits,
|
|
3
|
-
*
|
|
3
|
+
* and perp/spot market config arrays.
|
|
4
4
|
* Import specific submodules to avoid pulling in unused market lists.
|
|
5
5
|
*/
|
|
6
|
-
export * from './insuranceFund';
|
|
7
6
|
export * from './numericConstants';
|
|
8
7
|
export * from './perpMarkets';
|
|
9
8
|
export * from './spotMarkets';
|
|
@@ -16,10 +16,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
/**
|
|
18
18
|
* Protocol constants: numeric precision bases, market indices, transaction size limits,
|
|
19
|
-
*
|
|
19
|
+
* and perp/spot market config arrays.
|
|
20
20
|
* Import specific submodules to avoid pulling in unused market lists.
|
|
21
21
|
*/
|
|
22
|
-
__exportStar(require("./insuranceFund"), exports);
|
|
23
22
|
__exportStar(require("./numericConstants"), exports);
|
|
24
23
|
__exportStar(require("./perpMarkets"), exports);
|
|
25
24
|
__exportStar(require("./spotMarkets"), exports);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="bn.js" />
|
|
2
1
|
import { BN } from '../isomorphic/anchor';
|
|
3
2
|
export declare const ZERO: BN;
|
|
4
3
|
export declare const ONE: BN;
|
|
@@ -53,13 +52,13 @@ export declare const MARGIN_PRECISION: BN;
|
|
|
53
52
|
export declare const BID_ASK_SPREAD_PRECISION: BN;
|
|
54
53
|
export declare const LIQUIDATION_PCT_PRECISION: BN;
|
|
55
54
|
export declare const FUNDING_RATE_OFFSET_DENOMINATOR: BN;
|
|
55
|
+
export declare const FUNDING_RATE_OFFSET_PERCENTAGE: BN;
|
|
56
56
|
export declare const FUNDING_RATE_CLAMP_DENOMINATOR: BN;
|
|
57
57
|
export declare const PRICE_TIMES_AMM_TO_QUOTE_PRECISION_RATIO: BN;
|
|
58
58
|
export declare const FIVE_MINUTE: BN;
|
|
59
59
|
export declare const ONE_HOUR: BN;
|
|
60
60
|
export declare const ONE_YEAR: BN;
|
|
61
61
|
export declare const QUOTE_SPOT_MARKET_INDEX = 0;
|
|
62
|
-
export declare const GOV_SPOT_MARKET_INDEX = 15;
|
|
63
62
|
export declare const LAMPORTS_PRECISION: BN;
|
|
64
63
|
export declare const LAMPORTS_EXP: BN;
|
|
65
64
|
export declare const OPEN_ORDER_MARGIN_REQUIREMENT: BN;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MARGIN_PRECISION = exports.AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO = exports.PRICE_TO_QUOTE_PRECISION = exports.PRICE_DIV_PEG = exports.AMM_TO_QUOTE_PRECISION_RATIO = exports.BASE_PRECISION_EXP = exports.BASE_PRECISION = exports.AMM_RESERVE_PRECISION = exports.PEG_PRECISION = exports.FUNDING_RATE_BUFFER_PRECISION = exports.FUNDING_RATE_PRECISION = exports.PRICE_PRECISION = exports.QUOTE_PRECISION = exports.LIQUIDATION_FEE_PRECISION = exports.SPOT_MARKET_IMF_PRECISION = exports.SPOT_MARKET_IMF_PRECISION_EXP = exports.SPOT_MARKET_BALANCE_PRECISION = exports.SPOT_MARKET_BALANCE_PRECISION_EXP = exports.SPOT_MARKET_WEIGHT_PRECISION = exports.SPOT_MARKET_UTILIZATION_PRECISION = exports.SPOT_MARKET_UTILIZATION_PRECISION_EXP = exports.SPOT_MARKET_CUMULATIVE_INTEREST_PRECISION = exports.SPOT_MARKET_CUMULATIVE_INTEREST_PRECISION_EXP = exports.SPOT_MARKET_RATE_PRECISION = exports.SPOT_MARKET_RATE_PRECISION_EXP = exports.AMM_RESERVE_PRECISION_EXP = exports.PEG_PRECISION_EXP = exports.FUNDING_RATE_PRECISION_EXP = exports.PRICE_PRECISION_EXP = exports.FUNDING_RATE_BUFFER_PRECISION_EXP = exports.QUOTE_PRECISION_EXP = exports.CONCENTRATION_PRECISION = exports.PERCENTAGE_PRECISION = exports.PERCENTAGE_PRECISION_EXP = exports.MAX_LEVERAGE_ORDER_SIZE = exports.MAX_LEVERAGE = exports.TEN_MILLION = exports.BN_MAX = exports.TEN_THOUSAND = exports.TEN = exports.NINE = exports.EIGHT = exports.SEVEN = exports.SIX = exports.FIVE = exports.FOUR = exports.THREE = exports.TWO = exports.ONE = exports.ZERO = void 0;
|
|
4
|
-
exports.MIN_I64 = exports.MAX_I64 = exports.GET_MULTIPLE_ACCOUNTS_CHUNK_SIZE = exports.DUST_POSITION_SIZE = exports.SLOT_TIME_ESTIMATE_MS = exports.IDLE_TIME_SLOTS = exports.ACCOUNT_AGE_DELETION_CUTOFF_SECONDS = exports.DEFAULT_REVENUE_SINCE_LAST_FUNDING_SPREAD_RETREAT = exports.OPEN_ORDER_MARGIN_REQUIREMENT = exports.LAMPORTS_EXP = exports.LAMPORTS_PRECISION = exports.
|
|
4
|
+
exports.MIN_I64 = exports.MAX_I64 = exports.GET_MULTIPLE_ACCOUNTS_CHUNK_SIZE = exports.DUST_POSITION_SIZE = exports.SLOT_TIME_ESTIMATE_MS = exports.IDLE_TIME_SLOTS = exports.ACCOUNT_AGE_DELETION_CUTOFF_SECONDS = exports.DEFAULT_REVENUE_SINCE_LAST_FUNDING_SPREAD_RETREAT = exports.OPEN_ORDER_MARGIN_REQUIREMENT = exports.LAMPORTS_EXP = exports.LAMPORTS_PRECISION = exports.QUOTE_SPOT_MARKET_INDEX = exports.ONE_YEAR = exports.ONE_HOUR = exports.FIVE_MINUTE = exports.PRICE_TIMES_AMM_TO_QUOTE_PRECISION_RATIO = exports.FUNDING_RATE_CLAMP_DENOMINATOR = exports.FUNDING_RATE_OFFSET_PERCENTAGE = exports.FUNDING_RATE_OFFSET_DENOMINATOR = exports.LIQUIDATION_PCT_PRECISION = exports.BID_ASK_SPREAD_PRECISION = void 0;
|
|
5
5
|
const web3_js_1 = require("@solana/web3.js");
|
|
6
6
|
const anchor_1 = require("../isomorphic/anchor");
|
|
7
|
-
const bigNum_1 = require("../factory/bigNum");
|
|
8
7
|
exports.ZERO = new anchor_1.BN(0);
|
|
9
8
|
exports.ONE = new anchor_1.BN(1);
|
|
10
9
|
exports.TWO = new anchor_1.BN(2);
|
|
@@ -58,13 +57,13 @@ exports.MARGIN_PRECISION = exports.TEN_THOUSAND;
|
|
|
58
57
|
exports.BID_ASK_SPREAD_PRECISION = new anchor_1.BN(1000000); // 10^6
|
|
59
58
|
exports.LIQUIDATION_PCT_PRECISION = exports.TEN_THOUSAND;
|
|
60
59
|
exports.FUNDING_RATE_OFFSET_DENOMINATOR = new anchor_1.BN(3333);
|
|
60
|
+
exports.FUNDING_RATE_OFFSET_PERCENTAGE = exports.FUNDING_RATE_PRECISION.div(exports.FUNDING_RATE_OFFSET_DENOMINATOR);
|
|
61
61
|
exports.FUNDING_RATE_CLAMP_DENOMINATOR = new anchor_1.BN(2000);
|
|
62
62
|
exports.PRICE_TIMES_AMM_TO_QUOTE_PRECISION_RATIO = exports.PRICE_PRECISION.mul(exports.AMM_TO_QUOTE_PRECISION_RATIO);
|
|
63
63
|
exports.FIVE_MINUTE = new anchor_1.BN(60 * 5);
|
|
64
64
|
exports.ONE_HOUR = new anchor_1.BN(60 * 60);
|
|
65
65
|
exports.ONE_YEAR = new anchor_1.BN(31536000);
|
|
66
66
|
exports.QUOTE_SPOT_MARKET_INDEX = 0;
|
|
67
|
-
exports.GOV_SPOT_MARKET_INDEX = 15;
|
|
68
67
|
exports.LAMPORTS_PRECISION = new anchor_1.BN(web3_js_1.LAMPORTS_PER_SOL);
|
|
69
68
|
exports.LAMPORTS_EXP = new anchor_1.BN(Math.log10(web3_js_1.LAMPORTS_PER_SOL));
|
|
70
69
|
exports.OPEN_ORDER_MARGIN_REQUIREMENT = exports.QUOTE_PRECISION.div(new anchor_1.BN(100));
|
|
@@ -75,5 +74,8 @@ exports.SLOT_TIME_ESTIMATE_MS = 400;
|
|
|
75
74
|
exports.DUST_POSITION_SIZE = exports.QUOTE_PRECISION.divn(100); // Dust position is any position smaller than 1c
|
|
76
75
|
exports.GET_MULTIPLE_ACCOUNTS_CHUNK_SIZE = 99;
|
|
77
76
|
// integer constants
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
// Built with `BN` directly (not `BigNum.fromPrint`) to avoid a module-load
|
|
78
|
+
// circular dependency: `bigNum.ts` imports `ZERO` from this file, so importing
|
|
79
|
+
// `bigNum.ts` first leaves `BigNum` undefined while this module body evaluates.
|
|
80
|
+
exports.MAX_I64 = new anchor_1.BN('9223372036854775807');
|
|
81
|
+
exports.MIN_I64 = new anchor_1.BN('-9223372036854775808');
|
|
@@ -31,6 +31,9 @@ class ConstituentMap {
|
|
|
31
31
|
this.constituentAccountSubscriber =
|
|
32
32
|
new webSocketConstituentAccountSubscriber_1.WebSocketConstituentAccountSubscriber(this, this.velocityClient.program, config.subscriptionConfig.resubTimeoutMs, config.subscriptionConfig.commitment, this.getFilters());
|
|
33
33
|
}
|
|
34
|
+
else {
|
|
35
|
+
throw new Error(`ConstituentMap: unsupported subscriptionConfig type: ${config.subscriptionConfig.type}`);
|
|
36
|
+
}
|
|
34
37
|
// Listen for account updates from the subscriber
|
|
35
38
|
this.constituentAccountSubscriber.eventEmitter.on('onAccountUpdate', (account, pubkey, slot) => {
|
|
36
39
|
this.updateConstituentAccount(pubkey.toString(), account, slot);
|
|
@@ -91,7 +94,8 @@ class ConstituentMap {
|
|
|
91
94
|
await Promise.all(promises);
|
|
92
95
|
}
|
|
93
96
|
catch (error) {
|
|
94
|
-
|
|
97
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
98
|
+
console.log(`ConstituentMap.sync() error: ${message}`);
|
|
95
99
|
}
|
|
96
100
|
}
|
|
97
101
|
async subscribe() {
|
|
@@ -34,8 +34,9 @@ class PollingConstituentAccountSubscriber {
|
|
|
34
34
|
this.eventEmitter.emit('update');
|
|
35
35
|
}
|
|
36
36
|
catch (error) {
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
38
|
+
console.log(`PollingConstituentAccountSubscriber.sync() error: ${normalizedError.message}`);
|
|
39
|
+
this.eventEmitter.emit('error', normalizedError);
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
async unsubscribe() {
|
|
@@ -4,8 +4,6 @@ import { VelocityProgram } from '../config';
|
|
|
4
4
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
5
5
|
import { EventEmitter } from 'events';
|
|
6
6
|
import { Commitment, MemcmpFilter } from '@solana/web3.js';
|
|
7
|
-
import { ConstituentAccount } from '../types';
|
|
8
|
-
import { WebSocketProgramAccountSubscriber } from '../accounts/webSocketProgramAccountSubscriber';
|
|
9
7
|
import { ConstituentMap } from './constituentMap';
|
|
10
8
|
export declare class WebSocketConstituentAccountSubscriber implements ConstituentAccountSubscriber {
|
|
11
9
|
isSubscribed: boolean;
|
|
@@ -13,7 +11,8 @@ export declare class WebSocketConstituentAccountSubscriber implements Constituen
|
|
|
13
11
|
commitment?: Commitment;
|
|
14
12
|
program: VelocityProgram;
|
|
15
13
|
eventEmitter: StrictEventEmitter<EventEmitter, ConstituentAccountEvents>;
|
|
16
|
-
|
|
14
|
+
private _constituentDataAccountSubscriber?;
|
|
15
|
+
private get constituentDataAccountSubscriber();
|
|
17
16
|
constituentMap: ConstituentMap;
|
|
18
17
|
private additionalFilters?;
|
|
19
18
|
constructor(constituentMap: ConstituentMap, program: VelocityProgram, resubTimeoutMs?: number, commitment?: Commitment, additionalFilters?: MemcmpFilter[]);
|