@triadxyz/triad-protocol 1.4.6-beta → 1.4.7-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.d.ts CHANGED
@@ -3,7 +3,7 @@ import { Connection, Keypair, PublicKey } from '@solana/web3.js';
3
3
  import { TriadProtocol } from './types/triad_protocol';
4
4
  import Trade from './trade';
5
5
  import Stake from './stake';
6
- import { CreateUserArgs, MintTicketArgs, PrizeType, RpcOptions } from './types';
6
+ import { CreateUserArgs, MintTicketArgs, PrizeType, RpcOptions, TransferPoseidonArgs } from './types';
7
7
  export default class TriadProtocolClient {
8
8
  program: Program<TriadProtocol>;
9
9
  provider: AnchorProvider;
@@ -325,4 +325,11 @@ export default class TriadProtocolClient {
325
325
  *
326
326
  */
327
327
  buyToken(amount: number, options?: RpcOptions): Promise<string>;
328
+ /**
329
+ * Transfer Poseidon
330
+ * @param args - Transfer Poseidon args
331
+ * @param options - RPC options
332
+ *
333
+ */
334
+ transferPoseidon({ poseidonAsset, ticketAsset, verifier, ticketNumber }: TransferPoseidonArgs, options?: RpcOptions): Promise<string>;
328
335
  }
package/dist/index.js CHANGED
@@ -148,13 +148,13 @@ class TriadProtocolClient {
148
148
  return __awaiter(this, void 0, void 0, function* () {
149
149
  const asset = web3_js_1.Keypair.generate();
150
150
  const userNftAta = (0, pda_1.getTokenATA)(this.provider.wallet.publicKey, nftMint);
151
- const collectionSymbol = 'PTCKT';
152
- const [collection] = yield this.program.account.collection.all();
151
+ const CollectionPDA = (0, pda_1.getCollectionPDA)(this.program.programId, constants_1.TICKET_COLLECTION_SYMBOL);
152
+ const collection = yield this.program.account.collection.fetch(CollectionPDA);
153
153
  const ixs = [];
154
154
  ixs.push(yield this.program.methods
155
155
  .mintTicket({
156
- number: new anchor_1.BN(collection.account.minted),
157
- collectionSymbol,
156
+ number: new anchor_1.BN(collection.minted),
157
+ collectionSymbol: constants_1.TICKET_COLLECTION_SYMBOL,
158
158
  discount: new anchor_1.BN(discount),
159
159
  isBoosted,
160
160
  rarity
@@ -285,5 +285,34 @@ class TriadProtocolClient {
285
285
  return (0, sendTransactionWithOptions_1.default)(method, options);
286
286
  });
287
287
  }
288
+ /**
289
+ * Transfer Poseidon
290
+ * @param args - Transfer Poseidon args
291
+ * @param options - RPC options
292
+ *
293
+ */
294
+ transferPoseidon({ poseidonAsset, ticketAsset, verifier, ticketNumber }, options) {
295
+ return __awaiter(this, void 0, void 0, function* () {
296
+ const ixs = [];
297
+ const PoseidonCollectionPDA = (0, pda_1.getCollectionPDA)(this.program.programId, constants_1.POSEIDON_COLLECTION_SYMBOL);
298
+ const TicketCollectionPDA = (0, pda_1.getCollectionPDA)(this.program.programId, constants_1.TICKET_COLLECTION_SYMBOL);
299
+ const NftPDA = (0, pda_1.getNftPDA)(this.program.programId, ticketNumber);
300
+ ixs.push(yield this.program.methods
301
+ .transferPoseidon()
302
+ .accounts({
303
+ signer: this.provider.wallet.publicKey,
304
+ nft: NftPDA,
305
+ poseidonAsset,
306
+ ticketAsset,
307
+ verifier: constants_1.VERIFIER,
308
+ poseidonCollection: PoseidonCollectionPDA,
309
+ ticketCollection: TicketCollectionPDA,
310
+ coreTicketCollection: constants_1.TICKET_CORE_COLLECTION,
311
+ corePoseidonCollection: constants_1.POSEIDON_CORE_COLLECTION
312
+ })
313
+ .instruction());
314
+ return (0, sendVersionedTransaction_1.default)(this.provider, ixs, options, undefined, [], verifier);
315
+ });
316
+ }
288
317
  }
289
318
  exports.default = TriadProtocolClient;
@@ -19,10 +19,10 @@ const web3_js_1 = require("@solana/web3.js");
19
19
  const trade_1 = require("./types/trade");
20
20
  const spl_token_1 = require("@solana/spl-token");
21
21
  const constants_1 = require("./utils/constants");
22
- const file = fs_1.default.readFileSync('/Users/dannpl/.config/solana/id.json');
22
+ const file = fs_1.default.readFileSync('/Users/dannpl/.config/solana/triad-man.json');
23
23
  const rpc_file = fs_1.default.readFileSync('/Users/dannpl/.config/solana/rpc.txt');
24
24
  const keypair = web3_js_1.Keypair.fromSecretKey(new Uint8Array(JSON.parse(file.toString())));
25
- const connection = new web3_js_1.Connection('https://mainnet.helius-rpc.com/?api-key=05843ded-2085-4567-aff3-85af84ea71d2');
25
+ const connection = new web3_js_1.Connection(rpc_file.toString());
26
26
  const wallet = new anchor_1.Wallet(keypair);
27
27
  const triadProtocol = new _1.default(connection, wallet);
28
28
  const markets = [
@@ -54,6 +54,18 @@ const getStakeVault = () => __awaiter(void 0, void 0, void 0, function* () {
54
54
  const response = yield triadProtocol.stake.getStakeVaults();
55
55
  console.log(response);
56
56
  });
57
+ const getStakeByWallet = () => __awaiter(void 0, void 0, void 0, function* () {
58
+ const response = yield triadProtocol.stake.getStakeByWallet(new web3_js_1.PublicKey('4k8qFA1i7fv6YGWJnoLZPSHj9nhLn3bokAdXWnuAteBV'), 1);
59
+ let sum = 0;
60
+ for (const stake of response) {
61
+ sum += stake.amount / Math.pow(10, 6);
62
+ }
63
+ console.log(sum);
64
+ });
65
+ const getAllStakes = () => __awaiter(void 0, void 0, void 0, function* () {
66
+ const stakes = yield triadProtocol.stake.getStakes();
67
+ console.log(stakes.length);
68
+ });
57
69
  const getStakes = () => __awaiter(void 0, void 0, void 0, function* () {
58
70
  const stakes = yield triadProtocol.stake.getStakes();
59
71
  fs_1.default.writeFileSync('stakes.json', JSON.stringify(stakes, null, 2));
@@ -428,78 +440,78 @@ const getMinteds = () => __awaiter(void 0, void 0, void 0, function* () {
428
440
  // ];
429
441
  const addSpinPrize = () => __awaiter(void 0, void 0, void 0, function* () {
430
442
  const data = [
431
- // {
432
- // rangeMin: 1,
433
- // rangeMax: 9,
434
- // prizeType: { trd10000: {} },
435
- // availableQuantity: 1
436
- // },
437
- // {
438
- // rangeMin: 10,
439
- // rangeMax: 15,
440
- // prizeType: { undead: {} },
441
- // availableQuantity: 1
442
- // },
443
- // {
444
- // rangeMin: 16,
445
- // rangeMax: 116,
446
- // prizeType: { ticket: {} },
447
- // availableQuantity: 2
448
- // }
449
- // {
450
- // rangeMin: 117,
451
- // rangeMax: 617,
452
- // prizeType: { honeyland: {} },
453
- // availableQuantity: 2
454
- // }
455
- // {
456
- // rangeMin: 618,
457
- // rangeMax: 5618,
458
- // prizeType: { trd50: {} },
459
- // availableQuantity: 100
460
- // },
461
- // {
462
- // rangeMin: 5619,
463
- // rangeMax: 15619,
464
- // prizeType: { flip: {} },
465
- // availableQuantity: 30
466
- // }
467
- // {
468
- // rangeMin: 15620,
469
- // rangeMax: 25620,
470
- // prizeType: { pengu: {} },
471
- // availableQuantity: 100
472
- // }
473
- // {
474
- // rangeMin: 25621,
475
- // rangeMax: 65621,
476
- // prizeType: { ore: {} },
477
- // availableQuantity: 200
478
- // }
479
- // {
480
- // rangeMin: 65622,
481
- // rangeMax: 165622,
482
- // prizeType: { lucksea: {} },
483
- // availableQuantity: 2000
484
- // },
485
- // {
486
- // rangeMin: 165623,
487
- // rangeMax: 285623,
488
- // prizeType: { trd5: {} },
489
- // availableQuantity: 10000
490
- // },
491
- // {
492
- // rangeMin: 285624,
493
- // rangeMax: 499999,
494
- // prizeType: { trident2000: {} },
495
- // availableQuantity: 5000000
496
- // },
497
- // {
498
- // rangeMin: 500000,
499
- // rangeMax: 1000000,
500
- // prizeType: { trident500: {} },
501
- // availableQuantity: 5000000
502
- // }
443
+ // {
444
+ // rangeMin: 1,
445
+ // rangeMax: 9,
446
+ // prizeType: { trd10000: {} },
447
+ // availableQuantity: 1
448
+ // },
449
+ // {
450
+ // rangeMin: 10,
451
+ // rangeMax: 15,
452
+ // prizeType: { undead: {} },
453
+ // availableQuantity: 1
454
+ // },
455
+ // {
456
+ // rangeMin: 16,
457
+ // rangeMax: 116,
458
+ // prizeType: { ticket: {} },
459
+ // availableQuantity: 2
460
+ // }
461
+ // {
462
+ // rangeMin: 117,
463
+ // rangeMax: 617,
464
+ // prizeType: { honeyland: {} },
465
+ // availableQuantity: 2
466
+ // }
467
+ // {
468
+ // rangeMin: 618,
469
+ // rangeMax: 5618,
470
+ // prizeType: { trd50: {} },
471
+ // availableQuantity: 50
472
+ // },
473
+ // {
474
+ // rangeMin: 5619,
475
+ // rangeMax: 15619,
476
+ // prizeType: { flip: {} },
477
+ // availableQuantity: 1
478
+ // },
479
+ {
480
+ rangeMin: 15620,
481
+ rangeMax: 25620,
482
+ prizeType: { pengu: {} },
483
+ availableQuantity: 3 + 7
484
+ },
485
+ {
486
+ rangeMin: 25621,
487
+ rangeMax: 65621,
488
+ prizeType: { ore: {} },
489
+ availableQuantity: 13
490
+ },
491
+ {
492
+ rangeMin: 65622,
493
+ rangeMax: 165622,
494
+ prizeType: { lucksea: {} },
495
+ availableQuantity: 18
496
+ }
497
+ // {
498
+ // rangeMin: 165623,
499
+ // rangeMax: 285623,
500
+ // prizeType: { trd5: {} },
501
+ // availableQuantity: 10000
502
+ // },
503
+ // {
504
+ // rangeMin: 285624,
505
+ // rangeMax: 499999,
506
+ // prizeType: { trident2000: {} },
507
+ // availableQuantity: 5000000
508
+ // },
509
+ // {
510
+ // rangeMin: 500000,
511
+ // rangeMax: 1000000,
512
+ // prizeType: { trident500: {} },
513
+ // availableQuantity: 5000000
514
+ // }
503
515
  ];
504
516
  for (const item of data) {
505
517
  const response = yield triadProtocol.addSpinPrize(item);
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 } from './types/stake';
5
+ import { UpdateStakeVaultArgs, RequestWithdrawArgs, WithdrawArgs, Stake as StakeResponse, StakeTokenArgs } from './types/stake';
6
6
  export default class Stake {
7
7
  program: Program<TriadProtocol>;
8
8
  provider: AnchorProvider;
@@ -12,10 +12,6 @@ export default class Stake {
12
12
  * Get all Stake Vaults
13
13
  */
14
14
  getStakeVaults(): Promise<import("./types/stake").StakeVault[]>;
15
- /**
16
- * Get Stake Rewards
17
- */
18
- getStakeRewards({ stake, collections }: ClaimStakeRewardsArgs): Promise<number>;
19
15
  /**
20
16
  * Get all Stakes
21
17
  */
@@ -29,6 +25,7 @@ export default class Stake {
29
25
  * @param wallet - User wallet
30
26
  * @param collections - NFT collections
31
27
  * @param tensor rank
28
+ *
32
29
  */
33
30
  getStakeByWallet(wallet: PublicKey, collections: number): Promise<StakeResponse[]>;
34
31
  /**
package/dist/stake.js CHANGED
@@ -35,14 +35,6 @@ class Stake {
35
35
  return response.map((stakeVault) => (0, helpers_1.formatStakeVault)(stakeVault.account));
36
36
  });
37
37
  }
38
- /**
39
- * Get Stake Rewards
40
- */
41
- getStakeRewards({ stake, collections }) {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- return (0, helpers_1.calculateStakeRewards)(stake, collections);
44
- });
45
- }
46
38
  /**
47
39
  * Get all Stakes
48
40
  */
@@ -73,20 +65,14 @@ class Stake {
73
65
  * @param wallet - User wallet
74
66
  * @param collections - NFT collections
75
67
  * @param tensor rank
68
+ *
76
69
  */
77
70
  getStakeByWallet(wallet, collections) {
78
71
  return __awaiter(this, void 0, void 0, function* () {
79
72
  const response = yield this.getUserStakes(wallet);
80
73
  const data = [];
81
74
  for (const stake of response) {
82
- let available = 0;
83
- try {
84
- available = yield this.getStakeRewards({
85
- stake,
86
- collections
87
- });
88
- }
89
- catch (_a) { }
75
+ let available = (0, helpers_1.calculateStakeRewards)(stake, collections);
90
76
  data.push(Object.assign(Object.assign({}, stake), { available }));
91
77
  }
92
78
  return data;
@@ -1601,6 +1601,59 @@
1601
1601
  }
1602
1602
  ]
1603
1603
  },
1604
+ {
1605
+ "name": "transfer_poseidon",
1606
+ "discriminator": [57, 144, 113, 75, 97, 81, 3, 98],
1607
+ "accounts": [
1608
+ {
1609
+ "name": "signer",
1610
+ "writable": true,
1611
+ "signer": true
1612
+ },
1613
+ {
1614
+ "name": "verifier",
1615
+ "writable": true,
1616
+ "signer": true
1617
+ },
1618
+ {
1619
+ "name": "nft",
1620
+ "writable": true
1621
+ },
1622
+ {
1623
+ "name": "ticket_asset",
1624
+ "writable": true
1625
+ },
1626
+ {
1627
+ "name": "poseidon_asset",
1628
+ "writable": true
1629
+ },
1630
+ {
1631
+ "name": "ticket_collection",
1632
+ "writable": true
1633
+ },
1634
+ {
1635
+ "name": "core_ticket_collection",
1636
+ "writable": true
1637
+ },
1638
+ {
1639
+ "name": "poseidon_collection",
1640
+ "writable": true
1641
+ },
1642
+ {
1643
+ "name": "core_poseidon_collection",
1644
+ "writable": true
1645
+ },
1646
+ {
1647
+ "name": "metaplex_program",
1648
+ "address": "CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"
1649
+ },
1650
+ {
1651
+ "name": "system_program",
1652
+ "address": "11111111111111111111111111111111"
1653
+ }
1654
+ ],
1655
+ "args": []
1656
+ },
1604
1657
  {
1605
1658
  "name": "update_stake_vault",
1606
1659
  "discriminator": [84, 171, 100, 153, 126, 215, 229, 68],
@@ -1808,6 +1861,10 @@
1808
1861
  }
1809
1862
  ],
1810
1863
  "accounts": [
1864
+ {
1865
+ "name": "BaseAssetV1",
1866
+ "discriminator": [0, 0, 0, 0, 0, 0, 0, 0]
1867
+ },
1811
1868
  {
1812
1869
  "name": "BaseCollectionV1",
1813
1870
  "discriminator": [0, 0, 0, 0, 0, 0, 0, 0]
@@ -2045,6 +2102,48 @@
2045
2102
  ]
2046
2103
  }
2047
2104
  },
2105
+ {
2106
+ "name": "BaseAssetV1",
2107
+ "type": {
2108
+ "kind": "struct",
2109
+ "fields": [
2110
+ {
2111
+ "name": "key",
2112
+ "type": {
2113
+ "defined": {
2114
+ "name": "Key"
2115
+ }
2116
+ }
2117
+ },
2118
+ {
2119
+ "name": "owner",
2120
+ "type": "pubkey"
2121
+ },
2122
+ {
2123
+ "name": "update_authority",
2124
+ "type": {
2125
+ "defined": {
2126
+ "name": "UpdateAuthority"
2127
+ }
2128
+ }
2129
+ },
2130
+ {
2131
+ "name": "name",
2132
+ "type": "string"
2133
+ },
2134
+ {
2135
+ "name": "uri",
2136
+ "type": "string"
2137
+ },
2138
+ {
2139
+ "name": "seq",
2140
+ "type": {
2141
+ "option": "u64"
2142
+ }
2143
+ }
2144
+ ]
2145
+ }
2146
+ },
2048
2147
  {
2049
2148
  "name": "BaseCollectionV1",
2050
2149
  "type": {
@@ -3391,6 +3490,25 @@
3391
3490
  ]
3392
3491
  }
3393
3492
  },
3493
+ {
3494
+ "name": "UpdateAuthority",
3495
+ "type": {
3496
+ "kind": "enum",
3497
+ "variants": [
3498
+ {
3499
+ "name": "None"
3500
+ },
3501
+ {
3502
+ "name": "Address",
3503
+ "fields": ["pubkey"]
3504
+ },
3505
+ {
3506
+ "name": "Collection",
3507
+ "fields": ["pubkey"]
3508
+ }
3509
+ ]
3510
+ }
3511
+ },
3394
3512
  {
3395
3513
  "name": "UpdateStakeVaultArgs",
3396
3514
  "type": {
@@ -1,4 +1,4 @@
1
- import { PublicKey } from '@solana/web3.js';
1
+ import { Keypair, PublicKey } from '@solana/web3.js';
2
2
  export type RpcOptions = {
3
3
  skipPreflight?: boolean;
4
4
  microLamports?: number;
@@ -74,3 +74,9 @@ export type PrizeType = {
74
74
  } | {
75
75
  trd10000: {};
76
76
  };
77
+ export type TransferPoseidonArgs = {
78
+ poseidonAsset: PublicKey;
79
+ ticketAsset: PublicKey;
80
+ verifier: Keypair;
81
+ ticketNumber: number;
82
+ };
@@ -2303,6 +2303,59 @@ export type TriadProtocol = {
2303
2303
  }
2304
2304
  ];
2305
2305
  },
2306
+ {
2307
+ name: 'transferPoseidon';
2308
+ discriminator: [57, 144, 113, 75, 97, 81, 3, 98];
2309
+ accounts: [
2310
+ {
2311
+ name: 'signer';
2312
+ writable: true;
2313
+ signer: true;
2314
+ },
2315
+ {
2316
+ name: 'verifier';
2317
+ writable: true;
2318
+ signer: true;
2319
+ },
2320
+ {
2321
+ name: 'nft';
2322
+ writable: true;
2323
+ },
2324
+ {
2325
+ name: 'ticketAsset';
2326
+ writable: true;
2327
+ },
2328
+ {
2329
+ name: 'poseidonAsset';
2330
+ writable: true;
2331
+ },
2332
+ {
2333
+ name: 'ticketCollection';
2334
+ writable: true;
2335
+ },
2336
+ {
2337
+ name: 'coreTicketCollection';
2338
+ writable: true;
2339
+ },
2340
+ {
2341
+ name: 'poseidonCollection';
2342
+ writable: true;
2343
+ },
2344
+ {
2345
+ name: 'corePoseidonCollection';
2346
+ writable: true;
2347
+ },
2348
+ {
2349
+ name: 'metaplexProgram';
2350
+ address: 'CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d';
2351
+ },
2352
+ {
2353
+ name: 'systemProgram';
2354
+ address: '11111111111111111111111111111111';
2355
+ }
2356
+ ];
2357
+ args: [];
2358
+ },
2306
2359
  {
2307
2360
  name: 'updateStakeVault';
2308
2361
  discriminator: [84, 171, 100, 153, 126, 215, 229, 68];
@@ -2626,6 +2679,10 @@ export type TriadProtocol = {
2626
2679
  }
2627
2680
  ];
2628
2681
  accounts: [
2682
+ {
2683
+ name: 'baseAssetV1';
2684
+ discriminator: [0, 0, 0, 0, 0, 0, 0, 0];
2685
+ },
2629
2686
  {
2630
2687
  name: 'baseCollectionV1';
2631
2688
  discriminator: [0, 0, 0, 0, 0, 0, 0, 0];
@@ -2863,6 +2920,48 @@ export type TriadProtocol = {
2863
2920
  ];
2864
2921
  };
2865
2922
  },
2923
+ {
2924
+ name: 'baseAssetV1';
2925
+ type: {
2926
+ kind: 'struct';
2927
+ fields: [
2928
+ {
2929
+ name: 'key';
2930
+ type: {
2931
+ defined: {
2932
+ name: 'key';
2933
+ };
2934
+ };
2935
+ },
2936
+ {
2937
+ name: 'owner';
2938
+ type: 'pubkey';
2939
+ },
2940
+ {
2941
+ name: 'updateAuthority';
2942
+ type: {
2943
+ defined: {
2944
+ name: 'updateAuthority';
2945
+ };
2946
+ };
2947
+ },
2948
+ {
2949
+ name: 'name';
2950
+ type: 'string';
2951
+ },
2952
+ {
2953
+ name: 'uri';
2954
+ type: 'string';
2955
+ },
2956
+ {
2957
+ name: 'seq';
2958
+ type: {
2959
+ option: 'u64';
2960
+ };
2961
+ }
2962
+ ];
2963
+ };
2964
+ },
2866
2965
  {
2867
2966
  name: 'baseCollectionV1';
2868
2967
  type: {
@@ -4205,6 +4304,25 @@ export type TriadProtocol = {
4205
4304
  ];
4206
4305
  };
4207
4306
  },
4307
+ {
4308
+ name: 'updateAuthority';
4309
+ type: {
4310
+ kind: 'enum';
4311
+ variants: [
4312
+ {
4313
+ name: 'none';
4314
+ },
4315
+ {
4316
+ name: 'address';
4317
+ fields: ['pubkey'];
4318
+ },
4319
+ {
4320
+ name: 'collection';
4321
+ fields: ['pubkey'];
4322
+ }
4323
+ ];
4324
+ };
4325
+ },
4208
4326
  {
4209
4327
  name: 'updateStakeVaultArgs';
4210
4328
  type: {
@@ -10,3 +10,4 @@ export declare const SPIN_NAME = "christmas";
10
10
  export declare const TCMAS_MINT: PublicKey;
11
11
  export declare const POSEIDON_COLLECTION_SYMBOL = "$PSN";
12
12
  export declare const POSEIDON_CORE_COLLECTION: PublicKey;
13
+ export declare const TICKET_COLLECTION_SYMBOL = "PTCKT";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.POSEIDON_CORE_COLLECTION = exports.POSEIDON_COLLECTION_SYMBOL = exports.TCMAS_MINT = exports.SPIN_NAME = exports.TICKET_CORE_COLLECTION = exports.SOL_MINT = exports.TRIAD_ADMIN = exports.TRD_MINT = exports.VERIFIER = exports.TRD_DECIMALS = exports.STAKE_VAULT_NAME = void 0;
3
+ exports.TICKET_COLLECTION_SYMBOL = exports.POSEIDON_CORE_COLLECTION = exports.POSEIDON_COLLECTION_SYMBOL = exports.TCMAS_MINT = exports.SPIN_NAME = exports.TICKET_CORE_COLLECTION = exports.SOL_MINT = exports.TRIAD_ADMIN = exports.TRD_MINT = exports.VERIFIER = exports.TRD_DECIMALS = exports.STAKE_VAULT_NAME = void 0;
4
4
  const web3_js_1 = require("@solana/web3.js");
5
5
  exports.STAKE_VAULT_NAME = 'Triad Share 1';
6
6
  exports.TRD_DECIMALS = 6;
@@ -13,3 +13,4 @@ exports.SPIN_NAME = 'christmas';
13
13
  exports.TCMAS_MINT = new web3_js_1.PublicKey('tCMraBSGHeMcQS76hNnBhnfbMzrtnnT3nbt3vAnSCE2');
14
14
  exports.POSEIDON_COLLECTION_SYMBOL = '$PSN';
15
15
  exports.POSEIDON_CORE_COLLECTION = new web3_js_1.PublicKey('69CLccefLRmvDSAJP7Er632dvn878qkpdcnvq5ZUspSm');
16
+ exports.TICKET_COLLECTION_SYMBOL = 'PTCKT';
@@ -6,3 +6,5 @@ export declare const getUserPositionPDA: (programId: PublicKey, wallet: PublicKe
6
6
  export declare const getTokenVaultAddressSync: (programId: PublicKey, vault: PublicKey) => PublicKey;
7
7
  export declare const getTokenATA: (address: PublicKey, Mint: PublicKey) => PublicKey;
8
8
  export declare const getSpinPDA: (programId: PublicKey, name: string) => PublicKey;
9
+ export declare const getCollectionPDA: (programId: PublicKey, collectionSymbol: string) => PublicKey;
10
+ export declare const getNftPDA: (programId: PublicKey, number: number) => PublicKey;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSpinPDA = exports.getTokenATA = exports.getTokenVaultAddressSync = exports.getUserPositionPDA = exports.getVaultAddressSync = exports.getTickerPDA = exports.getUserPDA = void 0;
6
+ exports.getNftPDA = exports.getCollectionPDA = exports.getSpinPDA = exports.getTokenATA = exports.getTokenVaultAddressSync = exports.getUserPositionPDA = exports.getVaultAddressSync = exports.getTickerPDA = exports.getUserPDA = void 0;
4
7
  const web3_js_1 = require("@solana/web3.js");
8
+ const bn_js_1 = __importDefault(require("bn.js"));
5
9
  const spl_token_1 = require("@solana/spl-token");
6
10
  const getUserPDA = (programId, wallet) => {
7
11
  return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('user'), wallet.toBuffer()], programId)[0];
@@ -31,3 +35,11 @@ const getSpinPDA = (programId, name) => {
31
35
  return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('spin'), Buffer.from(name)], programId)[0];
32
36
  };
33
37
  exports.getSpinPDA = getSpinPDA;
38
+ const getCollectionPDA = (programId, collectionSymbol) => {
39
+ return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('collection'), Buffer.from(collectionSymbol)], programId)[0];
40
+ };
41
+ exports.getCollectionPDA = getCollectionPDA;
42
+ const getNftPDA = (programId, number) => {
43
+ return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('nft'), new bn_js_1.default(number).toArrayLike(Buffer, 'le', 8)], programId)[0];
44
+ };
45
+ exports.getNftPDA = getNftPDA;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "1.4.6-beta",
3
+ "version": "1.4.7-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",