@drift-labs/sdk-browser 2.163.0-beta.12 → 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/spotMarkets.d.ts +1 -1
- package/lib/browser/constants/spotMarkets.js +1 -1
- 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/spotMarkets.d.ts +1 -1
- package/lib/node/constants/spotMarkets.d.ts.map +1 -1
- package/lib/node/constants/spotMarkets.js +1 -1
- 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/spotMarkets.ts +1 -1
- 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
|
@@ -1,27 +1,4 @@
|
|
|
1
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
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
@@ -41,12 +18,11 @@ exports.DriftClient = void 0;
|
|
|
41
18
|
*
|
|
42
19
|
* Instruction → on-chain handler mapping: see ARCHITECTURE.md § SDK↔Instruction Mapping.
|
|
43
20
|
*/
|
|
44
|
-
const
|
|
45
|
-
const anchor_1 = require("@coral-xyz/anchor");
|
|
21
|
+
const anchor_1 = require("./isomorphic/anchor");
|
|
46
22
|
const bs58_1 = __importDefault(require("bs58"));
|
|
47
23
|
const spl_token_1 = require("@solana/spl-token");
|
|
48
24
|
const types_1 = require("./types");
|
|
49
|
-
const
|
|
25
|
+
const DriftCore_1 = require("./core/DriftCore");
|
|
50
26
|
/** Client-side guardrail; mirrors on-chain `ErrorCode::SpotDlobTradingDisabled`. */
|
|
51
27
|
const SPOT_DLOB_TRADING_DISABLED_MSG = 'Spot DLOB trading is disabled; spot balances, deposits, and swaps remain available.';
|
|
52
28
|
const web3_js_1 = require("@solana/web3.js");
|
|
@@ -81,8 +57,6 @@ const utils_2 = require("./tx/utils");
|
|
|
81
57
|
const grpcDriftClientAccountSubscriber_1 = require("./accounts/grpcDriftClientAccountSubscriber");
|
|
82
58
|
const tweetnacl_1 = __importDefault(require("tweetnacl"));
|
|
83
59
|
const oracleId_1 = require("./oracles/oracleId");
|
|
84
|
-
// BN is already imported globally in this file via other imports
|
|
85
|
-
const sha256_1 = require("@noble/hashes/sha256");
|
|
86
60
|
const utils_3 = require("./oracles/utils");
|
|
87
61
|
const orders_1 = require("./math/orders");
|
|
88
62
|
const builder_1 = require("./math/builder");
|
|
@@ -138,7 +112,7 @@ class DriftClient {
|
|
|
138
112
|
this.provider = new anchor_1.AnchorProvider(config.connection,
|
|
139
113
|
// @ts-ignore
|
|
140
114
|
config.wallet, this.opts);
|
|
141
|
-
this.program = new anchor_1.Program(
|
|
115
|
+
this.program = new anchor_1.Program(DriftCore_1.DriftCore.defaultIdl(), this.provider, config.coder);
|
|
142
116
|
this.authority = (_d = config.authority) !== null && _d !== void 0 ? _d : this.wallet.publicKey;
|
|
143
117
|
this.activeSubAccountId = (_e = config.activeSubAccountId) !== null && _e !== void 0 ? _e : 0;
|
|
144
118
|
this.skipLoadUsers = (_f = config.skipLoadUsers) !== null && _f !== void 0 ? _f : false;
|
|
@@ -454,7 +428,7 @@ class DriftClient {
|
|
|
454
428
|
const newProvider = new anchor_1.AnchorProvider(this.connection,
|
|
455
429
|
// @ts-ignore
|
|
456
430
|
newWallet, this.opts);
|
|
457
|
-
const newProgram = new anchor_1.Program(
|
|
431
|
+
const newProgram = new anchor_1.Program(DriftCore_1.DriftCore.defaultIdl(), newProvider);
|
|
458
432
|
this.skipLoadUsers = false;
|
|
459
433
|
// Update provider for txSender with new wallet details
|
|
460
434
|
this.txSender.wallet = newWallet;
|
|
@@ -664,8 +638,8 @@ class DriftClient {
|
|
|
664
638
|
userStats: (0, pda_1.getUserStatsAccountPublicKey)(this.program.programId, authority),
|
|
665
639
|
authority,
|
|
666
640
|
payer,
|
|
667
|
-
rent:
|
|
668
|
-
systemProgram:
|
|
641
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
642
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
669
643
|
state: await this.getStatePublicKey(),
|
|
670
644
|
},
|
|
671
645
|
});
|
|
@@ -687,8 +661,8 @@ class DriftClient {
|
|
|
687
661
|
signedMsgUserOrders: signedMsgUserAccountPublicKey,
|
|
688
662
|
authority,
|
|
689
663
|
payer,
|
|
690
|
-
rent:
|
|
691
|
-
systemProgram:
|
|
664
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
665
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
692
666
|
},
|
|
693
667
|
});
|
|
694
668
|
return [signedMsgUserAccountPublicKey, initializeUserAccountIx];
|
|
@@ -706,7 +680,7 @@ class DriftClient {
|
|
|
706
680
|
signedMsgUserOrders: signedMsgUserAccountPublicKey,
|
|
707
681
|
authority,
|
|
708
682
|
payer: this.wallet.publicKey,
|
|
709
|
-
systemProgram:
|
|
683
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
710
684
|
user: await (0, pda_1.getUserAccountPublicKey)(this.program.programId, authority, userSubaccountId),
|
|
711
685
|
},
|
|
712
686
|
});
|
|
@@ -724,8 +698,8 @@ class DriftClient {
|
|
|
724
698
|
accounts: {
|
|
725
699
|
signedMsgWsDelegates,
|
|
726
700
|
authority: this.wallet.publicKey,
|
|
727
|
-
rent:
|
|
728
|
-
systemProgram:
|
|
701
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
702
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
729
703
|
},
|
|
730
704
|
});
|
|
731
705
|
return ix;
|
|
@@ -744,8 +718,8 @@ class DriftClient {
|
|
|
744
718
|
revenueShare,
|
|
745
719
|
authority,
|
|
746
720
|
payer: (_a = overrides === null || overrides === void 0 ? void 0 : overrides.payer) !== null && _a !== void 0 ? _a : this.wallet.publicKey,
|
|
747
|
-
rent:
|
|
748
|
-
systemProgram:
|
|
721
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
722
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
749
723
|
},
|
|
750
724
|
});
|
|
751
725
|
}
|
|
@@ -765,8 +739,8 @@ class DriftClient {
|
|
|
765
739
|
payer: (_a = overrides === null || overrides === void 0 ? void 0 : overrides.payer) !== null && _a !== void 0 ? _a : this.wallet.publicKey,
|
|
766
740
|
userStats: (0, pda_1.getUserStatsAccountPublicKey)(this.program.programId, authority),
|
|
767
741
|
state: await this.getStatePublicKey(),
|
|
768
|
-
rent:
|
|
769
|
-
systemProgram:
|
|
742
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
743
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
770
744
|
},
|
|
771
745
|
});
|
|
772
746
|
}
|
|
@@ -801,7 +775,7 @@ class DriftClient {
|
|
|
801
775
|
escrow,
|
|
802
776
|
authority,
|
|
803
777
|
payer: this.wallet.publicKey,
|
|
804
|
-
systemProgram:
|
|
778
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
805
779
|
},
|
|
806
780
|
});
|
|
807
781
|
}
|
|
@@ -840,7 +814,7 @@ class DriftClient {
|
|
|
840
814
|
escrow,
|
|
841
815
|
authority,
|
|
842
816
|
payer,
|
|
843
|
-
systemProgram:
|
|
817
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
844
818
|
},
|
|
845
819
|
});
|
|
846
820
|
}
|
|
@@ -856,7 +830,7 @@ class DriftClient {
|
|
|
856
830
|
accounts: {
|
|
857
831
|
signedMsgWsDelegates,
|
|
858
832
|
authority: this.wallet.publicKey,
|
|
859
|
-
systemProgram:
|
|
833
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
860
834
|
},
|
|
861
835
|
});
|
|
862
836
|
return ix;
|
|
@@ -873,7 +847,7 @@ class DriftClient {
|
|
|
873
847
|
accounts: {
|
|
874
848
|
signedMsgWsDelegates,
|
|
875
849
|
authority: this.wallet.publicKey,
|
|
876
|
-
systemProgram:
|
|
850
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
877
851
|
},
|
|
878
852
|
});
|
|
879
853
|
return ix;
|
|
@@ -891,8 +865,8 @@ class DriftClient {
|
|
|
891
865
|
userStats: (0, pda_1.getUserStatsAccountPublicKey)(this.program.programId, authority !== null && authority !== void 0 ? authority : this.wallet.publicKey),
|
|
892
866
|
authority: authority !== null && authority !== void 0 ? authority : this.wallet.publicKey,
|
|
893
867
|
payer: this.wallet.publicKey,
|
|
894
|
-
rent:
|
|
895
|
-
systemProgram:
|
|
868
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
869
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
896
870
|
},
|
|
897
871
|
});
|
|
898
872
|
}
|
|
@@ -956,8 +930,8 @@ class DriftClient {
|
|
|
956
930
|
userStats: this.getUserStatsAccountPublicKey(),
|
|
957
931
|
authority: accountAuthority,
|
|
958
932
|
payer: payer,
|
|
959
|
-
rent:
|
|
960
|
-
systemProgram:
|
|
933
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
934
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
961
935
|
state: await this.getStatePublicKey(),
|
|
962
936
|
},
|
|
963
937
|
remainingAccounts,
|
|
@@ -986,8 +960,8 @@ class DriftClient {
|
|
|
986
960
|
authority: this.wallet.publicKey,
|
|
987
961
|
userStats: this.getUserStatsAccountPublicKey(),
|
|
988
962
|
payer: this.wallet.publicKey,
|
|
989
|
-
rent:
|
|
990
|
-
systemProgram:
|
|
963
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
964
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
991
965
|
},
|
|
992
966
|
});
|
|
993
967
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
@@ -1351,7 +1325,7 @@ class DriftClient {
|
|
|
1351
1325
|
userStats: this.getUserStatsAccountPublicKey(),
|
|
1352
1326
|
authority: this.wallet.publicKey,
|
|
1353
1327
|
state: await this.getStatePublicKey(),
|
|
1354
|
-
rent:
|
|
1328
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
1355
1329
|
},
|
|
1356
1330
|
});
|
|
1357
1331
|
}
|
|
@@ -1479,69 +1453,7 @@ class DriftClient {
|
|
|
1479
1453
|
});
|
|
1480
1454
|
}
|
|
1481
1455
|
getRemainingAccounts(params) {
|
|
1482
|
-
|
|
1483
|
-
const { oracleAccountMap, spotMarketAccountMap, perpMarketAccountMap } = this.getRemainingAccountMapsForUsers(params.userAccounts);
|
|
1484
|
-
if (params.useMarketLastSlotCache) {
|
|
1485
|
-
const lastUserSlot = (_a = this.getUserAccountAndSlot(params.userAccounts.length > 0
|
|
1486
|
-
? params.userAccounts[0].subAccountId
|
|
1487
|
-
: this.activeSubAccountId, params.userAccounts.length > 0
|
|
1488
|
-
? params.userAccounts[0].authority
|
|
1489
|
-
: this.authority)) === null || _a === void 0 ? void 0 : _a.slot;
|
|
1490
|
-
for (const [marketIndex, slot,] of this.perpMarketLastSlotCache.entries()) {
|
|
1491
|
-
// if cache has more recent slot than user positions account slot, add market to remaining accounts
|
|
1492
|
-
// otherwise remove from slot
|
|
1493
|
-
if (slot > lastUserSlot) {
|
|
1494
|
-
this.addPerpMarketToRemainingAccountMaps(marketIndex, false, oracleAccountMap, spotMarketAccountMap, perpMarketAccountMap);
|
|
1495
|
-
}
|
|
1496
|
-
else {
|
|
1497
|
-
this.perpMarketLastSlotCache.delete(marketIndex);
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
for (const [marketIndex, slot,] of this.spotMarketLastSlotCache.entries()) {
|
|
1501
|
-
// if cache has more recent slot than user positions account slot, add market to remaining accounts
|
|
1502
|
-
// otherwise remove from slot
|
|
1503
|
-
if (slot > lastUserSlot) {
|
|
1504
|
-
this.addSpotMarketToRemainingAccountMaps(marketIndex, false, oracleAccountMap, spotMarketAccountMap);
|
|
1505
|
-
}
|
|
1506
|
-
else {
|
|
1507
|
-
this.spotMarketLastSlotCache.delete(marketIndex);
|
|
1508
|
-
}
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
if (params.readablePerpMarketIndex !== undefined) {
|
|
1512
|
-
const readablePerpMarketIndexes = Array.isArray(params.readablePerpMarketIndex)
|
|
1513
|
-
? params.readablePerpMarketIndex
|
|
1514
|
-
: [params.readablePerpMarketIndex];
|
|
1515
|
-
for (const marketIndex of readablePerpMarketIndexes) {
|
|
1516
|
-
this.addPerpMarketToRemainingAccountMaps(marketIndex, false, oracleAccountMap, spotMarketAccountMap, perpMarketAccountMap);
|
|
1517
|
-
}
|
|
1518
|
-
}
|
|
1519
|
-
for (const perpMarketIndex of this.mustIncludePerpMarketIndexes.values()) {
|
|
1520
|
-
this.addPerpMarketToRemainingAccountMaps(perpMarketIndex, false, oracleAccountMap, spotMarketAccountMap, perpMarketAccountMap);
|
|
1521
|
-
}
|
|
1522
|
-
if (params.readableSpotMarketIndexes !== undefined) {
|
|
1523
|
-
for (const readableSpotMarketIndex of params.readableSpotMarketIndexes) {
|
|
1524
|
-
this.addSpotMarketToRemainingAccountMaps(readableSpotMarketIndex, false, oracleAccountMap, spotMarketAccountMap);
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
1527
|
-
for (const spotMarketIndex of this.mustIncludeSpotMarketIndexes.values()) {
|
|
1528
|
-
this.addSpotMarketToRemainingAccountMaps(spotMarketIndex, false, oracleAccountMap, spotMarketAccountMap);
|
|
1529
|
-
}
|
|
1530
|
-
if (params.writablePerpMarketIndexes !== undefined) {
|
|
1531
|
-
for (const writablePerpMarketIndex of params.writablePerpMarketIndexes) {
|
|
1532
|
-
this.addPerpMarketToRemainingAccountMaps(writablePerpMarketIndex, true, oracleAccountMap, spotMarketAccountMap, perpMarketAccountMap);
|
|
1533
|
-
}
|
|
1534
|
-
}
|
|
1535
|
-
if (params.writableSpotMarketIndexes !== undefined) {
|
|
1536
|
-
for (const writableSpotMarketIndex of params.writableSpotMarketIndexes) {
|
|
1537
|
-
this.addSpotMarketToRemainingAccountMaps(writableSpotMarketIndex, true, oracleAccountMap, spotMarketAccountMap);
|
|
1538
|
-
}
|
|
1539
|
-
}
|
|
1540
|
-
return [
|
|
1541
|
-
...oracleAccountMap.values(),
|
|
1542
|
-
...spotMarketAccountMap.values(),
|
|
1543
|
-
...perpMarketAccountMap.values(),
|
|
1544
|
-
];
|
|
1456
|
+
return DriftCore_1.DriftCore.remainingAccounts.getRemainingAccounts(this, params);
|
|
1545
1457
|
}
|
|
1546
1458
|
addPerpMarketToRemainingAccountMaps(marketIndex, writable, oracleAccountMap, spotMarketAccountMap, perpMarketAccountMap) {
|
|
1547
1459
|
const perpMarketAccount = this.getPerpMarketAccount(marketIndex);
|
|
@@ -1647,7 +1559,7 @@ class DriftClient {
|
|
|
1647
1559
|
{ pubkey: owner, isSigner: false, isWritable: false },
|
|
1648
1560
|
{ pubkey: mint, isSigner: false, isWritable: false },
|
|
1649
1561
|
{
|
|
1650
|
-
pubkey:
|
|
1562
|
+
pubkey: web3_js_1.SystemProgram.programId,
|
|
1651
1563
|
isSigner: false,
|
|
1652
1564
|
isWritable: false,
|
|
1653
1565
|
},
|
|
@@ -1747,17 +1659,19 @@ class DriftClient {
|
|
|
1747
1659
|
}
|
|
1748
1660
|
const authority = (_a = overrides === null || overrides === void 0 ? void 0 : overrides.authority) !== null && _a !== void 0 ? _a : this.wallet.publicKey;
|
|
1749
1661
|
const tokenProgram = this.getTokenProgramForSpotMarket(spotMarketAccount);
|
|
1750
|
-
return await
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1662
|
+
return await DriftCore_1.DriftCore.buildDepositInstruction({
|
|
1663
|
+
program: this.program,
|
|
1664
|
+
marketIndex,
|
|
1665
|
+
amount,
|
|
1666
|
+
reduceOnly,
|
|
1667
|
+
state: await this.getStatePublicKey(),
|
|
1668
|
+
spotMarket: spotMarketAccount.pubkey,
|
|
1669
|
+
spotMarketVault: spotMarketAccount.vault,
|
|
1670
|
+
user: userAccountPublicKey,
|
|
1671
|
+
userStats: this.getUserStatsAccountPublicKey(),
|
|
1672
|
+
userTokenAccount,
|
|
1673
|
+
authority,
|
|
1674
|
+
tokenProgram,
|
|
1761
1675
|
remainingAccounts,
|
|
1762
1676
|
});
|
|
1763
1677
|
}
|
|
@@ -2050,18 +1964,20 @@ class DriftClient {
|
|
|
2050
1964
|
await this.addExtraAccountMetasToRemainingAccounts(spotMarketAccount.mint, remainingAccounts);
|
|
2051
1965
|
}
|
|
2052
1966
|
const tokenProgram = this.getTokenProgramForSpotMarket(spotMarketAccount);
|
|
2053
|
-
return await
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
1967
|
+
return await DriftCore_1.DriftCore.buildWithdrawInstruction({
|
|
1968
|
+
program: this.program,
|
|
1969
|
+
marketIndex,
|
|
1970
|
+
amount,
|
|
1971
|
+
reduceOnly,
|
|
1972
|
+
state: await this.getStatePublicKey(),
|
|
1973
|
+
spotMarket: spotMarketAccount.pubkey,
|
|
1974
|
+
spotMarketVault: spotMarketAccount.vault,
|
|
1975
|
+
driftSigner: this.getSignerPublicKey(),
|
|
1976
|
+
user,
|
|
1977
|
+
userStats: this.getUserStatsAccountPublicKey(),
|
|
1978
|
+
userTokenAccount,
|
|
1979
|
+
authority: this.wallet.publicKey,
|
|
1980
|
+
tokenProgram,
|
|
2065
1981
|
remainingAccounts,
|
|
2066
1982
|
});
|
|
2067
1983
|
}
|
|
@@ -2566,13 +2482,13 @@ class DriftClient {
|
|
|
2566
2482
|
? [depositToTradeArgs === null || depositToTradeArgs === void 0 ? void 0 : depositToTradeArgs.depositMarketIndex]
|
|
2567
2483
|
: undefined,
|
|
2568
2484
|
});
|
|
2569
|
-
return await
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2485
|
+
return await DriftCore_1.DriftCore.buildPlacePerpOrderInstruction({
|
|
2486
|
+
program: this.program,
|
|
2487
|
+
orderParams,
|
|
2488
|
+
state: await this.getStatePublicKey(),
|
|
2489
|
+
user,
|
|
2490
|
+
userStats: this.getUserStatsAccountPublicKey(),
|
|
2491
|
+
authority: this.wallet.publicKey,
|
|
2576
2492
|
remainingAccounts,
|
|
2577
2493
|
});
|
|
2578
2494
|
}
|
|
@@ -2666,12 +2582,12 @@ class DriftClient {
|
|
|
2666
2582
|
userAccounts: [this.getUserAccount(subAccountId)],
|
|
2667
2583
|
useMarketLastSlotCache: true,
|
|
2668
2584
|
});
|
|
2669
|
-
return await
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2585
|
+
return await DriftCore_1.DriftCore.buildCancelOrderInstruction({
|
|
2586
|
+
program: this.program,
|
|
2587
|
+
orderId: orderId !== null && orderId !== void 0 ? orderId : null,
|
|
2588
|
+
state: await this.getStatePublicKey(),
|
|
2589
|
+
user,
|
|
2590
|
+
authority: this.wallet.publicKey,
|
|
2675
2591
|
remainingAccounts,
|
|
2676
2592
|
});
|
|
2677
2593
|
}
|
|
@@ -2687,13 +2603,13 @@ class DriftClient {
|
|
|
2687
2603
|
userAccounts: [this.getUserAccount(subAccountId)],
|
|
2688
2604
|
useMarketLastSlotCache: true,
|
|
2689
2605
|
});
|
|
2690
|
-
return await
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2606
|
+
return await DriftCore_1.DriftCore.buildCancelOrderByUserIdInstruction({
|
|
2607
|
+
program: this.program,
|
|
2608
|
+
userOrderId,
|
|
2609
|
+
state: await this.getStatePublicKey(),
|
|
2610
|
+
user,
|
|
2611
|
+
authority: this.wallet.publicKey,
|
|
2612
|
+
oracle,
|
|
2697
2613
|
remainingAccounts,
|
|
2698
2614
|
});
|
|
2699
2615
|
}
|
|
@@ -2727,12 +2643,12 @@ class DriftClient {
|
|
|
2727
2643
|
useMarketLastSlotCache: true,
|
|
2728
2644
|
});
|
|
2729
2645
|
const authority = (_c = overrides === null || overrides === void 0 ? void 0 : overrides.authority) !== null && _c !== void 0 ? _c : this.wallet.publicKey;
|
|
2730
|
-
return await
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2646
|
+
return await DriftCore_1.DriftCore.buildCancelOrdersByIdsInstruction({
|
|
2647
|
+
program: this.program,
|
|
2648
|
+
orderIds,
|
|
2649
|
+
state: await this.getStatePublicKey(),
|
|
2650
|
+
user: userAccountPubKey,
|
|
2651
|
+
authority,
|
|
2736
2652
|
remainingAccounts,
|
|
2737
2653
|
});
|
|
2738
2654
|
}
|
|
@@ -2758,12 +2674,15 @@ class DriftClient {
|
|
|
2758
2674
|
readableSpotMarketIndexes,
|
|
2759
2675
|
useMarketLastSlotCache: true,
|
|
2760
2676
|
});
|
|
2761
|
-
return await
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2677
|
+
return await DriftCore_1.DriftCore.buildCancelOrdersInstruction({
|
|
2678
|
+
program: this.program,
|
|
2679
|
+
marketType: marketType !== null && marketType !== void 0 ? marketType : null,
|
|
2680
|
+
marketIndex: marketIndex !== null && marketIndex !== void 0 ? marketIndex : null,
|
|
2681
|
+
direction: direction !== null && direction !== void 0 ? direction : null,
|
|
2682
|
+
user,
|
|
2683
|
+
state: await this.getStatePublicKey(),
|
|
2684
|
+
userStats: this.getUserStatsAccountPublicKey(),
|
|
2685
|
+
authority: this.wallet.publicKey,
|
|
2767
2686
|
remainingAccounts,
|
|
2768
2687
|
});
|
|
2769
2688
|
}
|
|
@@ -2821,13 +2740,13 @@ class DriftClient {
|
|
|
2821
2740
|
});
|
|
2822
2741
|
const formattedParams = params.map((item) => (0, orderParams_1.getOrderParams)(item));
|
|
2823
2742
|
const authority = (_a = overrides === null || overrides === void 0 ? void 0 : overrides.authority) !== null && _a !== void 0 ? _a : this.wallet.publicKey;
|
|
2824
|
-
return await
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2743
|
+
return await DriftCore_1.DriftCore.buildPlaceOrdersInstruction({
|
|
2744
|
+
program: this.program,
|
|
2745
|
+
formattedParams,
|
|
2746
|
+
state: await this.getStatePublicKey(),
|
|
2747
|
+
user,
|
|
2748
|
+
userStats: this.getUserStatsAccountPublicKey(),
|
|
2749
|
+
authority,
|
|
2831
2750
|
remainingAccounts,
|
|
2832
2751
|
});
|
|
2833
2752
|
}
|
|
@@ -3009,15 +2928,15 @@ class DriftClient {
|
|
|
3009
2928
|
});
|
|
3010
2929
|
}
|
|
3011
2930
|
const orderId = isSignedMsg ? null : order.orderId;
|
|
3012
|
-
return await
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
2931
|
+
return await DriftCore_1.DriftCore.buildFillPerpOrderInstruction({
|
|
2932
|
+
program: this.program,
|
|
2933
|
+
orderId,
|
|
2934
|
+
state: await this.getStatePublicKey(),
|
|
2935
|
+
filler,
|
|
2936
|
+
fillerStats: fillerStatsPublicKey,
|
|
2937
|
+
user: userAccountPublicKey,
|
|
2938
|
+
userStats: userStatsPublicKey,
|
|
2939
|
+
authority: this.wallet.publicKey,
|
|
3021
2940
|
remainingAccounts,
|
|
3022
2941
|
});
|
|
3023
2942
|
}
|
|
@@ -3573,7 +3492,7 @@ class DriftClient {
|
|
|
3573
3492
|
outTokenAccount,
|
|
3574
3493
|
tokenProgram: inTokenProgram,
|
|
3575
3494
|
driftSigner: this.getStateAccount().signer,
|
|
3576
|
-
instructions:
|
|
3495
|
+
instructions: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
3577
3496
|
},
|
|
3578
3497
|
remainingAccounts,
|
|
3579
3498
|
});
|
|
@@ -3589,7 +3508,7 @@ class DriftClient {
|
|
|
3589
3508
|
outTokenAccount,
|
|
3590
3509
|
tokenProgram: inTokenProgram,
|
|
3591
3510
|
driftSigner: this.getStateAccount().signer,
|
|
3592
|
-
instructions:
|
|
3511
|
+
instructions: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
3593
3512
|
},
|
|
3594
3513
|
remainingAccounts,
|
|
3595
3514
|
});
|
|
@@ -3721,13 +3640,13 @@ class DriftClient {
|
|
|
3721
3640
|
}
|
|
3722
3641
|
const remainingAccounts = this.getRemainingAccounts(remainingAccountsParams);
|
|
3723
3642
|
const orderId = order.orderId;
|
|
3724
|
-
return await
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3643
|
+
return await DriftCore_1.DriftCore.buildTriggerOrderInstruction({
|
|
3644
|
+
program: this.program,
|
|
3645
|
+
orderId,
|
|
3646
|
+
state: await this.getStatePublicKey(),
|
|
3647
|
+
filler,
|
|
3648
|
+
user: userAccountPublicKey,
|
|
3649
|
+
authority: this.wallet.publicKey,
|
|
3731
3650
|
remainingAccounts,
|
|
3732
3651
|
});
|
|
3733
3652
|
}
|
|
@@ -3992,13 +3911,14 @@ class DriftClient {
|
|
|
3992
3911
|
((auctionDurationPercentage !== null && auctionDurationPercentage !== void 0 ? auctionDurationPercentage : 100) << 8) | (successCondition !== null && successCondition !== void 0 ? successCondition : 0);
|
|
3993
3912
|
}
|
|
3994
3913
|
const authority = (_a = overrides === null || overrides === void 0 ? void 0 : overrides.authority) !== null && _a !== void 0 ? _a : this.wallet.publicKey;
|
|
3995
|
-
return await
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
3914
|
+
return await DriftCore_1.DriftCore.buildPlaceAndTakePerpOrderInstruction({
|
|
3915
|
+
program: this.program,
|
|
3916
|
+
orderParams,
|
|
3917
|
+
optionalParams,
|
|
3918
|
+
state: await this.getStatePublicKey(),
|
|
3919
|
+
user,
|
|
3920
|
+
userStats: userStatsPublicKey,
|
|
3921
|
+
authority,
|
|
4002
3922
|
remainingAccounts,
|
|
4003
3923
|
});
|
|
4004
3924
|
}
|
|
@@ -4039,15 +3959,16 @@ class DriftClient {
|
|
|
4039
3959
|
isSigner: false,
|
|
4040
3960
|
});
|
|
4041
3961
|
}
|
|
4042
|
-
return await
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
3962
|
+
return await DriftCore_1.DriftCore.buildPlaceAndMakePerpOrderInstruction({
|
|
3963
|
+
program: this.program,
|
|
3964
|
+
orderParams,
|
|
3965
|
+
takerOrderId,
|
|
3966
|
+
state: await this.getStatePublicKey(),
|
|
3967
|
+
user,
|
|
3968
|
+
userStats: userStatsPublicKey,
|
|
3969
|
+
taker: takerInfo.taker,
|
|
3970
|
+
takerStats: takerInfo.takerStats,
|
|
3971
|
+
authority: this.wallet.publicKey,
|
|
4051
3972
|
remainingAccounts,
|
|
4052
3973
|
});
|
|
4053
3974
|
}
|
|
@@ -4082,33 +4003,11 @@ class DriftClient {
|
|
|
4082
4003
|
* Borsh encode signedMsg taker order params
|
|
4083
4004
|
*/
|
|
4084
4005
|
encodeSignedMsgOrderParamsMessage(orderParamsMessage, delegateSigner) {
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
}
|
|
4091
|
-
const anchorIxName = delegateSigner
|
|
4092
|
-
? 'global' + ':' + 'SignedMsgOrderParamsDelegateMessage'
|
|
4093
|
-
: 'global' + ':' + 'SignedMsgOrderParamsMessage';
|
|
4094
|
-
const prefix = Buffer.from((0, sha256_1.sha256)(anchorIxName).slice(0, 8));
|
|
4095
|
-
// Backwards-compat: normalize optional builder fields to null for encoding
|
|
4096
|
-
const withBuilderDefaults = {
|
|
4097
|
-
...orderParamsMessage,
|
|
4098
|
-
builderIdx: orderParamsMessage.builderIdx !== undefined
|
|
4099
|
-
? orderParamsMessage.builderIdx
|
|
4100
|
-
: null,
|
|
4101
|
-
builderFeeTenthBps: orderParamsMessage.builderFeeTenthBps !== undefined
|
|
4102
|
-
? orderParamsMessage.builderFeeTenthBps
|
|
4103
|
-
: null,
|
|
4104
|
-
};
|
|
4105
|
-
const buf = Buffer.concat([
|
|
4106
|
-
prefix,
|
|
4107
|
-
delegateSigner
|
|
4108
|
-
? this.program.coder.types.encode('signedMsgOrderParamsDelegateMessage', withBuilderDefaults)
|
|
4109
|
-
: this.program.coder.types.encode('signedMsgOrderParamsMessage', withBuilderDefaults),
|
|
4110
|
-
]);
|
|
4111
|
-
return buf;
|
|
4006
|
+
return DriftCore_1.DriftCore.signedMsg.encodeSignedMsgOrderParamsMessage({
|
|
4007
|
+
coderTypes: this.program.coder.types,
|
|
4008
|
+
orderParamsMessage,
|
|
4009
|
+
delegateSigner,
|
|
4010
|
+
});
|
|
4112
4011
|
}
|
|
4113
4012
|
/*
|
|
4114
4013
|
* Decode signedMsg taker order params from borsh buffer. Zero pads the message in case the
|
|
@@ -4117,13 +4016,11 @@ class DriftClient {
|
|
|
4117
4016
|
* larger than the message we are receiving (unlikely, especially if all new fields are Options).
|
|
4118
4017
|
*/
|
|
4119
4018
|
decodeSignedMsgOrderParamsMessage(encodedMessage, delegateSigner) {
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
Buffer.alloc(128), // pad on 128 bytes, this is most efficient way to messages that are too small
|
|
4126
|
-
]));
|
|
4019
|
+
return DriftCore_1.DriftCore.signedMsg.decodeSignedMsgOrderParamsMessage({
|
|
4020
|
+
coderTypes: this.program.coder.types,
|
|
4021
|
+
encodedMessage,
|
|
4022
|
+
delegateSigner,
|
|
4023
|
+
});
|
|
4127
4024
|
}
|
|
4128
4025
|
signMessage(message, keypair = this.wallet.payer) {
|
|
4129
4026
|
return Buffer.from(tweetnacl_1.default.sign.detached(message, keypair.secretKey));
|
|
@@ -4356,13 +4253,14 @@ class DriftClient {
|
|
|
4356
4253
|
maxTs: maxTs || null,
|
|
4357
4254
|
};
|
|
4358
4255
|
const authority = (_g = (_e = overrides === null || overrides === void 0 ? void 0 : overrides.authority) !== null && _e !== void 0 ? _e : (_f = overrides === null || overrides === void 0 ? void 0 : overrides.user) === null || _f === void 0 ? void 0 : _f.getUserAccount().authority) !== null && _g !== void 0 ? _g : this.wallet.publicKey;
|
|
4359
|
-
return await
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4256
|
+
return await DriftCore_1.DriftCore.buildModifyOrderInstruction({
|
|
4257
|
+
program: this.program,
|
|
4258
|
+
orderId,
|
|
4259
|
+
modifyParams: orderParams,
|
|
4260
|
+
state: await this.getStatePublicKey(),
|
|
4261
|
+
user: userPubKey,
|
|
4262
|
+
userStats: this.getUserStatsAccountPublicKey(),
|
|
4263
|
+
authority,
|
|
4366
4264
|
remainingAccounts,
|
|
4367
4265
|
});
|
|
4368
4266
|
}
|
|
@@ -4410,13 +4308,14 @@ class DriftClient {
|
|
|
4410
4308
|
policy: policy || null,
|
|
4411
4309
|
maxTs: maxTs || null,
|
|
4412
4310
|
};
|
|
4413
|
-
return await
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4311
|
+
return await DriftCore_1.DriftCore.buildModifyOrderByUserIdInstruction({
|
|
4312
|
+
program: this.program,
|
|
4313
|
+
userOrderId,
|
|
4314
|
+
modifyParams: orderParams,
|
|
4315
|
+
state: await this.getStatePublicKey(),
|
|
4316
|
+
user,
|
|
4317
|
+
userStats: this.getUserStatsAccountPublicKey(),
|
|
4318
|
+
authority: this.wallet.publicKey,
|
|
4420
4319
|
remainingAccounts,
|
|
4421
4320
|
});
|
|
4422
4321
|
}
|
|
@@ -4525,14 +4424,14 @@ class DriftClient {
|
|
|
4525
4424
|
}
|
|
4526
4425
|
}
|
|
4527
4426
|
}
|
|
4528
|
-
return await
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
remainingAccounts
|
|
4427
|
+
return await DriftCore_1.DriftCore.buildSettlePnlInstruction({
|
|
4428
|
+
program: this.program,
|
|
4429
|
+
marketIndex,
|
|
4430
|
+
state: await this.getStatePublicKey(),
|
|
4431
|
+
authority: this.wallet.publicKey,
|
|
4432
|
+
user: settleeUserAccountPublicKey,
|
|
4433
|
+
spotMarketVault: this.getQuoteSpotMarketAccount().vault,
|
|
4434
|
+
remainingAccounts,
|
|
4536
4435
|
});
|
|
4537
4436
|
}
|
|
4538
4437
|
async settleMultiplePNLs(settleeUserAccountPublicKey, settleeUserAccount, marketIndexes, mode, revenueShareEscrowMap, txParams) {
|
|
@@ -4680,16 +4579,18 @@ class DriftClient {
|
|
|
4680
4579
|
useMarketLastSlotCache: true,
|
|
4681
4580
|
writablePerpMarketIndexes: [marketIndex],
|
|
4682
4581
|
});
|
|
4683
|
-
return await
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4582
|
+
return await DriftCore_1.DriftCore.buildLiquidatePerpInstruction({
|
|
4583
|
+
program: this.program,
|
|
4584
|
+
marketIndex,
|
|
4585
|
+
maxBaseAssetAmount,
|
|
4586
|
+
limitPrice: limitPrice !== null && limitPrice !== void 0 ? limitPrice : null,
|
|
4587
|
+
state: await this.getStatePublicKey(),
|
|
4588
|
+
authority: this.wallet.publicKey,
|
|
4589
|
+
user: userAccountPublicKey,
|
|
4590
|
+
userStats: userStatsPublicKey,
|
|
4591
|
+
liquidator,
|
|
4592
|
+
liquidatorStats: liquidatorStatsPublicKey,
|
|
4593
|
+
remainingAccounts,
|
|
4693
4594
|
});
|
|
4694
4595
|
}
|
|
4695
4596
|
async liquidatePerpWithFill(userAccountPublicKey, userAccount, marketIndex, makerInfos, txParams, liquidatorSubAccountId) {
|
|
@@ -4756,7 +4657,7 @@ class DriftClient {
|
|
|
4756
4657
|
liquidator,
|
|
4757
4658
|
liquidatorStats: liquidatorStatsPublicKey,
|
|
4758
4659
|
},
|
|
4759
|
-
remainingAccounts
|
|
4660
|
+
remainingAccounts,
|
|
4760
4661
|
});
|
|
4761
4662
|
}
|
|
4762
4663
|
async getJupiterLiquidateSpotWithSwapIxV6({ jupiterClient, liabilityMarketIndex, assetMarketIndex, swapAmount, assetTokenAccount, liabilityTokenAccount, slippageBps, swapMode, onlyDirectRoutes, quote, userAccount, userAccountPublicKey, userStatsAccountPublicKey, liquidatorSubAccountId, maxAccounts, }) {
|
|
@@ -4886,7 +4787,7 @@ class DriftClient {
|
|
|
4886
4787
|
liabilityTokenAccount: liabilityTokenAccount,
|
|
4887
4788
|
tokenProgram: assetTokenProgram,
|
|
4888
4789
|
driftSigner: this.getStateAccount().signer,
|
|
4889
|
-
instructions:
|
|
4790
|
+
instructions: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
4890
4791
|
},
|
|
4891
4792
|
remainingAccounts,
|
|
4892
4793
|
});
|
|
@@ -4904,7 +4805,7 @@ class DriftClient {
|
|
|
4904
4805
|
liabilityTokenAccount: liabilityTokenAccount,
|
|
4905
4806
|
tokenProgram: assetTokenProgram,
|
|
4906
4807
|
driftSigner: this.getStateAccount().signer,
|
|
4907
|
-
instructions:
|
|
4808
|
+
instructions: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
4908
4809
|
},
|
|
4909
4810
|
remainingAccounts,
|
|
4910
4811
|
});
|
|
@@ -4947,7 +4848,7 @@ class DriftClient {
|
|
|
4947
4848
|
ifRebalanceConfig: ifRebalanceConfig,
|
|
4948
4849
|
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
4949
4850
|
driftSigner: this.getStateAccount().signer,
|
|
4950
|
-
instructions:
|
|
4851
|
+
instructions: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
4951
4852
|
},
|
|
4952
4853
|
remainingAccounts,
|
|
4953
4854
|
});
|
|
@@ -4962,7 +4863,7 @@ class DriftClient {
|
|
|
4962
4863
|
ifRebalanceConfig: ifRebalanceConfig,
|
|
4963
4864
|
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
4964
4865
|
driftSigner: this.getStateAccount().signer,
|
|
4965
|
-
instructions:
|
|
4866
|
+
instructions: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
4966
4867
|
},
|
|
4967
4868
|
remainingAccounts,
|
|
4968
4869
|
});
|
|
@@ -5092,12 +4993,12 @@ class DriftClient {
|
|
|
5092
4993
|
}
|
|
5093
4994
|
async getUpdateFundingRateIx(perpMarketIndex, oracle) {
|
|
5094
4995
|
const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
|
|
5095
|
-
return await
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
4996
|
+
return await DriftCore_1.DriftCore.buildUpdateFundingRateInstruction({
|
|
4997
|
+
program: this.program,
|
|
4998
|
+
perpMarketIndex,
|
|
4999
|
+
state: await this.getStatePublicKey(),
|
|
5000
|
+
perpMarket: perpMarketPublicKey,
|
|
5001
|
+
oracle,
|
|
5101
5002
|
});
|
|
5102
5003
|
}
|
|
5103
5004
|
async updatePrelaunchOracle(perpMarketIndex, txParams) {
|
|
@@ -5244,8 +5145,8 @@ class DriftClient {
|
|
|
5244
5145
|
),
|
|
5245
5146
|
authority: this.wallet.publicKey,
|
|
5246
5147
|
payer: this.wallet.publicKey,
|
|
5247
|
-
rent:
|
|
5248
|
-
systemProgram:
|
|
5148
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
5149
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
5249
5150
|
state: await this.getStatePublicKey(),
|
|
5250
5151
|
};
|
|
5251
5152
|
return await this.program.instruction.initializeInsuranceFundStake(marketIndex, {
|