@triadxyz/triad-protocol 1.5.5-beta → 1.5.6-beta

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/dist/index.js CHANGED
@@ -126,9 +126,10 @@ class TriadProtocolClient {
126
126
  return __awaiter(this, void 0, void 0, function* () {
127
127
  const ixs = [];
128
128
  for (const user of users) {
129
+ const userPDA = (0, pda_1.getUserPDA)(this.program.programId, user);
129
130
  ixs.push(yield this.program.methods
130
131
  .migrateUser()
131
- .accounts({ user })
132
+ .accounts({ user: userPDA })
132
133
  .instruction());
133
134
  }
134
135
  return (0, sendVersionedTransaction_1.default)(this.provider, ixs, options, undefined, []);
package/dist/trade.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { AnchorProvider, Program } from '@coral-xyz/anchor';
2
2
  import { TriadProtocol } from './types/triad_protocol';
3
3
  import { PublicKey } from '@solana/web3.js';
4
- import { InitializeMarketArgs, OpenOrderArgs, OrderDirection } from './types/trade';
4
+ import { InitializeMarketArgs, OpenOrderArgs, OrderDirection, UserTrade } from './types/trade';
5
5
  import { RpcOptions } from './types';
6
6
  import BN from 'bn.js';
7
7
  export default class Trade {
@@ -14,11 +14,17 @@ export default class Trade {
14
14
  */
15
15
  getAllMarkets(): Promise<import("./types/trade").Market[]>;
16
16
  /**
17
- * Get All User Trades
17
+ * Get My User Trades from a user authority
18
18
  * @param user - User PublicKey
19
19
  *
20
20
  */
21
- getAllUserTrade(user: PublicKey): Promise<import("./types/trade").UserTrade[]>;
21
+ getMyUserTrades(user: PublicKey): Promise<UserTrade[]>;
22
+ /**
23
+ * Get User Orders
24
+ * @param user - User PublicKey
25
+ *
26
+ */
27
+ getUserOrders(user: PublicKey): Promise<import("./types/trade").Order[]>;
22
28
  /**
23
29
  * Get Market By ID
24
30
  * @param marketId - The ID of the market
@@ -34,9 +40,10 @@ export default class Trade {
34
40
  /**
35
41
  * Get User Trade
36
42
  * @param user - User PublicKey
43
+ * @param userNonce - The nonce of the user
37
44
  *
38
45
  */
39
- getUserTrade(user: PublicKey): Promise<{
46
+ getUserTrade(user: PublicKey, userNonce?: number): Promise<{
40
47
  bump: number;
41
48
  authority: PublicKey;
42
49
  totalDeposits: BN;
@@ -50,38 +57,18 @@ export default class Trade {
50
57
  status: ({
51
58
  open?: never;
52
59
  closed?: never;
53
- claimed?: never;
54
- liquidated?: never;
55
60
  } & {
56
61
  init: Record<string, never>;
57
62
  }) | ({
58
63
  init?: never;
59
64
  closed?: never;
60
- claimed?: never;
61
- liquidated?: never;
62
65
  } & {
63
66
  open: Record<string, never>;
64
67
  }) | ({
65
68
  init?: never;
66
69
  open?: never;
67
- claimed?: never;
68
- liquidated?: never;
69
70
  } & {
70
71
  closed: Record<string, never>;
71
- }) | ({
72
- init?: never;
73
- open?: never;
74
- closed?: never;
75
- liquidated?: never;
76
- } & {
77
- claimed: Record<string, never>;
78
- }) | ({
79
- init?: never;
80
- open?: never;
81
- closed?: never;
82
- claimed?: never;
83
- } & {
84
- liquidated: Record<string, never>;
85
72
  });
86
73
  price: BN;
87
74
  totalAmount: BN;
@@ -122,6 +109,12 @@ export default class Trade {
122
109
  *
123
110
  */
124
111
  initializeMarket({ marketId, startTime, endTime, question }: InitializeMarketArgs, options?: RpcOptions): Promise<string>;
112
+ /**
113
+ * Get User Trade Nonce With Slots
114
+ * @param userTrades - User Trades
115
+ *
116
+ */
117
+ getUserTradeNonceWithSlots(userTrades: UserTrade[]): Promise<PublicKey>;
125
118
  /**
126
119
  * Open Order
127
120
  * @param args.marketId - The ID of the Market
@@ -137,13 +130,15 @@ export default class Trade {
137
130
  * Close Order
138
131
  * @param args.marketId - The ID of the Market
139
132
  * @param args.orderId - The ID of the Order
133
+ * @param args.userNonce - The nonce of the user
140
134
  *
141
135
  * @param options - RPC options
142
136
  *
143
137
  */
144
- closeOrder({ marketId, orderId }: {
138
+ closeOrder({ marketId, orderId, userNonce }: {
145
139
  marketId: number;
146
140
  orderId: number;
141
+ userNonce: number;
147
142
  }, options?: RpcOptions): Promise<string>;
148
143
  /**
149
144
  * Resolve Market
@@ -207,13 +202,30 @@ export default class Trade {
207
202
  * Payout Order
208
203
  * @param args.marketId - The ID of the Market
209
204
  * @param args.orderId - The ID of the Order to Payout
205
+ * @param args.userNonce - The nonce of the user
210
206
  *
211
207
  * @param options - RPC options
212
208
  *
213
209
  */
214
- payoutOrder({ marketId, orderId }: {
210
+ payoutOrder({ marketId, orderId, userNonce }: {
215
211
  marketId: number;
216
212
  orderId: number;
213
+ userNonce: number;
217
214
  }, options?: RpcOptions): Promise<string>;
218
- allowMarketPayout(marketId: number, options?: RpcOptions): Promise<string>;
215
+ /**
216
+ * Allow Market to Payout
217
+ * @param marketId - The ID of the market
218
+ *
219
+ * @param options - RPC options
220
+ *
221
+ */
222
+ allowMarketToPayout(marketId: number, options?: RpcOptions): Promise<string>;
223
+ /**
224
+ * Create Sub User Trade
225
+ * @param user - User PublicKey the main user
226
+ *
227
+ * @param options - RPC options
228
+ *
229
+ */
230
+ createSubUserTrade(user: PublicKey, options?: RpcOptions): Promise<string>;
219
231
  }
package/dist/trade.js CHANGED
@@ -35,11 +35,11 @@ class Trade {
35
35
  });
36
36
  }
37
37
  /**
38
- * Get All User Trades
38
+ * Get My User Trades from a user authority
39
39
  * @param user - User PublicKey
40
40
  *
41
41
  */
42
- getAllUserTrade(user) {
42
+ getMyUserTrades(user) {
43
43
  return __awaiter(this, void 0, void 0, function* () {
44
44
  const response = yield this.program.account.userTrade.all([
45
45
  {
@@ -52,6 +52,18 @@ class Trade {
52
52
  return response.map(({ account, publicKey }) => (0, helpers_1.formatUserTrade)(account, publicKey));
53
53
  });
54
54
  }
55
+ /**
56
+ * Get User Orders
57
+ * @param user - User PublicKey
58
+ *
59
+ */
60
+ getUserOrders(user) {
61
+ return __awaiter(this, void 0, void 0, function* () {
62
+ const myUserTrades = yield this.getMyUserTrades(user);
63
+ const orders = myUserTrades.flatMap((userTrade) => userTrade.orders);
64
+ return orders;
65
+ });
66
+ }
55
67
  /**
56
68
  * Get Market By ID
57
69
  * @param marketId - The ID of the market
@@ -78,11 +90,16 @@ class Trade {
78
90
  /**
79
91
  * Get User Trade
80
92
  * @param user - User PublicKey
93
+ * @param userNonce - The nonce of the user
81
94
  *
82
95
  */
83
- getUserTrade(user) {
96
+ getUserTrade(user, userNonce = 0) {
84
97
  return __awaiter(this, void 0, void 0, function* () {
85
- const userTradePDA = (0, trade_1.getUserTradePDA)(this.program.programId, user);
98
+ let userTradePDA = (0, trade_1.getUserTradePDA)(this.program.programId, user);
99
+ if (userNonce !== 0) {
100
+ const subUserTradePDA = (0, trade_1.getSubUserTradePDA)(this.program.programId, user, userNonce);
101
+ userTradePDA = (0, trade_1.getUserTradePDA)(this.program.programId, subUserTradePDA);
102
+ }
86
103
  return this.program.account.userTrade.fetch(userTradePDA);
87
104
  });
88
105
  }
@@ -114,6 +131,39 @@ class Trade {
114
131
  }), options);
115
132
  });
116
133
  }
134
+ /**
135
+ * Get User Trade Nonce With Slots
136
+ * @param userTrades - User Trades
137
+ *
138
+ */
139
+ getUserTradeNonceWithSlots(userTrades) {
140
+ return __awaiter(this, void 0, void 0, function* () {
141
+ let nonce = null;
142
+ for (const userTrade of userTrades) {
143
+ if (nonce !== null) {
144
+ break;
145
+ }
146
+ userTrade.orders.forEach((order) => {
147
+ if (nonce !== null) {
148
+ return;
149
+ }
150
+ let status = Object.keys(order.status)[0];
151
+ if (status !== 'open') {
152
+ nonce = userTrade.nonce;
153
+ }
154
+ });
155
+ }
156
+ if (nonce === null) {
157
+ throw new Error('No open orders found');
158
+ }
159
+ if (nonce === 0) {
160
+ return (0, trade_1.getUserTradePDA)(this.program.programId, this.provider.publicKey);
161
+ }
162
+ const subUserTradePDA = (0, trade_1.getSubUserTradePDA)(this.program.programId, this.provider.publicKey, nonce);
163
+ const userTradePDA = (0, trade_1.getUserTradePDA)(this.program.programId, subUserTradePDA);
164
+ return userTradePDA;
165
+ });
166
+ }
117
167
  /**
118
168
  * Open Order
119
169
  * @param args.marketId - The ID of the Market
@@ -127,12 +177,13 @@ class Trade {
127
177
  openOrder({ marketId, amount, direction, token }, options) {
128
178
  return __awaiter(this, void 0, void 0, function* () {
129
179
  const marketPDA = (0, trade_1.getMarketPDA)(this.program.programId, marketId);
130
- const userTradePDA = (0, trade_1.getUserTradePDA)(this.program.programId, this.provider.publicKey);
180
+ let userTradePDA = (0, trade_1.getUserTradePDA)(this.program.programId, this.provider.publicKey);
131
181
  const ixs = [];
132
182
  const addressLookupTableAccounts = [];
133
183
  let amountInTRD = amount * Math.pow(10, constants_1.TRD_DECIMALS);
184
+ let myUserTrades = [];
134
185
  try {
135
- yield this.program.account.userTrade.fetch(userTradePDA);
186
+ myUserTrades = yield this.getMyUserTrades(this.provider.publicKey);
136
187
  }
137
188
  catch (_a) {
138
189
  ixs.push(yield this.program.methods
@@ -142,6 +193,21 @@ class Trade {
142
193
  })
143
194
  .instruction());
144
195
  }
196
+ try {
197
+ userTradePDA = yield this.getUserTradeNonceWithSlots(myUserTrades);
198
+ console.log(userTradePDA);
199
+ }
200
+ catch (_b) {
201
+ const mainUserTrade = myUserTrades.find((userTrade) => !userTrade.isSubUser);
202
+ const subUserTradePDA = (0, trade_1.getSubUserTradePDA)(this.program.programId, this.provider.publicKey, Number(mainUserTrade.nonce) + 1);
203
+ userTradePDA = (0, trade_1.getUserTradePDA)(this.program.programId, subUserTradePDA);
204
+ ixs.push(yield this.program.methods
205
+ .createSubUserTrade(subUserTradePDA)
206
+ .accounts({
207
+ signer: this.provider.publicKey
208
+ })
209
+ .instruction());
210
+ }
145
211
  if (token !== constants_1.TRD_MINT.toBase58()) {
146
212
  const { setupInstructions, swapIxs, addressLookupTableAccounts, trdAmount } = yield (0, swap_1.swap)({
147
213
  connection: this.provider.connection,
@@ -176,14 +242,19 @@ class Trade {
176
242
  * Close Order
177
243
  * @param args.marketId - The ID of the Market
178
244
  * @param args.orderId - The ID of the Order
245
+ * @param args.userNonce - The nonce of the user
179
246
  *
180
247
  * @param options - RPC options
181
248
  *
182
249
  */
183
- closeOrder({ marketId, orderId }, options) {
250
+ closeOrder({ marketId, orderId, userNonce }, options) {
184
251
  return __awaiter(this, void 0, void 0, function* () {
185
252
  const marketPDA = (0, trade_1.getMarketPDA)(this.program.programId, marketId);
186
- const userTradePDA = (0, trade_1.getUserTradePDA)(this.program.programId, this.provider.publicKey);
253
+ let userTradePDA = (0, trade_1.getUserTradePDA)(this.program.programId, this.provider.publicKey);
254
+ if (userNonce !== 0) {
255
+ const subUserTradePDA = (0, trade_1.getSubUserTradePDA)(this.program.programId, this.provider.publicKey, userNonce);
256
+ userTradePDA = (0, trade_1.getUserTradePDA)(this.program.programId, subUserTradePDA);
257
+ }
187
258
  return (0, sendTransactionWithOptions_1.default)(this.program.methods.closeOrder(new bn_js_1.default(orderId)).accounts({
188
259
  signer: this.provider.publicKey,
189
260
  market: marketPDA,
@@ -292,14 +363,19 @@ class Trade {
292
363
  * Payout Order
293
364
  * @param args.marketId - The ID of the Market
294
365
  * @param args.orderId - The ID of the Order to Payout
366
+ * @param args.userNonce - The nonce of the user
295
367
  *
296
368
  * @param options - RPC options
297
369
  *
298
370
  */
299
- payoutOrder({ marketId, orderId }, options) {
371
+ payoutOrder({ marketId, orderId, userNonce }, options) {
300
372
  return __awaiter(this, void 0, void 0, function* () {
301
373
  const marketPDA = (0, trade_1.getMarketPDA)(this.program.programId, marketId);
302
- const userTradePDA = (0, trade_1.getUserTradePDA)(this.program.programId, this.provider.publicKey);
374
+ let userTradePDA = (0, trade_1.getUserTradePDA)(this.program.programId, this.provider.publicKey);
375
+ if (userNonce !== 0) {
376
+ const subUserTradePDA = (0, trade_1.getSubUserTradePDA)(this.program.programId, this.provider.publicKey, userNonce);
377
+ userTradePDA = (0, trade_1.getUserTradePDA)(this.program.programId, subUserTradePDA);
378
+ }
303
379
  return (0, sendTransactionWithOptions_1.default)(this.program.methods.payoutOrder(new bn_js_1.default(orderId)).accounts({
304
380
  signer: this.provider.publicKey,
305
381
  userTrade: userTradePDA,
@@ -308,14 +384,37 @@ class Trade {
308
384
  }), options);
309
385
  });
310
386
  }
311
- allowMarketPayout(marketId, options) {
387
+ /**
388
+ * Allow Market to Payout
389
+ * @param marketId - The ID of the market
390
+ *
391
+ * @param options - RPC options
392
+ *
393
+ */
394
+ allowMarketToPayout(marketId, options) {
312
395
  return __awaiter(this, void 0, void 0, function* () {
313
396
  const marketPDA = (0, trade_1.getMarketPDA)(this.program.programId, marketId);
314
- return (0, sendTransactionWithOptions_1.default)(this.program.methods.allowMarketPayout().accounts({
397
+ return (0, sendTransactionWithOptions_1.default)(this.program.methods.allowMarketToPayout().accounts({
315
398
  signer: this.provider.publicKey,
316
399
  market: marketPDA
317
400
  }), options);
318
401
  });
319
402
  }
403
+ /**
404
+ * Create Sub User Trade
405
+ * @param user - User PublicKey the main user
406
+ *
407
+ * @param options - RPC options
408
+ *
409
+ */
410
+ createSubUserTrade(user, options) {
411
+ return __awaiter(this, void 0, void 0, function* () {
412
+ const userTrade = yield this.getUserTrade(user);
413
+ const subUserTradePDA = (0, trade_1.getSubUserTradePDA)(this.program.programId, user, userTrade.nonce + 1);
414
+ return (0, sendTransactionWithOptions_1.default)(this.program.methods.createSubUserTrade(subUserTradePDA).accounts({
415
+ signer: this.provider.publicKey
416
+ }), options);
417
+ });
418
+ }
320
419
  }
321
420
  exports.default = Trade;
@@ -105,8 +105,8 @@
105
105
  ]
106
106
  },
107
107
  {
108
- "name": "allow_market_payout",
109
- "discriminator": [95, 246, 155, 119, 253, 65, 95, 184],
108
+ "name": "allow_market_to_payout",
109
+ "discriminator": [193, 227, 109, 171, 110, 177, 47, 251],
110
110
  "accounts": [
111
111
  {
112
112
  "name": "signer",
@@ -497,7 +497,12 @@
497
497
  "address": "11111111111111111111111111111111"
498
498
  }
499
499
  ],
500
- "args": []
500
+ "args": [
501
+ {
502
+ "name": "sub_user_key",
503
+ "type": "pubkey"
504
+ }
505
+ ]
501
506
  },
502
507
  {
503
508
  "name": "create_user_trade",
@@ -1365,10 +1370,6 @@
1365
1370
  }
1366
1371
  ],
1367
1372
  "events": [
1368
- {
1369
- "name": "MarketAllowedToPayoutEvent",
1370
- "discriminator": [72, 148, 96, 232, 248, 132, 92, 26]
1371
- },
1372
1373
  {
1373
1374
  "name": "MarketEvent",
1374
1375
  "discriminator": [212, 67, 145, 23, 58, 104, 52, 83]
@@ -1466,6 +1467,11 @@
1466
1467
  "code": 6015,
1467
1468
  "name": "MarketNotAllowedToPayout",
1468
1469
  "msg": "Market Not allowed to payout"
1470
+ },
1471
+ {
1472
+ "code": 6016,
1473
+ "name": "UserTradeIsSubUser",
1474
+ "msg": "User trade is sub user"
1469
1475
  }
1470
1476
  ],
1471
1477
  "types": [
@@ -1669,34 +1675,6 @@
1669
1675
  ]
1670
1676
  }
1671
1677
  },
1672
- {
1673
- "name": "MarketAllowedToPayoutEvent",
1674
- "type": {
1675
- "kind": "struct",
1676
- "fields": [
1677
- {
1678
- "name": "market_id",
1679
- "type": "u64"
1680
- },
1681
- {
1682
- "name": "winning_direction",
1683
- "type": {
1684
- "defined": {
1685
- "name": "WinningDirection"
1686
- }
1687
- }
1688
- },
1689
- {
1690
- "name": "timestamp",
1691
- "type": "i64"
1692
- },
1693
- {
1694
- "name": "is_allowed_to_payout",
1695
- "type": "bool"
1696
- }
1697
- ]
1698
- }
1699
- },
1700
1678
  {
1701
1679
  "name": "MarketEvent",
1702
1680
  "type": {
@@ -1761,6 +1739,14 @@
1761
1739
  {
1762
1740
  "name": "market_end",
1763
1741
  "type": "i64"
1742
+ },
1743
+ {
1744
+ "name": "is_allowed_to_payout",
1745
+ "type": "bool"
1746
+ },
1747
+ {
1748
+ "name": "market_liquidity_at_start",
1749
+ "type": "u64"
1764
1750
  }
1765
1751
  ]
1766
1752
  }
@@ -2075,6 +2061,10 @@
2075
2061
  "type": {
2076
2062
  "option": "bool"
2077
2063
  }
2064
+ },
2065
+ {
2066
+ "name": "user_nonce",
2067
+ "type": "u32"
2078
2068
  }
2079
2069
  ]
2080
2070
  }
@@ -2092,12 +2082,6 @@
2092
2082
  },
2093
2083
  {
2094
2084
  "name": "Closed"
2095
- },
2096
- {
2097
- "name": "Claimed"
2098
- },
2099
- {
2100
- "name": "Liquidated"
2101
2085
  }
2102
2086
  ]
2103
2087
  }
@@ -64,10 +64,6 @@ export type OrderStatus = {
64
64
  open: {};
65
65
  } | {
66
66
  closed: {};
67
- } | {
68
- claimed: {};
69
- } | {
70
- liquidated: {};
71
67
  };
72
68
  export type OrderType = {
73
69
  limit: {};
@@ -169,8 +169,8 @@ export type TriadProtocol = {
169
169
  ];
170
170
  },
171
171
  {
172
- name: 'allowMarketPayout';
173
- discriminator: [95, 246, 155, 119, 253, 65, 95, 184];
172
+ name: 'allowMarketToPayout';
173
+ discriminator: [193, 227, 109, 171, 110, 177, 47, 251];
174
174
  accounts: [
175
175
  {
176
176
  name: 'signer';
@@ -735,7 +735,12 @@ export type TriadProtocol = {
735
735
  address: '11111111111111111111111111111111';
736
736
  }
737
737
  ];
738
- args: [];
738
+ args: [
739
+ {
740
+ name: 'subUserKey';
741
+ type: 'pubkey';
742
+ }
743
+ ];
739
744
  },
740
745
  {
741
746
  name: 'createUserTrade';
@@ -1922,10 +1927,6 @@ export type TriadProtocol = {
1922
1927
  }
1923
1928
  ];
1924
1929
  events: [
1925
- {
1926
- name: 'marketAllowedToPayoutEvent';
1927
- discriminator: [72, 148, 96, 232, 248, 132, 92, 26];
1928
- },
1929
1930
  {
1930
1931
  name: 'marketEvent';
1931
1932
  discriminator: [212, 67, 145, 23, 58, 104, 52, 83];
@@ -2023,6 +2024,11 @@ export type TriadProtocol = {
2023
2024
  code: 6015;
2024
2025
  name: 'marketNotAllowedToPayout';
2025
2026
  msg: 'Market Not allowed to payout';
2027
+ },
2028
+ {
2029
+ code: 6016;
2030
+ name: 'userTradeIsSubUser';
2031
+ msg: 'User trade is sub user';
2026
2032
  }
2027
2033
  ];
2028
2034
  types: [
@@ -2226,34 +2232,6 @@ export type TriadProtocol = {
2226
2232
  ];
2227
2233
  };
2228
2234
  },
2229
- {
2230
- name: 'marketAllowedToPayoutEvent';
2231
- type: {
2232
- kind: 'struct';
2233
- fields: [
2234
- {
2235
- name: 'marketId';
2236
- type: 'u64';
2237
- },
2238
- {
2239
- name: 'winningDirection';
2240
- type: {
2241
- defined: {
2242
- name: 'winningDirection';
2243
- };
2244
- };
2245
- },
2246
- {
2247
- name: 'timestamp';
2248
- type: 'i64';
2249
- },
2250
- {
2251
- name: 'isAllowedToPayout';
2252
- type: 'bool';
2253
- }
2254
- ];
2255
- };
2256
- },
2257
2235
  {
2258
2236
  name: 'marketEvent';
2259
2237
  type: {
@@ -2318,6 +2296,14 @@ export type TriadProtocol = {
2318
2296
  {
2319
2297
  name: 'marketEnd';
2320
2298
  type: 'i64';
2299
+ },
2300
+ {
2301
+ name: 'isAllowedToPayout';
2302
+ type: 'bool';
2303
+ },
2304
+ {
2305
+ name: 'marketLiquidityAtStart';
2306
+ type: 'u64';
2321
2307
  }
2322
2308
  ];
2323
2309
  };
@@ -2632,6 +2618,10 @@ export type TriadProtocol = {
2632
2618
  type: {
2633
2619
  option: 'bool';
2634
2620
  };
2621
+ },
2622
+ {
2623
+ name: 'userNonce';
2624
+ type: 'u32';
2635
2625
  }
2636
2626
  ];
2637
2627
  };
@@ -2649,12 +2639,6 @@ export type TriadProtocol = {
2649
2639
  },
2650
2640
  {
2651
2641
  name: 'closed';
2652
- },
2653
- {
2654
- name: 'claimed';
2655
- },
2656
- {
2657
- name: 'liquidated';
2658
2642
  }
2659
2643
  ];
2660
2644
  };
@@ -22,7 +22,7 @@ const swap = ({ connection, wallet, inToken, amount }) => __awaiter(void 0, void
22
22
  throw new Error('Token not found');
23
23
  }
24
24
  const formattedAmountIn = amount * Math.pow(10, token.decimals);
25
- const quoteResponse = yield axios_1.default.get(`https://quote-api.jup.ag/v6/quote?inputMint=${inToken}&outputMint=${constants_1.TRD_MINT.toBase58()}&amount=${formattedAmountIn}&slippageBps=30`);
25
+ const quoteResponse = yield axios_1.default.get(`https://quote-api.jup.ag/v6/quote?inputMint=${inToken}&outputMint=${constants_1.TRD_MINT.toBase58()}&amount=${formattedAmountIn}&slippageBps=60`);
26
26
  const { data: quoteData } = quoteResponse;
27
27
  const swapResponse = yield axios_1.default.post('https://quote-api.jup.ag/v6/swap-instructions', {
28
28
  userPublicKey: wallet,
@@ -35,9 +35,6 @@ const swap = ({ connection, wallet, inToken, amount }) => __awaiter(void 0, void
35
35
  deserializeInstruction(swapInstruction),
36
36
  web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({
37
37
  units: 500000
38
- }),
39
- web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({
40
- microLamports: yield getPriorityFee()
41
38
  })
42
39
  ],
43
40
  addressLookupTableAccounts: yield (0, exports.getAddressLookupTableAccounts)(connection, addressLookupTableAddresses),
@@ -73,15 +70,7 @@ const getAddressLookupTableAccounts = (connection, keys) => __awaiter(void 0, vo
73
70
  }, new Array());
74
71
  });
75
72
  exports.getAddressLookupTableAccounts = getAddressLookupTableAccounts;
76
- const getPriorityFee = () => __awaiter(void 0, void 0, void 0, function* () {
77
- const response = yield axios_1.default.get('https://solanacompass.com/api/fees');
78
- return response.data[15].priorityTx || 1000;
79
- });
80
73
  const TOKENS = {
81
- oreoU2P8bN6jkk3jbaiVxYnG1dCXcYxwhwyK9jSybcp: {
82
- mint: 'oreoU2P8bN6jkk3jbaiVxYnG1dCXcYxwhwyK9jSybcp',
83
- decimals: 11
84
- },
85
74
  So11111111111111111111111111111111111111112: {
86
75
  mint: 'So11111111111111111111111111111111111111112',
87
76
  decimals: 9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "1.5.5-beta",
3
+ "version": "1.5.6-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",