@triadxyz/triad-protocol 1.2.7-beta → 1.2.8-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.
@@ -15,23 +15,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const fs_1 = __importDefault(require("fs"));
16
16
  const _1 = __importDefault(require("./"));
17
17
  const anchor_1 = require("@coral-xyz/anchor");
18
- const axios_1 = __importDefault(require("axios"));
19
18
  const web3_js_1 = require("@solana/web3.js");
20
19
  const spl_token_1 = require("@solana/spl-token");
21
- const file = fs_1.default.readFileSync('/Users/dannpl/.config/solana/id.json');
20
+ const file = fs_1.default.readFileSync('/Users/dannpl/.config/solana/triad.json');
22
21
  const rpc_file = fs_1.default.readFileSync('/Users/dannpl/.config/solana/rpc.txt');
23
22
  const keypair = web3_js_1.Keypair.fromSecretKey(new Uint8Array(JSON.parse(file.toString())));
24
- const connection = new web3_js_1.Connection('https://triad-solanam-a5ee.mainnet.rpcpool.com/34797434-86a9-4a15-abb1-6b5f6cb7a8ff');
23
+ const connection = new web3_js_1.Connection(rpc_file.toString());
25
24
  const wallet = new anchor_1.Wallet(keypair);
26
25
  const triadProtocol = new _1.default(connection, wallet);
27
26
  const mint = new web3_js_1.PublicKey('X41iRJUPkKaEvhqWdxqrS5P7M5d8A9oathki5sT47KR');
28
27
  const markets = [
29
28
  {
30
- marketId: 16,
31
- name: 'MIKExJAKE',
32
- question: 'Jake Paul vs. Mike Tyson: Who wins today?',
33
- startTime: 1731682800,
34
- endTime: 1731715200
29
+ marketId: 24,
30
+ question: 'Will $CORN be above $2.1M in MarketCap on November 22?',
31
+ startTime: 1732040456,
32
+ endTime: 1732935600
35
33
  }
36
34
  ];
