@triadxyz/triad-protocol 1.2.0-beta → 1.2.1-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.
@@ -17,80 +17,94 @@ const _1 = __importDefault(require("./"));
17
17
  const anchor_1 = require("@coral-xyz/anchor");
18
18
  const axios_1 = __importDefault(require("axios"));
19
19
  const web3_js_1 = require("@solana/web3.js");
20
+ const spl_token_1 = require("@solana/spl-token");
20
21
  const file = fs_1.default.readFileSync('/Users/dannpl/.config/solana/id.json');
21
22
  const rpc_file = fs_1.default.readFileSync('/Users/dannpl/.config/solana/rpc.txt');
22
23
  const keypair = web3_js_1.Keypair.fromSecretKey(new Uint8Array(JSON.parse(file.toString())));
23
- const connection = new web3_js_1.Connection(rpc_file.toString(), 'confirmed');
24
+ const connection = new web3_js_1.Connection('https://mainnet.helius-rpc.com/?api-key=428d811e-ba57-4def-8876-de95d53b7c9d');
24
25
  const wallet = new anchor_1.Wallet(keypair);
25
26
  const triadProtocol = new _1.default(connection, wallet);
27
+ const mint = new web3_js_1.PublicKey('X41iRJUPkKaEvhqWdxqrS5P7M5d8A9oathki5sT47KR');
26
28
  const markets = [
27
- // { name: 'Triad', marketId: 0 },
28
- // { name: 'PYTH', marketId: 1 },
29
- // { name: 'DRIFT', marketId: 2 },
30
- // { name: 'SYMMETRY', marketId: 3 },
31
- // { name: 'ORE', marketId: 4 },
32
- // { name: 'COLETA', marketId: 5 },
33
- // { name: 'UNDEADS', marketId: 6 }
29
+ // { name: 'Triad', marketId: 0 },
30
+ // { name: 'PYTH', marketId: 1 }
31
+ // { name: 'DRIFT', marketId: 2 }
32
+ // { name: 'SYMMETRY', marketId: 3 }
33
+ // { name: 'ORE', marketId: 4 }
34
+ // { name: 'COLETA', marketId: 5 }
35
+ // { name: 'UNDEADS', marketId: 6 },
36
+ { name: 'SOL x ETH', marketId: 7 },
37
+ { name: 'PYTH x LINK', marketId: 8 },
38
+ { name: 'SOL PRICE', marketId: 9 }
34
39
  ];
35
40
  const questions = [
36
41
  {
37
42
  name: 'Pyth',
38
43
  marketId: 1,
39
- question: "$PYTH's market cap exceed $1.5B by the end of October?",
40
- startTime: 1728415578,
41
- endTime: 1730394000
42
- },
43
- {
44
- name: 'Drift',
45
- marketId: 2,
46
- question: 'Drift surpass $33M in volume on prediction markets by the end of October?',
47
- startTime: 1728415578,
48
- endTime: 1730394000
49
- },
50
- {
51
- name: 'Symmetry',
52
- marketId: 3,
53
- question: "Symmetry's TVL exceed $5.5M by the end of October?",
54
- startTime: 1728415578,
55
- endTime: 1730394000
56
- },
57
- {
58
- name: 'Ore',
59
- marketId: 4,
60
- question: 'ORE surpass 20k on-chain miners by the end of October?',
61
- startTime: 1728415578,
62
- endTime: 1730394000
63
- },
64
- {
65
- name: 'Coleta',
66
- marketId: 5,
67
- question: 'COLETA PFP reach 500 SOL in total volume by the end of October (based on Tensor)?',
68
- startTime: 1728415578,
69
- endTime: 1730394000
70
- },
71
- {
72
- name: 'Undeads',
73
- marketId: 6,
74
- question: 'The Undeads reach more than 1,600 holders by the end of October?',
75
- startTime: 1728415578,
44
+ question: 'test 2',
45
+ startTime: 1719513866,
76
46
  endTime: 1730394000
77
47
  }
48
+ // },
49
+ // {
50
+ // name: 'Pyth',
51
+ // marketId: 1,
52
+ // question: "$PYTH's market cap exceed $1.5B by the end of October?",
53
+ // startTime: 1728415578,
54
+ // endTime: 1730394000
55
+ // },
56
+ // {
57
+ // name: 'Drift',
58
+ // marketId: 2,
59
+ // question:
60
+ // 'Drift surpass $33M in volume on prediction markets by the end of October?',
61
+ // startTime: 1728415578,
62
+ // endTime: 1730394000
63
+ // },
64
+ // {
65
+ // name: 'Symmetry',
66
+ // marketId: 3,
67
+ // question: "Symmetry's TVL exceed $5.5M by the end of October?",
68
+ // startTime: 1728415578,
69
+ // endTime: 1730394000
70
+ // },
71
+ // {
72
+ // name: 'Ore',
73
+ // marketId: 4,
74
+ // question: 'ORE surpass 20k on-chain miners by the end of October?',
75
+ // startTime: 1728415578,
76
+ // endTime: 1730394000
77
+ // },
78
+ // {
79
+ // name: 'Coleta',
80
+ // marketId: 5,
81
+ // question:
82
+ // 'COLETA PFP reach 500 SOL in total volume by the end of October (based on Tensor)?',
83
+ // startTime: 1728415578,
84
+ // endTime: 1730394000
85
+ // },
86
+ // {
87
+ // name: 'Undeads',
88
+ // marketId: 6,
89
+ // question:
90
+ // 'The Undeads reach more than 1,600 holders by the end of October?',
91
+ // startTime: 1728415578,
92
+ // endTime: 1730394000
93
+ // }
78
94
  ];
