@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlotSubscriber.d.ts","sourceRoot":"","sources":["../../../src/slot/SlotSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,kBAAkB,MAAM,sCAAsC,CAAC;AAGtE,KAAK,oBAAoB,GAAG;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACpC,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,qBAAa,cAAc;IAYzB,OAAO,CAAC,UAAU;IAXnB,WAAW,
|
|
1
|
+
{"version":3,"file":"SlotSubscriber.d.ts","sourceRoot":"","sources":["../../../src/slot/SlotSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,kBAAkB,MAAM,sCAAsC,CAAC;AAGtE,KAAK,oBAAoB,GAAG;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACpC,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,qBAAa,cAAc;IAYzB,OAAO,CAAC,UAAU;IAXnB,WAAW,SAAK;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,kBAAkB,CAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC;IAGrE,SAAS,CAAC,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;IAC1C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,UAAS;IACxB,aAAa,UAAS;gBAGb,UAAU,EAAE,UAAU,EAC9B,MAAM,CAAC,EAAE,oBAAoB;IAWjB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IA2BvC,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,UAAU;IAkBX,OAAO,IAAI,MAAM;IAIX,WAAW,CAAC,OAAO,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAgBxD"}
|
|
@@ -5,11 +5,12 @@ const events_1 = require("events");
|
|
|
5
5
|
class SlotSubscriber {
|
|
6
6
|
constructor(connection, config) {
|
|
7
7
|
this.connection = connection;
|
|
8
|
+
this.currentSlot = 0;
|
|
8
9
|
this.isUnsubscribing = false;
|
|
9
10
|
this.receivingData = false;
|
|
10
11
|
this.eventEmitter = new events_1.EventEmitter();
|
|
11
12
|
this.resubTimeoutMs = config === null || config === void 0 ? void 0 : config.resubTimeoutMs;
|
|
12
|
-
if (this.resubTimeoutMs < 1000) {
|
|
13
|
+
if (this.resubTimeoutMs !== undefined && this.resubTimeoutMs < 1000) {
|
|
13
14
|
console.log('resubTimeoutMs should be at least 1000ms to avoid spamming resub');
|
|
14
15
|
}
|
|
15
16
|
}
|
|
@@ -9,8 +9,9 @@ export type Slothash = {
|
|
|
9
9
|
};
|
|
10
10
|
export declare class SlothashSubscriber {
|
|
11
11
|
private connection;
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
private _currentSlothash?;
|
|
13
|
+
private get currentSlothash();
|
|
14
|
+
subscriptionId?: number;
|
|
14
15
|
commitment: Commitment;
|
|
15
16
|
timeoutId?: ReturnType<typeof setTimeout>;
|
|
16
17
|
resubTimeoutMs?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlothashSubscriber.d.ts","sourceRoot":"","sources":["../../../src/slot/SlothashSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,UAAU,EACV,UAAU,EAEV,MAAM,iBAAiB,CAAC;AAKzB,KAAK,wBAAwB,GAAG;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,qBAAa,kBAAkB;
|
|
1
|
+
{"version":3,"file":"SlothashSubscriber.d.ts","sourceRoot":"","sources":["../../../src/slot/SlothashSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,UAAU,EACV,UAAU,EAEV,MAAM,iBAAiB,CAAC;AAKzB,KAAK,wBAAwB,GAAG;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,qBAAa,kBAAkB;IAoB7B,OAAO,CAAC,UAAU;IAnBnB,OAAO,CAAC,gBAAgB,CAAC,CAAW;IACpC,OAAO,KAAK,eAAe,GAO1B;IACD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,UAAU,CAAC;IAGvB,SAAS,CAAC,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;IAC1C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,UAAS;IACxB,aAAa,UAAS;gBAGb,UAAU,EAAE,UAAU,EAC9B,MAAM,CAAC,EAAE,wBAAwB;IAWrB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAsCvC,OAAO,CAAC,UAAU;IAkBX,WAAW,IAAI,QAAQ;IAIjB,WAAW,CAAC,OAAO,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAgBxD"}
|
|
@@ -8,6 +8,12 @@ const web3_js_1 = require("@solana/web3.js");
|
|
|
8
8
|
const bs58_1 = __importDefault(require("bs58"));
|
|
9
9
|
const anchor_1 = require("../isomorphic/anchor");
|
|
10
10
|
class SlothashSubscriber {
|
|
11
|
+
get currentSlothash() {
|
|
12
|
+
if (!this._currentSlothash) {
|
|
13
|
+
throw new Error('SlothashSubscriber: slothash accessed before subscribe()');
|
|
14
|
+
}
|
|
15
|
+
return this._currentSlothash;
|
|
16
|
+
}
|
|
11
17
|
constructor(connection, config) {
|
|
12
18
|
var _a;
|
|
13
19
|
this.connection = connection;
|
|
@@ -15,7 +21,7 @@ class SlothashSubscriber {
|
|
|
15
21
|
this.receivingData = false;
|
|
16
22
|
this.resubTimeoutMs = config === null || config === void 0 ? void 0 : config.resubTimeoutMs;
|
|
17
23
|
this.commitment = (_a = config === null || config === void 0 ? void 0 : config.commitment) !== null && _a !== void 0 ? _a : 'processed';
|
|
18
|
-
if (this.resubTimeoutMs < 1000) {
|
|
24
|
+
if (this.resubTimeoutMs != null && this.resubTimeoutMs < 1000) {
|
|
19
25
|
console.log('resubTimeoutMs should be at least 1000ms to avoid spamming resub');
|
|
20
26
|
}
|
|
21
27
|
}
|
|
@@ -27,15 +33,16 @@ class SlothashSubscriber {
|
|
|
27
33
|
if (currentAccountData == null) {
|
|
28
34
|
throw new Error('Failed to retrieve current slot hash');
|
|
29
35
|
}
|
|
30
|
-
this.
|
|
36
|
+
this._currentSlothash = deserializeSlothash(currentAccountData.data);
|
|
31
37
|
this.subscriptionId = this.connection.onAccountChange(web3_js_1.SYSVAR_SLOT_HASHES_PUBKEY, (slothashInfo, context) => {
|
|
32
|
-
if (!this.
|
|
38
|
+
if (!this._currentSlothash ||
|
|
39
|
+
this._currentSlothash.slot < context.slot) {
|
|
33
40
|
if (this.resubTimeoutMs && !this.isUnsubscribing) {
|
|
34
41
|
this.receivingData = true;
|
|
35
42
|
clearTimeout(this.timeoutId);
|
|
36
43
|
this.setTimeout();
|
|
37
44
|
}
|
|
38
|
-
this.
|
|
45
|
+
this._currentSlothash = deserializeSlothash(slothashInfo.data);
|
|
39
46
|
}
|
|
40
47
|
}, this.commitment);
|
|
41
48
|
if (this.resubTimeoutMs) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="bn.js" />
|
|
2
1
|
import { Connection, PublicKey, TransactionMessage, AddressLookupTableAccount, VersionedTransaction, TransactionInstruction } from '@solana/web3.js';
|
|
3
2
|
import { BN } from '../isomorphic/anchor';
|
|
4
3
|
import { JupiterClient } from '../jupiter/jupiterClient';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnifiedSwapClient.d.ts","sourceRoot":"","sources":["../../../src/swap/UnifiedSwapClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UnifiedSwapClient.d.ts","sourceRoot":"","sources":["../../../src/swap/UnifiedSwapClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,UAAU,EACV,SAAS,EACT,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,EACpB,sBAAsB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,EAAE,EAAE,MAAM,sBAAsB,C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AAE,CAAC;QACX,aAAa,EAAE,SAAS,CAAC;QACzB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;QACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,KAAK,CAAC,EAAE,oBAAoB,CAAC;QAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC;QACX,YAAY,EAAE,sBAAsB,EAAE,CAAC;QACvC,YAAY,EAAE,yBAAyB,EAAE,CAAC;KAC1C,CAAC;IAwEF;;OAEG;IACI,SAAS,IAAI,aAAa,GAAG,WAAW;IAI/C;;OAEG;IACI,aAAa,IAAI,cAAc;IAItC;;OAEG;IACI,SAAS,IAAI,OAAO;IAI3B;;OAEG;IACI,OAAO,IAAI,OAAO;CAGzB"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { grpcProgramAccountSubscriber } from '../accounts/grpcProgramAccountSubscriber';
|
|
2
1
|
import { GrpcConfigs } from '../accounts/types';
|
|
3
|
-
import { SignedMsgUserOrdersAccount } from '../types';
|
|
4
2
|
import { SignedMsgUserOrdersAccountSubscriber, SignedMsgUserOrdersAccountSubscriberConfig } from './signedMsgUserAccountSubscriber';
|
|
5
3
|
export declare class grpcSignedMsgUserOrdersAccountSubscriber extends SignedMsgUserOrdersAccountSubscriber {
|
|
6
4
|
private grpcConfigs;
|
|
7
|
-
subscriber: grpcProgramAccountSubscriber<SignedMsgUserOrdersAccount>;
|
|
8
5
|
constructor({ grpcConfigs, ...rest }: SignedMsgUserOrdersAccountSubscriberConfig & {
|
|
9
6
|
grpcConfigs: GrpcConfigs;
|
|
10
7
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpcSignedMsgUserAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/swift/grpcSignedMsgUserAccountSubscriber.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"grpcSignedMsgUserAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/swift/grpcSignedMsgUserAccountSubscriber.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EACN,oCAAoC,EACpC,0CAA0C,EAC1C,MAAM,kCAAkC,CAAC;AAE1C,qBAAa,wCAAyC,SAAQ,oCAAoC;IACjG,OAAO,CAAC,WAAW,CAAc;gBAErB,EACX,WAAW,EACX,GAAG,IAAI,EACP,EAAE,0CAA0C,GAAG;QAC/C,WAAW,EAAE,WAAW,CAAC;KACzB;IAKY,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAgD1B,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CASzC"}
|
|
@@ -10,8 +10,8 @@ class grpcSignedMsgUserOrdersAccountSubscriber extends signedMsgUserAccountSubsc
|
|
|
10
10
|
this.grpcConfigs = grpcConfigs;
|
|
11
11
|
}
|
|
12
12
|
async subscribe() {
|
|
13
|
-
if (!this.
|
|
14
|
-
this.
|
|
13
|
+
if (!this._subscriber) {
|
|
14
|
+
this._subscriber =
|
|
15
15
|
await grpcProgramAccountSubscriber_1.grpcProgramAccountSubscriber.create(this.grpcConfigs, 'SingedMsgUserOrdersAccountMap', 'signedMsgUserOrders', this.velocityClient.program, this.decodeFn, {
|
|
16
16
|
filters: [(0, memcmp_1.getSignedMsgUserOrdersFilter)()],
|
|
17
17
|
}, this.resubOpts);
|
|
@@ -38,10 +38,10 @@ class grpcSignedMsgUserOrdersAccountSubscriber extends signedMsgUserAccountSubsc
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
async unsubscribe() {
|
|
41
|
-
if (!this.
|
|
41
|
+
if (!this._subscriber)
|
|
42
42
|
return;
|
|
43
|
-
await this.
|
|
44
|
-
this.
|
|
43
|
+
await this._subscriber.unsubscribe();
|
|
44
|
+
this._subscriber = undefined;
|
|
45
45
|
if (this.resyncTimeoutId !== undefined) {
|
|
46
46
|
clearTimeout(this.resyncTimeoutId);
|
|
47
47
|
this.resyncTimeoutId = undefined;
|
|
@@ -33,8 +33,9 @@ export declare class SignedMsgUserOrdersAccountSubscriber {
|
|
|
33
33
|
}>;
|
|
34
34
|
mostRecentSlot: number;
|
|
35
35
|
fetchPromise?: Promise<void>;
|
|
36
|
-
fetchPromiseResolver
|
|
37
|
-
protected
|
|
36
|
+
private fetchPromiseResolver;
|
|
37
|
+
protected _subscriber?: WebSocketProgramAccountSubscriber<SignedMsgUserOrdersAccount>;
|
|
38
|
+
protected get subscriber(): WebSocketProgramAccountSubscriber<SignedMsgUserOrdersAccount>;
|
|
38
39
|
eventEmitter: StrictEventEmitter<EventEmitter, SignedMsgUserOrdersAccountSubscriberEvents>;
|
|
39
40
|
constructor({ velocityClient, commitment, resubOpts, decodeFn, resyncIntervalMs, }: SignedMsgUserOrdersAccountSubscriberConfig);
|
|
40
41
|
subscribe(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signedMsgUserAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/swift/signedMsgUserAccountSubscriber.ts"],"names":[],"mappings":";;;AACA,OAAO,EAAE,iCAAiC,EAAE,MAAM,+CAA+C,CAAC;AAClG,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,UAAU,EAAW,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,MAAM,MAAM,0CAA0C,GAAG;IACxD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,0BAA0B,CAAC;IACtE,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG;IAAE,cAAc,EAAE,cAAc,CAAA;CAAE,CAAC;AAEvC,MAAM,WAAW,0CAA0C;IAC1D,eAAe,EAAE,CAChB,uBAAuB,EAAE,gBAAgB,EAAE,EAC3C,eAAe,EAAE,SAAS,EAC1B,IAAI,EAAE,MAAM,KACR,IAAI,CAAC;IAEV,oBAAoB,EAAE,CACrB,oBAAoB,EAAE,gBAAgB,EAAE,EACxC,eAAe,EAAE,SAAS,EAC1B,IAAI,EAAE,MAAM,KACR,IAAI,CAAC;CACV;AAED,qBAAa,oCAAoC;IAChD,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC;IACzC,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC;IACjC,SAAS,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAChC,SAAS,CAAC,eAAe,CAAC,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;IAC1D,SAAS,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACpC,SAAS,CAAC,QAAQ,EAAE,CACnB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,KACR,0BAA0B,CAAC;IACzB,0BAA0B;cAExB,MAAM;oCAA8B,0BAA0B;OACnE;IACJ,cAAc,
|
|
1
|
+
{"version":3,"file":"signedMsgUserAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/swift/signedMsgUserAccountSubscriber.ts"],"names":[],"mappings":";;;AACA,OAAO,EAAE,iCAAiC,EAAE,MAAM,+CAA+C,CAAC;AAClG,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,UAAU,EAAW,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,mB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AAC,EAAE,iCAAiC,CAAC,0BAA0B,CAAC,CAAC;IACtF,SAAS,KAAK,UAAU,IAAI,iCAAiC,CAAC,0BAA0B,CAAC,CAOxF;IACM,YAAY,EAAE,kBAAkB,CACtC,YAAY,EACZ,0CAA0C,CAC1C,CAAC;gBAEU,EACX,cAAc,EACd,UAAU,EACV,SAAS,EACT,QAAQ,EACR,gBAAgB,GAChB,EAAE,0CAA0C;IAkBhC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAmDjC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA0C5B,mCAAmC,CAClC,IAAI,EAAE,MAAM,GAAG,0BAA0B,EACzC,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAC9B,IAAI,EAAE,MAAM,EACZ,iBAAiB,UAAQ,GACvB,IAAI;IAwDM,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CASzC"}
|
|
@@ -5,8 +5,16 @@ const memcmp_1 = require("../memcmp");
|
|
|
5
5
|
const webSocketProgramAccountSubscriber_1 = require("../accounts/webSocketProgramAccountSubscriber");
|
|
6
6
|
const events_1 = require("events");
|
|
7
7
|
class SignedMsgUserOrdersAccountSubscriber {
|
|
8
|
+
get subscriber() {
|
|
9
|
+
if (!this._subscriber) {
|
|
10
|
+
throw new Error('SignedMsgUserOrdersAccountSubscriber: subscriber accessed before subscribe()');
|
|
11
|
+
}
|
|
12
|
+
return this._subscriber;
|
|
13
|
+
}
|
|
8
14
|
constructor({ velocityClient, commitment, resubOpts, decodeFn, resyncIntervalMs, }) {
|
|
9
15
|
this.signedMsgUserOrderAccounts = new Map();
|
|
16
|
+
this.mostRecentSlot = 0;
|
|
17
|
+
this.fetchPromiseResolver = () => { };
|
|
10
18
|
this.commitment = commitment !== null && commitment !== void 0 ? commitment : 'confirmed';
|
|
11
19
|
this.resubOpts = resubOpts;
|
|
12
20
|
// Type-system guarantees at least one of the two is supplied.
|
|
@@ -19,9 +27,9 @@ class SignedMsgUserOrdersAccountSubscriber {
|
|
|
19
27
|
this.resubOpts = resubOpts;
|
|
20
28
|
}
|
|
21
29
|
async subscribe() {
|
|
22
|
-
if (!this.
|
|
30
|
+
if (!this._subscriber) {
|
|
23
31
|
const filters = [(0, memcmp_1.getSignedMsgUserOrdersFilter)()];
|
|
24
|
-
this.
|
|
32
|
+
this._subscriber =
|
|
25
33
|
new webSocketProgramAccountSubscriber_1.WebSocketProgramAccountSubscriber('SingedMsgUserOrdersAccountMap', 'signedMsgUserOrders', this.velocityClient.program, this.decodeFn, {
|
|
26
34
|
filters,
|
|
27
35
|
commitment: this.commitment,
|
|
@@ -106,10 +114,10 @@ class SignedMsgUserOrdersAccountSubscriber {
|
|
|
106
114
|
}
|
|
107
115
|
}
|
|
108
116
|
async unsubscribe() {
|
|
109
|
-
if (!this.
|
|
117
|
+
if (!this._subscriber)
|
|
110
118
|
return;
|
|
111
|
-
await this.
|
|
112
|
-
this.
|
|
119
|
+
await this._subscriber.unsubscribe();
|
|
120
|
+
this._subscriber = undefined;
|
|
113
121
|
if (this.resyncTimeoutId !== undefined) {
|
|
114
122
|
clearTimeout(this.resyncTimeoutId);
|
|
115
123
|
this.resyncTimeoutId = undefined;
|
|
@@ -52,7 +52,7 @@ export declare class SwiftOrderSubscriber {
|
|
|
52
52
|
private ws;
|
|
53
53
|
private velocityClient;
|
|
54
54
|
userAccountGetter?: AccountGetter;
|
|
55
|
-
onOrder
|
|
55
|
+
onOrder?: (orderMessageRaw: SwiftOrderMessage, signedMessage: SignedMsgOrderParamsMessage | SignedMsgOrderParamsDelegateMessage, isDelegateSigner?: boolean) => Promise<void>;
|
|
56
56
|
subscribed: boolean;
|
|
57
57
|
constructor(config: SwiftOrderSubscriberConfig);
|
|
58
58
|
unsubscribe(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swiftOrderSubscriber.d.ts","sourceRoot":"","sources":["../../../src/swift/swiftOrderSubscriber.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAA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@ class SwiftOrderSubscriber {
|
|
|
24
24
|
this.userAccountGetter = config.userAccountGetter;
|
|
25
25
|
}
|
|
26
26
|
unsubscribe() {
|
|
27
|
+
var _a, _b;
|
|
27
28
|
if (this.subscribed) {
|
|
28
|
-
this.ws.removeAllListeners();
|
|
29
|
-
this.ws.terminate();
|
|
29
|
+
(_a = this.ws) === null || _a === void 0 ? void 0 : _a.removeAllListeners();
|
|
30
|
+
(_b = this.ws) === null || _b === void 0 ? void 0 : _b.terminate();
|
|
30
31
|
this.ws = null;
|
|
31
32
|
this.subscribed = false;
|
|
32
33
|
}
|
|
@@ -124,8 +125,8 @@ class SwiftOrderSubscriber {
|
|
|
124
125
|
this.reconnect();
|
|
125
126
|
}, 5000);
|
|
126
127
|
});
|
|
127
|
-
ws.on('error', async (
|
|
128
|
-
console.error('WS closed from error, reconnecting in 1s:',
|
|
128
|
+
ws.on('error', async (error) => {
|
|
129
|
+
console.error('WS closed from error, reconnecting in 1s:', error);
|
|
129
130
|
setTimeout(() => {
|
|
130
131
|
if (this.heartbeatTimeout)
|
|
131
132
|
clearTimeout(this.heartbeatTimeout);
|
|
@@ -181,8 +182,12 @@ class SwiftOrderSubscriber {
|
|
|
181
182
|
this.ws.terminate();
|
|
182
183
|
}
|
|
183
184
|
console.log('Reconnecting to WebSocket...');
|
|
185
|
+
const onOrder = this.onOrder;
|
|
186
|
+
if (!onOrder) {
|
|
187
|
+
throw new Error('onOrder callback function must be set');
|
|
188
|
+
}
|
|
184
189
|
setTimeout(() => {
|
|
185
|
-
this.subscribe(
|
|
190
|
+
this.subscribe(onOrder);
|
|
186
191
|
}, 1000);
|
|
187
192
|
}
|
|
188
193
|
}
|
package/lib/node/testClient.js
CHANGED
|
@@ -4,8 +4,9 @@ exports.TestClient = void 0;
|
|
|
4
4
|
const adminClient_1 = require("./adminClient");
|
|
5
5
|
class TestClient extends adminClient_1.AdminClient {
|
|
6
6
|
constructor(config) {
|
|
7
|
+
var _a;
|
|
7
8
|
config.txVersion = 'legacy';
|
|
8
|
-
if (config.accountSubscription.type !== 'polling') {
|
|
9
|
+
if (((_a = config.accountSubscription) === null || _a === void 0 ? void 0 : _a.type) !== 'polling') {
|
|
9
10
|
throw new Error('Test client must be polling');
|
|
10
11
|
}
|
|
11
12
|
super(config);
|
|
@@ -14,7 +15,7 @@ class TestClient extends adminClient_1.AdminClient {
|
|
|
14
15
|
const { txSig, slot } = await super.sendTransaction(tx, additionalSigners, opts, preSigned);
|
|
15
16
|
let lastFetchedSlot = this.accountSubscriber.accountLoader.mostRecentSlot;
|
|
16
17
|
await this.fetchAccounts();
|
|
17
|
-
while (lastFetchedSlot < slot) {
|
|
18
|
+
while (slot !== undefined && lastFetchedSlot < slot) {
|
|
18
19
|
await this.fetchAccounts();
|
|
19
20
|
lastFetchedSlot = this.accountSubscriber.accountLoader.mostRecentSlot;
|
|
20
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"titanClient.d.ts","sourceRoot":"","sources":["../../../src/titan/titanClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"titanClient.d.ts","sourceRoot":"","sources":["../../../src/titan/titanClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,UAAU,EACV,SAAS,EACT,kBAAkB,EAClB,yBAAyB,EACzB,sBAAsB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,EAAE,EAAE,MAAM,sBAAsB,CAAC;AAG1C,oBAAY,QAAQ;IACnB,OAAO,YAAY;IACnB,QAAQ,aAAa;CACrB;AA6DD,MAAM,WAAW,aAAa;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAA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E,CAAC;QACxB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,qBAAqB,CAAC,EAAE,MAAM,CAAC;KAC/B,GAAG,OAAO,CAAC,aAAa,CAAC;IA4F1B;;OAEG;IACU,OAAO,CAAC,EACpB,aAAa,GACb,EAAE;QACF,SAAS,CAAC,EAAE,SAAS,CAAC;QACtB,UAAU,CAAC,EAAE,SAAS,CAAC;QACvB,MAAM,CAAC,EAAE,EAAE,CAAC;QACZ,aAAa,EAAE,SAAS,CAAC;QACzB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;QACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;QACxB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,qBAAqB,CAAC,EAAE,MAAM,CAAC;KAC/B,GAAG,OAAO,CAAC;QACX,kBAAkB,EAAE,kBAAkB,CAAC;QACvC,YAAY,EAAE,yBAAyB,EAAE,CAAC;KAC1C,CAAC;IAoCF;;;;;OAKG;IACI,oBAAoB,CAAC,EAC3B,kBAAkB,EAClB,SAAS,EACT,UAAU,GACV,EAAE;QACF,kBAAkB,EAAE,kBAAkB,CAAC;QACvC,SAAS,EAAE,SAAS,CAAC;QACrB,UAAU,EAAE,SAAS,CAAC;KACtB,GAAG,sBAAsB,EAAE;YAmCd,oCAAoC;CA+ClD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenFaucet.d.ts","sourceRoot":"","sources":["../../src/tokenFaucet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tokenFaucet.d.ts","sourceRoot":"","sources":["../../src/tokenFaucet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAO,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAC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AAC;IA2ChC,iDAAiD,CAC7D,aAAa,EAAE,SAAS,EACxB,MAAM,EAAE,EAAE,GACR,OAAO,CAAC,CAAC,SAAS,EAAE,sBAAsB,EAAE,sBAAsB,CAAC,CAAC;IAmB1D,gCAAgC,CAAC,KAAK,EAAE;QACpD,UAAU,EAAE,SAAS,CAAC;KACtB,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;IAMrB,mBAAmB,CAAC,KAAK,EAAE;QACvC,UAAU,EAAE,SAAS,CAAC;KACtB,GAAG,OAAO,CAAC,OAAO,CAAC;IAQP,uBAAuB,CAAC,KAAK,EAAE;QAC3C,UAAU,EAAE,SAAS,CAAC;QACtB,QAAQ,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAC;KACzC,GAAG,OAAO,CAAC,OAAO,CAAC;CA0BpB"}
|
package/lib/node/tokenFaucet.js
CHANGED
|
@@ -75,6 +75,9 @@ class TokenFaucet {
|
|
|
75
75
|
},
|
|
76
76
|
});
|
|
77
77
|
const tx = new web3_js_1.Transaction().add(ix);
|
|
78
|
+
if (!this.context) {
|
|
79
|
+
throw new Error('TokenFaucet: initialize() requires a BankrunContextWrapper context');
|
|
80
|
+
}
|
|
78
81
|
const txSig = await this.context.sendTransaction(tx);
|
|
79
82
|
return txSig;
|
|
80
83
|
}
|
|
@@ -99,6 +102,9 @@ class TokenFaucet {
|
|
|
99
102
|
return await this.context.sendTransaction(tx);
|
|
100
103
|
}
|
|
101
104
|
else {
|
|
105
|
+
if (!this.program.provider.sendAndConfirm) {
|
|
106
|
+
throw new Error('TokenFaucet: program provider does not support sendAndConfirm');
|
|
107
|
+
}
|
|
102
108
|
return await this.program.provider.sendAndConfirm(tx, [], this.opts);
|
|
103
109
|
}
|
|
104
110
|
}
|
|
@@ -132,7 +138,9 @@ class TokenFaucet {
|
|
|
132
138
|
const [associatedTokenPublicKey, createAssociatedAccountIx, mintToTx] = await this.createAssociatedTokenAccountAndMintToInstructions(userPublicKey, amount);
|
|
133
139
|
let associatedTokenAccountExists = false;
|
|
134
140
|
try {
|
|
135
|
-
const assosciatedTokenAccount =
|
|
141
|
+
const assosciatedTokenAccount = this.context
|
|
142
|
+
? await this.context.connection.getAccountInfo(associatedTokenPublicKey)
|
|
143
|
+
: await this.connection.getAccountInfo(associatedTokenPublicKey);
|
|
136
144
|
associatedTokenAccountExists = !!assosciatedTokenAccount;
|
|
137
145
|
}
|
|
138
146
|
catch (e) {
|
|
@@ -148,6 +156,9 @@ class TokenFaucet {
|
|
|
148
156
|
txSig = await this.context.sendTransaction(tx);
|
|
149
157
|
}
|
|
150
158
|
else {
|
|
159
|
+
if (!this.program.provider.sendAndConfirm) {
|
|
160
|
+
throw new Error('TokenFaucet: program provider does not support sendAndConfirm');
|
|
161
|
+
}
|
|
151
162
|
txSig = await this.program.provider.sendAndConfirm(tx, [], this.opts);
|
|
152
163
|
}
|
|
153
164
|
return [associatedTokenPublicKey, txSig];
|
|
@@ -175,7 +186,10 @@ class TokenFaucet {
|
|
|
175
186
|
const tokenAccountKey = await this.getAssosciatedMockUSDMintAddress(props);
|
|
176
187
|
props.callback(await this.getTokenAccountInfo(props));
|
|
177
188
|
// Couldn't find a way to do it using anchor framework subscription — fall back to onAccountChange.
|
|
178
|
-
this.context
|
|
189
|
+
const subscribeConnection = this.context
|
|
190
|
+
? this.context.connection
|
|
191
|
+
: this.connection;
|
|
192
|
+
subscribeConnection.onAccountChange(tokenAccountKey, async (_accountInfo /* accountInfo is a buffer which we don't know how to deserialize */) => {
|
|
179
193
|
props.callback(await this.getTokenAccountInfo(props));
|
|
180
194
|
});
|
|
181
195
|
return true;
|
|
@@ -13,7 +13,7 @@ export declare abstract class BaseTxSender implements TxSender {
|
|
|
13
13
|
additionalConnections: Connection[];
|
|
14
14
|
timeoutCount: number;
|
|
15
15
|
confirmationStrategy: ConfirmationStrategy;
|
|
16
|
-
additionalTxSenderCallbacks
|
|
16
|
+
additionalTxSenderCallbacks?: ((base58EncodedTx: string) => void)[];
|
|
17
17
|
txHandler: TxHandler;
|
|
18
18
|
trackTxLandRate?: boolean;
|
|
19
19
|
throwOnTimeoutError: boolean;
|
|
@@ -28,7 +28,7 @@ export declare abstract class BaseTxSender implements TxSender {
|
|
|
28
28
|
wallet: IWallet;
|
|
29
29
|
opts?: ConfirmOptions;
|
|
30
30
|
timeout?: number;
|
|
31
|
-
additionalConnections?:
|
|
31
|
+
additionalConnections?: Connection[];
|
|
32
32
|
confirmationStrategy?: ConfirmationStrategy;
|
|
33
33
|
additionalTxSenderCallbacks?: ((base58EncodedTx: string) => void)[];
|
|
34
34
|
txHandler?: TxHandler;
|
|
@@ -44,9 +44,9 @@ export declare abstract class BaseTxSender implements TxSender {
|
|
|
44
44
|
sendVersionedTransaction(tx: VersionedTransaction, additionalSigners?: Array<Signer>, opts?: ConfirmOptions, preSigned?: boolean): Promise<TxSigAndSlot>;
|
|
45
45
|
sendRawTransaction(rawTransaction: Buffer | Uint8Array, opts: ConfirmOptions): Promise<TxSigAndSlot>;
|
|
46
46
|
simulateTransaction(tx: VersionedTransaction): Promise<boolean>;
|
|
47
|
-
confirmTransactionWebSocket(signature: TransactionSignature, commitment?: Commitment): Promise<RpcResponseAndContext<SignatureResult
|
|
47
|
+
confirmTransactionWebSocket(signature: TransactionSignature, commitment?: Commitment): Promise<RpcResponseAndContext<SignatureResult> | undefined>;
|
|
48
48
|
confirmTransactionPolling(signature: TransactionSignature, commitment?: Commitment): Promise<RpcResponseAndContext<SignatureResult> | undefined>;
|
|
49
|
-
confirmTransaction(signature: TransactionSignature, commitment?: Commitment): Promise<RpcResponseAndContext<SignatureResult
|
|
49
|
+
confirmTransaction(signature: TransactionSignature, commitment?: Commitment): Promise<RpcResponseAndContext<SignatureResult> | undefined>;
|
|
50
50
|
getTimestamp(): number;
|
|
51
51
|
promiseTimeout<T>(promises: Promise<T>[], timeoutMs: number): Promise<T | null>;
|
|
52
52
|
sendToAdditionalConnections(rawTx: Buffer | Uint8Array, opts: ConfirmOptions): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseTxSender.d.ts","sourceRoot":"","sources":["../../../src/tx/baseTxSender.ts"],"names":[],"mappings":";;AAAA,OAAO,EACN,oBAAoB,EACpB,QAAQ,EAER,YAAY,EACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,UAAU,EACV,cAAc,EAEd,qBAAqB,EACrB,MAAM,EACN,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,UAAU,EACV,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,EACzB,8BAA8B,EAC9B,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,SAAS,MAAM,YAAY,CAAC;AASnC,8BAAsB,YAAa,YAAW,QAAQ;IACrD,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,qBAAqB,EAAE,UAAU,EAAE,CAAC;IACpC,YAAY,SAAK;IACjB,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,2BAA2B,EAAE,CAAC,CAAC,eAAe,EAAE,MAAM,KAAK,IAAI,CAAC,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"baseTxSender.d.ts","sourceRoot":"","sources":["../../../src/tx/baseTxSender.ts"],"names":[],"mappings":";;AAAA,OAAO,EACN,oBAAoB,EACpB,QAAQ,EAER,YAAY,EACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,UAAU,EACV,cAAc,EAEd,qBAAqB,EACrB,MAAM,EACN,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,UAAU,EACV,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,EACzB,8BAA8B,EAC9B,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,SAA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BAA2B,CAChC,SAAS,EAAE,oBAAoB,EAC/B,UAAU,CAAC,EAAE,UAAU,GACrB,OAAO,CAAC,qBAAqB,CAAC,eAAe,CAAC,GAAG,SAAS,CAAC;IAmFxD,yBAAyB,CAC9B,SAAS,EAAE,oBAAoB,EAC/B,UAAU,GAAE,UAAwB,GAClC,OAAO,CAAC,qBAAqB,CAAC,eAAe,CAAC,GAAG,SAAS,CAAC;IAuCxD,kBAAkB,CACvB,SAAS,EAAE,oBAAoB,EAC/B,UAAU,CAAC,EAAE,UAAU,GACrB,OAAO,CAAC,qBAAqB,CAAC,eAAe,CAAC,GAAG,SAAS,CAAC;IAW9D,YAAY,IAAI,MAAM;IAItB,cAAc,CAAC,CAAC,EACf,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,EACtB,SAAS,EAAE,MAAM,GACf,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAcpB,2BAA2B,CAC1B,KAAK,EAAE,MAAM,GAAG,UAAU,EAC1B,IAAI,EAAE,cAAc,GAClB,IAAI;IAeA,uBAAuB,CAAC,aAAa,EAAE,UAAU,GAAG,IAAI;IAYxD,eAAe,IAAI,MAAM;IAInB,+BAA+B,CAC3C,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,eAAe,GACrB,OAAO,CAAC,IAAI,CAAC;IAYT,aAAa,IAAI,MAAM;IAoB9B,OAAO,CAAC,wBAAwB;IAYzB,iCAAiC,IAAI,MAAM;CAMlD"}
|
|
@@ -74,7 +74,7 @@ class BaseTxSender {
|
|
|
74
74
|
signedTx = tx;
|
|
75
75
|
}
|
|
76
76
|
else {
|
|
77
|
-
signedTx = await this.txHandler.signVersionedTx(tx, additionalSigners, undefined, this.wallet);
|
|
77
|
+
signedTx = await this.txHandler.signVersionedTx(tx, additionalSigners !== null && additionalSigners !== void 0 ? additionalSigners : [], undefined, this.wallet);
|
|
78
78
|
}
|
|
79
79
|
if (opts === undefined) {
|
|
80
80
|
opts = this.opts;
|
|
@@ -172,7 +172,7 @@ class BaseTxSender {
|
|
|
172
172
|
throw new types_1.TxSendError(`Transaction was not confirmed in ${duration.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${signature} using the Solana Explorer or CLI tools.`, txConstants_1.NOT_CONFIRMED_ERROR_CODE);
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
return response;
|
|
175
|
+
return response !== null && response !== void 0 ? response : undefined;
|
|
176
176
|
}
|
|
177
177
|
async confirmTransactionPolling(signature, commitment = 'finalized') {
|
|
178
178
|
var _a;
|
|
@@ -256,7 +256,7 @@ class BaseTxSender {
|
|
|
256
256
|
return;
|
|
257
257
|
}
|
|
258
258
|
getTxLandRate() {
|
|
259
|
-
if (!this.trackTxLandRate) {
|
|
259
|
+
if (!this.trackTxLandRate || !this.txSigCache) {
|
|
260
260
|
return this.txLandRate;
|
|
261
261
|
}
|
|
262
262
|
const keys = this.txSigCache.keys();
|
|
@@ -275,8 +275,9 @@ class BaseTxSender {
|
|
|
275
275
|
return this.txLandRate;
|
|
276
276
|
}
|
|
277
277
|
defaultLandRateToFeeFunc(txLandRate) {
|
|
278
|
+
var _a, _b;
|
|
278
279
|
if (txLandRate >= BASELINE_TX_LAND_RATE ||
|
|
279
|
-
this.txSigCache.keys().length < 3) {
|
|
280
|
+
((_b = (_a = this.txSigCache) === null || _a === void 0 ? void 0 : _a.keys().length) !== null && _b !== void 0 ? _b : 0) < 3) {
|
|
280
281
|
return 1;
|
|
281
282
|
}
|
|
282
283
|
const multiplier = 10 * Math.log10(1 + (BASELINE_TX_LAND_RATE - txLandRate) * 5);
|
|
@@ -14,18 +14,18 @@ export declare class FastSingleTxSender extends BaseTxSender {
|
|
|
14
14
|
blockhashRefreshInterval: number;
|
|
15
15
|
additionalConnections: Connection[];
|
|
16
16
|
timoutCount: number;
|
|
17
|
-
recentBlockhash
|
|
17
|
+
recentBlockhash?: BlockhashWithExpiryBlockHeight;
|
|
18
18
|
skipConfirmation: boolean;
|
|
19
19
|
confirmInBackground: boolean;
|
|
20
20
|
blockhashCommitment: Commitment;
|
|
21
|
-
blockhashIntervalId
|
|
21
|
+
blockhashIntervalId?: NodeJS.Timer;
|
|
22
22
|
constructor({ connection, wallet, opts, timeout, blockhashRefreshInterval, additionalConnections, skipConfirmation, confirmInBackground, blockhashCommitment, confirmationStrategy, trackTxLandRate, txHandler, txLandRateLookbackWindowMinutes, landRateToFeeFunc, throwOnTimeoutError, }: {
|
|
23
23
|
connection: Connection;
|
|
24
24
|
wallet: IWallet;
|
|
25
25
|
opts?: ConfirmOptions;
|
|
26
26
|
timeout?: number;
|
|
27
27
|
blockhashRefreshInterval?: number;
|
|
28
|
-
additionalConnections?:
|
|
28
|
+
additionalConnections?: Connection[];
|
|
29
29
|
skipConfirmation?: boolean;
|
|
30
30
|
confirmInBackground?: boolean;
|
|
31
31
|
blockhashCommitment?: Commitment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastSingleTxSender.d.ts","sourceRoot":"","sources":["../../../src/tx/fastSingleTxSender.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EACN,cAAc,EAEd,UAAU,EACV,UAAU,EACV,8BAA8B,EAC9B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAMnC,qBAAa,kBAAmB,SAAQ,YAAY;IACnD,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,wBAAwB,EAAE,MAAM,CAAC;IACjC,qBAAqB,EAAE,UAAU,EAAE,CAAC;IACpC,WAAW,SAAK;IAChB,eAAe,EAAE,8BAA8B,C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;QAClC,qBAAqB,CAAC,EAAE,UAAU,EAAE,CAAC;QACrC,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAC;QAC9B,mBAAmB,CAAC,EAAE,UAAU,CAAC;QACjC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;QAC5C,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,SAAS,CAAC,EAAE,SAAS,CAAC;QACtB,+BAA+B,CAAC,EAAE,MAAM,CAAC;QACzC,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;QACjD,mBAAmB,CAAC,EAAE,OAAO,CAAC;KAC9B;IA0BD,yBAAyB,IAAI,IAAI;IAc3B,kBAAkB,CACvB,cAAc,EAAE,MAAM,GAAG,UAAU,EACnC,IAAI,EAAE,cAAc,GAClB,OAAO,CAAC,YAAY,CAAC;CAwCxB"}
|
|
@@ -46,7 +46,7 @@ class FastSingleTxSender extends baseTxSender_1.BaseTxSender {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
async sendRawTransaction(rawTransaction, opts) {
|
|
49
|
-
var _a, _b
|
|
49
|
+
var _a, _b;
|
|
50
50
|
let txid;
|
|
51
51
|
try {
|
|
52
52
|
txid = await this.connection.sendRawTransaction(rawTransaction, opts);
|
|
@@ -64,15 +64,19 @@ class FastSingleTxSender extends baseTxSender_1.BaseTxSender {
|
|
|
64
64
|
this.confirmTransaction(txid, opts.commitment).then(async (result) => {
|
|
65
65
|
var _a;
|
|
66
66
|
(_a = this.txSigCache) === null || _a === void 0 ? void 0 : _a.set(txid, true);
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
if (result) {
|
|
68
|
+
await this.checkConfirmationResultForError(txid, result.value);
|
|
69
|
+
slot = result.context.slot;
|
|
70
|
+
}
|
|
69
71
|
});
|
|
70
72
|
}
|
|
71
73
|
else {
|
|
72
74
|
const result = await this.confirmTransaction(txid, opts.commitment);
|
|
73
75
|
(_b = this.txSigCache) === null || _b === void 0 ? void 0 : _b.set(txid, true);
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
if (result) {
|
|
77
|
+
await this.checkConfirmationResultForError(txid, result.value);
|
|
78
|
+
slot = result.context.slot;
|
|
79
|
+
}
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
82
|
catch (e) {
|
|
@@ -16,6 +16,6 @@ export declare const throwTransactionError: (txSig: string, connection: Connecti
|
|
|
16
16
|
* @param connection
|
|
17
17
|
* @returns
|
|
18
18
|
*/
|
|
19
|
-
export declare const getTransactionErrorFromTxSig: (txSig: string, connection: Connection, commitment?: Commitment) => Promise<SendTransactionError>;
|
|
20
|
-
export declare const getTransactionError: (transactionResult: VersionedTransactionResponse) => SendTransactionError;
|
|
19
|
+
export declare const getTransactionErrorFromTxSig: (txSig: string, connection: Connection, commitment?: Commitment) => Promise<SendTransactionError | undefined>;
|
|
20
|
+
export declare const getTransactionError: (transactionResult: VersionedTransactionResponse) => SendTransactionError | undefined;
|
|
21
21
|
//# sourceMappingURL=reportTransactionError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reportTransactionError.d.ts","sourceRoot":"","sources":["../../../src/tx/reportTransactionError.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,UAAU,EACV,UAAU,EAEV,oBAAoB,EACpB,4BAA4B,EAC5B,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"reportTransactionError.d.ts","sourceRoot":"","sources":["../../../src/tx/reportTransactionError.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,UAAU,EACV,UAAU,EAEV,oBAAoB,EACpB,4BAA4B,EAC5B,MAAM,iBAAiB,CAAC;AA8EzB;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,UAC1B,MAAM,cACD,UAAU,eACT,UAAU,KACrB,QAAQ,IAAI,CAQd,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,UACjC,MAAM,cACD,UAAU,eACT,UAAU,KACrB,QAAQ,oBAAoB,GAAG,SAAS,CAsB1C,CAAC;AAEF,eAAO,MAAM,mBAAmB,sBACZ,4BAA4B,KAC7C,oBAAoB,GAAG,SAmBzB,CAAC"}
|
|
@@ -19,7 +19,11 @@ const commitmentToFinality = (commitment) => {
|
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
const getTransactionResult = async (txSig, connection, commitment) => {
|
|
22
|
-
const
|
|
22
|
+
const resolvedCommitment = commitment || connection.commitment || config_1.DEFAULT_CONFIRMATION_OPTS.commitment;
|
|
23
|
+
if (!resolvedCommitment) {
|
|
24
|
+
throw new Error('No commitment available when reporting transaction error. Provide a commitment, set one on the connection, or configure DEFAULT_CONFIRMATION_OPTS.');
|
|
25
|
+
}
|
|
26
|
+
const finality = commitmentToFinality(resolvedCommitment);
|
|
23
27
|
return await connection.getTransaction(txSig, {
|
|
24
28
|
maxSupportedTransactionVersion: 0,
|
|
25
29
|
commitment: finality,
|
|
@@ -22,7 +22,7 @@ export declare class RetryTxSender extends BaseTxSender {
|
|
|
22
22
|
opts?: ConfirmOptions;
|
|
23
23
|
timeout?: number;
|
|
24
24
|
retrySleep?: number;
|
|
25
|
-
additionalConnections?:
|
|
25
|
+
additionalConnections?: Connection[];
|
|
26
26
|
confirmationStrategy?: ConfirmationStrategy;
|
|
27
27
|
additionalTxSenderCallbacks?: ((base58EncodedTx: string) => void)[];
|
|
28
28
|
txHandler?: TxHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retryTxSender.d.ts","sourceRoot":"","sources":["../../../src/tx/retryTxSender.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,SAAS,E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