@drift-labs/sdk 2.36.1-beta.1 → 2.36.1-beta.2
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/lib/driftClient.d.ts +2 -0
- package/lib/driftClient.js +30 -0
- package/lib/idl/drift.json +36 -0
- package/package.json +1 -1
- package/src/driftClient.ts +51 -0
- package/src/idl/drift.json +36 -0
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.36.1-beta.
|
|
1
|
+
2.36.1-beta.2
|
package/lib/driftClient.d.ts
CHANGED
|
@@ -550,6 +550,8 @@ export declare class DriftClient {
|
|
|
550
550
|
getResolveSpotBankruptcyIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number): Promise<TransactionInstruction>;
|
|
551
551
|
updateFundingRate(perpMarketIndex: number, oracle: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
552
552
|
getUpdateFundingRateIx(perpMarketIndex: number, oracle: PublicKey): Promise<TransactionInstruction>;
|
|
553
|
+
updatePerpBidAskTwap(perpMarketIndex: number, makers: [PublicKey, PublicKey][], txParams?: TxParams): Promise<TransactionSignature>;
|
|
554
|
+
getUpdatePerpBidAskTwapIx(perpMarketIndex: number, makers: [PublicKey, PublicKey][]): Promise<TransactionInstruction>;
|
|
553
555
|
settleFundingPayment(userAccountPublicKey: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
554
556
|
getSettleFundingPaymentIx(userAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
|
|
555
557
|
triggerEvent(eventName: keyof DriftClientAccountEvents, data?: any): void;
|
package/lib/driftClient.js
CHANGED
|
@@ -2813,6 +2813,36 @@ class DriftClient {
|
|
|
2813
2813
|
},
|
|
2814
2814
|
});
|
|
2815
2815
|
}
|
|
2816
|
+
async updatePerpBidAskTwap(perpMarketIndex, makers, txParams) {
|
|
2817
|
+
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdatePerpBidAskTwapIx(perpMarketIndex, makers), txParams), [], this.opts);
|
|
2818
|
+
return txSig;
|
|
2819
|
+
}
|
|
2820
|
+
async getUpdatePerpBidAskTwapIx(perpMarketIndex, makers) {
|
|
2821
|
+
const perpMarket = this.getPerpMarketAccount(perpMarketIndex);
|
|
2822
|
+
const remainingAccounts = [];
|
|
2823
|
+
for (const [maker, makerStats] of makers) {
|
|
2824
|
+
remainingAccounts.push({
|
|
2825
|
+
pubkey: maker,
|
|
2826
|
+
isWritable: false,
|
|
2827
|
+
isSigner: false,
|
|
2828
|
+
});
|
|
2829
|
+
remainingAccounts.push({
|
|
2830
|
+
pubkey: makerStats,
|
|
2831
|
+
isWritable: false,
|
|
2832
|
+
isSigner: false,
|
|
2833
|
+
});
|
|
2834
|
+
}
|
|
2835
|
+
return await this.program.instruction.updatePerpBidAskTwap(perpMarketIndex, {
|
|
2836
|
+
accounts: {
|
|
2837
|
+
state: await this.getStatePublicKey(),
|
|
2838
|
+
perpMarket: perpMarket.pubkey,
|
|
2839
|
+
oracle: perpMarket.amm.oracle,
|
|
2840
|
+
authority: this.wallet.publicKey,
|
|
2841
|
+
keeperStats: this.getUserStatsAccountPublicKey(),
|
|
2842
|
+
},
|
|
2843
|
+
remainingAccounts,
|
|
2844
|
+
});
|
|
2845
|
+
}
|
|
2816
2846
|
async settleFundingPayment(userAccountPublicKey, txParams) {
|
|
2817
2847
|
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getSettleFundingPaymentIx(userAccountPublicKey), txParams), [], this.opts);
|
|
2818
2848
|
return txSig;
|
package/lib/idl/drift.json
CHANGED
|
@@ -1932,6 +1932,42 @@
|
|
|
1932
1932
|
}
|
|
1933
1933
|
]
|
|
1934
1934
|
},
|
|
1935
|
+
{
|
|
1936
|
+
"name": "updatePerpBidAskTwap",
|
|
1937
|
+
"accounts": [
|
|
1938
|
+
{
|
|
1939
|
+
"name": "state",
|
|
1940
|
+
"isMut": false,
|
|
1941
|
+
"isSigner": false
|
|
1942
|
+
},
|
|
1943
|
+
{
|
|
1944
|
+
"name": "perpMarket",
|
|
1945
|
+
"isMut": true,
|
|
1946
|
+
"isSigner": false
|
|
1947
|
+
},
|
|
1948
|
+
{
|
|
1949
|
+
"name": "oracle",
|
|
1950
|
+
"isMut": false,
|
|
1951
|
+
"isSigner": false
|
|
1952
|
+
},
|
|
1953
|
+
{
|
|
1954
|
+
"name": "user",
|
|
1955
|
+
"isMut": true,
|
|
1956
|
+
"isSigner": false
|
|
1957
|
+
},
|
|
1958
|
+
{
|
|
1959
|
+
"name": "userStats",
|
|
1960
|
+
"isMut": true,
|
|
1961
|
+
"isSigner": false
|
|
1962
|
+
},
|
|
1963
|
+
{
|
|
1964
|
+
"name": "authority",
|
|
1965
|
+
"isMut": false,
|
|
1966
|
+
"isSigner": true
|
|
1967
|
+
}
|
|
1968
|
+
],
|
|
1969
|
+
"args": []
|
|
1970
|
+
},
|
|
1935
1971
|
{
|
|
1936
1972
|
"name": "updateSpotMarketCumulativeInterest",
|
|
1937
1973
|
"accounts": [
|
package/package.json
CHANGED
package/src/driftClient.ts
CHANGED
|
@@ -5073,6 +5073,57 @@ export class DriftClient {
|
|
|
5073
5073
|
});
|
|
5074
5074
|
}
|
|
5075
5075
|
|
|
5076
|
+
public async updatePerpBidAskTwap(
|
|
5077
|
+
perpMarketIndex: number,
|
|
5078
|
+
makers: [PublicKey, PublicKey][],
|
|
5079
|
+
txParams?: TxParams
|
|
5080
|
+
): Promise<TransactionSignature> {
|
|
5081
|
+
const { txSig } = await this.sendTransaction(
|
|
5082
|
+
await this.buildTransaction(
|
|
5083
|
+
await this.getUpdatePerpBidAskTwapIx(perpMarketIndex, makers),
|
|
5084
|
+
txParams
|
|
5085
|
+
),
|
|
5086
|
+
[],
|
|
5087
|
+
this.opts
|
|
5088
|
+
);
|
|
5089
|
+
return txSig;
|
|
5090
|
+
}
|
|
5091
|
+
|
|
5092
|
+
public async getUpdatePerpBidAskTwapIx(
|
|
5093
|
+
perpMarketIndex: number,
|
|
5094
|
+
makers: [PublicKey, PublicKey][]
|
|
5095
|
+
): Promise<TransactionInstruction> {
|
|
5096
|
+
const perpMarket = this.getPerpMarketAccount(perpMarketIndex);
|
|
5097
|
+
|
|
5098
|
+
const remainingAccounts = [];
|
|
5099
|
+
for (const [maker, makerStats] of makers) {
|
|
5100
|
+
remainingAccounts.push({
|
|
5101
|
+
pubkey: maker,
|
|
5102
|
+
isWritable: false,
|
|
5103
|
+
isSigner: false,
|
|
5104
|
+
});
|
|
5105
|
+
remainingAccounts.push({
|
|
5106
|
+
pubkey: makerStats,
|
|
5107
|
+
isWritable: false,
|
|
5108
|
+
isSigner: false,
|
|
5109
|
+
});
|
|
5110
|
+
}
|
|
5111
|
+
|
|
5112
|
+
return await this.program.instruction.updatePerpBidAskTwap(
|
|
5113
|
+
perpMarketIndex,
|
|
5114
|
+
{
|
|
5115
|
+
accounts: {
|
|
5116
|
+
state: await this.getStatePublicKey(),
|
|
5117
|
+
perpMarket: perpMarket.pubkey,
|
|
5118
|
+
oracle: perpMarket.amm.oracle,
|
|
5119
|
+
authority: this.wallet.publicKey,
|
|
5120
|
+
keeperStats: this.getUserStatsAccountPublicKey(),
|
|
5121
|
+
},
|
|
5122
|
+
remainingAccounts,
|
|
5123
|
+
}
|
|
5124
|
+
);
|
|
5125
|
+
}
|
|
5126
|
+
|
|
5076
5127
|
public async settleFundingPayment(
|
|
5077
5128
|
userAccountPublicKey: PublicKey,
|
|
5078
5129
|
txParams?: TxParams
|
package/src/idl/drift.json
CHANGED
|
@@ -1932,6 +1932,42 @@
|
|
|
1932
1932
|
}
|
|
1933
1933
|
]
|
|
1934
1934
|
},
|
|
1935
|
+
{
|
|
1936
|
+
"name": "updatePerpBidAskTwap",
|
|
1937
|
+
"accounts": [
|
|
1938
|
+
{
|
|
1939
|
+
"name": "state",
|
|
1940
|
+
"isMut": false,
|
|
1941
|
+
"isSigner": false
|
|
1942
|
+
},
|
|
1943
|
+
{
|
|
1944
|
+
"name": "perpMarket",
|
|
1945
|
+
"isMut": true,
|
|
1946
|
+
"isSigner": false
|
|
1947
|
+
},
|
|
1948
|
+
{
|
|
1949
|
+
"name": "oracle",
|
|
1950
|
+
"isMut": false,
|
|
1951
|
+
"isSigner": false
|
|
1952
|
+
},
|
|
1953
|
+
{
|
|
1954
|
+
"name": "user",
|
|
1955
|
+
"isMut": true,
|
|
1956
|
+
"isSigner": false
|
|
1957
|
+
},
|
|
1958
|
+
{
|
|
1959
|
+
"name": "userStats",
|
|
1960
|
+
"isMut": true,
|
|
1961
|
+
"isSigner": false
|
|
1962
|
+
},
|
|
1963
|
+
{
|
|
1964
|
+
"name": "authority",
|
|
1965
|
+
"isMut": false,
|
|
1966
|
+
"isSigner": true
|
|
1967
|
+
}
|
|
1968
|
+
],
|
|
1969
|
+
"args": []
|
|
1970
|
+
},
|
|
1935
1971
|
{
|
|
1936
1972
|
"name": "updateSpotMarketCumulativeInterest",
|
|
1937
1973
|
"accounts": [
|