@drift-labs/sdk 2.97.0-beta.20 → 2.97.0-beta.22
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/addresses/pda.d.ts +1 -0
- package/lib/addresses/pda.js +8 -1
- package/lib/driftClient.d.ts +12 -5
- package/lib/driftClient.js +109 -19
- package/lib/idl/drift.json +275 -3
- package/lib/types.d.ts +25 -1
- package/lib/types.js +6 -1
- package/package.json +2 -1
- package/src/addresses/pda.ts +13 -0
- package/src/driftClient.ts +174 -24
- package/src/idl/drift.json +275 -3
- package/src/types.ts +29 -1
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drift-labs/sdk",
|
|
3
|
-
"version": "2.97.0-beta.
|
|
3
|
+
"version": "2.97.0-beta.22",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"author": "crispheaney",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"rpc-websockets": "7.5.1",
|
|
51
51
|
"solana-bankrun": "^0.3.0",
|
|
52
52
|
"strict-event-emitter-types": "^2.0.0",
|
|
53
|
+
"tweetnacl": "1.0.3",
|
|
53
54
|
"uuid": "^8.3.2",
|
|
54
55
|
"zstddec": "^0.1.0"
|
|
55
56
|
},
|
package/src/addresses/pda.ts
CHANGED
|
@@ -72,6 +72,19 @@ export function getUserStatsAccountPublicKey(
|
|
|
72
72
|
)[0];
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
export function getRFQUserAccountPublicKey(
|
|
76
|
+
programId: PublicKey,
|
|
77
|
+
userAccountPublicKey: PublicKey
|
|
78
|
+
): PublicKey {
|
|
79
|
+
return PublicKey.findProgramAddressSync(
|
|
80
|
+
[
|
|
81
|
+
Buffer.from(anchor.utils.bytes.utf8.encode('RFQ')),
|
|
82
|
+
userAccountPublicKey.toBuffer(),
|
|
83
|
+
],
|
|
84
|
+
programId
|
|
85
|
+
)[0];
|
|
86
|
+
}
|
|
87
|
+
|
|
75
88
|
export async function getPerpMarketPublicKey(
|
|
76
89
|
programId: PublicKey,
|
|
77
90
|
marketIndex: number
|
package/src/driftClient.ts
CHANGED
|
@@ -40,6 +40,8 @@ import {
|
|
|
40
40
|
PositionDirection,
|
|
41
41
|
ReferrerInfo,
|
|
42
42
|
ReferrerNameAccount,
|
|
43
|
+
RFQMakerOrderParams,
|
|
44
|
+
RFQMatch,
|
|
43
45
|
SerumV3FulfillmentConfigAccount,
|
|
44
46
|
SettlePnlMode,
|
|
45
47
|
SignedTxData,
|
|
@@ -90,6 +92,7 @@ import {
|
|
|
90
92
|
getPhoenixFulfillmentConfigPublicKey,
|
|
91
93
|
getPythPullOraclePublicKey,
|
|
92
94
|
getReferrerNamePublicKeySync,
|
|
95
|
+
getRFQUserAccountPublicKey,
|
|
93
96
|
getSerumFulfillmentConfigPublicKey,
|
|
94
97
|
getSerumSignerPublicKey,
|
|
95
98
|
getSpotMarketPublicKey,
|
|
@@ -164,7 +167,7 @@ import { getFeedIdUint8Array, trimFeedId } from './util/pythPullOracleUtils';
|
|
|
164
167
|
import { isVersionedTransaction } from './tx/utils';
|
|
165
168
|
import pythSolanaReceiverIdl from './idl/pyth_solana_receiver.json';
|
|
166
169
|
import { asV0Tx, PullFeed } from '@switchboard-xyz/on-demand';
|
|
167
|
-
import
|
|
170
|
+
import nacl from 'tweetnacl';
|
|
168
171
|
|
|
169
172
|
type RemainingAccountParams = {
|
|
170
173
|
userAccounts: UserAccount[];
|
|
@@ -940,6 +943,56 @@ export class DriftClient {
|
|
|
940
943
|
return [txSig, userAccountPublicKey];
|
|
941
944
|
}
|
|
942
945
|
|
|
946
|
+
async getInitializeUserStatsIx(): Promise<TransactionInstruction> {
|
|
947
|
+
return await this.program.instruction.initializeUserStats({
|
|
948
|
+
accounts: {
|
|
949
|
+
userStats: this.getUserStatsAccountPublicKey(),
|
|
950
|
+
authority: this.wallet.publicKey,
|
|
951
|
+
payer: this.wallet.publicKey,
|
|
952
|
+
rent: anchor.web3.SYSVAR_RENT_PUBKEY,
|
|
953
|
+
systemProgram: anchor.web3.SystemProgram.programId,
|
|
954
|
+
state: await this.getStatePublicKey(),
|
|
955
|
+
},
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
public async initializeRFQUser(
|
|
960
|
+
userAccountPublicKey: PublicKey,
|
|
961
|
+
txParams?: TxParams
|
|
962
|
+
): Promise<[TransactionSignature, PublicKey]> {
|
|
963
|
+
const initializeIxs = [];
|
|
964
|
+
|
|
965
|
+
const [rfqUserAccountPublicKey, initializeUserAccountIx] =
|
|
966
|
+
await this.getInitializeRFQUserInstruction(userAccountPublicKey);
|
|
967
|
+
initializeIxs.push(initializeUserAccountIx);
|
|
968
|
+
const tx = await this.buildTransaction(initializeIxs, txParams);
|
|
969
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
970
|
+
|
|
971
|
+
return [txSig, rfqUserAccountPublicKey];
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
async getInitializeRFQUserInstruction(
|
|
975
|
+
userAccountPublicKey: PublicKey
|
|
976
|
+
): Promise<[PublicKey, TransactionInstruction]> {
|
|
977
|
+
const rfqUserAccountPublicKey = getRFQUserAccountPublicKey(
|
|
978
|
+
this.program.programId,
|
|
979
|
+
userAccountPublicKey
|
|
980
|
+
);
|
|
981
|
+
const initializeUserAccountIx =
|
|
982
|
+
await this.program.instruction.initializeRfqUser({
|
|
983
|
+
accounts: {
|
|
984
|
+
rfqUser: rfqUserAccountPublicKey,
|
|
985
|
+
authority: this.wallet.publicKey,
|
|
986
|
+
user: userAccountPublicKey,
|
|
987
|
+
payer: this.wallet.publicKey,
|
|
988
|
+
rent: anchor.web3.SYSVAR_RENT_PUBKEY,
|
|
989
|
+
systemProgram: anchor.web3.SystemProgram.programId,
|
|
990
|
+
},
|
|
991
|
+
});
|
|
992
|
+
|
|
993
|
+
return [rfqUserAccountPublicKey, initializeUserAccountIx];
|
|
994
|
+
}
|
|
995
|
+
|
|
943
996
|
async getInitializeUserInstructions(
|
|
944
997
|
subAccountId = 0,
|
|
945
998
|
name?: string,
|
|
@@ -1004,19 +1057,6 @@ export class DriftClient {
|
|
|
1004
1057
|
return [userAccountPublicKey, initializeUserAccountIx];
|
|
1005
1058
|
}
|
|
1006
1059
|
|
|
1007
|
-
async getInitializeUserStatsIx(): Promise<TransactionInstruction> {
|
|
1008
|
-
return await this.program.instruction.initializeUserStats({
|
|
1009
|
-
accounts: {
|
|
1010
|
-
userStats: this.getUserStatsAccountPublicKey(),
|
|
1011
|
-
authority: this.wallet.publicKey,
|
|
1012
|
-
payer: this.wallet.publicKey,
|
|
1013
|
-
rent: anchor.web3.SYSVAR_RENT_PUBKEY,
|
|
1014
|
-
systemProgram: anchor.web3.SystemProgram.programId,
|
|
1015
|
-
state: await this.getStatePublicKey(),
|
|
1016
|
-
},
|
|
1017
|
-
});
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
1060
|
async getNextSubAccountId(): Promise<number> {
|
|
1021
1061
|
const userStats = this.getUserStats();
|
|
1022
1062
|
let userStatsAccount: UserStatsAccount;
|
|
@@ -4984,6 +5024,33 @@ export class DriftClient {
|
|
|
4984
5024
|
});
|
|
4985
5025
|
}
|
|
4986
5026
|
|
|
5027
|
+
public async updateUserStatsReferrerInfo(
|
|
5028
|
+
userStatsAccountPublicKey: PublicKey,
|
|
5029
|
+
txParams?: TxParams
|
|
5030
|
+
): Promise<TransactionSignature> {
|
|
5031
|
+
const { txSig } = await this.sendTransaction(
|
|
5032
|
+
await this.buildTransaction(
|
|
5033
|
+
await this.getUpdateUserStatsReferrerInfoIx(userStatsAccountPublicKey),
|
|
5034
|
+
txParams
|
|
5035
|
+
),
|
|
5036
|
+
[],
|
|
5037
|
+
this.opts
|
|
5038
|
+
);
|
|
5039
|
+
return txSig;
|
|
5040
|
+
}
|
|
5041
|
+
|
|
5042
|
+
public async getUpdateUserStatsReferrerInfoIx(
|
|
5043
|
+
userStatsAccountPublicKey: PublicKey
|
|
5044
|
+
): Promise<TransactionInstruction> {
|
|
5045
|
+
return await this.program.instruction.updateUserStatsReferrerInfo({
|
|
5046
|
+
accounts: {
|
|
5047
|
+
state: await this.getStatePublicKey(),
|
|
5048
|
+
userStats: userStatsAccountPublicKey,
|
|
5049
|
+
authority: this.wallet.publicKey,
|
|
5050
|
+
},
|
|
5051
|
+
});
|
|
5052
|
+
}
|
|
5053
|
+
|
|
4987
5054
|
public async updateUserOpenOrdersCount(
|
|
4988
5055
|
userAccountPublicKey: PublicKey,
|
|
4989
5056
|
user: UserAccount,
|
|
@@ -5448,22 +5515,20 @@ export class DriftClient {
|
|
|
5448
5515
|
};
|
|
5449
5516
|
}
|
|
5450
5517
|
|
|
5451
|
-
public
|
|
5452
|
-
message: SwiftServerMessage
|
|
5453
|
-
): Promise<Buffer> {
|
|
5518
|
+
public signSwiftServerMessage(message: SwiftServerMessage): Buffer {
|
|
5454
5519
|
const swiftServerMessage = Uint8Array.from(
|
|
5455
5520
|
this.encodeSwiftServerMessage(message)
|
|
5456
5521
|
);
|
|
5457
|
-
return
|
|
5522
|
+
return this.signMessage(swiftServerMessage);
|
|
5458
5523
|
}
|
|
5459
5524
|
|
|
5460
|
-
public
|
|
5525
|
+
public signSwiftOrderParamsMessage(
|
|
5461
5526
|
orderParamsMessage: SwiftOrderParamsMessage
|
|
5462
|
-
):
|
|
5527
|
+
): Buffer {
|
|
5463
5528
|
const takerOrderParamsMessage = Uint8Array.from(
|
|
5464
5529
|
this.encodeSwiftOrderParamsMessage(orderParamsMessage)
|
|
5465
5530
|
);
|
|
5466
|
-
return
|
|
5531
|
+
return this.signMessage(takerOrderParamsMessage);
|
|
5467
5532
|
}
|
|
5468
5533
|
|
|
5469
5534
|
public encodeSwiftOrderParamsMessage(
|
|
@@ -5484,11 +5549,11 @@ export class DriftClient {
|
|
|
5484
5549
|
);
|
|
5485
5550
|
}
|
|
5486
5551
|
|
|
5487
|
-
public
|
|
5552
|
+
public signMessage(
|
|
5488
5553
|
message: Uint8Array,
|
|
5489
5554
|
keypair: Keypair = this.wallet.payer
|
|
5490
|
-
):
|
|
5491
|
-
return Buffer.from(
|
|
5555
|
+
): Buffer {
|
|
5556
|
+
return Buffer.from(nacl.sign.detached(message, keypair.secretKey));
|
|
5492
5557
|
}
|
|
5493
5558
|
|
|
5494
5559
|
public async placeSwiftTakerOrder(
|
|
@@ -5691,6 +5756,91 @@ export class DriftClient {
|
|
|
5691
5756
|
];
|
|
5692
5757
|
}
|
|
5693
5758
|
|
|
5759
|
+
public encodeRFQMakerOrderParams(message: RFQMakerOrderParams): Buffer {
|
|
5760
|
+
return this.program.coder.types.encode('RFQMakerOrderParams', message);
|
|
5761
|
+
}
|
|
5762
|
+
|
|
5763
|
+
public async placeAndMatchRFQOrders(
|
|
5764
|
+
rfqMatches: RFQMatch[],
|
|
5765
|
+
txParams?: TxParams
|
|
5766
|
+
): Promise<TransactionSignature> {
|
|
5767
|
+
const ixs = await this.getPlaceAndMatchRFQOrdersIxs(rfqMatches);
|
|
5768
|
+
const { txSig } = await this.sendTransaction(
|
|
5769
|
+
await this.buildTransaction(ixs, txParams),
|
|
5770
|
+
[],
|
|
5771
|
+
this.opts
|
|
5772
|
+
);
|
|
5773
|
+
return txSig;
|
|
5774
|
+
}
|
|
5775
|
+
|
|
5776
|
+
public async getPlaceAndMatchRFQOrdersIxs(
|
|
5777
|
+
rfqMatches: RFQMatch[]
|
|
5778
|
+
): Promise<TransactionInstruction[]> {
|
|
5779
|
+
const remainingAccounts = this.getRemainingAccounts({
|
|
5780
|
+
userAccounts: [this.getUserAccount()],
|
|
5781
|
+
useMarketLastSlotCache: true,
|
|
5782
|
+
writablePerpMarketIndexes: [rfqMatches[0].makerOrderParams.marketIndex],
|
|
5783
|
+
});
|
|
5784
|
+
|
|
5785
|
+
const makerAccountMetas = [];
|
|
5786
|
+
const verifyIxs = [];
|
|
5787
|
+
for (const match of rfqMatches) {
|
|
5788
|
+
const verifyIx = Ed25519Program.createInstructionWithPublicKey({
|
|
5789
|
+
publicKey: match.makerOrderParams.authority.toBytes(),
|
|
5790
|
+
signature: match.makerSignature,
|
|
5791
|
+
message: Uint8Array.from(
|
|
5792
|
+
this.encodeRFQMakerOrderParams(match.makerOrderParams)
|
|
5793
|
+
),
|
|
5794
|
+
});
|
|
5795
|
+
verifyIxs.push(verifyIx);
|
|
5796
|
+
|
|
5797
|
+
const userAccountPubkey = await getUserAccountPublicKey(
|
|
5798
|
+
this.program.programId,
|
|
5799
|
+
match.makerOrderParams.authority,
|
|
5800
|
+
match.makerOrderParams.subAccountId
|
|
5801
|
+
);
|
|
5802
|
+
makerAccountMetas.push({
|
|
5803
|
+
pubkey: userAccountPubkey,
|
|
5804
|
+
isWritable: true,
|
|
5805
|
+
isSigner: false,
|
|
5806
|
+
});
|
|
5807
|
+
|
|
5808
|
+
makerAccountMetas.push({
|
|
5809
|
+
pubkey: getUserStatsAccountPublicKey(
|
|
5810
|
+
this.program.programId,
|
|
5811
|
+
match.makerOrderParams.authority
|
|
5812
|
+
),
|
|
5813
|
+
isWritable: true,
|
|
5814
|
+
isSigner: false,
|
|
5815
|
+
});
|
|
5816
|
+
|
|
5817
|
+
makerAccountMetas.push({
|
|
5818
|
+
pubkey: getRFQUserAccountPublicKey(
|
|
5819
|
+
this.program.programId,
|
|
5820
|
+
userAccountPubkey
|
|
5821
|
+
),
|
|
5822
|
+
isWritable: true,
|
|
5823
|
+
isSigner: false,
|
|
5824
|
+
});
|
|
5825
|
+
}
|
|
5826
|
+
remainingAccounts.push(...makerAccountMetas);
|
|
5827
|
+
|
|
5828
|
+
const userStatsPublicKey = this.getUserStatsAccountPublicKey();
|
|
5829
|
+
const user = await this.getUserAccountPublicKey();
|
|
5830
|
+
const placeAndMatchRFQOrdersIx =
|
|
5831
|
+
await this.program.instruction.placeAndMatchRfqOrders(rfqMatches, {
|
|
5832
|
+
accounts: {
|
|
5833
|
+
state: await this.getStatePublicKey(),
|
|
5834
|
+
user,
|
|
5835
|
+
userStats: userStatsPublicKey,
|
|
5836
|
+
authority: this.wallet.publicKey,
|
|
5837
|
+
ixSysvar: SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
5838
|
+
},
|
|
5839
|
+
remainingAccounts,
|
|
5840
|
+
});
|
|
5841
|
+
return [...verifyIxs, placeAndMatchRFQOrdersIx];
|
|
5842
|
+
}
|
|
5843
|
+
|
|
5694
5844
|
public async preparePlaceAndTakeSpotOrder(
|
|
5695
5845
|
orderParams: OptionalOrderParams,
|
|
5696
5846
|
fulfillmentConfig?: SerumV3FulfillmentConfigAccount,
|
package/src/idl/drift.json
CHANGED
|
@@ -93,6 +93,42 @@
|
|
|
93
93
|
],
|
|
94
94
|
"args": []
|
|
95
95
|
},
|
|
96
|
+
{
|
|
97
|
+
"name": "initializeRfqUser",
|
|
98
|
+
"accounts": [
|
|
99
|
+
{
|
|
100
|
+
"name": "rfqUser",
|
|
101
|
+
"isMut": true,
|
|
102
|
+
"isSigner": false
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"name": "authority",
|
|
106
|
+
"isMut": false,
|
|
107
|
+
"isSigner": true
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"name": "user",
|
|
111
|
+
"isMut": true,
|
|
112
|
+
"isSigner": false
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "payer",
|
|
116
|
+
"isMut": true,
|
|
117
|
+
"isSigner": true
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"name": "rent",
|
|
121
|
+
"isMut": false,
|
|
122
|
+
"isSigner": false
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"name": "systemProgram",
|
|
126
|
+
"isMut": false,
|
|
127
|
+
"isSigner": false
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"args": []
|
|
131
|
+
},
|
|
96
132
|
{
|
|
97
133
|
"name": "initializeReferrerName",
|
|
98
134
|
"accounts": [
|
|
@@ -662,6 +698,51 @@
|
|
|
662
698
|
}
|
|
663
699
|
]
|
|
664
700
|
},
|
|
701
|
+
{
|
|
702
|
+
"name": "placeAndMatchRfqOrders",
|
|
703
|
+
"accounts": [
|
|
704
|
+
{
|
|
705
|
+
"name": "state",
|
|
706
|
+
"isMut": false,
|
|
707
|
+
"isSigner": false
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
"name": "user",
|
|
711
|
+
"isMut": true,
|
|
712
|
+
"isSigner": false
|
|
713
|
+
},
|
|
714
|
+
{
|
|
715
|
+
"name": "userStats",
|
|
716
|
+
"isMut": true,
|
|
717
|
+
"isSigner": false
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
"name": "authority",
|
|
721
|
+
"isMut": false,
|
|
722
|
+
"isSigner": true
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
"name": "ixSysvar",
|
|
726
|
+
"isMut": false,
|
|
727
|
+
"isSigner": false,
|
|
728
|
+
"docs": [
|
|
729
|
+
"the supplied Sysvar could be anything else.",
|
|
730
|
+
"The Instruction Sysvar has not been implemented",
|
|
731
|
+
"in the Anchor framework yet, so this is the safe approach."
|
|
732
|
+
]
|
|
733
|
+
}
|
|
734
|
+
],
|
|
735
|
+
"args": [
|
|
736
|
+
{
|
|
737
|
+
"name": "rfqMatches",
|
|
738
|
+
"type": {
|
|
739
|
+
"vec": {
|
|
740
|
+
"defined": "RFQMatch"
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
]
|
|
745
|
+
},
|
|
665
746
|
{
|
|
666
747
|
"name": "placeSpotOrder",
|
|
667
748
|
"accounts": [
|
|
@@ -6752,6 +6833,29 @@
|
|
|
6752
6833
|
]
|
|
6753
6834
|
}
|
|
6754
6835
|
},
|
|
6836
|
+
{
|
|
6837
|
+
"name": "RFQUser",
|
|
6838
|
+
"type": {
|
|
6839
|
+
"kind": "struct",
|
|
6840
|
+
"fields": [
|
|
6841
|
+
{
|
|
6842
|
+
"name": "userPubkey",
|
|
6843
|
+
"type": "publicKey"
|
|
6844
|
+
},
|
|
6845
|
+
{
|
|
6846
|
+
"name": "rfqOrderData",
|
|
6847
|
+
"type": {
|
|
6848
|
+
"array": [
|
|
6849
|
+
{
|
|
6850
|
+
"defined": "RFQOrderId"
|
|
6851
|
+
},
|
|
6852
|
+
32
|
|
6853
|
+
]
|
|
6854
|
+
}
|
|
6855
|
+
}
|
|
6856
|
+
]
|
|
6857
|
+
}
|
|
6858
|
+
},
|
|
6755
6859
|
{
|
|
6756
6860
|
"name": "SpotMarket",
|
|
6757
6861
|
"type": {
|
|
@@ -7730,11 +7834,13 @@
|
|
|
7730
7834
|
"type": "u16"
|
|
7731
7835
|
},
|
|
7732
7836
|
{
|
|
7733
|
-
"name": "
|
|
7837
|
+
"name": "referrerStatus",
|
|
7734
7838
|
"docs": [
|
|
7735
|
-
"
|
|
7839
|
+
"Flags for referrer status:",
|
|
7840
|
+
"First bit (LSB): 1 if user is a referrer, 0 otherwise",
|
|
7841
|
+
"Second bit: 1 if user was referred, 0 otherwise"
|
|
7736
7842
|
],
|
|
7737
|
-
"type": "
|
|
7843
|
+
"type": "u8"
|
|
7738
7844
|
},
|
|
7739
7845
|
{
|
|
7740
7846
|
"name": "disableUpdatePerpBidAskTwap",
|
|
@@ -8405,6 +8511,109 @@
|
|
|
8405
8511
|
]
|
|
8406
8512
|
}
|
|
8407
8513
|
},
|
|
8514
|
+
{
|
|
8515
|
+
"name": "RFQMakerOrderParams",
|
|
8516
|
+
"type": {
|
|
8517
|
+
"kind": "struct",
|
|
8518
|
+
"fields": [
|
|
8519
|
+
{
|
|
8520
|
+
"name": "uuid",
|
|
8521
|
+
"type": {
|
|
8522
|
+
"array": [
|
|
8523
|
+
"u8",
|
|
8524
|
+
8
|
|
8525
|
+
]
|
|
8526
|
+
}
|
|
8527
|
+
},
|
|
8528
|
+
{
|
|
8529
|
+
"name": "authority",
|
|
8530
|
+
"type": "publicKey"
|
|
8531
|
+
},
|
|
8532
|
+
{
|
|
8533
|
+
"name": "subAccountId",
|
|
8534
|
+
"type": "u16"
|
|
8535
|
+
},
|
|
8536
|
+
{
|
|
8537
|
+
"name": "marketIndex",
|
|
8538
|
+
"type": "u16"
|
|
8539
|
+
},
|
|
8540
|
+
{
|
|
8541
|
+
"name": "marketType",
|
|
8542
|
+
"type": {
|
|
8543
|
+
"defined": "MarketType"
|
|
8544
|
+
}
|
|
8545
|
+
},
|
|
8546
|
+
{
|
|
8547
|
+
"name": "baseAssetAmount",
|
|
8548
|
+
"type": "u64"
|
|
8549
|
+
},
|
|
8550
|
+
{
|
|
8551
|
+
"name": "price",
|
|
8552
|
+
"type": "u64"
|
|
8553
|
+
},
|
|
8554
|
+
{
|
|
8555
|
+
"name": "direction",
|
|
8556
|
+
"type": {
|
|
8557
|
+
"defined": "PositionDirection"
|
|
8558
|
+
}
|
|
8559
|
+
},
|
|
8560
|
+
{
|
|
8561
|
+
"name": "maxTs",
|
|
8562
|
+
"type": "i64"
|
|
8563
|
+
}
|
|
8564
|
+
]
|
|
8565
|
+
}
|
|
8566
|
+
},
|
|
8567
|
+
{
|
|
8568
|
+
"name": "RFQMakerMessage",
|
|
8569
|
+
"type": {
|
|
8570
|
+
"kind": "struct",
|
|
8571
|
+
"fields": [
|
|
8572
|
+
{
|
|
8573
|
+
"name": "orderParams",
|
|
8574
|
+
"type": {
|
|
8575
|
+
"defined": "RFQMakerOrderParams"
|
|
8576
|
+
}
|
|
8577
|
+
},
|
|
8578
|
+
{
|
|
8579
|
+
"name": "signature",
|
|
8580
|
+
"type": {
|
|
8581
|
+
"array": [
|
|
8582
|
+
"u8",
|
|
8583
|
+
64
|
|
8584
|
+
]
|
|
8585
|
+
}
|
|
8586
|
+
}
|
|
8587
|
+
]
|
|
8588
|
+
}
|
|
8589
|
+
},
|
|
8590
|
+
{
|
|
8591
|
+
"name": "RFQMatch",
|
|
8592
|
+
"type": {
|
|
8593
|
+
"kind": "struct",
|
|
8594
|
+
"fields": [
|
|
8595
|
+
{
|
|
8596
|
+
"name": "baseAssetAmount",
|
|
8597
|
+
"type": "u64"
|
|
8598
|
+
},
|
|
8599
|
+
{
|
|
8600
|
+
"name": "makerOrderParams",
|
|
8601
|
+
"type": {
|
|
8602
|
+
"defined": "RFQMakerOrderParams"
|
|
8603
|
+
}
|
|
8604
|
+
},
|
|
8605
|
+
{
|
|
8606
|
+
"name": "makerSignature",
|
|
8607
|
+
"type": {
|
|
8608
|
+
"array": [
|
|
8609
|
+
"u8",
|
|
8610
|
+
64
|
|
8611
|
+
]
|
|
8612
|
+
}
|
|
8613
|
+
}
|
|
8614
|
+
]
|
|
8615
|
+
}
|
|
8616
|
+
},
|
|
8408
8617
|
{
|
|
8409
8618
|
"name": "ModifyOrderParams",
|
|
8410
8619
|
"type": {
|
|
@@ -9224,6 +9433,27 @@
|
|
|
9224
9433
|
]
|
|
9225
9434
|
}
|
|
9226
9435
|
},
|
|
9436
|
+
{
|
|
9437
|
+
"name": "RFQOrderId",
|
|
9438
|
+
"type": {
|
|
9439
|
+
"kind": "struct",
|
|
9440
|
+
"fields": [
|
|
9441
|
+
{
|
|
9442
|
+
"name": "uuid",
|
|
9443
|
+
"type": {
|
|
9444
|
+
"array": [
|
|
9445
|
+
"u8",
|
|
9446
|
+
8
|
|
9447
|
+
]
|
|
9448
|
+
}
|
|
9449
|
+
},
|
|
9450
|
+
{
|
|
9451
|
+
"name": "maxTs",
|
|
9452
|
+
"type": "i64"
|
|
9453
|
+
}
|
|
9454
|
+
]
|
|
9455
|
+
}
|
|
9456
|
+
},
|
|
9227
9457
|
{
|
|
9228
9458
|
"name": "InsuranceFund",
|
|
9229
9459
|
"type": {
|
|
@@ -10324,6 +10554,9 @@
|
|
|
10324
10554
|
},
|
|
10325
10555
|
{
|
|
10326
10556
|
"name": "Liquidation"
|
|
10557
|
+
},
|
|
10558
|
+
{
|
|
10559
|
+
"name": "RFQ"
|
|
10327
10560
|
}
|
|
10328
10561
|
]
|
|
10329
10562
|
}
|
|
@@ -10860,6 +11093,20 @@
|
|
|
10860
11093
|
]
|
|
10861
11094
|
}
|
|
10862
11095
|
},
|
|
11096
|
+
{
|
|
11097
|
+
"name": "ReferrerStatus",
|
|
11098
|
+
"type": {
|
|
11099
|
+
"kind": "enum",
|
|
11100
|
+
"variants": [
|
|
11101
|
+
{
|
|
11102
|
+
"name": "IsReferrer"
|
|
11103
|
+
},
|
|
11104
|
+
{
|
|
11105
|
+
"name": "IsReferred"
|
|
11106
|
+
}
|
|
11107
|
+
]
|
|
11108
|
+
}
|
|
11109
|
+
},
|
|
10863
11110
|
{
|
|
10864
11111
|
"name": "MarginMode",
|
|
10865
11112
|
"type": {
|
|
@@ -13371,6 +13618,31 @@
|
|
|
13371
13618
|
"code": 6290,
|
|
13372
13619
|
"name": "InvalidHighLeverageModeConfig",
|
|
13373
13620
|
"msg": "Invalid High Leverage Mode Config"
|
|
13621
|
+
},
|
|
13622
|
+
{
|
|
13623
|
+
"code": 6291,
|
|
13624
|
+
"name": "InvalidRFQUserAccount",
|
|
13625
|
+
"msg": "Invalid RFQ User Account"
|
|
13626
|
+
},
|
|
13627
|
+
{
|
|
13628
|
+
"code": 6292,
|
|
13629
|
+
"name": "RFQUserAccountWrongMutability",
|
|
13630
|
+
"msg": "RFQUserAccount should be mutable"
|
|
13631
|
+
},
|
|
13632
|
+
{
|
|
13633
|
+
"code": 6293,
|
|
13634
|
+
"name": "RFQUserAccountFull",
|
|
13635
|
+
"msg": "RFQUserAccount has too many active RFQs"
|
|
13636
|
+
},
|
|
13637
|
+
{
|
|
13638
|
+
"code": 6294,
|
|
13639
|
+
"name": "RFQOrderNotFilled",
|
|
13640
|
+
"msg": "RFQ order not filled as expected"
|
|
13641
|
+
},
|
|
13642
|
+
{
|
|
13643
|
+
"code": 6295,
|
|
13644
|
+
"name": "InvalidRFQOrder",
|
|
13645
|
+
"msg": "RFQ orders must be jit makers"
|
|
13374
13646
|
}
|
|
13375
13647
|
],
|
|
13376
13648
|
"metadata": {
|