@drift-labs/sdk-browser 2.163.0-beta.11 → 2.163.0-beta.13
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/VERSION +1 -1
- package/bun.lock +26 -13
- package/lib/browser/accounts/fetch.d.ts +9 -0
- package/lib/browser/accounts/fetch.js +14 -1
- package/lib/browser/addresses/pda.d.ts +1 -1
- package/lib/browser/addresses/pda.js +2 -2
- package/lib/browser/adminClient.d.ts +1 -1
- package/lib/browser/adminClient.js +2 -2
- package/lib/browser/bankrun/bankrunConnection.d.ts +1 -1
- package/lib/browser/bankrun/bankrunConnection.js +1 -1
- package/lib/browser/clock/clockSubscriber.js +1 -1
- package/lib/browser/config.d.ts +1 -1
- package/lib/browser/constants/numericConstants.d.ts +1 -1
- package/lib/browser/constants/numericConstants.js +1 -1
- package/lib/browser/constants/perpMarkets.js +1 -1
- package/lib/browser/constants/spotMarkets.d.ts +1 -1
- package/lib/browser/constants/spotMarkets.js +4 -3
- package/lib/browser/core/DriftCore.d.ts +224 -0
- package/lib/browser/core/DriftCore.js +138 -0
- package/lib/browser/core/index.d.ts +12 -0
- package/lib/browser/core/index.js +28 -0
- package/lib/browser/core/instructions/deposit.d.ts +19 -0
- package/lib/browser/core/instructions/deposit.js +19 -0
- package/lib/browser/core/instructions/fill.d.ts +13 -0
- package/lib/browser/core/instructions/fill.js +17 -0
- package/lib/browser/core/instructions/funding.d.ts +9 -0
- package/lib/browser/core/instructions/funding.js +13 -0
- package/lib/browser/core/instructions/liquidation.d.ts +15 -0
- package/lib/browser/core/instructions/liquidation.js +17 -0
- package/lib/browser/core/instructions/orders.d.ts +22 -0
- package/lib/browser/core/instructions/orders.js +27 -0
- package/lib/browser/core/instructions/perpOrders.d.ts +78 -0
- package/lib/browser/core/instructions/perpOrders.js +99 -0
- package/lib/browser/core/instructions/settlement.d.ts +11 -0
- package/lib/browser/core/instructions/settlement.js +15 -0
- package/lib/browser/core/instructions/trigger.d.ts +11 -0
- package/lib/browser/core/instructions/trigger.js +15 -0
- package/lib/browser/core/instructions/withdraw.d.ts +20 -0
- package/lib/browser/core/instructions/withdraw.js +20 -0
- package/lib/browser/core/remainingAccounts.d.ts +27 -0
- package/lib/browser/core/remainingAccounts.js +122 -0
- package/lib/browser/core/signedMsg.d.ts +17 -0
- package/lib/browser/core/signedMsg.js +39 -0
- package/lib/browser/decode/customCoder.d.ts +1 -1
- package/lib/browser/decode/customCoder.js +1 -1
- package/lib/browser/decode/user.js +1 -1
- package/lib/browser/dlob/DLOB.d.ts +1 -1
- package/lib/browser/dlob/DLOB.js +1 -1
- package/lib/browser/dlob/DLOBNode.d.ts +1 -1
- package/lib/browser/dlob/DLOBNode.js +1 -1
- package/lib/browser/dlob/DLOBSubscriber.d.ts +1 -1
- package/lib/browser/dlob/NodeList.d.ts +1 -1
- package/lib/browser/dlob/orderBookLevels.d.ts +1 -1
- package/lib/browser/dlob/orderBookLevels.js +1 -1
- package/lib/browser/driftClient.d.ts +17 -24
- package/lib/browser/driftClient.js +192 -291
- package/lib/browser/driftClientConfig.d.ts +1 -1
- package/lib/browser/events/eventSubscriber.d.ts +1 -1
- package/lib/browser/events/fetchLogs.d.ts +1 -1
- package/lib/browser/events/parse.d.ts +1 -1
- package/lib/browser/factory/bigNum.d.ts +1 -1
- package/lib/browser/factory/bigNum.js +1 -1
- package/lib/browser/factory/oracleClient.js +1 -1
- package/lib/browser/index.d.ts +2 -1
- package/lib/browser/index.js +2 -1
- package/lib/browser/indicative-quotes/indicativeQuotesSender.d.ts +1 -1
- package/lib/browser/isomorphic/anchor.browser.d.ts +24 -0
- package/lib/browser/isomorphic/anchor.browser.js +60 -0
- package/lib/browser/isomorphic/anchor.d.ts +24 -0
- package/lib/browser/isomorphic/anchor.js +60 -0
- package/lib/browser/isomorphic/anchor29.browser.d.ts +12 -0
- package/lib/browser/isomorphic/anchor29.browser.js +48 -0
- package/lib/browser/isomorphic/anchor29.d.ts +12 -0
- package/lib/browser/isomorphic/anchor29.js +48 -0
- package/lib/browser/jupiter/jupiterClient.d.ts +1 -1
- package/lib/browser/marginCalculation.d.ts +1 -1
- package/lib/browser/marinade/index.d.ts +1 -1
- package/lib/browser/marinade/index.js +2 -2
- package/lib/browser/math/amm.d.ts +1 -1
- package/lib/browser/math/amm.js +1 -1
- package/lib/browser/math/auction.d.ts +1 -1
- package/lib/browser/math/auction.js +1 -1
- package/lib/browser/math/conversion.d.ts +1 -1
- package/lib/browser/math/conversion.js +1 -1
- package/lib/browser/math/exchangeStatus.js +1 -1
- package/lib/browser/math/fuel.d.ts +1 -1
- package/lib/browser/math/fuel.js +1 -1
- package/lib/browser/math/funding.d.ts +1 -1
- package/lib/browser/math/funding.js +1 -1
- package/lib/browser/math/insurance.d.ts +1 -1
- package/lib/browser/math/insurance.js +1 -1
- package/lib/browser/math/liquidation.d.ts +1 -1
- package/lib/browser/math/liquidation.js +1 -1
- package/lib/browser/math/margin.d.ts +1 -1
- package/lib/browser/math/margin.js +1 -1
- package/lib/browser/math/market.d.ts +1 -1
- package/lib/browser/math/market.js +1 -1
- package/lib/browser/math/oracles.d.ts +1 -1
- package/lib/browser/math/oracles.js +1 -1
- package/lib/browser/math/orders.d.ts +1 -1
- package/lib/browser/math/orders.js +1 -1
- package/lib/browser/math/position.d.ts +1 -1
- package/lib/browser/math/position.js +1 -1
- package/lib/browser/math/protectedMakerParams.js +1 -1
- package/lib/browser/math/repeg.d.ts +1 -1
- package/lib/browser/math/repeg.js +1 -1
- package/lib/browser/math/spotBalance.d.ts +1 -1
- package/lib/browser/math/spotBalance.js +1 -1
- package/lib/browser/math/spotMarket.d.ts +1 -1
- package/lib/browser/math/spotMarket.js +1 -1
- package/lib/browser/math/spotPosition.d.ts +1 -1
- package/lib/browser/math/spotPosition.js +1 -1
- package/lib/browser/math/state.d.ts +1 -1
- package/lib/browser/math/state.js +1 -1
- package/lib/browser/math/superStake.d.ts +1 -1
- package/lib/browser/math/superStake.js +1 -1
- package/lib/browser/math/trade.d.ts +1 -1
- package/lib/browser/math/trade.js +1 -1
- package/lib/browser/math/utils.d.ts +1 -1
- package/lib/browser/math/utils.js +1 -1
- package/lib/browser/memcmp.js +8 -8
- package/lib/browser/openbook/openbookV2Subscriber.d.ts +1 -1
- package/lib/browser/openbook/openbookV2Subscriber.js +3 -3
- package/lib/browser/oracles/pythClient.d.ts +1 -1
- package/lib/browser/oracles/pythClient.js +1 -1
- package/lib/browser/oracles/pythLazerClient.d.ts +1 -1
- package/lib/browser/oracles/pythLazerClient.js +1 -1
- package/lib/browser/oracles/quoteAssetOracleClient.js +1 -1
- package/lib/browser/oracles/strictOraclePrice.d.ts +1 -1
- package/lib/browser/oracles/strictOraclePrice.js +1 -1
- package/lib/browser/oracles/types.d.ts +1 -1
- package/lib/browser/oracles/utils.d.ts +1 -1
- package/lib/browser/orderParams.d.ts +1 -1
- package/lib/browser/orderSubscriber/OrderSubscriber.js +1 -1
- package/lib/browser/phoenix/phoenixSubscriber.d.ts +1 -1
- package/lib/browser/phoenix/phoenixSubscriber.js +1 -1
- package/lib/browser/pyth/types.d.ts +1 -1
- package/lib/browser/serum/serumSubscriber.d.ts +1 -1
- package/lib/browser/serum/serumSubscriber.js +1 -1
- package/lib/browser/slot/SlothashSubscriber.js +6 -3
- package/lib/browser/swap/UnifiedSwapClient.d.ts +1 -1
- package/lib/browser/titan/titanClient.d.ts +1 -1
- package/lib/browser/tokenFaucet.d.ts +3 -3
- package/lib/browser/tokenFaucet.js +4 -4
- package/lib/browser/types.d.ts +1 -1
- package/lib/browser/user.d.ts +1 -1
- package/lib/browser/user.js +1 -1
- package/lib/browser/userMap/referrerMap.js +7 -4
- package/lib/browser/userStats.d.ts +1 -1
- package/lib/browser/userStats.js +1 -1
- package/lib/node/accounts/fetch.d.ts +9 -0
- package/lib/node/accounts/fetch.d.ts.map +1 -1
- package/lib/node/accounts/fetch.js +14 -1
- package/lib/node/addresses/pda.d.ts +1 -1
- package/lib/node/addresses/pda.d.ts.map +1 -1
- package/lib/node/addresses/pda.js +2 -2
- package/lib/node/adminClient.d.ts +1 -1
- package/lib/node/adminClient.d.ts.map +1 -1
- package/lib/node/adminClient.js +2 -2
- package/lib/node/bankrun/bankrunConnection.d.ts +1 -1
- package/lib/node/bankrun/bankrunConnection.d.ts.map +1 -1
- package/lib/node/bankrun/bankrunConnection.js +1 -1
- package/lib/node/clock/clockSubscriber.js +1 -1
- package/lib/node/config.d.ts +1 -1
- package/lib/node/config.d.ts.map +1 -1
- package/lib/node/constants/numericConstants.d.ts +1 -1
- package/lib/node/constants/numericConstants.d.ts.map +1 -1
- package/lib/node/constants/numericConstants.js +1 -1
- package/lib/node/constants/perpMarkets.js +1 -1
- package/lib/node/constants/spotMarkets.d.ts +1 -1
- package/lib/node/constants/spotMarkets.d.ts.map +1 -1
- package/lib/node/constants/spotMarkets.js +4 -3
- package/lib/node/core/DriftCore.d.ts +225 -0
- package/lib/node/core/DriftCore.d.ts.map +1 -0
- package/lib/node/core/DriftCore.js +138 -0
- package/lib/node/core/index.d.ts +13 -0
- package/lib/node/core/index.d.ts.map +1 -0
- package/lib/node/core/index.js +28 -0
- package/lib/node/core/instructions/deposit.d.ts +20 -0
- package/lib/node/core/instructions/deposit.d.ts.map +1 -0
- package/lib/node/core/instructions/deposit.js +19 -0
- package/lib/node/core/instructions/fill.d.ts +14 -0
- package/lib/node/core/instructions/fill.d.ts.map +1 -0
- package/lib/node/core/instructions/fill.js +17 -0
- package/lib/node/core/instructions/funding.d.ts +10 -0
- package/lib/node/core/instructions/funding.d.ts.map +1 -0
- package/lib/node/core/instructions/funding.js +13 -0
- package/lib/node/core/instructions/liquidation.d.ts +16 -0
- package/lib/node/core/instructions/liquidation.d.ts.map +1 -0
- package/lib/node/core/instructions/liquidation.js +17 -0
- package/lib/node/core/instructions/orders.d.ts +23 -0
- package/lib/node/core/instructions/orders.d.ts.map +1 -0
- package/lib/node/core/instructions/orders.js +27 -0
- package/lib/node/core/instructions/perpOrders.d.ts +79 -0
- package/lib/node/core/instructions/perpOrders.d.ts.map +1 -0
- package/lib/node/core/instructions/perpOrders.js +99 -0
- package/lib/node/core/instructions/settlement.d.ts +12 -0
- package/lib/node/core/instructions/settlement.d.ts.map +1 -0
- package/lib/node/core/instructions/settlement.js +15 -0
- package/lib/node/core/instructions/trigger.d.ts +12 -0
- package/lib/node/core/instructions/trigger.d.ts.map +1 -0
- 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 -0
- package/lib/node/core/instructions/withdraw.js +20 -0
- package/lib/node/core/remainingAccounts.d.ts +28 -0
- package/lib/node/core/remainingAccounts.d.ts.map +1 -0
- package/lib/node/core/remainingAccounts.js +122 -0
- package/lib/node/core/signedMsg.d.ts +18 -0
- package/lib/node/core/signedMsg.d.ts.map +1 -0
- package/lib/node/core/signedMsg.js +39 -0
- package/lib/node/decode/customCoder.d.ts +1 -1
- package/lib/node/decode/customCoder.d.ts.map +1 -1
- package/lib/node/decode/customCoder.js +1 -1
- package/lib/node/decode/user.js +1 -1
- package/lib/node/dlob/DLOB.d.ts +1 -1
- package/lib/node/dlob/DLOB.d.ts.map +1 -1
- package/lib/node/dlob/DLOB.js +1 -1
- package/lib/node/dlob/DLOBNode.d.ts +1 -1
- package/lib/node/dlob/DLOBNode.d.ts.map +1 -1
- package/lib/node/dlob/DLOBNode.js +1 -1
- package/lib/node/dlob/DLOBSubscriber.d.ts +1 -1
- package/lib/node/dlob/DLOBSubscriber.d.ts.map +1 -1
- package/lib/node/dlob/NodeList.d.ts +1 -1
- package/lib/node/dlob/NodeList.d.ts.map +1 -1
- package/lib/node/dlob/orderBookLevels.d.ts +1 -1
- package/lib/node/dlob/orderBookLevels.d.ts.map +1 -1
- package/lib/node/dlob/orderBookLevels.js +1 -1
- package/lib/node/driftClient.d.ts +17 -24
- package/lib/node/driftClient.d.ts.map +1 -1
- package/lib/node/driftClient.js +192 -291
- package/lib/node/driftClientConfig.d.ts +1 -1
- package/lib/node/driftClientConfig.d.ts.map +1 -1
- package/lib/node/events/eventSubscriber.d.ts +1 -1
- package/lib/node/events/eventSubscriber.d.ts.map +1 -1
- package/lib/node/events/fetchLogs.d.ts +1 -1
- package/lib/node/events/fetchLogs.d.ts.map +1 -1
- package/lib/node/events/parse.d.ts +1 -1
- package/lib/node/events/parse.d.ts.map +1 -1
- package/lib/node/factory/bigNum.d.ts +1 -1
- package/lib/node/factory/bigNum.d.ts.map +1 -1
- package/lib/node/factory/bigNum.js +1 -1
- package/lib/node/factory/oracleClient.js +1 -1
- package/lib/node/index.d.ts +2 -1
- package/lib/node/index.d.ts.map +1 -1
- package/lib/node/index.js +2 -1
- package/lib/node/indicative-quotes/indicativeQuotesSender.d.ts +1 -1
- package/lib/node/indicative-quotes/indicativeQuotesSender.d.ts.map +1 -1
- package/lib/node/isomorphic/anchor.browser.d.ts +25 -0
- package/lib/node/isomorphic/anchor.browser.d.ts.map +1 -0
- package/lib/node/isomorphic/anchor.browser.js +60 -0
- package/lib/node/isomorphic/anchor.d.ts +25 -0
- package/lib/node/isomorphic/anchor.d.ts.map +1 -0
- package/lib/node/isomorphic/anchor.js +60 -0
- package/lib/node/isomorphic/anchor.node.d.ts.map +1 -0
- package/lib/node/isomorphic/anchor29.browser.d.ts +13 -0
- package/lib/node/isomorphic/anchor29.browser.d.ts.map +1 -0
- package/lib/node/isomorphic/anchor29.browser.js +48 -0
- package/lib/node/isomorphic/anchor29.d.ts +13 -0
- package/lib/node/isomorphic/anchor29.d.ts.map +1 -0
- package/lib/node/isomorphic/anchor29.js +48 -0
- package/lib/node/isomorphic/anchor29.node.d.ts.map +1 -0
- package/lib/node/jupiter/jupiterClient.d.ts +1 -1
- package/lib/node/jupiter/jupiterClient.d.ts.map +1 -1
- package/lib/node/marginCalculation.d.ts +1 -1
- package/lib/node/marginCalculation.d.ts.map +1 -1
- package/lib/node/marinade/index.d.ts +1 -1
- package/lib/node/marinade/index.d.ts.map +1 -1
- package/lib/node/marinade/index.js +2 -2
- package/lib/node/math/amm.d.ts +1 -1
- package/lib/node/math/amm.d.ts.map +1 -1
- package/lib/node/math/amm.js +1 -1
- package/lib/node/math/auction.d.ts +1 -1
- package/lib/node/math/auction.d.ts.map +1 -1
- package/lib/node/math/auction.js +1 -1
- package/lib/node/math/conversion.d.ts +1 -1
- package/lib/node/math/conversion.d.ts.map +1 -1
- package/lib/node/math/conversion.js +1 -1
- package/lib/node/math/exchangeStatus.js +1 -1
- package/lib/node/math/fuel.d.ts +1 -1
- package/lib/node/math/fuel.d.ts.map +1 -1
- package/lib/node/math/fuel.js +1 -1
- package/lib/node/math/funding.d.ts +1 -1
- package/lib/node/math/funding.d.ts.map +1 -1
- package/lib/node/math/funding.js +1 -1
- package/lib/node/math/insurance.d.ts +1 -1
- package/lib/node/math/insurance.d.ts.map +1 -1
- package/lib/node/math/insurance.js +1 -1
- package/lib/node/math/liquidation.d.ts +1 -1
- package/lib/node/math/liquidation.d.ts.map +1 -1
- package/lib/node/math/liquidation.js +1 -1
- package/lib/node/math/margin.d.ts +1 -1
- package/lib/node/math/margin.d.ts.map +1 -1
- package/lib/node/math/margin.js +1 -1
- package/lib/node/math/market.d.ts +1 -1
- package/lib/node/math/market.d.ts.map +1 -1
- package/lib/node/math/market.js +1 -1
- package/lib/node/math/oracles.d.ts +1 -1
- package/lib/node/math/oracles.d.ts.map +1 -1
- package/lib/node/math/oracles.js +1 -1
- package/lib/node/math/orders.d.ts +1 -1
- package/lib/node/math/orders.d.ts.map +1 -1
- package/lib/node/math/orders.js +1 -1
- package/lib/node/math/position.d.ts +1 -1
- package/lib/node/math/position.d.ts.map +1 -1
- package/lib/node/math/position.js +1 -1
- package/lib/node/math/protectedMakerParams.js +1 -1
- package/lib/node/math/repeg.d.ts +1 -1
- package/lib/node/math/repeg.d.ts.map +1 -1
- package/lib/node/math/repeg.js +1 -1
- package/lib/node/math/spotBalance.d.ts +1 -1
- package/lib/node/math/spotBalance.d.ts.map +1 -1
- package/lib/node/math/spotBalance.js +1 -1
- package/lib/node/math/spotMarket.d.ts +1 -1
- package/lib/node/math/spotMarket.d.ts.map +1 -1
- package/lib/node/math/spotMarket.js +1 -1
- package/lib/node/math/spotPosition.d.ts +1 -1
- package/lib/node/math/spotPosition.d.ts.map +1 -1
- package/lib/node/math/spotPosition.js +1 -1
- package/lib/node/math/state.d.ts +1 -1
- package/lib/node/math/state.d.ts.map +1 -1
- package/lib/node/math/state.js +1 -1
- package/lib/node/math/superStake.d.ts +1 -1
- package/lib/node/math/superStake.d.ts.map +1 -1
- package/lib/node/math/superStake.js +1 -1
- package/lib/node/math/trade.d.ts +1 -1
- package/lib/node/math/trade.d.ts.map +1 -1
- package/lib/node/math/trade.js +1 -1
- package/lib/node/math/utils.d.ts +1 -1
- package/lib/node/math/utils.d.ts.map +1 -1
- package/lib/node/math/utils.js +1 -1
- package/lib/node/memcmp.js +8 -8
- package/lib/node/openbook/openbookV2Subscriber.d.ts +1 -1
- package/lib/node/openbook/openbookV2Subscriber.d.ts.map +1 -1
- package/lib/node/openbook/openbookV2Subscriber.js +3 -3
- package/lib/node/oracles/pythClient.d.ts +1 -1
- package/lib/node/oracles/pythClient.d.ts.map +1 -1
- package/lib/node/oracles/pythClient.js +1 -1
- package/lib/node/oracles/pythLazerClient.d.ts +1 -1
- package/lib/node/oracles/pythLazerClient.d.ts.map +1 -1
- package/lib/node/oracles/pythLazerClient.js +1 -1
- package/lib/node/oracles/quoteAssetOracleClient.js +1 -1
- package/lib/node/oracles/strictOraclePrice.d.ts +1 -1
- package/lib/node/oracles/strictOraclePrice.d.ts.map +1 -1
- package/lib/node/oracles/strictOraclePrice.js +1 -1
- package/lib/node/oracles/types.d.ts +1 -1
- package/lib/node/oracles/types.d.ts.map +1 -1
- package/lib/node/oracles/utils.d.ts +1 -1
- package/lib/node/oracles/utils.d.ts.map +1 -1
- package/lib/node/orderParams.d.ts +1 -1
- package/lib/node/orderParams.d.ts.map +1 -1
- package/lib/node/orderSubscriber/OrderSubscriber.js +1 -1
- package/lib/node/phoenix/phoenixSubscriber.d.ts +1 -1
- package/lib/node/phoenix/phoenixSubscriber.d.ts.map +1 -1
- package/lib/node/phoenix/phoenixSubscriber.js +1 -1
- package/lib/node/pyth/types.d.ts +1 -1
- package/lib/node/pyth/types.d.ts.map +1 -1
- package/lib/node/serum/serumSubscriber.d.ts +1 -1
- package/lib/node/serum/serumSubscriber.d.ts.map +1 -1
- package/lib/node/serum/serumSubscriber.js +1 -1
- package/lib/node/slot/SlothashSubscriber.js +6 -3
- package/lib/node/swap/UnifiedSwapClient.d.ts +1 -1
- package/lib/node/swap/UnifiedSwapClient.d.ts.map +1 -1
- package/lib/node/titan/titanClient.d.ts +1 -1
- package/lib/node/titan/titanClient.d.ts.map +1 -1
- package/lib/node/tokenFaucet.d.ts +3 -3
- package/lib/node/tokenFaucet.d.ts.map +1 -1
- package/lib/node/tokenFaucet.js +4 -4
- package/lib/node/types.d.ts +1 -1
- package/lib/node/types.d.ts.map +1 -1
- package/lib/node/user.d.ts +1 -1
- package/lib/node/user.d.ts.map +1 -1
- package/lib/node/user.js +1 -1
- package/lib/node/userMap/referrerMap.js +7 -4
- package/lib/node/userStats.d.ts +1 -1
- package/lib/node/userStats.d.ts.map +1 -1
- package/lib/node/userStats.js +1 -1
- package/package.json +4 -2
- package/scripts/postbuild.js +1 -1
- package/src/accounts/fetch.ts +27 -0
- package/src/accounts/webSocketAccountSubscriber.ts +1 -1
- package/src/accounts/webSocketAccountSubscriberV2.ts +1 -1
- package/src/accounts/webSocketProgramAccountSubscriber.ts +1 -1
- package/src/accounts/webSocketProgramAccountSubscriberV2.ts +1 -1
- package/src/accounts/webSocketProgramAccountsSubscriberV2.ts +1 -1
- package/src/addresses/pda.ts +2 -2
- package/src/adminClient.ts +2 -2
- package/src/bankrun/bankrunConnection.ts +1 -1
- package/src/clock/clockSubscriber.ts +1 -1
- package/src/config.ts +1 -1
- package/src/constants/numericConstants.ts +1 -1
- package/src/constants/perpMarkets.ts +1 -1
- package/src/constants/spotMarkets.ts +4 -3
- package/src/core/DriftCore.ts +326 -0
- package/src/core/index.ts +12 -0
- package/src/core/instructions/deposit.ts +42 -0
- package/src/core/instructions/fill.ts +34 -0
- package/src/core/instructions/funding.ts +21 -0
- package/src/core/instructions/liquidation.ts +37 -0
- package/src/core/instructions/orders.ts +56 -0
- package/src/core/instructions/perpOrders.ts +192 -0
- package/src/core/instructions/settlement.ts +26 -0
- package/src/core/instructions/trigger.ts +26 -0
- package/src/core/instructions/withdraw.ts +44 -0
- package/src/core/remainingAccounts.ts +276 -0
- package/src/core/signedMsg.ts +71 -0
- package/src/decode/customCoder.ts +1 -1
- package/src/decode/user.ts +1 -1
- package/src/dlob/DLOB.ts +1 -1
- package/src/dlob/DLOBNode.ts +1 -1
- package/src/dlob/DLOBSubscriber.ts +1 -1
- package/src/dlob/NodeList.ts +1 -1
- package/src/dlob/orderBookLevels.ts +1 -1
- package/src/driftClient.ts +207 -402
- package/src/driftClientConfig.ts +1 -1
- package/src/events/eventSubscriber.ts +1 -1
- package/src/events/fetchLogs.ts +1 -1
- package/src/events/parse.ts +1 -1
- package/src/factory/bigNum.ts +1 -1
- package/src/factory/oracleClient.ts +1 -1
- package/src/index.ts +2 -1
- package/src/indicative-quotes/indicativeQuotesSender.ts +1 -1
- package/src/isomorphic/anchor.browser.ts +44 -0
- package/src/isomorphic/anchor.node.ts +1 -0
- package/src/isomorphic/anchor.ts +1 -0
- package/src/isomorphic/anchor29.browser.ts +24 -0
- package/src/isomorphic/anchor29.node.ts +1 -0
- package/src/isomorphic/anchor29.ts +1 -0
- package/src/jupiter/jupiterClient.ts +1 -1
- package/src/marginCalculation.ts +1 -1
- package/src/marinade/index.ts +1 -1
- package/src/math/amm.ts +1 -1
- package/src/math/auction.ts +1 -1
- package/src/math/conversion.ts +1 -1
- package/src/math/exchangeStatus.ts +1 -1
- package/src/math/fuel.ts +1 -1
- package/src/math/funding.ts +1 -1
- package/src/math/insurance.ts +1 -1
- package/src/math/liquidation.ts +1 -1
- package/src/math/margin.ts +1 -1
- package/src/math/market.ts +1 -1
- package/src/math/oracles.ts +1 -1
- package/src/math/orders.ts +1 -1
- package/src/math/position.ts +1 -1
- package/src/math/protectedMakerParams.ts +1 -1
- package/src/math/repeg.ts +1 -1
- package/src/math/spotBalance.ts +1 -1
- package/src/math/spotMarket.ts +1 -1
- package/src/math/spotPosition.ts +1 -1
- package/src/math/state.ts +1 -1
- package/src/math/superStake.ts +1 -1
- package/src/math/trade.ts +1 -1
- package/src/math/utils.ts +1 -1
- package/src/memcmp.ts +1 -1
- package/src/openbook/openbookV2Subscriber.ts +7 -1
- package/src/oracles/pythClient.ts +1 -1
- package/src/oracles/pythLazerClient.ts +1 -1
- package/src/oracles/quoteAssetOracleClient.ts +1 -1
- package/src/oracles/strictOraclePrice.ts +1 -1
- package/src/oracles/types.ts +1 -1
- package/src/oracles/utils.ts +1 -1
- package/src/orderParams.ts +1 -1
- package/src/orderSubscriber/OrderSubscriber.ts +1 -1
- package/src/phoenix/phoenixSubscriber.ts +1 -1
- package/src/pyth/types.ts +1 -1
- package/src/serum/serumSubscriber.ts +1 -1
- package/src/slot/SlothashSubscriber.ts +2 -2
- package/src/swap/UnifiedSwapClient.ts +1 -1
- package/src/titan/titanClient.ts +1 -1
- package/src/tokenFaucet.ts +3 -3
- package/src/types.ts +1 -1
- package/src/user.ts +1 -1
- package/src/userMap/referrerMap.ts +1 -1
- package/src/userMap/userMap.ts +1 -1
- package/src/userStats.ts +1 -1
- package/tests/DriftCore/decode.test.ts +16 -0
- package/tests/DriftCore/fill_trigger.test.ts +73 -0
- package/tests/DriftCore/instructions.test.ts +46 -0
- package/tests/DriftCore/pdas.test.ts +29 -0
- package/tests/DriftCore/perp_orders.test.ts +205 -0
- package/tests/DriftCore/remainingAccounts.test.ts +70 -0
- package/tests/DriftCore/settlement_liquidation.test.ts +69 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/// <reference types="node" />
|
|
4
4
|
import { AMM, HistoricalOracleData, OracleGuardRails, OracleSource, OracleValidity, PerpMarketAccount } from '../types';
|
|
5
5
|
import { OraclePriceData } from '../oracles/types';
|
|
6
|
-
import { BN } from '
|
|
6
|
+
import { BN } from '../isomorphic/anchor';
|
|
7
7
|
export declare function oraclePriceBands(market: PerpMarketAccount, oraclePriceData: Pick<OraclePriceData, 'price'>): [BN, BN];
|
|
8
8
|
export declare function getMaxConfidenceIntervalMultiplier(market: PerpMarketAccount): BN;
|
|
9
9
|
export declare function getOracleValidity(market: PerpMarketAccount, oraclePriceData: OraclePriceData, oracleGuardRails: OracleGuardRails, slot: BN, oracleStalenessBuffer?: BN): OracleValidity;
|
|
@@ -4,7 +4,7 @@ exports.getMultipleBetweenOracleSources = exports.trimVaaSignatures = exports.ge
|
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
6
6
|
const assert_1 = require("../assert/assert");
|
|
7
|
-
const anchor_1 = require("
|
|
7
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
8
8
|
function oraclePriceBands(market, oraclePriceData) {
|
|
9
9
|
const maxPercentDiff = market.marginRatioInitial - market.marginRatioMaintenance;
|
|
10
10
|
const offset = oraclePriceData.price
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
2
|
import { User } from '../user';
|
|
3
3
|
import { PerpMarketAccount, AMM, Order, PositionDirection, ProtectedMakerParams, MarketTypeStr, StateAccount } from '../types';
|
|
4
|
-
import { BN } from '
|
|
4
|
+
import { BN } from '../isomorphic/anchor';
|
|
5
5
|
import { MMOraclePriceData, OraclePriceData } from '../oracles/types';
|
|
6
6
|
export declare function isOrderRiskIncreasing(user: User, order: Order): boolean;
|
|
7
7
|
export declare function isOrderRiskIncreasingInSameDirection(user: User, order: Order): boolean;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.maxSizeForTargetLiabilityWeightBN = exports.calculateOrderBaseAssetAmount = exports.hasBuilder = exports.isSignedMsgOrder = exports.isTakingOrder = exports.isRestingLimitOrder = exports.isTriggered = exports.mustBeTriggered = exports.isLimitOrder = exports.isMarketOrder = exports.isOrderExpired = exports.calculateBaseAssetAmountToFillUpToLimitPrice = exports.calculateBaseAssetAmountForAmmToFulfill = exports.isLowRiskForAmm = exports.isFillableByVAMM = exports.hasAuctionPrice = exports.hasLimitPrice = exports.applyProtectedMakerParams = exports.getLimitPrice = exports.standardizePrice = exports.standardizeBaseAssetAmount = exports.isOrderReduceOnly = exports.isOrderRiskIncreasingInSameDirection = exports.isOrderRiskIncreasing = void 0;
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
6
|
-
const anchor_1 = require("
|
|
6
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
7
7
|
const auction_1 = require("./auction");
|
|
8
8
|
const amm_1 = require("./amm");
|
|
9
9
|
const margin_1 = require("./margin");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
|
-
import { BN } from '
|
|
2
|
+
import { BN } from '../isomorphic/anchor';
|
|
3
3
|
import { MMOraclePriceData, OraclePriceData } from '../oracles/types';
|
|
4
4
|
import { PerpMarketAccount, PositionDirection, PerpPosition, SpotMarketAccount } from '../types';
|
|
5
5
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.hasOpenOrders = exports.isEmptyPosition = exports.positionCurrentDirection = exports.findDirectionToClose = exports.calculateCostBasis = exports.calculateEntryPrice = exports.calculateBreakEvenPrice = exports.positionIsBeingLiquidated = exports.positionIsAvailable = exports.calculatePositionFundingPNL = exports.calculateUnsettledFundingPnl = exports.calculateFeesAndFundingPnl = exports.calculateClaimablePnl = exports.calculatePositionPNL = exports.calculateBaseAssetValue = void 0;
|
|
4
|
-
const anchor_1 = require("
|
|
4
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
5
5
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
6
6
|
const types_1 = require("../types");
|
|
7
7
|
const amm_1 = require("./amm");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getProtectedMakerParamsMap = exports.getProtectedMakerParams = void 0;
|
|
4
|
-
const anchor_1 = require("
|
|
4
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
5
5
|
function getProtectedMakerParams(perpMarket) {
|
|
6
6
|
let dynamicOffset;
|
|
7
7
|
if (perpMarket.protectedMakerDynamicDivisor > 0) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.calculateBudgetedPeg = exports.calculateBudgetedK = exports.calculateBudgetedKBN = exports.calculateRepegCost = exports.calculateAdjustKCost = void 0;
|
|
4
|
-
const anchor_1 = require("
|
|
4
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
5
5
|
const assert_1 = require("../assert/assert");
|
|
6
6
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
7
7
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
2
|
import { SpotMarketAccount, SpotBalanceType, MarginCategory } from '../types';
|
|
3
|
-
import { BN } from '
|
|
3
|
+
import { BN } from '../isomorphic/anchor';
|
|
4
4
|
import { OraclePriceData } from '../oracles/types';
|
|
5
5
|
import { StrictOraclePrice } from '../oracles/strictOraclePrice';
|
|
6
6
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSpotLiabilityValue = exports.getSpotAssetValue = exports.calculateWithdrawLimit = exports.calculateTokenUtilizationLimits = exports.calculateInterestAccumulated = exports.calculateBorrowRate = exports.calculateDepositRate = exports.calculateInterestRate = exports.calculateSpotMarketBorrowCapacity = exports.calculateUtilization = exports.calculateLiabilityWeight = exports.calculateScaledInitialAssetWeight = exports.calculateAssetWeight = exports.getTokenValue = exports.getStrictTokenValue = exports.getSignedTokenAmount = exports.getTokenAmount = exports.getBalance = void 0;
|
|
4
4
|
const types_1 = require("../types");
|
|
5
|
-
const anchor_1 = require("
|
|
5
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
6
6
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
7
7
|
const margin_1 = require("./margin");
|
|
8
8
|
const numericConstants_2 = require("../constants/numericConstants");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
|
-
import { BN } from '
|
|
2
|
+
import { BN } from '../isomorphic/anchor';
|
|
3
3
|
import { MarginCategory, SpotBalanceType, SpotMarketAccount } from '../types';
|
|
4
4
|
export declare function castNumberToSpotPrecision(value: number | BN, spotMarket: SpotMarketAccount): BN;
|
|
5
5
|
export declare function calculateSpotMarketMarginRatio(market: SpotMarketAccount, oraclePrice: BN, marginCategory: MarginCategory, size: BN, balanceType: SpotBalanceType, customMarginRatio?: number): number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.calculateMaxRemainingDeposit = exports.calculateSpotMarketMarginRatio = exports.castNumberToSpotPrecision = void 0;
|
|
4
|
-
const anchor_1 = require("
|
|
4
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
5
5
|
const types_1 = require("../types");
|
|
6
6
|
const spotBalance_1 = require("./spotBalance");
|
|
7
7
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
2
|
import { MarginCategory, SpotMarketAccount, SpotPosition } from '../types';
|
|
3
|
-
import { BN } from '
|
|
3
|
+
import { BN } from '../isomorphic/anchor';
|
|
4
4
|
import { StrictOraclePrice } from '../oracles/strictOraclePrice';
|
|
5
5
|
export declare function isSpotPositionAvailable(position: SpotPosition): boolean;
|
|
6
6
|
export type OrderFillSimulation = {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.simulateOrderFill = exports.calculateWeightedTokenValue = exports.getWorstCaseTokenAmounts = exports.isSpotPositionAvailable = void 0;
|
|
4
4
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
5
|
-
const anchor_1 = require("
|
|
5
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
6
6
|
const spotBalance_1 = require("./spotBalance");
|
|
7
7
|
function isSpotPositionAvailable(position) {
|
|
8
8
|
return position.scaledBalance.eq(numericConstants_1.ZERO) && position.openOrders === 0;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
|
-
import { BN } from '
|
|
2
|
+
import { BN } from '../isomorphic/anchor';
|
|
3
3
|
import { StateAccount } from '../types';
|
|
4
4
|
export declare function calculateInitUserFee(stateAccount: StateAccount): BN;
|
|
5
5
|
export declare function getMaxNumberOfSubAccounts(stateAccount: StateAccount): BN;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.builderReferralEnabled = exports.builderCodesEnabled = exports.useMedianTriggerPrice = exports.getMaxNumberOfSubAccounts = exports.calculateInitUserFee = void 0;
|
|
4
|
-
const anchor_1 = require("
|
|
4
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
5
5
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
6
6
|
const types_1 = require("../types");
|
|
7
7
|
function calculateInitUserFee(stateAccount) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { AddressLookupTableAccount, PublicKey, TransactionInstruction } from '@solana/web3.js';
|
|
3
3
|
import { JupiterClient, QuoteResponse } from '../jupiter/jupiterClient';
|
|
4
4
|
import { DriftClient } from '../driftClient';
|
|
5
|
-
import { BN } from '
|
|
5
|
+
import { BN } from '../isomorphic/anchor';
|
|
6
6
|
import { User } from '../user';
|
|
7
7
|
import { DepositRecord } from '../types';
|
|
8
8
|
export type BSOL_STATS_API_RESPONSE = {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.calculateEstimatedSuperStakeLiquidationPrice = exports.calculateSolEarned = exports.fetchMSolMetrics = exports.fetchJitoSolMetrics = exports.findBestLstSuperStakeIxs = exports.findBestJitoSolSuperStakeIxs = exports.findBestMSolSuperStakeIxs = exports.findBestSuperStakeIxs = exports.fetchBSolDriftEmissions = exports.fetchBSolMetrics = void 0;
|
|
7
7
|
const web3_js_1 = require("@solana/web3.js");
|
|
8
8
|
const marinade_1 = require("../marinade");
|
|
9
|
-
const anchor_1 = require("
|
|
9
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
10
10
|
const types_1 = require("../types");
|
|
11
11
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
12
12
|
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
2
|
import { PerpMarketAccount, PositionDirection, SpotMarketAccount, UserStatsAccount } from '../types';
|
|
3
|
-
import { BN } from '
|
|
3
|
+
import { BN } from '../isomorphic/anchor';
|
|
4
4
|
import { AssetType } from './amm';
|
|
5
5
|
import { MMOraclePriceData, OraclePriceData } from '../oracles/types';
|
|
6
6
|
import { DLOB } from '../dlob/DLOB';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getUser30dRollingVolumeEstimate = exports.calculateEstimatedEntryPriceWithL2 = exports.calculateEstimatedSpotEntryPrice = exports.calculateEstimatedPerpEntryPrice = exports.calculateTargetPriceTrade = exports.calculateTradeAcquiredAmounts = exports.calculateTradeSlippage = void 0;
|
|
4
4
|
const types_1 = require("../types");
|
|
5
|
-
const anchor_1 = require("
|
|
5
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
6
6
|
const assert_1 = require("../assert/assert");
|
|
7
7
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
8
8
|
const market_1 = require("./market");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
|
-
import { BN } from '
|
|
2
|
+
import { BN } from '../isomorphic/anchor';
|
|
3
3
|
export declare function clampBN(x: BN, min: BN, max: BN): BN;
|
|
4
4
|
export declare const squareRootBN: (n: BN) => BN;
|
|
5
5
|
export declare const divCeil: (a: BN, b: BN) => BN;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.numberToSafeBN = exports.isBNSafe = exports.checkSameDate = exports.timeRemainingUntilUpdate = exports.sigNum = exports.divCeil = exports.squareRootBN = exports.clampBN = void 0;
|
|
4
|
-
const anchor_1 = require("
|
|
4
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
5
5
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
6
6
|
function clampBN(x, min, max) {
|
|
7
7
|
return anchor_1.BN.max(min, anchor_1.BN.min(x, max));
|
package/lib/browser/memcmp.js
CHANGED
|
@@ -5,13 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getConstituentLpPoolFilter = exports.getConstituentFilter = exports.getRevenueShareEscrowFilter = exports.getSpotMarketAccountsFilter = exports.getPerpMarketAccountsFilter = exports.getSignedMsgUserOrdersFilter = exports.getUserStatsIsReferredOrReferrerFilter = exports.getUserStatsIsReferredFilter = exports.getUserStatsFilter = exports.getUsersWithPoolId = exports.getUserWithName = exports.getUserThatHasBeenLP = exports.getUserWithAuctionFilter = exports.getUserWithoutOrderFilter = exports.getUserWithOrderFilter = exports.getNonIdleUserFilter = exports.getUserFilter = void 0;
|
|
7
7
|
const bs58_1 = __importDefault(require("bs58"));
|
|
8
|
-
const
|
|
8
|
+
const anchor29_1 = require("./isomorphic/anchor29");
|
|
9
9
|
const userName_1 = require("./userName");
|
|
10
10
|
function getUserFilter() {
|
|
11
11
|
return {
|
|
12
12
|
memcmp: {
|
|
13
13
|
offset: 0,
|
|
14
|
-
bytes: bs58_1.default.encode(
|
|
14
|
+
bytes: bs58_1.default.encode(anchor29_1.BorshAccountsCoder.accountDiscriminator('User')),
|
|
15
15
|
},
|
|
16
16
|
};
|
|
17
17
|
}
|
|
@@ -83,7 +83,7 @@ function getUserStatsFilter() {
|
|
|
83
83
|
return {
|
|
84
84
|
memcmp: {
|
|
85
85
|
offset: 0,
|
|
86
|
-
bytes: bs58_1.default.encode(
|
|
86
|
+
bytes: bs58_1.default.encode(anchor29_1.BorshAccountsCoder.accountDiscriminator('UserStats')),
|
|
87
87
|
},
|
|
88
88
|
};
|
|
89
89
|
}
|
|
@@ -110,7 +110,7 @@ function getSignedMsgUserOrdersFilter() {
|
|
|
110
110
|
return {
|
|
111
111
|
memcmp: {
|
|
112
112
|
offset: 0,
|
|
113
|
-
bytes: bs58_1.default.encode(
|
|
113
|
+
bytes: bs58_1.default.encode(anchor29_1.BorshAccountsCoder.accountDiscriminator('SignedMsgUserOrders')),
|
|
114
114
|
},
|
|
115
115
|
};
|
|
116
116
|
}
|
|
@@ -119,7 +119,7 @@ function getPerpMarketAccountsFilter() {
|
|
|
119
119
|
return {
|
|
120
120
|
memcmp: {
|
|
121
121
|
offset: 0,
|
|
122
|
-
bytes: bs58_1.default.encode(
|
|
122
|
+
bytes: bs58_1.default.encode(anchor29_1.BorshAccountsCoder.accountDiscriminator('PerpMarket')),
|
|
123
123
|
},
|
|
124
124
|
};
|
|
125
125
|
}
|
|
@@ -128,7 +128,7 @@ function getSpotMarketAccountsFilter() {
|
|
|
128
128
|
return {
|
|
129
129
|
memcmp: {
|
|
130
130
|
offset: 0,
|
|
131
|
-
bytes: bs58_1.default.encode(
|
|
131
|
+
bytes: bs58_1.default.encode(anchor29_1.BorshAccountsCoder.accountDiscriminator('SpotMarket')),
|
|
132
132
|
},
|
|
133
133
|
};
|
|
134
134
|
}
|
|
@@ -137,7 +137,7 @@ function getRevenueShareEscrowFilter() {
|
|
|
137
137
|
return {
|
|
138
138
|
memcmp: {
|
|
139
139
|
offset: 0,
|
|
140
|
-
bytes: bs58_1.default.encode(
|
|
140
|
+
bytes: bs58_1.default.encode(anchor29_1.BorshAccountsCoder.accountDiscriminator('RevenueShareEscrow')),
|
|
141
141
|
},
|
|
142
142
|
};
|
|
143
143
|
}
|
|
@@ -146,7 +146,7 @@ function getConstituentFilter() {
|
|
|
146
146
|
return {
|
|
147
147
|
memcmp: {
|
|
148
148
|
offset: 0,
|
|
149
|
-
bytes: bs58_1.default.encode(
|
|
149
|
+
bytes: bs58_1.default.encode(anchor29_1.BorshAccountsCoder.accountDiscriminator('Constituent')),
|
|
150
150
|
},
|
|
151
151
|
};
|
|
152
152
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
2
|
import { Connection, PublicKey } from '@solana/web3.js';
|
|
3
3
|
import { BulkAccountLoader } from '../accounts/bulkAccountLoader';
|
|
4
|
-
import { BN } from '
|
|
4
|
+
import { BN } from '../isomorphic/anchor29';
|
|
5
5
|
import { L2Level, L2OrderBookGenerator } from '../dlob/orderBookLevels';
|
|
6
6
|
import { Market, OpenBookV2Client } from '@openbook-dex/openbook-v2';
|
|
7
7
|
export type OpenbookV2SubscriberConfig = {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.OpenbookV2Subscriber = void 0;
|
|
7
7
|
const web3_js_1 = require("@solana/web3.js");
|
|
8
8
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
9
|
-
const
|
|
9
|
+
const anchor29_1 = require("../isomorphic/anchor29");
|
|
10
10
|
const openbook_v2_1 = require("@openbook-dex/openbook-v2");
|
|
11
11
|
const openbook_json_1 = __importDefault(require("../idl/openbook.json"));
|
|
12
12
|
class OpenbookV2Subscriber {
|
|
@@ -27,8 +27,8 @@ class OpenbookV2Subscriber {
|
|
|
27
27
|
if (this.subscribed === true) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
const anchorProvider = new
|
|
31
|
-
const openbookV2Program = new
|
|
30
|
+
const anchorProvider = new anchor29_1.AnchorProvider(this.connection, new anchor29_1.Wallet(web3_js_1.Keypair.generate()), {});
|
|
31
|
+
const openbookV2Program = new anchor29_1.Program(openbook_json_1.default, this.programId, anchorProvider);
|
|
32
32
|
this.client = new openbook_v2_1.OpenBookV2Client(anchorProvider);
|
|
33
33
|
const market = await openbook_v2_1.Market.load(this.client, this.marketAddress);
|
|
34
34
|
this.market = await market.loadOrderBook();
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/// <reference types="node" />
|
|
4
4
|
import { Connection, PublicKey } from '@solana/web3.js';
|
|
5
5
|
import { OracleClient, OraclePriceData } from './types';
|
|
6
|
-
import { BN } from '
|
|
6
|
+
import { BN } from '../isomorphic/anchor';
|
|
7
7
|
export declare class PythClient implements OracleClient {
|
|
8
8
|
private connection;
|
|
9
9
|
private multiple;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PythClient = void 0;
|
|
4
4
|
const client_1 = require("@pythnetwork/client");
|
|
5
|
-
const anchor_1 = require("
|
|
5
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
6
6
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
7
7
|
class PythClient {
|
|
8
8
|
constructor(connection, multiple = numericConstants_1.ONE, stableCoin = false) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/// <reference types="bn.js" />
|
|
4
4
|
import { Connection, PublicKey } from '@solana/web3.js';
|
|
5
5
|
import { OracleClient, OraclePriceData } from './types';
|
|
6
|
-
import { BN } from '
|
|
6
|
+
import { BN } from '../isomorphic/anchor';
|
|
7
7
|
export declare class PythLazerClient implements OracleClient {
|
|
8
8
|
private connection;
|
|
9
9
|
private multiple;
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.PythLazerClient = void 0;
|
|
7
7
|
const web3_js_1 = require("@solana/web3.js");
|
|
8
|
-
const anchor_1 = require("
|
|
8
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
9
9
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
10
10
|
const wallet_1 = require("../wallet");
|
|
11
11
|
const drift_json_1 = __importDefault(require("../idl/drift.json"));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.QuoteAssetOracleClient = exports.QUOTE_ORACLE_PRICE_DATA = void 0;
|
|
4
|
-
const anchor_1 = require("
|
|
4
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
5
5
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
6
6
|
exports.QUOTE_ORACLE_PRICE_DATA = {
|
|
7
7
|
price: numericConstants_1.PRICE_PRECISION,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StrictOraclePrice = void 0;
|
|
4
|
-
const anchor_1 = require("
|
|
4
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
5
5
|
class StrictOraclePrice {
|
|
6
6
|
constructor(current, twap) {
|
|
7
7
|
this.current = current;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* in this directory that fetches and normalises prices into OraclePriceData.
|
|
8
8
|
* Oracle client selection is configured via DriftClientConfig and cached in OracleClientCache.
|
|
9
9
|
*/
|
|
10
|
-
import { BN } from '
|
|
10
|
+
import { BN } from '../isomorphic/anchor';
|
|
11
11
|
import { PublicKey } from '@solana/web3.js';
|
|
12
12
|
import { OracleSource } from '../types';
|
|
13
13
|
export type MMOraclePriceData = Omit<OraclePriceData, 'twap' | 'twapConfidence' | 'maxPrice'> & {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
|
-
import { BN } from '
|
|
2
|
+
import { BN } from '../isomorphic/anchor';
|
|
3
3
|
import { OraclePriceData } from './types';
|
|
4
4
|
export declare function getOracleConfidenceFromMMOracleData(mmOraclePrice: BN, oraclePriceData: OraclePriceData): BN;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
2
|
import { OptionalOrderParams, OrderParams, OrderTriggerCondition } from './types';
|
|
3
|
-
import { BN } from '
|
|
3
|
+
import { BN } from './isomorphic/anchor';
|
|
4
4
|
export declare function getLimitOrderParams(params: Omit<OptionalOrderParams, 'orderType'> & {
|
|
5
5
|
price: BN;
|
|
6
6
|
}): OptionalOrderParams;
|
|
@@ -8,7 +8,7 @@ const DLOB_1 = require("../dlob/DLOB");
|
|
|
8
8
|
const PollingSubscription_1 = require("./PollingSubscription");
|
|
9
9
|
const WebsocketSubscription_1 = require("./WebsocketSubscription");
|
|
10
10
|
const events_1 = require("events");
|
|
11
|
-
const anchor_1 = require("
|
|
11
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
12
12
|
const user_1 = require("../decode/user");
|
|
13
13
|
const grpcSubscription_1 = require("./grpcSubscription");
|
|
14
14
|
const userStatus_1 = require("../math/userStatus");
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Connection, PublicKey } from '@solana/web3.js';
|
|
3
3
|
import { BulkAccountLoader } from '../accounts/bulkAccountLoader';
|
|
4
4
|
import { Client, Market } from '@ellipsis-labs/phoenix-sdk';
|
|
5
|
-
import { BN } from '
|
|
5
|
+
import { BN } from '../isomorphic/anchor';
|
|
6
6
|
import { L2Level, L2OrderBookGenerator } from '../dlob/orderBookLevels';
|
|
7
7
|
export type PhoenixMarketSubscriberConfig = {
|
|
8
8
|
connection: Connection;
|
|
@@ -4,7 +4,7 @@ exports.PhoenixSubscriber = void 0;
|
|
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
|
5
5
|
const phoenix_sdk_1 = require("@ellipsis-labs/phoenix-sdk");
|
|
6
6
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
7
|
-
const anchor_1 = require("
|
|
7
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
8
8
|
const phoenix_1 = require("../decode/phoenix");
|
|
9
9
|
class PhoenixSubscriber {
|
|
10
10
|
constructor(config) {
|
|
@@ -3,7 +3,7 @@ import { Connection, PublicKey } from '@solana/web3.js';
|
|
|
3
3
|
import { BulkAccountLoader } from '../accounts/bulkAccountLoader';
|
|
4
4
|
import { Market, Orderbook } from '@project-serum/serum';
|
|
5
5
|
import { SerumMarketSubscriberConfig } from './types';
|
|
6
|
-
import { BN } from '
|
|
6
|
+
import { BN } from '../isomorphic/anchor';
|
|
7
7
|
import { L2Level, L2OrderBookGenerator } from '../dlob/orderBookLevels';
|
|
8
8
|
export declare class SerumSubscriber implements L2OrderBookGenerator {
|
|
9
9
|
connection: Connection;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SerumSubscriber = void 0;
|
|
4
4
|
const serum_1 = require("@project-serum/serum");
|
|
5
|
-
const anchor_1 = require("
|
|
5
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
6
6
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
7
7
|
class SerumSubscriber {
|
|
8
8
|
constructor(config) {
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.SlothashSubscriber = void 0;
|
|
4
7
|
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
-
const
|
|
6
|
-
const anchor_1 = require("
|
|
8
|
+
const bs58_1 = __importDefault(require("bs58"));
|
|
9
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
7
10
|
class SlothashSubscriber {
|
|
8
11
|
constructor(connection, config) {
|
|
9
12
|
var _a;
|
|
@@ -77,7 +80,7 @@ class SlothashSubscriber {
|
|
|
77
80
|
exports.SlothashSubscriber = SlothashSubscriber;
|
|
78
81
|
function deserializeSlothash(data) {
|
|
79
82
|
const slotNumber = new anchor_1.BN(data.subarray(8, 16), 10, 'le');
|
|
80
|
-
const hash =
|
|
83
|
+
const hash = bs58_1.default.encode(data.subarray(16, 48));
|
|
81
84
|
return {
|
|
82
85
|
slot: slotNumber.toNumber(),
|
|
83
86
|
hash,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
2
|
import { Connection, PublicKey, TransactionMessage, AddressLookupTableAccount, VersionedTransaction, TransactionInstruction } from '@solana/web3.js';
|
|
3
|
-
import { BN } from '
|
|
3
|
+
import { BN } from '../isomorphic/anchor';
|
|
4
4
|
import { JupiterClient } from '../jupiter/jupiterClient';
|
|
5
5
|
import { TitanClient } from '../titan/titanClient';
|
|
6
6
|
export type SwapMode = 'ExactIn' | 'ExactOut';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
2
|
import { Connection, PublicKey, TransactionMessage, AddressLookupTableAccount, TransactionInstruction } from '@solana/web3.js';
|
|
3
|
-
import { BN } from '
|
|
3
|
+
import { BN } from '../isomorphic/anchor';
|
|
4
4
|
export declare enum SwapMode {
|
|
5
5
|
ExactIn = "ExactIn",
|
|
6
6
|
ExactOut = "ExactOut"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
|
-
import * as anchor from '
|
|
3
|
-
import { AnchorProvider, Program } from '
|
|
2
|
+
import * as anchor from './isomorphic/anchor29';
|
|
3
|
+
import { AnchorProvider, Program } from './isomorphic/anchor29';
|
|
4
4
|
import { Account } from '@solana/spl-token';
|
|
5
5
|
import { ConfirmOptions, Connection, PublicKey, TransactionInstruction, TransactionSignature } from '@solana/web3.js';
|
|
6
6
|
import { IWallet } from './types';
|
|
7
7
|
import { BankrunContextWrapper } from './bankrun/bankrunConnection';
|
|
8
|
-
import { BN } from '
|
|
8
|
+
import { BN } from './isomorphic/anchor';
|
|
9
9
|
export declare class TokenFaucet {
|
|
10
10
|
context?: BankrunContextWrapper;
|
|
11
11
|
connection: Connection;
|
|
@@ -27,8 +27,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.TokenFaucet = void 0;
|
|
30
|
-
const anchor = __importStar(require("
|
|
31
|
-
const
|
|
30
|
+
const anchor = __importStar(require("./isomorphic/anchor29"));
|
|
31
|
+
const anchor29_1 = require("./isomorphic/anchor29");
|
|
32
32
|
const spl_token_1 = require("@solana/spl-token");
|
|
33
33
|
const web3_js_1 = require("@solana/web3.js");
|
|
34
34
|
const token_faucet_json_1 = __importDefault(require("./idl/token_faucet.json"));
|
|
@@ -40,11 +40,11 @@ class TokenFaucet {
|
|
|
40
40
|
this.wallet = wallet;
|
|
41
41
|
this.opts = opts || config_1.DEFAULT_CONFIRMATION_OPTS;
|
|
42
42
|
// @ts-ignore
|
|
43
|
-
const provider = new
|
|
43
|
+
const provider = new anchor29_1.AnchorProvider(context ? context.connection.toConnection() : this.connection,
|
|
44
44
|
// @ts-ignore
|
|
45
45
|
wallet, this.opts);
|
|
46
46
|
this.provider = provider;
|
|
47
|
-
this.program = new
|
|
47
|
+
this.program = new anchor29_1.Program(token_faucet_json_1.default, programId, provider);
|
|
48
48
|
this.mint = mint;
|
|
49
49
|
}
|
|
50
50
|
async getFaucetConfigPublicKeyAndNonce() {
|
package/lib/browser/types.d.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* Do not edit struct shapes here without a corresponding on-chain change.
|
|
14
14
|
*/
|
|
15
15
|
import { Keypair, PublicKey, Transaction, TransactionVersion, VersionedTransaction } from '@solana/web3.js';
|
|
16
|
-
import { BN } from '
|
|
16
|
+
import { BN } from './isomorphic/anchor';
|
|
17
17
|
export type MappedRecord<A extends Record<string, unknown>, B> = {
|
|
18
18
|
[K in keyof A]: B;
|
|
19
19
|
};
|
package/lib/browser/user.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ import StrictEventEmitter from 'strict-event-emitter-types';
|
|
|
19
19
|
import { DriftClient } from './driftClient';
|
|
20
20
|
import { HealthComponent, HealthComponents, MarginCategory, Order, PerpMarketAccount, PerpPosition, SpotPosition, UserAccount, UserStatus, UserStatsAccount, AccountLiquidatableStatus } from './types';
|
|
21
21
|
import { DataAndSlot, UserAccountEvents, UserAccountSubscriber } from './accounts/types';
|
|
22
|
-
import { BN } from '
|
|
22
|
+
import { BN } from './isomorphic/anchor';
|
|
23
23
|
import { MarketType, PositionDirection, SpotMarketAccount } from './types';
|
|
24
24
|
import { UserStats } from './userStats';
|
|
25
25
|
import { OraclePriceData } from './oracles/types';
|
package/lib/browser/user.js
CHANGED
|
@@ -5,7 +5,7 @@ const types_1 = require("./types");
|
|
|
5
5
|
const position_1 = require("./math/position");
|
|
6
6
|
const numericConstants_1 = require("./constants/numericConstants");
|
|
7
7
|
const bigNum_1 = require("./factory/bigNum");
|
|
8
|
-
const anchor_1 = require("
|
|
8
|
+
const anchor_1 = require("./isomorphic/anchor");
|
|
9
9
|
const position_2 = require("./math/position");
|
|
10
10
|
const market_1 = require("./math/market");
|
|
11
11
|
const margin_1 = require("./math/margin");
|