@velocity-exchange/sdk 0.3.0 → 0.6.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/README.md +3 -3
- package/lib/browser/accounts/basicUserAccountSubscriber.d.ts +18 -0
- package/lib/browser/accounts/basicUserAccountSubscriber.js +18 -0
- package/lib/browser/accounts/basicUserStatsAccountSubscriber.d.ts +18 -0
- package/lib/browser/accounts/basicUserStatsAccountSubscriber.js +18 -0
- package/lib/browser/accounts/bulkAccountLoader.d.ts +52 -0
- package/lib/browser/accounts/bulkAccountLoader.js +51 -0
- package/lib/browser/accounts/bulkUserStatsSubscription.d.ts +9 -2
- package/lib/browser/accounts/bulkUserStatsSubscription.js +9 -2
- package/lib/browser/accounts/bulkUserSubscription.d.ts +8 -2
- package/lib/browser/accounts/bulkUserSubscription.js +8 -2
- package/lib/browser/accounts/customizedCadenceBulkAccountLoader.d.ts +37 -0
- package/lib/browser/accounts/customizedCadenceBulkAccountLoader.js +37 -0
- package/lib/browser/accounts/fetch.d.ts +59 -2
- package/lib/browser/accounts/fetch.js +57 -2
- package/lib/browser/accounts/grpcAccountSubscriber.d.ts +30 -0
- package/lib/browser/accounts/grpcAccountSubscriber.js +30 -0
- package/lib/browser/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts +16 -0
- package/lib/browser/accounts/grpcInsuranceFundStakeAccountSubscriber.js +16 -0
- package/lib/browser/accounts/grpcMultiAccountSubscriber.d.ts +60 -1
- package/lib/browser/accounts/grpcMultiAccountSubscriber.js +118 -37
- package/lib/browser/accounts/grpcMultiUserAccountSubscriber.d.ts +32 -0
- package/lib/browser/accounts/grpcMultiUserAccountSubscriber.js +40 -12
- package/lib/browser/accounts/grpcProgramAccountSubscriber.d.ts +33 -0
- package/lib/browser/accounts/grpcProgramAccountSubscriber.js +33 -0
- package/lib/browser/accounts/grpcUserAccountSubscriber.d.ts +15 -0
- package/lib/browser/accounts/grpcUserAccountSubscriber.js +15 -0
- package/lib/browser/accounts/grpcUserStatsAccountSubscriber.d.ts +15 -0
- package/lib/browser/accounts/grpcUserStatsAccountSubscriber.js +15 -0
- package/lib/browser/accounts/grpcVelocityClientAccountSubscriber.d.ts +41 -0
- package/lib/browser/accounts/grpcVelocityClientAccountSubscriber.js +41 -0
- package/lib/browser/accounts/grpcVelocityClientAccountSubscriberV2.d.ts +116 -0
- package/lib/browser/accounts/grpcVelocityClientAccountSubscriberV2.js +152 -1
- package/lib/browser/accounts/laserProgramAccountSubscriber.d.ts +34 -0
- package/lib/browser/accounts/laserProgramAccountSubscriber.js +34 -0
- package/lib/browser/accounts/oneShotUserAccountSubscriber.d.ts +19 -0
- package/lib/browser/accounts/oneShotUserAccountSubscriber.js +19 -0
- package/lib/browser/accounts/oneShotUserStatsAccountSubscriber.d.ts +19 -0
- package/lib/browser/accounts/oneShotUserStatsAccountSubscriber.js +19 -0
- package/lib/browser/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts +31 -0
- package/lib/browser/accounts/pollingInsuranceFundStakeAccountSubscriber.js +31 -0
- package/lib/browser/accounts/pollingOracleAccountSubscriber.d.ts +19 -0
- package/lib/browser/accounts/pollingOracleAccountSubscriber.js +21 -2
- package/lib/browser/accounts/pollingTokenAccountSubscriber.d.ts +22 -0
- package/lib/browser/accounts/pollingTokenAccountSubscriber.js +22 -0
- package/lib/browser/accounts/pollingUserAccountSubscriber.d.ts +32 -0
- package/lib/browser/accounts/pollingUserAccountSubscriber.js +32 -0
- package/lib/browser/accounts/pollingUserStatsAccountSubscriber.d.ts +22 -0
- package/lib/browser/accounts/pollingUserStatsAccountSubscriber.js +22 -0
- package/lib/browser/accounts/pollingVelocityClientAccountSubscriber.d.ts +83 -0
- package/lib/browser/accounts/pollingVelocityClientAccountSubscriber.js +84 -1
- package/lib/browser/accounts/testBulkAccountLoader.d.ts +8 -0
- package/lib/browser/accounts/testBulkAccountLoader.js +8 -0
- package/lib/browser/accounts/types.d.ts +149 -0
- package/lib/browser/accounts/types.js +13 -0
- package/lib/browser/accounts/utils.d.ts +18 -0
- package/lib/browser/accounts/utils.js +32 -16
- package/lib/browser/accounts/webSocketAccountSubscriber.d.ts +41 -0
- package/lib/browser/accounts/webSocketAccountSubscriber.js +41 -0
- package/lib/browser/accounts/webSocketAccountSubscriberV2.d.ts +31 -0
- package/lib/browser/accounts/webSocketAccountSubscriberV2.js +31 -23
- package/lib/browser/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +27 -0
- package/lib/browser/accounts/webSocketInsuranceFundStakeAccountSubscriber.js +27 -0
- package/lib/browser/accounts/webSocketProgramAccountSubscriber.d.ts +36 -0
- package/lib/browser/accounts/webSocketProgramAccountSubscriber.js +36 -0
- package/lib/browser/accounts/webSocketProgramAccountSubscriberV2.d.ts +21 -0
- package/lib/browser/accounts/webSocketProgramAccountSubscriberV2.js +25 -0
- package/lib/browser/accounts/webSocketProgramAccountsSubscriberV2.d.ts +21 -0
- package/lib/browser/accounts/webSocketProgramAccountsSubscriberV2.js +21 -0
- package/lib/browser/accounts/webSocketUserAccountSubscriber.d.ts +26 -0
- package/lib/browser/accounts/webSocketUserAccountSubscriber.js +26 -0
- package/lib/browser/accounts/webSocketUserStatsAccountSubsriber.d.ts +20 -0
- package/lib/browser/accounts/webSocketUserStatsAccountSubsriber.js +20 -0
- package/lib/browser/accounts/webSocketVelocityClientAccountSubscriber.d.ts +121 -0
- package/lib/browser/accounts/webSocketVelocityClientAccountSubscriber.js +123 -2
- package/lib/browser/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts +96 -0
- package/lib/browser/accounts/webSocketVelocityClientAccountSubscriberV2.js +108 -0
- package/lib/browser/accounts/websocketProgramUserAccountSubscriber.d.ts +28 -0
- package/lib/browser/accounts/websocketProgramUserAccountSubscriber.js +33 -0
- package/lib/browser/addresses/marketAddresses.d.ts +10 -0
- package/lib/browser/addresses/marketAddresses.js +10 -0
- package/lib/browser/addresses/pda.d.ts +214 -2
- package/lib/browser/addresses/pda.js +217 -5
- package/lib/browser/adminClient.d.ts +2171 -4
- package/lib/browser/adminClient.js +2215 -4
- package/lib/browser/auctionSubscriber/auctionSubscriber.d.ts +15 -0
- package/lib/browser/auctionSubscriber/auctionSubscriber.js +15 -0
- package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.d.ts +19 -0
- package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.js +19 -0
- package/lib/browser/auctionSubscriber/index.d.ts +6 -0
- package/lib/browser/auctionSubscriber/index.js +6 -0
- package/lib/browser/auctionSubscriber/types.d.ts +7 -0
- package/lib/browser/blockhashSubscriber/BlockhashSubscriber.d.ts +33 -0
- package/lib/browser/blockhashSubscriber/BlockhashSubscriber.js +33 -0
- package/lib/browser/blockhashSubscriber/index.d.ts +5 -0
- package/lib/browser/blockhashSubscriber/index.js +5 -0
- package/lib/browser/blockhashSubscriber/types.d.ts +5 -0
- package/lib/browser/clock/clockSubscriber.d.ts +24 -0
- package/lib/browser/clock/clockSubscriber.js +22 -0
- package/lib/browser/config.d.ts +58 -4
- package/lib/browser/config.js +94 -28
- package/lib/browser/constants/numericConstants.d.ts +67 -0
- package/lib/browser/constants/numericConstants.js +68 -1
- package/lib/browser/constants/perpMarkets.d.ts +10 -0
- package/lib/browser/constants/perpMarkets.js +40 -908
- package/lib/browser/constants/spotMarkets.d.ts +13 -0
- package/lib/browser/constants/spotMarkets.js +16 -742
- package/lib/browser/constants/txConstants.d.ts +1 -0
- package/lib/browser/constants/txConstants.js +1 -0
- package/lib/browser/core/VelocityCore.d.ts +285 -8
- package/lib/browser/core/VelocityCore.js +281 -8
- package/lib/browser/core/instructions/deposit.d.ts +22 -0
- package/lib/browser/core/instructions/deposit.js +22 -0
- package/lib/browser/core/instructions/fill.d.ts +17 -0
- package/lib/browser/core/instructions/fill.js +17 -0
- package/lib/browser/core/instructions/funding.d.ts +12 -0
- package/lib/browser/core/instructions/funding.js +12 -0
- package/lib/browser/core/instructions/liquidation.d.ts +18 -0
- package/lib/browser/core/instructions/liquidation.js +18 -0
- package/lib/browser/core/instructions/orders.d.ts +28 -0
- package/lib/browser/core/instructions/orders.js +28 -0
- package/lib/browser/core/instructions/perpOrders.d.ts +106 -0
- package/lib/browser/core/instructions/perpOrders.js +106 -0
- package/lib/browser/core/instructions/settlement.d.ts +14 -0
- package/lib/browser/core/instructions/settlement.js +14 -0
- package/lib/browser/core/instructions/trigger.d.ts +15 -0
- package/lib/browser/core/instructions/trigger.js +15 -0
- package/lib/browser/core/instructions/withdraw.d.ts +21 -0
- package/lib/browser/core/instructions/withdraw.js +21 -0
- package/lib/browser/core/remainingAccounts.d.ts +47 -3
- package/lib/browser/core/remainingAccounts.js +20 -0
- package/lib/browser/core/signedMsg.d.ts +38 -0
- package/lib/browser/core/signedMsg.js +33 -0
- package/lib/browser/decode/customCoder.d.ts +39 -3
- package/lib/browser/decode/customCoder.js +45 -3
- package/lib/browser/decode/user.d.ts +22 -0
- package/lib/browser/decode/user.js +27 -1
- package/lib/browser/dlob/DLOB.d.ts +502 -53
- package/lib/browser/dlob/DLOB.js +540 -98
- package/lib/browser/dlob/DLOBNode.d.ts +86 -4
- package/lib/browser/dlob/DLOBNode.js +37 -4
- package/lib/browser/dlob/DLOBSubscriber.d.ts +39 -12
- package/lib/browser/dlob/DLOBSubscriber.js +42 -12
- package/lib/browser/dlob/NodeList.d.ts +69 -0
- package/lib/browser/dlob/NodeList.js +66 -0
- package/lib/browser/dlob/orderBookLevels.d.ts +106 -13
- package/lib/browser/dlob/orderBookLevels.js +84 -14
- package/lib/browser/dlob/types.d.ts +15 -0
- package/lib/browser/events/eventList.d.ts +14 -0
- package/lib/browser/events/eventList.js +14 -0
- package/lib/browser/events/eventSubscriber.d.ts +87 -10
- package/lib/browser/events/eventSubscriber.js +93 -8
- package/lib/browser/events/eventsServerLogProvider.d.ts +22 -0
- package/lib/browser/events/eventsServerLogProvider.js +27 -0
- package/lib/browser/events/fetchLogs.d.ts +31 -0
- package/lib/browser/events/fetchLogs.js +46 -1
- package/lib/browser/events/parse.d.ts +23 -0
- package/lib/browser/events/parse.js +23 -0
- package/lib/browser/events/pollingLogProvider.d.ts +24 -0
- package/lib/browser/events/pollingLogProvider.js +24 -0
- package/lib/browser/events/sort.d.ts +11 -0
- package/lib/browser/events/sort.js +12 -0
- package/lib/browser/events/txEventCache.d.ts +13 -3
- package/lib/browser/events/txEventCache.js +19 -7
- package/lib/browser/events/types.d.ts +118 -2
- package/lib/browser/events/types.js +11 -0
- package/lib/browser/events/webSocketLogProvider.d.ts +23 -0
- package/lib/browser/events/webSocketLogProvider.js +28 -0
- package/lib/browser/factory/oracleClient.js +2 -2
- package/lib/browser/idl/velocity.d.ts +150 -7
- package/lib/browser/idl/velocity.json +151 -8
- package/lib/browser/keypair.d.ts +8 -0
- package/lib/browser/keypair.js +8 -0
- package/lib/browser/marginCalculation.d.ts +134 -2
- package/lib/browser/marginCalculation.js +121 -0
- package/lib/browser/math/amm.d.ts +348 -29
- package/lib/browser/math/amm.js +310 -32
- package/lib/browser/math/auction.d.ts +95 -19
- package/lib/browser/math/auction.js +118 -28
- package/lib/browser/math/bankruptcy.d.ts +46 -0
- package/lib/browser/math/bankruptcy.js +89 -1
- package/lib/browser/math/builder.d.ts +64 -8
- package/lib/browser/math/builder.js +71 -9
- package/lib/browser/math/conversion.d.ts +21 -0
- package/lib/browser/math/conversion.js +21 -0
- package/lib/browser/math/exchangeStatus.d.ts +91 -0
- package/lib/browser/math/exchangeStatus.js +106 -3
- package/lib/browser/math/funding.d.ts +57 -20
- package/lib/browser/math/funding.js +63 -23
- package/lib/browser/math/insurance.d.ts +62 -0
- package/lib/browser/math/insurance.js +62 -0
- package/lib/browser/math/liquidation.d.ts +127 -11
- package/lib/browser/math/liquidation.js +182 -19
- package/lib/browser/math/margin.d.ts +79 -13
- package/lib/browser/math/margin.js +80 -14
- package/lib/browser/math/market.d.ts +135 -15
- package/lib/browser/math/market.js +145 -17
- package/lib/browser/math/oracles.d.ts +113 -0
- package/lib/browser/math/oracles.js +118 -1
- package/lib/browser/math/orders.d.ts +115 -10
- package/lib/browser/math/orders.js +130 -19
- package/lib/browser/math/position.d.ts +80 -33
- package/lib/browser/math/position.js +80 -33
- package/lib/browser/math/repeg.d.ts +48 -10
- package/lib/browser/math/repeg.js +48 -10
- package/lib/browser/math/spotBalance.d.ts +200 -5
- package/lib/browser/math/spotBalance.js +239 -10
- package/lib/browser/math/spotMarket.d.ts +36 -3
- package/lib/browser/math/spotMarket.js +36 -3
- package/lib/browser/math/spotPosition.d.ts +72 -0
- package/lib/browser/math/spotPosition.js +62 -0
- package/lib/browser/math/state.d.ts +31 -0
- package/lib/browser/math/state.js +31 -0
- package/lib/browser/math/superStake.d.ts +126 -2
- package/lib/browser/math/superStake.js +123 -3
- package/lib/browser/math/tiers.d.ts +29 -0
- package/lib/browser/math/tiers.js +29 -0
- package/lib/browser/math/trade.d.ts +102 -51
- package/lib/browser/math/trade.js +101 -55
- package/lib/browser/math/utils.d.ts +71 -9
- package/lib/browser/math/utils.js +71 -9
- package/lib/browser/memcmp.d.ts +94 -0
- package/lib/browser/memcmp.js +103 -2
- package/lib/browser/oracles/oracleClientCache.d.ts +16 -0
- package/lib/browser/oracles/oracleClientCache.js +16 -0
- package/lib/browser/oracles/oracleId.d.ts +31 -0
- package/lib/browser/oracles/oracleId.js +39 -8
- package/lib/browser/oracles/prelaunchOracleClient.d.ts +20 -0
- package/lib/browser/oracles/prelaunchOracleClient.js +20 -0
- package/lib/browser/oracles/pythClient.d.ts +31 -0
- package/lib/browser/oracles/pythClient.js +32 -1
- package/lib/browser/oracles/pythLazerClient.d.ts +34 -0
- package/lib/browser/oracles/pythLazerClient.js +35 -1
- package/lib/browser/oracles/quoteAssetOracleClient.d.ts +18 -0
- package/lib/browser/oracles/quoteAssetOracleClient.js +18 -0
- package/lib/browser/oracles/strictOraclePrice.d.ts +21 -0
- package/lib/browser/oracles/strictOraclePrice.js +21 -0
- package/lib/browser/oracles/types.d.ts +45 -0
- package/lib/browser/oracles/utils.d.ts +20 -0
- package/lib/browser/oracles/utils.js +20 -0
- package/lib/browser/orderParams.d.ts +42 -4
- package/lib/browser/orderParams.js +42 -4
- package/lib/browser/orderSubscriber/OrderSubscriber.d.ts +56 -0
- package/lib/browser/orderSubscriber/OrderSubscriber.js +59 -0
- package/lib/browser/orderSubscriber/PollingSubscription.d.ts +11 -0
- package/lib/browser/orderSubscriber/PollingSubscription.js +11 -0
- package/lib/browser/orderSubscriber/WebsocketSubscription.d.ts +18 -0
- package/lib/browser/orderSubscriber/WebsocketSubscription.js +18 -0
- package/lib/browser/orderSubscriber/grpcSubscription.d.ts +16 -0
- package/lib/browser/orderSubscriber/grpcSubscription.js +16 -0
- package/lib/browser/orderSubscriber/types.d.ts +9 -0
- package/lib/browser/priorityFee/averageOverSlotsStrategy.d.ts +1 -0
- package/lib/browser/priorityFee/averageOverSlotsStrategy.js +1 -0
- package/lib/browser/priorityFee/averageStrategy.d.ts +1 -0
- package/lib/browser/priorityFee/averageStrategy.js +1 -0
- package/lib/browser/priorityFee/ewmaStrategy.d.ts +10 -0
- package/lib/browser/priorityFee/ewmaStrategy.js +10 -0
- package/lib/browser/priorityFee/heliusPriorityFeeMethod.d.ts +13 -0
- package/lib/browser/priorityFee/heliusPriorityFeeMethod.js +9 -2
- package/lib/browser/priorityFee/maxOverSlotsStrategy.d.ts +1 -0
- package/lib/browser/priorityFee/maxOverSlotsStrategy.js +1 -0
- package/lib/browser/priorityFee/maxStrategy.d.ts +1 -0
- package/lib/browser/priorityFee/maxStrategy.js +1 -0
- package/lib/browser/priorityFee/priorityFeeSubscriber.d.ts +39 -0
- package/lib/browser/priorityFee/priorityFeeSubscriber.js +39 -0
- package/lib/browser/priorityFee/priorityFeeSubscriberMap.d.ts +20 -1
- package/lib/browser/priorityFee/priorityFeeSubscriberMap.js +21 -2
- package/lib/browser/priorityFee/solanaPriorityFeeMethod.d.ts +12 -0
- package/lib/browser/priorityFee/solanaPriorityFeeMethod.js +10 -0
- package/lib/browser/priorityFee/types.d.ts +32 -0
- package/lib/browser/priorityFee/types.js +5 -0
- package/lib/browser/priorityFee/velocityPriorityFeeMethod.d.ts +11 -0
- package/lib/browser/priorityFee/velocityPriorityFeeMethod.js +8 -0
- package/lib/browser/pyth/pythLazerSubscriber.js +37 -27
- package/lib/browser/slot/SlotSubscriber.d.ts +18 -0
- package/lib/browser/slot/SlotSubscriber.js +16 -0
- package/lib/browser/slot/SlothashSubscriber.d.ts +26 -0
- package/lib/browser/slot/SlothashSubscriber.js +25 -1
- package/lib/browser/tx/baseTxSender.d.ts +163 -0
- package/lib/browser/tx/baseTxSender.js +174 -6
- package/lib/browser/tx/blockhashFetcher/baseBlockhashFetcher.d.ts +12 -0
- package/lib/browser/tx/blockhashFetcher/baseBlockhashFetcher.js +12 -0
- package/lib/browser/tx/blockhashFetcher/cachedBlockhashFetcher.d.ts +15 -0
- package/lib/browser/tx/blockhashFetcher/cachedBlockhashFetcher.js +15 -0
- package/lib/browser/tx/blockhashFetcher/types.d.ts +4 -0
- package/lib/browser/tx/fastSingleTxSender.d.ts +47 -0
- package/lib/browser/tx/fastSingleTxSender.js +48 -1
- package/lib/browser/tx/forwardOnlyTxSender.d.ts +48 -0
- package/lib/browser/tx/forwardOnlyTxSender.js +48 -0
- package/lib/browser/tx/reportTransactionError.d.ts +18 -6
- package/lib/browser/tx/reportTransactionError.js +18 -6
- package/lib/browser/tx/retryTxSender.d.ts +40 -0
- package/lib/browser/tx/retryTxSender.js +39 -0
- package/lib/browser/tx/txHandler.d.ts +146 -35
- package/lib/browser/tx/txHandler.js +132 -32
- package/lib/browser/tx/txParamProcessor.d.ts +47 -0
- package/lib/browser/tx/txParamProcessor.js +47 -0
- package/lib/browser/tx/types.d.ts +46 -0
- package/lib/browser/tx/types.js +5 -0
- package/lib/browser/tx/utils.d.ts +26 -0
- package/lib/browser/tx/utils.js +26 -0
- package/lib/browser/tx/whileValidTxSender.d.ts +82 -0
- package/lib/browser/tx/whileValidTxSender.js +81 -0
- package/lib/browser/types.d.ts +785 -13
- package/lib/browser/types.js +126 -9
- package/lib/browser/user.d.ts +660 -84
- package/lib/browser/user.js +816 -97
- package/lib/browser/userMap/PollingSubscription.d.ts +10 -0
- package/lib/browser/userMap/PollingSubscription.js +14 -2
- package/lib/browser/userMap/WebsocketSubscription.d.ts +9 -0
- package/lib/browser/userMap/WebsocketSubscription.js +9 -0
- package/lib/browser/userMap/grpcSubscription.d.ts +8 -0
- package/lib/browser/userMap/grpcSubscription.js +8 -0
- package/lib/browser/userMap/referrerMap.d.ts +72 -2
- package/lib/browser/userMap/referrerMap.js +84 -2
- package/lib/browser/userMap/revenueShareEscrowMap.d.ts +37 -10
- package/lib/browser/userMap/revenueShareEscrowMap.js +38 -11
- package/lib/browser/userMap/userMap.d.ts +81 -3
- package/lib/browser/userMap/userMap.js +81 -4
- package/lib/browser/userMap/userMapConfig.d.ts +23 -0
- package/lib/browser/userMap/userStatsMap.d.ts +22 -0
- package/lib/browser/userMap/userStatsMap.js +22 -0
- package/lib/browser/userName.d.ts +16 -0
- package/lib/browser/userName.js +16 -0
- package/lib/browser/userStats.d.ts +28 -1
- package/lib/browser/userStats.js +28 -1
- package/lib/browser/util/TransactionConfirmationManager.d.ts +33 -0
- package/lib/browser/util/TransactionConfirmationManager.js +33 -0
- package/lib/browser/util/chainClock.d.ts +24 -0
- package/lib/browser/util/chainClock.js +20 -0
- package/lib/browser/util/computeUnits.d.ts +32 -0
- package/lib/browser/util/computeUnits.js +32 -0
- package/lib/browser/util/digest.d.ts +17 -0
- package/lib/browser/util/digest.js +17 -0
- package/lib/browser/util/ed25519Utils.d.ts +12 -2
- package/lib/browser/util/ed25519Utils.js +12 -2
- package/lib/browser/util/promiseTimeout.d.ts +9 -0
- package/lib/browser/util/promiseTimeout.js +9 -0
- package/lib/browser/velocityClient.d.ts +3363 -220
- package/lib/browser/velocityClient.js +3514 -275
- package/lib/browser/wallet.d.ts +37 -0
- package/lib/browser/wallet.js +37 -0
- package/lib/node/accounts/basicUserAccountSubscriber.d.ts +18 -0
- package/lib/node/accounts/basicUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/basicUserAccountSubscriber.js +18 -0
- package/lib/node/accounts/basicUserStatsAccountSubscriber.d.ts +18 -0
- package/lib/node/accounts/basicUserStatsAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/basicUserStatsAccountSubscriber.js +18 -0
- package/lib/node/accounts/bulkAccountLoader.d.ts +52 -0
- package/lib/node/accounts/bulkAccountLoader.d.ts.map +1 -1
- package/lib/node/accounts/bulkAccountLoader.js +51 -0
- package/lib/node/accounts/bulkUserStatsSubscription.d.ts +9 -2
- package/lib/node/accounts/bulkUserStatsSubscription.d.ts.map +1 -1
- package/lib/node/accounts/bulkUserStatsSubscription.js +9 -2
- package/lib/node/accounts/bulkUserSubscription.d.ts +8 -2
- package/lib/node/accounts/bulkUserSubscription.d.ts.map +1 -1
- package/lib/node/accounts/bulkUserSubscription.js +8 -2
- package/lib/node/accounts/customizedCadenceBulkAccountLoader.d.ts +37 -0
- package/lib/node/accounts/customizedCadenceBulkAccountLoader.d.ts.map +1 -1
- package/lib/node/accounts/customizedCadenceBulkAccountLoader.js +37 -0
- package/lib/node/accounts/fetch.d.ts +59 -2
- package/lib/node/accounts/fetch.d.ts.map +1 -1
- package/lib/node/accounts/fetch.js +57 -2
- package/lib/node/accounts/grpcAccountSubscriber.d.ts +30 -0
- package/lib/node/accounts/grpcAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcAccountSubscriber.js +30 -0
- package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts +16 -0
- package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcInsuranceFundStakeAccountSubscriber.js +16 -0
- package/lib/node/accounts/grpcMultiAccountSubscriber.d.ts +60 -1
- package/lib/node/accounts/grpcMultiAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcMultiAccountSubscriber.js +118 -37
- package/lib/node/accounts/grpcMultiUserAccountSubscriber.d.ts +32 -0
- package/lib/node/accounts/grpcMultiUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcMultiUserAccountSubscriber.js +40 -12
- package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts +33 -0
- package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcProgramAccountSubscriber.js +33 -0
- package/lib/node/accounts/grpcUserAccountSubscriber.d.ts +15 -0
- package/lib/node/accounts/grpcUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcUserAccountSubscriber.js +15 -0
- package/lib/node/accounts/grpcUserStatsAccountSubscriber.d.ts +15 -0
- package/lib/node/accounts/grpcUserStatsAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcUserStatsAccountSubscriber.js +15 -0
- package/lib/node/accounts/grpcVelocityClientAccountSubscriber.d.ts +41 -0
- package/lib/node/accounts/grpcVelocityClientAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcVelocityClientAccountSubscriber.js +41 -0
- package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.d.ts +116 -0
- package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/grpcVelocityClientAccountSubscriberV2.js +152 -1
- package/lib/node/accounts/laserProgramAccountSubscriber.d.ts +34 -0
- package/lib/node/accounts/laserProgramAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/laserProgramAccountSubscriber.js +34 -0
- package/lib/node/accounts/oneShotUserAccountSubscriber.d.ts +19 -0
- package/lib/node/accounts/oneShotUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/oneShotUserAccountSubscriber.js +19 -0
- package/lib/node/accounts/oneShotUserStatsAccountSubscriber.d.ts +19 -0
- package/lib/node/accounts/oneShotUserStatsAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/oneShotUserStatsAccountSubscriber.js +19 -0
- package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts +31 -0
- package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingInsuranceFundStakeAccountSubscriber.js +31 -0
- package/lib/node/accounts/pollingOracleAccountSubscriber.d.ts +19 -0
- package/lib/node/accounts/pollingOracleAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingOracleAccountSubscriber.js +21 -2
- package/lib/node/accounts/pollingTokenAccountSubscriber.d.ts +22 -0
- package/lib/node/accounts/pollingTokenAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingTokenAccountSubscriber.js +22 -0
- package/lib/node/accounts/pollingUserAccountSubscriber.d.ts +32 -0
- package/lib/node/accounts/pollingUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingUserAccountSubscriber.js +32 -0
- package/lib/node/accounts/pollingUserStatsAccountSubscriber.d.ts +22 -0
- package/lib/node/accounts/pollingUserStatsAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingUserStatsAccountSubscriber.js +22 -0
- package/lib/node/accounts/pollingVelocityClientAccountSubscriber.d.ts +83 -0
- package/lib/node/accounts/pollingVelocityClientAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/pollingVelocityClientAccountSubscriber.js +84 -1
- package/lib/node/accounts/testBulkAccountLoader.d.ts +8 -0
- package/lib/node/accounts/testBulkAccountLoader.d.ts.map +1 -1
- package/lib/node/accounts/testBulkAccountLoader.js +8 -0
- package/lib/node/accounts/types.d.ts +149 -0
- package/lib/node/accounts/types.d.ts.map +1 -1
- package/lib/node/accounts/types.js +13 -0
- package/lib/node/accounts/utils.d.ts +18 -0
- package/lib/node/accounts/utils.d.ts.map +1 -1
- package/lib/node/accounts/utils.js +32 -16
- package/lib/node/accounts/webSocketAccountSubscriber.d.ts +41 -0
- package/lib/node/accounts/webSocketAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketAccountSubscriber.js +41 -0
- package/lib/node/accounts/webSocketAccountSubscriberV2.d.ts +31 -0
- package/lib/node/accounts/webSocketAccountSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/webSocketAccountSubscriberV2.js +31 -23
- package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +27 -0
- package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketInsuranceFundStakeAccountSubscriber.js +27 -0
- package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts +36 -0
- package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketProgramAccountSubscriber.js +36 -0
- package/lib/node/accounts/webSocketProgramAccountSubscriberV2.d.ts +21 -0
- package/lib/node/accounts/webSocketProgramAccountSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/webSocketProgramAccountSubscriberV2.js +25 -0
- package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.d.ts +21 -0
- package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/webSocketProgramAccountsSubscriberV2.js +21 -0
- package/lib/node/accounts/webSocketUserAccountSubscriber.d.ts +26 -0
- package/lib/node/accounts/webSocketUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketUserAccountSubscriber.js +26 -0
- package/lib/node/accounts/webSocketUserStatsAccountSubsriber.d.ts +20 -0
- package/lib/node/accounts/webSocketUserStatsAccountSubsriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketUserStatsAccountSubsriber.js +20 -0
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.d.ts +121 -0
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriber.js +123 -2
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts +96 -0
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.d.ts.map +1 -1
- package/lib/node/accounts/webSocketVelocityClientAccountSubscriberV2.js +108 -0
- package/lib/node/accounts/websocketProgramUserAccountSubscriber.d.ts +28 -0
- package/lib/node/accounts/websocketProgramUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/websocketProgramUserAccountSubscriber.js +33 -0
- package/lib/node/addresses/marketAddresses.d.ts +10 -0
- package/lib/node/addresses/marketAddresses.d.ts.map +1 -1
- package/lib/node/addresses/marketAddresses.js +10 -0
- package/lib/node/addresses/pda.d.ts +214 -2
- package/lib/node/addresses/pda.d.ts.map +1 -1
- package/lib/node/addresses/pda.js +217 -5
- package/lib/node/adminClient.d.ts +2171 -4
- package/lib/node/adminClient.d.ts.map +1 -1
- package/lib/node/adminClient.js +2215 -4
- package/lib/node/auctionSubscriber/auctionSubscriber.d.ts +15 -0
- package/lib/node/auctionSubscriber/auctionSubscriber.d.ts.map +1 -1
- package/lib/node/auctionSubscriber/auctionSubscriber.js +15 -0
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts +19 -0
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts.map +1 -1
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.js +19 -0
- package/lib/node/auctionSubscriber/index.d.ts +6 -0
- package/lib/node/auctionSubscriber/index.d.ts.map +1 -1
- package/lib/node/auctionSubscriber/index.js +6 -0
- package/lib/node/auctionSubscriber/types.d.ts +7 -0
- package/lib/node/auctionSubscriber/types.d.ts.map +1 -1
- package/lib/node/blockhashSubscriber/BlockhashSubscriber.d.ts +33 -0
- package/lib/node/blockhashSubscriber/BlockhashSubscriber.d.ts.map +1 -1
- package/lib/node/blockhashSubscriber/BlockhashSubscriber.js +33 -0
- package/lib/node/blockhashSubscriber/index.d.ts +5 -0
- package/lib/node/blockhashSubscriber/index.d.ts.map +1 -1
- package/lib/node/blockhashSubscriber/index.js +5 -0
- package/lib/node/blockhashSubscriber/types.d.ts +5 -0
- package/lib/node/blockhashSubscriber/types.d.ts.map +1 -1
- package/lib/node/clock/clockSubscriber.d.ts +24 -0
- package/lib/node/clock/clockSubscriber.d.ts.map +1 -1
- package/lib/node/clock/clockSubscriber.js +22 -0
- package/lib/node/config.d.ts +58 -4
- package/lib/node/config.d.ts.map +1 -1
- package/lib/node/config.js +94 -28
- package/lib/node/constants/numericConstants.d.ts +67 -0
- package/lib/node/constants/numericConstants.d.ts.map +1 -1
- package/lib/node/constants/numericConstants.js +68 -1
- package/lib/node/constants/perpMarkets.d.ts +10 -0
- package/lib/node/constants/perpMarkets.d.ts.map +1 -1
- package/lib/node/constants/perpMarkets.js +40 -908
- package/lib/node/constants/spotMarkets.d.ts +13 -0
- package/lib/node/constants/spotMarkets.d.ts.map +1 -1
- package/lib/node/constants/spotMarkets.js +16 -742
- package/lib/node/constants/txConstants.d.ts +1 -0
- package/lib/node/constants/txConstants.d.ts.map +1 -1
- package/lib/node/constants/txConstants.js +1 -0
- package/lib/node/core/VelocityCore.d.ts +285 -8
- package/lib/node/core/VelocityCore.d.ts.map +1 -1
- package/lib/node/core/VelocityCore.js +281 -8
- package/lib/node/core/instructions/deposit.d.ts +22 -0
- package/lib/node/core/instructions/deposit.d.ts.map +1 -1
- package/lib/node/core/instructions/deposit.js +22 -0
- package/lib/node/core/instructions/fill.d.ts +17 -0
- package/lib/node/core/instructions/fill.d.ts.map +1 -1
- package/lib/node/core/instructions/fill.js +17 -0
- package/lib/node/core/instructions/funding.d.ts +12 -0
- package/lib/node/core/instructions/funding.d.ts.map +1 -1
- package/lib/node/core/instructions/funding.js +12 -0
- package/lib/node/core/instructions/liquidation.d.ts +18 -0
- package/lib/node/core/instructions/liquidation.d.ts.map +1 -1
- package/lib/node/core/instructions/liquidation.js +18 -0
- package/lib/node/core/instructions/orders.d.ts +28 -0
- package/lib/node/core/instructions/orders.d.ts.map +1 -1
- package/lib/node/core/instructions/orders.js +28 -0
- package/lib/node/core/instructions/perpOrders.d.ts +106 -0
- package/lib/node/core/instructions/perpOrders.d.ts.map +1 -1
- package/lib/node/core/instructions/perpOrders.js +106 -0
- package/lib/node/core/instructions/settlement.d.ts +14 -0
- package/lib/node/core/instructions/settlement.d.ts.map +1 -1
- package/lib/node/core/instructions/settlement.js +14 -0
- package/lib/node/core/instructions/trigger.d.ts +15 -0
- package/lib/node/core/instructions/trigger.d.ts.map +1 -1
- package/lib/node/core/instructions/trigger.js +15 -0
- package/lib/node/core/instructions/withdraw.d.ts +21 -0
- package/lib/node/core/instructions/withdraw.d.ts.map +1 -1
- package/lib/node/core/instructions/withdraw.js +21 -0
- package/lib/node/core/remainingAccounts.d.ts +47 -3
- package/lib/node/core/remainingAccounts.d.ts.map +1 -1
- package/lib/node/core/remainingAccounts.js +20 -0
- package/lib/node/core/signedMsg.d.ts +38 -0
- package/lib/node/core/signedMsg.d.ts.map +1 -1
- package/lib/node/core/signedMsg.js +33 -0
- package/lib/node/decode/customCoder.d.ts +39 -3
- package/lib/node/decode/customCoder.d.ts.map +1 -1
- package/lib/node/decode/customCoder.js +45 -3
- package/lib/node/decode/user.d.ts +22 -0
- package/lib/node/decode/user.d.ts.map +1 -1
- package/lib/node/decode/user.js +27 -1
- package/lib/node/dlob/DLOB.d.ts +502 -53
- package/lib/node/dlob/DLOB.d.ts.map +1 -1
- package/lib/node/dlob/DLOB.js +540 -98
- package/lib/node/dlob/DLOBNode.d.ts +86 -4
- package/lib/node/dlob/DLOBNode.d.ts.map +1 -1
- package/lib/node/dlob/DLOBNode.js +37 -4
- package/lib/node/dlob/DLOBSubscriber.d.ts +39 -12
- package/lib/node/dlob/DLOBSubscriber.d.ts.map +1 -1
- package/lib/node/dlob/DLOBSubscriber.js +42 -12
- package/lib/node/dlob/NodeList.d.ts +69 -0
- package/lib/node/dlob/NodeList.d.ts.map +1 -1
- package/lib/node/dlob/NodeList.js +66 -0
- package/lib/node/dlob/orderBookLevels.d.ts +106 -13
- package/lib/node/dlob/orderBookLevels.d.ts.map +1 -1
- package/lib/node/dlob/orderBookLevels.js +84 -14
- package/lib/node/dlob/types.d.ts +15 -0
- package/lib/node/dlob/types.d.ts.map +1 -1
- package/lib/node/events/eventList.d.ts +14 -0
- package/lib/node/events/eventList.d.ts.map +1 -1
- package/lib/node/events/eventList.js +14 -0
- package/lib/node/events/eventSubscriber.d.ts +87 -10
- package/lib/node/events/eventSubscriber.d.ts.map +1 -1
- package/lib/node/events/eventSubscriber.js +93 -8
- package/lib/node/events/eventsServerLogProvider.d.ts +22 -0
- package/lib/node/events/eventsServerLogProvider.d.ts.map +1 -1
- package/lib/node/events/eventsServerLogProvider.js +27 -0
- package/lib/node/events/fetchLogs.d.ts +31 -0
- package/lib/node/events/fetchLogs.d.ts.map +1 -1
- package/lib/node/events/fetchLogs.js +46 -1
- package/lib/node/events/parse.d.ts +23 -0
- package/lib/node/events/parse.d.ts.map +1 -1
- package/lib/node/events/parse.js +23 -0
- package/lib/node/events/pollingLogProvider.d.ts +24 -0
- package/lib/node/events/pollingLogProvider.d.ts.map +1 -1
- package/lib/node/events/pollingLogProvider.js +24 -0
- package/lib/node/events/sort.d.ts +11 -0
- package/lib/node/events/sort.d.ts.map +1 -1
- package/lib/node/events/sort.js +12 -0
- package/lib/node/events/txEventCache.d.ts +13 -3
- package/lib/node/events/txEventCache.d.ts.map +1 -1
- package/lib/node/events/txEventCache.js +19 -7
- package/lib/node/events/types.d.ts +118 -2
- package/lib/node/events/types.d.ts.map +1 -1
- package/lib/node/events/types.js +11 -0
- package/lib/node/events/webSocketLogProvider.d.ts +23 -0
- package/lib/node/events/webSocketLogProvider.d.ts.map +1 -1
- package/lib/node/events/webSocketLogProvider.js +28 -0
- package/lib/node/factory/oracleClient.js +2 -2
- package/lib/node/idl/velocity.d.ts +150 -7
- package/lib/node/idl/velocity.d.ts.map +1 -1
- package/lib/node/idl/velocity.json +151 -8
- package/lib/node/keypair.d.ts +8 -0
- package/lib/node/keypair.d.ts.map +1 -1
- package/lib/node/keypair.js +8 -0
- package/lib/node/marginCalculation.d.ts +134 -2
- package/lib/node/marginCalculation.d.ts.map +1 -1
- package/lib/node/marginCalculation.js +121 -0
- package/lib/node/math/amm.d.ts +348 -29
- package/lib/node/math/amm.d.ts.map +1 -1
- package/lib/node/math/amm.js +310 -32
- package/lib/node/math/auction.d.ts +95 -19
- package/lib/node/math/auction.d.ts.map +1 -1
- package/lib/node/math/auction.js +118 -28
- package/lib/node/math/bankruptcy.d.ts +46 -0
- package/lib/node/math/bankruptcy.d.ts.map +1 -1
- package/lib/node/math/bankruptcy.js +89 -1
- package/lib/node/math/builder.d.ts +64 -8
- package/lib/node/math/builder.d.ts.map +1 -1
- package/lib/node/math/builder.js +71 -9
- package/lib/node/math/conversion.d.ts +21 -0
- package/lib/node/math/conversion.d.ts.map +1 -1
- package/lib/node/math/conversion.js +21 -0
- package/lib/node/math/exchangeStatus.d.ts +91 -0
- package/lib/node/math/exchangeStatus.d.ts.map +1 -1
- package/lib/node/math/exchangeStatus.js +106 -3
- package/lib/node/math/funding.d.ts +57 -20
- package/lib/node/math/funding.d.ts.map +1 -1
- package/lib/node/math/funding.js +63 -23
- package/lib/node/math/insurance.d.ts +62 -0
- package/lib/node/math/insurance.d.ts.map +1 -1
- package/lib/node/math/insurance.js +62 -0
- package/lib/node/math/liquidation.d.ts +127 -11
- package/lib/node/math/liquidation.d.ts.map +1 -1
- package/lib/node/math/liquidation.js +182 -19
- package/lib/node/math/margin.d.ts +79 -13
- package/lib/node/math/margin.d.ts.map +1 -1
- package/lib/node/math/margin.js +80 -14
- package/lib/node/math/market.d.ts +135 -15
- package/lib/node/math/market.d.ts.map +1 -1
- package/lib/node/math/market.js +145 -17
- package/lib/node/math/oracles.d.ts +113 -0
- package/lib/node/math/oracles.d.ts.map +1 -1
- package/lib/node/math/oracles.js +118 -1
- package/lib/node/math/orders.d.ts +115 -10
- package/lib/node/math/orders.d.ts.map +1 -1
- package/lib/node/math/orders.js +130 -19
- package/lib/node/math/position.d.ts +80 -33
- package/lib/node/math/position.d.ts.map +1 -1
- package/lib/node/math/position.js +80 -33
- package/lib/node/math/repeg.d.ts +48 -10
- package/lib/node/math/repeg.d.ts.map +1 -1
- package/lib/node/math/repeg.js +48 -10
- package/lib/node/math/spotBalance.d.ts +200 -5
- package/lib/node/math/spotBalance.d.ts.map +1 -1
- package/lib/node/math/spotBalance.js +239 -10
- package/lib/node/math/spotMarket.d.ts +36 -3
- package/lib/node/math/spotMarket.d.ts.map +1 -1
- package/lib/node/math/spotMarket.js +36 -3
- package/lib/node/math/spotPosition.d.ts +72 -0
- package/lib/node/math/spotPosition.d.ts.map +1 -1
- package/lib/node/math/spotPosition.js +62 -0
- package/lib/node/math/state.d.ts +31 -0
- package/lib/node/math/state.d.ts.map +1 -1
- package/lib/node/math/state.js +31 -0
- package/lib/node/math/superStake.d.ts +126 -2
- package/lib/node/math/superStake.d.ts.map +1 -1
- package/lib/node/math/superStake.js +123 -3
- package/lib/node/math/tiers.d.ts +29 -0
- package/lib/node/math/tiers.d.ts.map +1 -1
- package/lib/node/math/tiers.js +29 -0
- package/lib/node/math/trade.d.ts +102 -51
- package/lib/node/math/trade.d.ts.map +1 -1
- package/lib/node/math/trade.js +101 -55
- package/lib/node/math/utils.d.ts +71 -9
- package/lib/node/math/utils.d.ts.map +1 -1
- package/lib/node/math/utils.js +71 -9
- package/lib/node/memcmp.d.ts +94 -0
- package/lib/node/memcmp.d.ts.map +1 -1
- package/lib/node/memcmp.js +103 -2
- package/lib/node/oracles/oracleClientCache.d.ts +16 -0
- package/lib/node/oracles/oracleClientCache.d.ts.map +1 -1
- package/lib/node/oracles/oracleClientCache.js +16 -0
- package/lib/node/oracles/oracleId.d.ts +31 -0
- package/lib/node/oracles/oracleId.d.ts.map +1 -1
- package/lib/node/oracles/oracleId.js +39 -8
- package/lib/node/oracles/prelaunchOracleClient.d.ts +20 -0
- package/lib/node/oracles/prelaunchOracleClient.d.ts.map +1 -1
- package/lib/node/oracles/prelaunchOracleClient.js +20 -0
- package/lib/node/oracles/pythClient.d.ts +31 -0
- package/lib/node/oracles/pythClient.d.ts.map +1 -1
- package/lib/node/oracles/pythClient.js +32 -1
- package/lib/node/oracles/pythLazerClient.d.ts +34 -0
- package/lib/node/oracles/pythLazerClient.d.ts.map +1 -1
- package/lib/node/oracles/pythLazerClient.js +35 -1
- package/lib/node/oracles/quoteAssetOracleClient.d.ts +18 -0
- package/lib/node/oracles/quoteAssetOracleClient.d.ts.map +1 -1
- package/lib/node/oracles/quoteAssetOracleClient.js +18 -0
- package/lib/node/oracles/strictOraclePrice.d.ts +21 -0
- package/lib/node/oracles/strictOraclePrice.d.ts.map +1 -1
- package/lib/node/oracles/strictOraclePrice.js +21 -0
- package/lib/node/oracles/types.d.ts +45 -0
- package/lib/node/oracles/types.d.ts.map +1 -1
- package/lib/node/oracles/utils.d.ts +20 -0
- package/lib/node/oracles/utils.d.ts.map +1 -1
- package/lib/node/oracles/utils.js +20 -0
- package/lib/node/orderParams.d.ts +42 -4
- package/lib/node/orderParams.d.ts.map +1 -1
- package/lib/node/orderParams.js +42 -4
- package/lib/node/orderSubscriber/OrderSubscriber.d.ts +56 -0
- package/lib/node/orderSubscriber/OrderSubscriber.d.ts.map +1 -1
- package/lib/node/orderSubscriber/OrderSubscriber.js +59 -0
- package/lib/node/orderSubscriber/PollingSubscription.d.ts +11 -0
- package/lib/node/orderSubscriber/PollingSubscription.d.ts.map +1 -1
- package/lib/node/orderSubscriber/PollingSubscription.js +11 -0
- package/lib/node/orderSubscriber/WebsocketSubscription.d.ts +18 -0
- package/lib/node/orderSubscriber/WebsocketSubscription.d.ts.map +1 -1
- package/lib/node/orderSubscriber/WebsocketSubscription.js +18 -0
- package/lib/node/orderSubscriber/grpcSubscription.d.ts +16 -0
- package/lib/node/orderSubscriber/grpcSubscription.d.ts.map +1 -1
- package/lib/node/orderSubscriber/grpcSubscription.js +16 -0
- package/lib/node/orderSubscriber/types.d.ts +9 -0
- package/lib/node/orderSubscriber/types.d.ts.map +1 -1
- package/lib/node/priorityFee/averageOverSlotsStrategy.d.ts +1 -0
- package/lib/node/priorityFee/averageOverSlotsStrategy.d.ts.map +1 -1
- package/lib/node/priorityFee/averageOverSlotsStrategy.js +1 -0
- package/lib/node/priorityFee/averageStrategy.d.ts +1 -0
- package/lib/node/priorityFee/averageStrategy.d.ts.map +1 -1
- package/lib/node/priorityFee/averageStrategy.js +1 -0
- package/lib/node/priorityFee/ewmaStrategy.d.ts +10 -0
- package/lib/node/priorityFee/ewmaStrategy.d.ts.map +1 -1
- package/lib/node/priorityFee/ewmaStrategy.js +10 -0
- package/lib/node/priorityFee/heliusPriorityFeeMethod.d.ts +13 -0
- package/lib/node/priorityFee/heliusPriorityFeeMethod.d.ts.map +1 -1
- package/lib/node/priorityFee/heliusPriorityFeeMethod.js +9 -2
- package/lib/node/priorityFee/maxOverSlotsStrategy.d.ts +1 -0
- package/lib/node/priorityFee/maxOverSlotsStrategy.d.ts.map +1 -1
- package/lib/node/priorityFee/maxOverSlotsStrategy.js +1 -0
- package/lib/node/priorityFee/maxStrategy.d.ts +1 -0
- package/lib/node/priorityFee/maxStrategy.d.ts.map +1 -1
- package/lib/node/priorityFee/maxStrategy.js +1 -0
- package/lib/node/priorityFee/priorityFeeSubscriber.d.ts +39 -0
- package/lib/node/priorityFee/priorityFeeSubscriber.d.ts.map +1 -1
- package/lib/node/priorityFee/priorityFeeSubscriber.js +39 -0
- package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts +20 -1
- package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts.map +1 -1
- package/lib/node/priorityFee/priorityFeeSubscriberMap.js +21 -2
- package/lib/node/priorityFee/solanaPriorityFeeMethod.d.ts +12 -0
- package/lib/node/priorityFee/solanaPriorityFeeMethod.d.ts.map +1 -1
- package/lib/node/priorityFee/solanaPriorityFeeMethod.js +10 -0
- package/lib/node/priorityFee/types.d.ts +32 -0
- package/lib/node/priorityFee/types.d.ts.map +1 -1
- package/lib/node/priorityFee/types.js +5 -0
- package/lib/node/priorityFee/velocityPriorityFeeMethod.d.ts +11 -0
- package/lib/node/priorityFee/velocityPriorityFeeMethod.d.ts.map +1 -1
- package/lib/node/priorityFee/velocityPriorityFeeMethod.js +8 -0
- package/lib/node/pyth/pythLazerSubscriber.d.ts.map +1 -1
- package/lib/node/pyth/pythLazerSubscriber.js +37 -27
- package/lib/node/slot/SlotSubscriber.d.ts +18 -0
- package/lib/node/slot/SlotSubscriber.d.ts.map +1 -1
- package/lib/node/slot/SlotSubscriber.js +16 -0
- package/lib/node/slot/SlothashSubscriber.d.ts +26 -0
- package/lib/node/slot/SlothashSubscriber.d.ts.map +1 -1
- package/lib/node/slot/SlothashSubscriber.js +25 -1
- package/lib/node/tx/baseTxSender.d.ts +163 -0
- package/lib/node/tx/baseTxSender.d.ts.map +1 -1
- package/lib/node/tx/baseTxSender.js +174 -6
- package/lib/node/tx/blockhashFetcher/baseBlockhashFetcher.d.ts +12 -0
- package/lib/node/tx/blockhashFetcher/baseBlockhashFetcher.d.ts.map +1 -1
- package/lib/node/tx/blockhashFetcher/baseBlockhashFetcher.js +12 -0
- package/lib/node/tx/blockhashFetcher/cachedBlockhashFetcher.d.ts +15 -0
- package/lib/node/tx/blockhashFetcher/cachedBlockhashFetcher.d.ts.map +1 -1
- package/lib/node/tx/blockhashFetcher/cachedBlockhashFetcher.js +15 -0
- package/lib/node/tx/blockhashFetcher/types.d.ts +4 -0
- package/lib/node/tx/blockhashFetcher/types.d.ts.map +1 -1
- package/lib/node/tx/fastSingleTxSender.d.ts +47 -0
- package/lib/node/tx/fastSingleTxSender.d.ts.map +1 -1
- package/lib/node/tx/fastSingleTxSender.js +48 -1
- package/lib/node/tx/forwardOnlyTxSender.d.ts +48 -0
- package/lib/node/tx/forwardOnlyTxSender.d.ts.map +1 -1
- package/lib/node/tx/forwardOnlyTxSender.js +48 -0
- package/lib/node/tx/reportTransactionError.d.ts +18 -6
- package/lib/node/tx/reportTransactionError.d.ts.map +1 -1
- package/lib/node/tx/reportTransactionError.js +18 -6
- package/lib/node/tx/retryTxSender.d.ts +40 -0
- package/lib/node/tx/retryTxSender.d.ts.map +1 -1
- package/lib/node/tx/retryTxSender.js +39 -0
- package/lib/node/tx/txHandler.d.ts +146 -35
- package/lib/node/tx/txHandler.d.ts.map +1 -1
- package/lib/node/tx/txHandler.js +132 -32
- package/lib/node/tx/txParamProcessor.d.ts +47 -0
- package/lib/node/tx/txParamProcessor.d.ts.map +1 -1
- package/lib/node/tx/txParamProcessor.js +47 -0
- package/lib/node/tx/types.d.ts +46 -0
- package/lib/node/tx/types.d.ts.map +1 -1
- package/lib/node/tx/types.js +5 -0
- package/lib/node/tx/utils.d.ts +26 -0
- package/lib/node/tx/utils.d.ts.map +1 -1
- package/lib/node/tx/utils.js +26 -0
- package/lib/node/tx/whileValidTxSender.d.ts +82 -0
- package/lib/node/tx/whileValidTxSender.d.ts.map +1 -1
- package/lib/node/tx/whileValidTxSender.js +81 -0
- package/lib/node/types.d.ts +785 -13
- package/lib/node/types.d.ts.map +1 -1
- package/lib/node/types.js +126 -9
- package/lib/node/user.d.ts +660 -84
- package/lib/node/user.d.ts.map +1 -1
- package/lib/node/user.js +816 -97
- package/lib/node/userMap/PollingSubscription.d.ts +10 -0
- package/lib/node/userMap/PollingSubscription.d.ts.map +1 -1
- package/lib/node/userMap/PollingSubscription.js +14 -2
- package/lib/node/userMap/WebsocketSubscription.d.ts +9 -0
- package/lib/node/userMap/WebsocketSubscription.d.ts.map +1 -1
- package/lib/node/userMap/WebsocketSubscription.js +9 -0
- package/lib/node/userMap/grpcSubscription.d.ts +8 -0
- package/lib/node/userMap/grpcSubscription.d.ts.map +1 -1
- package/lib/node/userMap/grpcSubscription.js +8 -0
- package/lib/node/userMap/referrerMap.d.ts +72 -2
- package/lib/node/userMap/referrerMap.d.ts.map +1 -1
- package/lib/node/userMap/referrerMap.js +84 -2
- package/lib/node/userMap/revenueShareEscrowMap.d.ts +37 -10
- package/lib/node/userMap/revenueShareEscrowMap.d.ts.map +1 -1
- package/lib/node/userMap/revenueShareEscrowMap.js +38 -11
- package/lib/node/userMap/userMap.d.ts +81 -3
- package/lib/node/userMap/userMap.d.ts.map +1 -1
- package/lib/node/userMap/userMap.js +81 -4
- package/lib/node/userMap/userMapConfig.d.ts +23 -0
- package/lib/node/userMap/userMapConfig.d.ts.map +1 -1
- package/lib/node/userMap/userStatsMap.d.ts +22 -0
- package/lib/node/userMap/userStatsMap.d.ts.map +1 -1
- package/lib/node/userMap/userStatsMap.js +22 -0
- package/lib/node/userName.d.ts +16 -0
- package/lib/node/userName.d.ts.map +1 -1
- package/lib/node/userName.js +16 -0
- package/lib/node/userStats.d.ts +28 -1
- package/lib/node/userStats.d.ts.map +1 -1
- package/lib/node/userStats.js +28 -1
- package/lib/node/util/TransactionConfirmationManager.d.ts +33 -0
- package/lib/node/util/TransactionConfirmationManager.d.ts.map +1 -1
- package/lib/node/util/TransactionConfirmationManager.js +33 -0
- package/lib/node/util/chainClock.d.ts +24 -0
- package/lib/node/util/chainClock.d.ts.map +1 -1
- package/lib/node/util/chainClock.js +20 -0
- package/lib/node/util/computeUnits.d.ts +32 -0
- package/lib/node/util/computeUnits.d.ts.map +1 -1
- package/lib/node/util/computeUnits.js +32 -0
- package/lib/node/util/digest.d.ts +17 -0
- package/lib/node/util/digest.d.ts.map +1 -1
- package/lib/node/util/digest.js +17 -0
- package/lib/node/util/ed25519Utils.d.ts +12 -2
- package/lib/node/util/ed25519Utils.d.ts.map +1 -1
- package/lib/node/util/ed25519Utils.js +12 -2
- package/lib/node/util/promiseTimeout.d.ts +9 -0
- package/lib/node/util/promiseTimeout.d.ts.map +1 -1
- package/lib/node/util/promiseTimeout.js +9 -0
- package/lib/node/velocityClient.d.ts +3363 -220
- package/lib/node/velocityClient.d.ts.map +1 -1
- package/lib/node/velocityClient.js +3514 -275
- package/lib/node/wallet.d.ts +37 -0
- package/lib/node/wallet.d.ts.map +1 -1
- package/lib/node/wallet.js +37 -0
- package/package.json +8 -3
- package/.prettierignore +0 -1
- package/CHANGELOG.md +0 -81
- package/build-browser.js +0 -58
- package/bunfig.toml +0 -3
- package/esbuild-shims.js +0 -12
- package/scripts/deposit-isolated-positions.ts +0 -110
- package/scripts/find-flagged-users.ts +0 -213
- package/scripts/grpc-client-test-comparison.ts +0 -372
- package/scripts/grpc-multiuser-client-test-comparison.ts +0 -158
- package/scripts/postbuild.js +0 -95
- package/scripts/single-grpc-client-test.ts +0 -284
- package/scripts/withdraw-isolated-positions.ts +0 -174
- package/src/accounts/README_WebSocketAccountSubscriberV2.md +0 -95
- package/src/accounts/README_WebSocketProgramAccountSubscriberV2.md +0 -135
- package/src/accounts/basicUserAccountSubscriber.ts +0 -61
- package/src/accounts/basicUserStatsAccountSubscriber.ts +0 -69
- package/src/accounts/bulkAccountLoader.ts +0 -306
- package/src/accounts/bulkUserStatsSubscription.ts +0 -33
- package/src/accounts/bulkUserSubscription.ts +0 -33
- package/src/accounts/customizedCadenceBulkAccountLoader.ts +0 -213
- package/src/accounts/fetch.ts +0 -143
- package/src/accounts/grpcAccountSubscriber.ts +0 -195
- package/src/accounts/grpcInsuranceFundStakeAccountSubscriber.ts +0 -57
- package/src/accounts/grpcMultiAccountSubscriber.ts +0 -483
- package/src/accounts/grpcMultiUserAccountSubscriber.ts +0 -290
- package/src/accounts/grpcProgramAccountSubscriber.ts +0 -231
- package/src/accounts/grpcUserAccountSubscriber.ts +0 -48
- package/src/accounts/grpcUserStatsAccountSubscriber.ts +0 -50
- package/src/accounts/grpcVelocityClientAccountSubscriber.ts +0 -216
- package/src/accounts/grpcVelocityClientAccountSubscriberV2.ts +0 -782
- package/src/accounts/laserProgramAccountSubscriber.ts +0 -232
- package/src/accounts/oneShotUserAccountSubscriber.ts +0 -69
- package/src/accounts/oneShotUserStatsAccountSubscriber.ts +0 -75
- package/src/accounts/pollingInsuranceFundStakeAccountSubscriber.ts +0 -192
- package/src/accounts/pollingOracleAccountSubscriber.ts +0 -132
- package/src/accounts/pollingTokenAccountSubscriber.ts +0 -125
- package/src/accounts/pollingUserAccountSubscriber.ts +0 -166
- package/src/accounts/pollingUserStatsAccountSubscriber.ts +0 -158
- package/src/accounts/pollingVelocityClientAccountSubscriber.ts +0 -691
- package/src/accounts/testBulkAccountLoader.ts +0 -51
- package/src/accounts/types.ts +0 -279
- package/src/accounts/utils.ts +0 -72
- package/src/accounts/webSocketAccountSubscriber.ts +0 -263
- package/src/accounts/webSocketAccountSubscriberV2.ts +0 -528
- package/src/accounts/webSocketInsuranceFundStakeAccountSubscriber.ts +0 -144
- package/src/accounts/webSocketProgramAccountSubscriber.ts +0 -208
- package/src/accounts/webSocketProgramAccountSubscriberV2.ts +0 -1022
- package/src/accounts/webSocketProgramAccountsSubscriberV2.ts +0 -1021
- package/src/accounts/webSocketUserAccountSubscriber.ts +0 -113
- package/src/accounts/webSocketUserStatsAccountSubsriber.ts +0 -111
- package/src/accounts/webSocketVelocityClientAccountSubscriber.ts +0 -740
- package/src/accounts/webSocketVelocityClientAccountSubscriberV2.ts +0 -787
- package/src/accounts/websocketProgramUserAccountSubscriber.ts +0 -94
- package/src/addresses/marketAddresses.ts +0 -18
- package/src/addresses/pda.ts +0 -404
- package/src/adminClient.ts +0 -5984
- package/src/assert/assert.ts +0 -5
- package/src/auctionSubscriber/auctionSubscriber.ts +0 -71
- package/src/auctionSubscriber/auctionSubscriberGrpc.ts +0 -80
- package/src/auctionSubscriber/index.ts +0 -3
- package/src/auctionSubscriber/types.ts +0 -23
- package/src/bankrun/bankrunConnection.ts +0 -630
- package/src/blockhashSubscriber/BlockhashSubscriber.ts +0 -127
- package/src/blockhashSubscriber/index.ts +0 -1
- package/src/blockhashSubscriber/types.ts +0 -12
- package/src/clock/clockSubscriber.ts +0 -122
- package/src/config.ts +0 -225
- package/src/constants/index.ts +0 -9
- package/src/constants/numericConstants.ts +0 -124
- package/src/constants/perpMarkets.ts +0 -1042
- package/src/constants/spotMarkets.ts +0 -874
- package/src/constants/txConstants.ts +0 -1
- package/src/constituentMap/constituentMap.ts +0 -305
- package/src/constituentMap/pollingConstituentAccountSubscriber.ts +0 -99
- package/src/constituentMap/webSocketConstituentAccountSubscriber.ts +0 -121
- package/src/core/VelocityCore.ts +0 -328
- package/src/core/index.ts +0 -12
- package/src/core/instructions/deposit.ts +0 -42
- package/src/core/instructions/fill.ts +0 -34
- package/src/core/instructions/funding.ts +0 -21
- package/src/core/instructions/liquidation.ts +0 -37
- package/src/core/instructions/orders.ts +0 -56
- package/src/core/instructions/perpOrders.ts +0 -206
- package/src/core/instructions/settlement.ts +0 -26
- package/src/core/instructions/trigger.ts +0 -26
- package/src/core/instructions/withdraw.ts +0 -44
- package/src/core/remainingAccounts.ts +0 -276
- package/src/core/signedMsg.ts +0 -71
- package/src/decode/customCoder.ts +0 -105
- package/src/decode/user.ts +0 -379
- package/src/dlob/DLOB.ts +0 -2222
- package/src/dlob/DLOBNode.ts +0 -213
- package/src/dlob/DLOBSubscriber.ts +0 -232
- package/src/dlob/NodeList.ts +0 -175
- package/src/dlob/orderBookLevels.ts +0 -601
- package/src/dlob/types.ts +0 -22
- package/src/events/eventList.ts +0 -100
- package/src/events/eventSubscriber.ts +0 -440
- package/src/events/eventsServerLogProvider.ts +0 -161
- package/src/events/fetchLogs.ts +0 -169
- package/src/events/parse.ts +0 -248
- package/src/events/pollingLogProvider.ts +0 -89
- package/src/events/sort.ts +0 -39
- package/src/events/txEventCache.ts +0 -80
- package/src/events/types.ts +0 -217
- package/src/events/webSocketLogProvider.ts +0 -123
- package/src/factory/bigNum.ts +0 -709
- package/src/factory/oracleClient.ts +0 -73
- package/src/idl/pyth.json +0 -142
- package/src/idl/pyth.ts +0 -97
- package/src/idl/pyth_solana_receiver.json +0 -628
- package/src/idl/token_faucet.json +0 -229
- package/src/idl/token_faucet.ts +0 -197
- package/src/idl/velocity.json +0 -23974
- package/src/idl/velocity.ts +0 -23980
- package/src/index.ts +0 -150
- package/src/indicative-quotes/indicativeQuotesSender.ts +0 -233
- package/src/isomorphic/README.md +0 -19
- package/src/isomorphic/anchor.browser.ts +0 -44
- package/src/isomorphic/anchor.node.ts +0 -1
- package/src/isomorphic/anchor.ts +0 -1
- package/src/isomorphic/anchor29.browser.ts +0 -24
- package/src/isomorphic/anchor29.node.ts +0 -1
- package/src/isomorphic/anchor29.ts +0 -1
- package/src/isomorphic/grpc.browser.ts +0 -4
- package/src/isomorphic/grpc.node.ts +0 -130
- package/src/isomorphic/grpc.ts +0 -1
- package/src/jupiter/jupiterClient.ts +0 -502
- package/src/keypair.ts +0 -24
- package/src/margin/README.md +0 -138
- package/src/marginCalculation.ts +0 -256
- package/src/marinade/idl/idl.json +0 -1962
- package/src/marinade/index.ts +0 -73
- package/src/marinade/types.ts +0 -3925
- package/src/math/amm.ts +0 -1423
- package/src/math/auction.ts +0 -371
- package/src/math/bankruptcy.ts +0 -35
- package/src/math/builder.ts +0 -64
- package/src/math/conversion.ts +0 -24
- package/src/math/exchangeStatus.ts +0 -146
- package/src/math/funding.ts +0 -458
- package/src/math/insurance.ts +0 -109
- package/src/math/liquidation.ts +0 -223
- package/src/math/margin.ts +0 -261
- package/src/math/market.ts +0 -356
- package/src/math/oracles.ts +0 -353
- package/src/math/orders.ts +0 -378
- package/src/math/position.ts +0 -334
- package/src/math/repeg.ts +0 -185
- package/src/math/spotBalance.ts +0 -756
- package/src/math/spotMarket.ts +0 -82
- package/src/math/spotPosition.ts +0 -191
- package/src/math/state.ts +0 -40
- package/src/math/superStake.ts +0 -479
- package/src/math/tiers.ts +0 -44
- package/src/math/trade.ts +0 -809
- package/src/math/utils.ts +0 -121
- package/src/memcmp.ts +0 -177
- package/src/oracles/oracleClientCache.ts +0 -25
- package/src/oracles/oracleId.ts +0 -66
- package/src/oracles/prelaunchOracleClient.ts +0 -43
- package/src/oracles/pythClient.ts +0 -94
- package/src/oracles/pythLazerClient.ts +0 -107
- package/src/oracles/quoteAssetOracleClient.ts +0 -25
- package/src/oracles/strictOraclePrice.ts +0 -19
- package/src/oracles/types.ts +0 -37
- package/src/oracles/utils.ts +0 -25
- package/src/orderParams.ts +0 -79
- package/src/orderSubscriber/OrderSubscriber.ts +0 -322
- package/src/orderSubscriber/PollingSubscription.ts +0 -39
- package/src/orderSubscriber/WebsocketSubscription.ts +0 -119
- package/src/orderSubscriber/grpcSubscription.ts +0 -139
- package/src/orderSubscriber/index.ts +0 -7
- package/src/orderSubscriber/types.ts +0 -55
- package/src/priorityFee/averageOverSlotsStrategy.ts +0 -16
- package/src/priorityFee/averageStrategy.ts +0 -12
- package/src/priorityFee/ewmaStrategy.ts +0 -41
- package/src/priorityFee/heliusPriorityFeeMethod.ts +0 -57
- package/src/priorityFee/index.ts +0 -16
- package/src/priorityFee/maxOverSlotsStrategy.ts +0 -17
- package/src/priorityFee/maxStrategy.ts +0 -7
- package/src/priorityFee/priorityFeeSubscriber.ts +0 -289
- package/src/priorityFee/priorityFeeSubscriberMap.ts +0 -115
- package/src/priorityFee/solanaPriorityFeeMethod.ts +0 -34
- package/src/priorityFee/types.ts +0 -64
- package/src/priorityFee/velocityPriorityFeeMethod.ts +0 -42
- package/src/pyth/constants.ts +0 -9
- package/src/pyth/index.ts +0 -15
- package/src/pyth/pythLazerSubscriber.ts +0 -365
- package/src/pyth/types.ts +0 -4451
- package/src/pyth/utils.ts +0 -13
- package/src/slot/SlotSubscriber.ts +0 -108
- package/src/slot/SlothashSubscriber.ts +0 -137
- package/src/swap/UnifiedSwapClient.ts +0 -315
- package/src/swift/grpcSignedMsgUserAccountSubscriber.ts +0 -81
- package/src/swift/index.ts +0 -10
- package/src/swift/signedMsgUserAccountSubscriber.ts +0 -251
- package/src/swift/swiftOrderSubscriber.ts +0 -351
- package/src/testClient.ts +0 -42
- package/src/titan/titanClient.ts +0 -438
- package/src/token/index.ts +0 -13
- package/src/tokenFaucet.ts +0 -296
- package/src/tx/baseTxSender.ts +0 -471
- package/src/tx/blockhashFetcher/baseBlockhashFetcher.ts +0 -19
- package/src/tx/blockhashFetcher/cachedBlockhashFetcher.ts +0 -90
- package/src/tx/blockhashFetcher/types.ts +0 -5
- package/src/tx/fastSingleTxSender.ts +0 -146
- package/src/tx/forwardOnlyTxSender.ts +0 -145
- package/src/tx/priorityFeeCalculator.ts +0 -117
- package/src/tx/reportTransactionError.ts +0 -164
- package/src/tx/retryTxSender.ts +0 -137
- package/src/tx/txHandler.ts +0 -898
- package/src/tx/txParamProcessor.ts +0 -178
- package/src/tx/types.ts +0 -71
- package/src/tx/utils.ts +0 -107
- package/src/tx/whileValidTxSender.ts +0 -295
- package/src/types.ts +0 -1822
- package/src/user.ts +0 -4557
- package/src/userConfig.ts +0 -38
- package/src/userMap/PollingSubscription.ts +0 -47
- package/src/userMap/WebsocketSubscription.ts +0 -84
- package/src/userMap/grpcSubscription.ts +0 -85
- package/src/userMap/referrerMap.ts +0 -271
- package/src/userMap/revenueShareEscrowMap.ts +0 -315
- package/src/userMap/userMap.ts +0 -706
- package/src/userMap/userMapConfig.ts +0 -69
- package/src/userMap/userStatsMap.ts +0 -371
- package/src/userName.ts +0 -21
- package/src/userStats.ts +0 -132
- package/src/userStatsConfig.ts +0 -35
- package/src/util/TransactionConfirmationManager.ts +0 -300
- package/src/util/chainClock.ts +0 -41
- package/src/util/computeUnits.ts +0 -69
- package/src/util/digest.ts +0 -16
- package/src/util/ed25519Utils.ts +0 -85
- package/src/util/promiseTimeout.ts +0 -14
- package/src/velocityClient.ts +0 -11612
- package/src/velocityClientConfig.ts +0 -119
- package/src/wallet.ts +0 -54
- package/tests/VelocityCore/decode.test.ts +0 -16
- package/tests/VelocityCore/fill_trigger.test.ts +0 -73
- package/tests/VelocityCore/instructions.test.ts +0 -46
- package/tests/VelocityCore/pdas.test.ts +0 -30
- package/tests/VelocityCore/perp_orders.test.ts +0 -205
- package/tests/VelocityCore/remainingAccounts.test.ts +0 -72
- package/tests/VelocityCore/settlement_liquidation.test.ts +0 -69
- package/tests/accounts/customizedCadenceBulkAccountLoader.test.ts +0 -211
- package/tests/amm/test.ts +0 -2300
- package/tests/auctions/test.ts +0 -81
- package/tests/bn/test.ts +0 -355
- package/tests/ci/verifyConstants.ts +0 -393
- package/tests/decode/test.ts +0 -262
- package/tests/decode/userAccountBufferStrings.ts +0 -102
- package/tests/dlob/helpers.ts +0 -748
- package/tests/dlob/test.ts +0 -6969
- package/tests/events/parseLogsForCuUsage.ts +0 -139
- package/tests/insurance/test.ts +0 -40
- package/tests/spot/test.ts +0 -226
- package/tests/tx/TransactionConfirmationManager.test.ts +0 -312
- package/tests/tx/cachedBlockhashFetcher.test.ts +0 -96
- package/tests/tx/priorityFeeCalculator.ts +0 -77
- package/tests/tx/priorityFeeStrategy.ts +0 -95
- package/tests/user/getMarginCalculation.ts +0 -361
- package/tests/user/helpers.ts +0 -184
- package/tests/user/liquidations.ts +0 -129
- package/tests/user/marginCalculations.test.ts +0 -321
- package/tests/user/test.ts +0 -829
- package/tsconfig.browser.json +0 -18
- package/tsconfig.json +0 -36
package/lib/node/types.d.ts
CHANGED
|
@@ -13,9 +13,17 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import { Keypair, PublicKey, Transaction, TransactionVersion, VersionedTransaction } from '@solana/web3.js';
|
|
15
15
|
import { BN } from './isomorphic/anchor';
|
|
16
|
+
/** Utility type that maps every key of `A` to the same-shaped record with all values replaced by type `B`. */
|
|
16
17
|
export type MappedRecord<A extends Record<string, unknown>, B> = {
|
|
17
18
|
[K in keyof A]: B;
|
|
18
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Bitmask mirror of `State.exchangeStatus`. Each non-zero member pauses one class of
|
|
22
|
+
* instructions protocol-wide; multiple bits may be set simultaneously (e.g. deposits and
|
|
23
|
+
* withdrawals paused together). `PAUSED` (255) is the "pause everything" value, not a flag
|
|
24
|
+
* combinable with the others. Only `coldAdmin`/`warmAdmin` may clear bits; `pauseAdmin` may
|
|
25
|
+
* only set them (see `StateAccount.pauseAdmin`).
|
|
26
|
+
*/
|
|
19
27
|
export declare enum ExchangeStatus {
|
|
20
28
|
ACTIVE = 0,
|
|
21
29
|
DEPOSIT_PAUSED = 1,
|
|
@@ -28,16 +36,34 @@ export declare enum ExchangeStatus {
|
|
|
28
36
|
AMM_IMMEDIATE_FILL_PAUSED = 128,
|
|
29
37
|
PAUSED = 255
|
|
30
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Mirror of the Rust `SolvencyStatus` bitflag (`StateAccount.solvencyStatus`). Gates internal
|
|
41
|
+
* solvency-repair flows (bankruptcy / pnl-deficit resolution) independently of
|
|
42
|
+
* `ExchangeStatus.WITHDRAW_PAUSED`, so withdrawals can be halted while repair keeps running, or
|
|
43
|
+
* repair can be frozen on its own (e.g. when an oracle is suspect) without touching withdrawals.
|
|
44
|
+
* `ACTIVE` (0) means repair is allowed.
|
|
45
|
+
*/
|
|
31
46
|
export declare enum SolvencyStatus {
|
|
32
47
|
ACTIVE = 0,
|
|
33
48
|
SOLVENCY_REPAIR_PAUSED = 1
|
|
34
49
|
}
|
|
50
|
+
/** Bitmask mirror of `StateAccount.featureBitFlags`, gating protocol-wide optional features. */
|
|
35
51
|
export declare enum FeatureBitFlags {
|
|
36
52
|
MM_ORACLE_UPDATE = 1,
|
|
37
53
|
MEDIAN_TRIGGER_PRICE = 2,
|
|
38
|
-
BUILDER_CODES = 4
|
|
39
|
-
BUILDER_REFERRAL = 8
|
|
54
|
+
BUILDER_CODES = 4
|
|
40
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Mirrors the Rust `MarketStatus` enum on `PerpMarketAccount.status` / `SpotMarketAccount.status`.
|
|
58
|
+
* Controls which operations a market allows: `INITIALIZED` (warm-up, fills paused), `ACTIVE` (all
|
|
59
|
+
* operations allowed), `REDUCE_ONLY` (fills may only shrink a liability), `SETTLEMENT` (market has
|
|
60
|
+
* a determined settlement price; positions must be settled), `DELISTED` (no participants remain).
|
|
61
|
+
* Velocity's on-chain discriminants (`Initialized`=0, `Active`=1, `ReduceOnly`=2, `Settlement`=3,
|
|
62
|
+
* `Delisted`=4) are **shifted down from upstream Drift's** (`ReduceOnly`=6, `Settlement`=7,
|
|
63
|
+
* `Delisted`=8) after the deprecated `FundingPaused`/`AmmPaused`/`FillPaused`/`WithdrawPaused`
|
|
64
|
+
* variants were removed — any decoder built against the old Drift discriminants will silently
|
|
65
|
+
* misread these states.
|
|
66
|
+
*/
|
|
41
67
|
export declare class MarketStatus {
|
|
42
68
|
static readonly INITIALIZED: {
|
|
43
69
|
initialized: {};
|
|
@@ -55,6 +81,7 @@ export declare class MarketStatus {
|
|
|
55
81
|
delisted: {};
|
|
56
82
|
};
|
|
57
83
|
}
|
|
84
|
+
/** Bitmask mirror of `PerpMarketAccount.pausedOperations`; each bit disables one perp-market operation. */
|
|
58
85
|
export declare enum PerpOperation {
|
|
59
86
|
UPDATE_FUNDING = 1,
|
|
60
87
|
AMM_FILL = 2,
|
|
@@ -62,8 +89,10 @@ export declare enum PerpOperation {
|
|
|
62
89
|
SETTLE_PNL = 8,
|
|
63
90
|
SETTLE_PNL_WITH_POSITION = 16,
|
|
64
91
|
LIQUIDATION = 32,
|
|
65
|
-
|
|
92
|
+
AMM_IMMEDIATE_FILL = 64,
|
|
93
|
+
SETTLE_REV_POOL = 128
|
|
66
94
|
}
|
|
95
|
+
/** Bitmask mirror of `SpotMarketAccount.pausedOperations`; each bit disables one spot-market operation. */
|
|
67
96
|
export declare enum SpotOperation {
|
|
68
97
|
UPDATE_CUMULATIVE_INTEREST = 1,
|
|
69
98
|
FILL = 2,
|
|
@@ -71,42 +100,65 @@ export declare enum SpotOperation {
|
|
|
71
100
|
WITHDRAW = 8,
|
|
72
101
|
LIQUIDATION = 16
|
|
73
102
|
}
|
|
103
|
+
/** Bitmask mirror of `SpotMarketAccount.ifPausedOperations`; each bit disables one insurance-fund-stake operation. */
|
|
74
104
|
export declare enum InsuranceFundOperation {
|
|
75
105
|
INIT = 1,
|
|
76
106
|
ADD = 2,
|
|
77
107
|
REQUEST_REMOVE = 4,
|
|
78
108
|
REMOVE = 8
|
|
79
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Bitmask mirror of `UserAccount.status`. Multiple bits can be set at once (e.g. a bankrupt user
|
|
112
|
+
* is also `BEING_LIQUIDATED`). `0` (unset) means active/normal. Bit `16` (was `PROTECTED_MAKER`)
|
|
113
|
+
* is reserved and no longer assigned.
|
|
114
|
+
*/
|
|
80
115
|
export declare enum UserStatus {
|
|
81
116
|
BEING_LIQUIDATED = 1,
|
|
82
117
|
BANKRUPT = 2,
|
|
83
118
|
REDUCE_ONLY = 4,
|
|
84
119
|
ADVANCED_LP = 8
|
|
85
120
|
}
|
|
121
|
+
/** Bitmask mirror of `UserAccount.specialUserStatus`. `VAMM_HEDGER` marks the account used by the protocol's own vAMM-hedging bot. */
|
|
86
122
|
export declare enum SpecialUserStatus {
|
|
87
123
|
VAMM_HEDGER = 1
|
|
88
124
|
}
|
|
125
|
+
/** Bitmask mirror of `UserStatsAccount.pausedOperations`; each bit disables one per-user-stats update path. */
|
|
89
126
|
export declare enum UserStatsPausedOperation {
|
|
90
127
|
UPDATE_BID_ASK_TWAP = 1,
|
|
91
128
|
AMM_ATOMIC_FILL = 2,
|
|
92
129
|
AMM_ATOMIC_RISK_INCREASING_FILL = 4
|
|
93
130
|
}
|
|
131
|
+
/** Bitmask mirror of `PerpMarketAccount.marketConfig`. `DISABLE_FORMULAIC_K_UPDATE` turns off the AMM's automatic `k` (liquidity depth) adjustments for that market. */
|
|
94
132
|
export declare enum MarketConfigFlag {
|
|
95
133
|
DISABLE_FORMULAIC_K_UPDATE = 1
|
|
96
134
|
}
|
|
135
|
+
/** Margin-mode enum-class. Currently only `DEFAULT` (cross margin) exists; isolated margin is expressed per-position via `PositionFlag.IsolatedPosition`, not a distinct margin mode. */
|
|
97
136
|
export declare class MarginMode {
|
|
98
137
|
static readonly DEFAULT: {
|
|
99
138
|
default: {};
|
|
100
139
|
};
|
|
101
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Mirrors the on-chain `ContractType` on `PerpMarketAccount.contractType`. Only `PERPETUAL` is
|
|
143
|
+
* live; `DEPRECATED_FUTURE` and `DEPRECATED_PREDICTION` are inert stubs kept for IDL/discriminant
|
|
144
|
+
* compatibility and are never assigned to a market.
|
|
145
|
+
*/
|
|
102
146
|
export declare class ContractType {
|
|
103
147
|
static readonly PERPETUAL: {
|
|
104
148
|
perpetual: {};
|
|
105
149
|
};
|
|
106
|
-
static readonly
|
|
107
|
-
|
|
150
|
+
static readonly DEPRECATED_FUTURE: {
|
|
151
|
+
deprecatedFuture: {};
|
|
152
|
+
};
|
|
153
|
+
static readonly DEPRECATED_PREDICTION: {
|
|
154
|
+
deprecatedPrediction: {};
|
|
108
155
|
};
|
|
109
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* A perp market's speculativeness tier (`PerpMarketAccount.contractTier`). Determines how much of
|
|
159
|
+
* the insurance fund the market may draw on during bankruptcy and the order markets are
|
|
160
|
+
* liquidated in — `ISOLATED` markets receive no shared insurance coverage; `A` is safest.
|
|
161
|
+
*/
|
|
110
162
|
export declare class ContractTier {
|
|
111
163
|
static readonly A: {
|
|
112
164
|
a: {};
|
|
@@ -127,6 +179,12 @@ export declare class ContractTier {
|
|
|
127
179
|
isolated: {};
|
|
128
180
|
};
|
|
129
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* A spot market's collateral-safety tier (`SpotMarketAccount.assetTier`). Determines whether a
|
|
184
|
+
* deposit can be used as cross-margin collateral alongside other assets: `COLLATERAL` may back
|
|
185
|
+
* any borrow, `PROTECTED`/`CROSS` have restrictions on being borrowed against, `ISOLATED` deposits
|
|
186
|
+
* can't be combined with other borrows, and `UNLISTED` deposits count for nothing.
|
|
187
|
+
*/
|
|
130
188
|
export declare class AssetTier {
|
|
131
189
|
static readonly COLLATERAL: {
|
|
132
190
|
collateral: {};
|
|
@@ -144,10 +202,12 @@ export declare class AssetTier {
|
|
|
144
202
|
unlisted: {};
|
|
145
203
|
};
|
|
146
204
|
}
|
|
205
|
+
/** Bitmask mirror of `SpotMarketAccount.tokenProgramFlag`, recording which SPL token-program features the market's mint uses. */
|
|
147
206
|
export declare enum TokenProgramFlag {
|
|
148
207
|
Token2022 = 1,
|
|
149
208
|
TransferHook = 2
|
|
150
209
|
}
|
|
210
|
+
/** Direction of an LP-pool constituent swap (add liquidity vs remove liquidity). */
|
|
151
211
|
export declare class SwapDirection {
|
|
152
212
|
static readonly ADD: {
|
|
153
213
|
add: {};
|
|
@@ -156,6 +216,7 @@ export declare class SwapDirection {
|
|
|
156
216
|
remove: {};
|
|
157
217
|
};
|
|
158
218
|
}
|
|
219
|
+
/** Whether a `SpotPosition`/`PoolBalance`'s scaled balance represents a deposit (positive token claim) or a borrow (liability). */
|
|
159
220
|
export declare class SpotBalanceType {
|
|
160
221
|
static readonly DEPOSIT: {
|
|
161
222
|
deposit: {};
|
|
@@ -164,6 +225,7 @@ export declare class SpotBalanceType {
|
|
|
164
225
|
borrow: {};
|
|
165
226
|
};
|
|
166
227
|
}
|
|
228
|
+
/** Long (bid) or short (ask) side of a perp/spot order or position. */
|
|
167
229
|
export declare class PositionDirection {
|
|
168
230
|
static readonly LONG: {
|
|
169
231
|
long: {};
|
|
@@ -172,6 +234,7 @@ export declare class PositionDirection {
|
|
|
172
234
|
short: {};
|
|
173
235
|
};
|
|
174
236
|
}
|
|
237
|
+
/** Direction of a `DepositRecord` / `LPBorrowLendDepositRecord` event: funds entering or leaving the protocol. */
|
|
175
238
|
export declare class DepositDirection {
|
|
176
239
|
static readonly DEPOSIT: {
|
|
177
240
|
deposit: {};
|
|
@@ -180,6 +243,13 @@ export declare class DepositDirection {
|
|
|
180
243
|
withdraw: {};
|
|
181
244
|
};
|
|
182
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* Mirrors the on-chain `OracleSource` enum, identifying which oracle provider/decoder to use for
|
|
248
|
+
* a market's `oracle` account. The `1K`/`1M` suffixes scale the raw feed price by 1e3/1e6 (used
|
|
249
|
+
* for low-priced assets like BONK). `DEPRECATED_SWITCHBOARD`/`DEPRECATED_SWITCHBOARD_ON_DEMAND`
|
|
250
|
+
* are inert stubs — using them returns `InvalidOracle`. `Prelaunch` reads from a `PrelaunchOracle`
|
|
251
|
+
* account instead of an external feed.
|
|
252
|
+
*/
|
|
183
253
|
export declare class OracleSource {
|
|
184
254
|
static readonly PYTH: {
|
|
185
255
|
pyth: {};
|
|
@@ -199,8 +269,8 @@ export declare class OracleSource {
|
|
|
199
269
|
static readonly PYTH_1M_PULL: {
|
|
200
270
|
pyth1MPull: {};
|
|
201
271
|
};
|
|
202
|
-
static readonly
|
|
203
|
-
|
|
272
|
+
static readonly DEPRECATED_SWITCHBOARD: {
|
|
273
|
+
deprecatedSwitchboard: {};
|
|
204
274
|
};
|
|
205
275
|
static readonly QUOTE_ASSET: {
|
|
206
276
|
quoteAsset: {};
|
|
@@ -214,8 +284,8 @@ export declare class OracleSource {
|
|
|
214
284
|
static readonly Prelaunch: {
|
|
215
285
|
prelaunch: {};
|
|
216
286
|
};
|
|
217
|
-
static readonly
|
|
218
|
-
|
|
287
|
+
static readonly DEPRECATED_SWITCHBOARD_ON_DEMAND: {
|
|
288
|
+
deprecatedSwitchboardOnDemand: {};
|
|
219
289
|
};
|
|
220
290
|
static readonly PYTH_LAZER: {
|
|
221
291
|
pythLazer: {};
|
|
@@ -230,6 +300,13 @@ export declare class OracleSource {
|
|
|
230
300
|
pythLazerStableCoin: {};
|
|
231
301
|
};
|
|
232
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* Stable SDK-internal numeric encoding of `OracleSource`, used only for oracle-id string
|
|
305
|
+
* round-tripping (`getOracleSourceNum` ↔ `getOracleSourceFromNum` in `oracles/oracleId.ts`).
|
|
306
|
+
* NOTE: these numbers are **not** the on-chain Borsh discriminants and are **not** in the
|
|
307
|
+
* on-chain enum's declaration order — do not use them for raw memcmp filters against chain
|
|
308
|
+
* data. They only need to be self-consistent within the SDK.
|
|
309
|
+
*/
|
|
233
310
|
export declare class OracleSourceNum {
|
|
234
311
|
static readonly PYTH = 0;
|
|
235
312
|
static readonly PYTH_1K = 1;
|
|
@@ -237,17 +314,18 @@ export declare class OracleSourceNum {
|
|
|
237
314
|
static readonly PYTH_PULL = 3;
|
|
238
315
|
static readonly PYTH_1K_PULL = 4;
|
|
239
316
|
static readonly PYTH_1M_PULL = 5;
|
|
240
|
-
static readonly
|
|
317
|
+
static readonly DEPRECATED_SWITCHBOARD = 6;
|
|
241
318
|
static readonly QUOTE_ASSET = 7;
|
|
242
319
|
static readonly PYTH_STABLE_COIN = 8;
|
|
243
320
|
static readonly PYTH_STABLE_COIN_PULL = 9;
|
|
244
321
|
static readonly PRELAUNCH = 10;
|
|
245
|
-
static readonly
|
|
322
|
+
static readonly DEPRECATED_SWITCHBOARD_ON_DEMAND = 11;
|
|
246
323
|
static readonly PYTH_LAZER = 12;
|
|
247
324
|
static readonly PYTH_LAZER_1K = 13;
|
|
248
325
|
static readonly PYTH_LAZER_1M = 14;
|
|
249
326
|
static readonly PYTH_LAZER_STABLE_COIN = 15;
|
|
250
327
|
}
|
|
328
|
+
/** The order's price-determination mechanism: `LIMIT`/`TRIGGER_LIMIT` use `Order.price`, `MARKET`/`TRIGGER_MARKET` fill at the best available price (subject to any auction), and `ORACLE` prices relative to the oracle via `Order.oraclePriceOffset`. `TRIGGER_*` variants only become active once `Order.triggerPrice` is crossed. */
|
|
251
329
|
export declare class OrderType {
|
|
252
330
|
static readonly LIMIT: {
|
|
253
331
|
limit: {};
|
|
@@ -265,7 +343,9 @@ export declare class OrderType {
|
|
|
265
343
|
oracle: {};
|
|
266
344
|
};
|
|
267
345
|
}
|
|
346
|
+
/** String-literal twin of `MarketType`, used where a plain `'perp' | 'spot'` string (not the `{variant: {}}` shape) is more convenient, e.g. UI/query params. */
|
|
268
347
|
export declare type MarketTypeStr = 'perp' | 'spot';
|
|
348
|
+
/** Whether an order/position/market is on the spot or perp side of the protocol. */
|
|
269
349
|
export declare class MarketType {
|
|
270
350
|
static readonly SPOT: {
|
|
271
351
|
spot: {};
|
|
@@ -274,6 +354,7 @@ export declare class MarketType {
|
|
|
274
354
|
perp: {};
|
|
275
355
|
};
|
|
276
356
|
}
|
|
357
|
+
/** Lifecycle state of an `Order`: `INIT` (unused slot), `OPEN` (live, may still be filled), `FILLED` (fully filled), `CANCELED`. */
|
|
277
358
|
export declare class OrderStatus {
|
|
278
359
|
static readonly INIT: {
|
|
279
360
|
init: {};
|
|
@@ -288,12 +369,27 @@ export declare class OrderStatus {
|
|
|
288
369
|
canceled: {};
|
|
289
370
|
};
|
|
290
371
|
}
|
|
372
|
+
/**
|
|
373
|
+
* Bitmask mirror of `Order.bitFlags` / `OrderParams.bitFlags`.
|
|
374
|
+
* - `SignedMessage`: order originated from a signed off-chain message (swift/signed-msg flow).
|
|
375
|
+
* - `OracleTriggerMarket`: a `TriggerMarket` order whose trigger condition is evaluated against
|
|
376
|
+
* the oracle price rather than the last mark/fill price.
|
|
377
|
+
* - `SafeTriggerOrder`: exempts the order from the AMM's low-risk-fill slot-delay gate — it may
|
|
378
|
+
* be immediately filled by the AMM once triggered, or when the order itself is a liquidation.
|
|
379
|
+
* - `NewTriggerReduceOnly`: for a reduce-only order that has triggered, suppresses updating the
|
|
380
|
+
* user's `openBids`/`openAsks` counters (avoids double-counting margin already reserved).
|
|
381
|
+
* - `HasBuilder`: the order carries a `builderIdx`/`builderFeeTenthBps` builder-code fee split.
|
|
382
|
+
* - `IsIsolatedPosition`: the order trades against/opens an isolated-margin position rather than cross margin.
|
|
383
|
+
*/
|
|
291
384
|
export declare class OrderBitFlag {
|
|
292
385
|
static readonly SignedMessage = 1;
|
|
293
386
|
static readonly OracleTriggerMarket = 2;
|
|
294
387
|
static readonly SafeTriggerOrder = 4;
|
|
295
388
|
static readonly NewTriggerReduceOnly = 8;
|
|
389
|
+
static readonly HasBuilder = 16;
|
|
390
|
+
static readonly IsIsolatedPosition = 32;
|
|
296
391
|
}
|
|
392
|
+
/** The kind of action an `OrderActionRecord` event describes. */
|
|
297
393
|
export declare class OrderAction {
|
|
298
394
|
static readonly PLACE: {
|
|
299
395
|
place: {};
|
|
@@ -311,6 +407,7 @@ export declare class OrderAction {
|
|
|
311
407
|
trigger: {};
|
|
312
408
|
};
|
|
313
409
|
}
|
|
410
|
+
/** Why an `OrderActionRecord` event happened — the specific reason a fill/cancel/expire/trigger occurred (e.g. which fulfillment method filled the order, or why it was rejected/canceled). */
|
|
314
411
|
export declare class OrderActionExplanation {
|
|
315
412
|
static readonly NONE: {
|
|
316
413
|
none: {};
|
|
@@ -364,6 +461,7 @@ export declare class OrderActionExplanation {
|
|
|
364
461
|
transferPerpPosition: {};
|
|
365
462
|
};
|
|
366
463
|
}
|
|
464
|
+
/** Trigger-order condition on `Order.triggerCondition`. `ABOVE`/`BELOW` are the pending (not-yet-triggered) states; `TRIGGERED_ABOVE`/`TRIGGERED_BELOW` record that the condition has already fired, so the order is now live for filling. */
|
|
367
465
|
export declare class OrderTriggerCondition {
|
|
368
466
|
static readonly ABOVE: {
|
|
369
467
|
above: {};
|
|
@@ -378,6 +476,7 @@ export declare class OrderTriggerCondition {
|
|
|
378
476
|
triggeredBelow: {};
|
|
379
477
|
};
|
|
380
478
|
}
|
|
479
|
+
/** Why a `DepositRecord` event happened: a direct transfer, a borrow being drawn, a borrow being repaid, or a protocol reward credit. */
|
|
381
480
|
export declare class DepositExplanation {
|
|
382
481
|
static readonly NONE: {
|
|
383
482
|
none: {};
|
|
@@ -395,6 +494,7 @@ export declare class DepositExplanation {
|
|
|
395
494
|
reward: {};
|
|
396
495
|
};
|
|
397
496
|
}
|
|
497
|
+
/** Why a `SettlePnlRecord` event happened: a normal settle, or settlement of an expired-market position at the market's `expiryPrice`. */
|
|
398
498
|
export declare class SettlePnlExplanation {
|
|
399
499
|
static readonly NONE: {
|
|
400
500
|
none: {};
|
|
@@ -403,6 +503,7 @@ export declare class SettlePnlExplanation {
|
|
|
403
503
|
expiredPosition: {};
|
|
404
504
|
};
|
|
405
505
|
}
|
|
506
|
+
/** The insurance-fund-stake action an `InsuranceFundStakeRecord` event describes. */
|
|
406
507
|
export declare class StakeAction {
|
|
407
508
|
static readonly STAKE: {
|
|
408
509
|
stake: {};
|
|
@@ -423,6 +524,7 @@ export declare class StakeAction {
|
|
|
423
524
|
stakeTransfer: {};
|
|
424
525
|
};
|
|
425
526
|
}
|
|
527
|
+
/** Fill/settle-PnL strictness passed to settle-PnL instructions: `TRY_SETTLE` settles as much as is safe and never fails outright, `MUST_SETTLE` requires the full requested settlement to succeed or the instruction reverts. */
|
|
426
528
|
export declare class SettlePnlMode {
|
|
427
529
|
static readonly TRY_SETTLE: {
|
|
428
530
|
trySettle: {};
|
|
@@ -431,15 +533,21 @@ export declare class SettlePnlMode {
|
|
|
431
533
|
mustSettle: {};
|
|
432
534
|
};
|
|
433
535
|
}
|
|
536
|
+
/** Returns true if the Anchor enum-class instance `object` (shape `{ [variant]: {} }`) is the given variant key. */
|
|
434
537
|
export declare function isVariant(object: unknown, type: string): boolean;
|
|
538
|
+
/** Returns true if the Anchor enum-class instance `object` matches any of the given variant keys. */
|
|
435
539
|
export declare function isOneOfVariant(object: unknown, types: string[]): boolean;
|
|
540
|
+
/** Returns the sole variant key of an Anchor enum-class instance (shape `{ [variant]: {} }`), e.g. `"long"` for `PositionDirection.LONG`. */
|
|
436
541
|
export declare function getVariant(object: unknown): string;
|
|
542
|
+
/** Aggressor side of a trade for candle/trade-history purposes. `None` is used when a fill has no clear taker side (e.g. some liquidations). */
|
|
437
543
|
export declare enum TradeSide {
|
|
438
544
|
None = 0,
|
|
439
545
|
Buy = 1,
|
|
440
546
|
Sell = 2
|
|
441
547
|
}
|
|
548
|
+
/** Candle bucket size in minutes (`'1'`…`'240'`), or `'D'`/`'W'`/`'M'` for day/week/month candles. */
|
|
442
549
|
export type CandleResolution = '1' | '5' | '15' | '60' | '240' | 'D' | 'W' | 'M';
|
|
550
|
+
/** Emitted when a new `UserAccount` sub-account is created. */
|
|
443
551
|
export type NewUserRecord = {
|
|
444
552
|
ts: BN;
|
|
445
553
|
userAuthority: PublicKey;
|
|
@@ -448,6 +556,7 @@ export type NewUserRecord = {
|
|
|
448
556
|
name: number[];
|
|
449
557
|
referrer: PublicKey;
|
|
450
558
|
};
|
|
559
|
+
/** Emitted on every deposit, withdraw, or internal transfer that moves tokens into/out of a spot market. */
|
|
451
560
|
export type DepositRecord = {
|
|
452
561
|
ts: BN;
|
|
453
562
|
userAuthority: PublicKey;
|
|
@@ -457,64 +566,104 @@ export type DepositRecord = {
|
|
|
457
566
|
withdraw?: any;
|
|
458
567
|
};
|
|
459
568
|
marketIndex: number;
|
|
569
|
+
/** amount moved, in the spot market's token-mint precision (`SpotMarketConfig.precision`) */
|
|
460
570
|
amount: BN;
|
|
571
|
+
/** PRICE_PRECISION (1e6) */
|
|
461
572
|
oraclePrice: BN;
|
|
573
|
+
/** market's total deposit balance after this action, SPOT_BALANCE_PRECISION (1e9) scaled balance */
|
|
462
574
|
marketDepositBalance: BN;
|
|
575
|
+
/** market's total borrow balance after this action, SPOT_BALANCE_PRECISION (1e9) scaled balance */
|
|
463
576
|
marketWithdrawBalance: BN;
|
|
577
|
+
/** SPOT_CUMULATIVE_INTEREST_PRECISION (1e10) */
|
|
464
578
|
marketCumulativeDepositInterest: BN;
|
|
579
|
+
/** SPOT_CUMULATIVE_INTEREST_PRECISION (1e10) */
|
|
465
580
|
marketCumulativeBorrowInterest: BN;
|
|
581
|
+
/** user's lifetime deposits after this action, QUOTE_PRECISION (1e6) */
|
|
466
582
|
totalDepositsAfter: BN;
|
|
583
|
+
/** user's lifetime withdraws after this action, QUOTE_PRECISION (1e6) */
|
|
467
584
|
totalWithdrawsAfter: BN;
|
|
468
585
|
depositRecordId: BN;
|
|
469
586
|
explanation: DepositExplanation;
|
|
587
|
+
/** set when this was a `transferDeposit`: the counterparty user account */
|
|
470
588
|
transferUser?: PublicKey;
|
|
589
|
+
/** the signer that authorized the action, when different from the user's own authority (e.g. a delegate or keeper) */
|
|
471
590
|
signer?: PublicKey;
|
|
591
|
+
/** the user's token amount (deposit/borrow value) after this action, spot market token-mint precision */
|
|
472
592
|
userTokenAmountAfter: BN;
|
|
473
593
|
};
|
|
594
|
+
/** Emitted whenever a spot market's cumulative deposit/borrow interest is updated. */
|
|
474
595
|
export type SpotInterestRecord = {
|
|
475
596
|
ts: BN;
|
|
476
597
|
marketIndex: number;
|
|
598
|
+
/** SPOT_BALANCE_PRECISION (1e9) */
|
|
477
599
|
depositBalance: BN;
|
|
600
|
+
/** SPOT_CUMULATIVE_INTEREST_PRECISION (1e10) */
|
|
478
601
|
cumulativeDepositInterest: BN;
|
|
602
|
+
/** SPOT_BALANCE_PRECISION (1e9) */
|
|
479
603
|
borrowBalance: BN;
|
|
604
|
+
/** SPOT_CUMULATIVE_INTEREST_PRECISION (1e10) */
|
|
480
605
|
cumulativeBorrowInterest: BN;
|
|
606
|
+
/** SPOT_UTILIZATION_PRECISION (1e6) */
|
|
481
607
|
optimalUtilization: number;
|
|
608
|
+
/** SPOT_RATE_PRECISION (1e6) */
|
|
482
609
|
optimalBorrowRate: number;
|
|
610
|
+
/** SPOT_RATE_PRECISION (1e6) */
|
|
483
611
|
maxBorrowRate: number;
|
|
484
612
|
};
|
|
613
|
+
/** Emitted when a perp market's AMM curve is adjusted (repeg or `k` update). */
|
|
485
614
|
export type AmmCurveChanged = {
|
|
486
615
|
ts: BN;
|
|
487
616
|
marketIndex: number;
|
|
617
|
+
/** PEG_PRECISION (1e6) */
|
|
488
618
|
pegMultiplierBefore: BN;
|
|
619
|
+
/** AMM_RESERVE_PRECISION (1e9) */
|
|
489
620
|
baseAssetReserveBefore: BN;
|
|
621
|
+
/** AMM_RESERVE_PRECISION (1e9) */
|
|
490
622
|
quoteAssetReserveBefore: BN;
|
|
623
|
+
/** AMM_RESERVE_PRECISION (1e9) */
|
|
491
624
|
sqrtKBefore: BN;
|
|
625
|
+
/** PEG_PRECISION (1e6) */
|
|
492
626
|
pegMultiplierAfter: BN;
|
|
627
|
+
/** AMM_RESERVE_PRECISION (1e9) */
|
|
493
628
|
baseAssetReserveAfter: BN;
|
|
629
|
+
/** AMM_RESERVE_PRECISION (1e9) */
|
|
494
630
|
quoteAssetReserveAfter: BN;
|
|
631
|
+
/** AMM_RESERVE_PRECISION (1e9) */
|
|
495
632
|
sqrtKAfter: BN;
|
|
633
|
+
/** signed cost of the curve adjustment, QUOTE_PRECISION (1e6) */
|
|
496
634
|
adjustmentCost: BN;
|
|
635
|
+
/** QUOTE_PRECISION (1e6) */
|
|
497
636
|
totalFeeMinusDistributionsAfter: BN;
|
|
637
|
+
/** PRICE_PRECISION (1e6) */
|
|
498
638
|
oraclePrice: BN;
|
|
499
639
|
};
|
|
640
|
+
/** Emitted on insurance-fund vault operations (init/add/request-remove/remove) for a spot market's IF, keyed by the perp market that triggered it when settling a deficit. */
|
|
500
641
|
export declare type InsuranceFundRecord = {
|
|
501
642
|
ts: BN;
|
|
502
643
|
spotMarketIndex: number;
|
|
503
644
|
perpMarketIndex: number;
|
|
645
|
+
/** IF_FACTOR_PRECISION (1e6) share of this action attributed to the user */
|
|
504
646
|
userIfFactor: number;
|
|
647
|
+
/** IF_FACTOR_PRECISION (1e6) total IF factor at the time of the action */
|
|
505
648
|
totalIfFactor: number;
|
|
649
|
+
/** spot market vault token balance before the action, spot market token-mint precision */
|
|
506
650
|
vaultAmountBefore: BN;
|
|
651
|
+
/** insurance-fund vault token balance before the action, spot market token-mint precision */
|
|
507
652
|
insuranceVaultAmountBefore: BN;
|
|
508
653
|
totalIfSharesBefore: BN;
|
|
509
654
|
totalIfSharesAfter: BN;
|
|
655
|
+
/** amount moved, spot market token-mint precision */
|
|
510
656
|
amount: BN;
|
|
511
657
|
};
|
|
658
|
+
/** Emitted on every `InsuranceFundStake` account mutation (stake, unstake request/cancel, unstake, transfer). */
|
|
512
659
|
export declare type InsuranceFundStakeRecord = {
|
|
513
660
|
ts: BN;
|
|
514
661
|
userAuthority: PublicKey;
|
|
515
662
|
action: StakeAction;
|
|
663
|
+
/** amount staked/unstaked, spot market token-mint precision */
|
|
516
664
|
amount: BN;
|
|
517
665
|
marketIndex: number;
|
|
666
|
+
/** insurance-fund vault token balance before the action, spot market token-mint precision */
|
|
518
667
|
insuranceVaultAmountBefore: BN;
|
|
519
668
|
ifSharesBefore: BN;
|
|
520
669
|
userIfSharesBefore: BN;
|
|
@@ -523,39 +672,59 @@ export declare type InsuranceFundStakeRecord = {
|
|
|
523
672
|
userIfSharesAfter: BN;
|
|
524
673
|
totalIfSharesAfter: BN;
|
|
525
674
|
};
|
|
675
|
+
/** Emitted every time a perp market's funding rate is updated. */
|
|
526
676
|
export type FundingRateRecord = {
|
|
527
677
|
ts: BN;
|
|
528
678
|
recordId: BN;
|
|
529
679
|
marketIndex: number;
|
|
680
|
+
/** unit is quote per base, FUNDING_RATE_PRECISION (1e9) */
|
|
530
681
|
fundingRate: BN;
|
|
682
|
+
/** FUNDING_RATE_PRECISION (1e9) */
|
|
531
683
|
fundingRateLong: BN;
|
|
684
|
+
/** FUNDING_RATE_PRECISION (1e9) */
|
|
532
685
|
fundingRateShort: BN;
|
|
686
|
+
/** FUNDING_RATE_PRECISION (1e9) */
|
|
533
687
|
cumulativeFundingRateLong: BN;
|
|
688
|
+
/** FUNDING_RATE_PRECISION (1e9) */
|
|
534
689
|
cumulativeFundingRateShort: BN;
|
|
690
|
+
/** PRICE_PRECISION (1e6) */
|
|
535
691
|
oraclePriceTwap: BN;
|
|
692
|
+
/** PRICE_PRECISION (1e6) */
|
|
536
693
|
markPriceTwap: BN;
|
|
694
|
+
/** BASE_PRECISION (1e9) */
|
|
537
695
|
baseAssetAmountWithAmm: BN;
|
|
538
696
|
};
|
|
697
|
+
/** Emitted whenever a user's perp position settles a funding payment. */
|
|
539
698
|
export type FundingPaymentRecord = {
|
|
540
699
|
ts: BN;
|
|
541
700
|
userAuthority: PublicKey;
|
|
542
701
|
user: PublicKey;
|
|
543
702
|
marketIndex: number;
|
|
703
|
+
/** signed, positive = user received funding; QUOTE_PRECISION (1e6) */
|
|
544
704
|
fundingPayment: BN;
|
|
705
|
+
/** the position size the payment was calculated against, BASE_PRECISION (1e9) */
|
|
545
706
|
baseAssetAmount: BN;
|
|
707
|
+
/** the user's cumulative funding rate prior to this payment, FUNDING_RATE_PRECISION (1e9) */
|
|
546
708
|
userLastCumulativeFunding: BN;
|
|
709
|
+
/** FUNDING_RATE_PRECISION (1e9) */
|
|
547
710
|
ammCumulativeFundingLong: BN;
|
|
711
|
+
/** FUNDING_RATE_PRECISION (1e9) */
|
|
548
712
|
ammCumulativeFundingShort: BN;
|
|
549
713
|
};
|
|
714
|
+
/** Emitted for every liquidation action. Exactly one of `liquidatePerp`/`liquidateSpot`/`liquidateBorrowForPerpPnl`/`liquidatePerpPnlForDeposit`/`perpBankruptcy`/`spotBankruptcy` is populated, selected by `liquidationType`; the others are left as zeroed defaults. */
|
|
550
715
|
export type LiquidationRecord = {
|
|
551
716
|
ts: BN;
|
|
552
717
|
user: PublicKey;
|
|
553
718
|
liquidator: PublicKey;
|
|
554
719
|
liquidationType: LiquidationType;
|
|
720
|
+
/** QUOTE_PRECISION (1e6) */
|
|
555
721
|
marginRequirement: BN;
|
|
722
|
+
/** signed, QUOTE_PRECISION (1e6) */
|
|
556
723
|
totalCollateral: BN;
|
|
724
|
+
/** cumulative margin freed by this liquidation so far, QUOTE_PRECISION (1e6) */
|
|
557
725
|
marginFreed: BN;
|
|
558
726
|
liquidationId: number;
|
|
727
|
+
/** true if the user was bankrupt (their loss exceeded their collateral) as of this action */
|
|
559
728
|
bankrupt: boolean;
|
|
560
729
|
canceledOrderIds: number[];
|
|
561
730
|
liquidatePerp: LiquidatePerpRecord;
|
|
@@ -564,8 +733,10 @@ export type LiquidationRecord = {
|
|
|
564
733
|
liquidatePerpPnlForDeposit: LiquidatePerpPnlForDepositRecord;
|
|
565
734
|
perpBankruptcy: PerpBankruptcyRecord;
|
|
566
735
|
spotBankruptcy: SpotBankruptcyRecord;
|
|
736
|
+
/** bitmask, see `LiquidationBitFlag` */
|
|
567
737
|
bitFlags: number;
|
|
568
738
|
};
|
|
739
|
+
/** Which liquidation path a `LiquidationRecord` describes; selects which of the record's sub-record fields is populated. */
|
|
569
740
|
export declare class LiquidationType {
|
|
570
741
|
static readonly LIQUIDATE_PERP: {
|
|
571
742
|
liquidatePerp: {};
|
|
@@ -586,86 +757,131 @@ export declare class LiquidationType {
|
|
|
586
757
|
liquidateSpot: {};
|
|
587
758
|
};
|
|
588
759
|
}
|
|
760
|
+
/** Populated on `LiquidationRecord` when `liquidationType` is `LIQUIDATE_PERP`: a perp position was force-closed. */
|
|
589
761
|
export type LiquidatePerpRecord = {
|
|
590
762
|
marketIndex: number;
|
|
763
|
+
/** PRICE_PRECISION (1e6) */
|
|
591
764
|
oraclePrice: BN;
|
|
765
|
+
/** signed size transferred to the liquidator, BASE_PRECISION (1e9) */
|
|
592
766
|
baseAssetAmount: BN;
|
|
767
|
+
/** QUOTE_PRECISION (1e6) */
|
|
593
768
|
quoteAssetAmount: BN;
|
|
594
769
|
userOrderId: number;
|
|
595
770
|
liquidatorOrderId: number;
|
|
596
771
|
fillRecordId: BN;
|
|
772
|
+
/** paid to the liquidator, LIQUIDATOR_FEE_PRECISION (1e6)-denominated rate applied to `quoteAssetAmount`; QUOTE_PRECISION (1e6) amount */
|
|
597
773
|
liquidatorFee: BN;
|
|
774
|
+
/** cut routed to the insurance fund, QUOTE_PRECISION (1e6) */
|
|
598
775
|
ifFee: BN;
|
|
776
|
+
/** cut routed to the protocol fee pool, QUOTE_PRECISION (1e6) */
|
|
599
777
|
protocolFee: BN;
|
|
600
778
|
};
|
|
779
|
+
/** Populated on `LiquidationRecord` when `liquidationType` is `LIQUIDATE_SPOT`: a spot borrow was liquidated against a spot asset deposit. */
|
|
601
780
|
export type LiquidateSpotRecord = {
|
|
602
781
|
assetMarketIndex: number;
|
|
782
|
+
/** PRICE_PRECISION (1e6) */
|
|
603
783
|
assetPrice: BN;
|
|
784
|
+
/** asset market token-mint precision */
|
|
604
785
|
assetTransfer: BN;
|
|
605
786
|
liabilityMarketIndex: number;
|
|
787
|
+
/** PRICE_PRECISION (1e6) */
|
|
606
788
|
liabilityPrice: BN;
|
|
789
|
+
/** liability market token-mint precision */
|
|
607
790
|
liabilityTransfer: BN;
|
|
791
|
+
/** liability market token-mint precision */
|
|
608
792
|
ifFee: BN;
|
|
793
|
+
/** liability market token-mint precision */
|
|
609
794
|
protocolFee: BN;
|
|
610
795
|
};
|
|
796
|
+
/** Populated on `LiquidationRecord` when `liquidationType` is `LIQUIDATE_BORROW_FOR_PERP_PNL`: a user's negative perp PnL was covered by seizing one of their spot borrows/deposits. */
|
|
611
797
|
export type LiquidateBorrowForPerpPnlRecord = {
|
|
612
798
|
perpMarketIndex: number;
|
|
799
|
+
/** PRICE_PRECISION (1e6) */
|
|
613
800
|
marketOraclePrice: BN;
|
|
801
|
+
/** QUOTE_PRECISION (1e6) */
|
|
614
802
|
pnlTransfer: BN;
|
|
615
803
|
liabilityMarketIndex: number;
|
|
804
|
+
/** PRICE_PRECISION (1e6) */
|
|
616
805
|
liabilityPrice: BN;
|
|
806
|
+
/** liability market token-mint precision */
|
|
617
807
|
liabilityTransfer: BN;
|
|
618
808
|
};
|
|
809
|
+
/** Populated on `LiquidationRecord` when `liquidationType` is `LIQUIDATE_PERP_PNL_FOR_DEPOSIT`: a user's positive perp PnL was seized to cover a deficit, paid out from one of their spot deposits. */
|
|
619
810
|
export type LiquidatePerpPnlForDepositRecord = {
|
|
620
811
|
perpMarketIndex: number;
|
|
812
|
+
/** PRICE_PRECISION (1e6) */
|
|
621
813
|
marketOraclePrice: BN;
|
|
814
|
+
/** QUOTE_PRECISION (1e6) */
|
|
622
815
|
pnlTransfer: BN;
|
|
623
816
|
assetMarketIndex: number;
|
|
817
|
+
/** PRICE_PRECISION (1e6) */
|
|
624
818
|
assetPrice: BN;
|
|
819
|
+
/** asset market token-mint precision */
|
|
625
820
|
assetTransfer: BN;
|
|
626
821
|
};
|
|
822
|
+
/** Populated on `LiquidationRecord` when `liquidationType` is `PERP_BANKRUPTCY`: a user's unpaid perp loss was resolved via insurance-fund payout and/or socialized loss (`clawbackUser`/`clawbackUserPayment` set only when a clawback source exists). */
|
|
627
823
|
export type PerpBankruptcyRecord = {
|
|
628
824
|
marketIndex: number;
|
|
825
|
+
/** the bankrupt (unresolved negative) pnl, signed, QUOTE_PRECISION (1e6) */
|
|
629
826
|
pnl: BN;
|
|
827
|
+
/** amount paid from the insurance fund, QUOTE_PRECISION (1e6) */
|
|
630
828
|
ifPayment: BN;
|
|
631
829
|
clawbackUser: PublicKey | null;
|
|
830
|
+
/** QUOTE_PRECISION (1e6), set only when `clawbackUser` is set */
|
|
632
831
|
clawbackUserPayment: BN | null;
|
|
832
|
+
/** FUNDING_RATE_PRECISION (1e9) */
|
|
633
833
|
cumulativeFundingRateDelta: BN;
|
|
634
834
|
};
|
|
835
|
+
/** Populated on `LiquidationRecord` when `liquidationType` is `SPOT_BANKRUPTCY`: a user's unpaid spot borrow was resolved via insurance-fund payout and socialized loss. */
|
|
635
836
|
export type SpotBankruptcyRecord = {
|
|
636
837
|
marketIndex: number;
|
|
838
|
+
/** spot market token-mint precision */
|
|
637
839
|
borrowAmount: BN;
|
|
840
|
+
/** SPOT_CUMULATIVE_INTEREST_PRECISION (1e10) */
|
|
638
841
|
cumulativeDepositInterestDelta: BN;
|
|
842
|
+
/** amount paid from the insurance fund, spot market token-mint precision */
|
|
639
843
|
ifPayment: BN;
|
|
640
844
|
};
|
|
845
|
+
/** Bitmask mirror of `LiquidationRecord.bitFlags`. `IsolatedPosition` marks that the liquidation acted on an isolated-margin position rather than the user's cross-margin account. */
|
|
641
846
|
export declare class LiquidationBitFlag {
|
|
642
847
|
static readonly IsolatedPosition = 1;
|
|
643
848
|
}
|
|
849
|
+
/** Emitted every time a user's perp PnL is settled against the market's pnl pool. */
|
|
644
850
|
export type SettlePnlRecord = {
|
|
645
851
|
ts: BN;
|
|
646
852
|
user: PublicKey;
|
|
647
853
|
marketIndex: number;
|
|
854
|
+
/** signed amount settled, QUOTE_PRECISION (1e6) */
|
|
648
855
|
pnl: BN;
|
|
856
|
+
/** the position size at settlement time, BASE_PRECISION (1e9) */
|
|
649
857
|
baseAssetAmount: BN;
|
|
858
|
+
/** `PerpPosition.quoteAssetAmount` after settlement, QUOTE_PRECISION (1e6) */
|
|
650
859
|
quoteAssetAmountAfter: BN;
|
|
860
|
+
/** `PerpPosition.quoteEntryAmount` at settlement time, QUOTE_PRECISION (1e6) */
|
|
651
861
|
quoteEntryAmount: BN;
|
|
862
|
+
/** the price pnl was settled at, PRICE_PRECISION (1e6) */
|
|
652
863
|
settlePrice: BN;
|
|
653
864
|
explanation: SettlePnlExplanation;
|
|
654
865
|
};
|
|
866
|
+
/** Emitted when a signed off-chain (swift) order message is matched/recorded on-chain, so indexers can associate the signed message with its resulting order. */
|
|
655
867
|
export type SignedMsgOrderRecord = {
|
|
656
868
|
ts: BN;
|
|
657
869
|
user: PublicKey;
|
|
870
|
+
/** hash of the signed message, used to dedupe/look up the original signed order */
|
|
658
871
|
hash: string;
|
|
659
872
|
matchingOrderParams: OrderParams;
|
|
873
|
+
/** slot after which the signed message is no longer eligible to be placed */
|
|
660
874
|
signedMsgOrderMaxSlot: BN;
|
|
661
875
|
signedMsgOrderUuid: Uint8Array;
|
|
662
876
|
userOrderId: number;
|
|
663
877
|
};
|
|
878
|
+
/** Emitted whenever an `Order` slot is written (placed, updated on fill, canceled, expired, triggered) — a full snapshot of the order's post-action state. */
|
|
664
879
|
export type OrderRecord = {
|
|
665
880
|
ts: BN;
|
|
666
881
|
user: PublicKey;
|
|
667
882
|
order: Order;
|
|
668
883
|
};
|
|
884
|
+
/** Emitted for every order lifecycle action (place/fill/cancel/expire/trigger). Taker/maker fields are `null` when not applicable to the action (e.g. AMM fills have no `maker`). */
|
|
669
885
|
export type OrderActionRecord = {
|
|
670
886
|
ts: BN;
|
|
671
887
|
action: OrderAction;
|
|
@@ -673,109 +889,170 @@ export type OrderActionRecord = {
|
|
|
673
889
|
marketIndex: number;
|
|
674
890
|
marketType: MarketType;
|
|
675
891
|
filler: PublicKey | null;
|
|
892
|
+
/** paid to the filler/keeper, QUOTE_PRECISION (1e6) */
|
|
676
893
|
fillerReward: BN | null;
|
|
677
894
|
fillRecordId: BN | null;
|
|
895
|
+
/** perp: BASE_PRECISION (1e9); spot: market token-mint precision */
|
|
678
896
|
baseAssetAmountFilled: BN | null;
|
|
897
|
+
/** QUOTE_PRECISION (1e6) */
|
|
679
898
|
quoteAssetAmountFilled: BN | null;
|
|
899
|
+
/** QUOTE_PRECISION (1e6) */
|
|
680
900
|
takerFee: BN | null;
|
|
901
|
+
/** rebate paid to the maker (can be negative if the maker pays a fee), QUOTE_PRECISION (1e6) */
|
|
681
902
|
makerFee: BN | null;
|
|
903
|
+
/** BPS_PRECISION-style share of the taker fee credited to the referrer */
|
|
682
904
|
referrerReward: number | null;
|
|
905
|
+
/** taker's price improvement vs. their limit/oracle price, QUOTE_PRECISION (1e6) */
|
|
683
906
|
quoteAssetAmountSurplus: BN | null;
|
|
907
|
+
/** fee charged by the spot fulfillment method (e.g. an external DEX), spot market token-mint precision */
|
|
684
908
|
spotFulfillmentMethodFee: BN | null;
|
|
685
909
|
taker: PublicKey | null;
|
|
686
910
|
takerOrderId: number | null;
|
|
687
911
|
takerOrderDirection: PositionDirection | null;
|
|
912
|
+
/** perp: BASE_PRECISION (1e9); spot: market token-mint precision */
|
|
688
913
|
takerOrderBaseAssetAmount: BN | null;
|
|
914
|
+
/** perp: BASE_PRECISION (1e9); spot: market token-mint precision */
|
|
689
915
|
takerOrderCumulativeBaseAssetAmountFilled: BN | null;
|
|
916
|
+
/** QUOTE_PRECISION (1e6) */
|
|
690
917
|
takerOrderCumulativeQuoteAssetAmountFilled: BN | null;
|
|
691
918
|
maker: PublicKey | null;
|
|
692
919
|
makerOrderId: number | null;
|
|
693
920
|
makerOrderDirection: PositionDirection | null;
|
|
921
|
+
/** perp: BASE_PRECISION (1e9); spot: market token-mint precision */
|
|
694
922
|
makerOrderBaseAssetAmount: BN | null;
|
|
923
|
+
/** perp: BASE_PRECISION (1e9); spot: market token-mint precision */
|
|
695
924
|
makerOrderCumulativeBaseAssetAmountFilled: BN | null;
|
|
925
|
+
/** QUOTE_PRECISION (1e6) */
|
|
696
926
|
makerOrderCumulativeQuoteAssetAmountFilled: BN | null;
|
|
927
|
+
/** PRICE_PRECISION (1e6) */
|
|
697
928
|
oraclePrice: BN;
|
|
929
|
+
/** bitmask, currently records isolated-margin/builder-fee flags mirrored from `OrderBitFlag` */
|
|
698
930
|
bitFlags: number;
|
|
931
|
+
/** taker's `PerpPosition.quoteEntryAmount` immediately before this fill, QUOTE_PRECISION (1e6) */
|
|
699
932
|
takerExistingQuoteEntryAmount: BN | null;
|
|
933
|
+
/** taker's `PerpPosition.baseAssetAmount` immediately before this fill, BASE_PRECISION (1e9) */
|
|
700
934
|
takerExistingBaseAssetAmount: BN | null;
|
|
935
|
+
/** maker's `PerpPosition.quoteEntryAmount` immediately before this fill, QUOTE_PRECISION (1e6) */
|
|
701
936
|
makerExistingQuoteEntryAmount: BN | null;
|
|
937
|
+
/** maker's `PerpPosition.baseAssetAmount` immediately before this fill, BASE_PRECISION (1e9) */
|
|
702
938
|
makerExistingBaseAssetAmount: BN | null;
|
|
939
|
+
/** PRICE_PRECISION (1e6), set only for trigger-order fills */
|
|
703
940
|
triggerPrice: BN | null;
|
|
941
|
+
/** index into the taker's `RevenueShareEscrow.approvedBuilders`, set only when the taker order had `OrderBitFlag.HasBuilder` */
|
|
704
942
|
builderIdx: number | null;
|
|
943
|
+
/** builder fee charged on this fill, QUOTE_PRECISION (1e6) */
|
|
705
944
|
builderFee: BN | null;
|
|
706
945
|
};
|
|
946
|
+
/** Emitted on every constant-product spot swap (`beginSwap`/`endSwap`) between two spot markets. */
|
|
707
947
|
export type SwapRecord = {
|
|
708
948
|
ts: BN;
|
|
709
949
|
user: PublicKey;
|
|
950
|
+
/** out market token-mint precision */
|
|
710
951
|
amountOut: BN;
|
|
952
|
+
/** in market token-mint precision */
|
|
711
953
|
amountIn: BN;
|
|
712
954
|
outMarketIndex: number;
|
|
713
955
|
inMarketIndex: number;
|
|
956
|
+
/** PRICE_PRECISION (1e6) */
|
|
714
957
|
outOraclePrice: BN;
|
|
958
|
+
/** PRICE_PRECISION (1e6) */
|
|
715
959
|
inOraclePrice: BN;
|
|
960
|
+
/** total fee charged on the swap, out market token-mint precision */
|
|
716
961
|
fee: BN;
|
|
717
962
|
};
|
|
963
|
+
/** Emitted when a spot market's vault balance is reconciled against `SpotMarketAccount.depositBalance`/`borrowBalance` (drift/donation detection). */
|
|
718
964
|
export type SpotMarketVaultDepositRecord = {
|
|
719
965
|
ts: BN;
|
|
720
966
|
marketIndex: number;
|
|
967
|
+
/** SPOT_BALANCE_PRECISION (1e9) */
|
|
721
968
|
depositBalance: BN;
|
|
969
|
+
/** SPOT_CUMULATIVE_INTEREST_PRECISION (1e10) */
|
|
722
970
|
cumulativeDepositInterestBefore: BN;
|
|
971
|
+
/** SPOT_CUMULATIVE_INTEREST_PRECISION (1e10) */
|
|
723
972
|
cumulativeDepositInterestAfter: BN;
|
|
973
|
+
/** spot market token-mint precision */
|
|
724
974
|
depositTokenAmountBefore: BN;
|
|
975
|
+
/** spot market token-mint precision */
|
|
725
976
|
amount: BN;
|
|
726
977
|
};
|
|
978
|
+
/** Emitted when a `UserAccount` sub-account is deleted. */
|
|
727
979
|
export type DeleteUserRecord = {
|
|
728
980
|
ts: BN;
|
|
729
981
|
userAuthority: PublicKey;
|
|
730
982
|
user: PublicKey;
|
|
731
983
|
subAccountId: number;
|
|
984
|
+
/** set when a keeper (not the user/delegate) deleted an idle account */
|
|
732
985
|
keeper: PublicKey | null;
|
|
733
986
|
};
|
|
987
|
+
/** Emitted on every constituent-to-constituent swap inside an LP pool (`LPPoolAccount`). */
|
|
734
988
|
export type LPSwapRecord = {
|
|
735
989
|
ts: BN;
|
|
736
990
|
slot: BN;
|
|
737
991
|
authority: PublicKey;
|
|
992
|
+
/** out constituent's spot market token-mint precision */
|
|
738
993
|
outAmount: BN;
|
|
994
|
+
/** in constituent's spot market token-mint precision */
|
|
739
995
|
inAmount: BN;
|
|
996
|
+
/** out constituent's spot market token-mint precision */
|
|
740
997
|
outFee: BN;
|
|
998
|
+
/** in constituent's spot market token-mint precision */
|
|
741
999
|
inFee: BN;
|
|
742
1000
|
outSpotMarketIndex: number;
|
|
743
1001
|
inSpotMarketIndex: number;
|
|
744
1002
|
outConstituentIndex: number;
|
|
745
1003
|
inConstituentIndex: number;
|
|
1004
|
+
/** PRICE_PRECISION (1e6) */
|
|
746
1005
|
outOraclePrice: BN;
|
|
1006
|
+
/** PRICE_PRECISION (1e6) */
|
|
747
1007
|
inOraclePrice: BN;
|
|
1008
|
+
/** LP pool AUM at the time of the swap, QUOTE_PRECISION (1e6) */
|
|
748
1009
|
lastAum: BN;
|
|
749
1010
|
lastAumSlot: BN;
|
|
1011
|
+
/** PERCENTAGE_PRECISION (1e6) */
|
|
750
1012
|
inMarketCurrentWeight: BN;
|
|
1013
|
+
/** PERCENTAGE_PRECISION (1e6) */
|
|
751
1014
|
outMarketCurrentWeight: BN;
|
|
1015
|
+
/** PERCENTAGE_PRECISION (1e6) */
|
|
752
1016
|
inMarketTargetWeight: BN;
|
|
1017
|
+
/** PERCENTAGE_PRECISION (1e6) */
|
|
753
1018
|
outMarketTargetWeight: BN;
|
|
754
1019
|
inSwapId: BN;
|
|
755
1020
|
outSwapId: BN;
|
|
756
1021
|
lpPool: PublicKey;
|
|
757
1022
|
};
|
|
1023
|
+
/** Emitted when LP tokens are minted (deposit) or redeemed (withdraw) against an LP pool. */
|
|
758
1024
|
export type LPMintRedeemRecord = {
|
|
759
1025
|
ts: BN;
|
|
760
1026
|
slot: BN;
|
|
761
1027
|
authority: PublicKey;
|
|
1028
|
+
/** encodes mint vs. redeem (and any sub-variant); compare against the program's `MintRedeemDescription` discriminant */
|
|
762
1029
|
description: number;
|
|
1030
|
+
/** constituent spot market token-mint precision */
|
|
763
1031
|
amount: BN;
|
|
1032
|
+
/** constituent spot market token-mint precision */
|
|
764
1033
|
fee: BN;
|
|
765
1034
|
spotMarketIndex: number;
|
|
766
1035
|
constituentIndex: number;
|
|
1036
|
+
/** PRICE_PRECISION (1e6) */
|
|
767
1037
|
oraclePrice: BN;
|
|
768
1038
|
mint: PublicKey;
|
|
1039
|
+
/** LP token precision (quote-mint precision, QUOTE_PRECISION 1e6) */
|
|
769
1040
|
lpAmount: BN;
|
|
1041
|
+
/** LP token precision */
|
|
770
1042
|
lpFee: BN;
|
|
1043
|
+
/** LP token price, PRICE_PRECISION (1e6) */
|
|
771
1044
|
lpPrice: BN;
|
|
772
1045
|
mintRedeemId: BN;
|
|
1046
|
+
/** LP pool AUM at the time of the action, QUOTE_PRECISION (1e6) */
|
|
773
1047
|
lastAum: BN;
|
|
774
1048
|
lastAumSlot: BN;
|
|
1049
|
+
/** PERCENTAGE_PRECISION (1e6) */
|
|
775
1050
|
inMarketCurrentWeight: BN;
|
|
1051
|
+
/** PERCENTAGE_PRECISION (1e6) */
|
|
776
1052
|
inMarketTargetWeight: BN;
|
|
777
1053
|
lpPool: PublicKey;
|
|
778
1054
|
};
|
|
1055
|
+
/** Emitted when a perp market settles PnL/fees with its hedging LP pool. */
|
|
779
1056
|
export type LPSettleRecord = {
|
|
780
1057
|
recordId: BN;
|
|
781
1058
|
lastTs: BN;
|
|
@@ -783,25 +1060,53 @@ export type LPSettleRecord = {
|
|
|
783
1060
|
ts: BN;
|
|
784
1061
|
slot: BN;
|
|
785
1062
|
perpMarketIndex: number;
|
|
1063
|
+
/** signed amount transferred to/from the LP pool, QUOTE_PRECISION (1e6) */
|
|
786
1064
|
settleToLpAmount: BN;
|
|
1065
|
+
/** signed, QUOTE_PRECISION (1e6) */
|
|
787
1066
|
perpAmmPnlDelta: BN;
|
|
1067
|
+
/** signed, QUOTE_PRECISION (1e6) */
|
|
788
1068
|
perpAmmExFeeDelta: BN;
|
|
1069
|
+
/** LP pool AUM after this settle, QUOTE_PRECISION (1e6) */
|
|
789
1070
|
lpAum: BN;
|
|
1071
|
+
/** LP token price after this settle, PRICE_PRECISION (1e6) */
|
|
790
1072
|
lpPrice: BN;
|
|
791
1073
|
lpPool: PublicKey;
|
|
792
1074
|
};
|
|
1075
|
+
/** Emitted when an LP pool constituent's borrow/lend deposit into (or withdrawal from) the underlying spot market changes. */
|
|
793
1076
|
export type LPBorrowLendDepositRecord = {
|
|
794
1077
|
ts: BN;
|
|
795
1078
|
slot: BN;
|
|
796
1079
|
spotMarketIndex: number;
|
|
797
1080
|
constituentIndex: number;
|
|
798
1081
|
direction: DepositDirection;
|
|
1082
|
+
/** constituent spot market token-mint precision */
|
|
799
1083
|
tokenBalance: BN;
|
|
1084
|
+
/** constituent spot market token-mint precision */
|
|
800
1085
|
lastTokenBalance: BN;
|
|
1086
|
+
/** interest accrued since the last update, constituent spot market token-mint precision */
|
|
801
1087
|
interestAccruedTokenAmount: BN;
|
|
1088
|
+
/** constituent spot market token-mint precision */
|
|
802
1089
|
amountDepositWithdraw: BN;
|
|
803
1090
|
lpPool: PublicKey;
|
|
804
1091
|
};
|
|
1092
|
+
/**
|
|
1093
|
+
* The protocol's single global config account (one per deployment). Decoded mirror of the Rust
|
|
1094
|
+
* `State` zero-copy account.
|
|
1095
|
+
*
|
|
1096
|
+
* **Admin tiers** — three levels of authority, from slowest/most-trusted to fastest/least-trusted:
|
|
1097
|
+
* - `coldAdmin`: root authority, set once at `initialize`. Only key that can rotate `warmAdmin`
|
|
1098
|
+
* and `pauseAdmin`. Expected to sit behind a (small) timelocked multisig.
|
|
1099
|
+
* - `warmAdmin`: operational authority that can rotate the eleven `hot*` bot keys below.
|
|
1100
|
+
* `PublicKey.default()` means unset, in which case only `coldAdmin` can act.
|
|
1101
|
+
* - `pauseAdmin`: emergency-pause authority with no on-chain timelock — may only *add* pause bits
|
|
1102
|
+
* to `exchangeStatus` (never clear them); `coldAdmin`/`warmAdmin` retain full pause+unpause power.
|
|
1103
|
+
* `PublicKey.default()` means unassigned (only cold/warm can pause).
|
|
1104
|
+
*
|
|
1105
|
+
* **Hot role keys** (`hot*`): purpose-specific bot keys for high-frequency keeper actions (AMM
|
|
1106
|
+
* cranking, LP cache/swap/settle, feature-flag toggles, fuel, user-flag updates, vault deposits,
|
|
1107
|
+
* mm-oracle cranking, AMM spread adjustment, protocol-fee withdrawal). `PublicKey.default()` means
|
|
1108
|
+
* the role is unassigned and only `warmAdmin`/`coldAdmin` may call handlers gated on that role.
|
|
1109
|
+
*/
|
|
805
1110
|
export type StateAccount = {
|
|
806
1111
|
coldAdmin: PublicKey;
|
|
807
1112
|
warmAdmin: PublicKey;
|
|
@@ -816,9 +1121,13 @@ export type StateAccount = {
|
|
|
816
1121
|
hotVaultDeposit: PublicKey;
|
|
817
1122
|
hotMmOracleCrank: PublicKey;
|
|
818
1123
|
hotAmmSpreadAdjust: PublicKey;
|
|
1124
|
+
/** hot key authorized to trigger protocol-fee withdrawals to `protocolFeeRecipientPerp`/`protocolFeeRecipientSpot` */
|
|
819
1125
|
hotFeeWithdraw: PublicKey;
|
|
1126
|
+
/** treasury PERP protocol fees are withdrawn to (settable only by `coldAdmin`); `PublicKey.default()` makes perp fee withdrawals inert */
|
|
820
1127
|
protocolFeeRecipientPerp: PublicKey;
|
|
1128
|
+
/** treasury SPOT protocol fees are withdrawn to (settable only by `coldAdmin`); `PublicKey.default()` makes spot fee withdrawals inert */
|
|
821
1129
|
protocolFeeRecipientSpot: PublicKey;
|
|
1130
|
+
/** bitmask, see `ExchangeStatus` */
|
|
822
1131
|
exchangeStatus: number;
|
|
823
1132
|
whitelistMint: PublicKey;
|
|
824
1133
|
discountMint: PublicKey;
|
|
@@ -827,113 +1136,187 @@ export type StateAccount = {
|
|
|
827
1136
|
numberOfSubAccounts: BN;
|
|
828
1137
|
numberOfMarkets: number;
|
|
829
1138
|
numberOfSpotMarkets: number;
|
|
1139
|
+
/** slots */
|
|
830
1140
|
minPerpAuctionDuration: number;
|
|
1141
|
+
/** seconds */
|
|
831
1142
|
defaultMarketOrderTimeInForce: number;
|
|
1143
|
+
/** slots */
|
|
832
1144
|
defaultSpotAuctionDuration: number;
|
|
1145
|
+
/** MARGIN_PRECISION (1e4); extra maintenance-margin buffer required before a liquidation may proceed */
|
|
833
1146
|
liquidationMarginBufferRatio: number;
|
|
1147
|
+
/** seconds a market stays in `SETTLEMENT` status before positions must be settled */
|
|
834
1148
|
settlementDuration: number;
|
|
835
1149
|
maxNumberOfSubAccounts: number;
|
|
836
1150
|
signer: PublicKey;
|
|
837
1151
|
signerNonce: number;
|
|
838
1152
|
srmVault: PublicKey;
|
|
1153
|
+
/** default `FeeStructure` applied to new perp markets */
|
|
839
1154
|
perpFeeStructure: FeeStructure;
|
|
1155
|
+
/** default `FeeStructure` applied to new spot markets */
|
|
840
1156
|
spotFeeStructure: FeeStructure;
|
|
1157
|
+
/** LIQUIDATION_PCT_PRECISION (1e4); fraction of a position liquidated per partial-liquidation pass */
|
|
841
1158
|
initialPctToLiquidate: number;
|
|
1159
|
+
/** seconds a liquidation is spread over */
|
|
842
1160
|
liquidationDuration: number;
|
|
1161
|
+
/** max SOL fee `getInitUserFee` may charge to create a new sub-account, in value/100 SOL (e.g. 100 = 1 SOL); ramps from 0 to this max as account-space utilization rises from 80% to 100% of `maxNumberOfSubAccounts` */
|
|
843
1162
|
maxInitializeUserFee: number;
|
|
1163
|
+
/** bitmask, see `FeatureBitFlags` */
|
|
844
1164
|
featureBitFlags: number;
|
|
1165
|
+
/** bitmask of LP-pool-specific feature flags */
|
|
845
1166
|
lpPoolFeatureBitFlags: number;
|
|
1167
|
+
/** bitmask, see `SolvencyStatus` */
|
|
846
1168
|
solvencyStatus: number;
|
|
847
1169
|
};
|
|
1170
|
+
/** Decoded mirror of the on-chain `PerpMarket` zero-copy account. */
|
|
848
1171
|
export type PerpMarketAccount = {
|
|
849
1172
|
status: MarketStatus;
|
|
850
1173
|
contractType: ContractType;
|
|
851
1174
|
contractTier: ContractTier;
|
|
1175
|
+
/** unix timestamp the market will expire; only set if the market is reduce-only */
|
|
852
1176
|
expiryTs: BN;
|
|
1177
|
+
/** PRICE_PRECISION (1e6); the price positions settle at, only set once the market is expired */
|
|
853
1178
|
expiryPrice: BN;
|
|
854
1179
|
marketIndex: number;
|
|
855
1180
|
pubkey: PublicKey;
|
|
856
1181
|
name: number[];
|
|
1182
|
+
/** the market's constant-product vAMM state */
|
|
857
1183
|
amm: AMM;
|
|
1184
|
+
/** market-wide stats shared across all makers (mark/oracle TWAPs, volume, mm-oracle snapshot) */
|
|
858
1185
|
marketStats: MarketStats;
|
|
859
1186
|
numberOfUsersWithBase: number;
|
|
860
1187
|
numberOfUsers: number;
|
|
1188
|
+
/** MARGIN_PRECISION (1e4); collateral fraction required to open a position, e.g. 1000 = 10% = 10x max leverage */
|
|
861
1189
|
marginRatioInitial: number;
|
|
1190
|
+
/** MARGIN_PRECISION (1e4); collateral fraction below which a position is liquidated */
|
|
862
1191
|
marginRatioMaintenance: number;
|
|
863
1192
|
nextFillRecordId: BN;
|
|
864
1193
|
nextFundingRateRecordId: BN;
|
|
1194
|
+
/** the market's pnl pool: increases when users settle negative pnl, decreases when users settle positive pnl; SPOT_BALANCE_PRECISION (1e9) scaled balance in the quote spot market */
|
|
865
1195
|
pnlPool: PoolBalance;
|
|
1196
|
+
/** protocol-owned quote-denominated fee claim, withdrawn to `StateAccount.protocolFeeRecipientPerp`; SPOT_BALANCE_PRECISION (1e9) scaled balance */
|
|
866
1197
|
protocolFeePool: PoolBalance;
|
|
1198
|
+
/** consolidated fee-split accounting: lifetime analytics counters plus pending protocol/IF/AMM carveouts */
|
|
867
1199
|
feeLedger: FeeLedger;
|
|
1200
|
+
/** LIQUIDATOR_FEE_PRECISION (1e6); fee paid to the liquidator for taking over the position */
|
|
868
1201
|
liquidatorFee: number;
|
|
1202
|
+
/** LIQUIDATOR_FEE_PRECISION (1e6); cut of a liquidation routed to the insurance fund */
|
|
869
1203
|
ifLiquidationFee: number;
|
|
1204
|
+
/** LIQUIDATOR_FEE_PRECISION (1e6); protocol's cut of a liquidation, taken from the liquidatee */
|
|
870
1205
|
protocolLiquidationFee: number;
|
|
1206
|
+
/** QUOTE_PRECISION (1e6); pnl-pool retention buffer the fee-sweep leaves untouched above `max(net_user_pnl, 0)` */
|
|
871
1207
|
feePoolBufferTarget: BN;
|
|
1208
|
+
/** MARGIN_PRECISION (1e4); scales margin ratio up for large positions */
|
|
872
1209
|
imfFactor: number;
|
|
1210
|
+
/** MARGIN_PRECISION (1e4); discounts positive-unrealized-pnl asset weight for large positions */
|
|
873
1211
|
unrealizedPnlImfFactor: number;
|
|
1212
|
+
/** QUOTE_PRECISION (1e6); pnl imbalance (long pnl − short pnl) above which positive-pnl asset weight starts being discounted */
|
|
874
1213
|
unrealizedPnlMaxImbalance: BN;
|
|
1214
|
+
/** SPOT_WEIGHT_PRECISION (1e4); initial-margin asset weight applied to a user's unrealized positive pnl */
|
|
875
1215
|
unrealizedPnlInitialAssetWeight: number;
|
|
1216
|
+
/** SPOT_WEIGHT_PRECISION (1e4); maintenance-margin asset weight applied to a user's unrealized positive pnl */
|
|
876
1217
|
unrealizedPnlMaintenanceAssetWeight: number;
|
|
1218
|
+
/** the market's claim on the insurance fund */
|
|
877
1219
|
insuranceClaim: {
|
|
1220
|
+
/** QUOTE_PRECISION (1e6), signed: positive if funds left the market, negative if pulled in */
|
|
878
1221
|
revenueWithdrawSinceLastSettle: BN;
|
|
1222
|
+
/** QUOTE_PRECISION (1e6); cap on revenue withdrawable per settle period */
|
|
879
1223
|
maxRevenueWithdrawPerPeriod: BN;
|
|
880
1224
|
lastRevenueWithdrawTs: BN;
|
|
1225
|
+
/** QUOTE_PRECISION (1e6); insurance already used to resolve bankruptcy/pnl deficits */
|
|
881
1226
|
quoteSettledInsurance: BN;
|
|
1227
|
+
/** QUOTE_PRECISION (1e6); max insurance this market may draw to resolve bankruptcy/pnl deficits */
|
|
882
1228
|
quoteMaxInsurance: BN;
|
|
883
1229
|
};
|
|
884
1230
|
quoteSpotMarketIndex: number;
|
|
1231
|
+
/** -100 to 100; percentage adjustment applied to the base fee rate (e.g. -50 halves a 5bps fee to 2.5bps) */
|
|
885
1232
|
feeAdjustment: number;
|
|
1233
|
+
/** bitmask, see `PerpOperation` */
|
|
886
1234
|
pausedOperations: number;
|
|
1235
|
+
/** PRICE_PRECISION (1e6); price of the most recent fill */
|
|
887
1236
|
lastFillPrice: BN;
|
|
888
1237
|
poolId: number;
|
|
1238
|
+
/** this market's relationship to its hedging LP pool; admin-set, never mutated per fill */
|
|
889
1239
|
hedgeConfig: {
|
|
1240
|
+
/** the `LPPoolAccount.lpPoolId` this market hedges into */
|
|
890
1241
|
poolId: number;
|
|
1242
|
+
/** hedging enabled for this market when non-zero */
|
|
891
1243
|
status: number;
|
|
1244
|
+
/** bitmask of paused `ConstituentLpOperation`s */
|
|
892
1245
|
pausedOperations: number;
|
|
1246
|
+
/** scalar excluding a share of exchange fees from hedge routing */
|
|
893
1247
|
exchangeFeeExclusionScalar: number;
|
|
1248
|
+
/** scalar for the share of fees transferred to the hedge pool */
|
|
894
1249
|
feeTransferScalar: number;
|
|
895
1250
|
};
|
|
1251
|
+
/** bitmask, see `MarketConfigFlag` */
|
|
896
1252
|
marketConfig: number;
|
|
897
1253
|
oracle: PublicKey;
|
|
898
1254
|
oracleSource: OracleSource;
|
|
1255
|
+
/** override for the per-fill slot delay required from the oracle; -1 = use the state default */
|
|
899
1256
|
oracleSlotDelayOverride: number;
|
|
1257
|
+
/** override for `StateAccount.minPerpAuctionDuration`; 0 = no override, -1 = disable speed bump, 1-100 = literal speed bump slots */
|
|
900
1258
|
oracleLowRiskSlotDelayOverride: number;
|
|
1259
|
+
/** always non-negative; total long open interest across all users, BASE_PRECISION (1e9) */
|
|
901
1260
|
baseAssetAmountLong: BN;
|
|
1261
|
+
/** always non-positive; total short open interest across all users, BASE_PRECISION (1e9) */
|
|
902
1262
|
baseAssetAmountShort: BN;
|
|
1263
|
+
/** sum of all users' `PerpPosition.quoteAssetAmount` in this market, QUOTE_PRECISION (1e6) */
|
|
903
1264
|
quoteAssetAmount: BN;
|
|
1265
|
+
/** QUOTE_PRECISION (1e6) */
|
|
904
1266
|
quoteEntryAmountLong: BN;
|
|
1267
|
+
/** QUOTE_PRECISION (1e6) */
|
|
905
1268
|
quoteEntryAmountShort: BN;
|
|
1269
|
+
/** QUOTE_PRECISION (1e6) */
|
|
906
1270
|
quoteBreakEvenAmountLong: BN;
|
|
1271
|
+
/** QUOTE_PRECISION (1e6) */
|
|
907
1272
|
quoteBreakEvenAmountShort: BN;
|
|
1273
|
+
/** QUOTE_PRECISION (1e6); accumulated socialized loss paid by users in this market since inception */
|
|
908
1274
|
totalSocialLoss: BN;
|
|
1275
|
+
/** BASE_PRECISION (1e9); max allowed open interest — trades that would breach this are blocked */
|
|
909
1276
|
maxOpenInterest: BN;
|
|
1277
|
+
/** FUNDING_RATE_PRECISION (1e9) */
|
|
910
1278
|
cumulativeFundingRateLong: BN;
|
|
1279
|
+
/** FUNDING_RATE_PRECISION (1e9) */
|
|
911
1280
|
cumulativeFundingRateShort: BN;
|
|
1281
|
+
/** unit is quote per base, FUNDING_RATE_PRECISION (1e9) */
|
|
912
1282
|
lastFundingRate: BN;
|
|
1283
|
+
/** FUNDING_RATE_PRECISION (1e9) */
|
|
913
1284
|
lastFundingRateLong: BN;
|
|
1285
|
+
/** FUNDING_RATE_PRECISION (1e9) */
|
|
914
1286
|
lastFundingRateShort: BN;
|
|
915
1287
|
lastFundingRateTs: BN;
|
|
1288
|
+
/** unsettled funding pnl across the whole market */
|
|
916
1289
|
netUnsettledFundingPnl: BN;
|
|
1290
|
+
/** BPS_PRECISION (1e4); dead-zone threshold for the funding premium — mark/oracle spreads within this band add no funding premium */
|
|
917
1291
|
fundingClampThreshold: number;
|
|
1292
|
+
/** PERCENTAGE_PRECISION (1e6); slope of the funding premium ramp above the dead zone (1.0x = pass shrunk spread through unchanged) */
|
|
918
1293
|
fundingRampSlope: number;
|
|
1294
|
+
/** orders must be a multiple of this, BASE_PRECISION (1e9) */
|
|
919
1295
|
orderStepSize: BN;
|
|
1296
|
+
/** orders must be a multiple of this, PRICE_PRECISION (1e6) */
|
|
920
1297
|
orderTickSize: BN;
|
|
921
1298
|
};
|
|
1299
|
+
/** Oracle price/TWAP snapshot shared by `PerpMarketAccount.marketStats` and `SpotMarketAccount`. All price fields are PRICE_PRECISION (1e6). */
|
|
922
1300
|
export type HistoricalOracleData = {
|
|
923
1301
|
lastOraclePrice: BN;
|
|
1302
|
+
/** number of slots since the last oracle update */
|
|
924
1303
|
lastOracleDelay: BN;
|
|
925
1304
|
lastOracleConf: BN;
|
|
926
1305
|
lastOraclePriceTwap: BN;
|
|
927
1306
|
lastOraclePriceTwap5Min: BN;
|
|
1307
|
+
/** unix timestamp of the last TWAP snapshot */
|
|
928
1308
|
lastOraclePriceTwapTs: BN;
|
|
929
1309
|
};
|
|
1310
|
+
/** Rolling index-price stats for a spot market (bid/ask/TWAP of the underlying index, e.g. a basket or peg reference). All price fields are PRICE_PRECISION (1e6). */
|
|
930
1311
|
export type HistoricalIndexData = {
|
|
931
1312
|
lastIndexBidPrice: BN;
|
|
932
1313
|
lastIndexAskPrice: BN;
|
|
933
1314
|
lastIndexPriceTwap: BN;
|
|
934
1315
|
lastIndexPriceTwap5Min: BN;
|
|
1316
|
+
/** unix timestamp of the last TWAP snapshot */
|
|
935
1317
|
lastIndexPriceTwapTs: BN;
|
|
936
1318
|
};
|
|
1319
|
+
/** Decoded mirror of the on-chain `SpotMarket` zero-copy account. */
|
|
937
1320
|
export type SpotMarketAccount = {
|
|
938
1321
|
status: MarketStatus;
|
|
939
1322
|
assetTier: AssetTier;
|
|
@@ -941,225 +1324,386 @@ export type SpotMarketAccount = {
|
|
|
941
1324
|
marketIndex: number;
|
|
942
1325
|
pubkey: PublicKey;
|
|
943
1326
|
mint: PublicKey;
|
|
1327
|
+
/** the market's token vault; balance should be >= `depositBalance` token amount − `borrowBalance` token amount */
|
|
944
1328
|
vault: PublicKey;
|
|
945
1329
|
oracle: PublicKey;
|
|
946
1330
|
oracleSource: OracleSource;
|
|
947
1331
|
historicalOracleData: HistoricalOracleData;
|
|
948
1332
|
historicalIndexData: HistoricalIndexData;
|
|
1333
|
+
/** covers bankruptcies for borrows of this market's token and perps settling in this market's token */
|
|
949
1334
|
insuranceFund: {
|
|
950
1335
|
vault: PublicKey;
|
|
951
1336
|
totalShares: BN;
|
|
952
1337
|
userShares: BN;
|
|
1338
|
+
/** exponent used to rebase `totalShares`/`userShares` */
|
|
953
1339
|
sharesBase: BN;
|
|
1340
|
+
/** seconds a stake must wait after an unstake request before it can be withdrawn */
|
|
954
1341
|
unstakingPeriod: BN;
|
|
955
1342
|
lastRevenueSettleTs: BN;
|
|
1343
|
+
/** seconds; how often `revenuePool` may settle into the IF vault */
|
|
956
1344
|
revenueSettlePeriod: BN;
|
|
1345
|
+
/** IF_FACTOR_PRECISION (1e6); fraction of spot deposit-interest gains carved out to the (100% staker-owned) insurance fund */
|
|
957
1346
|
ifFeeFactor: number;
|
|
958
1347
|
};
|
|
1348
|
+
/** revenue this market's token has collected (e.g. for SOL-PERP, settled funds flow into the USDC revenue pool); SPOT_BALANCE_PRECISION (1e9) scaled balance */
|
|
959
1349
|
revenuePool: PoolBalance;
|
|
1350
|
+
/** protocol-owned fee claim in this market's token, withdrawn to `StateAccount.protocolFeeRecipientSpot`; SPOT_BALANCE_PRECISION (1e9) scaled balance */
|
|
960
1351
|
protocolFeePool: PoolBalance;
|
|
1352
|
+
/** LIQUIDATOR_FEE_PRECISION (1e6); cut of a liquidation routed to the insurance fund */
|
|
961
1353
|
ifLiquidationFee: number;
|
|
1354
|
+
/** LIQUIDATOR_FEE_PRECISION (1e6); protocol's cut of a spot liquidation, taken from the liquidatee */
|
|
962
1355
|
protocolLiquidationFee: number;
|
|
1356
|
+
/** IF_FACTOR_PRECISION (1e6); protocol's carveout of lending deposit-interest gains */
|
|
963
1357
|
protocolFeeFactor: number;
|
|
1358
|
+
/** token mint decimals; token-mint precision throughout this account is 10^decimals */
|
|
964
1359
|
decimals: number;
|
|
1360
|
+
/** SPOT_UTILIZATION_PRECISION (1e6) */
|
|
965
1361
|
optimalUtilization: number;
|
|
1362
|
+
/** SPOT_RATE_PRECISION (1e6); borrow rate when the market is at `optimalUtilization` */
|
|
966
1363
|
optimalBorrowRate: number;
|
|
1364
|
+
/** SPOT_RATE_PRECISION (1e6); borrow rate at 100% utilization */
|
|
967
1365
|
maxBorrowRate: number;
|
|
1366
|
+
/** SPOT_CUMULATIVE_INTEREST_PRECISION (1e10) */
|
|
968
1367
|
cumulativeDepositInterest: BN;
|
|
1368
|
+
/** SPOT_CUMULATIVE_INTEREST_PRECISION (1e10) */
|
|
969
1369
|
cumulativeBorrowInterest: BN;
|
|
1370
|
+
/** token mint precision; accumulated socialized loss from borrows, in this market's own token */
|
|
970
1371
|
totalSocialLoss: BN;
|
|
1372
|
+
/** QUOTE_PRECISION (1e6); accumulated socialized loss from borrows, converted to quote */
|
|
971
1373
|
totalQuoteSocialLoss: BN;
|
|
1374
|
+
/** SPOT_BALANCE_PRECISION (1e9) scaled balance; multiply by `cumulativeDepositInterest` for the token amount */
|
|
972
1375
|
depositBalance: BN;
|
|
1376
|
+
/** SPOT_BALANCE_PRECISION (1e9) scaled balance; multiply by `cumulativeBorrowInterest` for the token amount */
|
|
973
1377
|
borrowBalance: BN;
|
|
1378
|
+
/** token mint precision; 0 = no limit */
|
|
974
1379
|
maxTokenDeposits: BN;
|
|
975
1380
|
lastInterestTs: BN;
|
|
976
1381
|
lastTwapTs: BN;
|
|
1382
|
+
/** unix timestamp the market is set to expire; only set if reduce-only */
|
|
977
1383
|
expiryTs: BN;
|
|
1384
|
+
/** SPOT_WEIGHT_PRECISION (1e4); e.g. 8000 (.8) means $100 of deposits contributes $80 to initial collateral */
|
|
978
1385
|
initialAssetWeight: number;
|
|
1386
|
+
/** SPOT_WEIGHT_PRECISION (1e4); e.g. 9000 (.9) means $100 of deposits contributes $90 to maintenance collateral */
|
|
979
1387
|
maintenanceAssetWeight: number;
|
|
1388
|
+
/** SPOT_WEIGHT_PRECISION (1e4); e.g. 9000 (.9) means $100 of borrows contributes $90 to the initial margin requirement */
|
|
980
1389
|
initialLiabilityWeight: number;
|
|
1390
|
+
/** SPOT_WEIGHT_PRECISION (1e4); e.g. 8000 (.8) means $100 of borrows contributes $80 to the maintenance margin requirement */
|
|
981
1391
|
maintenanceLiabilityWeight: number;
|
|
1392
|
+
/** LIQUIDATOR_FEE_PRECISION (1e6); fee paid to the liquidator for taking over the borrow/deposit */
|
|
982
1393
|
liquidatorFee: number;
|
|
1394
|
+
/** MARGIN_PRECISION (1e4); scales liability weight up / asset weight down for large positions */
|
|
983
1395
|
imfFactor: number;
|
|
1396
|
+
/** QUOTE_PRECISION (1e6); deposit level at which `initialAssetWeight` begins scaling down; 0 = disabled */
|
|
984
1397
|
scaleInitialAssetWeightStart: BN;
|
|
1398
|
+
/** token mint precision; below this vault balance, no withdraw limits/guards apply */
|
|
985
1399
|
withdrawGuardThreshold: BN;
|
|
1400
|
+
/** token mint precision; 24h rolling average of deposit token amount */
|
|
986
1401
|
depositTokenTwap: BN;
|
|
1402
|
+
/** token mint precision; 24h rolling average of borrow token amount */
|
|
987
1403
|
borrowTokenTwap: BN;
|
|
1404
|
+
/** SPOT_UTILIZATION_PRECISION (1e6); 24h rolling average utilization (borrow / total) */
|
|
988
1405
|
utilizationTwap: BN;
|
|
989
1406
|
nextDepositRecordId: BN;
|
|
1407
|
+
/** orders must be a multiple of this, token mint precision */
|
|
990
1408
|
orderStepSize: BN;
|
|
1409
|
+
/** orders must be a multiple of this, PRICE_PRECISION (1e6) */
|
|
991
1410
|
orderTickSize: BN;
|
|
1411
|
+
/** token mint precision */
|
|
992
1412
|
minOrderSize: BN;
|
|
1413
|
+
/** token mint precision; 0 = no limit */
|
|
993
1414
|
maxPositionSize: BN;
|
|
994
1415
|
nextFillRecordId: BN;
|
|
1416
|
+
/** fees collected from swaps between this market and the quote market, settled to the quote market's revenue pool; SPOT_BALANCE_PRECISION (1e9) scaled balance */
|
|
995
1417
|
spotFeePool: PoolBalance;
|
|
1418
|
+
/** QUOTE_PRECISION (1e6) */
|
|
996
1419
|
totalSpotFee: BN;
|
|
1420
|
+
/** token mint precision; total fees received from swaps */
|
|
997
1421
|
totalSwapFee: BN;
|
|
1422
|
+
/** token mint precision; amount loaned out in `beginSwap`, for the in-flight flash-loan invariant check */
|
|
998
1423
|
flashLoanAmount: BN;
|
|
1424
|
+
/** token mint precision; user's token balance snapshotted at `beginSwap`, used to compute how much left the system by `endSwap` */
|
|
999
1425
|
flashLoanInitialTokenAmount: BN;
|
|
1000
1426
|
ordersEnabled: boolean;
|
|
1427
|
+
/** bitmask, see `SpotOperation` */
|
|
1001
1428
|
pausedOperations: number;
|
|
1429
|
+
/** bitmask, see `InsuranceFundOperation` */
|
|
1002
1430
|
ifPausedOperations: number;
|
|
1431
|
+
/** X/10000; fraction of `maxTokenDeposits` that may be borrowed in total; 0 disables the cap */
|
|
1003
1432
|
maxTokenBorrowsFraction: number;
|
|
1433
|
+
/** X/200; floor borrow rate regardless of utilization */
|
|
1004
1434
|
minBorrowRate: number;
|
|
1435
|
+
/** bitmask, see `TokenProgramFlag` */
|
|
1005
1436
|
tokenProgramFlag: number;
|
|
1006
1437
|
poolId: number;
|
|
1438
|
+
/** -100 to 100; percentage adjustment applied to the base fee rate */
|
|
1007
1439
|
feeAdjustment: number;
|
|
1008
1440
|
};
|
|
1441
|
+
/** A scaled token balance inside a market's internal pools (pnl pool, protocol fee pool, revenue pool, spot fee pool, AMM fee pool). Multiply `scaledBalance` (SPOT_BALANCE_PRECISION, 1e9) by the referenced spot market's `cumulativeDepositInterest`/`cumulativeBorrowInterest` to get the token amount. */
|
|
1009
1442
|
export type PoolBalance = {
|
|
1010
1443
|
scaledBalance: BN;
|
|
1444
|
+
/** the spot market this balance's token amount is denominated in */
|
|
1011
1445
|
marketIndex: number;
|
|
1012
1446
|
};
|
|
1447
|
+
/**
|
|
1448
|
+
* Consolidated per-market fee ledger: lifetime analytics counters plus the pending
|
|
1449
|
+
* (not-yet-materialized) protocol/IF/AMM carveouts and the AMM's backstop-of-last-resort
|
|
1450
|
+
* clawback cap. All fields are QUOTE_PRECISION (1e6). Pure counters — the actual token claims
|
|
1451
|
+
* live in `PerpMarketAccount.protocolFeePool` / `pnlPool` / `AMM.feePool`.
|
|
1452
|
+
*/
|
|
1013
1453
|
export type FeeLedger = {
|
|
1454
|
+
/** lifetime gross taker fees collected (analytics only, post referee-discount, pre carve-outs) */
|
|
1014
1455
|
totalExchangeFee: BN;
|
|
1456
|
+
/** lifetime liquidation fees charged to liquidatees (IF + protocol cuts; analytics only) */
|
|
1015
1457
|
totalLiquidationFee: BN;
|
|
1458
|
+
/** protocol carveouts accrued but not yet materialized into `protocolFeePool` */
|
|
1016
1459
|
pendingProtocolFee: BN;
|
|
1460
|
+
/** insurance-fund carveouts accrued but not yet materialized into the quote market's revenue pool; also the first bankruptcy tranche */
|
|
1017
1461
|
pendingIfFee: BN;
|
|
1462
|
+
/** cumulative fee provision granted to the AMM as its backstop-of-last-resort tranche; drawable (and decremented) only in bankruptcy */
|
|
1018
1463
|
ammProtocolFeesReceived: BN;
|
|
1464
|
+
/** AMM fee provision accrued at fill but not yet tokenized into `AMM.feePool` by the sweep; always `<= ammProtocolFeesReceived` */
|
|
1019
1465
|
pendingAmmProvision: BN;
|
|
1020
1466
|
};
|
|
1467
|
+
/** Decoded mirror of the on-chain constant-product `AMM` struct embedded in `PerpMarketAccount.amm`. */
|
|
1021
1468
|
export type AMM = {
|
|
1469
|
+
/** partition of fees moved from pnl settlements; SPOT_BALANCE_PRECISION (1e9) scaled balance */
|
|
1022
1470
|
feePool: PoolBalance;
|
|
1471
|
+
/** `x` reserve of the constant-product formula (x*y=k), AMM_RESERVE_PRECISION (1e9) */
|
|
1023
1472
|
baseAssetReserve: BN;
|
|
1473
|
+
/** `y` reserve of the constant-product formula (x*y=k), AMM_RESERVE_PRECISION (1e9) */
|
|
1024
1474
|
quoteAssetReserve: BN;
|
|
1475
|
+
/** PERCENTAGE_PRECISION (1e6); how tightly the min/max reserves bracket the current reserves (lowers slippage without adding liquidity) */
|
|
1025
1476
|
concentrationCoef: BN;
|
|
1477
|
+
/** AMM_RESERVE_PRECISION (1e9); reserve floor below which the AMM is unavailable */
|
|
1026
1478
|
minBaseAssetReserve: BN;
|
|
1479
|
+
/** AMM_RESERVE_PRECISION (1e9); reserve ceiling above which the AMM is unavailable */
|
|
1027
1480
|
maxBaseAssetReserve: BN;
|
|
1481
|
+
/** `sqrt(k)`, AMM_RESERVE_PRECISION (1e9); cached to avoid precision loss recomputing it */
|
|
1028
1482
|
sqrtK: BN;
|
|
1483
|
+
/** normalizes quote reserves for lowest slippage when the market is balanced; PEG_PRECISION (1e6) */
|
|
1029
1484
|
pegMultiplier: BN;
|
|
1485
|
+
/** `y` reserve when the market is balanced, AMM_RESERVE_PRECISION (1e9) */
|
|
1030
1486
|
terminalQuoteAssetReserve: BN;
|
|
1487
|
+
/** net position (longs − shorts) with the AMM as counterparty, BASE_PRECISION (1e9) */
|
|
1031
1488
|
baseAssetAmountWithAmm: BN;
|
|
1489
|
+
/** the AMM's own fee-derived income (provision + spread surplus), QUOTE_PRECISION (1e6) — the market's gross fees are `feeLedger.totalExchangeFee` */
|
|
1032
1490
|
totalFee: BN;
|
|
1491
|
+
/** spread-capture component of `totalFee` (trading profit, not a paid fee), QUOTE_PRECISION (1e6) */
|
|
1033
1492
|
totalMmFee: BN;
|
|
1493
|
+
/** the AMM's equity ledger (retained earnings): fee income + funding/PnL + credits − curve costs − bankruptcy clawbacks; AMM money only, QUOTE_PRECISION (1e6) */
|
|
1034
1494
|
totalFeeMinusDistributions: BN;
|
|
1495
|
+
/** @deprecated frozen pre-isolation analytics counter; nothing writes this anymore. QUOTE_PRECISION (1e6) */
|
|
1035
1496
|
totalFeeWithdrawn: BN;
|
|
1497
|
+
/** cached spread-adjusted ask (long-take) reserve, AMM_RESERVE_PRECISION (1e9) */
|
|
1036
1498
|
askBaseAssetReserve: BN;
|
|
1499
|
+
/** AMM_RESERVE_PRECISION (1e9) */
|
|
1037
1500
|
askQuoteAssetReserve: BN;
|
|
1501
|
+
/** cached spread-adjusted bid (short-take) reserve, AMM_RESERVE_PRECISION (1e9) */
|
|
1038
1502
|
bidBaseAssetReserve: BN;
|
|
1503
|
+
/** AMM_RESERVE_PRECISION (1e9) */
|
|
1039
1504
|
bidQuoteAssetReserve: BN;
|
|
1040
1505
|
lastUpdateSlot: BN;
|
|
1506
|
+
/** change in `totalFeeMinusDistributions` since the last funding update, QUOTE_PRECISION (1e6) */
|
|
1041
1507
|
netRevenueSinceLastFunding: BN;
|
|
1508
|
+
/** the AMM's last-seen cumulative long funding rate (mirrors `PerpPosition.lastCumulativeFundingRate`), FUNDING_RATE_PRECISION (1e9) */
|
|
1042
1509
|
lastCumulativeFundingRateLong: BN;
|
|
1510
|
+
/** FUNDING_RATE_PRECISION (1e9) */
|
|
1043
1511
|
lastCumulativeFundingRateShort: BN;
|
|
1512
|
+
/** signed, BID_ASK_SPREAD_PRECISION (1e6); cached oracle-vs-reserve price spread feeding `calculate_spread` */
|
|
1044
1513
|
lastOracleReservePriceSpreadPct: BN;
|
|
1045
1514
|
lastSpreadUpdateSlot: BN;
|
|
1515
|
+
/** BID_ASK_SPREAD_PRECISION (1e6); minimum spread the AMM can quote */
|
|
1046
1516
|
baseSpread: number;
|
|
1517
|
+
/** BID_ASK_SPREAD_PRECISION (1e6); maximum spread the AMM can quote */
|
|
1047
1518
|
maxSpread: number;
|
|
1519
|
+
/** BID_ASK_SPREAD_PRECISION (1e6); cached spread applied to the ask (long-take) side */
|
|
1048
1520
|
longSpread: number;
|
|
1521
|
+
/** BID_ASK_SPREAD_PRECISION (1e6); cached spread applied to the bid (short-take) side */
|
|
1049
1522
|
shortSpread: number;
|
|
1523
|
+
/** signed, PRICE_PRECISION (1e6); cached reference-price offset applied to both sides' quotes */
|
|
1050
1524
|
referencePriceOffset: number;
|
|
1525
|
+
/** fraction of total available liquidity a single AMM fill may consume */
|
|
1051
1526
|
maxFillReserveFraction: number;
|
|
1527
|
+
/** maximum slippage ratio a single AMM fill may push */
|
|
1052
1528
|
maxSlippageRatio: number;
|
|
1529
|
+
/** 0-100; intensity of the AMM's formulaic `k` updates */
|
|
1053
1530
|
curveUpdateIntensity: number;
|
|
1531
|
+
/** 0 = no AMM JIT participation, (0,100] = intensity of protocol-owned-AMM JIT participation */
|
|
1054
1532
|
ammJitIntensity: number;
|
|
1533
|
+
/** signed, -100 = 0x scale, 100 = 2x scale, applied to the computed spread */
|
|
1055
1534
|
ammSpreadAdjustment: number;
|
|
1535
|
+
/** signed, -100 = 0x scale, 100 = 2x scale, applied to the inventory-skew component of the spread */
|
|
1056
1536
|
ammInventorySpreadAdjustment: number;
|
|
1057
1537
|
referencePriceOffsetDeadbandPct: number;
|
|
1538
|
+
/** stored in hundredths (value/100); how much the paying side's spread widens while the AMM pays funding on its inventory — 50 => 1.5x, 100 => 2x, 0 disables the bias */
|
|
1058
1539
|
fundingBiasSensitivity: number;
|
|
1059
1540
|
};
|
|
1541
|
+
/** Market-wide stats shared across all makers (vAMM, DLOB resting orders, JIT participants), updated on every fill regardless of which maker filled. */
|
|
1060
1542
|
export type MarketStats = {
|
|
1543
|
+
/** average (bid+ask)/2 price over `fundingPeriod`, PRICE_PRECISION (1e6) */
|
|
1061
1544
|
lastMarkPriceTwap: BN;
|
|
1545
|
+
/** average (bid+ask)/2 price over 5 minutes, PRICE_PRECISION (1e6) */
|
|
1062
1546
|
lastMarkPriceTwap5Min: BN;
|
|
1063
1547
|
lastMarkPriceTwapTs: BN;
|
|
1548
|
+
/** PRICE_PRECISION (1e6) */
|
|
1064
1549
|
lastBidPriceTwap: BN;
|
|
1550
|
+
/** PRICE_PRECISION (1e6) */
|
|
1065
1551
|
lastAskPriceTwap: BN;
|
|
1552
|
+
/** standard deviation of fill (mark) prices, PRICE_PRECISION (1e6) */
|
|
1066
1553
|
markStd: BN;
|
|
1554
|
+
/** standard deviation of the oracle price at each update, PRICE_PRECISION (1e6) */
|
|
1067
1555
|
oracleStd: BN;
|
|
1556
|
+
/** PERCENTAGE_PRECISION (1e6); size of the oracle confidence interval as a fraction of price */
|
|
1068
1557
|
lastOracleConfPct: BN;
|
|
1558
|
+
/** QUOTE_PRECISION (1e6); estimated total volume traded in the market */
|
|
1069
1559
|
volume24H: BN;
|
|
1070
1560
|
longIntensityVolume: BN;
|
|
1071
1561
|
shortIntensityVolume: BN;
|
|
1072
1562
|
lastTradeTs: BN;
|
|
1563
|
+
/** unit is quote per base, QUOTE_PRECISION (1e6); estimate of the last 24h average funding rate */
|
|
1073
1564
|
last24HAvgFundingRate: BN;
|
|
1565
|
+
/** seconds; periodicity of funding rate updates */
|
|
1074
1566
|
fundingPeriod: BN;
|
|
1567
|
+
/** BASE_PRECISION (1e9); minimum order size, mirrored here from `PerpMarketAccount` config so the AMM can read it without touching the market's other fields */
|
|
1075
1568
|
minOrderSize: BN;
|
|
1569
|
+
/** market-maker oracle price snapshot set by the native `updateMmOracle` handler */
|
|
1076
1570
|
mmOraclePrice: BN;
|
|
1077
1571
|
mmOracleSlot: BN;
|
|
1572
|
+
/** monotonically increasing; guards against out-of-order mm-oracle updates */
|
|
1078
1573
|
mmOracleSequenceId: BN;
|
|
1574
|
+
/** canonical sanitised/clamped oracle price after normalisation */
|
|
1079
1575
|
lastOracleNormalisedPrice: BN;
|
|
1576
|
+
/** PRICE_PRECISION (1e6); reference-price offset from the previous `_update_amm` call, used to smooth the sign-flip transition when the freshly computed offset changes direction */
|
|
1080
1577
|
lastReferencePriceOffset: number;
|
|
1081
1578
|
lastOracleValid: boolean;
|
|
1579
|
+
/** unit is quote per base, QUOTE_PRECISION (1e6); oracle TWAP snapshot used by the funding-rate computation */
|
|
1082
1580
|
lastFundingOracleTwap: BN;
|
|
1083
1581
|
historicalOracleData: HistoricalOracleData;
|
|
1084
1582
|
};
|
|
1583
|
+
/** A user's position in one perp market. Decoded mirror of the on-chain `PerpPosition`. */
|
|
1085
1584
|
export type PerpPosition = {
|
|
1585
|
+
/** signed size of the position, BASE_PRECISION (1e9) */
|
|
1086
1586
|
baseAssetAmount: BN;
|
|
1587
|
+
/** the market's last cumulative funding rate this position has settled against, FUNDING_RATE_PRECISION (1e9) */
|
|
1087
1588
|
lastCumulativeFundingRate: BN;
|
|
1088
1589
|
marketIndex: number;
|
|
1590
|
+
/** used to calculate pnl; updated on open/close/settle, includes fees/funding, QUOTE_PRECISION (1e6) */
|
|
1089
1591
|
quoteAssetAmount: BN;
|
|
1592
|
+
/** quote the position was entered with (base * avg entry price), excludes fees/funding, QUOTE_PRECISION (1e6) */
|
|
1090
1593
|
quoteEntryAmount: BN;
|
|
1594
|
+
/** quote needed to exit at breakeven, includes fees/funding, QUOTE_PRECISION (1e6) */
|
|
1091
1595
|
quoteBreakEvenAmount: BN;
|
|
1092
1596
|
openOrders: number;
|
|
1597
|
+
/** size of non-reduce-only bids resting/triggering against this position, BASE_PRECISION (1e9) */
|
|
1093
1598
|
openBids: BN;
|
|
1599
|
+
/** size of non-reduce-only asks resting/triggering against this position, BASE_PRECISION (1e9) */
|
|
1094
1600
|
openAsks: BN;
|
|
1601
|
+
/** cumulative pnl settled in this market since the position was opened, QUOTE_PRECISION (1e6) */
|
|
1095
1602
|
settledPnl: BN;
|
|
1096
1603
|
/** TODO: remove this field - it doesn't exist on chain */
|
|
1097
1604
|
remainderBaseAssetAmount: number;
|
|
1605
|
+
/** MARGIN_PRECISION (1e4); custom max margin ratio for this position, 0 = use the market default */
|
|
1098
1606
|
maxMarginRatio: number;
|
|
1607
|
+
/** bitmask, see `PositionFlag` */
|
|
1099
1608
|
positionFlag: number;
|
|
1609
|
+
/** SPOT_BALANCE_PRECISION (1e9) scaled balance backing this position when it is isolated-margin (`PositionFlag.IsolatedPosition` set) */
|
|
1100
1610
|
isolatedPositionScaledBalance: BN;
|
|
1101
1611
|
};
|
|
1612
|
+
/** Decoded mirror of the on-chain `UserStats` account: authority-level (cross-sub-account) rolling volume, fee, and referral stats. */
|
|
1102
1613
|
export type UserStatsAccount = {
|
|
1103
1614
|
numberOfSubAccounts: number;
|
|
1615
|
+
/** can exceed `numberOfSubAccounts` if sub-accounts were deleted */
|
|
1104
1616
|
numberOfSubAccountsCreated: number;
|
|
1617
|
+
/** rolling 30-day maker volume, QUOTE_PRECISION (1e6) */
|
|
1105
1618
|
makerVolume30D: BN;
|
|
1619
|
+
/** rolling 30-day taker volume, QUOTE_PRECISION (1e6) */
|
|
1106
1620
|
takerVolume30D: BN;
|
|
1621
|
+
/** rolling 30-day filler (keeper) volume, QUOTE_PRECISION (1e6) */
|
|
1107
1622
|
fillerVolume30D: BN;
|
|
1108
1623
|
lastMakerVolume30DTs: BN;
|
|
1109
1624
|
lastTakerVolume30DTs: BN;
|
|
1110
1625
|
lastFillerVolume30DTs: BN;
|
|
1111
1626
|
fees: {
|
|
1627
|
+
/** total taker fees paid, QUOTE_PRECISION (1e6) */
|
|
1112
1628
|
totalFeePaid: BN;
|
|
1629
|
+
/** total maker rebate received, QUOTE_PRECISION (1e6) */
|
|
1113
1630
|
totalFeeRebate: BN;
|
|
1631
|
+
/** total discount from holding the discount token, QUOTE_PRECISION (1e6) */
|
|
1114
1632
|
totalTokenDiscount: BN;
|
|
1633
|
+
/** total discount from being a referred user, QUOTE_PRECISION (1e6) */
|
|
1115
1634
|
totalRefereeDiscount: BN;
|
|
1116
1635
|
};
|
|
1117
1636
|
referrer: PublicKey;
|
|
1637
|
+
/** bitmask, see `ReferrerStatus` */
|
|
1118
1638
|
referrerStatus: number;
|
|
1119
1639
|
disableUpdatePerpBidAskTwap: number;
|
|
1640
|
+
/** bitmask, see `UserStatsPausedOperation` */
|
|
1120
1641
|
pausedOperations: number;
|
|
1121
1642
|
authority: PublicKey;
|
|
1122
1643
|
ifStakedQuoteAssetAmount: BN;
|
|
1123
1644
|
delegatePermissions: number;
|
|
1645
|
+
/** non-zero when the permissionless `tripEquityFloorBreaker` fired: every subaccount of the authority rejects risk-increasing fills, withdrawals and transfers out until the warm admin resets */
|
|
1646
|
+
equityBreakerTripped: number;
|
|
1124
1647
|
};
|
|
1648
|
+
/** Decoded mirror of the on-chain `User` (sub-account) zero-copy account. */
|
|
1125
1649
|
export type UserAccount = {
|
|
1126
1650
|
authority: PublicKey;
|
|
1651
|
+
/** address that can control the account on the authority's behalf; limited power, cannot withdraw */
|
|
1127
1652
|
delegate: PublicKey;
|
|
1128
1653
|
name: number[];
|
|
1129
1654
|
subAccountId: number;
|
|
1130
1655
|
spotPositions: SpotPosition[];
|
|
1131
1656
|
perpPositions: PerpPosition[];
|
|
1132
1657
|
orders: Order[];
|
|
1658
|
+
/** bitmask, see `UserStatus` */
|
|
1133
1659
|
status: number;
|
|
1134
1660
|
nextLiquidationId: number;
|
|
1135
1661
|
nextOrderId: number;
|
|
1662
|
+
/** MARGIN_PRECISION (1e4); custom max initial margin ratio for the whole account, 0 = use market defaults */
|
|
1136
1663
|
maxMarginRatio: number;
|
|
1664
|
+
/** fees (taker fee, maker rebate, referrer reward, filler reward) and pnl for perps, QUOTE_PRECISION (1e6) */
|
|
1137
1665
|
settledPerpPnl: BN;
|
|
1666
|
+
/** QUOTE_PRECISION (1e6) */
|
|
1138
1667
|
totalDeposits: BN;
|
|
1668
|
+
/** QUOTE_PRECISION (1e6) */
|
|
1139
1669
|
totalWithdraws: BN;
|
|
1670
|
+
/** QUOTE_PRECISION (1e6) */
|
|
1140
1671
|
totalSocialLoss: BN;
|
|
1672
|
+
/** cumulative funding paid/received across perps, QUOTE_PRECISION (1e6) */
|
|
1141
1673
|
cumulativePerpFunding: BN;
|
|
1674
|
+
/** fees (taker fee, maker rebate, filler reward) for spot, QUOTE_PRECISION (1e6) */
|
|
1142
1675
|
cumulativeSpotFees: BN;
|
|
1676
|
+
/** QUOTE_PRECISION (1e6); margin freed so far during an in-progress liquidation (spreads the liquidation over time); 0 when not being liquidated */
|
|
1143
1677
|
liquidationMarginFreed: BN;
|
|
1144
1678
|
lastActiveSlot: BN;
|
|
1145
1679
|
isMarginTradingEnabled: boolean;
|
|
1680
|
+
/** true if the account hasn't interacted with the protocol in ~1 week and has no orders/positions/borrows; off-chain keepers may ignore idle accounts */
|
|
1146
1681
|
idle: boolean;
|
|
1147
1682
|
openOrders: number;
|
|
1148
1683
|
hasOpenOrder: boolean;
|
|
1149
1684
|
openAuctions: number;
|
|
1150
1685
|
hasOpenAuction: boolean;
|
|
1151
1686
|
poolId: number;
|
|
1687
|
+
/** bitmask, see `SpecialUserStatus` */
|
|
1152
1688
|
specialUserStatus: number;
|
|
1689
|
+
/** QUOTE_PRECISION (1e6); admin-set minimum cross-margin total collateral for risk-increasing orders, fills, withdrawals and transfers; 0 = disabled */
|
|
1690
|
+
equityFloor: BN;
|
|
1153
1691
|
};
|
|
1692
|
+
/** A user's balance in one spot market. Decoded mirror of the on-chain `SpotPosition`. */
|
|
1154
1693
|
export type SpotPosition = {
|
|
1155
1694
|
marketIndex: number;
|
|
1156
1695
|
balanceType: SpotBalanceType;
|
|
1696
|
+
/** SPOT_BALANCE_PRECISION (1e9) scaled balance; multiply by the spot market's cumulative deposit/borrow interest for the token amount */
|
|
1157
1697
|
scaledBalance: BN;
|
|
1158
1698
|
openOrders: number;
|
|
1699
|
+
/** size of non-reduce-only bids resting/triggering, token mint precision */
|
|
1159
1700
|
openBids: BN;
|
|
1701
|
+
/** size of non-reduce-only asks resting/triggering, token mint precision */
|
|
1160
1702
|
openAsks: BN;
|
|
1703
|
+
/** cumulative deposits/borrows into this market, token mint precision */
|
|
1161
1704
|
cumulativeDeposits: BN;
|
|
1162
1705
|
};
|
|
1706
|
+
/** Decoded mirror of an on-chain `Order` slot inside `UserAccount.orders`. */
|
|
1163
1707
|
export type Order = {
|
|
1164
1708
|
status: OrderStatus;
|
|
1165
1709
|
orderType: OrderType;
|
|
@@ -1168,48 +1712,73 @@ export type Order = {
|
|
|
1168
1712
|
orderId: number;
|
|
1169
1713
|
userOrderId: number;
|
|
1170
1714
|
marketIndex: number;
|
|
1715
|
+
/** the limit price; can be 0 for market orders. For orders with an auction, unused until the auction completes. PRICE_PRECISION (1e6) */
|
|
1171
1716
|
price: BN;
|
|
1717
|
+
/** perp: BASE_PRECISION (1e9); spot: token mint precision */
|
|
1172
1718
|
baseAssetAmount: BN;
|
|
1719
|
+
/** perp: BASE_PRECISION (1e9); spot: token mint precision */
|
|
1173
1720
|
baseAssetAmountFilled: BN;
|
|
1721
|
+
/** QUOTE_PRECISION (1e6) */
|
|
1174
1722
|
quoteAssetAmountFilled: BN;
|
|
1175
1723
|
direction: PositionDirection;
|
|
1176
1724
|
reduceOnly: boolean;
|
|
1725
|
+
/** price at which the order becomes active; only relevant for trigger orders, PRICE_PRECISION (1e6) */
|
|
1177
1726
|
triggerPrice: BN;
|
|
1178
1727
|
triggerCondition: OrderTriggerCondition;
|
|
1728
|
+
/** the user's position direction when this order was placed */
|
|
1179
1729
|
existingPositionDirection: PositionDirection;
|
|
1180
1730
|
postOnly: boolean;
|
|
1731
|
+
/** must be canceled the same slot it's placed if not fully filled */
|
|
1181
1732
|
immediateOrCancel: boolean;
|
|
1733
|
+
/** if set, the limit price is `oraclePrice + oraclePriceOffset`; PRICE_PRECISION (1e6), signed */
|
|
1182
1734
|
oraclePriceOffset: BN;
|
|
1735
|
+
/** slots the auction lasts; only relevant for market/oracle orders */
|
|
1183
1736
|
auctionDuration: number;
|
|
1737
|
+
/** PRICE_PRECISION (1e6), signed; only relevant for market/oracle orders */
|
|
1184
1738
|
auctionStartPrice: BN;
|
|
1739
|
+
/** PRICE_PRECISION (1e6), signed; only relevant for market/oracle orders */
|
|
1185
1740
|
auctionEndPrice: BN;
|
|
1741
|
+
/** unix timestamp after which the order expires */
|
|
1186
1742
|
maxTs: BN;
|
|
1743
|
+
/** bitmask, see `OrderBitFlag` */
|
|
1187
1744
|
bitFlags: number;
|
|
1745
|
+
/** low 8 bits of the slot the order was posted on-chain (not the order's `slot` field for signed-msg orders) */
|
|
1188
1746
|
postedSlotTail: number;
|
|
1189
1747
|
};
|
|
1748
|
+
/** Instruction-parameter shape for placing an order (perp or spot). Optional fields default to `null`/unset on-chain unless noted. */
|
|
1190
1749
|
export type OrderParams = {
|
|
1191
1750
|
orderType: OrderType;
|
|
1192
1751
|
marketType: MarketType;
|
|
1193
1752
|
userOrderId: number;
|
|
1194
1753
|
direction: PositionDirection;
|
|
1754
|
+
/** perp: BASE_PRECISION (1e9); spot: token mint precision */
|
|
1195
1755
|
baseAssetAmount: BN;
|
|
1756
|
+
/** limit price, PRICE_PRECISION (1e6); 0 for market orders */
|
|
1196
1757
|
price: BN;
|
|
1197
1758
|
marketIndex: number;
|
|
1198
1759
|
reduceOnly: boolean;
|
|
1199
1760
|
postOnly: PostOnlyParams;
|
|
1761
|
+
/** bitmask, see `OrderParamsBitFlag` (distinct from the on-chain `Order.bitFlags` set of flags) */
|
|
1200
1762
|
bitFlags: number;
|
|
1763
|
+
/** PRICE_PRECISION (1e6); only used for trigger orders */
|
|
1201
1764
|
triggerPrice: BN | null;
|
|
1202
1765
|
triggerCondition: OrderTriggerCondition;
|
|
1766
|
+
/** signed offset from the oracle price, PRICE_PRECISION (1e6); when set, the order's effective limit price tracks the oracle */
|
|
1203
1767
|
oraclePriceOffset: BN | null;
|
|
1768
|
+
/** slots; only used for market/oracle orders */
|
|
1204
1769
|
auctionDuration: number | null;
|
|
1770
|
+
/** unix timestamp after which the order expires */
|
|
1205
1771
|
maxTs: BN | null;
|
|
1772
|
+
/** PRICE_PRECISION (1e6) or oracle-offset units depending on the order, signed; only used for market/oracle orders */
|
|
1206
1773
|
auctionStartPrice: BN | null;
|
|
1774
|
+
/** PRICE_PRECISION (1e6) or oracle-offset units depending on the order, signed; only used for market/oracle orders */
|
|
1207
1775
|
auctionEndPrice: BN | null;
|
|
1208
1776
|
/** index into the placing user's RevenueShareEscrow.approved_builders list (non-swift builder codes) */
|
|
1209
1777
|
builderIdx?: number | null;
|
|
1210
1778
|
/** builder fee on this order, in tenths of a bps, e.g. 100 = 0.01% */
|
|
1211
1779
|
builderFeeTenthBps?: number | null;
|
|
1212
1780
|
};
|
|
1781
|
+
/** Whether/how an order must avoid taking liquidity. `MUST_POST_ONLY` reverts the transaction if the order would cross; `TRY_POST_ONLY` silently drops the order instead of reverting; `SLIDE` adjusts the price to make it post-only. */
|
|
1213
1782
|
export declare class PostOnlyParams {
|
|
1214
1783
|
static readonly NONE: {
|
|
1215
1784
|
none: {};
|
|
@@ -1264,45 +1833,58 @@ export type ScaleOrderParams = {
|
|
|
1264
1833
|
/** Maximum timestamp for orders to be valid */
|
|
1265
1834
|
maxTs: BN | null;
|
|
1266
1835
|
};
|
|
1836
|
+
/** Bitmask mirror of `OrderParams.bitFlags` (the instruction-parameter flag set; distinct from the on-chain `Order.bitFlags` set of `OrderBitFlag`). */
|
|
1267
1837
|
export declare class OrderParamsBitFlag {
|
|
1268
1838
|
static readonly ImmediateOrCancel = 1;
|
|
1269
1839
|
}
|
|
1840
|
+
/** Bitmask mirror of `PerpPosition.positionFlag`. Multiple bits can be set (e.g. an isolated position mid-liquidation has both `IsolatedPosition` and `BeingLiquidated`). */
|
|
1270
1841
|
export declare class PositionFlag {
|
|
1271
1842
|
static readonly IsolatedPosition = 1;
|
|
1272
1843
|
static readonly BeingLiquidated = 2;
|
|
1273
1844
|
static readonly Bankruptcy = 4;
|
|
1274
1845
|
}
|
|
1846
|
+
/** The subset of `OrderParams` an SDK caller must always supply; everything else can be defaulted. */
|
|
1275
1847
|
export type NecessaryOrderParams = {
|
|
1276
1848
|
orderType: OrderType;
|
|
1277
1849
|
marketIndex: number;
|
|
1278
1850
|
baseAssetAmount: BN;
|
|
1279
1851
|
direction: PositionDirection;
|
|
1280
1852
|
};
|
|
1853
|
+
/** `OrderParams` with every field optional except `NecessaryOrderParams`; SDK order-placement helpers fill in the rest from `DefaultOrderParams`. */
|
|
1281
1854
|
export type OptionalOrderParams = {
|
|
1282
1855
|
[Property in keyof OrderParams]?: OrderParams[Property];
|
|
1283
1856
|
} & NecessaryOrderParams;
|
|
1857
|
+
/** Fields to change on an existing order via `modifyOrder`. Only the fields present (non-`undefined`) are changed on-chain; the rest of the order is left as-is. `null` explicitly clears an optional on-chain field (e.g. `triggerPrice: null` removes the trigger). */
|
|
1284
1858
|
export type ModifyOrderParams = {
|
|
1285
1859
|
[Property in keyof OrderParams]?: OrderParams[Property] | null;
|
|
1286
1860
|
} & {
|
|
1287
1861
|
policy?: ModifyOrderPolicy | null;
|
|
1288
1862
|
};
|
|
1863
|
+
/** Bitmask passed as `ModifyOrderParams.policy` (combine with `|`). `MustModify`: fail the instruction instead of silently no-op'ing if the target order id can't be found. `ExcludePreviousFill`: when a new `baseAssetAmount` is given, treat it as the new *remaining* size — the already-filled amount is subtracted off it (rather than replacing the order's total size outright). */
|
|
1289
1864
|
export declare enum ModifyOrderPolicy {
|
|
1290
1865
|
MustModify = 1,
|
|
1291
1866
|
ExcludePreviousFill = 2
|
|
1292
1867
|
}
|
|
1868
|
+
/** Base `OrderParams` (a market perp long of size 0) that SDK order-building helpers spread their caller-supplied `OptionalOrderParams` over. */
|
|
1293
1869
|
export declare const DefaultOrderParams: OrderParams;
|
|
1870
|
+
/** The payload signed off-chain by a user (non-delegated) for a swift/signed-msg order, optionally bundling bracket TP/SL orders and an isolated-margin deposit. */
|
|
1294
1871
|
export type SignedMsgOrderParamsMessage = {
|
|
1295
1872
|
signedMsgOrderParams: OrderParams;
|
|
1296
1873
|
subAccountId: number;
|
|
1874
|
+
/** slot the message was signed at; combined with `signedMsgOrderMaxSlot`-style checks to bound message validity */
|
|
1297
1875
|
slot: BN;
|
|
1298
1876
|
uuid: Uint8Array;
|
|
1299
1877
|
takeProfitOrderParams: SignedMsgTriggerOrderParams | null;
|
|
1300
1878
|
stopLossOrderParams: SignedMsgTriggerOrderParams | null;
|
|
1879
|
+
/** MARGIN_PRECISION (1e4); custom max margin ratio applied to the resulting position, if any */
|
|
1301
1880
|
maxMarginRatio?: number | null;
|
|
1302
1881
|
builderIdx?: number | null;
|
|
1882
|
+
/** builder fee on this order, in tenths of a bps, e.g. 100 = 0.01% */
|
|
1303
1883
|
builderFeeTenthBps?: number | null;
|
|
1884
|
+
/** if set, deposits this amount (spot market token-mint precision) into a new isolated-margin position when placing the order */
|
|
1304
1885
|
isolatedPositionDeposit?: BN | null;
|
|
1305
1886
|
};
|
|
1887
|
+
/** Same as `SignedMsgOrderParamsMessage`, but signed by a delegate on the taker's behalf; carries `takerPubkey` explicitly since the signer isn't the taker's own authority. */
|
|
1306
1888
|
export type SignedMsgOrderParamsDelegateMessage = {
|
|
1307
1889
|
signedMsgOrderParams: OrderParams;
|
|
1308
1890
|
slot: BN;
|
|
@@ -1315,49 +1897,68 @@ export type SignedMsgOrderParamsDelegateMessage = {
|
|
|
1315
1897
|
builderFeeTenthBps?: number | null;
|
|
1316
1898
|
isolatedPositionDeposit?: BN | null;
|
|
1317
1899
|
};
|
|
1900
|
+
/** A bracket take-profit/stop-loss order attached to a signed-msg order message. */
|
|
1318
1901
|
export type SignedMsgTriggerOrderParams = {
|
|
1902
|
+
/** PRICE_PRECISION (1e6) */
|
|
1319
1903
|
triggerPrice: BN;
|
|
1904
|
+
/** perp: BASE_PRECISION (1e9); spot: token mint precision */
|
|
1320
1905
|
baseAssetAmount: BN;
|
|
1321
1906
|
};
|
|
1907
|
+
/** Identifies a resting maker order/account to pass into a fill instruction's remaining accounts. `order` may be omitted when the whole account (not one specific order) is being matched against, e.g. AMM-JIT. */
|
|
1322
1908
|
export type MakerInfo = {
|
|
1323
1909
|
maker: PublicKey;
|
|
1324
1910
|
makerStats: PublicKey;
|
|
1325
1911
|
makerUserAccount: UserAccount;
|
|
1326
1912
|
order?: Order;
|
|
1327
1913
|
};
|
|
1914
|
+
/** Identifies the taker order/account being filled, for fill instructions. */
|
|
1328
1915
|
export type TakerInfo = {
|
|
1329
1916
|
taker: PublicKey;
|
|
1330
1917
|
takerStats: PublicKey;
|
|
1331
1918
|
takerUserAccount: UserAccount;
|
|
1332
1919
|
order: Order;
|
|
1333
1920
|
};
|
|
1921
|
+
/** Referrer accounts to pass into an instruction so the referrer's reward can be credited. */
|
|
1334
1922
|
export type ReferrerInfo = {
|
|
1335
1923
|
referrer: PublicKey;
|
|
1336
1924
|
referrerStats: PublicKey;
|
|
1337
1925
|
};
|
|
1926
|
+
/** Bitmask mirror of `UserStatsAccount.referrerStatus`. */
|
|
1338
1927
|
export declare enum ReferrerStatus {
|
|
1339
1928
|
IsReferrer = 1,
|
|
1340
1929
|
IsReferred = 2,
|
|
1341
1930
|
/** set when the user's RevenueShareEscrow was initialized with a referrer */
|
|
1342
1931
|
BuilderReferral = 4
|
|
1343
1932
|
}
|
|
1933
|
+
/** Which fill outcome counts as "success" for a `placeAndTake*` instruction's on-chain success check. */
|
|
1344
1934
|
export declare enum PlaceAndTakeOrderSuccessCondition {
|
|
1345
1935
|
PartialFill = 1,
|
|
1346
1936
|
FullFill = 2
|
|
1347
1937
|
}
|
|
1348
1938
|
type ExactType<T> = Pick<T, keyof T>;
|
|
1939
|
+
/** Compute-budget overrides accepted by SDK transaction-building helpers. Omit either field to let the SDK compute/skip it. */
|
|
1349
1940
|
export type BaseTxParams = ExactType<{
|
|
1941
|
+
/** explicit compute-unit limit to request; if omitted, may be derived via simulation (see `ProcessingTxParams`) */
|
|
1350
1942
|
computeUnits?: number;
|
|
1943
|
+
/** micro-lamports per compute unit for the priority fee */
|
|
1351
1944
|
computeUnitsPrice?: number;
|
|
1352
1945
|
}>;
|
|
1946
|
+
/** Controls how the SDK derives compute-unit limit/price when not explicitly given in `BaseTxParams`. */
|
|
1353
1947
|
export type ProcessingTxParams = {
|
|
1948
|
+
/** simulate the transaction to determine the compute-unit limit instead of using a static estimate */
|
|
1354
1949
|
useSimulatedComputeUnits?: boolean;
|
|
1950
|
+
/** multiplier applied to the simulated/estimated compute-unit count to leave headroom, e.g. 1.2 = +20% */
|
|
1355
1951
|
computeUnitsBufferMultiplier?: number;
|
|
1952
|
+
/** also use the simulated compute-unit count (rather than the static estimate) as the basis for `getCUPriceFromComputeUnits` */
|
|
1356
1953
|
useSimulatedComputeUnitsForCUPriceCalculation?: boolean;
|
|
1954
|
+
/** custom function mapping a compute-unit count to a compute-unit price (micro-lamports); overrides `computeUnitsPrice` */
|
|
1357
1955
|
getCUPriceFromComputeUnits?: (computeUnits: number) => number;
|
|
1956
|
+
/** floor applied to the computed/simulated compute-unit count before requesting a limit */
|
|
1358
1957
|
lowerBoundCu?: number;
|
|
1359
1958
|
};
|
|
1959
|
+
/** Combined compute-budget + compute-unit-derivation options accepted by SDK transaction-building helpers. */
|
|
1360
1960
|
export type TxParams = BaseTxParams & ProcessingTxParams;
|
|
1961
|
+
/** For `beginSwap`/`endSwap`, whether the reduce-only constraint applies to the `In` (source) or `Out` (destination) side of the swap. */
|
|
1361
1962
|
export declare class SwapReduceOnly {
|
|
1362
1963
|
static readonly In: {
|
|
1363
1964
|
in: {};
|
|
@@ -1366,6 +1967,7 @@ export declare class SwapReduceOnly {
|
|
|
1366
1967
|
out: {};
|
|
1367
1968
|
};
|
|
1368
1969
|
}
|
|
1970
|
+
/** Minimal wallet adapter the SDK requires for legacy (non-versioned) transaction signing. */
|
|
1369
1971
|
export interface IWallet {
|
|
1370
1972
|
signTransaction(tx: Transaction): Promise<Transaction>;
|
|
1371
1973
|
signAllTransactions(txs: Transaction[]): Promise<Transaction[]>;
|
|
@@ -1373,49 +1975,72 @@ export interface IWallet {
|
|
|
1373
1975
|
payer?: Keypair;
|
|
1374
1976
|
supportedTransactionVersions?: ReadonlySet<TransactionVersion> | null | undefined;
|
|
1375
1977
|
}
|
|
1978
|
+
/** Wallet adapter capable of signing versioned transactions (v0 message format). */
|
|
1376
1979
|
export interface IVersionedWallet {
|
|
1377
1980
|
signVersionedTransaction(tx: VersionedTransaction): Promise<VersionedTransaction>;
|
|
1378
1981
|
signAllVersionedTransactions(txs: VersionedTransaction[]): Promise<VersionedTransaction[]>;
|
|
1379
1982
|
publicKey: PublicKey;
|
|
1380
1983
|
payer?: Keypair;
|
|
1381
1984
|
}
|
|
1985
|
+
/** `IWallet` extended with arbitrary-message signing (used for signed-msg/swift order flows). */
|
|
1382
1986
|
export interface IWalletV2 extends IWallet {
|
|
1383
1987
|
signMessage(message: Uint8Array): Promise<Uint8Array>;
|
|
1384
1988
|
}
|
|
1989
|
+
/** The fee schedule applied to fills in a market category (perp or spot); decoded from `StateAccount.perpFeeStructure`/`spotFeeStructure`. */
|
|
1385
1990
|
export type FeeStructure = {
|
|
1991
|
+
/** volume-based fee tiers, evaluated by the taker's 30-day volume; tier 0 is the base/default tier */
|
|
1386
1992
|
feeTiers: FeeTier[];
|
|
1387
1993
|
fillerRewardStructure: OrderFillerRewardStructure;
|
|
1994
|
+
/** flat portion of the filler (keeper) reward, QUOTE_PRECISION (1e6) */
|
|
1388
1995
|
flatFillerFee: BN;
|
|
1996
|
+
/** FEE_PERCENTAGE_DENOMINATOR (100)-denominated share of the trade-fee remainder provisioned to the AMM as its backstop-of-last-resort tranche; `ammFeeNumerator + ifFeeNumerator` must be <= 100, the protocol keeps the residual */
|
|
1389
1997
|
ammFeeNumerator: number;
|
|
1998
|
+
/** FEE_PERCENTAGE_DENOMINATOR (100)-denominated share of the trade-fee remainder routed to the insurance fund */
|
|
1390
1999
|
ifFeeNumerator: number;
|
|
1391
2000
|
};
|
|
2001
|
+
/** One volume tier of a `FeeStructure`. All `*Numerator`/`*Denominator` pairs form a fraction (e.g. `feeNumerator / feeDenominator`). */
|
|
1392
2002
|
export type FeeTier = {
|
|
2003
|
+
/** taker fee rate */
|
|
1393
2004
|
feeNumerator: number;
|
|
1394
2005
|
feeDenominator: number;
|
|
2006
|
+
/** rebate paid to the resting maker */
|
|
1395
2007
|
makerRebateNumerator: number;
|
|
1396
2008
|
makerRebateDenominator: number;
|
|
2009
|
+
/** share of the taker fee credited to the taker's referrer */
|
|
1397
2010
|
referrerRewardNumerator: number;
|
|
1398
2011
|
referrerRewardDenominator: number;
|
|
2012
|
+
/** discount applied to the taker's own fee when they were referred */
|
|
1399
2013
|
refereeFeeNumerator: number;
|
|
1400
2014
|
refereeFeeDenominator: number;
|
|
1401
2015
|
};
|
|
2016
|
+
/** The reward paid to the keeper (filler) that submits a fill transaction. */
|
|
1402
2017
|
export type OrderFillerRewardStructure = {
|
|
2018
|
+
/** share of the fill's fee/size paid as a variable reward */
|
|
1403
2019
|
rewardNumerator: number;
|
|
1404
2020
|
rewardDenominator: number;
|
|
2021
|
+
/** QUOTE_PRECISION (1e6); floor below which the time-based reward component doesn't apply */
|
|
1405
2022
|
timeBasedRewardLowerBound: BN;
|
|
1406
2023
|
};
|
|
2024
|
+
/** Protocol-wide oracle safety thresholds (`StateAccount.oracleGuardRails`), gating how far an oracle price may diverge from mark and how stale/uncertain it may be before it's rejected for a given action. */
|
|
1407
2025
|
export type OracleGuardRails = {
|
|
1408
2026
|
priceDivergence: {
|
|
2027
|
+
/** PERCENTAGE_PRECISION (1e6); max allowed |mark − oracle| / oracle before divergence checks reject the price */
|
|
1409
2028
|
markOraclePercentDivergence: BN;
|
|
2029
|
+
/** PERCENTAGE_PRECISION (1e6); max allowed divergence between the oracle's live price and its 5-minute TWAP */
|
|
1410
2030
|
oracleTwap5MinPercentDivergence: BN;
|
|
1411
2031
|
};
|
|
1412
2032
|
validity: {
|
|
2033
|
+
/** slots; oracle updates older than this are stale for AMM-facing actions */
|
|
1413
2034
|
slotsBeforeStaleForAmm: BN;
|
|
2035
|
+
/** slots; oracle updates older than this are stale for margin/liquidation actions */
|
|
1414
2036
|
slotsBeforeStaleForMargin: BN;
|
|
2037
|
+
/** PERCENTAGE_PRECISION (1e6)-scaled fraction of price; oracle confidence intervals wider than this are rejected */
|
|
1415
2038
|
confidenceIntervalMaxSize: BN;
|
|
2039
|
+
/** oracle price moves within one update exceeding this multiple of the recent range are rejected as "too volatile" */
|
|
1416
2040
|
tooVolatileRatio: BN;
|
|
1417
2041
|
};
|
|
1418
2042
|
};
|
|
2043
|
+
/** Result of the oracle validity check (`is_oracle_valid_for_action` and friends). Only `Valid` (7) permits using the price; every other variant identifies the specific failure so callers can gate accordingly (stale-for-margin still permits AMM-only actions, etc.). */
|
|
1419
2044
|
export declare enum OracleValidity {
|
|
1420
2045
|
NonPositive = 0,
|
|
1421
2046
|
TooVolatile = 1,
|
|
@@ -1426,19 +2051,27 @@ export declare enum OracleValidity {
|
|
|
1426
2051
|
isStaleForAmmImmediate = 6,
|
|
1427
2052
|
Valid = 7
|
|
1428
2053
|
}
|
|
2054
|
+
/** Decoded mirror of a `PrelaunchOracle` account — an admin-fed synthetic price feed used before a market has a real external oracle (`OracleSource.Prelaunch`). */
|
|
1429
2055
|
export type PrelaunchOracle = {
|
|
2056
|
+
/** PRICE_PRECISION (1e6) */
|
|
1430
2057
|
price: BN;
|
|
2058
|
+
/** PRICE_PRECISION (1e6); ceiling the admin-set price is clamped to */
|
|
1431
2059
|
maxPrice: BN;
|
|
2060
|
+
/** PRICE_PRECISION (1e6) */
|
|
1432
2061
|
confidence: BN;
|
|
1433
2062
|
ammLastUpdateSlot: BN;
|
|
1434
2063
|
lastUpdateSlot: BN;
|
|
1435
2064
|
perpMarketIndex: number;
|
|
1436
2065
|
};
|
|
2066
|
+
/** Admin instruction params for updating a `PrelaunchOracle`; `null` fields leave the current on-chain value unchanged. */
|
|
1437
2067
|
export type PrelaunchOracleParams = {
|
|
1438
2068
|
perpMarketIndex: number;
|
|
2069
|
+
/** PRICE_PRECISION (1e6) */
|
|
1439
2070
|
price: BN | null;
|
|
2071
|
+
/** PRICE_PRECISION (1e6) */
|
|
1440
2072
|
maxPrice: BN | null;
|
|
1441
2073
|
};
|
|
2074
|
+
/** Decoded mirror of a Pyth Lazer oracle account. `price`/`conf` are in the feed's native `exponent` (a power-of-ten scale factor, typically negative), not a fixed SDK precision — divide by `10^-exponent` to get the human-readable price. */
|
|
1442
2075
|
export type PythLazerOracle = {
|
|
1443
2076
|
price: BN;
|
|
1444
2077
|
publishTime: BN;
|
|
@@ -1446,28 +2079,43 @@ export type PythLazerOracle = {
|
|
|
1446
2079
|
exponent: number;
|
|
1447
2080
|
conf: BN;
|
|
1448
2081
|
};
|
|
2082
|
+
/** Admin instruction params for correcting a perp market's cached AMM summary stats; `null` fields leave the current on-chain value unchanged. */
|
|
1449
2083
|
export type UpdatePerpMarketSummaryStatsParams = {
|
|
2084
|
+
/** QUOTE_PRECISION (1e6) */
|
|
1450
2085
|
netUnsettledFundingPnl: BN | null;
|
|
1451
2086
|
updateAmmSummaryStats: boolean | null;
|
|
1452
2087
|
};
|
|
1453
|
-
|
|
2088
|
+
/**
|
|
2089
|
+
* Which margin requirement a calculation is being performed for, mirroring the program's
|
|
2090
|
+
* `MarginRequirementType`: `'Initial'` (opening/maintaining leverage headroom), `'Maintenance'`
|
|
2091
|
+
* (liquidation), or `'Fill'` (fill-time check — weights/ratios are the integer-averaged midpoint
|
|
2092
|
+
* of initial and maintenance).
|
|
2093
|
+
*/
|
|
2094
|
+
export type MarginCategory = 'Initial' | 'Maintenance' | 'Fill';
|
|
2095
|
+
/** Decoded mirror of the on-chain `InsuranceFundStake` account: one user's stake in one spot market's insurance fund. */
|
|
1454
2096
|
export type InsuranceFundStake = {
|
|
2097
|
+
/** signed, spot market token-mint precision; tracks the staker's cost basis for pnl reporting */
|
|
1455
2098
|
costBasis: BN;
|
|
1456
2099
|
marketIndex: number;
|
|
1457
2100
|
authority: PublicKey;
|
|
2101
|
+
/** the staker's share count; multiply by the IF's share price to get token value */
|
|
1458
2102
|
ifShares: BN;
|
|
2103
|
+
/** exponent used to rebase `ifShares` in step with `InsuranceFund.sharesBase` */
|
|
1459
2104
|
ifBase: BN;
|
|
1460
2105
|
lastValidTs: BN;
|
|
1461
2106
|
lastWithdrawRequestShares: BN;
|
|
2107
|
+
/** spot market token-mint precision value of `lastWithdrawRequestShares` at request time */
|
|
1462
2108
|
lastWithdrawRequestValue: BN;
|
|
1463
2109
|
lastWithdrawRequestTs: BN;
|
|
1464
2110
|
};
|
|
2111
|
+
/** Decoded mirror of a `ReferrerName` account, mapping a human-readable referrer name to its user/authority. */
|
|
1465
2112
|
export type ReferrerNameAccount = {
|
|
1466
2113
|
name: number[];
|
|
1467
2114
|
user: PublicKey;
|
|
1468
2115
|
authority: PublicKey;
|
|
1469
2116
|
userStats: PublicKey;
|
|
1470
2117
|
};
|
|
2118
|
+
/** SDK-computed convenience summary of a perp market's order-size/margin/insurance limits, derived from `PerpMarketAccount` (not decoded directly from a single on-chain field). */
|
|
1471
2119
|
export type PerpMarketExtendedInfo = {
|
|
1472
2120
|
marketIndex: number;
|
|
1473
2121
|
/**
|
|
@@ -1489,29 +2137,38 @@ export type PerpMarketExtendedInfo = {
|
|
|
1489
2137
|
pnlPoolValue: BN;
|
|
1490
2138
|
contractTier: ContractTier;
|
|
1491
2139
|
};
|
|
2140
|
+
/** SDK-computed breakdown of a user's margin-health calculation, grouped by contribution type; each group is a list of the individual `HealthComponent`s that summed into the account's total collateral/margin requirement. */
|
|
1492
2141
|
export type HealthComponents = {
|
|
1493
2142
|
deposits: HealthComponent[];
|
|
1494
2143
|
borrows: HealthComponent[];
|
|
1495
2144
|
perpPositions: HealthComponent[];
|
|
1496
2145
|
perpPnl: HealthComponent[];
|
|
1497
2146
|
};
|
|
2147
|
+
/** One market's contribution to a `HealthComponents` group. */
|
|
1498
2148
|
export type HealthComponent = {
|
|
1499
2149
|
marketIndex: number;
|
|
2150
|
+
/** perp: signed BASE_PRECISION (1e9) position size; spot: signed token-mint-precision balance */
|
|
1500
2151
|
size: BN;
|
|
2152
|
+
/** unweighted USD value, QUOTE_PRECISION (1e6) */
|
|
1501
2153
|
value: BN;
|
|
2154
|
+
/** the asset/liability weight applied, SPOT_WEIGHT_PRECISION or MARGIN_PRECISION (1e4) depending on component type */
|
|
1502
2155
|
weight: BN;
|
|
2156
|
+
/** `value` after applying `weight`, QUOTE_PRECISION (1e6); this is what's actually summed into total collateral/margin requirement */
|
|
1503
2157
|
weightedValue: BN;
|
|
1504
2158
|
};
|
|
2159
|
+
/** Event map for `VelocityClient`'s internal metrics emitter. */
|
|
1505
2160
|
export interface VelocityClientMetricsEvents {
|
|
1506
2161
|
txSigned: SignedTxData[];
|
|
1507
2162
|
preTxSigned: void;
|
|
1508
2163
|
}
|
|
2164
|
+
/** A transaction the SDK has signed, returned by transaction-sending helpers before/instead of submission. */
|
|
1509
2165
|
export type SignedTxData = {
|
|
1510
2166
|
txSig: string;
|
|
1511
2167
|
signedTx: Transaction | VersionedTransaction;
|
|
1512
2168
|
lastValidBlockHeight?: number;
|
|
1513
2169
|
blockHash: string;
|
|
1514
2170
|
};
|
|
2171
|
+
/** Proof of a signed-msg (swift) taker order, submitted to the program to fill it. */
|
|
1515
2172
|
export interface SignedMsgOrderParams {
|
|
1516
2173
|
/**
|
|
1517
2174
|
* The encoded order params that were signed (borsh encoded then hexified).
|
|
@@ -1522,229 +2179,342 @@ export interface SignedMsgOrderParams {
|
|
|
1522
2179
|
*/
|
|
1523
2180
|
signature: Buffer;
|
|
1524
2181
|
}
|
|
2182
|
+
/** One slot of a `SignedMsgUserOrdersAccount`, recording a signed-msg order's validity window and dedupe key so a replayed/expired signed message can be rejected without an extra RPC round-trip. */
|
|
1525
2183
|
export type SignedMsgOrderId = {
|
|
2184
|
+
/** slot after which this signed message is no longer eligible to be placed */
|
|
1526
2185
|
maxSlot: BN;
|
|
1527
2186
|
uuid: Uint8Array;
|
|
1528
2187
|
orderId: number;
|
|
1529
2188
|
};
|
|
2189
|
+
/** Per-authority account tracking recently-seen signed-msg order UUIDs, used to detect replay/duplicate submission of the same signed message. */
|
|
1530
2190
|
export type SignedMsgUserOrdersAccount = {
|
|
1531
2191
|
authorityPubkey: PublicKey;
|
|
1532
2192
|
signedMsgOrderData: SignedMsgOrderId[];
|
|
1533
2193
|
};
|
|
2194
|
+
/** Account listing the delegate keys authorized to submit signed-msg orders over the swift websocket on a user's behalf. */
|
|
1534
2195
|
export type SignedMsgWsDelegatesAccount = {
|
|
1535
2196
|
delegates: PublicKey[];
|
|
1536
2197
|
};
|
|
2198
|
+
/** Decoded mirror of the on-chain `RevenueShare` account: one per builder/referrer, accumulating their lifetime rewards. */
|
|
1537
2199
|
export type RevenueShareAccount = {
|
|
2200
|
+
/** the builder or referrer that owns this account */
|
|
1538
2201
|
authority: PublicKey;
|
|
2202
|
+
/** QUOTE_PRECISION (1e6) */
|
|
1539
2203
|
totalReferrerRewards: BN;
|
|
2204
|
+
/** QUOTE_PRECISION (1e6) */
|
|
1540
2205
|
totalBuilderRewards: BN;
|
|
1541
2206
|
padding: number[];
|
|
1542
2207
|
};
|
|
2208
|
+
/** Decoded mirror of the on-chain `RevenueShareEscrow` account: one per trading user, holding their referrer link, approved builder codes, and in-flight per-order fee accruals awaiting settlement. Required in remaining accounts when filling an order with a builder code or a referred taker (see `TakerInfo`/fill-instruction docs). */
|
|
1543
2209
|
export type RevenueShareEscrowAccount = {
|
|
2210
|
+
/** the user that owns this escrow */
|
|
1544
2211
|
authority: PublicKey;
|
|
1545
2212
|
referrer: PublicKey;
|
|
1546
2213
|
reservedFixed: number[];
|
|
2214
|
+
/** ring-buffer of in-flight order fee accruals, settled into the builder's/referrer's `RevenueShareAccount` on settle-PnL */
|
|
1547
2215
|
orders: RevenueShareOrder[];
|
|
2216
|
+
/** builders this user has approved to charge a fee, indexed by `builderIdx` on `OrderParams`/`RevenueShareOrder` */
|
|
1548
2217
|
approvedBuilders: BuilderInfo[];
|
|
1549
2218
|
};
|
|
2219
|
+
/** One in-flight order's accrued builder/referral fee inside a `RevenueShareEscrowAccount`. */
|
|
1550
2220
|
export type RevenueShareOrder = {
|
|
2221
|
+
/** QUOTE_PRECISION (1e6); accrued so far for this slot — may include fees from other orders that reused the same slot, not exclusively `orderId` */
|
|
1551
2222
|
feesAccrued: BN;
|
|
2223
|
+
/** the currently-active order's id in this slot; only meaningful while the slot is open */
|
|
1552
2224
|
orderId: number;
|
|
2225
|
+
/** builder fee on this order, in tenths of a bps, e.g. 100 = 0.01% */
|
|
1553
2226
|
feeTenthBps: number;
|
|
1554
2227
|
marketIndex: number;
|
|
2228
|
+
/** only meaningful while the slot is open */
|
|
1555
2229
|
subAccountId: number;
|
|
2230
|
+
/** index into `RevenueShareEscrowAccount.approvedBuilders` this order's fee settles to; ignored for a referral-only slot */
|
|
1556
2231
|
builderIdx: number;
|
|
2232
|
+
/** bitflags describing slot state (init/open/completed) and whether it holds referral rewards rather than a builder fee */
|
|
1557
2233
|
bitFlags: number;
|
|
1558
2234
|
userOrderIndex: number;
|
|
1559
2235
|
marketType: MarketType;
|
|
1560
2236
|
padding: number[];
|
|
1561
2237
|
};
|
|
2238
|
+
/** One builder a user has approved to charge a fee on their orders, inside `RevenueShareEscrowAccount.approvedBuilders`. */
|
|
1562
2239
|
export type BuilderInfo = {
|
|
2240
|
+
/** the builder's authority */
|
|
1563
2241
|
authority: PublicKey;
|
|
2242
|
+
/** ceiling on the fee (tenths of a bps) this builder may charge; `0` means the approval has been revoked */
|
|
1564
2243
|
maxFeeTenthBps: number;
|
|
1565
2244
|
padding: number[];
|
|
1566
2245
|
};
|
|
2246
|
+
/** Emitted when a perp market's fee-ledger pendings are swept into their durable homes (protocol fee pool, quote market revenue pool, AMM fee pool). */
|
|
1567
2247
|
export type PerpMarketFeeSweepRecord = {
|
|
1568
2248
|
ts: BN;
|
|
1569
2249
|
marketIndex: number;
|
|
2250
|
+
/** pending insurance cut moved to the quote spot market's revenue pool, QUOTE_PRECISION (1e6) */
|
|
1570
2251
|
ifSwept: BN;
|
|
2252
|
+
/** pending protocol cut moved to the market's protocol fee pool, QUOTE_PRECISION (1e6) */
|
|
1571
2253
|
protocolSwept: BN;
|
|
2254
|
+
/** AMM fee provision (booked at fill) tokenized into `AMM.feePool`, QUOTE_PRECISION (1e6) */
|
|
1572
2255
|
ammProvisionTokenized: BN;
|
|
1573
2256
|
};
|
|
2257
|
+
/** Emitted when `coldAdmin` withdraws accumulated protocol fees to the configured recipient. */
|
|
1574
2258
|
export type ProtocolFeeWithdrawRecord = {
|
|
1575
2259
|
ts: BN;
|
|
2260
|
+
/** perp market index for a perp-fee withdrawal, else the spot market index */
|
|
1576
2261
|
marketIndex: number;
|
|
2262
|
+
/** true if this withdrawal drained a perp market's `protocolFeePool` (sourced from the quote spot vault); false for a spot market withdrawal */
|
|
1577
2263
|
isPerp: boolean;
|
|
2264
|
+
/** the spot market the tokens were drawn from */
|
|
1578
2265
|
spotMarketIndex: number;
|
|
2266
|
+
/** spot market token-mint precision */
|
|
1579
2267
|
amount: BN;
|
|
1580
2268
|
recipientTokenAccount: PublicKey;
|
|
1581
2269
|
};
|
|
2270
|
+
/** Emitted when a builder's/referrer's accrued `RevenueShareOrder` fees are settled into their `RevenueShareAccount`. */
|
|
1582
2271
|
export type RevenueShareSettleRecord = {
|
|
1583
2272
|
ts: BN;
|
|
2273
|
+
/** set when this settle paid a builder fee */
|
|
1584
2274
|
builder: PublicKey | null;
|
|
2275
|
+
/** set when this settle paid a referral reward */
|
|
1585
2276
|
referrer: PublicKey | null;
|
|
2277
|
+
/** QUOTE_PRECISION (1e6) */
|
|
1586
2278
|
feeSettled: BN;
|
|
1587
2279
|
marketIndex: number;
|
|
1588
2280
|
marketType: MarketType;
|
|
2281
|
+
/** the builder's `RevenueShareAccount.totalReferrerRewards` after this settle, QUOTE_PRECISION (1e6) */
|
|
1589
2282
|
builderTotalReferrerRewards: BN;
|
|
2283
|
+
/** the builder's `RevenueShareAccount.totalBuilderRewards` after this settle, QUOTE_PRECISION (1e6) */
|
|
1590
2284
|
builderTotalBuilderRewards: BN;
|
|
1591
2285
|
builderSubAccountId: number;
|
|
1592
2286
|
};
|
|
2287
|
+
/** Admin instruction params to add one constituent's weight in a perp market's AMM constituent mapping (used to route hedge flow). */
|
|
1593
2288
|
export type AddAmmConstituentMappingDatum = {
|
|
1594
2289
|
constituentIndex: number;
|
|
1595
2290
|
perpMarketIndex: number;
|
|
2291
|
+
/** PERCENTAGE_PRECISION (1e6) */
|
|
1596
2292
|
weight: BN;
|
|
1597
2293
|
};
|
|
2294
|
+
/** One entry of an `AmmConstituentMapping`, weighting how much of a perp market's hedge flow routes to a given LP-pool constituent. */
|
|
1598
2295
|
export type AmmConstituentDatum = AddAmmConstituentMappingDatum & {
|
|
1599
2296
|
lastSlot: BN;
|
|
1600
2297
|
};
|
|
2298
|
+
/** Decoded mirror of the `AmmConstituentMapping` account: which LP-pool constituents each perp market hedges into, and by how much. */
|
|
1601
2299
|
export type AmmConstituentMapping = {
|
|
1602
2300
|
lpPool: PublicKey;
|
|
1603
2301
|
bump: number;
|
|
1604
2302
|
weights: AmmConstituentDatum[];
|
|
1605
2303
|
};
|
|
2304
|
+
/** One perp market's target-hedge-position entry inside a `ConstituentTargetBaseAccount`. */
|
|
1606
2305
|
export type TargetDatum = {
|
|
2306
|
+
/** bps; estimated cost to trade into/out of the target position */
|
|
1607
2307
|
costToTradeBps: number;
|
|
1608
2308
|
lastOracleSlot: BN;
|
|
1609
2309
|
lastPositionSlot: BN;
|
|
2310
|
+
/** BASE_PRECISION (1e9); the target hedge position size */
|
|
1610
2311
|
targetBase: BN;
|
|
1611
2312
|
};
|
|
2313
|
+
/** Decoded mirror of the `ConstituentTargetBase` account: the LP pool's per-perp-market target hedge positions. */
|
|
1612
2314
|
export type ConstituentTargetBaseAccount = {
|
|
1613
2315
|
lpPool: PublicKey;
|
|
1614
2316
|
bump: number;
|
|
1615
2317
|
targets: TargetDatum[];
|
|
1616
2318
|
};
|
|
2319
|
+
/** Decoded mirror of the `ConstituentCorrelations` account: pairwise correlation coefficients between an LP pool's constituents, used in swap-fee pricing. */
|
|
1617
2320
|
export type ConstituentCorrelations = {
|
|
1618
2321
|
lpPool: PublicKey;
|
|
1619
2322
|
bump: number;
|
|
2323
|
+
/** PERCENTAGE_PRECISION (1e6), signed; flattened row-major correlation matrix */
|
|
1620
2324
|
correlations: BN[];
|
|
1621
2325
|
};
|
|
2326
|
+
/** Decoded mirror of the on-chain `LPPool` account: a hedging vault that mints/redeems LP tokens against a basket of spot-market constituents and hedges perp-market exposure. */
|
|
1622
2327
|
export type LPPoolAccount = {
|
|
1623
2328
|
lpPoolId: number;
|
|
1624
2329
|
pubkey: PublicKey;
|
|
2330
|
+
/** the LP token mint */
|
|
1625
2331
|
mint: PublicKey;
|
|
1626
2332
|
whitelistMint: PublicKey;
|
|
1627
2333
|
constituentTargetBase: PublicKey;
|
|
1628
2334
|
constituentCorrelations: PublicKey;
|
|
2335
|
+
/** QUOTE_PRECISION (1e6); mint requests that would push AUM above this are rejected */
|
|
1629
2336
|
maxAum: BN;
|
|
2337
|
+
/** QUOTE_PRECISION (1e6); AUM of the vault in USD, updated lazily */
|
|
1630
2338
|
lastAum: BN;
|
|
2339
|
+
/** QUOTE_PRECISION (1e6) */
|
|
1631
2340
|
cumulativeQuoteSentToPerpMarkets: BN;
|
|
2341
|
+
/** QUOTE_PRECISION (1e6) */
|
|
1632
2342
|
cumulativeQuoteReceivedFromPerpMarkets: BN;
|
|
2343
|
+
/** signed, QUOTE_PRECISION (1e6); total fees paid for minting and redeeming LP tokens */
|
|
1633
2344
|
totalMintRedeemFeesPaid: BN;
|
|
1634
2345
|
lastAumSlot: BN;
|
|
2346
|
+
/** token-mint precision cap on a single settle's quote transfer */
|
|
1635
2347
|
maxSettleQuoteAmount: BN;
|
|
1636
2348
|
mintRedeemId: BN;
|
|
1637
2349
|
settleId: BN;
|
|
2350
|
+
/** PERCENTAGE_PRECISION (1e6); floor fee charged on mint/redeem */
|
|
1638
2351
|
minMintFee: BN;
|
|
2352
|
+
/** LP token precision; the LP mint's total supply */
|
|
1639
2353
|
tokenSupply: BN;
|
|
2354
|
+
/** PERCENTAGE_PRECISION (1e6); pool-wide volatility parameter feeding swap-fee/target pricing */
|
|
1640
2355
|
volatility: BN;
|
|
1641
2356
|
constituents: number;
|
|
1642
|
-
|
|
2357
|
+
quoteConsituentIndex: number;
|
|
1643
2358
|
bump: number;
|
|
2359
|
+
/** no precision — a raw constant used in swap-fee execution-cost pricing */
|
|
1644
2360
|
gammaExecution: number;
|
|
2361
|
+
/** no precision — a raw constant used in swap-fee pricing */
|
|
1645
2362
|
xi: number;
|
|
2363
|
+
/** bps of fee per 10 slots of oracle-target delay */
|
|
1646
2364
|
targetOracleDelayFeeBpsPer10Slots: number;
|
|
2365
|
+
/** bps of fee per 10 slots of position-target delay */
|
|
1647
2366
|
targetPositionDelayFeeBpsPer10Slots: number;
|
|
1648
2367
|
};
|
|
2368
|
+
/** A constituent's spot-market balance inside an LP pool (parallel to `PoolBalance` but tracking cumulative deposits too). */
|
|
1649
2369
|
export type ConstituentSpotBalance = {
|
|
2370
|
+
/** SPOT_BALANCE_PRECISION (1e9) scaled balance */
|
|
1650
2371
|
scaledBalance: BN;
|
|
2372
|
+
/** token mint precision */
|
|
1651
2373
|
cumulativeDeposits: BN;
|
|
1652
2374
|
marketIndex: number;
|
|
1653
2375
|
balanceType: SpotBalanceType;
|
|
1654
2376
|
};
|
|
2377
|
+
/** Admin instruction params for `initializeConstituent`, configuring a new LP-pool spot-market constituent. */
|
|
1655
2378
|
export type InitializeConstituentParams = {
|
|
1656
2379
|
spotMarketIndex: number;
|
|
1657
2380
|
decimals: number;
|
|
2381
|
+
/** PERCENTAGE_PRECISION (1e6); max allowed deviation from target weight before rebalance pressure kicks in */
|
|
1658
2382
|
maxWeightDeviation: BN;
|
|
2383
|
+
/** PERCENTAGE_PRECISION (1e6) */
|
|
1659
2384
|
swapFeeMin: BN;
|
|
2385
|
+
/** PERCENTAGE_PRECISION (1e6) */
|
|
1660
2386
|
swapFeeMax: BN;
|
|
2387
|
+
/** token mint precision; borrow cap for this constituent */
|
|
1661
2388
|
maxBorrowTokenAmount: BN;
|
|
2389
|
+
/** slots; oracle updates older than this are treated as stale for this constituent */
|
|
1662
2390
|
oracleStalenessThreshold: BN;
|
|
2391
|
+
/** bps; estimated cost to trade this constituent */
|
|
1663
2392
|
costToTrade: number;
|
|
2393
|
+
/** PERCENTAGE_PRECISION (1e6); weight applied when this constituent derives its price from another constituent */
|
|
1664
2394
|
derivativeWeight: BN;
|
|
1665
2395
|
constituentDerivativeIndex?: number;
|
|
2396
|
+
/** PERCENTAGE_PRECISION (1e6); max allowed depeg from the derivative reference before the constituent is treated as broken */
|
|
1666
2397
|
constituentDerivativeDepegThreshold?: BN;
|
|
2398
|
+
/** PERCENTAGE_PRECISION (1e6), signed; this constituent's correlation with every other constituent */
|
|
1667
2399
|
constituentCorrelations: BN[];
|
|
2400
|
+
/** PERCENTAGE_PRECISION (1e6) */
|
|
1668
2401
|
volatility: BN;
|
|
1669
2402
|
gammaExecution?: number;
|
|
1670
2403
|
gammaInventory?: number;
|
|
1671
2404
|
xi?: number;
|
|
1672
2405
|
};
|
|
2406
|
+
/** Lifecycle status of an LP-pool `ConstituentAccount`. */
|
|
1673
2407
|
export declare enum ConstituentStatus {
|
|
1674
2408
|
ACTIVE = 0,
|
|
2409
|
+
/** may only shrink toward its target weight, not grow */
|
|
1675
2410
|
REDUCE_ONLY = 1,
|
|
1676
2411
|
DECOMMISSIONED = 2
|
|
1677
2412
|
}
|
|
2413
|
+
/** Bitmask mirror of `ConstituentAccount.pausedOperations`, gating which LP-pool operations a constituent allows. */
|
|
1678
2414
|
export declare enum ConstituentLpOperation {
|
|
1679
2415
|
Swap = 1,
|
|
1680
2416
|
Deposit = 2,
|
|
1681
2417
|
Withdraw = 4
|
|
1682
2418
|
}
|
|
2419
|
+
/** Decoded mirror of the on-chain `Constituent` account: one spot-market asset inside an LP pool's basket. */
|
|
1683
2420
|
export type ConstituentAccount = {
|
|
1684
2421
|
pubkey: PublicKey;
|
|
1685
2422
|
mint: PublicKey;
|
|
1686
2423
|
lpPool: PublicKey;
|
|
1687
2424
|
vault: PublicKey;
|
|
2425
|
+
/** signed, positive = fees received, negative = fees paid; PERCENTAGE_PRECISION-derived token units */
|
|
1688
2426
|
totalSwapFees: BN;
|
|
1689
2427
|
spotBalance: ConstituentSpotBalance;
|
|
2428
|
+
/** token mint precision */
|
|
1690
2429
|
lastSpotBalanceTokenAmount: BN;
|
|
2430
|
+
/** token mint precision */
|
|
1691
2431
|
cumulativeSpotInterestAccruedTokenAmount: BN;
|
|
2432
|
+
/** PERCENTAGE_PRECISION (1e6); max allowed deviation from target weight */
|
|
1692
2433
|
maxWeightDeviation: BN;
|
|
2434
|
+
/** PERCENTAGE_PRECISION (1e6); min fee charged on swaps to/from this constituent */
|
|
1693
2435
|
swapFeeMin: BN;
|
|
2436
|
+
/** PERCENTAGE_PRECISION (1e6); max fee charged on swaps to/from this constituent */
|
|
1694
2437
|
swapFeeMax: BN;
|
|
2438
|
+
/** token mint precision */
|
|
1695
2439
|
maxBorrowTokenAmount: BN;
|
|
2440
|
+
/** token mint precision; the vault's actual token account balance */
|
|
1696
2441
|
vaultTokenBalance: BN;
|
|
1697
2442
|
lastOraclePrice: BN;
|
|
1698
2443
|
lastOracleSlot: BN;
|
|
2444
|
+
/** slots; delay allowed for a valid AUM calculation before this constituent's price is considered stale */
|
|
1699
2445
|
oracleStalenessThreshold: BN;
|
|
2446
|
+
/** token mint precision; user's token balance snapshotted at `beginSwap`-style flash accounting */
|
|
1700
2447
|
flashLoanInitialTokenAmount: BN;
|
|
1701
2448
|
nextSwapId: BN;
|
|
2449
|
+
/** PERCENTAGE_PRECISION (1e6); share of derivative weight routed to this constituent specifically; 0 if this constituent has no derivative weight */
|
|
1702
2450
|
derivativeWeight: BN;
|
|
2451
|
+
/** PERCENTAGE_PRECISION (1e6); 1 = 1% */
|
|
1703
2452
|
volatility: BN;
|
|
2453
|
+
/** PERCENTAGE_PRECISION (1e6); max allowed depeg from the parent constituent before this derivative is treated as broken */
|
|
1704
2454
|
constituentDerivativeDepegThreshold: BN;
|
|
2455
|
+
/** the parent constituent's index if this is a derivative (e.g. dSOL -> SOL); -1 if this constituent is itself a parent */
|
|
1705
2456
|
constituentDerivativeIndex: number;
|
|
1706
2457
|
spotMarketIndex: number;
|
|
1707
2458
|
constituentIndex: number;
|
|
1708
2459
|
decimals: number;
|
|
1709
2460
|
bump: number;
|
|
1710
2461
|
vaultBump: number;
|
|
2462
|
+
/** no precision — raw constant used in swap-fee inventory-skew pricing */
|
|
1711
2463
|
gammaInventory: number;
|
|
2464
|
+
/** no precision — raw constant used in swap-fee execution-cost pricing */
|
|
1712
2465
|
gammaExecution: number;
|
|
2466
|
+
/** no precision — raw constant used in swap-fee pricing */
|
|
1713
2467
|
xi: number;
|
|
2468
|
+
/** see `ConstituentStatus` */
|
|
1714
2469
|
status: number;
|
|
2470
|
+
/** bitmask, see `ConstituentLpOperation` */
|
|
1715
2471
|
pausedOperations: number;
|
|
1716
2472
|
};
|
|
2473
|
+
/** One perp market's cached AMM/settlement snapshot inside an `AmmCache`, refreshed by the keeper crank so LP-pool settlement doesn't need to reload the full `PerpMarketAccount`. */
|
|
1717
2474
|
export type CacheInfo = {
|
|
1718
2475
|
oracle: PublicKey;
|
|
1719
2476
|
lastFeePoolTokenAmount: BN;
|
|
2477
|
+
/** signed */
|
|
1720
2478
|
lastNetPnlPoolTokenAmount: BN;
|
|
1721
2479
|
lastExchangeFees: BN;
|
|
1722
2480
|
lastSettleAmmExFees: BN;
|
|
2481
|
+
/** signed */
|
|
1723
2482
|
lastSettleAmmPnl: BN;
|
|
2483
|
+
/** BASE_PRECISION (1e9), signed; the AMM's net position at last cache update */
|
|
1724
2484
|
position: BN;
|
|
1725
2485
|
slot: BN;
|
|
1726
2486
|
lastSettleAmount: BN;
|
|
1727
2487
|
lastSettleSlot: BN;
|
|
1728
2488
|
lastSettleTs: BN;
|
|
2489
|
+
/** signed; quote owed from the LP pool to this market (or vice versa if negative) */
|
|
1729
2490
|
quoteOwedFromLpPool: BN;
|
|
2491
|
+
/** signed; cap on the AMM's hedgeable inventory */
|
|
1730
2492
|
ammInventoryLimit: BN;
|
|
2493
|
+
/** PRICE_PRECISION (1e6), signed */
|
|
1731
2494
|
oraclePrice: BN;
|
|
1732
2495
|
oracleSlot: BN;
|
|
2496
|
+
/** numeric `OracleSourceNum` discriminant */
|
|
1733
2497
|
oracleSource: number;
|
|
2498
|
+
/** `OracleValidity` discriminant at last cache update */
|
|
1734
2499
|
oracleValidity: number;
|
|
1735
2500
|
lpStatusForPerpMarket: number;
|
|
1736
2501
|
ammPositionScalar: number;
|
|
1737
2502
|
marketIndex: number;
|
|
1738
2503
|
};
|
|
2504
|
+
/** Decoded mirror of the on-chain `AmmCache` account: one `CacheInfo` per perp market, indexed by `marketIndex`. */
|
|
1739
2505
|
export type AmmCache = {
|
|
1740
2506
|
bump: number;
|
|
1741
2507
|
cache: CacheInfo[];
|
|
1742
2508
|
};
|
|
2509
|
+
/** SDK-computed result of checking whether a user account can currently be liquidated. */
|
|
1743
2510
|
export type AccountLiquidatableStatus = {
|
|
1744
2511
|
canBeLiquidated: boolean;
|
|
2512
|
+
/** QUOTE_PRECISION (1e6); the maintenance margin requirement compared against */
|
|
1745
2513
|
marginRequirement: BN;
|
|
2514
|
+
/** signed, QUOTE_PRECISION (1e6) */
|
|
1746
2515
|
totalCollateral: BN;
|
|
1747
2516
|
};
|
|
2517
|
+
/** Direction of an admin `transferFeeAndPnlPool` action, moving funds between a perp market's protocol fee pool and its pnl pool. */
|
|
1748
2518
|
export declare class TransferFeeAndPnlPoolDirection {
|
|
1749
2519
|
static readonly FEE_TO_PNL_POOL: {
|
|
1750
2520
|
feeToPnlPool: {};
|
|
@@ -1753,12 +2523,14 @@ export declare class TransferFeeAndPnlPoolDirection {
|
|
|
1753
2523
|
pnlToFeePool: {};
|
|
1754
2524
|
};
|
|
1755
2525
|
}
|
|
2526
|
+
/** Emitted when an admin transfers funds between a perp market's fee pool and pnl pool (`transferFeeAndPnlPool`). The two market indices may refer to the same or different perp markets. */
|
|
1756
2527
|
export type TransferFeeAndPnlPoolRecord = {
|
|
1757
2528
|
ts: BN;
|
|
1758
2529
|
slot: BN;
|
|
1759
2530
|
perpMarketIndexWithFeePool: number;
|
|
1760
2531
|
perpMarketIndexWithPnlPool: number;
|
|
1761
2532
|
direction: TransferFeeAndPnlPoolDirection;
|
|
2533
|
+
/** QUOTE_PRECISION (1e6) */
|
|
1762
2534
|
amount: BN;
|
|
1763
2535
|
};
|
|
1764
2536
|
export {};
|