@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
|
@@ -15,7 +15,7 @@ import { DriftEnv } from './config';
|
|
|
15
15
|
import { TxSender } from './tx/types';
|
|
16
16
|
import { TxHandler, TxHandlerConfig } from './tx/txHandler';
|
|
17
17
|
import { GrpcConfigs, ResubOpts, DelistedMarketSetting } from './accounts/types';
|
|
18
|
-
import { Coder, Program } from '
|
|
18
|
+
import { Coder, Program } from './isomorphic/anchor';
|
|
19
19
|
import { WebSocketAccountSubscriber } from './accounts/webSocketAccountSubscriber';
|
|
20
20
|
import { WebSocketAccountSubscriberV2 } from './accounts/webSocketAccountSubscriberV2';
|
|
21
21
|
import { grpcDriftClientAccountSubscriberV2 } from './accounts/grpcDriftClientAccountSubscriberV2';
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* See `events/types.ts` for the full event type union and `events/parse.ts` for log parsing.
|
|
9
9
|
*/
|
|
10
10
|
import { Connection, TransactionSignature } from '@solana/web3.js';
|
|
11
|
-
import { Program } from '
|
|
11
|
+
import { Program } from '../isomorphic/anchor';
|
|
12
12
|
import { EventSubscriptionOptions, EventType, WrappedEvents, EventMap, EventSubscriberEvents, LogProviderType } from './types';
|
|
13
13
|
import { EventList } from './eventList';
|
|
14
14
|
import { EventEmitter } from 'events';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Program, Event } from '
|
|
1
|
+
import { Program, Event } from '../isomorphic/anchor';
|
|
2
2
|
import { CuUsageEvent } from './types';
|
|
3
3
|
export declare function parseLogs(program: Program, logs: string[], programId?: string): Event[];
|
|
4
4
|
export declare function parseLogsWithRaw(program: Program, logs: string[], programId?: string): {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BigNum = 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
|
class BigNum {
|
|
@@ -4,7 +4,7 @@ exports.getOracleClient = void 0;
|
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
const pythClient_1 = require("../oracles/pythClient");
|
|
6
6
|
const quoteAssetOracleClient_1 = require("../oracles/quoteAssetOracleClient");
|
|
7
|
-
const anchor_1 = require("
|
|
7
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
8
8
|
const prelaunchOracleClient_1 = require("../oracles/prelaunchOracleClient");
|
|
9
9
|
const pythLazerClient_1 = require("../oracles/pythLazerClient");
|
|
10
10
|
function getOracleClient(oracleSource, connection, program) {
|
package/lib/browser/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Key re-exported namespaces: types, addresses/pda, accounts (subscribers), math, events, oracles, constants.
|
|
12
12
|
*/
|
|
13
|
-
import { BN } from '
|
|
13
|
+
import { BN } from './isomorphic/anchor';
|
|
14
14
|
import { PublicKey } from '@solana/web3.js';
|
|
15
15
|
import pyth from '@pythnetwork/client';
|
|
16
16
|
export * from './tokenFaucet';
|
|
@@ -148,4 +148,5 @@ export * from './math/userStatus';
|
|
|
148
148
|
export * from './indicative-quotes/indicativeQuotesSender';
|
|
149
149
|
export * from './constants';
|
|
150
150
|
export * from './constituentMap/constituentMap';
|
|
151
|
+
export * from './core';
|
|
151
152
|
export { BN, PublicKey, pyth };
|
package/lib/browser/index.js
CHANGED
|
@@ -30,7 +30,7 @@ exports.pyth = exports.PublicKey = exports.BN = exports.PythLazerSubscriber = ex
|
|
|
30
30
|
*
|
|
31
31
|
* Key re-exported namespaces: types, addresses/pda, accounts (subscribers), math, events, oracles, constants.
|
|
32
32
|
*/
|
|
33
|
-
const anchor_1 = require("
|
|
33
|
+
const anchor_1 = require("./isomorphic/anchor");
|
|
34
34
|
Object.defineProperty(exports, "BN", { enumerable: true, get: function () { return anchor_1.BN; } });
|
|
35
35
|
const web3_js_1 = require("@solana/web3.js");
|
|
36
36
|
Object.defineProperty(exports, "PublicKey", { enumerable: true, get: function () { return web3_js_1.PublicKey; } });
|
|
@@ -179,3 +179,4 @@ __exportStar(require("./math/userStatus"), exports);
|
|
|
179
179
|
__exportStar(require("./indicative-quotes/indicativeQuotesSender"), exports);
|
|
180
180
|
__exportStar(require("./constants"), exports);
|
|
181
181
|
__exportStar(require("./constituentMap/constituentMap"), exports);
|
|
182
|
+
__exportStar(require("./core"), exports);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import BNJS from 'bn.js';
|
|
2
|
+
import * as web3 from '@solana/web3.js';
|
|
3
|
+
export declare class BN extends BNJS {
|
|
4
|
+
}
|
|
5
|
+
export { BorshAccountsCoder, BorshEventCoder, BorshInstructionCoder, BorshCoder, } from '@anchor-lang/core';
|
|
6
|
+
export declare const utils: {
|
|
7
|
+
bytes: {
|
|
8
|
+
utf8: {
|
|
9
|
+
encode: (s: string) => Uint8Array;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export { web3 };
|
|
14
|
+
export declare class AnchorProvider {
|
|
15
|
+
constructor();
|
|
16
|
+
}
|
|
17
|
+
export declare class Program<_T = any> {
|
|
18
|
+
constructor();
|
|
19
|
+
}
|
|
20
|
+
export type Idl = any;
|
|
21
|
+
export type Coder = any;
|
|
22
|
+
export type ProgramAccount = any;
|
|
23
|
+
export type Event = any;
|
|
24
|
+
export type Wallet = any;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.Program = exports.AnchorProvider = exports.web3 = exports.utils = exports.BorshCoder = exports.BorshInstructionCoder = exports.BorshEventCoder = exports.BorshAccountsCoder = exports.BN = void 0;
|
|
30
|
+
// eslint-disable-next-line no-restricted-imports -- browser stub: minimal BN without pulling full Anchor
|
|
31
|
+
const bn_js_1 = __importDefault(require("bn.js"));
|
|
32
|
+
const web3 = __importStar(require("@solana/web3.js"));
|
|
33
|
+
exports.web3 = web3;
|
|
34
|
+
class BN extends bn_js_1.default {
|
|
35
|
+
}
|
|
36
|
+
exports.BN = BN;
|
|
37
|
+
var core_1 = require("@anchor-lang/core");
|
|
38
|
+
Object.defineProperty(exports, "BorshAccountsCoder", { enumerable: true, get: function () { return core_1.BorshAccountsCoder; } });
|
|
39
|
+
Object.defineProperty(exports, "BorshEventCoder", { enumerable: true, get: function () { return core_1.BorshEventCoder; } });
|
|
40
|
+
Object.defineProperty(exports, "BorshInstructionCoder", { enumerable: true, get: function () { return core_1.BorshInstructionCoder; } });
|
|
41
|
+
Object.defineProperty(exports, "BorshCoder", { enumerable: true, get: function () { return core_1.BorshCoder; } });
|
|
42
|
+
exports.utils = {
|
|
43
|
+
bytes: {
|
|
44
|
+
utf8: {
|
|
45
|
+
encode: (s) => new TextEncoder().encode(s),
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
class AnchorProvider {
|
|
50
|
+
constructor() {
|
|
51
|
+
throw new Error('AnchorProvider is not supported in the browser build. Use `DriftCore` (pure builders/decoders/PDAs) instead of `DriftClient`.');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.AnchorProvider = AnchorProvider;
|
|
55
|
+
class Program {
|
|
56
|
+
constructor() {
|
|
57
|
+
throw new Error('Program is not supported in the browser build. Use `DriftCore` (pure builders/decoders/PDAs) instead of `DriftClient`.');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.Program = Program;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import BNJS from 'bn.js';
|
|
2
|
+
import * as web3 from '@solana/web3.js';
|
|
3
|
+
export declare class BN extends BNJS {
|
|
4
|
+
}
|
|
5
|
+
export { BorshAccountsCoder, BorshEventCoder, BorshInstructionCoder, BorshCoder, } from '@anchor-lang/core';
|
|
6
|
+
export declare const utils: {
|
|
7
|
+
bytes: {
|
|
8
|
+
utf8: {
|
|
9
|
+
encode: (s: string) => Uint8Array;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export { web3 };
|
|
14
|
+
export declare class AnchorProvider {
|
|
15
|
+
constructor();
|
|
16
|
+
}
|
|
17
|
+
export declare class Program<_T = any> {
|
|
18
|
+
constructor();
|
|
19
|
+
}
|
|
20
|
+
export type Idl = any;
|
|
21
|
+
export type Coder = any;
|
|
22
|
+
export type ProgramAccount = any;
|
|
23
|
+
export type Event = any;
|
|
24
|
+
export type Wallet = any;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.Program = exports.AnchorProvider = exports.web3 = exports.utils = exports.BorshCoder = exports.BorshInstructionCoder = exports.BorshEventCoder = exports.BorshAccountsCoder = exports.BN = void 0;
|
|
30
|
+
// eslint-disable-next-line no-restricted-imports -- browser stub: minimal BN without pulling full Anchor
|
|
31
|
+
const bn_js_1 = __importDefault(require("bn.js"));
|
|
32
|
+
const web3 = __importStar(require("@solana/web3.js"));
|
|
33
|
+
exports.web3 = web3;
|
|
34
|
+
class BN extends bn_js_1.default {
|
|
35
|
+
}
|
|
36
|
+
exports.BN = BN;
|
|
37
|
+
var core_1 = require("@anchor-lang/core");
|
|
38
|
+
Object.defineProperty(exports, "BorshAccountsCoder", { enumerable: true, get: function () { return core_1.BorshAccountsCoder; } });
|
|
39
|
+
Object.defineProperty(exports, "BorshEventCoder", { enumerable: true, get: function () { return core_1.BorshEventCoder; } });
|
|
40
|
+
Object.defineProperty(exports, "BorshInstructionCoder", { enumerable: true, get: function () { return core_1.BorshInstructionCoder; } });
|
|
41
|
+
Object.defineProperty(exports, "BorshCoder", { enumerable: true, get: function () { return core_1.BorshCoder; } });
|
|
42
|
+
exports.utils = {
|
|
43
|
+
bytes: {
|
|
44
|
+
utf8: {
|
|
45
|
+
encode: (s) => new TextEncoder().encode(s),
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
class AnchorProvider {
|
|
50
|
+
constructor() {
|
|
51
|
+
throw new Error('AnchorProvider is not supported in the browser build. Use `DriftCore` (pure builders/decoders/PDAs) instead of `DriftClient`.');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.AnchorProvider = AnchorProvider;
|
|
55
|
+
class Program {
|
|
56
|
+
constructor() {
|
|
57
|
+
throw new Error('Program is not supported in the browser build. Use `DriftCore` (pure builders/decoders/PDAs) instead of `DriftClient`.');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.Program = Program;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import BNJS from 'bn.js';
|
|
2
|
+
import * as web3 from '@solana/web3.js';
|
|
3
|
+
export declare class BN extends BNJS {
|
|
4
|
+
}
|
|
5
|
+
export { web3 };
|
|
6
|
+
export declare class AnchorProvider {
|
|
7
|
+
constructor();
|
|
8
|
+
}
|
|
9
|
+
export declare class Program<_T = any> {
|
|
10
|
+
constructor();
|
|
11
|
+
}
|
|
12
|
+
export type IdlAccounts<_T = any> = any;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.Program = exports.AnchorProvider = exports.web3 = exports.BN = void 0;
|
|
30
|
+
// eslint-disable-next-line no-restricted-imports -- browser stub: minimal BN without pulling full Anchor
|
|
31
|
+
const bn_js_1 = __importDefault(require("bn.js"));
|
|
32
|
+
const web3 = __importStar(require("@solana/web3.js"));
|
|
33
|
+
exports.web3 = web3;
|
|
34
|
+
class BN extends bn_js_1.default {
|
|
35
|
+
}
|
|
36
|
+
exports.BN = BN;
|
|
37
|
+
class AnchorProvider {
|
|
38
|
+
constructor() {
|
|
39
|
+
throw new Error('Anchor (0.29) is not supported in the browser build. Use `DriftCore` instead of `DriftClient`.');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.AnchorProvider = AnchorProvider;
|
|
43
|
+
class Program {
|
|
44
|
+
constructor() {
|
|
45
|
+
throw new Error('Anchor (0.29) Program is not supported in the browser build. Use `DriftCore` instead of `DriftClient`.');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.Program = Program;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import BNJS from 'bn.js';
|
|
2
|
+
import * as web3 from '@solana/web3.js';
|
|
3
|
+
export declare class BN extends BNJS {
|
|
4
|
+
}
|
|
5
|
+
export { web3 };
|
|
6
|
+
export declare class AnchorProvider {
|
|
7
|
+
constructor();
|
|
8
|
+
}
|
|
9
|
+
export declare class Program<_T = any> {
|
|
10
|
+
constructor();
|
|
11
|
+
}
|
|
12
|
+
export type IdlAccounts<_T = any> = any;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.Program = exports.AnchorProvider = exports.web3 = exports.BN = void 0;
|
|
30
|
+
// eslint-disable-next-line no-restricted-imports -- browser stub: minimal BN without pulling full Anchor
|
|
31
|
+
const bn_js_1 = __importDefault(require("bn.js"));
|
|
32
|
+
const web3 = __importStar(require("@solana/web3.js"));
|
|
33
|
+
exports.web3 = web3;
|
|
34
|
+
class BN extends bn_js_1.default {
|
|
35
|
+
}
|
|
36
|
+
exports.BN = BN;
|
|
37
|
+
class AnchorProvider {
|
|
38
|
+
constructor() {
|
|
39
|
+
throw new Error('Anchor (0.29) is not supported in the browser build. Use `DriftCore` instead of `DriftClient`.');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.AnchorProvider = AnchorProvider;
|
|
43
|
+
class Program {
|
|
44
|
+
constructor() {
|
|
45
|
+
throw new Error('Anchor (0.29) Program is not supported in the browser build. Use `DriftCore` instead of `DriftClient`.');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.Program = Program;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
2
|
import { AddressLookupTableAccount, Connection, PublicKey, TransactionInstruction, TransactionMessage, VersionedTransaction } from '@solana/web3.js';
|
|
3
|
-
import { BN } from '
|
|
3
|
+
import { BN } from '../isomorphic/anchor';
|
|
4
4
|
import { SwapMode } from '../swap/UnifiedSwapClient';
|
|
5
5
|
export interface MarketInfo {
|
|
6
6
|
id: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
|
-
import { AnchorProvider, BN, Program } from '
|
|
2
|
+
import { AnchorProvider, BN, Program } from '../isomorphic/anchor29';
|
|
3
3
|
import { MarinadeFinance } from './types';
|
|
4
4
|
import { PublicKey, TransactionInstruction } from '@solana/web3.js';
|
|
5
5
|
export declare function getMarinadeFinanceProgram(provider: AnchorProvider): Program<MarinadeFinance>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getMarinadeMSolPrice = exports.getMarinadeDepositIx = exports.getMarinadeFinanceProgram = void 0;
|
|
4
|
-
const
|
|
4
|
+
const anchor29_1 = require("../isomorphic/anchor29");
|
|
5
5
|
const types_1 = require("./types");
|
|
6
6
|
const web3_js_1 = require("@solana/web3.js");
|
|
7
7
|
const spl_token_1 = require("@solana/spl-token");
|
|
8
8
|
const marinadeFinanceProgramId = new web3_js_1.PublicKey('MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD');
|
|
9
9
|
function getMarinadeFinanceProgram(provider) {
|
|
10
|
-
return new
|
|
10
|
+
return new anchor29_1.Program(types_1.IDL, marinadeFinanceProgramId, provider);
|
|
11
11
|
}
|
|
12
12
|
exports.getMarinadeFinanceProgram = getMarinadeFinanceProgram;
|
|
13
13
|
function getMarinadeDepositIx({ program, amount, mSOLAccount, transferFrom, }) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
|
-
import { BN } from '
|
|
2
|
+
import { BN } from '../isomorphic/anchor';
|
|
3
3
|
import { AMM, PositionDirection, SwapDirection, PerpMarketAccount } from '../types';
|
|
4
4
|
import { MMOraclePriceData, OraclePriceData } from '../oracles/types';
|
|
5
5
|
export declare function calculatePegFromTargetPrice(targetPrice: BN, baseAssetReserve: BN, quoteAssetReserve: BN): BN;
|
package/lib/browser/math/amm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.calculateMaxBaseAssetAmountFillable = exports.calculateQuoteAssetAmountSwapped = exports.calculateMaxBaseAssetAmountToTrade = exports.calculateTerminalPrice = exports.getSwapDirection = exports.calculateSwapOutput = exports.calculateSpreadReserves = exports.calculateSpread = exports.calculateSpreadBN = exports.calculateVolSpreadBN = exports.calculateMaxSpread = exports.calculateEffectiveLeverage = exports.calculateReferencePriceOffset = exports.calculateInventoryScale = exports.calculateInventoryLiquidityRatioForReferencePriceOffset = exports.calculateInventoryLiquidityRatio = exports.calculateMarketOpenBidAsk = exports.calculateAmmReservesAfterSwap = exports.calculatePrice = exports.calculateBidAskPrice = exports.calculateUpdatedAMMSpreadReserves = exports.calculateUpdatedAMM = exports.calculateNewAmm = exports.calculateOptimalPegAndBudget = exports.calculatePegFromTargetPrice = 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 assert_1 = require("../assert/assert");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
2
|
import { Order, PositionDirection, StateAccount } from '../types';
|
|
3
|
-
import { BN } from '
|
|
3
|
+
import { BN } from '../isomorphic/anchor';
|
|
4
4
|
import { PerpMarketAccount } from '../types';
|
|
5
5
|
import { MMOraclePriceData } from '../oracles/types';
|
|
6
6
|
export declare function isAuctionComplete(order: Order, slot: number): boolean;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getTriggerAuctionStartAndExecutionPrice = exports.getTriggerAuctionStartPrice = exports.deriveOracleAuctionParams = exports.getAuctionPriceForOracleOffsetAuction = exports.getAuctionPriceForFixedAuction = exports.getAuctionPrice = exports.isFallbackAvailableLiquiditySource = exports.isAuctionComplete = 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 types_2 = require("../types");
|
|
8
8
|
const tiers_1 = require("./tiers");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
|
-
import { BN } from '
|
|
2
|
+
import { BN } from '../isomorphic/anchor';
|
|
3
3
|
export declare const convertToNumber: (bigNumber: BN, precision?: BN) => number;
|
|
4
4
|
export declare function convertToBN(value: number, precision: BN): BN;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.convertToBN = exports.convertToNumber = 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 convertToNumber = (bigNumber, precision = numericConstants_1.PRICE_PRECISION) => {
|
|
7
7
|
if (!bigNumber)
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.isFormulaicKUpdateDisabled = exports.isMarketConfigFlagSet = exports.isAmmDrawdownPause = exports.isOperationPaused = exports.ammPaused = exports.fillPaused = exports.exchangePaused = void 0;
|
|
4
4
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
5
5
|
const types_1 = require("../types");
|
|
6
|
-
const anchor_1 = require("
|
|
6
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
7
7
|
function exchangePaused(state) {
|
|
8
8
|
return state.exchangeStatus !== types_1.ExchangeStatus.ACTIVE;
|
|
9
9
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
|
-
import { BN } from '
|
|
2
|
+
import { BN } from '../isomorphic/anchor';
|
|
3
3
|
import { SpotMarketAccount, PerpMarketAccount } from '../types';
|
|
4
4
|
export declare function calculateInsuranceFuelBonus(spotMarket: SpotMarketAccount, tokenStakeAmount: BN, fuelBonusNumerator: BN): BN;
|
|
5
5
|
export declare function calculateSpotFuelBonus(spotMarket: SpotMarketAccount, signedTokenValue: BN, fuelBonusNumerator: BN): BN;
|
package/lib/browser/math/fuel.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.calculatePerpFuelBonus = exports.calculateSpotFuelBonus = exports.calculateInsuranceFuelBonus = 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 calculateInsuranceFuelBonus(spotMarket, tokenStakeAmount, fuelBonusNumerator) {
|
|
7
7
|
const result = tokenStakeAmount
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.calculateFundingPool = exports.calculateLongShortFundingRateAndLiveTwaps = exports.calculateLongShortFundingRate = exports.calculateFormattedLiveFundingRate = exports.calculateAllEstimatedFundingRate = 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 bigNum_1 = require("../factory/bigNum");
|
|
7
7
|
const types_1 = require("../types");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
|
-
import { BN } from '
|
|
2
|
+
import { BN } from '../isomorphic/anchor';
|
|
3
3
|
import { SpotMarketAccount } from '../types';
|
|
4
4
|
export declare function nextRevenuePoolSettleApr(spotMarket: SpotMarketAccount, vaultBalance: BN, // vault token amount
|
|
5
5
|
amount?: BN): number;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.unstakeSharesToAmountWithOpenRequest = exports.unstakeSharesToAmount = exports.stakeAmountToShares = exports.nextRevenuePoolSettleApr = void 0;
|
|
4
4
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
5
5
|
const spotBalance_1 = require("../math/spotBalance");
|
|
6
|
-
const anchor_1 = require("
|
|
6
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
7
7
|
const types_1 = require("../types");
|
|
8
8
|
function nextRevenuePoolSettleApr(spotMarket, vaultBalance, // vault token amount
|
|
9
9
|
amount // delta token amount
|
|
@@ -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 calculateBaseAssetAmountToCoverMarginShortage(marginShortage: BN, marginRatio: number, liquidationFee: number, ifLiquidationFee: number, oraclePrice: BN, quoteOraclePrice: BN): BN | undefined;
|
|
4
4
|
export declare function calculateLiabilityTransferToCoverMarginShortage(marginShortage: BN, assetWeight: number, assetLiquidationMultiplier: number, liabilityWeight: number, liabilityLiquidationMultiplier: number, liabilityDecimals: number, liabilityPrice: BN, ifLiquidationFee: number): BN | undefined;
|
|
5
5
|
export declare function calculateAssetTransferForLiabilityTransfer(assetAmount: BN, assetLiquidationMultiplier: number, assetDecimals: number, assetPrice: BN, liabilityAmount: BN, liabilityLiquidationMultiplier: number, liabilityDecimals: number, liabilityPrice: BN): BN | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getMarginShortage = exports.calculateMaxPctToLiquidate = exports.calculateAssetTransferForLiabilityTransfer = exports.calculateLiabilityTransferToCoverMarginShortage = exports.calculateBaseAssetAmountToCoverMarginShortage = 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 calculateBaseAssetAmountToCoverMarginShortage(marginShortage, marginRatio, liquidationFee, ifLiquidationFee, oraclePrice, quoteOraclePrice) {
|
|
7
7
|
const marginRatioBN = new anchor_1.BN(marginRatio)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
|
-
import { BN } from '
|
|
2
|
+
import { BN } from '../isomorphic/anchor';
|
|
3
3
|
import { OraclePriceData } from '../oracles/types';
|
|
4
4
|
import { DriftClient } from '../driftClient';
|
|
5
5
|
import { PerpMarketAccount, PerpPosition, PositionDirection, UserAccount } from '../types';
|
|
@@ -8,7 +8,7 @@ exports.calculateUserMaxPerpOrderSize = exports.calculateLiquidationPrice = expo
|
|
|
8
8
|
*/
|
|
9
9
|
const utils_1 = require("./utils");
|
|
10
10
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
11
|
-
const anchor_1 = require("
|
|
11
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
12
12
|
const market_1 = require("./market");
|
|
13
13
|
const spotBalance_1 = require("./spotBalance");
|
|
14
14
|
const oneShotUserAccountSubscriber_1 = require("../accounts/oneShotUserAccountSubscriber");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
|
-
import { BN } from '
|
|
2
|
+
import { BN } from '../isomorphic/anchor';
|
|
3
3
|
import { PerpMarketAccount, PositionDirection, MarginCategory, SpotMarketAccount } from '../types';
|
|
4
4
|
import { MMOraclePriceData, OraclePriceData } from '../oracles/types';
|
|
5
5
|
import { DLOB } from '../dlob/DLOB';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getTriggerPrice = exports.calculatePerpMarketBaseLiquidatorFee = exports.calculateAvailablePerpLiquidity = exports.calculateNetUserPnlImbalance = exports.calculateNetUserPnl = exports.calculateMarketMaxAvailableInsurance = exports.calculateMarketAvailablePNL = exports.calculateUnrealizedAssetWeight = exports.calculateMarketMarginRatio = exports.calculateOracleSpread = exports.calculateOracleReserveSpread = exports.calculateNewMarketAfterTrade = exports.calculateAskPrice = exports.calculateBidPrice = exports.calculateReservePrice = void 0;
|
|
4
|
-
const anchor_1 = require("
|
|
4
|
+
const anchor_1 = require("../isomorphic/anchor");
|
|
5
5
|
const types_1 = require("../types");
|
|
6
6
|
const amm_1 = require("./amm");
|
|
7
7
|
const margin_1 = require("./margin");
|