@drift-labs/jit-proxy 0.10.34 → 0.10.36
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/lib/jitProxyClient.d.ts +9 -1
- package/lib/jitProxyClient.js +37 -0
- package/lib/types/jit_proxy.d.ts +83 -27
- package/lib/types/jit_proxy.js +83 -27
- package/package.json +2 -2
- package/src/jitProxyClient.ts +55 -0
- package/src/types/jit_proxy.ts +166 -54
package/lib/jitProxyClient.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BN, DriftClient, MarketType, PostOnlyParams, ReferrerInfo, TxParams, UserAccount } from '@drift-labs/sdk';
|
|
1
|
+
import { BN, DriftClient, MakerInfo, MarketType, PostOnlyParams, ReferrerInfo, TxParams, UserAccount } from '@drift-labs/sdk';
|
|
2
2
|
import { PublicKey, TransactionInstruction } from '@solana/web3.js';
|
|
3
3
|
import { TxSigAndSlot } from '@drift-labs/sdk/lib/tx/types';
|
|
4
4
|
export type JitIxParams = {
|
|
@@ -42,4 +42,12 @@ export declare class JitProxyClient {
|
|
|
42
42
|
subAccountId: number;
|
|
43
43
|
orderConstraints: OrderConstraint[];
|
|
44
44
|
}): Promise<TransactionInstruction>;
|
|
45
|
+
arbPerp(params: {
|
|
46
|
+
makerInfos: MakerInfo[];
|
|
47
|
+
marketIndex: number;
|
|
48
|
+
}, txParams?: TxParams): Promise<TxSigAndSlot>;
|
|
49
|
+
getArbPerpIx({ makerInfos, marketIndex, }: {
|
|
50
|
+
makerInfos: MakerInfo[];
|
|
51
|
+
marketIndex: number;
|
|
52
|
+
}): Promise<TransactionInstruction>;
|
|
45
53
|
}
|
package/lib/jitProxyClient.js
CHANGED
|
@@ -108,5 +108,42 @@ class JitProxyClient {
|
|
|
108
108
|
.remainingAccounts(remainingAccounts)
|
|
109
109
|
.instruction();
|
|
110
110
|
}
|
|
111
|
+
async arbPerp(params, txParams) {
|
|
112
|
+
const ix = await this.getArbPerpIx(params);
|
|
113
|
+
const tx = await this.driftClient.buildTransaction([ix], txParams);
|
|
114
|
+
return await this.driftClient.sendTransaction(tx);
|
|
115
|
+
}
|
|
116
|
+
async getArbPerpIx({ makerInfos, marketIndex, }) {
|
|
117
|
+
const userAccounts = [this.driftClient.getUserAccount()];
|
|
118
|
+
for (const makerInfo of makerInfos) {
|
|
119
|
+
userAccounts.push(makerInfo.makerUserAccount);
|
|
120
|
+
}
|
|
121
|
+
const remainingAccounts = this.driftClient.getRemainingAccounts({
|
|
122
|
+
userAccounts,
|
|
123
|
+
writablePerpMarketIndexes: [marketIndex],
|
|
124
|
+
});
|
|
125
|
+
for (const makerInfo of makerInfos) {
|
|
126
|
+
remainingAccounts.push({
|
|
127
|
+
pubkey: makerInfo.maker,
|
|
128
|
+
isWritable: true,
|
|
129
|
+
isSigner: false,
|
|
130
|
+
});
|
|
131
|
+
remainingAccounts.push({
|
|
132
|
+
pubkey: makerInfo.makerStats,
|
|
133
|
+
isWritable: true,
|
|
134
|
+
isSigner: false,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
return this.program.methods
|
|
138
|
+
.arbPerp(marketIndex)
|
|
139
|
+
.accounts({
|
|
140
|
+
state: await this.driftClient.getStatePublicKey(),
|
|
141
|
+
user: await this.driftClient.getUserAccountPublicKey(),
|
|
142
|
+
userStats: this.driftClient.getUserStatsAccountPublicKey(),
|
|
143
|
+
driftProgram: this.driftClient.program.programId,
|
|
144
|
+
})
|
|
145
|
+
.remainingAccounts(remainingAccounts)
|
|
146
|
+
.instruction();
|
|
147
|
+
}
|
|
111
148
|
}
|
|
112
149
|
exports.JitProxyClient = JitProxyClient;
|
package/lib/types/jit_proxy.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type JitProxy = {
|
|
2
|
-
version: '0.10.
|
|
2
|
+
version: '0.10.2';
|
|
3
3
|
name: 'jit_proxy';
|
|
4
4
|
instructions: [
|
|
5
5
|
{
|
|
@@ -69,18 +69,50 @@ export type JitProxy = {
|
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
];
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: 'arbPerp';
|
|
75
|
+
accounts: [
|
|
76
|
+
{
|
|
77
|
+
name: 'state';
|
|
78
|
+
isMut: false;
|
|
79
|
+
isSigner: false;
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'user';
|
|
83
|
+
isMut: true;
|
|
84
|
+
isSigner: false;
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: 'userStats';
|
|
88
|
+
isMut: true;
|
|
89
|
+
isSigner: false;
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: 'authority';
|
|
93
|
+
isMut: false;
|
|
94
|
+
isSigner: true;
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'driftProgram';
|
|
98
|
+
isMut: false;
|
|
99
|
+
isSigner: false;
|
|
100
|
+
}
|
|
101
|
+
];
|
|
102
|
+
args: [
|
|
103
|
+
{
|
|
104
|
+
name: 'marketIndex';
|
|
105
|
+
type: 'u16';
|
|
106
|
+
}
|
|
107
|
+
];
|
|
72
108
|
}
|
|
73
109
|
];
|
|
74
110
|
types: [
|
|
75
111
|
{
|
|
76
|
-
name: '
|
|
112
|
+
name: 'OrderConstraint';
|
|
77
113
|
type: {
|
|
78
114
|
kind: 'struct';
|
|
79
115
|
fields: [
|
|
80
|
-
{
|
|
81
|
-
name: 'takerOrderId';
|
|
82
|
-
type: 'u32';
|
|
83
|
-
},
|
|
84
116
|
{
|
|
85
117
|
name: 'maxPosition';
|
|
86
118
|
type: 'i64';
|
|
@@ -90,35 +122,27 @@ export type JitProxy = {
|
|
|
90
122
|
type: 'i64';
|
|
91
123
|
},
|
|
92
124
|
{
|
|
93
|
-
name: '
|
|
94
|
-
type: '
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
name: 'ask';
|
|
98
|
-
type: 'i64';
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: 'priceType';
|
|
102
|
-
type: {
|
|
103
|
-
defined: 'PriceType';
|
|
104
|
-
};
|
|
125
|
+
name: 'marketIndex';
|
|
126
|
+
type: 'u16';
|
|
105
127
|
},
|
|
106
128
|
{
|
|
107
|
-
name: '
|
|
129
|
+
name: 'marketType';
|
|
108
130
|
type: {
|
|
109
|
-
|
|
110
|
-
defined: 'PostOnlyParam';
|
|
111
|
-
};
|
|
131
|
+
defined: 'MarketType';
|
|
112
132
|
};
|
|
113
133
|
}
|
|
114
134
|
];
|
|
115
135
|
};
|
|
116
136
|
},
|
|
117
137
|
{
|
|
118
|
-
name: '
|
|
138
|
+
name: 'JitParams';
|
|
119
139
|
type: {
|
|
120
140
|
kind: 'struct';
|
|
121
141
|
fields: [
|
|
142
|
+
{
|
|
143
|
+
name: 'takerOrderId';
|
|
144
|
+
type: 'u32';
|
|
145
|
+
},
|
|
122
146
|
{
|
|
123
147
|
name: 'maxPosition';
|
|
124
148
|
type: 'i64';
|
|
@@ -128,13 +152,25 @@ export type JitProxy = {
|
|
|
128
152
|
type: 'i64';
|
|
129
153
|
},
|
|
130
154
|
{
|
|
131
|
-
name: '
|
|
132
|
-
type: '
|
|
155
|
+
name: 'bid';
|
|
156
|
+
type: 'i64';
|
|
133
157
|
},
|
|
134
158
|
{
|
|
135
|
-
name: '
|
|
159
|
+
name: 'ask';
|
|
160
|
+
type: 'i64';
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: 'priceType';
|
|
136
164
|
type: {
|
|
137
|
-
defined: '
|
|
165
|
+
defined: 'PriceType';
|
|
166
|
+
};
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: 'postOnly';
|
|
170
|
+
type: {
|
|
171
|
+
option: {
|
|
172
|
+
defined: 'PostOnlyParam';
|
|
173
|
+
};
|
|
138
174
|
};
|
|
139
175
|
}
|
|
140
176
|
];
|
|
@@ -206,6 +242,26 @@ export type JitProxy = {
|
|
|
206
242
|
code: 6003;
|
|
207
243
|
name: 'OrderSizeBreached';
|
|
208
244
|
msg: 'OrderSizeBreached';
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
code: 6004;
|
|
248
|
+
name: 'NoBestBid';
|
|
249
|
+
msg: 'NoBestBid';
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
code: 6005;
|
|
253
|
+
name: 'NoBestAsk';
|
|
254
|
+
msg: 'NoBestAsk';
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
code: 6006;
|
|
258
|
+
name: 'NoArbOpportunity';
|
|
259
|
+
msg: 'NoArbOpportunity';
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
code: 6007;
|
|
263
|
+
name: 'UnprofitableArb';
|
|
264
|
+
msg: 'UnprofitableArb';
|
|
209
265
|
}
|
|
210
266
|
];
|
|
211
267
|
};
|
package/lib/types/jit_proxy.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IDL = void 0;
|
|
4
4
|
exports.IDL = {
|
|
5
|
-
version: '0.10.
|
|
5
|
+
version: '0.10.2',
|
|
6
6
|
name: 'jit_proxy',
|
|
7
7
|
instructions: [
|
|
8
8
|
{
|
|
@@ -73,17 +73,49 @@ exports.IDL = {
|
|
|
73
73
|
},
|
|
74
74
|
],
|
|
75
75
|
},
|
|
76
|
+
{
|
|
77
|
+
name: 'arbPerp',
|
|
78
|
+
accounts: [
|
|
79
|
+
{
|
|
80
|
+
name: 'state',
|
|
81
|
+
isMut: false,
|
|
82
|
+
isSigner: false,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'user',
|
|
86
|
+
isMut: true,
|
|
87
|
+
isSigner: false,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'userStats',
|
|
91
|
+
isMut: true,
|
|
92
|
+
isSigner: false,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: 'authority',
|
|
96
|
+
isMut: false,
|
|
97
|
+
isSigner: true,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: 'driftProgram',
|
|
101
|
+
isMut: false,
|
|
102
|
+
isSigner: false,
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
args: [
|
|
106
|
+
{
|
|
107
|
+
name: 'marketIndex',
|
|
108
|
+
type: 'u16',
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
},
|
|
76
112
|
],
|
|
77
113
|
types: [
|
|
78
114
|
{
|
|
79
|
-
name: '
|
|
115
|
+
name: 'OrderConstraint',
|
|
80
116
|
type: {
|
|
81
117
|
kind: 'struct',
|
|
82
118
|
fields: [
|
|
83
|
-
{
|
|
84
|
-
name: 'takerOrderId',
|
|
85
|
-
type: 'u32',
|
|
86
|
-
},
|
|
87
119
|
{
|
|
88
120
|
name: 'maxPosition',
|
|
89
121
|
type: 'i64',
|
|
@@ -93,35 +125,27 @@ exports.IDL = {
|
|
|
93
125
|
type: 'i64',
|
|
94
126
|
},
|
|
95
127
|
{
|
|
96
|
-
name: '
|
|
97
|
-
type: '
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
name: 'ask',
|
|
101
|
-
type: 'i64',
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
name: 'priceType',
|
|
105
|
-
type: {
|
|
106
|
-
defined: 'PriceType',
|
|
107
|
-
},
|
|
128
|
+
name: 'marketIndex',
|
|
129
|
+
type: 'u16',
|
|
108
130
|
},
|
|
109
131
|
{
|
|
110
|
-
name: '
|
|
132
|
+
name: 'marketType',
|
|
111
133
|
type: {
|
|
112
|
-
|
|
113
|
-
defined: 'PostOnlyParam',
|
|
114
|
-
},
|
|
134
|
+
defined: 'MarketType',
|
|
115
135
|
},
|
|
116
136
|
},
|
|
117
137
|
],
|
|
118
138
|
},
|
|
119
139
|
},
|
|
120
140
|
{
|
|
121
|
-
name: '
|
|
141
|
+
name: 'JitParams',
|
|
122
142
|
type: {
|
|
123
143
|
kind: 'struct',
|
|
124
144
|
fields: [
|
|
145
|
+
{
|
|
146
|
+
name: 'takerOrderId',
|
|
147
|
+
type: 'u32',
|
|
148
|
+
},
|
|
125
149
|
{
|
|
126
150
|
name: 'maxPosition',
|
|
127
151
|
type: 'i64',
|
|
@@ -131,13 +155,25 @@ exports.IDL = {
|
|
|
131
155
|
type: 'i64',
|
|
132
156
|
},
|
|
133
157
|
{
|
|
134
|
-
name: '
|
|
135
|
-
type: '
|
|
158
|
+
name: 'bid',
|
|
159
|
+
type: 'i64',
|
|
136
160
|
},
|
|
137
161
|
{
|
|
138
|
-
name: '
|
|
162
|
+
name: 'ask',
|
|
163
|
+
type: 'i64',
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: 'priceType',
|
|
139
167
|
type: {
|
|
140
|
-
defined: '
|
|
168
|
+
defined: 'PriceType',
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: 'postOnly',
|
|
173
|
+
type: {
|
|
174
|
+
option: {
|
|
175
|
+
defined: 'PostOnlyParam',
|
|
176
|
+
},
|
|
141
177
|
},
|
|
142
178
|
},
|
|
143
179
|
],
|
|
@@ -210,5 +246,25 @@ exports.IDL = {
|
|
|
210
246
|
name: 'OrderSizeBreached',
|
|
211
247
|
msg: 'OrderSizeBreached',
|
|
212
248
|
},
|
|
249
|
+
{
|
|
250
|
+
code: 6004,
|
|
251
|
+
name: 'NoBestBid',
|
|
252
|
+
msg: 'NoBestBid',
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
code: 6005,
|
|
256
|
+
name: 'NoBestAsk',
|
|
257
|
+
msg: 'NoBestAsk',
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
code: 6006,
|
|
261
|
+
name: 'NoArbOpportunity',
|
|
262
|
+
msg: 'NoArbOpportunity',
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
code: 6007,
|
|
266
|
+
name: 'UnprofitableArb',
|
|
267
|
+
msg: 'UnprofitableArb',
|
|
268
|
+
},
|
|
213
269
|
],
|
|
214
270
|
};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drift-labs/jit-proxy",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.36",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"clean": "rm -rf lib",
|
|
6
6
|
"build": "yarn clean && tsc"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@coral-xyz/anchor": "^0.26.0",
|
|
10
|
-
"@drift-labs/sdk": "2.42.0-beta.
|
|
10
|
+
"@drift-labs/sdk": "2.42.0-beta.6",
|
|
11
11
|
"@solana/web3.js": "1.73.2"
|
|
12
12
|
},
|
|
13
13
|
"engines": {
|
package/src/jitProxyClient.ts
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
BN,
|
|
3
3
|
DriftClient,
|
|
4
4
|
isVariant,
|
|
5
|
+
MakerInfo,
|
|
5
6
|
MarketType,
|
|
6
7
|
PostOnlyParams,
|
|
7
8
|
QUOTE_SPOT_MARKET_INDEX,
|
|
@@ -180,4 +181,58 @@ export class JitProxyClient {
|
|
|
180
181
|
.remainingAccounts(remainingAccounts)
|
|
181
182
|
.instruction();
|
|
182
183
|
}
|
|
184
|
+
|
|
185
|
+
public async arbPerp(
|
|
186
|
+
params: {
|
|
187
|
+
makerInfos: MakerInfo[];
|
|
188
|
+
marketIndex: number;
|
|
189
|
+
},
|
|
190
|
+
txParams?: TxParams
|
|
191
|
+
): Promise<TxSigAndSlot> {
|
|
192
|
+
const ix = await this.getArbPerpIx(params);
|
|
193
|
+
const tx = await this.driftClient.buildTransaction([ix], txParams);
|
|
194
|
+
return await this.driftClient.sendTransaction(tx);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
public async getArbPerpIx({
|
|
198
|
+
makerInfos,
|
|
199
|
+
marketIndex,
|
|
200
|
+
}: {
|
|
201
|
+
makerInfos: MakerInfo[];
|
|
202
|
+
marketIndex: number;
|
|
203
|
+
}): Promise<TransactionInstruction> {
|
|
204
|
+
const userAccounts = [this.driftClient.getUserAccount()];
|
|
205
|
+
for (const makerInfo of makerInfos) {
|
|
206
|
+
userAccounts.push(makerInfo.makerUserAccount);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const remainingAccounts = this.driftClient.getRemainingAccounts({
|
|
210
|
+
userAccounts,
|
|
211
|
+
writablePerpMarketIndexes: [marketIndex],
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
for (const makerInfo of makerInfos) {
|
|
215
|
+
remainingAccounts.push({
|
|
216
|
+
pubkey: makerInfo.maker,
|
|
217
|
+
isWritable: true,
|
|
218
|
+
isSigner: false,
|
|
219
|
+
});
|
|
220
|
+
remainingAccounts.push({
|
|
221
|
+
pubkey: makerInfo.makerStats,
|
|
222
|
+
isWritable: true,
|
|
223
|
+
isSigner: false,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return this.program.methods
|
|
228
|
+
.arbPerp(marketIndex)
|
|
229
|
+
.accounts({
|
|
230
|
+
state: await this.driftClient.getStatePublicKey(),
|
|
231
|
+
user: await this.driftClient.getUserAccountPublicKey(),
|
|
232
|
+
userStats: this.driftClient.getUserStatsAccountPublicKey(),
|
|
233
|
+
driftProgram: this.driftClient.program.programId,
|
|
234
|
+
})
|
|
235
|
+
.remainingAccounts(remainingAccounts)
|
|
236
|
+
.instruction();
|
|
237
|
+
}
|
|
183
238
|
}
|
package/src/types/jit_proxy.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type JitProxy = {
|
|
2
|
-
version: '0.10.
|
|
2
|
+
version: '0.10.2';
|
|
3
3
|
name: 'jit_proxy';
|
|
4
4
|
instructions: [
|
|
5
5
|
{
|
|
@@ -69,18 +69,50 @@ export type JitProxy = {
|
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
];
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: 'arbPerp';
|
|
75
|
+
accounts: [
|
|
76
|
+
{
|
|
77
|
+
name: 'state';
|
|
78
|
+
isMut: false;
|
|
79
|
+
isSigner: false;
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'user';
|
|
83
|
+
isMut: true;
|
|
84
|
+
isSigner: false;
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: 'userStats';
|
|
88
|
+
isMut: true;
|
|
89
|
+
isSigner: false;
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: 'authority';
|
|
93
|
+
isMut: false;
|
|
94
|
+
isSigner: true;
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'driftProgram';
|
|
98
|
+
isMut: false;
|
|
99
|
+
isSigner: false;
|
|
100
|
+
}
|
|
101
|
+
];
|
|
102
|
+
args: [
|
|
103
|
+
{
|
|
104
|
+
name: 'marketIndex';
|
|
105
|
+
type: 'u16';
|
|
106
|
+
}
|
|
107
|
+
];
|
|
72
108
|
}
|
|
73
109
|
];
|
|
74
110
|
types: [
|
|
75
111
|
{
|
|
76
|
-
name: '
|
|
112
|
+
name: 'OrderConstraint';
|
|
77
113
|
type: {
|
|
78
114
|
kind: 'struct';
|
|
79
115
|
fields: [
|
|
80
|
-
{
|
|
81
|
-
name: 'takerOrderId';
|
|
82
|
-
type: 'u32';
|
|
83
|
-
},
|
|
84
116
|
{
|
|
85
117
|
name: 'maxPosition';
|
|
86
118
|
type: 'i64';
|
|
@@ -90,35 +122,27 @@ export type JitProxy = {
|
|
|
90
122
|
type: 'i64';
|
|
91
123
|
},
|
|
92
124
|
{
|
|
93
|
-
name: '
|
|
94
|
-
type: '
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
name: 'ask';
|
|
98
|
-
type: 'i64';
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: 'priceType';
|
|
102
|
-
type: {
|
|
103
|
-
defined: 'PriceType';
|
|
104
|
-
};
|
|
125
|
+
name: 'marketIndex';
|
|
126
|
+
type: 'u16';
|
|
105
127
|
},
|
|
106
128
|
{
|
|
107
|
-
name: '
|
|
129
|
+
name: 'marketType';
|
|
108
130
|
type: {
|
|
109
|
-
|
|
110
|
-
defined: 'PostOnlyParam';
|
|
111
|
-
};
|
|
131
|
+
defined: 'MarketType';
|
|
112
132
|
};
|
|
113
133
|
}
|
|
114
134
|
];
|
|
115
135
|
};
|
|
116
136
|
},
|
|
117
137
|
{
|
|
118
|
-
name: '
|
|
138
|
+
name: 'JitParams';
|
|
119
139
|
type: {
|
|
120
140
|
kind: 'struct';
|
|
121
141
|
fields: [
|
|
142
|
+
{
|
|
143
|
+
name: 'takerOrderId';
|
|
144
|
+
type: 'u32';
|
|
145
|
+
},
|
|
122
146
|
{
|
|
123
147
|
name: 'maxPosition';
|
|
124
148
|
type: 'i64';
|
|
@@ -128,13 +152,25 @@ export type JitProxy = {
|
|
|
128
152
|
type: 'i64';
|
|
129
153
|
},
|
|
130
154
|
{
|
|
131
|
-
name: '
|
|
132
|
-
type: '
|
|
155
|
+
name: 'bid';
|
|
156
|
+
type: 'i64';
|
|
133
157
|
},
|
|
134
158
|
{
|
|
135
|
-
name: '
|
|
159
|
+
name: 'ask';
|
|
160
|
+
type: 'i64';
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: 'priceType';
|
|
136
164
|
type: {
|
|
137
|
-
defined: '
|
|
165
|
+
defined: 'PriceType';
|
|
166
|
+
};
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: 'postOnly';
|
|
170
|
+
type: {
|
|
171
|
+
option: {
|
|
172
|
+
defined: 'PostOnlyParam';
|
|
173
|
+
};
|
|
138
174
|
};
|
|
139
175
|
}
|
|
140
176
|
];
|
|
@@ -206,12 +242,32 @@ export type JitProxy = {
|
|
|
206
242
|
code: 6003;
|
|
207
243
|
name: 'OrderSizeBreached';
|
|
208
244
|
msg: 'OrderSizeBreached';
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
code: 6004;
|
|
248
|
+
name: 'NoBestBid';
|
|
249
|
+
msg: 'NoBestBid';
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
code: 6005;
|
|
253
|
+
name: 'NoBestAsk';
|
|
254
|
+
msg: 'NoBestAsk';
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
code: 6006;
|
|
258
|
+
name: 'NoArbOpportunity';
|
|
259
|
+
msg: 'NoArbOpportunity';
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
code: 6007;
|
|
263
|
+
name: 'UnprofitableArb';
|
|
264
|
+
msg: 'UnprofitableArb';
|
|
209
265
|
}
|
|
210
266
|
];
|
|
211
267
|
};
|
|
212
268
|
|
|
213
269
|
export const IDL: JitProxy = {
|
|
214
|
-
version: '0.10.
|
|
270
|
+
version: '0.10.2',
|
|
215
271
|
name: 'jit_proxy',
|
|
216
272
|
instructions: [
|
|
217
273
|
{
|
|
@@ -282,17 +338,49 @@ export const IDL: JitProxy = {
|
|
|
282
338
|
},
|
|
283
339
|
],
|
|
284
340
|
},
|
|
341
|
+
{
|
|
342
|
+
name: 'arbPerp',
|
|
343
|
+
accounts: [
|
|
344
|
+
{
|
|
345
|
+
name: 'state',
|
|
346
|
+
isMut: false,
|
|
347
|
+
isSigner: false,
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
name: 'user',
|
|
351
|
+
isMut: true,
|
|
352
|
+
isSigner: false,
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
name: 'userStats',
|
|
356
|
+
isMut: true,
|
|
357
|
+
isSigner: false,
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
name: 'authority',
|
|
361
|
+
isMut: false,
|
|
362
|
+
isSigner: true,
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
name: 'driftProgram',
|
|
366
|
+
isMut: false,
|
|
367
|
+
isSigner: false,
|
|
368
|
+
},
|
|
369
|
+
],
|
|
370
|
+
args: [
|
|
371
|
+
{
|
|
372
|
+
name: 'marketIndex',
|
|
373
|
+
type: 'u16',
|
|
374
|
+
},
|
|
375
|
+
],
|
|
376
|
+
},
|
|
285
377
|
],
|
|
286
378
|
types: [
|
|
287
379
|
{
|
|
288
|
-
name: '
|
|
380
|
+
name: 'OrderConstraint',
|
|
289
381
|
type: {
|
|
290
382
|
kind: 'struct',
|
|
291
383
|
fields: [
|
|
292
|
-
{
|
|
293
|
-
name: 'takerOrderId',
|
|
294
|
-
type: 'u32',
|
|
295
|
-
},
|
|
296
384
|
{
|
|
297
385
|
name: 'maxPosition',
|
|
298
386
|
type: 'i64',
|
|
@@ -302,35 +390,27 @@ export const IDL: JitProxy = {
|
|
|
302
390
|
type: 'i64',
|
|
303
391
|
},
|
|
304
392
|
{
|
|
305
|
-
name: '
|
|
306
|
-
type: '
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
name: 'ask',
|
|
310
|
-
type: 'i64',
|
|
311
|
-
},
|
|
312
|
-
{
|
|
313
|
-
name: 'priceType',
|
|
314
|
-
type: {
|
|
315
|
-
defined: 'PriceType',
|
|
316
|
-
},
|
|
393
|
+
name: 'marketIndex',
|
|
394
|
+
type: 'u16',
|
|
317
395
|
},
|
|
318
396
|
{
|
|
319
|
-
name: '
|
|
397
|
+
name: 'marketType',
|
|
320
398
|
type: {
|
|
321
|
-
|
|
322
|
-
defined: 'PostOnlyParam',
|
|
323
|
-
},
|
|
399
|
+
defined: 'MarketType',
|
|
324
400
|
},
|
|
325
401
|
},
|
|
326
402
|
],
|
|
327
403
|
},
|
|
328
404
|
},
|
|
329
405
|
{
|
|
330
|
-
name: '
|
|
406
|
+
name: 'JitParams',
|
|
331
407
|
type: {
|
|
332
408
|
kind: 'struct',
|
|
333
409
|
fields: [
|
|
410
|
+
{
|
|
411
|
+
name: 'takerOrderId',
|
|
412
|
+
type: 'u32',
|
|
413
|
+
},
|
|
334
414
|
{
|
|
335
415
|
name: 'maxPosition',
|
|
336
416
|
type: 'i64',
|
|
@@ -340,13 +420,25 @@ export const IDL: JitProxy = {
|
|
|
340
420
|
type: 'i64',
|
|
341
421
|
},
|
|
342
422
|
{
|
|
343
|
-
name: '
|
|
344
|
-
type: '
|
|
423
|
+
name: 'bid',
|
|
424
|
+
type: 'i64',
|
|
345
425
|
},
|
|
346
426
|
{
|
|
347
|
-
name: '
|
|
427
|
+
name: 'ask',
|
|
428
|
+
type: 'i64',
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
name: 'priceType',
|
|
348
432
|
type: {
|
|
349
|
-
defined: '
|
|
433
|
+
defined: 'PriceType',
|
|
434
|
+
},
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
name: 'postOnly',
|
|
438
|
+
type: {
|
|
439
|
+
option: {
|
|
440
|
+
defined: 'PostOnlyParam',
|
|
441
|
+
},
|
|
350
442
|
},
|
|
351
443
|
},
|
|
352
444
|
],
|
|
@@ -419,5 +511,25 @@ export const IDL: JitProxy = {
|
|
|
419
511
|
name: 'OrderSizeBreached',
|
|
420
512
|
msg: 'OrderSizeBreached',
|
|
421
513
|
},
|
|
514
|
+
{
|
|
515
|
+
code: 6004,
|
|
516
|
+
name: 'NoBestBid',
|
|
517
|
+
msg: 'NoBestBid',
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
code: 6005,
|
|
521
|
+
name: 'NoBestAsk',
|
|
522
|
+
msg: 'NoBestAsk',
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
code: 6006,
|
|
526
|
+
name: 'NoArbOpportunity',
|
|
527
|
+
msg: 'NoArbOpportunity',
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
code: 6007,
|
|
531
|
+
name: 'UnprofitableArb',
|
|
532
|
+
msg: 'UnprofitableArb',
|
|
533
|
+
},
|
|
422
534
|
],
|
|
423
535
|
};
|