@drift-labs/sdk 0.1.27 → 0.1.28

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.
@@ -121,6 +121,8 @@ export declare class ClearingHouse {
121
121
  initializeUserOrdersThenPlaceOrder(orderParams: OrderParams, discountToken?: PublicKey, referrer?: PublicKey): Promise<TransactionSignature>;
122
122
  placeOrder(orderParams: OrderParams, discountToken?: PublicKey, referrer?: PublicKey): Promise<TransactionSignature>;
123
123
  getPlaceOrderIx(orderParams: OrderParams, discountToken?: PublicKey, referrer?: PublicKey): Promise<TransactionInstruction>;
124
+ expireOrders(userAccountPublicKey: PublicKey, userOrdersAccountPublicKey: PublicKey): Promise<TransactionSignature>;
125
+ getExpireOrdersIx(userAccountPublicKey: PublicKey, userOrdersAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
124
126
  cancelOrder(orderId: BN, oracle?: PublicKey): Promise<TransactionSignature>;
125
127
  getCancelOrderIx(orderId: BN, oracle?: PublicKey): Promise<TransactionInstruction>;
126
128
  cancelOrderByUserId(userOrderId: number, oracle?: PublicKey): Promise<TransactionSignature>;
@@ -538,6 +538,30 @@ class ClearingHouse {
538
538
  });
539
539
  });
540
540
  }
541
+ expireOrders(userAccountPublicKey, userOrdersAccountPublicKey) {
542
+ return __awaiter(this, void 0, void 0, function* () {
543
+ return yield this.txSender.send((0, utils_1.wrapInTx)(yield this.getExpireOrdersIx(userAccountPublicKey, userOrdersAccountPublicKey)), [], this.opts);
544
+ });
545
+ }
546
+ getExpireOrdersIx(userAccountPublicKey, userOrdersAccountPublicKey) {
547
+ return __awaiter(this, void 0, void 0, function* () {
548
+ const fillerPublicKey = yield this.getUserAccountPublicKey();
549
+ const userAccount = yield this.program.account.user.fetch(userAccountPublicKey);
550
+ const orderState = this.getOrderStateAccount();
551
+ return yield this.program.instruction.expireOrders({
552
+ accounts: {
553
+ state: yield this.getStatePublicKey(),
554
+ filler: fillerPublicKey,
555
+ user: userAccountPublicKey,
556
+ authority: this.wallet.publicKey,
557
+ userPositions: userAccount.positions,
558
+ userOrders: userOrdersAccountPublicKey,
559
+ orderState: yield this.getOrderStatePublicKey(),
560
+ orderHistory: orderState.orderHistory,
561
+ },
562
+ });
563
+ });
564
+ }
541
565
  cancelOrder(orderId, oracle) {
542
566
  return __awaiter(this, void 0, void 0, function* () {
543
567
  return yield this.txSender.send((0, utils_1.wrapInTx)(yield this.getCancelOrderIx(orderId, oracle)), [], this.opts);
@@ -156,7 +156,7 @@ exports.Markets = [
156
156
  oracleSource: __1.OracleSource.SWITCHBOARD,
157
157
  },
158
158
  {
159
- fullName: 'Ape',
159
+ fullName: 'ApeCoin',
160
160
  category: ['NFT'],
161
161
  symbol: 'APE-PERP',
162
162
  baseAssetSymbol: 'APE',
@@ -166,6 +166,17 @@ exports.Markets = [
166
166
  launchTs: 1648475932000,
167
167
  oracleSource: __1.OracleSource.SWITCHBOARD,
168
168
  },
169
+ {
170
+ fullName: 'DogeCoin',
171
+ category: ['Meme', 'NFT'],
172
+ symbol: 'DOGE-PERP',
173
+ baseAssetSymbol: 'DOGE',
174
+ marketIndex: new __1.BN(15),
175
+ devnetPublicKey: '4L6YhY8VvUgmqG5MvJkUJATtzB2rFqdrJwQCmFLv4Jzy',
176
+ mainnetPublicKey: 'FsSM3s38PX9K7Dn6eGzuE29S2Dsk1Sss1baytTQdCaQj',
177
+ launchTs: 1648607439000,
178
+ oracleSource: __1.OracleSource.PYTH,
179
+ },
169
180
  // {
170
181
  // symbol: 'mSOL-PERP',
171
182
  // baseAssetSymbol: 'mSOL',
@@ -677,6 +677,52 @@
677
677
  }
678
678
  ]
679
679
  },
680
+ {
681
+ "name": "expireOrders",
682
+ "accounts": [
683
+ {
684
+ "name": "state",
685
+ "isMut": false,
686
+ "isSigner": false
687
+ },
688
+ {
689
+ "name": "orderState",
690
+ "isMut": false,
691
+ "isSigner": false
692
+ },
693
+ {
694
+ "name": "authority",
695
+ "isMut": false,
696
+ "isSigner": true
697
+ },
698
+ {
699
+ "name": "filler",
700
+ "isMut": true,
701
+ "isSigner": false
702
+ },
703
+ {
704
+ "name": "user",
705
+ "isMut": true,
706
+ "isSigner": false
707
+ },
708
+ {
709
+ "name": "userPositions",
710
+ "isMut": true,
711
+ "isSigner": false
712
+ },
713
+ {
714
+ "name": "userOrders",
715
+ "isMut": true,
716
+ "isSigner": false
717
+ },
718
+ {
719
+ "name": "orderHistory",
720
+ "isMut": true,
721
+ "isSigner": false
722
+ }
723
+ ],
724
+ "args": []
725
+ },
680
726
  {
681
727
  "name": "fillOrder",
682
728
  "accounts": [
@@ -3800,6 +3846,9 @@
3800
3846
  },
3801
3847
  {
3802
3848
  "name": "Fill"
3849
+ },
3850
+ {
3851
+ "name": "Expire"
3803
3852
  }
3804
3853
  ]
3805
3854
  }
@@ -4190,6 +4239,11 @@
4190
4239
  "code": 6059,
4191
4240
  "name": "InvalidOracleOffset",
