@velocity-exchange/sdk 0.0.5 → 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 +20 -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/dlob/DLOB.d.ts +1 -1
- package/lib/browser/dlob/DLOB.js +6 -6
- 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} +1042 -767
- package/lib/browser/idl/{drift.json → velocity.json} +1033 -758
- 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.js +16 -12
- 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 +9 -9
- 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 +79 -91
- 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 +53 -38
- package/lib/browser/velocityClient.js +258 -196
- 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/dlob/DLOB.d.ts +1 -1
- package/lib/node/dlob/DLOB.d.ts.map +1 -1
- package/lib/node/dlob/DLOB.js +6 -6
- 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} +1043 -768
- package/lib/node/idl/velocity.d.ts.map +1 -0
- package/lib/node/idl/{drift.json → velocity.json} +1033 -758
- 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.map +1 -1
- package/lib/node/math/auction.js +16 -12
- 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 +9 -9
- 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 +79 -91
- 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 +53 -38
- package/lib/node/velocityClient.d.ts.map +1 -1
- package/lib/node/velocityClient.js +258 -196
- 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 -67
- 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/dlob/DLOB.ts +6 -6
- 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} +1033 -758
- package/src/idl/{drift.ts → velocity.ts} +1035 -760
- 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 +16 -12
- 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 +18 -5
- 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 +3 -13
- 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 +84 -102
- 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 +339 -225
- package/src/velocityClientConfig.ts +0 -10
- package/tests/{DriftCore → VelocityCore}/decode.test.ts +1 -1
- package/tests/{DriftCore → VelocityCore}/fill_trigger.test.ts +1 -1
- package/tests/{DriftCore → VelocityCore}/instructions.test.ts +1 -1
- package/tests/{DriftCore → VelocityCore}/pdas.test.ts +4 -2
- package/tests/ci/verifyConstants.ts +24 -27
- package/tests/decode/test.ts +2 -2
- package/tests/dlob/helpers.ts +5 -9
- package/tests/events/parseLogsForCuUsage.ts +15 -15
- package/tests/user/helpers.ts +9 -9
- 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 -21
- /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
|
@@ -23,10 +23,6 @@ export class PriorityFeeSubscriber {
|
|
|
23
23
|
frequencyMs: number;
|
|
24
24
|
addresses: string[];
|
|
25
25
|
velocityMarkets?: VelocityMarketInfo[];
|
|
26
|
-
/** @deprecated Use `velocityMarkets` instead. `driftMarkets` will be removed in a future major. */
|
|
27
|
-
public get driftMarkets(): VelocityMarketInfo[] | undefined {
|
|
28
|
-
return this.velocityMarkets;
|
|
29
|
-
}
|
|
30
26
|
customStrategy?: PriorityFeeStrategy;
|
|
31
27
|
averageStrategy = new AverageOverSlotsStrategy();
|
|
32
28
|
maxStrategy = new MaxOverSlotsStrategy();
|
|
@@ -36,10 +32,6 @@ export class PriorityFeeSubscriber {
|
|
|
36
32
|
priorityFeeMultiplier?: number;
|
|
37
33
|
|
|
38
34
|
velocityPriorityFeeEndpoint?: string;
|
|
39
|
-
/** @deprecated Use `velocityPriorityFeeEndpoint` instead. `driftPriorityFeeEndpoint` will be removed in a future major. */
|
|
40
|
-
public get driftPriorityFeeEndpoint(): string | undefined {
|
|
41
|
-
return this.velocityPriorityFeeEndpoint;
|
|
42
|
-
}
|
|
43
35
|
heliusRpcUrl?: string;
|
|
44
36
|
lastHeliusSample?: HeliusPriorityFeeLevels;
|
|
45
37
|
|
|
@@ -58,7 +50,7 @@ export class PriorityFeeSubscriber {
|
|
|
58
50
|
this.addresses = config.addresses
|
|
59
51
|
? config.addresses.map((address) => address.toBase58())
|
|
60
52
|
: [];
|
|
61
|
-
this.velocityMarkets = config.velocityMarkets
|
|
53
|
+
this.velocityMarkets = config.velocityMarkets;
|
|
62
54
|
|
|
63
55
|
if (config.customStrategy) {
|
|
64
56
|
this.customStrategy = config.customStrategy;
|
|
@@ -84,7 +76,8 @@ export class PriorityFeeSubscriber {
|
|
|
84
76
|
}
|
|
85
77
|
} else if (this.priorityFeeMethod === PriorityFeeMethod.VELOCITY) {
|
|
86
78
|
this.velocityPriorityFeeEndpoint =
|
|
87
|
-
config.velocityPriorityFeeEndpoint ??
|
|
79
|
+
config.velocityPriorityFeeEndpoint ??
|
|
80
|
+
config.velocityPriorityFeeEndpoint;
|
|
88
81
|
}
|
|
89
82
|
}
|
|
90
83
|
|
|
@@ -146,7 +139,7 @@ export class PriorityFeeSubscriber {
|
|
|
146
139
|
}
|
|
147
140
|
}
|
|
148
141
|
|
|
149
|
-
private async
|
|
142
|
+
private async loadForVelocity(): Promise<void> {
|
|
150
143
|
if (!this.velocityMarkets) {
|
|
151
144
|
return;
|
|
152
145
|
}
|
|
@@ -228,7 +221,7 @@ export class PriorityFeeSubscriber {
|
|
|
228
221
|
} else if (this.priorityFeeMethod === PriorityFeeMethod.HELIUS) {
|
|
229
222
|
await this.loadForHelius();
|
|
230
223
|
} else if (this.priorityFeeMethod === PriorityFeeMethod.VELOCITY) {
|
|
231
|
-
await this.
|
|
224
|
+
await this.loadForVelocity();
|
|
232
225
|
} else {
|
|
233
226
|
throw new Error(`${this.priorityFeeMethod} load not implemented`);
|
|
234
227
|
}
|
|
@@ -17,15 +17,7 @@ export class PriorityFeeSubscriberMap {
|
|
|
17
17
|
intervalId?: ReturnType<typeof setTimeout>;
|
|
18
18
|
|
|
19
19
|
velocityMarkets?: VelocityMarketInfo[];
|
|
20
|
-
/** @deprecated Use `velocityMarkets` instead. `driftMarkets` will be removed in a future major. */
|
|
21
|
-
public get driftMarkets(): VelocityMarketInfo[] | undefined {
|
|
22
|
-
return this.velocityMarkets;
|
|
23
|
-
}
|
|
24
20
|
velocityPriorityFeeEndpoint: string;
|
|
25
|
-
/** @deprecated Use `velocityPriorityFeeEndpoint` instead. `driftPriorityFeeEndpoint` will be removed in a future major. */
|
|
26
|
-
public get driftPriorityFeeEndpoint(): string {
|
|
27
|
-
return this.velocityPriorityFeeEndpoint;
|
|
28
|
-
}
|
|
29
21
|
feesMap: Map<string, Map<number, VelocityPriorityFeeLevels>>; // marketType -> marketIndex -> priority fee
|
|
30
22
|
|
|
31
23
|
public constructor(config: PriorityFeeSubscriberMapConfig) {
|
|
@@ -33,8 +25,8 @@ export class PriorityFeeSubscriberMap {
|
|
|
33
25
|
config.frequencyMs ?? DEFAULT_PRIORITY_FEE_MAP_FREQUENCY_MS;
|
|
34
26
|
// Type-system guarantees at least one of the two is supplied.
|
|
35
27
|
this.velocityPriorityFeeEndpoint = (config.velocityPriorityFeeEndpoint ??
|
|
36
|
-
config.
|
|
37
|
-
this.velocityMarkets = config.velocityMarkets
|
|
28
|
+
config.velocityPriorityFeeEndpoint)!;
|
|
29
|
+
this.velocityMarkets = config.velocityMarkets;
|
|
38
30
|
this.feesMap = new Map<string, Map<number, VelocityPriorityFeeLevels>>();
|
|
39
31
|
this.feesMap.set('perp', new Map<number, VelocityPriorityFeeLevels>());
|
|
40
32
|
this.feesMap.set('spot', new Map<number, VelocityPriorityFeeLevels>());
|
package/src/priorityFee/types.ts
CHANGED
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
VelocityMarketInfo,
|
|
6
6
|
VelocityPriorityFeeResponse,
|
|
7
7
|
} from './velocityPriorityFeeMethod';
|
|
8
|
-
import { AtLeastOne } from '../util/deprecatedAlias';
|
|
9
8
|
|
|
10
9
|
export const DEFAULT_PRIORITY_FEE_MAP_FREQUENCY_MS = 10_000;
|
|
11
10
|
|
|
@@ -35,8 +34,6 @@ export type PriorityFeeSubscriberConfig = {
|
|
|
35
34
|
addresses?: PublicKey[];
|
|
36
35
|
/// market type and index, optionally provide at initialization time if using priorityFeeMethod.VELOCITY
|
|
37
36
|
velocityMarkets?: VelocityMarketInfo[];
|
|
38
|
-
/** @deprecated Use `velocityMarkets` instead. `driftMarkets` will be removed in a future major. */
|
|
39
|
-
driftMarkets?: VelocityMarketInfo[];
|
|
40
37
|
/// custom strategy to calculate priority fees, defaults to AVERAGE
|
|
41
38
|
customStrategy?: PriorityFeeStrategy;
|
|
42
39
|
/// method for fetching priority fee samples
|
|
@@ -47,8 +44,6 @@ export type PriorityFeeSubscriberConfig = {
|
|
|
47
44
|
heliusRpcUrl?: string;
|
|
48
45
|
/// url for Velocity cached priority fee endpoint, required if using priorityFeeMethod.VELOCITY
|
|
49
46
|
velocityPriorityFeeEndpoint?: string;
|
|
50
|
-
/** @deprecated Use `velocityPriorityFeeEndpoint` instead. `driftPriorityFeeEndpoint` will be removed in a future major. */
|
|
51
|
-
driftPriorityFeeEndpoint?: string;
|
|
52
47
|
/// clamp any returned priority fee value to this value.
|
|
53
48
|
maxFeeMicroLamports?: number;
|
|
54
49
|
/// multiplier applied to priority fee before maxFeeMicroLamports, defaults to 1.0
|
|
@@ -60,15 +55,10 @@ type PriorityFeeSubscriberMapConfigBase = {
|
|
|
60
55
|
frequencyMs?: number;
|
|
61
56
|
/// market type and associated market index to query
|
|
62
57
|
velocityMarkets?: VelocityMarketInfo[];
|
|
63
|
-
/** @deprecated Use `velocityMarkets` instead. `driftMarkets` will be removed in a future major. */
|
|
64
|
-
driftMarkets?: VelocityMarketInfo[];
|
|
65
58
|
};
|
|
66
59
|
|
|
67
60
|
/// url for Velocity cached priority fee endpoint
|
|
68
61
|
export type PriorityFeeSubscriberMapConfig =
|
|
69
|
-
PriorityFeeSubscriberMapConfigBase &
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
'driftPriorityFeeEndpoint',
|
|
73
|
-
string
|
|
74
|
-
>;
|
|
62
|
+
PriorityFeeSubscriberMapConfigBase & {
|
|
63
|
+
velocityPriorityFeeEndpoint: string;
|
|
64
|
+
};
|
|
@@ -6,9 +6,6 @@ export type VelocityMarketInfo = {
|
|
|
6
6
|
marketIndex: number;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
/** @deprecated Use `VelocityMarketInfo` instead. `DriftMarketInfo` will be removed in a future major. */
|
|
10
|
-
export type DriftMarketInfo = VelocityMarketInfo;
|
|
11
|
-
|
|
12
9
|
export type VelocityPriorityFeeLevels = {
|
|
13
10
|
[key in HeliusPriorityLevel]: number;
|
|
14
11
|
} & {
|
|
@@ -16,14 +13,8 @@ export type VelocityPriorityFeeLevels = {
|
|
|
16
13
|
marketIndex: number;
|
|
17
14
|
};
|
|
18
15
|
|
|
19
|
-
/** @deprecated Use `VelocityPriorityFeeLevels` instead. `DriftPriorityFeeLevels` will be removed in a future major. */
|
|
20
|
-
export type DriftPriorityFeeLevels = VelocityPriorityFeeLevels;
|
|
21
|
-
|
|
22
16
|
export type VelocityPriorityFeeResponse = VelocityPriorityFeeLevels[];
|
|
23
17
|
|
|
24
|
-
/** @deprecated Use `VelocityPriorityFeeResponse` instead. `DriftPriorityFeeResponse` will be removed in a future major. */
|
|
25
|
-
export type DriftPriorityFeeResponse = VelocityPriorityFeeResponse;
|
|
26
|
-
|
|
27
18
|
export async function fetchVelocityPriorityFee(
|
|
28
19
|
url: string,
|
|
29
20
|
marketTypes: string[],
|
|
@@ -49,6 +40,3 @@ export async function fetchVelocityPriorityFee(
|
|
|
49
40
|
|
|
50
41
|
return [];
|
|
51
42
|
}
|
|
52
|
-
|
|
53
|
-
/** @deprecated Use `fetchVelocityPriorityFee` instead. `fetchDriftPriorityFee` will be removed in a future major. */
|
|
54
|
-
export const fetchDriftPriorityFee = fetchVelocityPriorityFee;
|
|
@@ -50,7 +50,7 @@ export class PythLazerSubscriber {
|
|
|
50
50
|
* @param endpoints - Array of WebSocket endpoint URLs for Pyth Lazer
|
|
51
51
|
* @param token - Authentication token for Pyth Lazer API
|
|
52
52
|
* @param priceFeedArrays - Array of price feed configurations to subscribe to
|
|
53
|
-
* @param env -
|
|
53
|
+
* @param env - Velocity environment (mainnet-beta, devnet, etc.)
|
|
54
54
|
* @param resubTimeoutMs - Milliseconds to wait before resubscribing on data timeout
|
|
55
55
|
* @param sdkLogging - Whether to log Pyth SDK logs to the console. This is very noisy but could be useful for debugging.
|
|
56
56
|
* @param feedProperties - Price feed properties to request. Must include both 'price' and 'exponent' (required for getPriceFromMarketIndex). Defaults to ['price', 'bestAskPrice', 'bestBidPrice', 'exponent']. Stored by copy so caller mutation does not affect this instance.
|
|
@@ -270,7 +270,7 @@ export class UnifiedSwapClient {
|
|
|
270
270
|
slippageBps,
|
|
271
271
|
swapMode: isExactOut ? TitanSwapMode.ExactOut : TitanSwapMode.ExactIn,
|
|
272
272
|
onlyDirectRoutes,
|
|
273
|
-
sizeConstraint: sizeConstraint || 1280 - 375, // MAX_TX_BYTE_SIZE - buffer for
|
|
273
|
+
sizeConstraint: sizeConstraint || 1280 - 375, // MAX_TX_BYTE_SIZE - buffer for velocity instructions
|
|
274
274
|
});
|
|
275
275
|
|
|
276
276
|
swapInstructions = titanClient.getTitanInstructions({
|
|
@@ -4,7 +4,6 @@ import { SignedMsgOrderId, SignedMsgUserOrdersAccount } from '../types';
|
|
|
4
4
|
import { Commitment, Context, PublicKey } from '@solana/web3.js';
|
|
5
5
|
import { ResubOpts } from '../accounts/types';
|
|
6
6
|
import { VelocityClient } from '../velocityClient';
|
|
7
|
-
import { AtLeastOne } from '../util/deprecatedAlias';
|
|
8
7
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
9
8
|
import { EventEmitter } from 'events';
|
|
10
9
|
|
|
@@ -13,7 +12,7 @@ export type SignedMsgUserOrdersAccountSubscriberConfig = {
|
|
|
13
12
|
resubOpts?: ResubOpts;
|
|
14
13
|
decodeFn?: (name: string, data: Buffer) => SignedMsgUserOrdersAccount;
|
|
15
14
|
resyncIntervalMs?: number;
|
|
16
|
-
} &
|
|
15
|
+
} & { velocityClient: VelocityClient };
|
|
17
16
|
|
|
18
17
|
export interface SignedMsgUserOrdersAccountSubscriberEvents {
|
|
19
18
|
onAccountUpdate: (
|
|
@@ -31,10 +30,6 @@ export interface SignedMsgUserOrdersAccountSubscriberEvents {
|
|
|
31
30
|
|
|
32
31
|
export class SignedMsgUserOrdersAccountSubscriber {
|
|
33
32
|
protected velocityClient: VelocityClient;
|
|
34
|
-
/** @deprecated Use `velocityClient` instead. `driftClient` will be removed in a future major. */
|
|
35
|
-
protected get driftClient(): VelocityClient {
|
|
36
|
-
return this.velocityClient;
|
|
37
|
-
}
|
|
38
33
|
protected commitment: Commitment;
|
|
39
34
|
protected resubOpts?: ResubOpts;
|
|
40
35
|
protected resyncTimeoutId?: ReturnType<typeof setTimeout>;
|
|
@@ -60,7 +55,6 @@ export class SignedMsgUserOrdersAccountSubscriber {
|
|
|
60
55
|
|
|
61
56
|
constructor({
|
|
62
57
|
velocityClient,
|
|
63
|
-
driftClient,
|
|
64
58
|
commitment,
|
|
65
59
|
resubOpts,
|
|
66
60
|
decodeFn,
|
|
@@ -69,7 +63,7 @@ export class SignedMsgUserOrdersAccountSubscriber {
|
|
|
69
63
|
this.commitment = commitment ?? 'confirmed';
|
|
70
64
|
this.resubOpts = resubOpts;
|
|
71
65
|
// Type-system guarantees at least one of the two is supplied.
|
|
72
|
-
this.velocityClient =
|
|
66
|
+
this.velocityClient = velocityClient!;
|
|
73
67
|
this.decodeFn =
|
|
74
68
|
decodeFn ??
|
|
75
69
|
(
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
} from '../constants/perpMarkets';
|
|
5
5
|
import { VelocityClient } from '../velocityClient';
|
|
6
6
|
import { VelocityEnv } from '../config';
|
|
7
|
-
import { AtLeastOne } from '../util/deprecatedAlias';
|
|
8
7
|
import {
|
|
9
8
|
getUserAccountPublicKey,
|
|
10
9
|
getUserStatsAccountPublicKey,
|
|
@@ -33,16 +32,16 @@ type SwiftOrderSubscriberConfigBase = {
|
|
|
33
32
|
endpoint?: string;
|
|
34
33
|
marketIndexes: number[];
|
|
35
34
|
/**
|
|
36
|
-
In the future, this will be used for verifying $
|
|
35
|
+
In the future, this will be used for verifying $VELOCITY stake as we add
|
|
37
36
|
authentication for delegate signers
|
|
38
37
|
For now, pass a new keypair or a keypair to an empty wallet
|
|
39
38
|
*/
|
|
40
39
|
keypair: Keypair;
|
|
41
40
|
};
|
|
42
41
|
|
|
43
|
-
export type SwiftOrderSubscriberConfig = SwiftOrderSubscriberConfigBase &
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
export type SwiftOrderSubscriberConfig = SwiftOrderSubscriberConfigBase & {
|
|
43
|
+
velocityEnv: VelocityEnv;
|
|
44
|
+
} & { velocityClient: VelocityClient };
|
|
46
45
|
|
|
47
46
|
/**
|
|
48
47
|
* Swift order message received from WebSocket
|
|
@@ -74,10 +73,6 @@ export class SwiftOrderSubscriber {
|
|
|
74
73
|
private readonly heartbeatIntervalMs = 60000;
|
|
75
74
|
private ws: WebSocket | null = null;
|
|
76
75
|
private velocityClient: VelocityClient;
|
|
77
|
-
/** @deprecated Use `velocityClient` instead. `driftClient` will be removed in a future major. */
|
|
78
|
-
private get driftClient(): VelocityClient {
|
|
79
|
-
return this.velocityClient;
|
|
80
|
-
}
|
|
81
76
|
public userAccountGetter?: AccountGetter; // In practice, this for now is just an OrderSubscriber or a UserMap
|
|
82
77
|
public onOrder: (
|
|
83
78
|
orderMessageRaw: SwiftOrderMessage,
|
|
@@ -91,7 +86,7 @@ export class SwiftOrderSubscriber {
|
|
|
91
86
|
|
|
92
87
|
constructor(private config: SwiftOrderSubscriberConfig) {
|
|
93
88
|
// Type-system guarantees at least one of the two is supplied.
|
|
94
|
-
this.velocityClient =
|
|
89
|
+
this.velocityClient = config.velocityClient!;
|
|
95
90
|
this.userAccountGetter = config.userAccountGetter;
|
|
96
91
|
}
|
|
97
92
|
|
|
@@ -105,7 +100,7 @@ export class SwiftOrderSubscriber {
|
|
|
105
100
|
}
|
|
106
101
|
|
|
107
102
|
getSymbolForMarketIndex(marketIndex: number): string {
|
|
108
|
-
const env = this.config.velocityEnv
|
|
103
|
+
const env = this.config.velocityEnv;
|
|
109
104
|
const markets = env === 'devnet' ? DevnetPerpMarkets : MainnetPerpMarkets;
|
|
110
105
|
return markets[marketIndex].symbol;
|
|
111
106
|
}
|
|
@@ -162,7 +157,7 @@ export class SwiftOrderSubscriber {
|
|
|
162
157
|
): Promise<void> {
|
|
163
158
|
this.onOrder = onOrder;
|
|
164
159
|
|
|
165
|
-
const env = this.config.velocityEnv
|
|
160
|
+
const env = this.config.velocityEnv;
|
|
166
161
|
const endpoint =
|
|
167
162
|
this.config.endpoint ??
|
|
168
163
|
(env === 'devnet'
|
package/src/types.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared TypeScript types for the
|
|
2
|
+
* Shared TypeScript types for the Velocity SDK.
|
|
3
3
|
*
|
|
4
4
|
* Contains TypeScript mirrors of all on-chain account structs (UserAccount, PerpMarketAccount,
|
|
5
5
|
* SpotMarketAccount, StateAccount, OracleData, etc.), instruction parameter types (OrderParams,
|
|
6
6
|
* ModifyOrderParams), enums (MarketType, OrderType, PositionDirection, OracleSource), and
|
|
7
7
|
* precision constants used throughout the SDK.
|
|
8
8
|
*
|
|
9
|
-
* The authoritative layout source is `sdk/src/idl/
|
|
9
|
+
* The authoritative layout source is `sdk/src/idl/velocity.json` (generated from the program).
|
|
10
10
|
* Do not edit struct shapes here without a corresponding on-chain change.
|
|
11
11
|
*/
|
|
12
12
|
import {
|
|
@@ -385,9 +385,8 @@ export type SpotInterestRecord = {
|
|
|
385
385
|
maxBorrowRate: number;
|
|
386
386
|
};
|
|
387
387
|
|
|
388
|
-
export type
|
|
388
|
+
export type AmmCurveChanged = {
|
|
389
389
|
ts: BN;
|
|
390
|
-
recordId: BN;
|
|
391
390
|
marketIndex: number;
|
|
392
391
|
pegMultiplierBefore: BN;
|
|
393
392
|
baseAssetReserveBefore: BN;
|
|
@@ -397,15 +396,9 @@ export type CurveRecord = {
|
|
|
397
396
|
baseAssetReserveAfter: BN;
|
|
398
397
|
quoteAssetReserveAfter: BN;
|
|
399
398
|
sqrtKAfter: BN;
|
|
400
|
-
baseAssetAmountLong: BN;
|
|
401
|
-
baseAssetAmountShort: BN;
|
|
402
|
-
baseAssetAmountWithAmm: BN;
|
|
403
|
-
totalFee: BN;
|
|
404
|
-
totalFeeMinusDistributions: BN;
|
|
405
399
|
adjustmentCost: BN;
|
|
406
|
-
|
|
400
|
+
totalFeeMinusDistributionsAfter: BN;
|
|
407
401
|
oraclePrice: BN;
|
|
408
|
-
fillRecord: BN;
|
|
409
402
|
};
|
|
410
403
|
|
|
411
404
|
export declare type InsuranceFundRecord = {
|
|
@@ -447,7 +440,6 @@ export type FundingRateRecord = {
|
|
|
447
440
|
cumulativeFundingRateShort: BN;
|
|
448
441
|
oraclePriceTwap: BN;
|
|
449
442
|
markPriceTwap: BN;
|
|
450
|
-
periodRevenue: BN;
|
|
451
443
|
baseAssetAmountWithAmm: BN;
|
|
452
444
|
};
|
|
453
445
|
|
|
@@ -816,13 +808,13 @@ export type PerpMarketAccount = {
|
|
|
816
808
|
pubkey: PublicKey;
|
|
817
809
|
name: number[];
|
|
818
810
|
amm: AMM;
|
|
811
|
+
marketStats: MarketStats;
|
|
819
812
|
numberOfUsersWithBase: number;
|
|
820
813
|
numberOfUsers: number;
|
|
821
814
|
marginRatioInitial: number;
|
|
822
815
|
marginRatioMaintenance: number;
|
|
823
816
|
nextFillRecordId: BN;
|
|
824
817
|
nextFundingRateRecordId: BN;
|
|
825
|
-
nextCurveRecordId: BN;
|
|
826
818
|
pnlPool: PoolBalance;
|
|
827
819
|
liquidatorFee: number;
|
|
828
820
|
ifLiquidationFee: number;
|
|
@@ -844,12 +836,41 @@ export type PerpMarketAccount = {
|
|
|
844
836
|
|
|
845
837
|
lastFillPrice: BN;
|
|
846
838
|
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
839
|
+
hedgeConfig: {
|
|
840
|
+
poolId: number;
|
|
841
|
+
status: number;
|
|
842
|
+
pausedOperations: number;
|
|
843
|
+
exchangeFeeExclusionScalar: number;
|
|
844
|
+
feeTransferScalar: number;
|
|
845
|
+
};
|
|
852
846
|
marketConfig: number;
|
|
847
|
+
|
|
848
|
+
// Fields migrated off AMM to top-level PerpMarket
|
|
849
|
+
oracle: PublicKey;
|
|
850
|
+
oracleSource: OracleSource;
|
|
851
|
+
oracleSlotDelayOverride: number;
|
|
852
|
+
oracleLowRiskSlotDelayOverride: number;
|
|
853
|
+
baseAssetAmountLong: BN;
|
|
854
|
+
baseAssetAmountShort: BN;
|
|
855
|
+
quoteAssetAmount: BN;
|
|
856
|
+
quoteEntryAmountLong: BN;
|
|
857
|
+
quoteEntryAmountShort: BN;
|
|
858
|
+
quoteBreakEvenAmountLong: BN;
|
|
859
|
+
quoteBreakEvenAmountShort: BN;
|
|
860
|
+
totalSocialLoss: BN;
|
|
861
|
+
maxOpenInterest: BN;
|
|
862
|
+
totalExchangeFee: BN;
|
|
863
|
+
totalLiquidationFee: BN;
|
|
864
|
+
cumulativeFundingRateLong: BN;
|
|
865
|
+
cumulativeFundingRateShort: BN;
|
|
866
|
+
lastFundingRate: BN;
|
|
867
|
+
lastFundingRateLong: BN;
|
|
868
|
+
lastFundingRateShort: BN;
|
|
869
|
+
lastFundingRateTs: BN;
|
|
870
|
+
netUnsettledFundingPnl: BN;
|
|
871
|
+
lastFundingOracleTwap: BN;
|
|
872
|
+
orderStepSize: BN;
|
|
873
|
+
orderTickSize: BN;
|
|
853
874
|
};
|
|
854
875
|
|
|
855
876
|
export type HistoricalOracleData = {
|
|
@@ -960,97 +981,58 @@ export type PoolBalance = {
|
|
|
960
981
|
};
|
|
961
982
|
|
|
962
983
|
export type AMM = {
|
|
984
|
+
feePool: PoolBalance;
|
|
963
985
|
baseAssetReserve: BN;
|
|
964
|
-
sqrtK: BN;
|
|
965
|
-
cumulativeFundingRate: BN;
|
|
966
|
-
lastFundingRate: BN;
|
|
967
|
-
lastFundingRateTs: BN;
|
|
968
|
-
lastMarkPriceTwap: BN;
|
|
969
|
-
lastMarkPriceTwap5Min: BN;
|
|
970
|
-
lastMarkPriceTwapTs: BN;
|
|
971
|
-
lastTradeTs: BN;
|
|
972
|
-
|
|
973
|
-
oracle: PublicKey;
|
|
974
|
-
oracleSource: OracleSource;
|
|
975
|
-
historicalOracleData: HistoricalOracleData;
|
|
976
|
-
|
|
977
|
-
lastOracleReservePriceSpreadPct: BN;
|
|
978
|
-
lastOracleConfPct: BN;
|
|
979
|
-
|
|
980
|
-
fundingPeriod: BN;
|
|
981
986
|
quoteAssetReserve: BN;
|
|
987
|
+
concentrationCoef: BN;
|
|
988
|
+
minBaseAssetReserve: BN;
|
|
989
|
+
maxBaseAssetReserve: BN;
|
|
990
|
+
sqrtK: BN;
|
|
982
991
|
pegMultiplier: BN;
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
lastFundingRateLong: BN;
|
|
988
|
-
|
|
989
|
-
totalLiquidationFee: BN;
|
|
992
|
+
terminalQuoteAssetReserve: BN;
|
|
993
|
+
baseAssetAmountWithAmm: BN;
|
|
994
|
+
totalFee: BN;
|
|
995
|
+
totalMmFee: BN;
|
|
990
996
|
totalFeeMinusDistributions: BN;
|
|
991
997
|
totalFeeWithdrawn: BN;
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
998
|
+
lastUpdateSlot: BN;
|
|
999
|
+
netRevenueSinceLastFunding: BN;
|
|
1000
|
+
lastCumulativeFundingRateLong: BN;
|
|
1001
|
+
lastCumulativeFundingRateShort: BN;
|
|
1002
|
+
baseSpread: number;
|
|
1003
|
+
maxSpread: number;
|
|
996
1004
|
maxFillReserveFraction: number;
|
|
997
1005
|
maxSlippageRatio: number;
|
|
998
|
-
baseSpread: number;
|
|
999
1006
|
curveUpdateIntensity: number;
|
|
1000
|
-
baseAssetAmountWithAmm: BN;
|
|
1001
|
-
baseAssetAmountLong: BN;
|
|
1002
|
-
baseAssetAmountShort: BN;
|
|
1003
|
-
quoteAssetAmount: BN;
|
|
1004
|
-
terminalQuoteAssetReserve: BN;
|
|
1005
|
-
concentrationCoef: BN;
|
|
1006
|
-
feePool: PoolBalance;
|
|
1007
|
-
totalExchangeFee: BN;
|
|
1008
|
-
totalMmFee: BN;
|
|
1009
|
-
netRevenueSinceLastFunding: BN;
|
|
1010
|
-
lastUpdateSlot: BN;
|
|
1011
|
-
lastOracleNormalisedPrice: BN;
|
|
1012
|
-
lastOracleValid: boolean;
|
|
1013
|
-
lastBidPriceTwap: BN;
|
|
1014
|
-
lastAskPriceTwap: BN;
|
|
1015
|
-
longSpread: number;
|
|
1016
|
-
shortSpread: number;
|
|
1017
|
-
maxSpread: number;
|
|
1018
|
-
|
|
1019
1007
|
ammJitIntensity: number;
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
quoteBreakEvenAmountLong: BN;
|
|
1026
|
-
quoteBreakEvenAmountShort: BN;
|
|
1027
|
-
quoteEntryAmountLong: BN;
|
|
1028
|
-
quoteEntryAmountShort: BN;
|
|
1008
|
+
ammSpreadAdjustment: number;
|
|
1009
|
+
ammInventorySpreadAdjustment: number;
|
|
1010
|
+
referencePriceOffsetDeadbandPct: number;
|
|
1011
|
+
};
|
|
1029
1012
|
|
|
1013
|
+
export type MarketStats = {
|
|
1014
|
+
lastMarkPriceTwap: BN;
|
|
1015
|
+
lastMarkPriceTwap5Min: BN;
|
|
1016
|
+
lastMarkPriceTwapTs: BN;
|
|
1017
|
+
lastBidPriceTwap: BN;
|
|
1018
|
+
lastAskPriceTwap: BN;
|
|
1030
1019
|
markStd: BN;
|
|
1031
1020
|
oracleStd: BN;
|
|
1021
|
+
lastOracleConfPct: BN;
|
|
1022
|
+
volume24H: BN;
|
|
1032
1023
|
longIntensityVolume: BN;
|
|
1033
1024
|
shortIntensityVolume: BN;
|
|
1034
|
-
|
|
1025
|
+
lastTradeTs: BN;
|
|
1026
|
+
last24HAvgFundingRate: BN;
|
|
1027
|
+
fundingPeriod: BN;
|
|
1035
1028
|
minOrderSize: BN;
|
|
1036
1029
|
mmOraclePrice: BN;
|
|
1037
1030
|
mmOracleSlot: BN;
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
netUnsettledFundingPnl: BN;
|
|
1045
|
-
referencePriceOffset: number;
|
|
1046
|
-
|
|
1047
|
-
oracleLowRiskSlotDelayOverride: number;
|
|
1048
|
-
oracleSlotDelayOverride: number;
|
|
1049
|
-
ammSpreadAdjustment: number;
|
|
1050
|
-
ammInventorySpreadAdjustment: number;
|
|
1051
|
-
|
|
1052
|
-
lastFundingOracleTwap: BN;
|
|
1053
|
-
referencePriceOffsetDeadbandPct: number;
|
|
1031
|
+
mmOracleSequenceId: BN;
|
|
1032
|
+
lastOracleNormalisedPrice: BN;
|
|
1033
|
+
lastReferencePriceOffset: number;
|
|
1034
|
+
lastOracleValid: boolean;
|
|
1035
|
+
historicalOracleData: HistoricalOracleData;
|
|
1054
1036
|
};
|
|
1055
1037
|
|
|
1056
1038
|
// # User Account Types
|
|
@@ -1086,14 +1068,13 @@ export type UserStatsAccount = {
|
|
|
1086
1068
|
totalFeeRebate: BN;
|
|
1087
1069
|
totalTokenDiscount: BN;
|
|
1088
1070
|
totalRefereeDiscount: BN;
|
|
1089
|
-
totalReferrerReward: BN;
|
|
1090
|
-
current_epoch_referrer_reward: BN;
|
|
1091
1071
|
};
|
|
1092
1072
|
referrer: PublicKey;
|
|
1093
1073
|
referrerStatus: number;
|
|
1094
1074
|
authority: PublicKey;
|
|
1095
1075
|
ifStakedQuoteAssetAmount: BN;
|
|
1096
1076
|
ifStakedGovTokenAmount: BN;
|
|
1077
|
+
delegatePermissions: number;
|
|
1097
1078
|
};
|
|
1098
1079
|
|
|
1099
1080
|
export type UserAccount = {
|
|
@@ -1183,6 +1164,10 @@ export type OrderParams = {
|
|
|
1183
1164
|
maxTs: BN | null;
|
|
1184
1165
|
auctionStartPrice: BN | null;
|
|
1185
1166
|
auctionEndPrice: BN | null;
|
|
1167
|
+
/** index into the placing user's RevenueShareEscrow.approved_builders list (non-swift builder codes) */
|
|
1168
|
+
builderIdx?: number | null;
|
|
1169
|
+
/** builder fee on this order, in tenths of a bps, e.g. 100 = 0.01% */
|
|
1170
|
+
builderFeeTenthBps?: number | null;
|
|
1186
1171
|
};
|
|
1187
1172
|
|
|
1188
1173
|
export class PostOnlyParams {
|
|
@@ -1276,6 +1261,8 @@ export const DefaultOrderParams: OrderParams = {
|
|
|
1276
1261
|
maxTs: null,
|
|
1277
1262
|
auctionStartPrice: null,
|
|
1278
1263
|
auctionEndPrice: null,
|
|
1264
|
+
builderIdx: null,
|
|
1265
|
+
builderFeeTenthBps: null,
|
|
1279
1266
|
};
|
|
1280
1267
|
|
|
1281
1268
|
export type SignedMsgOrderParamsMessage = {
|
|
@@ -1331,6 +1318,8 @@ export type ReferrerInfo = {
|
|
|
1331
1318
|
export enum ReferrerStatus {
|
|
1332
1319
|
IsReferrer = 1,
|
|
1333
1320
|
IsReferred = 2,
|
|
1321
|
+
/** set when the user's RevenueShareEscrow was initialized with a referrer */
|
|
1322
|
+
BuilderReferral = 4,
|
|
1334
1323
|
}
|
|
1335
1324
|
|
|
1336
1325
|
export enum PlaceAndTakeOrderSuccessCondition {
|
|
@@ -1508,9 +1497,6 @@ export interface VelocityClientMetricsEvents {
|
|
|
1508
1497
|
preTxSigned: void;
|
|
1509
1498
|
}
|
|
1510
1499
|
|
|
1511
|
-
/** @deprecated Use `VelocityClientMetricsEvents` instead. `DriftClientMetricsEvents` will be removed in a future major. */
|
|
1512
|
-
export interface DriftClientMetricsEvents extends VelocityClientMetricsEvents {}
|
|
1513
|
-
|
|
1514
1500
|
export type SignedTxData = {
|
|
1515
1501
|
txSig: string;
|
|
1516
1502
|
signedTx: Transaction | VersionedTransaction;
|
|
@@ -1547,7 +1533,7 @@ export type IfRebalanceConfigParams = {
|
|
|
1547
1533
|
};
|
|
1548
1534
|
|
|
1549
1535
|
/* Represents proof of a signed msg taker order
|
|
1550
|
-
* It can be provided to
|
|
1536
|
+
* It can be provided to velocity program to fill a signed msg order
|
|
1551
1537
|
*/
|
|
1552
1538
|
export interface SignedMsgOrderParams {
|
|
1553
1539
|
/**
|
|
@@ -1581,10 +1567,6 @@ export type RevenueShareAccount = {
|
|
|
1581
1567
|
export type RevenueShareEscrowAccount = {
|
|
1582
1568
|
authority: PublicKey;
|
|
1583
1569
|
referrer: PublicKey;
|
|
1584
|
-
referrerBoostExpireTs: number;
|
|
1585
|
-
referrerRewardOffset: number;
|
|
1586
|
-
refereeFeeNumeratorOffset: number;
|
|
1587
|
-
referrerBoostNumerator: number;
|
|
1588
1570
|
reservedFixed: number[];
|
|
1589
1571
|
orders: RevenueShareOrder[];
|
|
1590
1572
|
approvedBuilders: BuilderInfo[];
|