79
95
  const ordersHypeAndFloopBot = [
80
96
  {
81
- marketId: 0,
82
- amount: 0.001,
97
+ marketId: 7,
98
+ amount: 5000,
83
99
  direction: {
84
100
  flop: {}
85
- },
86
- orderType: {
87
- market: {}
88
101
  }
89
102
  }
90
103
  ];
91
104
  const updateStakeVault = () => __awaiter(void 0, void 0, void 0, function* () {
92
105
  const response = yield triadProtocol.stake.updateStakeVault({
93
- wallet: wallet.publicKey
106
+ wallet: wallet.publicKey,
107
+ amount: new anchor_1.BN(5000 * Math.pow(10, 6))
94
108
  });
95
109
  console.log(response);
96
110
  });
@@ -98,16 +112,8 @@ const getStakeVault = () => __awaiter(void 0, void 0, void 0, function* () {
98
112
  const response = yield triadProtocol.stake.getStakeVaults();
99
113
  console.log(response);
100
114
  });
101
- const updateStakeVaultStatus = () => __awaiter(void 0, void 0, void 0, function* () {
102
- const response = yield triadProtocol.stake.updateStakeVault({
103
- wallet: wallet.publicKey,
104
- amount: new anchor_1.BN(0),
105
- status: false
106
- });
107
- console.log(response);
108
- });
109
115
  const updateBoost = () => __awaiter(void 0, void 0, void 0, function* () {
110
- const response = (yield axios_1.default.get('https://api.triadfi.co/boost'))
116
+ const response = (yield axios_1.default.get('http://localhost:8080/boost'))
111
117
  .data;
112
118
  const stakes = yield triadProtocol.stake.getStakes();
113
119
  const update = [];
@@ -132,7 +138,7 @@ const getAllMarkets = () => __awaiter(void 0, void 0, void 0, function* () {
132
138
  });
133
139
  getAllMarkets();
134
140
  const getMarket = () => __awaiter(void 0, void 0, void 0, function* () {
135
- const market = yield triadProtocol.trade.getMarketById(2);
141
+ const market = yield triadProtocol.trade.getMarketById(7);
136
142
  console.log(market);
137
143
  });
138
144
  const initializeAllMarkets = () => __awaiter(void 0, void 0, void 0, function* () {
@@ -150,58 +156,54 @@ const initializeAllMarkets = () => __awaiter(void 0, void 0, void 0, function* (
150
156
  });
151
157
  const getOrders = (walletAddress) => __awaiter(void 0, void 0, void 0, function* () {
152
158
  const response = (yield triadProtocol.program.account.userTrade.all()).find((userTrade) => userTrade.account.authority.toBase58() === walletAddress.toBase58());
153
- console.log(response.account);
159
+ let orders = [];
160
+ for (const order of response.account.orders) {
161
+ if (!order.status.open) {
162
+ continue;
163
+ }
164
+ orders.push({
165
+ marketId: order.marketId,
166
+ orderId: order.orderId.toNumber(),
167
+ totalShares: order.totalShares.toString(),
168
+ amount: order.totalAmount.toString(),
169
+ direction: order.direction,
170
+ questionId: order.questionId,
171
+ price: order.price.toString(),
172
+ status: order.status
173
+ });
174
+ }
175
+ console.log(orders);
176
+ return orders;
177
+ });
178
+ // getOrders(new PublicKey('HjJQdfTHgC3EBX3471w4st8BXbBmtbaMyCAXNgcUb7dq'))
179
+ const openOrder = () => __awaiter(void 0, void 0, void 0, function* () {
180
+ yield getMarket();
181
+ for (const order of ordersHypeAndFloopBot) {
182
+ const response = yield triadProtocol.trade.openOrder({
183
+ marketId: order.marketId,
184
+ amount: order.amount,
185
+ direction: order.direction,
186
+ token: mint.toBase58(),
187
+ comment: `hype/flop bot ${order.amount} - ${order.direction}`
188
+ });
189
+ console.log(response);
190
+ }
191
+ yield new Promise((resolve) => setTimeout(resolve, 50000));
192
+ getMarket();
193
+ });
194
+ const closeOrder = (orderId) => __awaiter(void 0, void 0, void 0, function* () {
195
+ const response = yield triadProtocol.trade.closeOrder({
196
+ marketId: 7,
197
+ orderId: orderId
198
+ });
199
+ console.log(response);
154
200
  });
155
- // const openOrder = async () => {
156
- // for (const order of ordersHypeAndFloopBot) {
157
- // const response = await triadProtocol.trade.openOrder(
158
- // {
159
- // marketId: 0,
160
- // amount: order.amount,
161
- // direction: order.direction as any,
162
- // token: 'So11111111111111111111111111111111111111112',
163
- // comment: `hype/flop bot ${order.amount} - ${order.direction}`
164
- // },
165
- // {
166
- // skipPreflight: true
167
- // }
168
- // )
169
- // console.log(response)
170
- // }
171
- // }
172
- // const closeOrder = async () => {
173
- // for (const order of await getOrders()) {
174
- // try {
175
- // const response = await triadProtocol.trade.closeOrder({
176
- // marketId: 1,
177
- // orderId: order
178
- // })
179
- // console.log(response)
180
- // } catch (e) {
181
- // console.log('Error closing order')
182
- // }
183
- // }
184
- // }
185
- // const runBot = async () => {
186
- // while (true) {
187
- // const hasOpenOrders = (await getOrders()).find((order) => order !== 0)
188
- // if (hasOpenOrders) {
189
- // await closeOrder()
190
- // }
191
- // await openOrder()
192
- // await new Promise((resolve) => setTimeout(resolve, 40000))
193
- // }
194
- // }
195
- const initializeQuestion = () => __awaiter(void 0, void 0, void 0, function* () {
196
- for (const question of questions) {
201
+ const closeOrders = () => __awaiter(void 0, void 0, void 0, function* () {
202
+ for (const order of yield getOrders(wallet.publicKey)) {
197
203
  try {
198
- const response = yield triadProtocol.trade.initializeQuestion({
199
- marketId: question.marketId,
200
- question: question.question,
201
- startTime: question.startTime,
202
- endTime: question.endTime
203
- }, {
204
- skipPreflight: true
204
+ const response = yield triadProtocol.trade.closeOrder({
205
+ marketId: order.marketId,
206
+ orderId: order.orderId
205
207
  });
206
208
  console.log(response);
207
209
  }
@@ -210,11 +212,38 @@ const initializeQuestion = () => __awaiter(void 0, void 0, void 0, function* ()
210
212
  }
211
213
  }
212
214
  });
213
- const resolveQuestion = () => __awaiter(void 0, void 0, void 0, function* () {
214
- const response = yield triadProtocol.trade.resolveQuestion(0);
215
- console.log(response);
215
+ const mintTokens = () => __awaiter(void 0, void 0, void 0, function* () {
216
+ // const mint = await createMint(
217
+ // connection,
218
+ // keypair,
219
+ // keypair.publicKey,
220
+ // null,
221
+ // 6,
222
+ // undefined,
223
+ // undefined,
224
+ // TOKEN_2022_PROGRAM_ID
225
+ // )
226
+ // console.log(mint)
227
+ const ataAddress = yield (0, spl_token_1.getAssociatedTokenAddress)(keypair.publicKey, mint);
228
+ console.log(ataAddress);
229
+ const ata = yield (0, spl_token_1.createAssociatedTokenAccount)(connection, keypair, mint, keypair.publicKey, undefined, spl_token_1.TOKEN_2022_PROGRAM_ID);
230
+ const mintTx = yield (0, spl_token_1.mintTo)(connection, keypair, mint, ata, keypair, 1000000 * Math.pow(10, 6), [keypair], undefined, spl_token_1.TOKEN_2022_PROGRAM_ID);
231
+ console.log(mintTx);
216
232
  });
217
- const getReferral = () => __awaiter(void 0, void 0, void 0, function* () {
218
- const response = yield triadProtocol.getReferral('dannpl');
219
- console.log(response);
233
+ const resolveQuestion = () => __awaiter(void 0, void 0, void 0, function* () {
234
+ const marketsToResolve = [
235
+ { marketId: 1, winningDirection: { flop: {} } },
236
+ { marketId: 2, winningDirection: { flop: {} } },
237
+ { marketId: 3, winningDirection: { flop: {} } },
238
+ { marketId: 5, winningDirection: { flop: {} } }
239
+ ];
240
+ for (const market of marketsToResolve) {
241
+ const response = yield triadProtocol.trade.resolveQuestion({
242
+ marketId: market.marketId,
243
+ winningDirection: market.winningDirection
244
+ }, {
245
+ microLamports: 5000
246
+ });
247
+ console.log(response);
248
+ }
220
249
  });
package/dist/stake.d.ts CHANGED
@@ -54,10 +54,10 @@ export default class Stake {
54
54
  * Update Stake Vault
55
55
  * @param wallet - User wallet
56
56
  * @param amount - Reward amount to deposit (optional)
57
- * @param status - Status of the stake vault (optional)
57
+ * @param isLocked - is locked stake vault (optional)
58
58
  *
59
59
  */
60
- updateStakeVault({ wallet, amount, status }: UpdateStakeVaultArgs, options?: RpcOptions): Promise<any>;
60
+ updateStakeVault({ wallet, amount, isLocked }: UpdateStakeVaultArgs, options?: RpcOptions): Promise<any>;
61
61
  /**
62
62
  * Request Withdraw
63
63
  * @param wallet - User wallet
package/dist/stake.js CHANGED
@@ -166,15 +166,15 @@ class Stake {
166
166
  * Update Stake Vault
167
167
  * @param wallet - User wallet
168
168
  * @param amount - Reward amount to deposit (optional)
169
- * @param status - Status of the stake vault (optional)
169
+ * @param isLocked - is locked stake vault (optional)
170
170
  *
171
171
  */
172
- updateStakeVault({ wallet, amount, status }, options) {
172
+ updateStakeVault({ wallet, amount, isLocked }, options) {
173
173
  return __awaiter(this, void 0, void 0, function* () {
174
174
  return (0, sendTransactionWithOptions_1.default)(this.program.methods
175
175
  .updateStakeVault({
176
176
  amount,
177
- status,
177
+ isLocked,
178
178
  stakeVault: this.stakeVaultName
179
179
  })
180
180
  .accounts({
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 { FeeVault, InitializeQuestionArgs, Market, OpenOrderArgs } from './types/trade';
4
+ import { FeeVault, InitializeQuestionArgs, Market, OpenOrderArgs, OrderDirection } from './types/trade';
5
5
  import { RpcOptions } from './types';
6
6
  import BN from 'bn.js';
7
7
  export default class Trade {
@@ -157,7 +157,16 @@ export default class Trade {
157
157
  * @param options - RPC options
158
158
  *
159
159
  */
160
- resolveQuestion(marketId: number, options?: RpcOptions): Promise<string>;
160
+ resolveQuestion({ marketId, winningDirection }: {
161
+ marketId: number;
162
+ winningDirection: {
163
+ hype: {};
164
+ } | {
165
+ flop: {};
166
+ } | {
167
+ none: {};
168
+ };
169
+ }, options?: RpcOptions): Promise<string>;
161
170
  /**
162
171
  * Settle an order
163
172
  * @param marketId - The ID of the market
@@ -170,4 +179,18 @@ export default class Trade {
170
179
  marketId: number;
171
180
  orderId: number;
172
181
  }, options?: RpcOptions): Promise<string>;
182
+ /**
183
+ * Add Liquidity
184
+ * @param marketId - The ID of the market
185
+ * @param amount - The amount of the order
186
+ * @param direction - The direction of the order
187
+ *
188
+ * @param options - RPC options
189
+ *
190
+ */
191
+ addLiquidity({ marketId, amount, direction }: {
192
+ marketId: number;
193
+ amount: number;
194
+ direction: OrderDirection;
195
+ }, options?: RpcOptions): Promise<string>;
173
196
  }
package/dist/trade.js CHANGED
@@ -227,10 +227,12 @@ class Trade {
227
227
  * @param options - RPC options
228
228
  *
229
229
  */
230
- resolveQuestion(marketId, options) {
230
+ resolveQuestion({ marketId, winningDirection }, options) {
231
231
  return __awaiter(this, void 0, void 0, function* () {
232
232
  const marketPDA = (0, trade_1.getMarketPDA)(this.program.programId, marketId);
233
- const method = this.program.methods.resolveQuestion().accounts({
233
+ const method = this.program.methods
234
+ .resolveQuestion(winningDirection)
235
+ .accounts({
234
236
  signer: this.provider.publicKey,
235
237
  market: marketPDA
236
238
  });
@@ -257,5 +259,30 @@ class Trade {
257
259
  }), options);
258
260
  });
259
261
  }
262
+ /**
263
+ * Add Liquidity
264
+ * @param marketId - The ID of the market
265
+ * @param amount - The amount of the order
266
+ * @param direction - The direction of the order
267
+ *
268
+ * @param options - RPC options
269
+ *
270
+ */
271
+ addLiquidity({ marketId, amount, direction }, options) {
272
+ return __awaiter(this, void 0, void 0, function* () {
273
+ const marketPDA = (0, trade_1.getMarketPDA)(this.program.programId, marketId);
274
+ const method = this.program.methods
275
+ .addLiquidity({
276
+ amount: new bn_js_1.default(amount * Math.pow(10, constants_1.TRD_DECIMALS)),
277
+ direction: direction
278
+ })
279
+ .accounts({
280
+ signer: this.provider.publicKey,
281
+ market: marketPDA,
282
+ mint: this.mint
283
+ });
284
+ return (0, sendTransactionWithOptions_1.default)(method, options);
285
+ });
286
+ }
260
287
  }
261
288
  exports.default = Trade;
@@ -7,6 +7,103 @@
7
7
  "description": "Triad protocol, trade solana projects"
8
8
  },
9
9
  "instructions": [
10
+ {
11
+ "name": "add_liquidity",
12
+ "discriminator": [181, 157, 89, 67, 143, 182, 52, 72],
13
+ "accounts": [
14
+ {
15
+ "name": "signer",
16
+ "writable": true,
17
+ "signer": true
18
+ },
19
+ {
20
+ "name": "market",
21
+ "writable": true
22
+ },
23
+ {
24
+ "name": "mint",
25
+ "writable": true
26
+ },
27
+ {
28
+ "name": "user_from_ata",
29
+ "writable": true,
30
+ "pda": {
31
+ "seeds": [
32
+ {
33
+ "kind": "account",
34
+ "path": "signer"
35
+ },
36
+ {
37
+ "kind": "account",
38
+ "path": "token_program"
39
+ },
40
+ {
41
+ "kind": "account",
42
+ "path": "mint"
43
+ }
44
+ ],
45
+ "program": {
46
+ "kind": "const",
47
+ "value": [
48
+ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
49
+ 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
50
+ 219, 233, 248, 89
51
+ ]
52
+ }
53
+ }
54
+ },
55
+ {
56
+ "name": "market_to_ata",
57
+ "writable": true,
58
+ "pda": {
59
+ "seeds": [
60
+ {
61
+ "kind": "account",
62
+ "path": "market"
63
+ },
64
+ {
65
+ "kind": "account",
66
+ "path": "token_program"
67
+ },
68
+ {
69
+ "kind": "account",
70
+ "path": "mint"
71
+ }
72
+ ],
73
+ "program": {
74
+ "kind": "const",
75
+ "value": [
76
+ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
77
+ 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
78
+ 219, 233, 248, 89
79
+ ]
80
+ }
81
+ }
82
+ },
83
+ {
84
+ "name": "token_program",
85
+ "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
86
+ },
87
+ {
88
+ "name": "associated_token_program",
89
+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
90
+ },
91
+ {
92
+ "name": "system_program",
93
+ "address": "11111111111111111111111111111111"
94
+ }
95
+ ],
96
+ "args": [
97
+ {
98
+ "name": "args",
99
+ "type": {
100
+ "defined": {
101
+ "name": "AddLiquidityArgs"
102
+ }
103
+ }
104
+ }
105
+ ]
106
+ },
10
107
  {
11
108
  "name": "claim_stake_rewards",
12
109
  "discriminator": [107, 91, 233, 196, 211, 47, 218, 21],
@@ -240,22 +337,6 @@
240
337
  ]
241
338
  }
242
339
  },
243
- {
244
- "name": "user_trade",
245
- "writable": true,
246
- "pda": {
247
- "seeds": [
248
- {
249
- "kind": "const",
250
- "value": [117, 115, 101, 114, 95, 116, 114, 97, 100, 101]
251
- },
252
- {
253
- "kind": "account",
254
- "path": "signer"
255
- }
256
- ]
257
- }
258
- },
259
340
  {
260
341
  "name": "system_program",
261
342
  "address": "11111111111111111111111111111111"
@@ -621,7 +702,16 @@
621
702
  "address": "11111111111111111111111111111111"
622
703
  }
623
704
  ],
624
- "args": []
705
+ "args": [
706
+ {
707
+ "name": "winning_direction",
708
+ "type": {
709
+ "defined": {
710
+ "name": "WinningDirection"
711
+ }
712
+ }
713
+ }
714
+ ]
625
715
  },
626
716
  {
627
717
  "name": "settle_order",
@@ -1527,9 +1617,54 @@
1527
1617
  "code": 6041,
1528
1618
  "name": "OrderNotOpen",
1529
1619
  "msg": "Order not open"
1620
+ },
1621
+ {
1622
+ "code": 6042,
1623
+ "name": "HasOpenedOrders",
1624
+ "msg": "Has opened orders"
1625
+ },
1626
+ {
1627
+ "code": 6043,
1628
+ "name": "InsufficientLiquidity",
1629
+ "msg": "Insufficient liquidity"
1630
+ },
1631
+ {
1632
+ "code": 6044,
1633
+ "name": "MarketNotResolved",
1634
+ "msg": "Market not resolved"
1635
+ },
1636
+ {
1637
+ "code": 6045,
1638
+ "name": "MarketAlreadyResolved",
1639
+ "msg": "Market already resolved"
1640
+ },
1641
+ {
1642
+ "code": 6046,
1643
+ "name": "ConcurrentTransaction",
1644
+ "msg": "Concurrent transaction"
1530
1645
  }
1531
1646
  ],
1532
1647
  "types": [
1648
+ {
1649
+ "name": "AddLiquidityArgs",
1650
+ "type": {
1651
+ "kind": "struct",
1652
+ "fields": [
1653
+ {
1654
+ "name": "amount",
1655
+ "type": "u64"
1656
+ },
1657
+ {
1658
+ "name": "direction",
1659
+ "type": {
1660
+ "defined": {
1661
+ "name": "OrderDirection"
1662
+ }
1663
+ }
1664
+ }
1665
+ ]
1666
+ }
1667
+ },
1533
1668
  {
1534
1669
  "name": "ClaimStakeRewardsArgs",
1535
1670
  "type": {
@@ -2539,7 +2674,7 @@
2539
2674
  }
2540
2675
  },
2541
2676
  {
2542
- "name": "status",
2677
+ "name": "is_locked",
2543
2678
  "type": {
2544
2679
  "option": "bool"
2545
2680
  }
@@ -2789,9 +2924,6 @@
2789
2924
  },
2790
2925
  {
2791
2926
  "name": "Flop"
2792
- },
2793
- {
2794
- "name": "Draw"
2795
2927
  }
2796
2928
  ]
2797
2929
  }
@@ -22,7 +22,7 @@ export type InitializeStakeArgs = {
22
22
  export type UpdateStakeVaultArgs = {
23
23
  wallet: PublicKey;
24
24
  amount?: BN;
25
- status?: boolean;
25
+ isLocked?: boolean;
26
26
  };
27
27
  export type RequestWithdrawArgs = {
28
28
  wallet: PublicKey;
@@ -13,6 +13,161 @@ export type TriadProtocol = {
13
13
  description: 'Triad protocol, trade solana projects';
14
14
  };
15
15
  instructions: [
16
+ {
17
+ name: 'addLiquidity';
18
+ discriminator: [181, 157, 89, 67, 143, 182, 52, 72];
19
+ accounts: [
20
+ {
21
+ name: 'signer';
22
+ writable: true;
23
+ signer: true;
24
+ },
25
+ {
26
+ name: 'market';
27
+ writable: true;
28
+ },
29
+ {
30
+ name: 'mint';
31
+ writable: true;
32
+ },
33
+ {
34
+ name: 'userFromAta';
35
+ writable: true;
36
+ pda: {
37
+ seeds: [
38
+ {
39
+ kind: 'account';
40
+ path: 'signer';
41
+ },
42
+ {
43
+ kind: 'account';
44
+ path: 'tokenProgram';
45
+ },
46
+ {
47
+ kind: 'account';
48
+ path: 'mint';
49
+ }
50
+ ];
51
+ program: {
52
+ kind: 'const';
53
+ value: [
54
+ 140,
55
+ 151,
56
+ 37,
57
+ 143,
58
+ 78,
59
+ 36,
60
+ 137,
61
+ 241,
62
+ 187,
63
+ 61,
64
+ 16,
65
+ 41,
66
+ 20,
67
+ 142,
68
+ 13,
69
+ 131,
70
+ 11,
71
+ 90,
72
+ 19,
73
+ 153,
74
+ 218,
75
+ 255,
76
+ 16,
77
+ 132,
78
+ 4,
79
+ 142,
80
+ 123,
81
+ 216,
82
+ 219,
83
+ 233,
84
+ 248,
85
+ 89
86
+ ];
87
+ };
88
+ };
89
+ },
90
+ {
91
+ name: 'marketToAta';
92
+ writable: true;
93
+ pda: {
94
+ seeds: [
95
+ {
96
+ kind: 'account';
97
+ path: 'market';
98
+ },
99
+ {
100
+ kind: 'account';
101
+ path: 'tokenProgram';
102
+ },
103
+ {
104
+ kind: 'account';
105
+ path: 'mint';
106
+ }
107
+ ];
108
+ program: {
109
+ kind: 'const';
110
+ value: [
111
+ 140,
112
+ 151,
113
+ 37,
114
+ 143,
115
+ 78,
116
+ 36,
117
+ 137,
118
+ 241,
119
+ 187,
120
+ 61,
121
+ 16,
122
+ 41,
123
+ 20,
124
+ 142,
125
+ 13,
126
+ 131,
127
+ 11,
128
+ 90,
129
+ 19,
130
+ 153,
131
+ 218,
132
+ 255,
133
+ 16,
134
+ 132,
135
+ 4,
136
+ 142,
137
+ 123,
138
+ 216,
139
+ 219,
140
+ 233,
141
+ 248,
142
+ 89
143
+ ];
144
+ };
145
+ };
146
+ },
147
+ {
148
+ name: 'tokenProgram';
149
+ address: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb';
150
+ },
151
+ {
152
+ name: 'associatedTokenProgram';
153
+ address: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
154
+ },
155
+ {
156
+ name: 'systemProgram';
157
+ address: '11111111111111111111111111111111';
158
+ }
159
+ ];
160
+ args: [
161
+ {
162
+ name: 'args';
163
+ type: {
164
+ defined: {
165
+ name: 'addLiquidityArgs';
166
+ };
167
+ };
168
+ }
169
+ ];
170
+ },
16
171
  {
17
172
  name: 'claimStakeRewards';
18
173
  discriminator: [107, 91, 233, 196, 211, 47, 218, 21];
@@ -362,22 +517,6 @@ export type TriadProtocol = {
362
517
  ];
363
518
  };
364
519
  },
365
- {
366
- name: 'userTrade';
367
- writable: true;
368
- pda: {
369
- seeds: [
370
- {
371
- kind: 'const';
372
- value: [117, 115, 101, 114, 95, 116, 114, 97, 100, 101];
373
- },
374
- {
375
- kind: 'account';
376
- path: 'signer';
377
- }
378
- ];
379
- };
380
- },
381
520
  {
382
521
  name: 'systemProgram';
383
522
  address: '11111111111111111111111111111111';
@@ -859,7 +998,16 @@ export type TriadProtocol = {
859
998
  address: '11111111111111111111111111111111';
860
999
  }
861
1000
  ];
862
- args: [];
1001
+ args: [
1002
+ {
1003
+ name: 'winningDirection';
1004
+ type: {
1005
+ defined: {
1006
+ name: 'winningDirection';
1007
+ };
1008
+ };
1009
+ }
1010
+ ];
863
1011
  },
864
1012
  {
865
1013
  name: 'settleOrder';
@@ -2055,9 +2203,54 @@ export type TriadProtocol = {
2055
2203
  code: 6041;
2056
2204
  name: 'orderNotOpen';
2057
2205
  msg: 'Order not open';
2206
+ },
2207
+ {
2208
+ code: 6042;
2209
+ name: 'hasOpenedOrders';
2210
+ msg: 'Has opened orders';
2211
+ },
2212
+ {
2213
+ code: 6043;
2214
+ name: 'insufficientLiquidity';
2215
+ msg: 'Insufficient liquidity';
2216
+ },
2217
+ {
2218
+ code: 6044;
2219
+ name: 'marketNotResolved';
2220
+ msg: 'Market not resolved';
2221
+ },
2222
+ {
2223
+ code: 6045;
2224
+ name: 'marketAlreadyResolved';
2225
+ msg: 'Market already resolved';
2226
+ },
2227
+ {
2228
+ code: 6046;
2229
+ name: 'concurrentTransaction';
2230
+ msg: 'Concurrent transaction';
2058
2231
  }
2059
2232
  ];
2060
2233
  types: [
2234
+ {
2235
+ name: 'addLiquidityArgs';
2236
+ type: {
2237
+ kind: 'struct';
2238
+ fields: [
2239
+ {
2240
+ name: 'amount';
2241
+ type: 'u64';
2242
+ },
2243
+ {
2244
+ name: 'direction';
2245
+ type: {
2246
+ defined: {
2247
+ name: 'orderDirection';
2248
+ };
2249
+ };
2250
+ }
2251
+ ];
2252
+ };
2253
+ },
2061
2254
  {
2062
2255
  name: 'claimStakeRewardsArgs';
2063
2256
  type: {
@@ -3065,7 +3258,7 @@ export type TriadProtocol = {
3065
3258
  };
3066
3259
  },
3067
3260
  {
3068
- name: 'status';
3261
+ name: 'isLocked';
3069
3262
  type: {
3070
3263
  option: 'bool';
3071
3264
  };
@@ -3315,9 +3508,6 @@ export type TriadProtocol = {
3315
3508
  },
3316
3509
  {
3317
3510
  name: 'flop';
3318
- },
3319
- {
3320
- name: 'draw';
3321
3511
  }
3322
3512
  ];
3323
3513
  };
@@ -21,7 +21,7 @@ const sendVersionedTransaction = (provider, ixs, options, payer, addressLookupTa
21
21
  instructions: ixs,
22
22
  recentBlockhash: blockhash,
23
23
  payerKey: provider.publicKey
24
- }).compileToV0Message(addressLookupTableAccounts || []));
24
+ }).compileToV0Message(addressLookupTableAccounts));
25
25
  if (payer) {
26
26
  tx.sign([payer]);
27
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "1.2.0-beta",
3
+ "version": "1.2.1-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",