@velocity-exchange/sdk 0.0.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierignore +1 -1
- package/CHANGELOG.md +35 -0
- package/README.md +30 -30
- package/bun.lock +1 -1
- package/lib/browser/accounts/grpcProgramAccountSubscriber.js +1 -1
- package/lib/browser/accounts/grpcVelocityClientAccountSubscriber.d.ts +0 -4
- package/lib/browser/accounts/grpcVelocityClientAccountSubscriber.js +1 -3
- package/lib/browser/accounts/grpcVelocityClientAccountSubscriberV2.d.ts +0 -4
- package/lib/browser/accounts/grpcVelocityClientAccountSubscriberV2.js +5 -7
- package/lib/browser/accounts/laserProgramAccountSubscriber.js +1 -1
- package/lib/browser/accounts/pollingVelocityClientAccountSubscriber.d.ts +0 -4
- package/lib/browser/accounts/pollingVelocityClientAccountSubscriber.js +5 -7
- package/lib/browser/accounts/types.d.ts +2 -8
- package/lib/browser/accounts/utils.js +2 -2
- package/lib/browser/accounts/webSocketVelocityClientAccountSubscriber.d.ts +0 -4
- package/lib/browser/accounts/webSocketVelocityClientAccountSubscriber.js +5 -7
- package/lib/browser/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts +0 -4
- package/lib/browser/accounts/webSocketVelocityClientAccountSubscriberV2.js +5 -7
- package/lib/browser/addresses/pda.d.ts +1 -7
- package/lib/browser/addresses/pda.js +4 -10
- package/lib/browser/adminClient.d.ts +1 -1
- package/lib/browser/adminClient.js +21 -21
- package/lib/browser/auctionSubscriber/auctionSubscriber.d.ts +1 -3
- package/lib/browser/auctionSubscriber/auctionSubscriber.js +2 -6
- package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.d.ts +1 -3
- package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.js +2 -6
- package/lib/browser/auctionSubscriber/types.d.ts +3 -2
- package/lib/browser/config.d.ts +10 -19
- package/lib/browser/config.js +6 -33
- package/lib/browser/constants/insuranceFund.d.ts +1 -1
- package/lib/browser/constants/insuranceFund.js +1 -1
- package/lib/browser/constituentMap/constituentMap.d.ts +0 -2
- package/lib/browser/constituentMap/constituentMap.js +5 -5
- package/lib/browser/core/VelocityCore.d.ts +9 -15
- package/lib/browser/core/VelocityCore.js +5 -7
- package/lib/browser/core/instructions/withdraw.d.ts +1 -1
- package/lib/browser/core/instructions/withdraw.js +1 -1
- package/lib/browser/core/remainingAccounts.js +3 -3
- package/lib/browser/decode/user.js +5 -5
- package/lib/browser/dlob/DLOB.d.ts +1 -1
- package/lib/browser/dlob/DLOB.js +7 -7
- package/lib/browser/dlob/DLOBNode.js +1 -2
- package/lib/browser/dlob/DLOBSubscriber.d.ts +0 -2
- package/lib/browser/dlob/DLOBSubscriber.js +2 -7
- package/lib/browser/dlob/orderBookLevels.js +7 -7
- package/lib/browser/dlob/types.d.ts +0 -2
- package/lib/browser/events/eventSubscriber.d.ts +1 -1
- package/lib/browser/events/eventsServerLogProvider.js +2 -2
- package/lib/browser/events/parse.js +14 -14
- package/lib/browser/events/types.d.ts +3 -5
- package/lib/browser/events/types.js +1 -1
- package/lib/browser/idl/{drift.d.ts → velocity.d.ts} +1043 -768
- package/lib/browser/idl/{drift.json → velocity.json} +1034 -759
- package/lib/browser/index.d.ts +1 -1
- package/lib/browser/index.js +1 -2
- package/lib/browser/math/amm.d.ts +10 -10
- package/lib/browser/math/amm.js +29 -28
- package/lib/browser/math/auction.d.ts +1 -1
- package/lib/browser/math/auction.js +18 -21
- package/lib/browser/math/builder.d.ts +18 -1
- package/lib/browser/math/builder.js +32 -1
- package/lib/browser/math/funding.js +26 -26
- package/lib/browser/math/margin.d.ts +4 -4
- package/lib/browser/math/margin.js +15 -15
- package/lib/browser/math/market.js +13 -13
- package/lib/browser/math/oracles.d.ts +4 -4
- package/lib/browser/math/oracles.js +23 -23
- package/lib/browser/math/orders.d.ts +2 -2
- package/lib/browser/math/orders.js +12 -12
- package/lib/browser/math/position.js +4 -4
- package/lib/browser/math/superStake.d.ts +8 -10
- package/lib/browser/math/superStake.js +18 -20
- package/lib/browser/math/trade.js +5 -5
- package/lib/browser/math/utils.d.ts +1 -1
- package/lib/browser/math/utils.js +1 -1
- package/lib/browser/oracles/pythLazerClient.js +2 -2
- package/lib/browser/orderSubscriber/OrderSubscriber.d.ts +0 -2
- package/lib/browser/orderSubscriber/OrderSubscriber.js +8 -12
- package/lib/browser/orderSubscriber/WebsocketSubscription.js +1 -1
- package/lib/browser/orderSubscriber/grpcSubscription.js +2 -2
- package/lib/browser/orderSubscriber/types.d.ts +0 -2
- package/lib/browser/priorityFee/priorityFeeSubscriber.d.ts +1 -5
- package/lib/browser/priorityFee/priorityFeeSubscriber.js +7 -15
- package/lib/browser/priorityFee/priorityFeeSubscriberMap.d.ts +0 -4
- package/lib/browser/priorityFee/priorityFeeSubscriberMap.js +3 -11
- package/lib/browser/priorityFee/types.d.ts +3 -8
- package/lib/browser/priorityFee/velocityPriorityFeeMethod.d.ts +0 -8
- package/lib/browser/priorityFee/velocityPriorityFeeMethod.js +1 -3
- package/lib/browser/pyth/pythLazerSubscriber.d.ts +1 -1
- package/lib/browser/pyth/pythLazerSubscriber.js +1 -1
- package/lib/browser/swap/UnifiedSwapClient.js +1 -1
- package/lib/browser/swift/signedMsgUserAccountSubscriber.d.ts +4 -5
- package/lib/browser/swift/signedMsgUserAccountSubscriber.js +2 -6
- package/lib/browser/swift/swiftOrderSubscriber.d.ts +6 -5
- package/lib/browser/swift/swiftOrderSubscriber.js +5 -11
- package/lib/browser/types.d.ts +81 -93
- package/lib/browser/types.js +4 -0
- package/lib/browser/user.d.ts +1 -3
- package/lib/browser/user.js +19 -23
- package/lib/browser/userConfig.d.ts +3 -2
- package/lib/browser/userMap/WebsocketSubscription.js +1 -1
- package/lib/browser/userMap/grpcSubscription.js +1 -1
- package/lib/browser/userMap/referrerMap.d.ts +0 -2
- package/lib/browser/userMap/referrerMap.js +0 -4
- package/lib/browser/userMap/revenueShareEscrowMap.d.ts +0 -2
- package/lib/browser/userMap/revenueShareEscrowMap.js +0 -4
- package/lib/browser/userMap/userMap.d.ts +2 -4
- package/lib/browser/userMap/userMap.js +10 -14
- package/lib/browser/userMap/userMapConfig.d.ts +3 -2
- package/lib/browser/userMap/userStatsMap.d.ts +0 -2
- package/lib/browser/userMap/userStatsMap.js +0 -4
- package/lib/browser/userStats.d.ts +0 -2
- package/lib/browser/userStats.js +10 -14
- package/lib/browser/userStatsConfig.d.ts +3 -2
- package/lib/browser/util/ed25519Utils.d.ts +1 -1
- package/lib/browser/util/ed25519Utils.js +1 -1
- package/lib/browser/velocityClient.d.ts +59 -44
- package/lib/browser/velocityClient.js +259 -197
- package/lib/browser/velocityClientConfig.d.ts +0 -8
- package/lib/node/accounts/grpcProgramAccountSubscriber.js +1 -1
- package/lib/node/accounts/grpcVelocityClientAccountSubscriber.d.ts +0 -4
- package/lib/node/accounts/grpcVelocityClientAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcVelocityClientAccountSubscriber.js +1 -3
- package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.d.ts +0 -4
- package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.js +5 -7
- package/lib/node/accounts/laserProgramAccountSubscriber.js +1 -1
- package/lib/node/accounts/pollingVelocityClientAccountSubscriber.d.ts +0 -4
- package/lib/node/accounts/pollingVelocityClientAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingVelocityClientAccountSubscriber.js +5 -7
- package/lib/node/accounts/types.d.ts +2 -8
- package/lib/node/accounts/types.d.ts.map +1 -1
- package/lib/node/accounts/utils.js +2 -2
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.d.ts +0 -4
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.js +5 -7
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts +0 -4
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.js +5 -7
- package/lib/node/addresses/pda.d.ts +1 -7
- package/lib/node/addresses/pda.d.ts.map +1 -1
- package/lib/node/addresses/pda.js +4 -10
- package/lib/node/adminClient.d.ts +1 -1
- package/lib/node/adminClient.js +21 -21
- package/lib/node/auctionSubscriber/auctionSubscriber.d.ts +1 -3
- package/lib/node/auctionSubscriber/auctionSubscriber.d.ts.map +1 -1
- package/lib/node/auctionSubscriber/auctionSubscriber.js +2 -6
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts +1 -3
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts.map +1 -1
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.js +2 -6
- package/lib/node/auctionSubscriber/types.d.ts +3 -2
- package/lib/node/auctionSubscriber/types.d.ts.map +1 -1
- package/lib/node/config.d.ts +10 -19
- package/lib/node/config.d.ts.map +1 -1
- package/lib/node/config.js +6 -33
- package/lib/node/constants/insuranceFund.d.ts +1 -1
- package/lib/node/constants/insuranceFund.js +1 -1
- package/lib/node/constituentMap/constituentMap.d.ts +0 -2
- package/lib/node/constituentMap/constituentMap.d.ts.map +1 -1
- package/lib/node/constituentMap/constituentMap.js +5 -5
- package/lib/node/core/VelocityCore.d.ts +9 -15
- package/lib/node/core/VelocityCore.d.ts.map +1 -1
- package/lib/node/core/VelocityCore.js +5 -7
- package/lib/node/core/instructions/withdraw.d.ts +1 -1
- package/lib/node/core/instructions/withdraw.d.ts.map +1 -1
- package/lib/node/core/instructions/withdraw.js +1 -1
- package/lib/node/core/remainingAccounts.js +3 -3
- package/lib/node/decode/user.js +5 -5
- package/lib/node/dlob/DLOB.d.ts +1 -1
- package/lib/node/dlob/DLOB.d.ts.map +1 -1
- package/lib/node/dlob/DLOB.js +7 -7
- package/lib/node/dlob/DLOBNode.js +1 -2
- package/lib/node/dlob/DLOBSubscriber.d.ts +0 -2
- package/lib/node/dlob/DLOBSubscriber.d.ts.map +1 -1
- package/lib/node/dlob/DLOBSubscriber.js +2 -7
- package/lib/node/dlob/orderBookLevels.d.ts.map +1 -1
- package/lib/node/dlob/orderBookLevels.js +7 -7
- package/lib/node/dlob/types.d.ts +0 -2
- package/lib/node/dlob/types.d.ts.map +1 -1
- package/lib/node/events/eventSubscriber.d.ts +1 -1
- package/lib/node/events/eventsServerLogProvider.js +2 -2
- package/lib/node/events/parse.d.ts.map +1 -1
- package/lib/node/events/parse.js +14 -14
- package/lib/node/events/types.d.ts +3 -5
- package/lib/node/events/types.d.ts.map +1 -1
- package/lib/node/events/types.js +1 -1
- package/lib/node/idl/{drift.d.ts → velocity.d.ts} +1044 -769
- package/lib/node/idl/velocity.d.ts.map +1 -0
- package/lib/node/idl/{drift.json → velocity.json} +1034 -759
- package/lib/node/index.d.ts +1 -1
- package/lib/node/index.d.ts.map +1 -1
- package/lib/node/index.js +1 -2
- package/lib/node/math/amm.d.ts +10 -10
- package/lib/node/math/amm.d.ts.map +1 -1
- package/lib/node/math/amm.js +29 -28
- package/lib/node/math/auction.d.ts +1 -1
- package/lib/node/math/auction.d.ts.map +1 -1
- package/lib/node/math/auction.js +18 -21
- package/lib/node/math/builder.d.ts +18 -1
- package/lib/node/math/builder.d.ts.map +1 -1
- package/lib/node/math/builder.js +32 -1
- package/lib/node/math/funding.d.ts.map +1 -1
- package/lib/node/math/funding.js +26 -26
- package/lib/node/math/margin.d.ts +4 -4
- package/lib/node/math/margin.d.ts.map +1 -1
- package/lib/node/math/margin.js +15 -15
- package/lib/node/math/market.d.ts.map +1 -1
- package/lib/node/math/market.js +13 -13
- package/lib/node/math/oracles.d.ts +4 -4
- package/lib/node/math/oracles.d.ts.map +1 -1
- package/lib/node/math/oracles.js +23 -23
- package/lib/node/math/orders.d.ts +2 -2
- package/lib/node/math/orders.d.ts.map +1 -1
- package/lib/node/math/orders.js +12 -12
- package/lib/node/math/position.d.ts.map +1 -1
- package/lib/node/math/position.js +4 -4
- package/lib/node/math/superStake.d.ts +8 -10
- package/lib/node/math/superStake.d.ts.map +1 -1
- package/lib/node/math/superStake.js +18 -20
- package/lib/node/math/trade.d.ts.map +1 -1
- package/lib/node/math/trade.js +5 -5
- package/lib/node/math/utils.d.ts +1 -1
- package/lib/node/math/utils.js +1 -1
- package/lib/node/oracles/pythLazerClient.js +2 -2
- package/lib/node/orderSubscriber/OrderSubscriber.d.ts +0 -2
- package/lib/node/orderSubscriber/OrderSubscriber.d.ts.map +1 -1
- package/lib/node/orderSubscriber/OrderSubscriber.js +8 -12
- package/lib/node/orderSubscriber/WebsocketSubscription.js +1 -1
- package/lib/node/orderSubscriber/grpcSubscription.js +2 -2
- package/lib/node/orderSubscriber/types.d.ts +0 -2
- package/lib/node/orderSubscriber/types.d.ts.map +1 -1
- package/lib/node/priorityFee/priorityFeeSubscriber.d.ts +1 -5
- package/lib/node/priorityFee/priorityFeeSubscriber.d.ts.map +1 -1
- package/lib/node/priorityFee/priorityFeeSubscriber.js +7 -15
- package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts +0 -4
- package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts.map +1 -1
- package/lib/node/priorityFee/priorityFeeSubscriberMap.js +3 -11
- package/lib/node/priorityFee/types.d.ts +3 -8
- package/lib/node/priorityFee/types.d.ts.map +1 -1
- package/lib/node/priorityFee/velocityPriorityFeeMethod.d.ts +0 -8
- package/lib/node/priorityFee/velocityPriorityFeeMethod.d.ts.map +1 -1
- package/lib/node/priorityFee/velocityPriorityFeeMethod.js +1 -3
- package/lib/node/pyth/pythLazerSubscriber.d.ts +1 -1
- package/lib/node/pyth/pythLazerSubscriber.js +1 -1
- package/lib/node/swap/UnifiedSwapClient.js +1 -1
- package/lib/node/swift/signedMsgUserAccountSubscriber.d.ts +4 -5
- package/lib/node/swift/signedMsgUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/swift/signedMsgUserAccountSubscriber.js +2 -6
- package/lib/node/swift/swiftOrderSubscriber.d.ts +6 -5
- package/lib/node/swift/swiftOrderSubscriber.d.ts.map +1 -1
- package/lib/node/swift/swiftOrderSubscriber.js +5 -11
- package/lib/node/types.d.ts +81 -93
- package/lib/node/types.d.ts.map +1 -1
- package/lib/node/types.js +4 -0
- package/lib/node/user.d.ts +1 -3
- package/lib/node/user.d.ts.map +1 -1
- package/lib/node/user.js +19 -23
- package/lib/node/userConfig.d.ts +3 -2
- package/lib/node/userConfig.d.ts.map +1 -1
- package/lib/node/userMap/WebsocketSubscription.js +1 -1
- package/lib/node/userMap/grpcSubscription.js +1 -1
- package/lib/node/userMap/referrerMap.d.ts +0 -2
- package/lib/node/userMap/referrerMap.d.ts.map +1 -1
- package/lib/node/userMap/referrerMap.js +0 -4
- package/lib/node/userMap/revenueShareEscrowMap.d.ts +0 -2
- package/lib/node/userMap/revenueShareEscrowMap.d.ts.map +1 -1
- package/lib/node/userMap/revenueShareEscrowMap.js +0 -4
- package/lib/node/userMap/userMap.d.ts +2 -4
- package/lib/node/userMap/userMap.d.ts.map +1 -1
- package/lib/node/userMap/userMap.js +10 -14
- package/lib/node/userMap/userMapConfig.d.ts +3 -2
- package/lib/node/userMap/userMapConfig.d.ts.map +1 -1
- package/lib/node/userMap/userStatsMap.d.ts +0 -2
- package/lib/node/userMap/userStatsMap.d.ts.map +1 -1
- package/lib/node/userMap/userStatsMap.js +0 -4
- package/lib/node/userStats.d.ts +0 -2
- package/lib/node/userStats.d.ts.map +1 -1
- package/lib/node/userStats.js +10 -14
- package/lib/node/userStatsConfig.d.ts +3 -2
- package/lib/node/userStatsConfig.d.ts.map +1 -1
- package/lib/node/util/ed25519Utils.d.ts +1 -1
- package/lib/node/util/ed25519Utils.js +1 -1
- package/lib/node/velocityClient.d.ts +59 -44
- package/lib/node/velocityClient.d.ts.map +1 -1
- package/lib/node/velocityClient.js +259 -197
- package/lib/node/velocityClientConfig.d.ts +0 -8
- package/lib/node/velocityClientConfig.d.ts.map +1 -1
- package/package.json +6 -7
- package/scripts/deposit-isolated-positions.ts +2 -2
- package/scripts/find-flagged-users.ts +1 -1
- package/scripts/grpc-client-test-comparison.ts +4 -4
- package/scripts/grpc-multiuser-client-test-comparison.ts +2 -2
- package/scripts/single-grpc-client-test.ts +3 -3
- package/scripts/updateVersion.js +4 -4
- package/scripts/withdraw-isolated-positions.ts +2 -2
- package/src/accounts/grpcProgramAccountSubscriber.ts +1 -1
- package/src/accounts/grpcVelocityClientAccountSubscriber.ts +0 -7
- package/src/accounts/grpcVelocityClientAccountSubscriberV2.ts +4 -11
- package/src/accounts/laserProgramAccountSubscriber.ts +1 -1
- package/src/accounts/pollingVelocityClientAccountSubscriber.ts +4 -11
- package/src/accounts/types.ts +2 -9
- package/src/accounts/utils.ts +2 -2
- package/src/accounts/webSocketVelocityClientAccountSubscriber.ts +4 -11
- package/src/accounts/webSocketVelocityClientAccountSubscriberV2.ts +4 -11
- package/src/addresses/pda.ts +3 -13
- package/src/adminClient.ts +21 -21
- package/src/auctionSubscriber/auctionSubscriber.ts +1 -6
- package/src/auctionSubscriber/auctionSubscriberGrpc.ts +1 -6
- package/src/auctionSubscriber/types.ts +3 -3
- package/src/config.ts +8 -64
- package/src/constants/insuranceFund.ts +1 -1
- package/src/constituentMap/constituentMap.ts +2 -6
- package/src/core/VelocityCore.ts +11 -20
- package/src/core/instructions/withdraw.ts +2 -2
- package/src/core/remainingAccounts.ts +3 -3
- package/src/decode/user.ts +5 -5
- package/src/dlob/DLOB.ts +7 -7
- package/src/dlob/DLOBNode.ts +1 -1
- package/src/dlob/DLOBSubscriber.ts +2 -8
- package/src/dlob/orderBookLevels.ts +12 -6
- package/src/dlob/types.ts +0 -2
- package/src/events/eventSubscriber.ts +1 -1
- package/src/events/eventsServerLogProvider.ts +2 -2
- package/src/events/parse.ts +14 -14
- package/src/events/types.ts +4 -7
- package/src/idl/{drift.json → velocity.json} +1034 -759
- package/src/idl/{drift.ts → velocity.ts} +1036 -761
- package/src/index.ts +1 -4
- package/src/margin/README.md +2 -2
- package/src/math/amm.ts +43 -21
- package/src/math/auction.ts +19 -22
- package/src/math/builder.ts +45 -1
- package/src/math/funding.ts +46 -43
- package/src/math/margin.ts +15 -15
- package/src/math/market.ts +21 -13
- package/src/math/oracles.ts +29 -26
- package/src/math/orders.ts +21 -11
- package/src/math/position.ts +9 -3
- package/src/math/superStake.ts +21 -24
- package/src/math/trade.ts +9 -1
- package/src/math/utils.ts +1 -1
- package/src/oracles/pythLazerClient.ts +3 -3
- package/src/orderSubscriber/OrderSubscriber.ts +2 -8
- package/src/orderSubscriber/WebsocketSubscription.ts +1 -1
- package/src/orderSubscriber/grpcSubscription.ts +2 -2
- package/src/orderSubscriber/types.ts +0 -2
- package/src/priorityFee/priorityFeeSubscriber.ts +5 -12
- package/src/priorityFee/priorityFeeSubscriberMap.ts +2 -10
- package/src/priorityFee/types.ts +4 -9
- package/src/priorityFee/velocityPriorityFeeMethod.ts +0 -12
- package/src/pyth/pythLazerSubscriber.ts +1 -1
- package/src/swap/UnifiedSwapClient.ts +1 -1
- package/src/swift/signedMsgUserAccountSubscriber.ts +2 -8
- package/src/swift/swiftOrderSubscriber.ts +7 -12
- package/src/types.ts +86 -104
- package/src/user.ts +9 -14
- package/src/userConfig.ts +1 -3
- package/src/userMap/WebsocketSubscription.ts +1 -1
- package/src/userMap/grpcSubscription.ts +1 -1
- package/src/userMap/referrerMap.ts +0 -4
- package/src/userMap/revenueShareEscrowMap.ts +0 -4
- package/src/userMap/userMap.ts +3 -7
- package/src/userMap/userMapConfig.ts +3 -3
- package/src/userMap/userStatsMap.ts +0 -4
- package/src/userStats.ts +1 -5
- package/src/userStatsConfig.ts +3 -3
- package/src/util/ed25519Utils.ts +1 -1
- package/src/velocityClient.ts +345 -231
- package/src/velocityClientConfig.ts +3 -11
- package/tests/{DriftCore → VelocityCore}/decode.test.ts +1 -1
- package/tests/{DriftCore → VelocityCore}/fill_trigger.test.ts +1 -1
- package/tests/{DriftCore → VelocityCore}/instructions.test.ts +1 -1
- package/tests/{DriftCore → VelocityCore}/pdas.test.ts +4 -2
- package/tests/auctions/test.ts +4 -4
- package/tests/ci/verifyConstants.ts +24 -27
- package/tests/decode/test.ts +3 -3
- package/tests/dlob/helpers.ts +5 -9
- package/tests/dlob/test.ts +5 -5
- package/tests/events/parseLogsForCuUsage.ts +15 -15
- package/tests/user/helpers.ts +10 -10
- package/tests/user/test.ts +13 -10
- package/lib/browser/util/deprecatedAlias.d.ts +0 -26
- package/lib/browser/util/deprecatedAlias.js +0 -10
- package/lib/node/idl/drift.d.ts.map +0 -1
- package/lib/node/util/deprecatedAlias.d.ts +0 -27
- package/lib/node/util/deprecatedAlias.d.ts.map +0 -1
- package/lib/node/util/deprecatedAlias.js +0 -10
- package/src/util/deprecatedAlias.ts +0 -25
- /package/lib/browser/idl/{drift.js → velocity.js} +0 -0
- /package/lib/node/idl/{drift.js → velocity.js} +0 -0
- /package/tests/{DriftCore → VelocityCore}/perp_orders.test.ts +0 -0
- /package/tests/{DriftCore → VelocityCore}/remainingAccounts.test.ts +0 -0
- /package/tests/{DriftCore → VelocityCore}/settlement_liquidation.test.ts +0 -0
|
@@ -12,8 +12,6 @@ export declare class UserStatsMap {
|
|
|
12
12
|
*/
|
|
13
13
|
private userStatsMap;
|
|
14
14
|
private velocityClient;
|
|
15
|
-
/** @deprecated Use `velocityClient` instead. `driftClient` will be removed in a future major. */
|
|
16
|
-
private get driftClient();
|
|
17
15
|
private bulkAccountLoader;
|
|
18
16
|
private decode;
|
|
19
17
|
private syncConfig;
|
|
@@ -7,10 +7,6 @@ const bulkAccountLoader_1 = require("../accounts/bulkAccountLoader");
|
|
|
7
7
|
const memcmp_1 = require("../memcmp");
|
|
8
8
|
const web3_js_1 = require("@solana/web3.js");
|
|
9
9
|
class UserStatsMap {
|
|
10
|
-
/** @deprecated Use `velocityClient` instead. `driftClient` will be removed in a future major. */
|
|
11
|
-
get driftClient() {
|
|
12
|
-
return this.velocityClient;
|
|
13
|
-
}
|
|
14
10
|
/**
|
|
15
11
|
* Creates a new UserStatsMap instance.
|
|
16
12
|
*
|
|
@@ -10,8 +10,6 @@ import { UserStatsConfig } from './userStatsConfig';
|
|
|
10
10
|
import { ReferrerInfo, UserStatsAccount } from './types';
|
|
11
11
|
export declare class UserStats {
|
|
12
12
|
velocityClient: VelocityClient;
|
|
13
|
-
/** @deprecated Use `velocityClient` instead. `driftClient` will be removed in a future major. */
|
|
14
|
-
get driftClient(): VelocityClient;
|
|
15
13
|
userStatsAccountPublicKey: PublicKey;
|
|
16
14
|
accountSubscriber: UserStatsAccountSubscriber;
|
|
17
15
|
isSubscribed: boolean;
|
package/lib/browser/userStats.js
CHANGED
|
@@ -7,32 +7,28 @@ const webSocketUserStatsAccountSubsriber_1 = require("./accounts/webSocketUserSt
|
|
|
7
7
|
const pda_1 = require("./addresses/pda");
|
|
8
8
|
const grpcUserStatsAccountSubscriber_1 = require("./accounts/grpcUserStatsAccountSubscriber");
|
|
9
9
|
class UserStats {
|
|
10
|
-
/** @deprecated Use `velocityClient` instead. `driftClient` will be removed in a future major. */
|
|
11
|
-
get driftClient() {
|
|
12
|
-
return this.velocityClient;
|
|
13
|
-
}
|
|
14
10
|
constructor(config) {
|
|
15
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
11
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
16
12
|
// Type-system guarantees at least one of the two is supplied.
|
|
17
|
-
const velocityClient =
|
|
13
|
+
const velocityClient = config.velocityClient;
|
|
18
14
|
this.velocityClient = velocityClient;
|
|
19
15
|
this.userStatsAccountPublicKey = config.userStatsAccountPublicKey;
|
|
20
|
-
if (((
|
|
16
|
+
if (((_a = config.accountSubscription) === null || _a === void 0 ? void 0 : _a.type) === 'polling') {
|
|
21
17
|
this.accountSubscriber = new pollingUserStatsAccountSubscriber_1.PollingUserStatsAccountSubscriber(velocityClient.program, config.userStatsAccountPublicKey, config.accountSubscription.accountLoader);
|
|
22
18
|
}
|
|
23
|
-
else if (((
|
|
19
|
+
else if (((_b = config.accountSubscription) === null || _b === void 0 ? void 0 : _b.type) === 'grpc') {
|
|
24
20
|
this.accountSubscriber = new grpcUserStatsAccountSubscriber_1.grpcUserStatsAccountSubscriber(config.accountSubscription.grpcConfigs, velocityClient.program, config.userStatsAccountPublicKey, {
|
|
25
|
-
resubTimeoutMs: (
|
|
26
|
-
logResubMessages: (
|
|
21
|
+
resubTimeoutMs: (_c = config.accountSubscription) === null || _c === void 0 ? void 0 : _c.resubTimeoutMs,
|
|
22
|
+
logResubMessages: (_d = config.accountSubscription) === null || _d === void 0 ? void 0 : _d.logResubMessages,
|
|
27
23
|
});
|
|
28
24
|
}
|
|
29
|
-
else if (((
|
|
25
|
+
else if (((_e = config.accountSubscription) === null || _e === void 0 ? void 0 : _e.type) === 'websocket') {
|
|
30
26
|
this.accountSubscriber = new webSocketUserStatsAccountSubsriber_1.WebSocketUserStatsAccountSubscriber(velocityClient.program, config.userStatsAccountPublicKey, {
|
|
31
|
-
resubTimeoutMs: (
|
|
32
|
-
logResubMessages: (
|
|
27
|
+
resubTimeoutMs: (_f = config.accountSubscription) === null || _f === void 0 ? void 0 : _f.resubTimeoutMs,
|
|
28
|
+
logResubMessages: (_g = config.accountSubscription) === null || _g === void 0 ? void 0 : _g.logResubMessages,
|
|
33
29
|
}, config.accountSubscription.commitment);
|
|
34
30
|
}
|
|
35
|
-
else if (((
|
|
31
|
+
else if (((_h = config.accountSubscription) === null || _h === void 0 ? void 0 : _h.type) === 'custom') {
|
|
36
32
|
this.accountSubscriber =
|
|
37
33
|
config.accountSubscription.userStatsAccountSubscriber;
|
|
38
34
|
}
|
|
@@ -2,12 +2,13 @@ import { VelocityClient } from './velocityClient';
|
|
|
2
2
|
import { Commitment, PublicKey } from '@solana/web3.js';
|
|
3
3
|
import { BulkAccountLoader } from './accounts/bulkAccountLoader';
|
|
4
4
|
import { GrpcConfigs, UserStatsAccountSubscriber } from './accounts/types';
|
|
5
|
-
import { AtLeastOne } from './util/deprecatedAlias';
|
|
6
5
|
type UserStatsConfigBase = {
|
|
7
6
|
accountSubscription?: UserStatsSubscriptionConfig;
|
|
8
7
|
userStatsAccountPublicKey: PublicKey;
|
|
9
8
|
};
|
|
10
|
-
export type UserStatsConfig = UserStatsConfigBase &
|
|
9
|
+
export type UserStatsConfig = UserStatsConfigBase & {
|
|
10
|
+
velocityClient: VelocityClient;
|
|
11
|
+
};
|
|
11
12
|
export type UserStatsSubscriptionConfig = {
|
|
12
13
|
type: 'websocket';
|
|
13
14
|
resubTimeoutMs?: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TransactionInstruction } from '@solana/web3.js';
|
|
2
2
|
/**
|
|
3
3
|
* Constructs a minimal Ed25519 verification instruction that references the data
|
|
4
|
-
* inside the
|
|
4
|
+
* inside the velocity custom instruction (e.g. postPythLazerOracleUpdate, placeSignedMsgTakerOrder).
|
|
5
5
|
*
|
|
6
6
|
* @param customInstructionIndex The index of the custom instruction in the transaction (e.g. if tx contains compute budget limit, compute budget price, ed25519 verify, custom ix, this would be 3).
|
|
7
7
|
* @param messageOffset The offset within the custom instruction data where the signed message begins.
|
|
@@ -47,7 +47,7 @@ const ED25519_INSTRUCTION_LAYOUT = BufferLayout.struct([
|
|
|
47
47
|
]);
|
|
48
48
|
/**
|
|
49
49
|
* Constructs a minimal Ed25519 verification instruction that references the data
|
|
50
|
-
* inside the
|
|
50
|
+
* inside the velocity custom instruction (e.g. postPythLazerOracleUpdate, placeSignedMsgTakerOrder).
|
|
51
51
|
*
|
|
52
52
|
* @param customInstructionIndex The index of the custom instruction in the transaction (e.g. if tx contains compute budget limit, compute budget price, ed25519 verify, custom ix, this would be 3).
|
|
53
53
|
* @param messageOffset The offset within the custom instruction data where the signed message begins.
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import { AnchorProvider, BN } from './isomorphic/anchor';
|
|
20
20
|
import type { ProgramAccount } from '@coral-xyz/anchor';
|
|
21
|
-
import { VelocityClientMetricsEvents, IWallet, MakerInfo, MappedRecord, MarketType, ModifyOrderPolicy, OptionalOrderParams, OracleSource, Order, OrderParams, OrderTriggerCondition, PerpMarketAccount, PerpMarketExtendedInfo, PlaceAndTakeOrderSuccessCondition, PositionDirection, ReferrerInfo, ReferrerNameAccount, ScaleOrderParams, SettlePnlMode, SignedTxData, SpotMarketAccount, SpotPosition, StateAccount, SwapReduceOnly, SignedMsgOrderParamsMessage, TxParams, UserAccount, UserStatsAccount, SignedMsgOrderParamsDelegateMessage, PostOnlyParams, LPPoolAccount, ConstituentAccount, ConstituentTargetBaseAccount, AmmCache } from './types';
|
|
21
|
+
import { VelocityClientMetricsEvents, IWallet, MakerInfo, MappedRecord, MarketType, ModifyOrderPolicy, OptionalOrderParams, OracleSource, Order, OrderParams, OrderTriggerCondition, PerpMarketAccount, PerpMarketExtendedInfo, PlaceAndTakeOrderSuccessCondition, PositionDirection, ReferrerInfo, ReferrerNameAccount, RevenueShareEscrowAccount, ScaleOrderParams, SettlePnlMode, SignedTxData, SpotMarketAccount, SpotPosition, StateAccount, SwapReduceOnly, SignedMsgOrderParamsMessage, TxParams, UserAccount, UserStatsAccount, SignedMsgOrderParamsDelegateMessage, PostOnlyParams, LPPoolAccount, ConstituentAccount, ConstituentTargetBaseAccount, AmmCache } from './types';
|
|
22
22
|
import { AccountMeta, AddressLookupTableAccount, BlockhashWithExpiryBlockHeight, ConfirmOptions, Connection, Keypair, PublicKey, Signer, Transaction, TransactionInstruction, TransactionSignature, TransactionVersion, VersionedTransaction } from '@solana/web3.js';
|
|
23
23
|
import { TokenFaucet } from './tokenFaucet';
|
|
24
24
|
import { EventEmitter } from 'events';
|
|
@@ -131,7 +131,7 @@ export declare class VelocityClient {
|
|
|
131
131
|
fetchAllLookupTableAccounts(): Promise<AddressLookupTableAccount[]>;
|
|
132
132
|
private getTxVersionForNewWallet;
|
|
133
133
|
/**
|
|
134
|
-
* Update the wallet to use for
|
|
134
|
+
* Update the wallet to use for velocity transactions and linked user account
|
|
135
135
|
* @param newWallet
|
|
136
136
|
* @param subAccountIds
|
|
137
137
|
* @param activeSubAccountId
|
|
@@ -253,6 +253,8 @@ export declare class VelocityClient {
|
|
|
253
253
|
authority?: PublicKey;
|
|
254
254
|
}): Promise<TransactionInstruction>;
|
|
255
255
|
updateUserDelegate(delegate: PublicKey, subAccountId?: number): Promise<TransactionSignature>;
|
|
256
|
+
getUpdateUserAllowDelegateTransferIx(allowDelegateTransfer: boolean): Promise<TransactionInstruction>;
|
|
257
|
+
updateUserAllowDelegateTransfer(allowDelegateTransfer: boolean): Promise<TransactionSignature>;
|
|
256
258
|
updateUserAdvancedLp(updates: {
|
|
257
259
|
advancedLp: boolean;
|
|
258
260
|
subAccountId: number;
|
|
@@ -332,7 +334,7 @@ export declare class VelocityClient {
|
|
|
332
334
|
*/
|
|
333
335
|
convertToPricePrecision(amount: BN | number): BN;
|
|
334
336
|
/**
|
|
335
|
-
* Each
|
|
337
|
+
* Each velocity instruction must include perp and sport market accounts in the ix remaining accounts.
|
|
336
338
|
* Use this function to force a subset of markets to be included in the remaining accounts for every ix
|
|
337
339
|
*
|
|
338
340
|
* @param perpMarketIndexes
|
|
@@ -462,6 +464,8 @@ export declare class VelocityClient {
|
|
|
462
464
|
*/
|
|
463
465
|
transferDeposit(amount: BN, marketIndex: number, fromSubAccountId: number, toSubAccountId: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
464
466
|
getTransferDepositIx(amount: BN, marketIndex: number, fromSubAccountId: number, toSubAccountId: number): Promise<TransactionInstruction>;
|
|
467
|
+
transferDepositByDelegate(amount: BN, marketIndex: number, fromSubAccountId: number, toSubAccountId: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
468
|
+
getTransferDepositByDelegateIx(amount: BN, marketIndex: number, fromSubAccountId: number, toSubAccountId: number): Promise<TransactionInstruction>;
|
|
465
469
|
transferPools(depositFromMarketIndex: number, depositToMarketIndex: number, borrowFromMarketIndex: number, borrowToMarketIndex: number, depositAmount: BN | undefined, borrowAmount: BN | undefined, fromSubAccountId: number, toSubAccountId: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
466
470
|
getTransferPoolsIx(depositFromMarketIndex: number, depositToMarketIndex: number, borrowFromMarketIndex: number, borrowToMarketIndex: number, depositAmount: BN | undefined, borrowAmount: BN | undefined, fromSubAccountId: number, toSubAccountId: number, isToNewSubAccount?: boolean): Promise<TransactionInstruction>;
|
|
467
471
|
transferPerpPosition(fromSubAccountId: number, toSubAccountId: number, marketIndex: number, amount: BN, txParams?: TxParams): Promise<TransactionSignature>;
|
|
@@ -482,7 +486,7 @@ export declare class VelocityClient {
|
|
|
482
486
|
*/
|
|
483
487
|
openPosition(direction: PositionDirection, amount: BN, marketIndex: number, limitPrice?: BN, subAccountId?: number): Promise<TransactionSignature>;
|
|
484
488
|
sendSignedTx(tx: Transaction | VersionedTransaction, opts?: ConfirmOptions): Promise<TransactionSignature>;
|
|
485
|
-
prepareMarketOrderTxs(orderParams: OptionalOrderParams, userAccountPublicKey: PublicKey, userAccount: UserAccount, makerInfo?: MakerInfo | MakerInfo[], txParams?: TxParams, bracketOrdersParams?: OptionalOrderParams[],
|
|
489
|
+
prepareMarketOrderTxs(orderParams: OptionalOrderParams, userAccountPublicKey: PublicKey, userAccount: UserAccount, makerInfo?: MakerInfo | MakerInfo[], txParams?: TxParams, bracketOrdersParams?: OptionalOrderParams[], cancelExistingOrders?: boolean, settlePnl?: boolean, positionMaxLev?: number, isolatedPositionDepositAmount?: BN): Promise<{
|
|
486
490
|
cancelExistingOrdersTx?: Transaction | VersionedTransaction;
|
|
487
491
|
settlePnlTx?: Transaction | VersionedTransaction;
|
|
488
492
|
fillTx?: Transaction | VersionedTransaction;
|
|
@@ -499,13 +503,31 @@ export declare class VelocityClient {
|
|
|
499
503
|
* @param cancelExistingOrders - Builds and returns an extra transaciton to cancel the existing orders in the same perp market. Intended use is to auto-cancel TP/SL orders when closing a position. Ignored if orderParams.marketType is not MarketType.PERP
|
|
500
504
|
* @returns
|
|
501
505
|
*/
|
|
502
|
-
sendMarketOrderAndGetSignedFillTx(orderParams: OptionalOrderParams, userAccountPublicKey: PublicKey, userAccount: UserAccount, makerInfo?: MakerInfo | MakerInfo[], txParams?: TxParams, bracketOrdersParams?: OptionalOrderParams[],
|
|
506
|
+
sendMarketOrderAndGetSignedFillTx(orderParams: OptionalOrderParams, userAccountPublicKey: PublicKey, userAccount: UserAccount, makerInfo?: MakerInfo | MakerInfo[], txParams?: TxParams, bracketOrdersParams?: OptionalOrderParams[], cancelExistingOrders?: boolean, settlePnl?: boolean): Promise<{
|
|
503
507
|
txSig: TransactionSignature;
|
|
504
508
|
signedFillTx?: Transaction;
|
|
505
509
|
signedCancelExistingOrdersTx?: Transaction;
|
|
506
510
|
signedSettlePnlTx?: Transaction;
|
|
507
511
|
}>;
|
|
508
512
|
placePerpOrder(orderParams: OptionalOrderParams, txParams?: TxParams, subAccountId?: number, isolatedPositionDepositAmount?: BN): Promise<TransactionSignature>;
|
|
513
|
+
/**
|
|
514
|
+
* Returns the RevenueShareEscrow account meta for the placing user when `orderParams`
|
|
515
|
+
* carries a builder code (`builderIdx` + `builderFeeTenthBps`), otherwise `undefined`.
|
|
516
|
+
* The on-chain handlers peek for this account last in `remaining_accounts`, so callers
|
|
517
|
+
* must push it after the market/oracle/maker accounts.
|
|
518
|
+
*/
|
|
519
|
+
private getBuilderEscrowAccountMeta;
|
|
520
|
+
/**
|
|
521
|
+
* Returns the AccountMeta for the taker's RevenueShareEscrow when a fill of the
|
|
522
|
+
* taker's order must include it: the order carries a builder code, or the taker
|
|
523
|
+
* is referred (their escrow was initialized with a referrer). Returns `undefined`
|
|
524
|
+
* when neither applies so no account meta is added to the transaction. The
|
|
525
|
+
* on-chain handlers peek for this account last in `remaining_accounts`, so
|
|
526
|
+
* callers must push it after the market/oracle/maker accounts.
|
|
527
|
+
*
|
|
528
|
+
* Throws when `takerEscrow` does not belong to `takerAuthority`.
|
|
529
|
+
*/
|
|
530
|
+
private getTakerEscrowAccountMeta;
|
|
509
531
|
getPlacePerpOrderIx(orderParams: OptionalOrderParams, subAccountId?: number, depositToTradeArgs?: {
|
|
510
532
|
isMakingNewAccount: boolean;
|
|
511
533
|
depositMarketIndex: number;
|
|
@@ -572,18 +594,18 @@ export declare class VelocityClient {
|
|
|
572
594
|
placeScaleOrdersTx: Transaction | VersionedTransaction;
|
|
573
595
|
}>;
|
|
574
596
|
getPlaceScaleOrdersIx(params: ScaleOrderParams, subAccountId?: number): Promise<TransactionInstruction>;
|
|
575
|
-
fillPerpOrder(userAccountPublicKey: PublicKey, user: UserAccount, order?: Pick<Order, 'marketIndex' | 'orderId'>, makerInfo?: MakerInfo | MakerInfo[],
|
|
576
|
-
getFillPerpOrderIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, order: Pick<Order, 'marketIndex' | 'orderId'>, makerInfo?: MakerInfo | MakerInfo[],
|
|
597
|
+
fillPerpOrder(userAccountPublicKey: PublicKey, user: UserAccount, order?: Pick<Order, 'marketIndex' | 'orderId'>, makerInfo?: MakerInfo | MakerInfo[], txParams?: TxParams, fillerSubAccountId?: number, fillerAuthority?: PublicKey, hasBuilderFee?: boolean, takerEscrow?: RevenueShareEscrowAccount): Promise<TransactionSignature>;
|
|
598
|
+
getFillPerpOrderIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, order: Pick<Order, 'marketIndex' | 'orderId'>, makerInfo?: MakerInfo | MakerInfo[], fillerSubAccountId?: number, isSignedMsg?: boolean, fillerAuthority?: PublicKey, hasBuilderFee?: boolean, takerEscrow?: RevenueShareEscrowAccount): Promise<TransactionInstruction>;
|
|
577
599
|
getRevertFillIx(fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
|
|
578
600
|
placeSpotOrder(_orderParams: OptionalOrderParams, _txParams?: TxParams, _subAccountId?: number): Promise<TransactionSignature>;
|
|
579
601
|
preparePlaceSpotOrderTx(_orderParams: OptionalOrderParams, _txParams?: TxParams, _subAccountId?: number): Promise<void>;
|
|
580
602
|
getPlaceSpotOrderIx(_orderParams: OptionalOrderParams, _subAccountId?: number, _overrides?: {
|
|
581
603
|
authority?: PublicKey;
|
|
582
604
|
}): Promise<TransactionInstruction>;
|
|
583
|
-
fillSpotOrder(_userAccountPublicKey: PublicKey, _user: UserAccount, _order?: Pick<Order, 'marketIndex' | 'orderId'>, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo | MakerInfo[],
|
|
584
|
-
getFillSpotOrderIx(_userAccountPublicKey: PublicKey, _userAccount: UserAccount, _order?: Pick<Order, 'marketIndex' | 'orderId'>, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo | MakerInfo[],
|
|
605
|
+
fillSpotOrder(_userAccountPublicKey: PublicKey, _user: UserAccount, _order?: Pick<Order, 'marketIndex' | 'orderId'>, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo | MakerInfo[], _txParams?: TxParams): Promise<TransactionSignature>;
|
|
606
|
+
getFillSpotOrderIx(_userAccountPublicKey: PublicKey, _userAccount: UserAccount, _order?: Pick<Order, 'marketIndex' | 'orderId'>, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo | MakerInfo[], _fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
|
|
585
607
|
/**
|
|
586
|
-
* Swap tokens in
|
|
608
|
+
* Swap tokens in velocity account using titan or jupiter
|
|
587
609
|
* @param swapClient swap client to find routes and instructions (Titan or Jupiter)
|
|
588
610
|
* @param jupiterClient @deprecated Use swapClient instead. Legacy parameter for backward compatibility
|
|
589
611
|
* @param outMarketIndex the market index of the token you're buying
|
|
@@ -594,7 +616,7 @@ export declare class VelocityClient {
|
|
|
594
616
|
* @param slippageBps the max slippage passed to the swap provider api
|
|
595
617
|
* @param swapMode swap provider swapMode (ExactIn or ExactOut), default is ExactIn
|
|
596
618
|
* @param route the swap provider route to use for the swap
|
|
597
|
-
* @param reduceOnly specify if In or Out token on the
|
|
619
|
+
* @param reduceOnly specify if In or Out token on the velocity account must reduceOnly, checked at end of swap
|
|
598
620
|
* @param v6 pass in the quote response from swap provider quote's API (deprecated, use quote instead)
|
|
599
621
|
* @param quote pass in the quote response from swap provider quote's API
|
|
600
622
|
* @param txParams
|
|
@@ -652,7 +674,7 @@ export declare class VelocityClient {
|
|
|
652
674
|
lookupTables: AddressLookupTableAccount[];
|
|
653
675
|
}>;
|
|
654
676
|
/**
|
|
655
|
-
* Get the
|
|
677
|
+
* Get the velocity begin_swap and end_swap instructions
|
|
656
678
|
*
|
|
657
679
|
* @param outMarketIndex the market index of the token you're buying
|
|
658
680
|
* @param inMarketIndex the market index of the token you're selling
|
|
@@ -715,27 +737,27 @@ export declare class VelocityClient {
|
|
|
715
737
|
getUpdateUserStatsReferrerStatusIx(userAuthority: PublicKey): Promise<TransactionInstruction>;
|
|
716
738
|
updateUserOpenOrdersCount(userAccountPublicKey: PublicKey, user: UserAccount, txParams?: TxParams, fillerPublicKey?: PublicKey): Promise<TransactionSignature>;
|
|
717
739
|
getUpdateUserOpenOrdersCountIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
|
|
718
|
-
placeAndTakePerpOrder(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[],
|
|
719
|
-
preparePlaceAndTakePerpOrderWithAdditionalOrders(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[],
|
|
740
|
+
placeAndTakePerpOrder(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], successCondition?: PlaceAndTakeOrderSuccessCondition, auctionDurationPercentage?: number, txParams?: TxParams, subAccountId?: number, takerEscrow?: RevenueShareEscrowAccount): Promise<TransactionSignature>;
|
|
741
|
+
preparePlaceAndTakePerpOrderWithAdditionalOrders(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], bracketOrdersParams?: OptionalOrderParams[], txParams?: TxParams, subAccountId?: number, cancelExistingOrders?: boolean, settlePnl?: boolean, exitEarlyIfSimFails?: boolean, auctionDurationPercentage?: number, optionalIxs?: TransactionInstruction[], isolatedPositionDepositAmount?: BN): Promise<{
|
|
720
742
|
placeAndTakeTx: Transaction | VersionedTransaction;
|
|
721
743
|
cancelExistingOrdersTx: Transaction | VersionedTransaction;
|
|
722
744
|
settlePnlTx: Transaction | VersionedTransaction;
|
|
723
745
|
}>;
|
|
724
|
-
placeAndTakePerpWithAdditionalOrders(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[],
|
|
746
|
+
placeAndTakePerpWithAdditionalOrders(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], bracketOrdersParams?: OptionalOrderParams[], txParams?: TxParams, subAccountId?: number, cancelExistingOrders?: boolean, settlePnl?: boolean, exitEarlyIfSimFails?: boolean): Promise<{
|
|
725
747
|
txSig: TransactionSignature;
|
|
726
748
|
signedCancelExistingOrdersTx?: Transaction;
|
|
727
749
|
signedSettlePnlTx?: Transaction;
|
|
728
750
|
}>;
|
|
729
|
-
getPlaceAndTakePerpOrderIx(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[],
|
|
751
|
+
getPlaceAndTakePerpOrderIx(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], successCondition?: PlaceAndTakeOrderSuccessCondition, auctionDurationPercentage?: number, subAccountId?: number, overrides?: {
|
|
730
752
|
authority?: PublicKey;
|
|
731
|
-
}): Promise<TransactionInstruction>;
|
|
732
|
-
placeAndMakePerpOrder(orderParams: OptionalOrderParams, takerInfo: TakerInfo,
|
|
733
|
-
getPlaceAndMakePerpOrderIx(orderParams: OptionalOrderParams, takerInfo: TakerInfo,
|
|
753
|
+
}, takerEscrow?: RevenueShareEscrowAccount): Promise<TransactionInstruction>;
|
|
754
|
+
placeAndMakePerpOrder(orderParams: OptionalOrderParams, takerInfo: TakerInfo, txParams?: TxParams, subAccountId?: number, takerEscrow?: RevenueShareEscrowAccount): Promise<TransactionSignature>;
|
|
755
|
+
getPlaceAndMakePerpOrderIx(orderParams: OptionalOrderParams, takerInfo: TakerInfo, subAccountId?: number, takerEscrow?: RevenueShareEscrowAccount): Promise<TransactionInstruction>;
|
|
734
756
|
signSignedMsgOrderParamsMessage(orderParamsMessage: SignedMsgOrderParamsMessage | SignedMsgOrderParamsDelegateMessage, delegateSigner?: boolean): SignedMsgOrderParams;
|
|
735
757
|
/**
|
|
736
758
|
* Builds a deposit and place request for Swift service
|
|
737
759
|
*
|
|
738
|
-
* @param depositTx - The signed tx containing a
|
|
760
|
+
* @param depositTx - The signed tx containing a velocity deposit (e.g. see `buildSwiftDepositTx`)
|
|
739
761
|
* @param orderParamsMessage - The order parameters message to sign
|
|
740
762
|
* @param delegateSigner - Whether this is a delegate signer
|
|
741
763
|
*
|
|
@@ -765,18 +787,18 @@ export declare class VelocityClient {
|
|
|
765
787
|
takerStats: PublicKey;
|
|
766
788
|
takerUserAccount: UserAccount;
|
|
767
789
|
signingAuthority: PublicKey;
|
|
768
|
-
}, orderParams: OptionalOrderParams,
|
|
790
|
+
}, orderParams: OptionalOrderParams, txParams?: TxParams, subAccountId?: number, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number, takerEscrow?: RevenueShareEscrowAccount): Promise<TransactionSignature>;
|
|
769
791
|
getPlaceAndMakeSignedMsgPerpOrderIxs(signedSignedMsgOrderParams: SignedMsgOrderParams, signedMsgOrderUuid: Uint8Array, takerInfo: {
|
|
770
792
|
taker: PublicKey;
|
|
771
793
|
takerStats: PublicKey;
|
|
772
794
|
takerUserAccount: UserAccount;
|
|
773
795
|
signingAuthority: PublicKey;
|
|
774
|
-
}, orderParams: OptionalOrderParams,
|
|
775
|
-
preparePlaceAndTakeSpotOrder(_orderParams: OptionalOrderParams, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo,
|
|
776
|
-
placeAndTakeSpotOrder(_orderParams: OptionalOrderParams, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo,
|
|
777
|
-
getPlaceAndTakeSpotOrderIx(_orderParams: OptionalOrderParams, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo,
|
|
778
|
-
placeAndMakeSpotOrder(_orderParams: OptionalOrderParams, _takerInfo: TakerInfo, _fulfillmentConfig?: unknown,
|
|
779
|
-
getPlaceAndMakeSpotOrderIx(_orderParams: OptionalOrderParams, _takerInfo: TakerInfo, _fulfillmentConfig?: unknown,
|
|
796
|
+
}, orderParams: OptionalOrderParams, subAccountId?: number, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number, takerEscrow?: RevenueShareEscrowAccount): Promise<TransactionInstruction[]>;
|
|
797
|
+
preparePlaceAndTakeSpotOrder(_orderParams: OptionalOrderParams, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo, _txParams?: TxParams, _subAccountId?: number): Promise<void>;
|
|
798
|
+
placeAndTakeSpotOrder(_orderParams: OptionalOrderParams, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo, _txParams?: TxParams, _subAccountId?: number): Promise<TransactionSignature>;
|
|
799
|
+
getPlaceAndTakeSpotOrderIx(_orderParams: OptionalOrderParams, _fulfillmentConfig?: unknown, _makerInfo?: MakerInfo, _subAccountId?: number): Promise<TransactionInstruction>;
|
|
800
|
+
placeAndMakeSpotOrder(_orderParams: OptionalOrderParams, _takerInfo: TakerInfo, _fulfillmentConfig?: unknown, _txParams?: TxParams, _subAccountId?: number): Promise<TransactionSignature>;
|
|
801
|
+
getPlaceAndMakeSpotOrderIx(_orderParams: OptionalOrderParams, _takerInfo: TakerInfo, _fulfillmentConfig?: unknown, _subAccountId?: number): Promise<TransactionInstruction>;
|
|
780
802
|
/**
|
|
781
803
|
* @deprecated use {@link placePerpOrder} or {@link placeAndTakePerpOrder} instead
|
|
782
804
|
*/
|
|
@@ -790,7 +812,7 @@ export declare class VelocityClient {
|
|
|
790
812
|
* @param newOraclePriceOffset: The new oracle price offset for the order. One of [newBaseAmount|newLimitPrice|newOraclePriceOffset] must be provided.
|
|
791
813
|
* @returns
|
|
792
814
|
*/
|
|
793
|
-
modifyPerpOrder(orderId: number, newBaseAmount?: BN, newLimitPrice?: BN, newOraclePriceOffset?:
|
|
815
|
+
modifyPerpOrder(orderId: number, newBaseAmount?: BN, newLimitPrice?: BN, newOraclePriceOffset?: BN): Promise<TransactionSignature>;
|
|
794
816
|
/**
|
|
795
817
|
* Modifies an open order by closing it and replacing it with a new order.
|
|
796
818
|
* @deprecated use modifyOrderByUserOrderId instead
|
|
@@ -800,7 +822,7 @@ export declare class VelocityClient {
|
|
|
800
822
|
* @param newOraclePriceOffset: The new oracle price offset for the order. One of [newBaseAmount|newLimitPrice|newOraclePriceOffset] must be provided.
|
|
801
823
|
* @returns
|
|
802
824
|
*/
|
|
803
|
-
modifyPerpOrderByUserOrderId(userOrderId: number, newBaseAmount?: BN, newLimitPrice?: BN, newOraclePriceOffset?:
|
|
825
|
+
modifyPerpOrderByUserOrderId(userOrderId: number, newBaseAmount?: BN, newLimitPrice?: BN, newOraclePriceOffset?: BN): Promise<TransactionSignature>;
|
|
804
826
|
/**
|
|
805
827
|
* Modifies an open order (spot or perp) by closing it and replacing it with a new order.
|
|
806
828
|
* @param orderParams.orderId: The open order to modify
|
|
@@ -824,7 +846,7 @@ export declare class VelocityClient {
|
|
|
824
846
|
newDirection?: PositionDirection;
|
|
825
847
|
newBaseAmount?: BN;
|
|
826
848
|
newLimitPrice?: BN;
|
|
827
|
-
newOraclePriceOffset?:
|
|
849
|
+
newOraclePriceOffset?: BN;
|
|
828
850
|
newTriggerPrice?: BN;
|
|
829
851
|
newTriggerCondition?: OrderTriggerCondition;
|
|
830
852
|
auctionDuration?: number;
|
|
@@ -847,7 +869,7 @@ export declare class VelocityClient {
|
|
|
847
869
|
newDirection?: PositionDirection;
|
|
848
870
|
newBaseAmount?: BN;
|
|
849
871
|
newLimitPrice?: BN;
|
|
850
|
-
newOraclePriceOffset?:
|
|
872
|
+
newOraclePriceOffset?: BN;
|
|
851
873
|
newTriggerPrice?: BN;
|
|
852
874
|
newTriggerCondition?: OrderTriggerCondition;
|
|
853
875
|
auctionDuration?: number;
|
|
@@ -885,7 +907,7 @@ export declare class VelocityClient {
|
|
|
885
907
|
newDirection?: PositionDirection;
|
|
886
908
|
newBaseAmount?: BN;
|
|
887
909
|
newLimitPrice?: BN;
|
|
888
|
-
newOraclePriceOffset?:
|
|
910
|
+
newOraclePriceOffset?: BN;
|
|
889
911
|
newTriggerPrice?: BN;
|
|
890
912
|
newTriggerCondition?: OrderTriggerCondition;
|
|
891
913
|
auctionDuration?: number;
|
|
@@ -902,7 +924,7 @@ export declare class VelocityClient {
|
|
|
902
924
|
newDirection?: PositionDirection;
|
|
903
925
|
newBaseAmount?: BN;
|
|
904
926
|
newLimitPrice?: BN;
|
|
905
|
-
newOraclePriceOffset?:
|
|
927
|
+
newOraclePriceOffset?: BN;
|
|
906
928
|
newTriggerPrice?: BN;
|
|
907
929
|
newTriggerCondition?: OrderTriggerCondition;
|
|
908
930
|
auctionDuration?: number;
|
|
@@ -939,7 +961,7 @@ export declare class VelocityClient {
|
|
|
939
961
|
getLiquidatePerpWithFillIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number, makerInfos: MakerInfo[], liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
|
|
940
962
|
liquidateSpot(userAccountPublicKey: PublicKey, userAccount: UserAccount, assetMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN, limitPrice?: BN, txParams?: TxParams, liquidatorSubAccountId?: number): Promise<TransactionSignature>;
|
|
941
963
|
getLiquidateSpotIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, assetMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN, limitPrice?: BN, liquidatorSubAccountId?: number): Promise<TransactionInstruction>;
|
|
942
|
-
getJupiterLiquidateSpotWithSwapIxV6({ jupiterClient, liabilityMarketIndex, assetMarketIndex, swapAmount, assetTokenAccount, liabilityTokenAccount, slippageBps, swapMode, onlyDirectRoutes, quote, userAccount, userAccountPublicKey,
|
|
964
|
+
getJupiterLiquidateSpotWithSwapIxV6({ jupiterClient, liabilityMarketIndex, assetMarketIndex, swapAmount, assetTokenAccount, liabilityTokenAccount, slippageBps, swapMode, onlyDirectRoutes, quote, userAccount, userAccountPublicKey, liquidatorSubAccountId, maxAccounts, }: {
|
|
943
965
|
jupiterClient: JupiterClient;
|
|
944
966
|
liabilityMarketIndex: number;
|
|
945
967
|
assetMarketIndex: number;
|
|
@@ -952,7 +974,6 @@ export declare class VelocityClient {
|
|
|
952
974
|
quote?: QuoteResponse;
|
|
953
975
|
userAccount: UserAccount;
|
|
954
976
|
userAccountPublicKey: PublicKey;
|
|
955
|
-
userStatsAccountPublicKey: PublicKey;
|
|
956
977
|
liquidatorSubAccountId?: number;
|
|
957
978
|
maxAccounts?: number;
|
|
958
979
|
}): Promise<{
|
|
@@ -960,7 +981,7 @@ export declare class VelocityClient {
|
|
|
960
981
|
lookupTables: AddressLookupTableAccount[];
|
|
961
982
|
}>;
|
|
962
983
|
/**
|
|
963
|
-
* Get the
|
|
984
|
+
* Get the velocity liquidate_spot_with_swap instructions
|
|
964
985
|
*
|
|
965
986
|
* @param liabilityMarketIndex the market index of the token you're buying
|
|
966
987
|
* @param assetMarketIndex the market index of the token you're selling
|
|
@@ -969,9 +990,8 @@ export declare class VelocityClient {
|
|
|
969
990
|
* @param liabilityTokenAccount the token account to receive the tokens being bought
|
|
970
991
|
* @param userAccount
|
|
971
992
|
* @param userAccountPublicKey
|
|
972
|
-
* @param userStatsAccountPublicKey
|
|
973
993
|
*/
|
|
974
|
-
getLiquidateSpotWithSwapIx({ liabilityMarketIndex, assetMarketIndex, swapAmount: swapAmount, assetTokenAccount, liabilityTokenAccount, userAccount, userAccountPublicKey,
|
|
994
|
+
getLiquidateSpotWithSwapIx({ liabilityMarketIndex, assetMarketIndex, swapAmount: swapAmount, assetTokenAccount, liabilityTokenAccount, userAccount, userAccountPublicKey, liquidatorSubAccountId, }: {
|
|
975
995
|
liabilityMarketIndex: number;
|
|
976
996
|
assetMarketIndex: number;
|
|
977
997
|
swapAmount: BN;
|
|
@@ -979,7 +999,6 @@ export declare class VelocityClient {
|
|
|
979
999
|
liabilityTokenAccount: PublicKey;
|
|
980
1000
|
userAccount: UserAccount;
|
|
981
1001
|
userAccountPublicKey: PublicKey;
|
|
982
|
-
userStatsAccountPublicKey: PublicKey;
|
|
983
1002
|
liquidatorSubAccountId?: number;
|
|
984
1003
|
}): Promise<{
|
|
985
1004
|
beginSwapIx: TransactionInstruction;
|
|
@@ -1076,7 +1095,7 @@ export declare class VelocityClient {
|
|
|
1076
1095
|
getResolvePerpPnlDeficitIx(spotMarketIndex: number, perpMarketIndex: number): Promise<TransactionInstruction>;
|
|
1077
1096
|
getDepositIntoSpotMarketRevenuePoolIx(marketIndex: number, amount: BN, userTokenAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
|
|
1078
1097
|
/**
|
|
1079
|
-
* This ix will donate your funds to
|
|
1098
|
+
* This ix will donate your funds to velocity revenue pool. It does not deposit into your user account
|
|
1080
1099
|
* @param marketIndex
|
|
1081
1100
|
* @param amount
|
|
1082
1101
|
* @param userTokenAccountPublicKey
|
|
@@ -1223,8 +1242,4 @@ export declare class VelocityClient {
|
|
|
1223
1242
|
}>;
|
|
1224
1243
|
isOrderIncreasingPosition(orderParams: OptionalOrderParams, subAccountId: number): boolean;
|
|
1225
1244
|
}
|
|
1226
|
-
/** @deprecated Use `VelocityClient` instead. `DriftClient` will be removed in a future major. */
|
|
1227
|
-
export declare const DriftClient: typeof VelocityClient;
|
|
1228
|
-
/** @deprecated Use `VelocityClient` instead. `DriftClient` will be removed in a future major. */
|
|
1229
|
-
export type DriftClient = VelocityClient;
|
|
1230
1245
|
export {};
|