4192
4241
  "msg": "InvalidOracleOffset"
4242
+ },
4243
+ {
4244
+ "code": 6060,
4245
+ "name": "CantExpireOrders",
4246
+ "msg": "CantExpireOrders"
4193
4247
  }
4194
4248
  ]
4195
4249
  }
package/lib/types.d.ts CHANGED
@@ -71,6 +71,9 @@ export declare class OrderAction {
71
71
  static readonly CANCEL: {
72
72
  cancel: {};
73
73
  };
74
+ static readonly EXPIRE: {
75
+ expire: {};
76
+ };
74
77
  static readonly FILL: {
75
78
  fill: {};
76
79
  };
package/lib/types.js CHANGED
@@ -42,6 +42,7 @@ class OrderAction {
42
42
  exports.OrderAction = OrderAction;
43
43
  OrderAction.PLACE = { place: {} };
44
44
  OrderAction.CANCEL = { cancel: {} };
45
+ OrderAction.EXPIRE = { expire: {} };
45
46
  OrderAction.FILL = { fill: {} };
46
47
  class OrderTriggerCondition {
47
48
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "0.1.27",
3
+ "version": "0.1.28",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -788,6 +788,46 @@ export class ClearingHouse {
788
788
  });
789
789
  }
790
790
 
791
+ public async expireOrders(
792
+ userAccountPublicKey: PublicKey,
793
+ userOrdersAccountPublicKey: PublicKey
794
+ ): Promise<TransactionSignature> {
795
+ return await this.txSender.send(
796
+ wrapInTx(
797
+ await this.getExpireOrdersIx(
798
+ userAccountPublicKey,
799
+ userOrdersAccountPublicKey
800
+ )
801
+ ),
802
+ [],
803
+ this.opts
804
+ );
805
+ }
806
+
807
+ public async getExpireOrdersIx(
808
+ userAccountPublicKey: PublicKey,
809
+ userOrdersAccountPublicKey: PublicKey
810
+ ): Promise<TransactionInstruction> {
811
+ const fillerPublicKey = await this.getUserAccountPublicKey();
812
+ const userAccount: any = await this.program.account.user.fetch(
813
+ userAccountPublicKey
814
+ );
815
+
816
+ const orderState = this.getOrderStateAccount();
817
+ return await this.program.instruction.expireOrders({
818
+ accounts: {
819
+ state: await this.getStatePublicKey(),
820
+ filler: fillerPublicKey,
821
+ user: userAccountPublicKey,
822
+ authority: this.wallet.publicKey,
823
+ userPositions: userAccount.positions,
824
+ userOrders: userOrdersAccountPublicKey,
825
+ orderState: await this.getOrderStatePublicKey(),
826
+ orderHistory: orderState.orderHistory,
827
+ },
828
+ });
829
+ }
830
+
791
831
  public async cancelOrder(
792
832
  orderId: BN,
793
833
  oracle?: PublicKey
@@ -166,7 +166,7 @@ export const Markets: MarketConfig[] = [
166
166
  oracleSource: OracleSource.SWITCHBOARD,
167
167
  },
168
168
  {
169
- fullName: 'Ape',
169
+ fullName: 'ApeCoin',
170
170
  category: ['NFT'],
171
171
  symbol: 'APE-PERP',
172
172
  baseAssetSymbol: 'APE',
@@ -176,6 +176,17 @@ export const Markets: MarketConfig[] = [
176
176
  launchTs: 1648475932000,
177
177
  oracleSource: OracleSource.SWITCHBOARD,
178
178
  },
179
+ {
180
+ fullName: 'DogeCoin',
181
+ category: ['Meme', 'NFT'],
182
+ symbol: 'DOGE-PERP',
183
+ baseAssetSymbol: 'DOGE',
184
+ marketIndex: new BN(15),
185
+ devnetPublicKey: '4L6YhY8VvUgmqG5MvJkUJATtzB2rFqdrJwQCmFLv4Jzy',
186
+ mainnetPublicKey: 'FsSM3s38PX9K7Dn6eGzuE29S2Dsk1Sss1baytTQdCaQj',
187
+ launchTs: 1648607439000,
188
+ oracleSource: OracleSource.PYTH,
189
+ },
179
190
  // {
180
191
  // symbol: 'mSOL-PERP',
181
192
  // baseAssetSymbol: 'mSOL',
@@ -677,6 +677,52 @@
677
677
  }
678
678
  ]
679
679
  },
680
+ {
681
+ "name": "expireOrders",
682
+ "accounts": [
683
+ {
684
+ "name": "state",
685
+ "isMut": false,
686
+ "isSigner": false
687
+ },
688
+ {
689
+ "name": "orderState",
690
+ "isMut": false,
691
+ "isSigner": false
692
+ },
693
+ {
694
+ "name": "authority",
695
+ "isMut": false,
696
+ "isSigner": true
697
+ },
698
+ {
699
+ "name": "filler",
700
+ "isMut": true,
701
+ "isSigner": false
702
+ },
703
+ {
704
+ "name": "user",
705
+ "isMut": true,
706
+ "isSigner": false
707
+ },
708
+ {
709
+ "name": "userPositions",
710
+ "isMut": true,
711
+ "isSigner": false
712
+ },
713
+ {
714
+ "name": "userOrders",
715
+ "isMut": true,
716
+ "isSigner": false
717
+ },
718
+ {
719
+ "name": "orderHistory",
720
+ "isMut": true,
721
+ "isSigner": false
722
+ }
723
+ ],
724
+ "args": []
725
+ },
680
726
  {
681
727
  "name": "fillOrder",
682
728
  "accounts": [
@@ -3800,6 +3846,9 @@
3800
3846
  },
3801
3847
  {
3802
3848
  "name": "Fill"
3849
+ },
3850
+ {
3851
+ "name": "Expire"
3803
3852
  }
3804
3853
  ]
3805
3854
  }
@@ -4190,6 +4239,11 @@
4190
4239
  "code": 6059,
4191
4240
  "name": "InvalidOracleOffset",
4192
4241
  "msg": "InvalidOracleOffset"
