@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
package/src/driftClientConfig.ts
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
ResubOpts,
|
|
24
24
|
DelistedMarketSetting,
|
|
25
25
|
} from './accounts/types';
|
|
26
|
-
import { Coder, Program } from '
|
|
26
|
+
import { Coder, Program } from './isomorphic/anchor';
|
|
27
27
|
import { WebSocketAccountSubscriber } from './accounts/webSocketAccountSubscriber';
|
|
28
28
|
import { WebSocketAccountSubscriberV2 } from './accounts/webSocketAccountSubscriberV2';
|
|
29
29
|
import { grpcDriftClientAccountSubscriberV2 } from './accounts/grpcDriftClientAccountSubscriberV2';
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* See `events/types.ts` for the full event type union and `events/parse.ts` for log parsing.
|
|
8
8
|
*/
|
|
9
9
|
import { Connection, PublicKey, TransactionSignature } from '@solana/web3.js';
|
|
10
|
-
import { Program } from '
|
|
10
|
+
import { Program } from '../isomorphic/anchor';
|
|
11
11
|
import {
|
|
12
12
|
DefaultEventSubscriptionOptions,
|
|
13
13
|
EventSubscriptionOptions,
|
package/src/events/fetchLogs.ts
CHANGED
package/src/events/parse.ts
CHANGED
package/src/factory/bigNum.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Connection } from '@solana/web3.js';
|
|
|
3
3
|
import { OracleClient } from '../oracles/types';
|
|
4
4
|
import { PythClient } from '../oracles/pythClient';
|
|
5
5
|
import { QuoteAssetOracleClient } from '../oracles/quoteAssetOracleClient';
|
|
6
|
-
import { BN } from '
|
|
6
|
+
import { BN } from '../isomorphic/anchor';
|
|
7
7
|
import { DriftProgram } from '../config';
|
|
8
8
|
import { PrelaunchOracleClient } from '../oracles/prelaunchOracleClient';
|
|
9
9
|
import { PythLazerClient } from '../oracles/pythLazerClient';
|
package/src/index.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
|
|
|
@@ -150,5 +150,6 @@ export * from './math/userStatus';
|
|
|
150
150
|
export * from './indicative-quotes/indicativeQuotesSender';
|
|
151
151
|
export * from './constants';
|
|
152
152
|
export * from './constituentMap/constituentMap';
|
|
153
|
+
export * from './core';
|
|
153
154
|
|
|
154
155
|
export { BN, PublicKey, pyth };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// eslint-disable-next-line no-restricted-imports -- browser stub: minimal BN without pulling full Anchor
|
|
2
|
+
import BNJS from 'bn.js';
|
|
3
|
+
import * as web3 from '@solana/web3.js';
|
|
4
|
+
|
|
5
|
+
export class BN extends BNJS {}
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
BorshAccountsCoder,
|
|
9
|
+
BorshEventCoder,
|
|
10
|
+
BorshInstructionCoder,
|
|
11
|
+
BorshCoder,
|
|
12
|
+
} from '@anchor-lang/core';
|
|
13
|
+
|
|
14
|
+
export const utils = {
|
|
15
|
+
bytes: {
|
|
16
|
+
utf8: {
|
|
17
|
+
encode: (s: string) => new TextEncoder().encode(s),
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { web3 };
|
|
23
|
+
|
|
24
|
+
export class AnchorProvider {
|
|
25
|
+
constructor() {
|
|
26
|
+
throw new Error(
|
|
27
|
+
'AnchorProvider is not supported in the browser build. Use `DriftCore` (pure builders/decoders/PDAs) instead of `DriftClient`.'
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export class Program<_T = any> {
|
|
33
|
+
constructor() {
|
|
34
|
+
throw new Error(
|
|
35
|
+
'Program is not supported in the browser build. Use `DriftCore` (pure builders/decoders/PDAs) instead of `DriftClient`.'
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type Idl = any;
|
|
41
|
+
export type Coder = any;
|
|
42
|
+
export type ProgramAccount = any;
|
|
43
|
+
export type Event = any;
|
|
44
|
+
export type Wallet = any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@coral-xyz/anchor';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@coral-xyz/anchor';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// eslint-disable-next-line no-restricted-imports -- browser stub: minimal BN without pulling full Anchor
|
|
2
|
+
import BNJS from 'bn.js';
|
|
3
|
+
import * as web3 from '@solana/web3.js';
|
|
4
|
+
|
|
5
|
+
export class BN extends BNJS {}
|
|
6
|
+
export { web3 };
|
|
7
|
+
|
|
8
|
+
export class AnchorProvider {
|
|
9
|
+
constructor() {
|
|
10
|
+
throw new Error(
|
|
11
|
+
'Anchor (0.29) is not supported in the browser build. Use `DriftCore` instead of `DriftClient`.'
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class Program<_T = any> {
|
|
17
|
+
constructor() {
|
|
18
|
+
throw new Error(
|
|
19
|
+
'Anchor (0.29) Program is not supported in the browser build. Use `DriftCore` instead of `DriftClient`.'
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type IdlAccounts<_T = any> = any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@coral-xyz/anchor-29';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@coral-xyz/anchor-29';
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
VersionedTransaction,
|
|
8
8
|
} from '@solana/web3.js';
|
|
9
9
|
import fetch from 'node-fetch';
|
|
10
|
-
import { BN } from '
|
|
10
|
+
import { BN } from '../isomorphic/anchor';
|
|
11
11
|
import { SwapMode } from '../swap/UnifiedSwapClient';
|
|
12
12
|
|
|
13
13
|
export interface MarketInfo {
|
package/src/marginCalculation.ts
CHANGED
package/src/marinade/index.ts
CHANGED
package/src/math/amm.ts
CHANGED
package/src/math/auction.ts
CHANGED
package/src/math/conversion.ts
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
InsuranceFundOperation,
|
|
15
15
|
MarketConfigFlag,
|
|
16
16
|
} from '../types';
|
|
17
|
-
import { BN } from '
|
|
17
|
+
import { BN } from '../isomorphic/anchor';
|
|
18
18
|
|
|
19
19
|
export function exchangePaused(state: StateAccount): boolean {
|
|
20
20
|
return state.exchangeStatus !== ExchangeStatus.ACTIVE;
|
package/src/math/fuel.ts
CHANGED
package/src/math/funding.ts
CHANGED
package/src/math/insurance.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PERCENTAGE_PRECISION, ZERO } from '../constants/numericConstants';
|
|
2
2
|
import { getTokenAmount } from '../math/spotBalance';
|
|
3
|
-
import { BN } from '
|
|
3
|
+
import { BN } from '../isomorphic/anchor';
|
|
4
4
|
import { SpotBalanceType, SpotMarketAccount } from '../types';
|
|
5
5
|
|
|
6
6
|
export function nextRevenuePoolSettleApr(
|
package/src/math/liquidation.ts
CHANGED
package/src/math/margin.ts
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
PRICE_PRECISION,
|
|
16
16
|
QUOTE_PRECISION,
|
|
17
17
|
} from '../constants/numericConstants';
|
|
18
|
-
import { BN } from '
|
|
18
|
+
import { BN } from '../isomorphic/anchor';
|
|
19
19
|
import { OraclePriceData } from '../oracles/types';
|
|
20
20
|
import { calculateMarketMarginRatio } from './market';
|
|
21
21
|
import { calculateScaledInitialAssetWeight } from './spotBalance';
|
package/src/math/market.ts
CHANGED
package/src/math/oracles.ts
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
FIVE,
|
|
20
20
|
} from '../constants/numericConstants';
|
|
21
21
|
import { assert } from '../assert/assert';
|
|
22
|
-
import { BN } from '
|
|
22
|
+
import { BN } from '../isomorphic/anchor';
|
|
23
23
|
|
|
24
24
|
export function oraclePriceBands(
|
|
25
25
|
market: PerpMarketAccount,
|
package/src/math/orders.ts
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
SPOT_MARKET_IMF_PRECISION,
|
|
19
19
|
MARGIN_PRECISION,
|
|
20
20
|
} from '../constants/numericConstants';
|
|
21
|
-
import { BN } from '
|
|
21
|
+
import { BN } from '../isomorphic/anchor';
|
|
22
22
|
import { MMOraclePriceData, OraclePriceData } from '../oracles/types';
|
|
23
23
|
import {
|
|
24
24
|
getAuctionPrice,
|
package/src/math/position.ts
CHANGED
package/src/math/repeg.ts
CHANGED
package/src/math/spotBalance.ts
CHANGED
package/src/math/spotMarket.ts
CHANGED
package/src/math/spotPosition.ts
CHANGED
package/src/math/state.ts
CHANGED
package/src/math/superStake.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import { JupiterClient, QuoteResponse } from '../jupiter/jupiterClient';
|
|
8
8
|
import { DriftClient } from '../driftClient';
|
|
9
9
|
import { getMarinadeFinanceProgram, getMarinadeMSolPrice } from '../marinade';
|
|
10
|
-
import { BN } from '
|
|
10
|
+
import { BN } from '../isomorphic/anchor';
|
|
11
11
|
import { User } from '../user';
|
|
12
12
|
import { DepositRecord, isVariant } from '../types';
|
|
13
13
|
import { LAMPORTS_PRECISION, ZERO } from '../constants/numericConstants';
|
package/src/math/trade.ts
CHANGED
package/src/math/utils.ts
CHANGED
package/src/memcmp.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MemcmpFilter, PublicKey } from '@solana/web3.js';
|
|
2
2
|
import bs58 from 'bs58';
|
|
3
|
-
import { BorshAccountsCoder } from '
|
|
3
|
+
import { BorshAccountsCoder } from './isomorphic/anchor29';
|
|
4
4
|
import { encodeName } from './userName';
|
|
5
5
|
|
|
6
6
|
export function getUserFilter(): MemcmpFilter {
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { Connection, Keypair, PublicKey } from '@solana/web3.js';
|
|
2
2
|
import { BulkAccountLoader } from '../accounts/bulkAccountLoader';
|
|
3
3
|
import { PRICE_PRECISION } from '../constants/numericConstants';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
AnchorProvider,
|
|
6
|
+
BN,
|
|
7
|
+
Idl,
|
|
8
|
+
Program,
|
|
9
|
+
Wallet,
|
|
10
|
+
} from '../isomorphic/anchor29';
|
|
5
11
|
import { L2Level, L2OrderBookGenerator } from '../dlob/orderBookLevels';
|
|
6
12
|
import { Market, OpenBookV2Client } from '@openbook-dex/openbook-v2';
|
|
7
13
|
import openbookV2Idl from '../idl/openbook.json';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { parsePriceData } from '@pythnetwork/client';
|
|
2
2
|
import { Connection, PublicKey } from '@solana/web3.js';
|
|
3
3
|
import { OracleClient, OraclePriceData } from './types';
|
|
4
|
-
import { BN } from '
|
|
4
|
+
import { BN } from '../isomorphic/anchor';
|
|
5
5
|
import {
|
|
6
6
|
ONE,
|
|
7
7
|
PRICE_PRECISION,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Connection, Keypair, PublicKey } from '@solana/web3.js';
|
|
2
2
|
import { OracleClient, OraclePriceData } from './types';
|
|
3
|
-
import { AnchorProvider, BN, Program } from '
|
|
3
|
+
import { AnchorProvider, BN, Program } from '../isomorphic/anchor';
|
|
4
4
|
import { Drift } from '../idl/drift';
|
|
5
5
|
import { DriftProgram } from '../config';
|
|
6
6
|
import {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PublicKey } from '@solana/web3.js';
|
|
2
2
|
import { OracleClient, OraclePriceData } from './types';
|
|
3
|
-
import { BN } from '
|
|
3
|
+
import { BN } from '../isomorphic/anchor';
|
|
4
4
|
import { PRICE_PRECISION } from '../constants/numericConstants';
|
|
5
5
|
|
|
6
6
|
export const QUOTE_ORACLE_PRICE_DATA: OraclePriceData = {
|
package/src/oracles/types.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* in this directory that fetches and normalises prices into OraclePriceData.
|
|
5
5
|
* Oracle client selection is configured via DriftClientConfig and cached in OracleClientCache.
|
|
6
6
|
*/
|
|
7
|
-
import { BN } from '
|
|
7
|
+
import { BN } from '../isomorphic/anchor';
|
|
8
8
|
import { PublicKey } from '@solana/web3.js';
|
|
9
9
|
import { OracleSource } from '../types';
|
|
10
10
|
|
package/src/oracles/utils.ts
CHANGED
package/src/orderParams.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { PollingSubscription } from './PollingSubscription';
|
|
|
13
13
|
import { WebsocketSubscription } from './WebsocketSubscription';
|
|
14
14
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
15
15
|
import { EventEmitter } from 'events';
|
|
16
|
-
import { BN } from '
|
|
16
|
+
import { BN } from '../isomorphic/anchor';
|
|
17
17
|
import { ProtectMakerParamsMap } from '../dlob/types';
|
|
18
18
|
import { decodeUser } from '../decode/user';
|
|
19
19
|
import { grpcSubscription } from './grpcSubscription';
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
getMarketLadder,
|
|
9
9
|
} from '@ellipsis-labs/phoenix-sdk';
|
|
10
10
|
import { PRICE_PRECISION } from '../constants/numericConstants';
|
|
11
|
-
import { BN } from '
|
|
11
|
+
import { BN } from '../isomorphic/anchor';
|
|
12
12
|
import { L2Level, L2OrderBookGenerator } from '../dlob/orderBookLevels';
|
|
13
13
|
import { fastDecode } from '../decode/phoenix';
|
|
14
14
|
|
package/src/pyth/types.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Connection, PublicKey } from '@solana/web3.js';
|
|
|
2
2
|
import { BulkAccountLoader } from '../accounts/bulkAccountLoader';
|
|
3
3
|
import { Market, Orderbook } from '@project-serum/serum';
|
|
4
4
|
import { SerumMarketSubscriberConfig } from './types';
|
|
5
|
-
import { BN } from '
|
|
5
|
+
import { BN } from '../isomorphic/anchor';
|
|
6
6
|
import { PRICE_PRECISION } from '../constants/numericConstants';
|
|
7
7
|
import { L2Level, L2OrderBookGenerator } from '../dlob/orderBookLevels';
|
|
8
8
|
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
Connection,
|
|
4
4
|
SYSVAR_SLOT_HASHES_PUBKEY,
|
|
5
5
|
} from '@solana/web3.js';
|
|
6
|
-
import
|
|
7
|
-
import { BN } from '
|
|
6
|
+
import bs58 from 'bs58';
|
|
7
|
+
import { BN } from '../isomorphic/anchor';
|
|
8
8
|
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
10
10
|
type SlothashSubscriberConfig = {
|
package/src/titan/titanClient.ts
CHANGED
package/src/tokenFaucet.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as anchor from '
|
|
2
|
-
import { AnchorProvider, Idl, Program } from '
|
|
1
|
+
import * as anchor from './isomorphic/anchor29';
|
|
2
|
+
import { AnchorProvider, Idl, Program } from './isomorphic/anchor29';
|
|
3
3
|
import {
|
|
4
4
|
TOKEN_PROGRAM_ID,
|
|
5
5
|
Account,
|
|
@@ -20,7 +20,7 @@ import tokenFaucet from './idl/token_faucet.json';
|
|
|
20
20
|
import { IWallet } from './types';
|
|
21
21
|
import { BankrunContextWrapper } from './bankrun/bankrunConnection';
|
|
22
22
|
import { DEFAULT_CONFIRMATION_OPTS } from './config';
|
|
23
|
-
import { BN } from '
|
|
23
|
+
import { BN } from './isomorphic/anchor';
|
|
24
24
|
|
|
25
25
|
export class TokenFaucet {
|
|
26
26
|
context?: BankrunContextWrapper;
|
package/src/types.ts
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
TransactionVersion,
|
|
17
17
|
VersionedTransaction,
|
|
18
18
|
} from '@solana/web3.js';
|
|
19
|
-
import { BN } from '
|
|
19
|
+
import { BN } from './isomorphic/anchor';
|
|
20
20
|
import { ZERO } from './constants/numericConstants';
|
|
21
21
|
|
|
22
22
|
// Utility type which lets you denote record with values of type A mapped to a record with the same keys but values of type B
|
package/src/user.ts
CHANGED
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
UserAccountSubscriber,
|
|
62
62
|
} from './accounts/types';
|
|
63
63
|
import { BigNum } from './factory/bigNum';
|
|
64
|
-
import { BN } from '
|
|
64
|
+
import { BN } from './isomorphic/anchor';
|
|
65
65
|
import { calculateBaseAssetValue, calculatePositionPNL } from './math/position';
|
|
66
66
|
import {
|
|
67
67
|
calculateMarketMarginRatio,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
getUserStatsIsReferredFilter,
|
|
15
15
|
getUserStatsIsReferredOrReferrerFilter,
|
|
16
16
|
} from '../memcmp';
|
|
17
|
-
import
|
|
17
|
+
import bs58 from 'bs58';
|
|
18
18
|
|
|
19
19
|
const DEFAULT_PUBLIC_KEY = PublicKey.default.toBase58();
|
|
20
20
|
|
package/src/userMap/userMap.ts
CHANGED
package/src/userStats.ts
CHANGED
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
GOV_SPOT_MARKET_INDEX,
|
|
22
22
|
QUOTE_SPOT_MARKET_INDEX,
|
|
23
23
|
} from './constants/numericConstants';
|
|
24
|
-
import { BN } from '
|
|
24
|
+
import { BN } from './isomorphic/anchor';
|
|
25
25
|
import { calculateInsuranceFuelBonus } from './math/fuel';
|
|
26
26
|
|
|
27
27
|
export class UserStats {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
2
|
+
import { DriftCore } from '../../src/core/DriftCore';
|
|
3
|
+
import { userAccountBufferStrings } from '../decode/userAccountBufferStrings';
|
|
4
|
+
|
|
5
|
+
describe('DriftCore decoding', () => {
|
|
6
|
+
test('can decode User account from fixture buffer', () => {
|
|
7
|
+
const s = userAccountBufferStrings[0];
|
|
8
|
+
const buf = Buffer.from(s, 'base64');
|
|
9
|
+
const decoded = DriftCore.decodeUserAccount(buf);
|
|
10
|
+
|
|
11
|
+
expect(decoded).toBeTruthy();
|
|
12
|
+
expect(decoded.authority).toBeTruthy();
|
|
13
|
+
expect(decoded.delegate).toBeTruthy();
|
|
14
|
+
expect(decoded.name).toBeTruthy();
|
|
15
|
+
});
|
|
16
|
+
});
|