@triadxyz/triad-protocol 1.9.4-beta → 1.9.5-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/stake.d.ts CHANGED
@@ -26,10 +26,9 @@ export default class Stake {
26
26
  /**
27
27
  * Get Stake By Wallet
28
28
  * @param wallet - User Wallet
29
- * @param multiplier - Multiplier
30
29
  *
31
30
  */
32
- getStakeByWallet(wallet: PublicKey, collections: number): Promise<StakeResponse[]>;
31
+ getStakeByWallet(wallet: PublicKey): Promise<StakeResponse[]>;
33
32
  /**
34
33
  * Stake Token
35
34
  * @param args.name - Index for finding the PDA
@@ -78,14 +77,5 @@ export default class Stake {
78
77
  * @param options - RPC options
79
78
  *
80
79
  */
81
- claimStakeRewards({ wallet, collections, ranks, verifier }: {
82
- wallet: PublicKey;
83
- collections: number;
84
- ranks: {
85
- onchainId: string;
86
- name: string;
87
- rarityRankHrtt: number;
88
- }[];
89
- verifier: string;
90
- }, options?: RpcOptions): Promise<string>;
80
+ claimStakeRewards(wallet: PublicKey, options?: RpcOptions): Promise<string>;
91
81
  }
package/dist/stake.js CHANGED
@@ -18,7 +18,6 @@ const stake_1 = require("./utils/pda/stake");
18
18
  const constants_1 = require("./utils/constants");
19
19
  const sendVersionedTransaction_1 = __importDefault(require("./utils/sendVersionedTransaction"));
20
20
  const sendTransactionWithOptions_1 = __importDefault(require("./utils/sendTransactionWithOptions"));