4242
+ },
4243
+ {
4244
+ "code": 6060,
4245
+ "name": "CantExpireOrders",
4246
+ "msg": "CantExpireOrders"
4193
4247
  }
4194
4248
  ]
4195
4249
  }
package/src/types.ts CHANGED
@@ -40,6 +40,7 @@ export class OrderDiscountTier {
40
40
  export class OrderAction {
41
41
  static readonly PLACE = { place: {} };
42
42
  static readonly CANCEL = { cancel: {} };
43
+ static readonly EXPIRE = { expire: {} };
43
44
  static readonly FILL = { fill: {} };
44
45
  }
45
46
 
@@ -1,769 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- var __importDefault = (this && this.__importDefault) || function (mod) {
22
- return (mod && mod.__esModule) ? mod : { "default": mod };
23
- };
24
- Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.ClearingHouse = void 0;
26
- const anchor_1 = require("@project-serum/anchor");
27
- const spl_token_1 = require("@solana/spl-token");
28
- const anchor = __importStar(require("@project-serum/anchor"));
29
- const clearing_house_json_1 = __importDefault(require("./idl/clearing_house.json"));
30
- const web3_js_1 = require("@solana/web3.js");
31
- const addresses_1 = require("./addresses");
32
- const utils_1 = require("./tx/utils");
33
- const clearingHouse_1 = require("./factory/clearingHouse");
34
- const numericConstants_1 = require("./constants/numericConstants");
35
- /**
36
- * # ClearingHouse
37
- * This class is the main way to interact with Drift Protocol. It allows you to subscribe to the various accounts where the Market's state is stored, as well as: opening positions, liquidating, settling funding, depositing & withdrawing, and more.
38
- *
39
- * The default way to construct a ClearingHouse instance is using the {@link from} method. This will create an instance using the static {@link WebSocketClearingHouseAccountSubscriber}, which will use a websocket for each state account subscription.
40
- * Alternatively, if you want to implement your own method of subscribing to the state accounts on the blockchain, you can implement a {@link ClearingHouseAccountSubscriber} and use it in the {@link ClearingHouse.constructor}
41
- */
42
- class ClearingHouse {
43
- constructor(connection, wallet, program, accountSubscriber, txSender, opts) {
44
- this._isSubscribed = false;
45
- this.connection = connection;
46
- this.wallet = wallet;
47
- this.opts = opts;
48
- this.program = program;
49
- this.accountSubscriber = accountSubscriber;
50
- this.eventEmitter = this.accountSubscriber.eventEmitter;
51
- this.txSender = txSender;
52
- }
53
- get isSubscribed() {
54
- return this._isSubscribed && this.accountSubscriber.isSubscribed;
55
- }
56
- set isSubscribed(val) {
57
- this._isSubscribed = val;
58
- }
59
- /**
60
- * @deprecated You should use the getClearingHouse factory method instead
61
- * @param connection
62
- * @param wallet
63
- * @param clearingHouseProgramId
64
- * @param opts
65
- * @returns
66
- */
67
- static from(connection, wallet, clearingHouseProgramId, opts = anchor_1.Provider.defaultOptions()) {
68
- const config = (0, clearingHouse_1.getWebSocketClearingHouseConfig)(connection, wallet, clearingHouseProgramId, opts);
69
- return (0, clearingHouse_1.getClearingHouse)(config);
70
- }
71
- /**
72
- *
73
- * @param optionalSubscriptions - Optional extra accounts to subcribe to. Always subscribes to base clearing house state and market account state by default. You should only subscribe to optional extra accounts if required, to avoid overloading your RPC.
74
- * @returns Promise<boolean> : SubscriptionSuccess
75
- */
76
- async subscribe(optionalSubscriptions) {
77
- this.isSubscribed = await this.accountSubscriber.subscribe(optionalSubscriptions);
78
- return this.isSubscribed;
79
- }
80
- /**
81
- * Shorthand function to subscribe to all available Clearing House State Accounts
82
- * @returns Promise<boolean> : SubscriptionSuccess
83
- */
84
- async subscribeToAll() {
85
- return this.subscribe([
86
- 'curveHistoryAccount',
87
- 'depositHistoryAccount',
88
- 'fundingPaymentHistoryAccount',
89
- 'fundingRateHistoryAccount',
90
- 'liquidationHistoryAccount',
91
- 'tradeHistoryAccount',
92
- 'orderHistoryAccount',
93
- ]);
94
- }
95
- /**
96
- * Forces the accountSubscriber to fetch account updates from rpc
97
- */
98
- async fetchAccounts() {
99
- await this.accountSubscriber.fetch();
100
- }
101
- /**
102
- * Unsubscribe from all currently subscribed state accounts
103
- */
104
- async unsubscribe() {
105
- await this.accountSubscriber.unsubscribe();
106
- this.isSubscribed = false;
107
- }
108
- async getStatePublicKey() {
109
- if (this.statePublicKey) {
110
- return this.statePublicKey;
111
- }
112
- this.statePublicKey = await (0, addresses_1.getClearingHouseStateAccountPublicKey)(this.program.programId);
113
- return this.statePublicKey;
114
- }
115
- getStateAccount() {
116
- return this.accountSubscriber.getStateAccount();
117
- }
118
- getMarketsAccount() {
119
- return this.accountSubscriber.getMarketsAccount();
120
- }
121
- getMarket(marketIndex) {
122
- if (marketIndex instanceof anchor_1.BN) {
123
- marketIndex = marketIndex.toNumber();
124
- }
125
- return this.getMarketsAccount().markets[marketIndex];
126
- }
127
- getFundingPaymentHistoryAccount() {
128
- return this.accountSubscriber.getFundingPaymentHistoryAccount();
129
- }
130
- getFundingRateHistoryAccount() {
131
- return this.accountSubscriber.getFundingRateHistoryAccount();
132
- }
133
- getTradeHistoryAccount() {
134
- return this.accountSubscriber.getTradeHistoryAccount();
135
- }
136
- getLiquidationHistoryAccount() {
137
- return this.accountSubscriber.getLiquidationHistoryAccount();
138
- }
139
- getDepositHistoryAccount() {
140
- return this.accountSubscriber.getDepositHistoryAccount();
141
- }
142
- getCurveHistoryAccount() {
143
- return this.accountSubscriber.getCurveHistoryAccount();
144
- }
145
- getOrderHistoryAccount() {
146
- return this.accountSubscriber.getOrderHistoryAccount();
147
- }
148
- async getOrderStatePublicKey() {
149
- if (this.orderStatePublicKey) {
150
- return this.orderStatePublicKey;
151
- }
152
- this.orderStatePublicKey = await (0, addresses_1.getOrderStateAccountPublicKey)(this.program.programId);
153
- return this.orderStatePublicKey;
154
- }
155
- getOrderStateAccount() {
156
- return this.accountSubscriber.getOrderStateAccount();
157
- }
158
- /**
159
- * Update the wallet to use for clearing house transactions and linked user account
160
- * @param newWallet
161
- */
162
- updateWallet(newWallet) {
163
- const newProvider = new anchor_1.Provider(this.connection, newWallet, this.opts);
164
- const newProgram = new anchor_1.Program(clearing_house_json_1.default, this.program.programId, newProvider);
165
- // Update provider for txSender with new wallet details
166
- this.txSender.provider = newProvider;
167
- this.wallet = newWallet;
168
- this.provider = newProvider;
169
- this.program = newProgram;
170
- this.userAccountPublicKey = undefined;
171
- this.userAccount = undefined;
172
- this.userOrdersAccountPublicKey = undefined;
173
- this.userOrdersExist = undefined;
174
- }
175
- async initializeUserAccount() {
176
- const [userPositionsAccount, userAccountPublicKey, initializeUserAccountIx, initializeUserOrdersAccountIx,] = await this.getInitializeUserInstructions();
177
- const tx = new web3_js_1.Transaction()
178
- .add(initializeUserAccountIx)
179
- .add(initializeUserOrdersAccountIx);
180
- const txSig = await this.txSender.send(tx, [userPositionsAccount], this.opts);
181
- return [txSig, userAccountPublicKey];
182
- }
183
- async getInitializeUserInstructions() {
184
- const [userAccountPublicKey, userAccountNonce] = await (0, addresses_1.getUserAccountPublicKeyAndNonce)(this.program.programId, this.wallet.publicKey);
185
- const remainingAccounts = [];
186
- const optionalAccounts = {
187
- whitelistToken: false,
188
- };
189
- const state = this.getStateAccount();
190
- if (state.whitelistMint) {
191
- optionalAccounts.whitelistToken = true;
192
- const associatedTokenPublicKey = await spl_token_1.Token.getAssociatedTokenAddress(spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, spl_token_1.TOKEN_PROGRAM_ID, state.whitelistMint, this.wallet.publicKey);
193
- remainingAccounts.push({
194
- pubkey: associatedTokenPublicKey,
195
- isWritable: false,
196
- isSigner: false,
197
- });
198
- }
199
- const userPositions = new web3_js_1.Keypair();
200
- const initializeUserAccountIx = await this.program.instruction.initializeUser(userAccountNonce, optionalAccounts, {
201
- accounts: {
202
- user: userAccountPublicKey,
203
- authority: this.wallet.publicKey,
204
- rent: anchor.web3.SYSVAR_RENT_PUBKEY,
205
- systemProgram: anchor.web3.SystemProgram.programId,
206
- userPositions: userPositions.publicKey,
207
- state: await this.getStatePublicKey(),
208
- },
209
- remainingAccounts: remainingAccounts,
210
- });
211
- const initializeUserOrdersAccountIx = await this.getInitializeUserOrdersInstruction(userAccountPublicKey);
212
- return [
213
- userPositions,
214
- userAccountPublicKey,
215
- initializeUserAccountIx,
216
- initializeUserOrdersAccountIx,
217
- ];
218
- }
219
- async getInitializeUserOrdersInstruction(userAccountPublicKey) {
220
- if (!userAccountPublicKey) {
221
- userAccountPublicKey = await this.getUserAccountPublicKey();
222
- }
223
- const [userOrdersAccountPublicKey, userOrdersAccountNonce] = await (0, addresses_1.getUserOrdersAccountPublicKeyAndNonce)(this.program.programId, userAccountPublicKey);
224
- return await this.program.instruction.initializeUserOrders(userOrdersAccountNonce, {
225
- accounts: {
226
- user: userAccountPublicKey,
227
- authority: this.wallet.publicKey,
228
- rent: anchor.web3.SYSVAR_RENT_PUBKEY,
229
- systemProgram: anchor.web3.SystemProgram.programId,
230
- userOrders: userOrdersAccountPublicKey,
231
- state: await this.getStatePublicKey(),
232
- },
233
- });
234
- }
235
- /**
236
- * Get the address for the Clearing House User's account. NOT the user's wallet address.
237
- * @returns
238
- */
239
- async getUserAccountPublicKey() {
240
- if (this.userAccountPublicKey) {
241
- return this.userAccountPublicKey;
242
- }
243
- this.userAccountPublicKey = await (0, addresses_1.getUserAccountPublicKey)(this.program.programId, this.wallet.publicKey);
244
- return this.userAccountPublicKey;
245
- }
246
- async getUserAccount() {
247
- if (this.userAccount) {
248
- return this.userAccount;
249
- }
250
- this.userAccount = (await this.program.account.user.fetch(await this.getUserAccountPublicKey()));
251
- return this.userAccount;
252
- }
253
- /**
254
- * Get the address for the Clearing House User Order's account. NOT the user's wallet address.
255
- * @returns
256
- */
257
- async getUserOrdersAccountPublicKey() {
258
- if (this.userOrdersAccountPublicKey) {
259
- return this.userOrdersAccountPublicKey;
260
- }
261
- this.userOrdersAccountPublicKey = await (0, addresses_1.getUserOrdersAccountPublicKey)(this.program.programId, await this.getUserAccountPublicKey());
262
- return this.userOrdersAccountPublicKey;
263
- }
264
- async userOrdersAccountExists() {
265
- if (this.userOrdersExist) {
266
- return this.userOrdersExist;
267
- }
268
- const userOrdersAccountRPCResponse = await this.connection.getParsedAccountInfo(await this.getUserOrdersAccountPublicKey());
269
- this.userOrdersExist = userOrdersAccountRPCResponse.value !== null;
270
- return this.userOrdersExist;
271
- }
272
- async depositCollateral(amount, collateralAccountPublicKey, userPositionsAccountPublicKey) {
273
- const depositCollateralIx = await this.getDepositCollateralInstruction(amount, collateralAccountPublicKey, userPositionsAccountPublicKey);
274
- const tx = new web3_js_1.Transaction().add(depositCollateralIx);
275
- return await this.txSender.send(tx);
276
- }
277
- async getDepositCollateralInstruction(amount, collateralAccountPublicKey, userPositionsAccountPublicKey) {
278
- const userAccountPublicKey = await this.getUserAccountPublicKey();
279
- if (!userPositionsAccountPublicKey) {
280
- userPositionsAccountPublicKey = (await this.getUserAccount()).positions;
281
- }
282
- const state = this.getStateAccount();
283
- return await this.program.instruction.depositCollateral(amount, {
284
- accounts: {
285
- state: await this.getStatePublicKey(),
286
- user: userAccountPublicKey,
287
- collateralVault: state.collateralVault,
288
- userCollateralAccount: collateralAccountPublicKey,
289
- authority: this.wallet.publicKey,
290
- tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
291
- markets: state.markets,
292
- fundingPaymentHistory: state.fundingPaymentHistory,
293
- depositHistory: state.depositHistory,
294
- userPositions: userPositionsAccountPublicKey,
295
- },
296
- });
297
- }
298
- /**
299
- * Creates the Clearing House User account for a user, and deposits some initial collateral
300
- * @param amount
301
- * @param collateralAccountPublicKey
302
- * @returns
303
- */
304
- async initializeUserAccountAndDepositCollateral(amount, collateralAccountPublicKey) {
305
- const [userPositionsAccount, userAccountPublicKey, initializeUserAccountIx, initializeUserOrdersAccountIx,] = await this.getInitializeUserInstructions();
306
- const depositCollateralIx = await this.getDepositCollateralInstruction(amount, collateralAccountPublicKey, userPositionsAccount.publicKey);
307
- const tx = new web3_js_1.Transaction()
308
- .add(initializeUserAccountIx)
309
- .add(initializeUserOrdersAccountIx)
310
- .add(depositCollateralIx);
311
- const txSig = await this.program.provider.send(tx, [userPositionsAccount]);
312
- return [txSig, userAccountPublicKey];
313
- }
314
- async initializeUserAccountForDevnet(mockUSDCFaucet, amount) {
315
- const [associateTokenPublicKey, createAssociatedAccountIx, mintToIx] = await mockUSDCFaucet.createAssociatedTokenAccountAndMintToInstructions(this.wallet.publicKey, amount);
316
- const [userPositionsAccount, userAccountPublicKey, initializeUserAccountIx, initializeUserOrdersAccountIx,] = await this.getInitializeUserInstructions();
317
- const depositCollateralIx = await this.getDepositCollateralInstruction(amount, associateTokenPublicKey, userPositionsAccount.publicKey);
318
- const tx = new web3_js_1.Transaction()
319
- .add(createAssociatedAccountIx)
320
- .add(mintToIx)
321
- .add(initializeUserAccountIx)
322
- .add(initializeUserOrdersAccountIx)
323
- .add(depositCollateralIx);
324
- const txSig = await this.program.provider.send(tx, [userPositionsAccount]);
325
- return [txSig, userAccountPublicKey];
326
- }
327
- async deleteUser() {
328
- const userAccountPublicKey = await this.getUserAccountPublicKey();
329
- const user = await this.program.account.user.fetch(userAccountPublicKey);
330
- const deleteUserTx = await this.program.transaction.deleteUser({
331
- accounts: {
332
- user: userAccountPublicKey,
333
- userPositions: user.positions,
334
- authority: this.wallet.publicKey,
335
- },
336
- });
337
- return this.txSender.send(deleteUserTx, [], this.opts);
338
- }
339
- async withdrawCollateral(amount, collateralAccountPublicKey) {
340
- return this.txSender.send((0, utils_1.wrapInTx)(await this.getWithdrawCollateralIx(amount, collateralAccountPublicKey)), [], this.opts);
341
- }
342
- async getWithdrawCollateralIx(amount, collateralAccountPublicKey) {
343
- const userAccountPublicKey = await this.getUserAccountPublicKey();
344
- const user = await this.program.account.user.fetch(userAccountPublicKey);
345
- const state = this.getStateAccount();
346
- return await this.program.instruction.withdrawCollateral(amount, {
347
- accounts: {
348
- state: await this.getStatePublicKey(),
349
- user: userAccountPublicKey,
350
- collateralVault: state.collateralVault,
351
- collateralVaultAuthority: state.collateralVaultAuthority,
352
- insuranceVault: state.insuranceVault,
353
- insuranceVaultAuthority: state.insuranceVaultAuthority,
354
- userCollateralAccount: collateralAccountPublicKey,
355
- authority: this.wallet.publicKey,
356
- tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
357
- markets: state.markets,
358
- userPositions: user.positions,
359
- fundingPaymentHistory: state.fundingPaymentHistory,
360
- depositHistory: state.depositHistory,
361
- },
362
- });
363
- }
364
- async openPosition(direction, amount, marketIndex, limitPrice, discountToken, referrer) {
365
- return await this.txSender.send((0, utils_1.wrapInTx)(await this.getOpenPositionIx(direction, amount, marketIndex, limitPrice, discountToken, referrer)), [], this.opts);
366
- }
367
- async getOpenPositionIx(direction, amount, marketIndex, limitPrice, discountToken, referrer) {
368
- const userAccountPublicKey = await this.getUserAccountPublicKey();
369
- const userAccount = await this.getUserAccount();
370
- if (limitPrice == undefined) {
371
- limitPrice = new anchor_1.BN(0); // no limit
372
- }
373
- const optionalAccounts = {
374
- discountToken: false,
375
- referrer: false,
376
- };
377
- const remainingAccounts = [];
378
- if (discountToken) {
379
- optionalAccounts.discountToken = true;
380
- remainingAccounts.push({
381
- pubkey: discountToken,
382
- isWritable: false,
383
- isSigner: false,
384
- });
385
- }
386
- if (referrer) {
387
- optionalAccounts.referrer = true;
388
- remainingAccounts.push({
389
- pubkey: referrer,
390
- isWritable: true,
391
- isSigner: false,
392
- });
393
- }
394
- const priceOracle = this.getMarketsAccount().markets[marketIndex.toNumber()].amm.oracle;
395
- const state = this.getStateAccount();
396
- return await this.program.instruction.openPosition(direction, amount, marketIndex, limitPrice, optionalAccounts, {
397
- accounts: {
398
- state: await this.getStatePublicKey(),
399
- user: userAccountPublicKey,
400
- authority: this.wallet.publicKey,
401
- markets: state.markets,
402
- userPositions: userAccount.positions,
403
- tradeHistory: state.tradeHistory,
404
- fundingPaymentHistory: state.fundingPaymentHistory,
405
- fundingRateHistory: state.fundingRateHistory,
406
- oracle: priceOracle,
407
- },
408
- remainingAccounts: remainingAccounts,
409
- });
410
- }
411
- async initializeUserOrdersThenPlaceOrder(orderParams, discountToken, referrer) {
412
- const instructions = [];
413
- const userOrdersAccountExists = await this.userOrdersAccountExists();
414
- if (!userOrdersAccountExists) {
415
- instructions.push(await this.getInitializeUserOrdersInstruction());
416
- }
417
- instructions.push(await this.getPlaceOrderIx(orderParams, discountToken, referrer));
418
- const tx = new web3_js_1.Transaction();
419
- for (const instruction of instructions) {
420
- tx.add(instruction);
421
- }
422
- return await this.txSender.send(tx, [], this.opts);
423
- }
424
- async placeOrder(orderParams, discountToken, referrer) {
425
- return await this.txSender.send((0, utils_1.wrapInTx)(await this.getPlaceOrderIx(orderParams, discountToken, referrer)), [], this.opts);
426
- }
427
- async getPlaceOrderIx(orderParams, discountToken, referrer) {
428
- const userAccountPublicKey = await this.getUserAccountPublicKey();
429
- const userAccount = await this.getUserAccount();
430
- const priceOracle = this.getMarketsAccount().markets[orderParams.marketIndex.toNumber()].amm
431
- .oracle;
432
- const remainingAccounts = [];
433
- if (orderParams.optionalAccounts.discountToken) {
434
- if (!discountToken) {
435
- throw Error('Optional accounts specified discount token but no discount token present');
436
- }
437
- remainingAccounts.push({
438
- pubkey: discountToken,
439
- isWritable: false,
440
- isSigner: false,
441
- });
442
- }
443
- if (orderParams.optionalAccounts.referrer) {
444
- if (!referrer) {
445
- throw Error('Optional accounts specified referrer but no referrer present');
446
- }
447
- remainingAccounts.push({
448
- pubkey: referrer,
449
- isWritable: false,
450
- isSigner: false,
451
- });
452
- }
453
- if (!orderParams.oraclePriceOffset.eq(numericConstants_1.ZERO)) {
454
- remainingAccounts.push({
455
- pubkey: priceOracle,
456
- isWritable: false,
457
- isSigner: false,
458
- });
459
- }
460
- const state = this.getStateAccount();
461
- const orderState = this.getOrderStateAccount();
462
- return await this.program.instruction.placeOrder(orderParams, {
463
- accounts: {
464
- state: await this.getStatePublicKey(),
465
- user: userAccountPublicKey,
466
- authority: this.wallet.publicKey,
467
- markets: state.markets,
468
- userOrders: await this.getUserOrdersAccountPublicKey(),
469
- userPositions: userAccount.positions,
470
- fundingPaymentHistory: state.fundingPaymentHistory,
471
- fundingRateHistory: state.fundingRateHistory,
472
- orderState: await this.getOrderStatePublicKey(),
473
- orderHistory: orderState.orderHistory,
474
- },
475
- remainingAccounts,
476
- });
477
- }
478
- async cancelOrder(orderId, oracle) {
479
- return await this.txSender.send((0, utils_1.wrapInTx)(await this.getCancelOrderIx(orderId, oracle)), [], this.opts);
480
- }
481
- async getCancelOrderIx(orderId, oracle) {
482
- const userAccountPublicKey = await this.getUserAccountPublicKey();
483
- const userAccount = await this.getUserAccount();
484
- const state = this.getStateAccount();
485
- const orderState = this.getOrderStateAccount();
486
- const remainingAccounts = [];
487
- if (oracle) {
488
- remainingAccounts.push({
489
- pubkey: oracle,
490
- isWritable: false,
491
- isSigner: false,
492
- });
493
- }
494
- return await this.program.instruction.cancelOrder(orderId, {
495
- accounts: {
496
- state: await this.getStatePublicKey(),
497
- user: userAccountPublicKey,
498
- authority: this.wallet.publicKey,
499
- markets: state.markets,
500
- userOrders: await this.getUserOrdersAccountPublicKey(),
501
- userPositions: userAccount.positions,
502
- fundingPaymentHistory: state.fundingPaymentHistory,
503
- fundingRateHistory: state.fundingRateHistory,
504
- orderState: await this.getOrderStatePublicKey(),
505
- orderHistory: orderState.orderHistory,
506
- },
507
- remainingAccounts,
508
- });
509
- }
510
- async cancelOrderByUserId(userOrderId, oracle) {
511
- return await this.txSender.send((0, utils_1.wrapInTx)(await this.getCancelOrderByUserIdIx(userOrderId, oracle)), [], this.opts);
512
- }
513
- async getCancelOrderByUserIdIx(userOrderId, oracle) {
514
- const userAccountPublicKey = await this.getUserAccountPublicKey();
515
- const userAccount = await this.getUserAccount();
516
- const state = this.getStateAccount();
517
- const orderState = this.getOrderStateAccount();
518
- const remainingAccounts = [];
519
- if (oracle) {
520
- remainingAccounts.push({
521
- pubkey: oracle,
522
- isWritable: false,
523
- isSigner: false,
524
- });
525
- }
526
- return await this.program.instruction.cancelOrderByUserId(userOrderId, {
527
- accounts: {
528
- state: await this.getStatePublicKey(),
529
- user: userAccountPublicKey,
530
- authority: this.wallet.publicKey,
531
- markets: state.markets,
532
- userOrders: await this.getUserOrdersAccountPublicKey(),
533
- userPositions: userAccount.positions,
534
- fundingPaymentHistory: state.fundingPaymentHistory,
535
- fundingRateHistory: state.fundingRateHistory,
536
- orderState: await this.getOrderStatePublicKey(),
537
- orderHistory: orderState.orderHistory,
538
- },
539
- remainingAccounts,
540
- });
541
- }
542
- async fillOrder(userAccountPublicKey, userOrdersAccountPublicKey, order) {
543
- return await this.txSender.send((0, utils_1.wrapInTx)(await this.getFillOrderIx(userAccountPublicKey, userOrdersAccountPublicKey, order)), [], this.opts);
544
- }
545
- async getFillOrderIx(userAccountPublicKey, userOrdersAccountPublicKey, order) {
546
- const fillerPublicKey = await this.getUserAccountPublicKey();
547
- const userAccount = await this.program.account.user.fetch(userAccountPublicKey);
548
- const marketIndex = order.marketIndex;
549
- const oracle = this.getMarket(marketIndex).amm.oracle;
550
- const state = this.getStateAccount();
551
- const orderState = this.getOrderStateAccount();
552
- const remainingAccounts = [];
553
- if (!order.referrer.equals(web3_js_1.PublicKey.default)) {
554
- remainingAccounts.push({
555
- pubkey: order.referrer,
556
- isWritable: true,
557
- isSigner: false,
558
- });
559
- }
560
- const orderId = order.orderId;
561
- return await this.program.instruction.fillOrder(orderId, {
562
- accounts: {
563
- state: await this.getStatePublicKey(),
564
- filler: fillerPublicKey,
565
- user: userAccountPublicKey,
566
- authority: this.wallet.publicKey,
567
- markets: state.markets,
568
- userPositions: userAccount.positions,
569
- userOrders: userOrdersAccountPublicKey,
570
- tradeHistory: state.tradeHistory,
571
- fundingPaymentHistory: state.fundingPaymentHistory,
572
- fundingRateHistory: state.fundingRateHistory,
573
- orderState: await this.getOrderStatePublicKey(),
574
- orderHistory: orderState.orderHistory,
575
- extendedCurveHistory: state.extendedCurveHistory,
576
- oracle: oracle,
577
- },
578
- remainingAccounts,
579
- });
580
- }
581
- async initializeUserOrdersThenPlaceAndFillOrder(orderParams, discountToken, referrer) {
582
- const instructions = [];
583
- const userOrdersAccountExists = await this.userOrdersAccountExists();
584
- if (!userOrdersAccountExists) {
585
- instructions.push(await this.getInitializeUserOrdersInstruction());
586
- }
587
- instructions.push(await this.getPlaceAndFillOrderIx(orderParams, discountToken, referrer));
588
- const tx = new web3_js_1.Transaction();
589
- for (const instruction of instructions) {
590
- tx.add(instruction);
591
- }
592
- return await this.txSender.send(tx, [], this.opts);
593
- }
594
- async placeAndFillOrder(orderParams, discountToken, referrer) {
595
- return await this.txSender.send((0, utils_1.wrapInTx)(await this.getPlaceAndFillOrderIx(orderParams, discountToken, referrer)), [], this.opts);
596
- }
597
- async getPlaceAndFillOrderIx(orderParams, discountToken, referrer) {
598
- const userAccountPublicKey = await this.getUserAccountPublicKey();
599
- const userAccount = await this.getUserAccount();
600
- const priceOracle = this.getMarketsAccount().markets[orderParams.marketIndex.toNumber()].amm
601
- .oracle;
602
- const remainingAccounts = [];
603
- if (orderParams.optionalAccounts.discountToken) {
604
- if (!discountToken) {
605
- throw Error('Optional accounts specified discount token but no discount token present');
606
- }
607
- remainingAccounts.push({
608
- pubkey: discountToken,
609
- isWritable: false,
610
- isSigner: false,
611
- });
612
- }
613
- if (orderParams.optionalAccounts.referrer) {
614
- if (!referrer) {
615
- throw Error('Optional accounts specified referrer but no referrer present');
616
- }
617
- remainingAccounts.push({
618
- pubkey: referrer,
619
- isWritable: true,
620
- isSigner: false,
621
- });
622
- }
623
- const state = this.getStateAccount();
624
- const orderState = this.getOrderStateAccount();
625
- return await this.program.instruction.placeAndFillOrder(orderParams, {
626
- accounts: {
627
- state: await this.getStatePublicKey(),
628
- user: userAccountPublicKey,
629
- authority: this.wallet.publicKey,
630
- markets: state.markets,
631
- userOrders: await this.getUserOrdersAccountPublicKey(),
632
- userPositions: userAccount.positions,
633
- tradeHistory: state.tradeHistory,
634
- fundingPaymentHistory: state.fundingPaymentHistory,
635
- fundingRateHistory: state.fundingRateHistory,
636
- orderState: await this.getOrderStatePublicKey(),
637
- orderHistory: orderState.orderHistory,
638
- extendedCurveHistory: state.extendedCurveHistory,
639
- oracle: priceOracle,
640
- },
641
- remainingAccounts,
642
- });
643
- }
644
- /**
645
- * Close an entire position. If you want to reduce a position, use the {@link openPosition} method in the opposite direction of the current position.
646
- * @param marketIndex
647
- * @param discountToken
648
- * @param referrer
649
- * @returns
650
- */
651
- async closePosition(marketIndex, discountToken, referrer) {
652
- return await this.txSender.send((0, utils_1.wrapInTx)(await this.getClosePositionIx(marketIndex, discountToken, referrer)), [], this.opts);
653
- }
654
- async getClosePositionIx(marketIndex, discountToken, referrer) {
655
- const userAccountPublicKey = await this.getUserAccountPublicKey();
656
- const userAccount = await this.getUserAccount();
657
- const priceOracle = this.getMarketsAccount().markets[marketIndex.toNumber()].amm.oracle;
658
- const optionalAccounts = {
659
- discountToken: false,
660
- referrer: false,
661
- };
662
- const remainingAccounts = [];
663
- if (discountToken) {
664
- optionalAccounts.discountToken = true;
665
- remainingAccounts.push({
666
- pubkey: discountToken,
667
- isWritable: false,
668
- isSigner: false,
669
- });
670
- }
671
- if (referrer) {
672
- optionalAccounts.referrer = true;
673
- remainingAccounts.push({
674
- pubkey: referrer,
675
- isWritable: true,
676
- isSigner: false,
677
- });
678
- }
679
- const state = this.getStateAccount();
680
- return await this.program.instruction.closePosition(marketIndex, optionalAccounts, {
681
- accounts: {
682
- state: await this.getStatePublicKey(),
683
- user: userAccountPublicKey,
684
- authority: this.wallet.publicKey,
685
- markets: state.markets,
686
- userPositions: userAccount.positions,
687
- tradeHistory: state.tradeHistory,
688
- fundingPaymentHistory: state.fundingPaymentHistory,
689
- fundingRateHistory: state.fundingRateHistory,
690
- oracle: priceOracle,
691
- },
692
- remainingAccounts: remainingAccounts,
693
- });
694
- }
695
- async liquidate(liquidateeUserAccountPublicKey) {
696
- return this.txSender.send((0, utils_1.wrapInTx)(await this.getLiquidateIx(liquidateeUserAccountPublicKey)), [], this.opts);
697
- }
698
- async getLiquidateIx(liquidateeUserAccountPublicKey) {
699
- const userAccountPublicKey = await this.getUserAccountPublicKey();
700
- const liquidateeUserAccount = await this.program.account.user.fetch(liquidateeUserAccountPublicKey);
701
- const liquidateePositions = await this.program.account.userPositions.fetch(liquidateeUserAccount.positions);
702
- const markets = this.getMarketsAccount();
703
- const remainingAccounts = [];
704
- for (const position of liquidateePositions.positions) {
705
- if (!position.baseAssetAmount.eq(new anchor_1.BN(0))) {
706
- const market = markets.markets[position.marketIndex.toNumber()];
707
- remainingAccounts.push({
708
- pubkey: market.amm.oracle,
709
- isWritable: false,
710
- isSigner: false,
711
- });
712
- }
713
- }
714
- const state = this.getStateAccount();
715
- return await this.program.instruction.liquidate({
716
- accounts: {
717
- state: await this.getStatePublicKey(),
718
- authority: this.wallet.publicKey,
719
- user: liquidateeUserAccountPublicKey,
720
- liquidator: userAccountPublicKey,
721
- collateralVault: state.collateralVault,
722
- collateralVaultAuthority: state.collateralVaultAuthority,
723
- insuranceVault: state.insuranceVault,
724
- insuranceVaultAuthority: state.insuranceVaultAuthority,
725
- tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
726
- markets: state.markets,
727
- userPositions: liquidateeUserAccount.positions,
728
- tradeHistory: state.tradeHistory,
729
- liquidationHistory: state.liquidationHistory,
730
- fundingPaymentHistory: state.fundingPaymentHistory,
731
- },
732
- remainingAccounts: remainingAccounts,
733
- });
734
- }
735
- async updateFundingRate(oracle, marketIndex) {
736
- return this.txSender.send((0, utils_1.wrapInTx)(await this.getUpdateFundingRateIx(oracle, marketIndex)), [], this.opts);
737
- }
738
- async getUpdateFundingRateIx(oracle, marketIndex) {
739
- const state = this.getStateAccount();
740
- return await this.program.instruction.updateFundingRate(marketIndex, {
741
- accounts: {
742
- state: await this.getStatePublicKey(),
743
- markets: state.markets,
744
- oracle: oracle,
745
- fundingRateHistory: state.fundingRateHistory,
746
- },
747
- });
748
- }
749
- async settleFundingPayment(userAccount, userPositionsAccount) {
750
- return this.txSender.send((0, utils_1.wrapInTx)(await this.getSettleFundingPaymentIx(userAccount, userPositionsAccount)), [], this.opts);
751
- }
752
- async getSettleFundingPaymentIx(userAccount, userPositionsAccount) {
753
- const state = this.getStateAccount();
754
- return await this.program.instruction.settleFundingPayment({
755
- accounts: {
756
- state: await this.getStatePublicKey(),
757
- markets: state.markets,
758
- user: userAccount,
759
- userPositions: userPositionsAccount,
760
- fundingPaymentHistory: state.fundingPaymentHistory,
761
- },
762
- });
763
- }
764
- triggerEvent(eventName, data) {
765
- this.eventEmitter.emit(eventName, data);
766
- }
767
- }
768
- exports.ClearingHouse = ClearingHouse;
769
- //# sourceMappingURL=clearingHouse.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clearingHouse.js","sourceRoot":"","sources":["clearingHouse.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAmE;AACnE,iDAI2B;AAmB3B,8DAAgD;AAChD,oFAAyD;AAEzD,6CAQyB;AAKzB,2CAOqB;AAOrB,sCAAsC;AACtC,2DAGiC;AACjC,mEAAoD;AAEpD;;;;;;GAMG;AACH,MAAa,aAAa;IA0CzB,YACC,UAAsB,EACtB,MAAe,EACf,OAAgB,EAChB,iBAAiD,EACjD,QAAkB,EAClB,IAAoB;QAxCrB,kBAAa,GAAG,KAAK,CAAC;QA0CrB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC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