@drift-labs/sdk 2.109.0-beta.6 → 2.109.0-beta.8
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/browser/decode/user.js +3 -1
- package/lib/browser/driftClient.d.ts +2 -2
- package/lib/browser/driftClient.js +4 -4
- package/lib/browser/idl/drift.json +8 -1
- package/lib/browser/types.d.ts +1 -0
- package/lib/node/decode/user.js +3 -1
- package/lib/node/driftClient.d.ts +2 -2
- package/lib/node/driftClient.js +4 -4
- package/lib/node/idl/drift.json +8 -1
- package/lib/node/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/decode/user.ts +3 -1
- package/src/driftClient.ts +6 -3
- package/src/idl/drift.json +8 -1
- package/src/types.ts +1 -0
- package/tests/user/helpers.ts +1 -0
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.109.0-beta.
|
|
1
|
+
2.109.0-beta.8
|
|
@@ -228,7 +228,8 @@ function decodeUser(buffer) {
|
|
|
228
228
|
offset += 1;
|
|
229
229
|
const auctionDuration = buffer.readUInt8(offset);
|
|
230
230
|
offset += 1;
|
|
231
|
-
|
|
231
|
+
const postedSlotTail = buffer.readUint8(offset);
|
|
232
|
+
offset += 2; // padding
|
|
232
233
|
orders.push({
|
|
233
234
|
slot,
|
|
234
235
|
price,
|
|
@@ -254,6 +255,7 @@ function decodeUser(buffer) {
|
|
|
254
255
|
immediateOrCancel,
|
|
255
256
|
triggerCondition,
|
|
256
257
|
auctionDuration,
|
|
258
|
+
postedSlotTail,
|
|
257
259
|
});
|
|
258
260
|
}
|
|
259
261
|
const lastAddPerpLpSharesTs = readSignedBigInt64LE(buffer, offset);
|
|
@@ -888,8 +888,8 @@ export declare class DriftClient {
|
|
|
888
888
|
disableUserHighLeverageMode(user: PublicKey, userAccount?: UserAccount, txParams?: TxParams): Promise<TransactionSignature>;
|
|
889
889
|
getDisableHighLeverageModeIx(user: PublicKey, userAccount?: UserAccount): Promise<TransactionInstruction>;
|
|
890
890
|
fetchHighLeverageModeConfig(): Promise<HighLeverageModeConfig>;
|
|
891
|
-
updateUserProtectedMakerOrders(subAccountId: number, protectedOrders: boolean, txParams?: TxParams): Promise<TransactionSignature>;
|
|
892
|
-
getUpdateUserProtectedMakerOrdersIx(subAccountId: number, protectedOrders: boolean): Promise<TransactionInstruction>;
|
|
891
|
+
updateUserProtectedMakerOrders(subAccountId: number, protectedOrders: boolean, authority?: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
892
|
+
getUpdateUserProtectedMakerOrdersIx(subAccountId: number, protectedOrders: boolean, authority?: PublicKey): Promise<TransactionInstruction>;
|
|
893
893
|
getPauseSpotMarketDepositWithdrawIx(spotMarketIndex: number): Promise<TransactionInstruction>;
|
|
894
894
|
pauseSpotMarketDepositWithdraw(spotMarketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
895
895
|
private handleSignedTransaction;
|
|
@@ -4847,15 +4847,15 @@ class DriftClient {
|
|
|
4847
4847
|
const config = await this.program.account.highLeverageModeConfig.fetch((0, pda_1.getHighLeverageModeConfigPublicKey)(this.program.programId));
|
|
4848
4848
|
return config;
|
|
4849
4849
|
}
|
|
4850
|
-
async updateUserProtectedMakerOrders(subAccountId, protectedOrders, txParams) {
|
|
4851
|
-
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserProtectedMakerOrdersIx(subAccountId, protectedOrders), txParams), [], this.opts);
|
|
4850
|
+
async updateUserProtectedMakerOrders(subAccountId, protectedOrders, authority, txParams) {
|
|
4851
|
+
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserProtectedMakerOrdersIx(subAccountId, protectedOrders, authority), txParams), [], this.opts);
|
|
4852
4852
|
return txSig;
|
|
4853
4853
|
}
|
|
4854
|
-
async getUpdateUserProtectedMakerOrdersIx(subAccountId, protectedOrders) {
|
|
4854
|
+
async getUpdateUserProtectedMakerOrdersIx(subAccountId, protectedOrders, authority) {
|
|
4855
4855
|
const ix = await this.program.instruction.updateUserProtectedMakerOrders(subAccountId, protectedOrders, {
|
|
4856
4856
|
accounts: {
|
|
4857
4857
|
state: await this.getStatePublicKey(),
|
|
4858
|
-
user: (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, this.
|
|
4858
|
+
user: (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, authority !== null && authority !== void 0 ? authority : this.authority, subAccountId),
|
|
4859
4859
|
authority: this.wallet.publicKey,
|
|
4860
4860
|
protectedMakerModeConfig: (0, pda_1.getProtectedMakerModeConfigPublicKey)(this.program.programId),
|
|
4861
4861
|
},
|
|
@@ -10875,12 +10875,19 @@
|
|
|
10875
10875
|
],
|
|
10876
10876
|
"type": "u8"
|
|
10877
10877
|
},
|
|
10878
|
+
{
|
|
10879
|
+
"name": "postedSlotTail",
|
|
10880
|
+
"docs": [
|
|
10881
|
+
"Last 8 bits of the slot the order was posted on-chain (not order slot for swift orders)"
|
|
10882
|
+
],
|
|
10883
|
+
"type": "u8"
|
|
10884
|
+
},
|
|
10878
10885
|
{
|
|
10879
10886
|
"name": "padding",
|
|
10880
10887
|
"type": {
|
|
10881
10888
|
"array": [
|
|
10882
10889
|
"u8",
|
|
10883
|
-
|
|
10890
|
+
2
|
|
10884
10891
|
]
|
|
10885
10892
|
}
|
|
10886
10893
|
}
|
package/lib/browser/types.d.ts
CHANGED
package/lib/node/decode/user.js
CHANGED
|
@@ -228,7 +228,8 @@ function decodeUser(buffer) {
|
|
|
228
228
|
offset += 1;
|
|
229
229
|
const auctionDuration = buffer.readUInt8(offset);
|
|
230
230
|
offset += 1;
|
|
231
|
-
|
|
231
|
+
const postedSlotTail = buffer.readUint8(offset);
|
|
232
|
+
offset += 2; // padding
|
|
232
233
|
orders.push({
|
|
233
234
|
slot,
|
|
234
235
|
price,
|
|
@@ -254,6 +255,7 @@ function decodeUser(buffer) {
|
|
|
254
255
|
immediateOrCancel,
|
|
255
256
|
triggerCondition,
|
|
256
257
|
auctionDuration,
|
|
258
|
+
postedSlotTail,
|
|
257
259
|
});
|
|
258
260
|
}
|
|
259
261
|
const lastAddPerpLpSharesTs = readSignedBigInt64LE(buffer, offset);
|
|
@@ -888,8 +888,8 @@ export declare class DriftClient {
|
|
|
888
888
|
disableUserHighLeverageMode(user: PublicKey, userAccount?: UserAccount, txParams?: TxParams): Promise<TransactionSignature>;
|
|
889
889
|
getDisableHighLeverageModeIx(user: PublicKey, userAccount?: UserAccount): Promise<TransactionInstruction>;
|
|
890
890
|
fetchHighLeverageModeConfig(): Promise<HighLeverageModeConfig>;
|
|
891
|
-
updateUserProtectedMakerOrders(subAccountId: number, protectedOrders: boolean, txParams?: TxParams): Promise<TransactionSignature>;
|
|
892
|
-
getUpdateUserProtectedMakerOrdersIx(subAccountId: number, protectedOrders: boolean): Promise<TransactionInstruction>;
|
|
891
|
+
updateUserProtectedMakerOrders(subAccountId: number, protectedOrders: boolean, authority?: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
892
|
+
getUpdateUserProtectedMakerOrdersIx(subAccountId: number, protectedOrders: boolean, authority?: PublicKey): Promise<TransactionInstruction>;
|
|
893
893
|
getPauseSpotMarketDepositWithdrawIx(spotMarketIndex: number): Promise<TransactionInstruction>;
|
|
894
894
|
pauseSpotMarketDepositWithdraw(spotMarketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
895
895
|
private handleSignedTransaction;
|
package/lib/node/driftClient.js
CHANGED
|
@@ -4847,15 +4847,15 @@ class DriftClient {
|
|
|
4847
4847
|
const config = await this.program.account.highLeverageModeConfig.fetch((0, pda_1.getHighLeverageModeConfigPublicKey)(this.program.programId));
|
|
4848
4848
|
return config;
|
|
4849
4849
|
}
|
|
4850
|
-
async updateUserProtectedMakerOrders(subAccountId, protectedOrders, txParams) {
|
|
4851
|
-
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserProtectedMakerOrdersIx(subAccountId, protectedOrders), txParams), [], this.opts);
|
|
4850
|
+
async updateUserProtectedMakerOrders(subAccountId, protectedOrders, authority, txParams) {
|
|
4851
|
+
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserProtectedMakerOrdersIx(subAccountId, protectedOrders, authority), txParams), [], this.opts);
|
|
4852
4852
|
return txSig;
|
|
4853
4853
|
}
|
|
4854
|
-
async getUpdateUserProtectedMakerOrdersIx(subAccountId, protectedOrders) {
|
|
4854
|
+
async getUpdateUserProtectedMakerOrdersIx(subAccountId, protectedOrders, authority) {
|
|
4855
4855
|
const ix = await this.program.instruction.updateUserProtectedMakerOrders(subAccountId, protectedOrders, {
|
|
4856
4856
|
accounts: {
|
|
4857
4857
|
state: await this.getStatePublicKey(),
|
|
4858
|
-
user: (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, this.
|
|
4858
|
+
user: (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, authority !== null && authority !== void 0 ? authority : this.authority, subAccountId),
|
|
4859
4859
|
authority: this.wallet.publicKey,
|
|
4860
4860
|
protectedMakerModeConfig: (0, pda_1.getProtectedMakerModeConfigPublicKey)(this.program.programId),
|
|
4861
4861
|
},
|
package/lib/node/idl/drift.json
CHANGED
|
@@ -10875,12 +10875,19 @@
|
|
|
10875
10875
|
],
|
|
10876
10876
|
"type": "u8"
|
|
10877
10877
|
},
|
|
10878
|
+
{
|
|
10879
|
+
"name": "postedSlotTail",
|
|
10880
|
+
"docs": [
|
|
10881
|
+
"Last 8 bits of the slot the order was posted on-chain (not order slot for swift orders)"
|
|
10882
|
+
],
|
|
10883
|
+
"type": "u8"
|
|
10884
|
+
},
|
|
10878
10885
|
{
|
|
10879
10886
|
"name": "padding",
|
|
10880
10887
|
"type": {
|
|
10881
10888
|
"array": [
|
|
10882
10889
|
"u8",
|
|
10883
|
-
|
|
10890
|
+
2
|
|
10884
10891
|
]
|
|
10885
10892
|
}
|
|
10886
10893
|
}
|
package/lib/node/types.d.ts
CHANGED
package/package.json
CHANGED
package/src/decode/user.ts
CHANGED
|
@@ -237,7 +237,8 @@ export function decodeUser(buffer: Buffer): UserAccount {
|
|
|
237
237
|
offset += 1;
|
|
238
238
|
const auctionDuration = buffer.readUInt8(offset);
|
|
239
239
|
offset += 1;
|
|
240
|
-
|
|
240
|
+
const postedSlotTail = buffer.readUint8(offset);
|
|
241
|
+
offset += 2; // padding
|
|
241
242
|
orders.push({
|
|
242
243
|
slot,
|
|
243
244
|
price,
|
|
@@ -263,6 +264,7 @@ export function decodeUser(buffer: Buffer): UserAccount {
|
|
|
263
264
|
immediateOrCancel,
|
|
264
265
|
triggerCondition,
|
|
265
266
|
auctionDuration,
|
|
267
|
+
postedSlotTail,
|
|
266
268
|
});
|
|
267
269
|
}
|
|
268
270
|
|
package/src/driftClient.ts
CHANGED
|
@@ -9209,13 +9209,15 @@ export class DriftClient {
|
|
|
9209
9209
|
public async updateUserProtectedMakerOrders(
|
|
9210
9210
|
subAccountId: number,
|
|
9211
9211
|
protectedOrders: boolean,
|
|
9212
|
+
authority?: PublicKey,
|
|
9212
9213
|
txParams?: TxParams
|
|
9213
9214
|
): Promise<TransactionSignature> {
|
|
9214
9215
|
const { txSig } = await this.sendTransaction(
|
|
9215
9216
|
await this.buildTransaction(
|
|
9216
9217
|
await this.getUpdateUserProtectedMakerOrdersIx(
|
|
9217
9218
|
subAccountId,
|
|
9218
|
-
protectedOrders
|
|
9219
|
+
protectedOrders,
|
|
9220
|
+
authority
|
|
9219
9221
|
),
|
|
9220
9222
|
txParams
|
|
9221
9223
|
),
|
|
@@ -9227,7 +9229,8 @@ export class DriftClient {
|
|
|
9227
9229
|
|
|
9228
9230
|
public async getUpdateUserProtectedMakerOrdersIx(
|
|
9229
9231
|
subAccountId: number,
|
|
9230
|
-
protectedOrders: boolean
|
|
9232
|
+
protectedOrders: boolean,
|
|
9233
|
+
authority?: PublicKey
|
|
9231
9234
|
): Promise<TransactionInstruction> {
|
|
9232
9235
|
const ix = await this.program.instruction.updateUserProtectedMakerOrders(
|
|
9233
9236
|
subAccountId,
|
|
@@ -9237,7 +9240,7 @@ export class DriftClient {
|
|
|
9237
9240
|
state: await this.getStatePublicKey(),
|
|
9238
9241
|
user: getUserAccountPublicKeySync(
|
|
9239
9242
|
this.program.programId,
|
|
9240
|
-
this.
|
|
9243
|
+
authority ?? this.authority,
|
|
9241
9244
|
subAccountId
|
|
9242
9245
|
),
|
|
9243
9246
|
authority: this.wallet.publicKey,
|
package/src/idl/drift.json
CHANGED
|
@@ -10875,12 +10875,19 @@
|
|
|
10875
10875
|
],
|
|
10876
10876
|
"type": "u8"
|
|
10877
10877
|
},
|
|
10878
|
+
{
|
|
10879
|
+
"name": "postedSlotTail",
|
|
10880
|
+
"docs": [
|
|
10881
|
+
"Last 8 bits of the slot the order was posted on-chain (not order slot for swift orders)"
|
|
10882
|
+
],
|
|
10883
|
+
"type": "u8"
|
|
10884
|
+
},
|
|
10878
10885
|
{
|
|
10879
10886
|
"name": "padding",
|
|
10880
10887
|
"type": {
|
|
10881
10888
|
"array": [
|
|
10882
10889
|
"u8",
|
|
10883
|
-
|
|
10890
|
+
2
|
|
10884
10891
|
]
|
|
10885
10892
|
}
|
|
10886
10893
|
}
|
package/src/types.ts
CHANGED