21
- const convertSecretKeyToKeypair_1 = require("./utils/convertSecretKeyToKeypair");
22
21
  class Stake {
23
22
  constructor(program, provider) {
24
23
  this.program = program;
@@ -59,15 +58,14 @@ class Stake {
59
58
  /**
60
59
  * Get Stake By Wallet
61
60
  * @param wallet - User Wallet
62
- * @param multiplier - Multiplier
63
61
  *
64
62
  */
65
- getStakeByWallet(wallet, collections) {
63
+ getStakeByWallet(wallet) {
66
64
  return __awaiter(this, void 0, void 0, function* () {
67
65
  const response = yield this.getUserStakes(wallet);
68
66
  const data = [];
69
67
  for (const stake of response) {
70
- let available = (0, helpers_1.calculateStakeRewards)(stake, collections);
68
+ let available = (0, helpers_1.calculateStakeRewards)(stake);
71
69
  data.push(Object.assign(Object.assign({}, stake), { available }));
72
70
  }
73
71
  return data;
@@ -135,7 +133,6 @@ class Stake {
135
133
  .requestWithdrawStake()
136
134
  .accounts({
137
135
  signer: wallet,
138
- mint: nft.mint,
139
136
  stake: stakePDA
140
137
  })
141
138
  .instruction());
@@ -175,7 +172,7 @@ class Stake {
175
172
  * @param options - RPC options
176
173
  *
177
174
  */
178
- claimStakeRewards({ wallet, collections, ranks, verifier }, options) {
175
+ claimStakeRewards(wallet, options) {
179
176
  return __awaiter(this, void 0, void 0, function* () {
180
177
  const stakes = (yield this.getUserStakes(wallet)).sort((a, b) => a.claimedTs - b.claimedTs);
181
178
  const ixs = [];
@@ -193,20 +190,16 @@ class Stake {
193
190
  const stakeVaultPDA = (0, stake_1.getStakeVaultPDA)(this.program.programId, constants_1.STAKE_VAULT_NAME);
194
191
  const stakePDA = (0, stake_1.getStakePDA)(this.program.programId, wallet, stake.name);
195
192
  ixs.push(yield this.program.methods
196
- .claimStakeRewards({
197
- collections,
198
- rank: 963
199
- })
193
+ .claimStakeRewards()
200
194
  .accounts({
201
195
  signer: wallet,
202
196
  mint: constants_1.TRD_MINT,
203
197
  stake: stakePDA,
204
- stakeVault: stakeVaultPDA,
205
- verifier: constants_1.VERIFIER
198
+ stakeVault: stakeVaultPDA
206
199
  })
207
200
  .instruction());
208
201
  }
209
- return (0, sendVersionedTransaction_1.default)(this.provider, ixs, options, (0, convertSecretKeyToKeypair_1.convertSecretKeyToKeypair)(verifier));
202
+ return (0, sendVersionedTransaction_1.default)(this.provider, ixs, options);
210
203
  });
211
204
  }
212
205
  }
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, TransactionInstruction } from '@solana/web3.js';
4
- import { CreateMarketArgs, OpenOrderArgs, UserTrade, CreateCustomerArgs, Order, MarketBidOrderArgs, UpdateMarketAdminArgs, CancelBidOrderArgs, CancelAskOrderArgs, PlaceBidOrderArgs, PlaceAskOrderArgs } from './types/trade';
4
+ import { CreateMarketArgs, OpenOrderArgs, UserTrade, CreateCustomerArgs, Order, MarketBidOrderArgs, CancelBidOrderArgs, CancelAskOrderArgs, PlaceBidOrderArgs, PlaceAskOrderArgs } from './types/trade';
5
5
  import { RpcOptions } from './types';
6
6
  import BN from 'bn.js';
7
7
  export default class Trade {
@@ -344,12 +344,4 @@ export default class Trade {
344
344
  ask: Order[];
345
345
  };
346
346
  }>;
347
- /**
348
- * Update Market Admin
349
- * @param args.payoutFee - The payout fee of the market
350
- * @param args.feeBps - The fee bps of the market
351
- *
352
- * @param options - RPC options
353
- */
354
- updateMarketAdmin(args: UpdateMarketAdminArgs, options?: RpcOptions): Promise<string>;
355
347
  }
package/dist/trade.js CHANGED
@@ -232,9 +232,6 @@ class Trade {
232
232
  return __awaiter(this, void 0, void 0, function* () {
233
233
  const marketPDA = (0, trade_2.getMarketPDA)(this.program.programId, marketId);
234
234
  const market = yield this.getMarketByAddress(marketPDA);
235
- if (market.isAllowedToPayout) {
236
- return;
237
- }
238
235
  return (0, sendTransactionWithOptions_1.default)(this.program.methods.collectRemainingLiquidity().accounts({
239
236
  signer: this.provider.publicKey,
240
237
  market: marketPDA,
@@ -670,21 +667,5 @@ class Trade {
670
667
  return orderBook;
671
668
  });
672
669
  }
673
- /**
674
- * Update Market Admin
675
- * @param args.payoutFee - The payout fee of the market
676
- * @param args.feeBps - The fee bps of the market
677
- *
678
- * @param options - RPC options
679
- */
680
- updateMarketAdmin(args, options) {
681
- return __awaiter(this, void 0, void 0, function* () {
682
- const marketPDA = (0, trade_2.getMarketPDA)(this.program.programId, args.marketId);
683
- return (0, sendTransactionWithOptions_1.default)(this.program.methods.updateMarketAdmin(args).accounts({
684
- signer: this.provider.publicKey,
685
- market: marketPDA
686
- }), options);
687
- });
688
- }
689
670
  }
690
671
  exports.default = Trade;
@@ -202,11 +202,6 @@
202
202
  "writable": true,
203
203
  "signer": true
204
204
  },
205
- {
206
- "name": "verifier",
207
- "writable": true,
208
- "signer": true
209
- },
210
205
  {
211
206
  "name": "stake_vault",
212
207
  "writable": true
@@ -288,16 +283,7 @@
288
283
  "address": "11111111111111111111111111111111"
289
284
  }
290
285
  ],
291
- "args": [
292
- {
293
- "name": "args",
294
- "type": {
295
- "defined": {
296
- "name": "ClaimStakeRewardsArgs"
297
- }
298
- }
299
- }
300
- ],
286
+ "args": [],
301
287
  "returns": "u64"
302
288
  },
303
289
  {
@@ -1099,7 +1085,7 @@
1099
1085
  }
1100
1086
  },
1101
1087
  {
1102
- "name": "market_vault",
1088
+ "name": "market_ata",
1103
1089
  "writable": true,
1104
1090
  "pda": {
1105
1091
  "seeds": [
@@ -1127,8 +1113,7 @@
1127
1113
  }
1128
1114
  },
1129
1115
  {
1130
- "name": "token_program",
1131
- "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
1116
+ "name": "token_program"
1132
1117
  },
1133
1118
  {
1134
1119
  "name": "associated_token_program",
@@ -1343,14 +1328,6 @@
1343
1328
  "name": "stake",
1344
1329
  "writable": true
1345
1330
  },
1346
- {
1347
- "name": "mint",
1348
- "writable": true
1349
- },
1350
- {
1351
- "name": "token_program",
1352
- "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
1353
- },
1354
1331
  {
1355
1332
  "name": "system_program",
1356
1333
  "address": "11111111111111111111111111111111"
@@ -1594,35 +1571,6 @@
1594
1571
  }
1595
1572
  ]
1596
1573
  },
1597
- {
1598
- "name": "update_market_admin",
1599
- "discriminator": [167, 63, 152, 152, 112, 165, 97, 114],
1600
- "accounts": [
1601
- {
1602
- "name": "signer",
1603
- "writable": true,
1604
- "signer": true
1605
- },
1606
- {
1607
- "name": "market",
1608
- "writable": true
1609
- },
1610
- {
1611
- "name": "system_program",
1612
- "address": "11111111111111111111111111111111"
1613
- }
1614
- ],
1615
- "args": [
1616
- {
1617
- "name": "args",
1618
- "type": {
1619
- "defined": {
1620
- "name": "UpdateMarketAdminArgs"
1621
- }
1622
- }
1623
- }
1624
- ]
1625
- },
1626
1574
  {
1627
1575
  "name": "update_stake_vault",
1628
1576
  "discriminator": [84, 171, 100, 153, 126, 215, 229, 68],
@@ -2132,22 +2080,6 @@
2132
2080
  ]
2133
2081
  }
2134
2082
  },
2135
- {
2136
- "name": "ClaimStakeRewardsArgs",
2137
- "type": {
2138
- "kind": "struct",
2139
- "fields": [
2140
- {
2141
- "name": "rank",
2142
- "type": "u16"
2143
- },
2144
- {
2145
- "name": "collections",
2146
- "type": "u8"
2147
- }
2148
- ]
2149
- }
2150
- },
2151
2083
  {
2152
2084
  "name": "Collection",
2153
2085
  "type": {
@@ -3152,26 +3084,6 @@
3152
3084
  ]
3153
3085
  }
3154
3086
  },
3155
- {
3156
- "name": "UpdateMarketAdminArgs",
3157
- "type": {
3158
- "kind": "struct",
3159
- "fields": [
3160
- {
3161
- "name": "payout_fee",
3162
- "type": {
3163
- "option": "u16"
3164
- }
3165
- },
3166
- {
3167
- "name": "fee_bps",
3168
- "type": {
3169
- "option": "u16"
3170
- }
3171
- }
3172
- ]
3173
- }
3174
- },
3175
3087
  {
3176
3088
  "name": "UpdateStakeVaultArgs",
3177
3089
  "type": {
@@ -176,8 +176,3 @@ export type MarketBidOrderArgs = {
176
176
  };
177
177
  mint: PublicKey;
178
178
  };
179
- export type UpdateMarketAdminArgs = {
180
- marketId: number;
181
- payoutFee: number | null;
182
- feeBps: number | null;
183
- };
@@ -266,11 +266,6 @@ export type TriadProtocol = {
266
266
  writable: true;
267
267
  signer: true;
268
268
  },
269
- {
270
- name: 'verifier';
271
- writable: true;
272
- signer: true;
273
- },
274
269
  {
275
270
  name: 'stakeVault';
276
271
  writable: true;
@@ -410,16 +405,7 @@ export type TriadProtocol = {
410
405
  address: '11111111111111111111111111111111';
411
406
  }
412
407
  ];
413
- args: [
414
- {
415
- name: 'args';
416
- type: {
417
- defined: {
418
- name: 'claimStakeRewardsArgs';
419
- };
420
- };
421
- }
422
- ];
408
+ args: [];
423
409
  returns: 'u64';
424
410
  },
425
411
  {
@@ -1540,7 +1526,7 @@ export type TriadProtocol = {
1540
1526
  };
1541
1527
  },
1542
1528
  {
1543
- name: 'marketVault';
1529
+ name: 'marketAta';
1544
1530
  writable: true;
1545
1531
  pda: {
1546
1532
  seeds: [
@@ -1598,7 +1584,6 @@ export type TriadProtocol = {
1598
1584
  },
1599
1585
  {
1600
1586
  name: 'tokenProgram';
1601
- address: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb';
1602
1587
  },
1603
1588
  {
1604
1589
  name: 'associatedTokenProgram';
@@ -1871,14 +1856,6 @@ export type TriadProtocol = {
1871
1856
  name: 'stake';
1872
1857
  writable: true;
1873
1858
  },
1874
- {
1875
- name: 'mint';
1876
- writable: true;
1877
- },
1878
- {
1879
- name: 'tokenProgram';
1880
- address: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb';
1881
- },
1882
1859
  {
1883
1860
  name: 'systemProgram';
1884
1861
  address: '11111111111111111111111111111111';
@@ -2180,35 +2157,6 @@ export type TriadProtocol = {
2180
2157
  }
2181
2158
  ];
2182
2159
  },
2183
- {
2184
- name: 'updateMarketAdmin';
2185
- discriminator: [167, 63, 152, 152, 112, 165, 97, 114];
2186
- accounts: [
2187
- {
2188
- name: 'signer';
2189
- writable: true;
2190
- signer: true;
2191
- },
2192
- {
2193
- name: 'market';
2194
- writable: true;
2195
- },
2196
- {
2197
- name: 'systemProgram';
2198
- address: '11111111111111111111111111111111';
2199
- }
2200
- ];
2201
- args: [
2202
- {
2203
- name: 'args';
2204
- type: {
2205
- defined: {
2206
- name: 'updateMarketAdminArgs';
2207
- };
2208
- };
2209
- }
2210
- ];
2211
- },
2212
2160
  {
2213
2161
  name: 'updateStakeVault';
2214
2162
  discriminator: [84, 171, 100, 153, 126, 215, 229, 68];
@@ -2834,22 +2782,6 @@ export type TriadProtocol = {
2834
2782
  ];
2835
2783
  };
2836
2784
  },
2837
- {
2838
- name: 'claimStakeRewardsArgs';
2839
- type: {
2840
- kind: 'struct';
2841
- fields: [
2842
- {
2843
- name: 'rank';
2844
- type: 'u16';
2845
- },
2846
- {
2847
- name: 'collections';
2848
- type: 'u8';
2849
- }
2850
- ];
2851
- };
2852
- },
2853
2785
  {
2854
2786
  name: 'collection';
2855
2787
  type: {
@@ -3854,26 +3786,6 @@ export type TriadProtocol = {
3854
3786
  ];
3855
3787
  };
3856
3788
  },
3857
- {
3858
- name: 'updateMarketAdminArgs';
3859
- type: {
3860
- kind: 'struct';
3861
- fields: [
3862
- {
3863
- name: 'payoutFee';
3864
- type: {
3865
- option: 'u16';
3866
- };
3867
- },
3868
- {
3869
- name: 'feeBps';
3870
- type: {
3871
- option: 'u16';
3872
- };
3873
- }
3874
- ];
3875
- };
3876
- },
3877
3789
  {
3878
3790
  name: 'updateStakeVaultArgs';
3879
3791
  type: {
@@ -1,6 +1,6 @@
1
1
  import { Stake, StakeVault } from './../types/stake';
2
2
  import { Market, Order, OrderDirection, OrderSide, OrderStatus, OrderType, UserTrade } from '../types/trade';
3
- import { PublicKey, AddressLookupTableAccount } from '@solana/web3.js';
3
+ import { PublicKey } from '@solana/web3.js';
4
4
  export declare const encodeString: (value: string, alloc?: number) => number[];
5
5
  export declare const decodeString: (bytes: number[]) => string;
6
6
  export declare const formatStakeVault: (stakeVault: any) => StakeVault;
@@ -8,7 +8,7 @@ export declare const formatStake: (stake: any) => Stake;
8
8
  export declare const formatMarket: (account: any, address: PublicKey) => Market;
9
9
  export declare const formatOrder: (order: any, authority?: string) => Order;
10
10
  export declare const formatUserTrade: (account: any, publicKey: PublicKey) => UserTrade;
11
- export declare const calculateStakeRewards: (stake: Stake, multiplier: number) => number;
11
+ export declare const calculateStakeRewards: (stake: Stake) => number;
12
12
  export declare const getTokenProgram: (mint: PublicKey) => PublicKey;
13
13
  export declare const getOrderDirection: (direction: {
14
14
  hype: {};
@@ -38,4 +38,3 @@ export declare const getOrderStatus: (status: {
38
38
  } | {
39
39
  waiting: {};
40
40
  }) => OrderStatus;
41
- export declare const defaultLookupTable: AddressLookupTableAccount;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaultLookupTable = exports.getOrderStatus = exports.getOrderSide = exports.getOrderType = exports.getOrderDirection = exports.getTokenProgram = exports.calculateStakeRewards = exports.formatUserTrade = exports.formatOrder = exports.formatMarket = exports.formatStake = exports.formatStakeVault = exports.decodeString = exports.encodeString = void 0;
3
+ exports.getOrderStatus = exports.getOrderSide = exports.getOrderType = exports.getOrderDirection = exports.getTokenProgram = exports.calculateStakeRewards = exports.formatUserTrade = exports.formatOrder = exports.formatMarket = exports.formatStake = exports.formatStakeVault = exports.decodeString = exports.encodeString = void 0;
4
4
  const trade_1 = require("../types/trade");
5
- const web3_js_1 = require("@solana/web3.js");
6
5
  const constants_1 = require("./constants");
7
6
  const spl_token_1 = require("@solana/spl-token");
8
7
  const spl_token_2 = require("@solana/spl-token");
@@ -123,19 +122,16 @@ const formatUserTrade = (account, publicKey) => {
123
122
  };
124
123
  };
125
124
  exports.formatUserTrade = formatUserTrade;
126
- const calculateStakeRewards = (stake, multiplier) => {
125
+ const calculateStakeRewards = (stake) => {
127
126
  if (stake.withdrawTs !== 0)
128
127
  return 0;
129
- if (multiplier > 3)
130
- return 0;
131
- const collectionsMultiplier = multiplier * 150;
132
128
  const maxRank = 1633;
133
- const rank = 963;
129
+ const rank = 639;
134
130
  const rankWeight = (maxRank - rank + 1) / maxRank;
135
131
  const userStakedAmount = stake.mint === constants_1.TRD_MINT.toBase58()
136
132
  ? stake.amount
137
133
  : stake.amount * 10000 * Math.pow(10, constants_1.TRD_DECIMALS);
138
- const formattedAmount = userStakedAmount / Math.pow(10, constants_1.TRD_DECIMALS) + collectionsMultiplier;
134
+ const formattedAmount = userStakedAmount / Math.pow(10, constants_1.TRD_DECIMALS);
139
135
  const adjustedAmount = formattedAmount * rankWeight;
140
136
  const lastClaim = stake.claimedTs === 0 ? stake.initTs : stake.claimedTs;
141
137
  const currentTime = Math.floor(Date.now() / 1000);
@@ -193,19 +189,3 @@ const getOrderStatus = (status) => {
193
189
  }
194
190
  };
195
191
  exports.getOrderStatus = getOrderStatus;
196
- exports.defaultLookupTable = {
197
- isActive: () => true,
198
- key: new web3_js_1.PublicKey('A2wLWeXEHjmeRvSAyijS9ofv87N1GzFyQfdYPgPoQhZf'),
199
- state: {
200
- deactivationSlot: BigInt(18446744073709551615),
201
- lastExtendedSlot: 328789868,
202
- lastExtendedSlotStartIndex: 0,
203
- authority: new web3_js_1.PublicKey('82ppCojm3yrEKgdpH8B5AmBJTU1r1uAWXFWhxvPs9UCR'),
204
- addresses: [
205
- new web3_js_1.PublicKey('t3DohmswhKk94PPbPYwA6ZKACyY3y5kbcqeQerAJjmV'),
206
- new web3_js_1.PublicKey('6fcSf6qfwPNR9AUUNC1UWYZDy5cQ4TzTb2aaipN2zFdq'),
207
- new web3_js_1.PublicKey('TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'),
208
- new web3_js_1.PublicKey('ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL')
209
- ]
210
- }
211
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "1.9.4-beta",
3
+ "version": "1.9.5-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",