@drift-labs/sdk 2.97.0-beta.20 → 2.97.0-beta.21
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 +13 -0
- package/lib/idl/drift.json +19 -3
- package/lib/types.d.ts +5 -1
- package/lib/types.js +6 -1
- package/package.json +1 -1
- package/src/driftClient.ts +27 -0
- package/src/idl/drift.json +19 -3
- package/src/types.ts +6 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.97.0-beta.
|
|
1
|
+
2.97.0-beta.21
|
package/lib/driftClient.d.ts
CHANGED
|
@@ -493,6 +493,8 @@ export declare class DriftClient {
|
|
|
493
493
|
getUpdateUserIdleIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
|
|
494
494
|
updateUserFuelBonus(userAccountPublicKey: PublicKey, user: UserAccount, userAuthority: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
495
495
|
getUpdateUserFuelBonusIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, userAuthority: PublicKey): Promise<TransactionInstruction>;
|
|
496
|
+
updateUserStatsReferrerInfo(userStatsAccountPublicKey: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
497
|
+
getUpdateUserStatsReferrerInfoIx(userStatsAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
|
|
496
498
|
updateUserOpenOrdersCount(userAccountPublicKey: PublicKey, user: UserAccount, txParams?: TxParams, fillerPublicKey?: PublicKey): Promise<TransactionSignature>;
|
|
497
499
|
getUpdateUserOpenOrdersCountIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
|
|
498
500
|
placeAndTakePerpOrder(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, successCondition?: PlaceAndTakeOrderSuccessCondition, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
|
package/lib/driftClient.js
CHANGED
|
@@ -2731,6 +2731,19 @@ class DriftClient {
|
|
|
2731
2731
|
remainingAccounts,
|
|
2732
2732
|
});
|
|
2733
2733
|
}
|
|
2734
|
+
async updateUserStatsReferrerInfo(userStatsAccountPublicKey, txParams) {
|
|
2735
|
+
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserStatsReferrerInfoIx(userStatsAccountPublicKey), txParams), [], this.opts);
|
|
2736
|
+
return txSig;
|
|
2737
|
+
}
|
|
2738
|
+
async getUpdateUserStatsReferrerInfoIx(userStatsAccountPublicKey) {
|
|
2739
|
+
return await this.program.instruction.updateUserStatsReferrerInfo({
|
|
2740
|
+
accounts: {
|
|
2741
|
+
state: await this.getStatePublicKey(),
|
|
2742
|
+
userStats: userStatsAccountPublicKey,
|
|
2743
|
+
authority: this.wallet.publicKey,
|
|
2744
|
+
},
|
|
2745
|
+
});
|
|
2746
|
+
}
|
|
2734
2747
|
async updateUserOpenOrdersCount(userAccountPublicKey, user, txParams, fillerPublicKey) {
|
|
2735
2748
|
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserOpenOrdersCountIx(userAccountPublicKey, user, fillerPublicKey), txParams), [], this.opts);
|
|
2736
2749
|
return txSig;
|
package/lib/idl/drift.json
CHANGED
|
@@ -7730,11 +7730,13 @@
|
|
|
7730
7730
|
"type": "u16"
|
|
7731
7731
|
},
|
|
7732
7732
|
{
|
|
7733
|
-
"name": "
|
|
7733
|
+
"name": "referrerStatus",
|
|
7734
7734
|
"docs": [
|
|
7735
|
-
"
|
|
7735
|
+
"Flags for referrer status:",
|
|
7736
|
+
"First bit (LSB): 1 if user is a referrer, 0 otherwise",
|
|
7737
|
+
"Second bit: 1 if user was referred, 0 otherwise"
|
|
7736
7738
|
],
|
|
7737
|
-
"type": "
|
|
7739
|
+
"type": "u8"
|
|
7738
7740
|
},
|
|
7739
7741
|
{
|
|
7740
7742
|
"name": "disableUpdatePerpBidAskTwap",
|
|
@@ -10860,6 +10862,20 @@
|
|
|
10860
10862
|
]
|
|
10861
10863
|
}
|
|
10862
10864
|
},
|
|
10865
|
+
{
|
|
10866
|
+
"name": "ReferrerStatus",
|
|
10867
|
+
"type": {
|
|
10868
|
+
"kind": "enum",
|
|
10869
|
+
"variants": [
|
|
10870
|
+
{
|
|
10871
|
+
"name": "IsReferrer"
|
|
10872
|
+
},
|
|
10873
|
+
{
|
|
10874
|
+
"name": "IsReferred"
|
|
10875
|
+
}
|
|
10876
|
+
]
|
|
10877
|
+
}
|
|
10878
|
+
},
|
|
10863
10879
|
{
|
|
10864
10880
|
"name": "MarginMode",
|
|
10865
10881
|
"type": {
|
package/lib/types.d.ts
CHANGED
|
@@ -974,7 +974,7 @@ export type UserStatsAccount = {
|
|
|
974
974
|
current_epoch_referrer_reward: BN;
|
|
975
975
|
};
|
|
976
976
|
referrer: PublicKey;
|
|
977
|
-
|
|
977
|
+
referrerStatus: boolean;
|
|
978
978
|
authority: PublicKey;
|
|
979
979
|
ifStakedQuoteAssetAmount: BN;
|
|
980
980
|
lastFuelIfBonusUpdateTs: number;
|
|
@@ -1138,6 +1138,10 @@ export type ReferrerInfo = {
|
|
|
1138
1138
|
referrer: PublicKey;
|
|
1139
1139
|
referrerStats: PublicKey;
|
|
1140
1140
|
};
|
|
1141
|
+
export declare enum ReferrerStatus {
|
|
1142
|
+
IsReferrer = 1,
|
|
1143
|
+
IsReferred = 2
|
|
1144
|
+
}
|
|
1141
1145
|
export declare enum PlaceAndTakeOrderSuccessCondition {
|
|
1142
1146
|
PartialFill = 1,
|
|
1143
1147
|
FullFill = 2
|
package/lib/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SwapReduceOnly = exports.PlaceAndTakeOrderSuccessCondition = exports.DefaultOrderParams = exports.ModifyOrderPolicy = exports.PostOnlyParams = exports.LiquidationType = exports.LPAction = exports.TradeSide = exports.getVariant = exports.isOneOfVariant = exports.isVariant = exports.SettlePnlMode = exports.StakeAction = exports.SpotFulfillmentConfigStatus = exports.SettlePnlExplanation = exports.DepositExplanation = exports.SpotFulfillmentStatus = exports.SpotFulfillmentType = exports.OrderTriggerCondition = exports.OrderActionExplanation = exports.OrderAction = exports.OrderStatus = exports.MarketType = exports.OrderType = exports.OracleSource = exports.DepositDirection = exports.PositionDirection = exports.SpotBalanceType = exports.SwapDirection = exports.AssetTier = exports.ContractTier = exports.ContractType = exports.MarginMode = exports.UserStatus = exports.InsuranceFundOperation = exports.SpotOperation = exports.PerpOperation = exports.MarketStatus = exports.ExchangeStatus = void 0;
|
|
3
|
+
exports.SwapReduceOnly = exports.PlaceAndTakeOrderSuccessCondition = exports.ReferrerStatus = exports.DefaultOrderParams = exports.ModifyOrderPolicy = exports.PostOnlyParams = exports.LiquidationType = exports.LPAction = exports.TradeSide = exports.getVariant = exports.isOneOfVariant = exports.isVariant = exports.SettlePnlMode = exports.StakeAction = exports.SpotFulfillmentConfigStatus = exports.SettlePnlExplanation = exports.DepositExplanation = exports.SpotFulfillmentStatus = exports.SpotFulfillmentType = exports.OrderTriggerCondition = exports.OrderActionExplanation = exports.OrderAction = exports.OrderStatus = exports.MarketType = exports.OrderType = exports.OracleSource = exports.DepositDirection = exports.PositionDirection = exports.SpotBalanceType = exports.SwapDirection = exports.AssetTier = exports.ContractTier = exports.ContractType = exports.MarginMode = exports.UserStatus = exports.InsuranceFundOperation = exports.SpotOperation = exports.PerpOperation = exports.MarketStatus = exports.ExchangeStatus = void 0;
|
|
4
4
|
const _1 = require(".");
|
|
5
5
|
// # Utility Types / Enums / Constants
|
|
6
6
|
var ExchangeStatus;
|
|
@@ -330,6 +330,11 @@ exports.DefaultOrderParams = {
|
|
|
330
330
|
auctionStartPrice: null,
|
|
331
331
|
auctionEndPrice: null,
|
|
332
332
|
};
|
|
333
|
+
var ReferrerStatus;
|
|
334
|
+
(function (ReferrerStatus) {
|
|
335
|
+
ReferrerStatus[ReferrerStatus["IsReferrer"] = 1] = "IsReferrer";
|
|
336
|
+
ReferrerStatus[ReferrerStatus["IsReferred"] = 2] = "IsReferred";
|
|
337
|
+
})(ReferrerStatus = exports.ReferrerStatus || (exports.ReferrerStatus = {}));
|
|
333
338
|
var PlaceAndTakeOrderSuccessCondition;
|
|
334
339
|
(function (PlaceAndTakeOrderSuccessCondition) {
|
|
335
340
|
PlaceAndTakeOrderSuccessCondition[PlaceAndTakeOrderSuccessCondition["PartialFill"] = 1] = "PartialFill";
|
package/package.json
CHANGED
package/src/driftClient.ts
CHANGED
|
@@ -4984,6 +4984,33 @@ export class DriftClient {
|
|
|
4984
4984
|
});
|
|
4985
4985
|
}
|
|
4986
4986
|
|
|
4987
|
+
public async updateUserStatsReferrerInfo(
|
|
4988
|
+
userStatsAccountPublicKey: PublicKey,
|
|
4989
|
+
txParams?: TxParams
|
|
4990
|
+
): Promise<TransactionSignature> {
|
|
4991
|
+
const { txSig } = await this.sendTransaction(
|
|
4992
|
+
await this.buildTransaction(
|
|
4993
|
+
await this.getUpdateUserStatsReferrerInfoIx(userStatsAccountPublicKey),
|
|
4994
|
+
txParams
|
|
4995
|
+
),
|
|
4996
|
+
[],
|
|
4997
|
+
this.opts
|
|
4998
|
+
);
|
|
4999
|
+
return txSig;
|
|
5000
|
+
}
|
|
5001
|
+
|
|
5002
|
+
public async getUpdateUserStatsReferrerInfoIx(
|
|
5003
|
+
userStatsAccountPublicKey: PublicKey
|
|
5004
|
+
): Promise<TransactionInstruction> {
|
|
5005
|
+
return await this.program.instruction.updateUserStatsReferrerInfo({
|
|
5006
|
+
accounts: {
|
|
5007
|
+
state: await this.getStatePublicKey(),
|
|
5008
|
+
userStats: userStatsAccountPublicKey,
|
|
5009
|
+
authority: this.wallet.publicKey,
|
|
5010
|
+
},
|
|
5011
|
+
});
|
|
5012
|
+
}
|
|
5013
|
+
|
|
4987
5014
|
public async updateUserOpenOrdersCount(
|
|
4988
5015
|
userAccountPublicKey: PublicKey,
|
|
4989
5016
|
user: UserAccount,
|
package/src/idl/drift.json
CHANGED
|
@@ -7730,11 +7730,13 @@
|
|
|
7730
7730
|
"type": "u16"
|
|
7731
7731
|
},
|
|
7732
7732
|
{
|
|
7733
|
-
"name": "
|
|
7733
|
+
"name": "referrerStatus",
|
|
7734
7734
|
"docs": [
|
|
7735
|
-
"
|
|
7735
|
+
"Flags for referrer status:",
|
|
7736
|
+
"First bit (LSB): 1 if user is a referrer, 0 otherwise",
|
|
7737
|
+
"Second bit: 1 if user was referred, 0 otherwise"
|
|
7736
7738
|
],
|
|
7737
|
-
"type": "
|
|
7739
|
+
"type": "u8"
|
|
7738
7740
|
},
|
|
7739
7741
|
{
|
|
7740
7742
|
"name": "disableUpdatePerpBidAskTwap",
|
|
@@ -10860,6 +10862,20 @@
|
|
|
10860
10862
|
]
|
|
10861
10863
|
}
|
|
10862
10864
|
},
|
|
10865
|
+
{
|
|
10866
|
+
"name": "ReferrerStatus",
|
|
10867
|
+
"type": {
|
|
10868
|
+
"kind": "enum",
|
|
10869
|
+
"variants": [
|
|
10870
|
+
{
|
|
10871
|
+
"name": "IsReferrer"
|
|
10872
|
+
},
|
|
10873
|
+
{
|
|
10874
|
+
"name": "IsReferred"
|
|
10875
|
+
}
|
|
10876
|
+
]
|
|
10877
|
+
}
|
|
10878
|
+
},
|
|
10863
10879
|
{
|
|
10864
10880
|
"name": "MarginMode",
|
|
10865
10881
|
"type": {
|
package/src/types.ts
CHANGED
|
@@ -914,7 +914,7 @@ export type UserStatsAccount = {
|
|
|
914
914
|
current_epoch_referrer_reward: BN;
|
|
915
915
|
};
|
|
916
916
|
referrer: PublicKey;
|
|
917
|
-
|
|
917
|
+
referrerStatus: boolean;
|
|
918
918
|
authority: PublicKey;
|
|
919
919
|
ifStakedQuoteAssetAmount: BN;
|
|
920
920
|
|
|
@@ -1102,6 +1102,11 @@ export type ReferrerInfo = {
|
|
|
1102
1102
|
referrerStats: PublicKey;
|
|
1103
1103
|
};
|
|
1104
1104
|
|
|
1105
|
+
export enum ReferrerStatus {
|
|
1106
|
+
IsReferrer = 1,
|
|
1107
|
+
IsReferred = 2,
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1105
1110
|
export enum PlaceAndTakeOrderSuccessCondition {
|
|
1106
1111
|
PartialFill = 1,
|
|
1107
1112
|
FullFill = 2,
|