37
35
  const ordersHypeAndFloopBot = [
@@ -46,7 +44,7 @@ const ordersHypeAndFloopBot = [
46
44
  const updateStakeVault = () => __awaiter(void 0, void 0, void 0, function* () {
47
45
  const response = yield triadProtocol.stake.updateStakeVault({
48
46
  wallet: wallet.publicKey,
49
- amount: new anchor_1.BN(8000 * Math.pow(10, 6)),
47
+ amount: new anchor_1.BN(3000 * Math.pow(10, 6)),
50
48
  isLocked: false
51
49
  });
52
50
  console.log(response);
@@ -55,25 +53,11 @@ const getStakeVault = () => __awaiter(void 0, void 0, void 0, function* () {
55
53
  const response = yield triadProtocol.stake.getStakeVaults();
56
54
  console.log(response);
57
55
  });
58
- const updateBoost = () => __awaiter(void 0, void 0, void 0, function* () {
59
- const response = (yield axios_1.default.get('http://localhost:8080/boost'))
60
- .data;
61
- const stakes = yield triadProtocol.stake.getStakes();
62
- const update = [];
63
- for (const stake of stakes) {
64
- if (update.length >= 10) {
65
- break;
66
- }
67
- if (response.includes(stake.mint) && !stake.boost) {
68
- update.push({ name: stake.name, wallet: stake.authority });
69
- }
70
- }
71
- console.log(update);
72
- const updateBoostResponse = yield triadProtocol.stake.updateBoost({
73
- wallet: wallet.publicKey,
74
- nfts: update
75
- });
76
- console.log(updateBoostResponse);
56
+ const getStaked = () => __awaiter(void 0, void 0, void 0, function* () {
57
+ const user = yield triadProtocol.getUser(new web3_js_1.PublicKey('3umHQwkz2r8E6K6xWJuSDziDoWgkWwRckDPGEYzD8TPf'));
58
+ const response = yield triadProtocol.stake.getUserStakes(new web3_js_1.PublicKey('3umHQwkz2r8E6K6xWJuSDziDoWgkWwRckDPGEYzD8TPf'));
59
+ console.log(user);
60
+ console.log(response);
77
61
  });
78
62
  const getAllMarkets = () => __awaiter(void 0, void 0, void 0, function* () {
79
63
  const markets = yield triadProtocol.trade.getAllMarkets();
@@ -89,10 +73,10 @@ const initializeAllMarkets = () => __awaiter(void 0, void 0, void 0, function* (
89
73
  const response = yield triadProtocol.trade.initializeMarket(market, {
90
74
  microLamports: 5000
91
75
  });
92
- console.log(`Initialized market ${market.name}:`, response);
76
+ console.log(`Initialized market ${market.question}:`, response);
93
77
  }
94
78
  catch (error) {
95
- console.error(`Error initializing market ${market.name}:`, error);
79
+ console.error(`Error initializing market ${market.question}:`, error);
96
80
  }
97
81
  }
98
82
  });
@@ -120,125 +104,35 @@ const getOrders = (walletAddress) => __awaiter(void 0, void 0, void 0, function*
120
104
  const getLiquidityToRecovery = () => __awaiter(void 0, void 0, void 0, function* () {
121
105
  const response = yield triadProtocol.program.account.userTrade.all();
122
106
  const allMarkets = yield triadProtocol.trade.getAllMarkets();
123
- const liquidityToRecovery = {
124
- 0: {
125
- name: 'triad',
126
- liquidityToPay: 0,
127
- sharesToPay: 0,
128
- openOrders: 0,
129
- medPrice: 0,
130
- direction: {
131
- flop: {}
132
- }
133
- },
134
- 1: {
135
- name: 'pyth',
136
- liquidityToPay: 0,
137
- sharesToPay: 0,
138
- openOrders: 0,
139
- medPrice: 0,
140
- direction: {
141
- flop: {}
142
- }
143
- },
144
- 2: {
145
- name: 'drift',
146
- liquidityToPay: 0,
147
- sharesToPay: 0,
148
- openOrders: 0,
149
- medPrice: 0,
150
- direction: {
151
- flop: {}
152
- }
153
- },
154
- 3: {
155
- name: 'symmetry',
156
- liquidityToPay: 0,
157
- sharesToPay: 0,
158
- openOrders: 0,
159
- medPrice: 0,
160
- direction: {
161
- flop: {}
162
- }
163
- },
164
- 4: {
165
- name: 'ore',
166
- liquidityToPay: 0,
167
- sharesToPay: 0,
168
- openOrders: 0,
169
- medPrice: 0,
170
- direction: {
171
- hype: {}
172
- }
173
- },
174
- 5: {
175
- name: 'coleta',
176
- liquidityToPay: 0,
177
- sharesToPay: 0,
178
- openOrders: 0,
179
- medPrice: 0,
180
- direction: {
181
- flop: {}
182
- }
183
- },
184
- 6: {
185
- name: 'undead',
186
- liquidityToPay: 0,
187
- sharesToPay: 0,
188
- openOrders: 0,
189
- medPrice: 0,
190
- direction: {
191
- hype: {}
192
- }
193
- },
194
- 7: {
195
- name: 'solxeth',
196
- liquidityToPay: 0,
197
- sharesToPay: 0,
198
- openOrders: 0,
199
- medPrice: 0,
200
- direction: {
201
- flop: {}
202
- }
203
- },
204
- 8: {
205
- name: 'solxeth2',
206
- liquidityToPay: 0,
207
- sharesToPay: 0,
208
- openOrders: 0,
209
- medPrice: 0,
210
- direction: {
211
- flop: {}
212
- }
213
- },
214
- 9: {
215
- name: 'solxeth3',
216
- liquidityToPay: 0,
217
- sharesToPay: 0,
218
- openOrders: 0,
219
- medPrice: 0,
220
- direction: {
221
- flop: {}
222
- }
223
- }
224
- };
107
+ const liquidityToRecovery = {};
225
108
  for (const market of allMarkets) {
226
109
  let currentMarket = liquidityToRecovery[market.marketId];
227
110
  if (!currentMarket) {
228
- continue;
111
+ currentMarket = {
112
+ address: market.address,
113
+ name: market.question,
114
+ liquidityToPay: 0,
115
+ sharesToPay: 0,
116
+ openOrders: 0,
117
+ direction: market.winningDirection.toLowerCase() === 'flop'
118
+ ? { flop: {} }
119
+ : { hype: {} },
120
+ totalLiquidity: 0
121
+ };
122
+ liquidityToRecovery[market.marketId] = currentMarket;
229
123
  }
124
+ currentMarket.totalLiquidity +=
125
+ parseFloat(market.flopLiquidity.toString()) / Math.pow(10, 6);
126
+ currentMarket.totalLiquidity +=
127
+ parseFloat(market.hypeLiquidity.toString()) / Math.pow(10, 6);
230
128
  if ('flop' in currentMarket.direction) {
231
129
  let shares = parseFloat(market.flopShares.toString()) / Math.pow(10, 6);
232
- currentMarket.medPrice =
233
- parseFloat(market.hypeLiquidity.toString()) / Math.pow(10, 6) / shares;
234
130
  currentMarket.sharesToPay = shares;
235
131
  currentMarket.liquidityToPay =
236
132
  parseFloat(market.hypeLiquidity.toString()) / Math.pow(10, 6);
237
133
  }
238
134
  else {
239
135
  let shares = parseFloat(market.hypeShares.toString()) / Math.pow(10, 6);
240
- currentMarket.medPrice =
241
- parseFloat(market.flopLiquidity.toString()) / Math.pow(10, 6) / shares;
242
136
  currentMarket.sharesToPay = shares;
243
137
  currentMarket.liquidityToPay =
244
138
  parseFloat(market.flopLiquidity.toString()) / Math.pow(10, 6);
@@ -257,6 +151,7 @@ const getLiquidityToRecovery = () => __awaiter(void 0, void 0, void 0, function*
257
151
  }
258
152
  console.log(liquidityToRecovery);
259
153
  });
154
+ getLiquidityToRecovery();
260
155
  const openOrder = () => __awaiter(void 0, void 0, void 0, function* () {
261
156
  yield getMarket();
262
157
  for (const order of ordersHypeAndFloopBot) {
@@ -312,7 +207,7 @@ const mintTokens = () => __awaiter(void 0, void 0, void 0, function* () {
312
207
  console.log(mintTx);
313
208
  });
314
209
  const resolveMarket = () => __awaiter(void 0, void 0, void 0, function* () {
315
- const marketsToResolve = [{ marketId: 16, winningDirection: { flop: {} } }];
210
+ const marketsToResolve = [{ marketId: 22, winningDirection: { hype: {} } }];
316
211
  for (const market of marketsToResolve) {
317
212
  const response = yield triadProtocol.trade.resolveMarket({
318
213
  marketId: market.marketId,
@@ -342,9 +237,9 @@ const collectFees = () => __awaiter(void 0, void 0, void 0, function* () {
342
237
  try {
343
238
  const response = yield triadProtocol.trade.collectFee({
344
239
  marketId: Number(market.marketId),
345
- vault: new web3_js_1.PublicKey('6fcSf6qfwPNR9AUUNC1UWYZDy5cQ4TzTb2aaipN2zFdq')
240
+ vault: new web3_js_1.PublicKey('Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4')
346
241
  }, {
347
- microLamports: 90000,
242
+ microLamports: 180000,
348
243
  skipPreflight: true
349
244
  });
350
245
  console.log(response);
@@ -353,7 +248,6 @@ const collectFees = () => __awaiter(void 0, void 0, void 0, function* () {
353
248
  console.log(e);
354
249
  }
355
250
  }
356
- fs_1.default.writeFileSync(`fees-collected.json`, JSON.stringify(currentFees, null, 2));
357
251
  });
358
252
  const mintTicket = () => __awaiter(void 0, void 0, void 0, function* () {
359
253
  console.log(wallet.publicKey.toBase58());
@@ -361,9 +255,10 @@ const mintTicket = () => __awaiter(void 0, void 0, void 0, function* () {
361
255
  discount: 0,
362
256
  isBoosted: false,
363
257
  rarity: { uncommon: {} },
364
- verifier: '',
365
- nftMint: new web3_js_1.PublicKey('')
258
+ verifier: '43bkRb3xj4Vv77Y76TjQuNiPGUsnun4tFSMYXY2Y2K5LfRT79YDpHhc7jruWmDGdygUBPXYQQZntCQz6V6cRGz8F',
259
+ nftMint: new web3_js_1.PublicKey('A5dk1WqN9qcq1ZaWEh1UaMJR3SQeAsMirEEnLWbpp6fu')
260
+ }, {
261
+ skipPreflight: true
366
262
  });
367
263
  console.log(response);
368
264
  });
369
- mintTicket();
package/dist/stake.d.ts CHANGED
@@ -2,7 +2,7 @@ import { AnchorProvider, Program } from '@coral-xyz/anchor';
2
2
  import { PublicKey } from '@solana/web3.js';
3
3
  import { TriadProtocol } from './types/triad_protocol';
4
4
  import { RpcOptions } from './types';
5
- import { UpdateStakeVaultArgs, RequestWithdrawArgs, WithdrawArgs, Stake as StakeResponse, ClaimStakeRewardsArgs, StakeTokenArgs, UpdateBoostArgs } from './types/stake';
5
+ import { UpdateStakeVaultArgs, RequestWithdrawArgs, WithdrawArgs, Stake as StakeResponse, ClaimStakeRewardsArgs, StakeTokenArgs } from './types/stake';
6
6
  export default class Stake {
7
7
  program: Program<TriadProtocol>;
8
8
  provider: AnchorProvider;
@@ -85,10 +85,18 @@ export default class Stake {
85
85
  isToken?: boolean;
86
86
  }, options?: RpcOptions): Promise<string>;
87
87
  /**
88
- * Update Boost
88
+ * Withdraw NFT
89
89
  * @param wallet - User wallet
90
- * @param nfts - Name of the nfts
90
+ * @param name - Stake name
91
+ * @param mint - NFT mint
91
92
  *
92
93
  */
93
- updateBoost({ wallet, nfts }: UpdateBoostArgs, options?: RpcOptions): Promise<string>;
94
+ withdrawNft({ wallet, name, nftMint, tokenMint, rank, collections }: {
95
+ wallet: PublicKey;
96
+ name: string;
97
+ nftMint: PublicKey;
98
+ tokenMint: PublicKey;
99
+ rank: number;
100
+ collections: number;
101
+ }, options?: RpcOptions): Promise<any>;
94
102
  }
package/dist/stake.js CHANGED
@@ -13,7 +13,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const anchor_1 = require("@coral-xyz/anchor");
16
- const web3_js_1 = require("@solana/web3.js");
17
16
  const helpers_1 = require("./utils/helpers");
18
17
  const stake_1 = require("./utils/pda/stake");
19
18
  const pda_1 = require("./utils/pda");
@@ -167,7 +166,6 @@ class Stake {
167
166
  requestWithdraw({ wallet, nfts }, options) {
168
167
  return __awaiter(this, void 0, void 0, function* () {
169
168
  const ixs = [];
170
- const stakeVaultPDA = (0, stake_1.getStakeVaultPDA)(this.program.programId, this.stakeVaultName);
171
169
  const userPDA = (0, pda_1.getUserPDA)(this.program.programId, wallet);
172
170
  for (const nft of nfts) {
173
171
  const stakePDA = (0, stake_1.getStakePDA)(this.program.programId, wallet, nft.name);
@@ -177,8 +175,7 @@ class Stake {
177
175
  signer: wallet,
178
176
  mint: nft.mint,
179
177
  user: userPDA,
180
- stake: stakePDA,
181
- stakeVault: stakeVaultPDA
178
+ stake: stakePDA
182
179
  })
183
180
  .instruction());
184
181
  }
@@ -256,25 +253,25 @@ class Stake {
256
253
  });
257
254
  }
258
255
  /**
259
- * Update Boost
256
+ * Withdraw NFT
260
257
  * @param wallet - User wallet
261
- * @param nfts - Name of the nfts
258
+ * @param name - Stake name
259
+ * @param mint - NFT mint
262
260
  *
263
261
  */
264
- updateBoost({ wallet, nfts }, options) {
262
+ withdrawNft({ wallet, name, nftMint, tokenMint, rank, collections }, options) {
265
263
  return __awaiter(this, void 0, void 0, function* () {
266
- const ixs = [];
267
- for (const nft of nfts) {
268
- const stakePDA = (0, stake_1.getStakePDA)(this.program.programId, new web3_js_1.PublicKey(nft.wallet), nft.name);
269
- ixs.push(yield this.program.methods
270
- .updateStakeBoost()
271
- .accounts({
272
- signer: wallet,
273
- stake: stakePDA
274
- })
275
- .instruction());
276
- }
277
- return (0, sendVersionedTransaction_1.default)(this.provider, ixs, options);
264
+ const stakeVaultPDA = (0, stake_1.getStakeVaultPDA)(this.program.programId, this.stakeVaultName);
265
+ const userPDA = (0, pda_1.getUserPDA)(this.program.programId, wallet);
266
+ const stakePDA = (0, stake_1.getStakePDA)(this.program.programId, wallet, name);
267
+ return (0, sendTransactionWithOptions_1.default)(this.program.methods.withdrawNft(rank, collections).accounts({
268
+ signer: this.provider.wallet.publicKey,
269
+ stake: stakePDA,
270
+ stakeVault: stakeVaultPDA,
271
+ tokenMint: tokenMint,
272
+ nftMint: nftMint,
273
+ user: userPDA
274
+ }), options);
278
275
  });
279
276
  }
280
277
  }
package/dist/trade.d.ts CHANGED
@@ -110,7 +110,7 @@ export default class Trade {
110
110
  * @param options - RPC options
111
111
  *
112
112
  */
113
- initializeMarket({ marketId, name, startTime, endTime, question }: InitializeMarketArgs, options?: RpcOptions): Promise<any>;
113
+ initializeMarket({ marketId, startTime, endTime, question }: InitializeMarketArgs, options?: RpcOptions): Promise<any>;
114
114
  /**
115
115
  * Open Order
116
116
  * @param marketId - The ID of the market
package/dist/trade.js CHANGED
@@ -84,12 +84,14 @@ class Trade {
84
84
  * @param options - RPC options
85
85
  *
86
86
  */
87
- initializeMarket({ marketId, name, startTime, endTime, question }, options) {
87
+ initializeMarket({ marketId, startTime, endTime, question }, options) {
88
88
  return __awaiter(this, void 0, void 0, function* () {
89
+ if (question.length > 80) {
90
+ throw new Error('Question must be less than 80 characters');
91
+ }
89
92
  return (0, sendTransactionWithOptions_1.default)(this.program.methods
90
93
  .initializeMarket({
91
94
  marketId: new bn_js_1.default(marketId),
92
- name: name,
93
95
  question: (0, helpers_1.encodeString)(question, 80),
94
96
  startTime: new bn_js_1.default(startTime),
95
97
  endTime: new bn_js_1.default(endTime)
@@ -946,10 +946,6 @@
946
946
  "writable": true,
947
947
  "signer": true
948
948
  },
949
- {
950
- "name": "stake_vault",
951
- "writable": true
952
- },
953
949
  {
954
950
  "name": "user",
955
951
  "writable": true
@@ -1261,26 +1257,6 @@
1261
1257
  }
1262
1258
  ]
1263
1259
  },
1264
- {
1265
- "name": "update_stake_boost",
1266
- "discriminator": [239, 85, 19, 140, 235, 236, 88, 70],
1267
- "accounts": [
1268
- {
1269
- "name": "signer",
1270
- "writable": true,
1271
- "signer": true
1272
- },
1273
- {
1274
- "name": "stake",
1275
- "writable": true
1276
- },
1277
- {
1278
- "name": "system_program",
1279
- "address": "11111111111111111111111111111111"
1280
- }
1281
- ],
1282
- "args": []
1283
- },
1284
1260
  {
1285
1261
  "name": "update_stake_vault",
1286
1262
  "discriminator": [84, 171, 100, 153, 126, 215, 229, 68],
@@ -1390,6 +1366,171 @@
1390
1366
  }
1391
1367
  ]
1392
1368
  },
1369
+ {
1370
+ "name": "withdraw_nft",
1371
+ "discriminator": [142, 181, 191, 149, 82, 175, 216, 100],
1372
+ "accounts": [
1373
+ {
1374
+ "name": "signer",
1375
+ "writable": true,
1376
+ "signer": true
1377
+ },
1378
+ {
1379
+ "name": "stake_vault",
1380
+ "writable": true
1381
+ },
1382
+ {
1383
+ "name": "user",
1384
+ "writable": true
1385
+ },
1386
+ {
1387
+ "name": "stake",
1388
+ "writable": true
1389
+ },
1390
+ {
1391
+ "name": "nft_mint",
1392
+ "writable": true
1393
+ },
1394
+ {
1395
+ "name": "token_mint",
1396
+ "writable": true
1397
+ },
1398
+ {
1399
+ "name": "nft_from_ata",
1400
+ "writable": true,
1401
+ "pda": {
1402
+ "seeds": [
1403
+ {
1404
+ "kind": "account",
1405
+ "path": "stake_vault"
1406
+ },
1407
+ {
1408
+ "kind": "account",
1409
+ "path": "token_program"
1410
+ },
1411
+ {
1412
+ "kind": "account",
1413
+ "path": "nft_mint"
1414
+ }
1415
+ ],
1416
+ "program": {
1417
+ "kind": "const",
1418
+ "value": [
1419
+ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
1420
+ 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
1421
+ 219, 233, 248, 89
1422
+ ]
1423
+ }
1424
+ }
1425
+ },
1426
+ {
1427
+ "name": "nft_to_ata",
1428
+ "writable": true,
1429
+ "pda": {
1430
+ "seeds": [
1431
+ {
1432
+ "kind": "account",
1433
+ "path": "user"
1434
+ },
1435
+ {
1436
+ "kind": "account",
1437
+ "path": "token_program"
1438
+ },
1439
+ {
1440
+ "kind": "account",
1441
+ "path": "nft_mint"
1442
+ }
1443
+ ],
1444
+ "program": {
1445
+ "kind": "const",
1446
+ "value": [
1447
+ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
1448
+ 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
1449
+ 219, 233, 248, 89
1450
+ ]
1451
+ }
1452
+ }
1453
+ },
1454
+ {
1455
+ "name": "token_from_ata",
1456
+ "writable": true,
1457
+ "pda": {
1458
+ "seeds": [
1459
+ {
1460
+ "kind": "account",
1461
+ "path": "stake_vault"
1462
+ },
1463
+ {
1464
+ "kind": "account",
1465
+ "path": "token_program"
1466
+ },
1467
+ {
1468
+ "kind": "account",
1469
+ "path": "token_mint"
1470
+ }
1471
+ ],
1472
+ "program": {
1473
+ "kind": "const",
1474
+ "value": [
1475
+ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
1476
+ 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
1477
+ 219, 233, 248, 89
1478
+ ]
1479
+ }
1480
+ }
1481
+ },
1482
+ {
1483
+ "name": "token_to_ata",
1484
+ "writable": true,
1485
+ "pda": {
1486
+ "seeds": [
1487
+ {
1488
+ "kind": "account",
1489
+ "path": "user"
1490
+ },
1491
+ {
1492
+ "kind": "account",
1493
+ "path": "token_program"
1494
+ },
1495
+ {
1496
+ "kind": "account",
1497
+ "path": "token_mint"
1498
+ }
1499
+ ],
1500
+ "program": {
1501
+ "kind": "const",
1502
+ "value": [
1503
+ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
1504
+ 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
1505
+ 219, 233, 248, 89
1506
+ ]
1507
+ }
1508
+ }
1509
+ },
1510
+ {
1511
+ "name": "token_program",
1512
+ "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
1513
+ },
1514
+ {
1515
+ "name": "associated_token_program",
1516
+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
1517
+ },
1518
+ {
1519
+ "name": "system_program",
1520
+ "address": "11111111111111111111111111111111"
1521
+ }
1522
+ ],
1523
+ "args": [
1524
+ {
1525
+ "name": "rank",
1526
+ "type": "u16"
1527
+ },
1528
+ {
1529
+ "name": "collections",
1530
+ "type": "f64"
1531
+ }
1532
+ ]
1533
+ },
1393
1534
  {
1394
1535
  "name": "withdraw_stake",
1395
1536
  "discriminator": [153, 8, 22, 138, 105, 176, 87, 66],
@@ -1851,10 +1992,6 @@
1851
1992
  "type": {
1852
1993
  "kind": "struct",
1853
1994
  "fields": [
1854
- {
1855
- "name": "name",
1856
- "type": "string"
1857
- },
1858
1995
  {
1859
1996
  "name": "market_id",
1860
1997
  "type": "u64"
@@ -2913,24 +3050,10 @@
2913
3050
  "type": "string"
2914
3051
  },
2915
3052
  {
2916
- "name": "swaps",
2917
- "type": "i16"
2918
- },
2919
- {
2920
- "name": "swaps_made",
2921
- "type": "i16"
2922
- },
2923
- {
2924
- "name": "staked",
2925
- "type": "u64"
2926
- },
2927
- {
2928
- "name": "first_swap",
2929
- "type": "i64"
2930
- },
2931
- {
2932
- "name": "user_trade",
2933
- "type": "pubkey"
3053
+ "name": "padding",
3054
+ "type": {
3055
+ "array": ["u8", 50]
3056
+ }
2934
3057
  }
2935
3058
  ]
2936
3059
  }
@@ -33,7 +33,4 @@ export type User = {
33
33
  referral: string;
34
34
  referred: number;
35
35
  name: string;
36
- swapsMade: number;
37
- swaps: number;
38
- staked: number;
39
36
  };
@@ -61,7 +61,6 @@ export type OpenOrderArgs = {
61
61
  };
62
62
  export type InitializeMarketArgs = {
63
63
  marketId: number;
64
- name: string;
65
64
  startTime: number;
66
65
  endTime: number;
67
66
  question: string;
@@ -1358,10 +1358,6 @@ export type TriadProtocol = {
1358
1358
  writable: true;
1359
1359
  signer: true;
1360
1360
  },
1361
- {
1362
- name: 'stakeVault';
1363
- writable: true;
1364
- },
1365
1361
  {
1366
1362
  name: 'user';
1367
1363
  writable: true;
@@ -1789,26 +1785,6 @@ export type TriadProtocol = {
1789
1785
  }
1790
1786
  ];
1791
1787
  },
1792
- {
1793
- name: 'updateStakeBoost';
1794
- discriminator: [239, 85, 19, 140, 235, 236, 88, 70];
1795
- accounts: [
1796
- {
1797
- name: 'signer';
1798
- writable: true;
1799
- signer: true;
1800
- },
1801
- {
1802
- name: 'stake';
1803
- writable: true;
1804
- },
1805
- {
1806
- name: 'systemProgram';
1807
- address: '11111111111111111111111111111111';
1808
- }
1809
- ];
1810
- args: [];
1811
- },
1812
1788
  {
1813
1789
  name: 'updateStakeVault';
1814
1790
  discriminator: [84, 171, 100, 153, 126, 215, 229, 68];
@@ -1976,6 +1952,287 @@ export type TriadProtocol = {
1976
1952
  }
1977
1953
  ];
1978
1954
  },
1955
+ {
1956
+ name: 'withdrawNft';
1957
+ discriminator: [142, 181, 191, 149, 82, 175, 216, 100];
1958
+ accounts: [
1959
+ {
1960
+ name: 'signer';
1961
+ writable: true;
1962
+ signer: true;
1963
+ },
1964
+ {
1965
+ name: 'stakeVault';
1966
+ writable: true;
1967
+ },
1968
+ {
1969
+ name: 'user';
1970
+ writable: true;
1971
+ },
1972
+ {
1973
+ name: 'stake';
1974
+ writable: true;
1975
+ },
1976
+ {
1977
+ name: 'nftMint';
1978
+ writable: true;
1979
+ },
1980
+ {
1981
+ name: 'tokenMint';
1982
+ writable: true;
1983
+ },
1984
+ {
1985
+ name: 'nftFromAta';
1986
+ writable: true;
1987
+ pda: {
1988
+ seeds: [
1989
+ {
1990
+ kind: 'account';
1991
+ path: 'stakeVault';
1992
+ },
1993
+ {
1994
+ kind: 'account';
1995
+ path: 'tokenProgram';
1996
+ },
1997
+ {
1998
+ kind: 'account';
1999
+ path: 'nftMint';
2000
+ }
2001
+ ];
2002
+ program: {
2003
+ kind: 'const';
2004
+ value: [
2005
+ 140,
2006
+ 151,
2007
+ 37,
2008
+ 143,
2009
+ 78,
2010
+ 36,
2011
+ 137,
2012
+ 241,
2013
+ 187,
2014
+ 61,
2015
+ 16,
2016
+ 41,
2017
+ 20,
2018
+ 142,
2019
+ 13,
2020
+ 131,
2021
+ 11,
2022
+ 90,
2023
+ 19,
2024
+ 153,
2025
+ 218,
2026
+ 255,
2027
+ 16,
2028
+ 132,
2029
+ 4,
2030
+ 142,
2031
+ 123,
2032
+ 216,
2033
+ 219,
2034
+ 233,
2035
+ 248,
2036
+ 89
2037
+ ];
2038
+ };
2039
+ };
2040
+ },
2041
+ {
2042
+ name: 'nftToAta';
2043
+ writable: true;
2044
+ pda: {
2045
+ seeds: [
2046
+ {
2047
+ kind: 'account';
2048
+ path: 'user';
2049
+ },
2050
+ {
2051
+ kind: 'account';
2052
+ path: 'tokenProgram';
2053
+ },
2054
+ {
2055
+ kind: 'account';
2056
+ path: 'nftMint';
2057
+ }
2058
+ ];
2059
+ program: {
2060
+ kind: 'const';
2061
+ value: [
2062
+ 140,
2063
+ 151,
2064
+ 37,
2065
+ 143,
2066
+ 78,
2067
+ 36,
2068
+ 137,
2069
+ 241,
2070
+ 187,
2071
+ 61,
2072
+ 16,
2073
+ 41,
2074
+ 20,
2075
+ 142,
2076
+ 13,
2077
+ 131,
2078
+ 11,
2079
+ 90,
2080
+ 19,
2081
+ 153,
2082
+ 218,
2083
+ 255,
2084
+ 16,
2085
+ 132,
2086
+ 4,
2087
+ 142,
2088
+ 123,
2089
+ 216,
2090
+ 219,
2091
+ 233,
2092
+ 248,
2093
+ 89
2094
+ ];
2095
+ };
2096
+ };
2097
+ },
2098
+ {
2099
+ name: 'tokenFromAta';
2100
+ writable: true;
2101
+ pda: {
2102
+ seeds: [
2103
+ {
2104
+ kind: 'account';
2105
+ path: 'stakeVault';
2106
+ },
2107
+ {
2108
+ kind: 'account';
2109
+ path: 'tokenProgram';
2110
+ },
2111
+ {
2112
+ kind: 'account';
2113
+ path: 'tokenMint';
2114
+ }
2115
+ ];
2116
+ program: {
2117
+ kind: 'const';
2118
+ value: [
2119
+ 140,
2120
+ 151,
2121
+ 37,
2122
+ 143,
2123
+ 78,
2124
+ 36,
2125
+ 137,
2126
+ 241,
2127
+ 187,
2128
+ 61,
2129
+ 16,
2130
+ 41,
2131
+ 20,
2132
+ 142,
2133
+ 13,
2134
+ 131,
2135
+ 11,
2136
+ 90,
2137
+ 19,
2138
+ 153,
2139
+ 218,
2140
+ 255,
2141
+ 16,
2142
+ 132,
2143
+ 4,
2144
+ 142,
2145
+ 123,
2146
+ 216,
2147
+ 219,
2148
+ 233,
2149
+ 248,
2150
+ 89
2151
+ ];
2152
+ };
2153
+ };
2154
+ },
2155
+ {
2156
+ name: 'tokenToAta';
2157
+ writable: true;
2158
+ pda: {
2159
+ seeds: [
2160
+ {
2161
+ kind: 'account';
2162
+ path: 'user';
2163
+ },
2164
+ {
2165
+ kind: 'account';
2166
+ path: 'tokenProgram';
2167
+ },
2168
+ {
2169
+ kind: 'account';
2170
+ path: 'tokenMint';
2171
+ }
2172
+ ];
2173
+ program: {
2174
+ kind: 'const';
2175
+ value: [
2176
+ 140,
2177
+ 151,
2178
+ 37,
2179
+ 143,
2180
+ 78,
2181
+ 36,
2182
+ 137,
2183
+ 241,
2184
+ 187,
2185
+ 61,
2186
+ 16,
2187
+ 41,
2188
+ 20,
2189
+ 142,
2190
+ 13,
2191
+ 131,
2192
+ 11,
2193
+ 90,
2194
+ 19,
2195
+ 153,
2196
+ 218,
2197
+ 255,
2198
+ 16,
2199
+ 132,
2200
+ 4,
2201
+ 142,
2202
+ 123,
2203
+ 216,
2204
+ 219,
2205
+ 233,
2206
+ 248,
2207
+ 89
2208
+ ];
2209
+ };
2210
+ };
2211
+ },
2212
+ {
2213
+ name: 'tokenProgram';
2214
+ address: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb';
2215
+ },
2216
+ {
2217
+ name: 'associatedTokenProgram';
2218
+ address: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
2219
+ },
2220
+ {
2221
+ name: 'systemProgram';
2222
+ address: '11111111111111111111111111111111';
2223
+ }
2224
+ ];
2225
+ args: [
2226
+ {
2227
+ name: 'rank';
2228
+ type: 'u16';
2229
+ },
2230
+ {
2231
+ name: 'collections';
2232
+ type: 'f64';
2233
+ }
2234
+ ];
2235
+ },
1979
2236
  {
1980
2237
  name: 'withdrawStake';
1981
2238
  discriminator: [153, 8, 22, 138, 105, 176, 87, 66];
@@ -2495,10 +2752,6 @@ export type TriadProtocol = {
2495
2752
  type: {
2496
2753
  kind: 'struct';
2497
2754
  fields: [
2498
- {
2499
- name: 'name';
2500
- type: 'string';
2501
- },
2502
2755
  {
2503
2756
  name: 'marketId';
2504
2757
  type: 'u64';
@@ -3553,24 +3806,10 @@ export type TriadProtocol = {
3553
3806
  type: 'string';
3554
3807
  },
3555
3808
  {
3556
- name: 'swaps';
3557
- type: 'i16';
3558
- },
3559
- {
3560
- name: 'swapsMade';
3561
- type: 'i16';
3562
- },
3563
- {
3564
- name: 'staked';
3565
- type: 'u64';
3566
- },
3567
- {
3568
- name: 'firstSwap';
3569
- type: 'i64';
3570
- },
3571
- {
3572
- name: 'userTrade';
3573
- type: 'pubkey';
3809
+ name: 'padding';
3810
+ type: {
3811
+ array: ['u8', 50];
3812
+ };
3574
3813
  }
3575
3814
  ];
3576
3815
  };
@@ -3,9 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.accountToMarketV1 = exports.formatMarket = exports.formatUser = exports.formatStake = exports.formatStakeVault = exports.decodeString = exports.encodeString = void 0;
4
4
  const trade_1 = require("../types/trade");
5
5
  const encodeString = (value, alloc = 32) => {
6
- const buffer = Buffer.alloc(alloc);
7
- buffer.fill(value);
8
- buffer.fill(' ', value.length);
6
+ const buffer = Buffer.alloc(alloc, 32);
7
+ buffer.write(value);
9
8
  return Array(...buffer);
10
9
  };
11
10
  exports.encodeString = encodeString;
@@ -56,9 +55,6 @@ const formatUser = (user) => {
56
55
  authority: user.authority.toBase58(),
57
56
  referral: user.referral,
58
57
  referred: user.referred.toNumber(),
59
- swapsMade: user.swapsMade,
60
- swaps: user.swaps,
61
- staked: user.staked.toNumber(),
62
58
  name: user.name
63
59
  };
64
60
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "1.2.7-beta",
3
+ "version": "1.2.8-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",