@triadxyz/triad-protocol 1.4.5-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 +8 -1
- package/dist/index.js +33 -4
- package/dist/local-test.js +47 -40
- package/dist/stake.d.ts +2 -5
- package/dist/stake.js +2 -20
- package/dist/types/idl_triad_protocol.json +118 -0
- package/dist/types/index.d.ts +7 -1
- package/dist/types/stake.d.ts +1 -3
- package/dist/types/triad_protocol.d.ts +118 -0
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.js +2 -1
- package/dist/utils/pda/index.d.ts +2 -0
- package/dist/utils/pda/index.js +13 -1
- package/package.json +1 -1
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
|
|
152
|
-
const
|
|
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.
|
|
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;
|
package/dist/local-test.js
CHANGED
|
@@ -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/
|
|
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(
|
|
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));
|
|
@@ -445,61 +457,61 @@ const addSpinPrize = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
445
457
|
// rangeMax: 116,
|
|
446
458
|
// prizeType: { ticket: {} },
|
|
447
459
|
// availableQuantity: 2
|
|
448
|
-
// }
|
|
460
|
+
// }
|
|
449
461
|
// {
|
|
450
462
|
// rangeMin: 117,
|
|
451
463
|
// rangeMax: 617,
|
|
452
464
|
// prizeType: { honeyland: {} },
|
|
453
|
-
// availableQuantity:
|
|
465
|
+
// availableQuantity: 2
|
|
466
|
+
// }
|
|
467
|
+
// {
|
|
468
|
+
// rangeMin: 618,
|
|
469
|
+
// rangeMax: 5618,
|
|
470
|
+
// prizeType: { trd50: {} },
|
|
471
|
+
// availableQuantity: 50
|
|
454
472
|
// },
|
|
455
|
-
{
|
|
456
|
-
rangeMin: 618,
|
|
457
|
-
rangeMax: 5618,
|
|
458
|
-
prizeType: { trd50: {} },
|
|
459
|
-
availableQuantity: 50
|
|
460
|
-
},
|
|
461
473
|
// {
|
|
462
474
|
// rangeMin: 5619,
|
|
463
475
|
// rangeMax: 15619,
|
|
464
476
|
// prizeType: { flip: {} },
|
|
465
|
-
// availableQuantity:
|
|
477
|
+
// availableQuantity: 1
|
|
466
478
|
// },
|
|
467
479
|
{
|
|
468
480
|
rangeMin: 15620,
|
|
469
481
|
rangeMax: 25620,
|
|
470
482
|
prizeType: { pengu: {} },
|
|
471
|
-
availableQuantity:
|
|
483
|
+
availableQuantity: 3 + 7
|
|
472
484
|
},
|
|
473
485
|
{
|
|
474
486
|
rangeMin: 25621,
|
|
475
487
|
rangeMax: 65621,
|
|
476
488
|
prizeType: { ore: {} },
|
|
477
|
-
availableQuantity:
|
|
489
|
+
availableQuantity: 13
|
|
478
490
|
},
|
|
479
|
-
// {
|
|
480
|
-
// rangeMin: 65622,
|
|
481
|
-
// rangeMax: 165622,
|
|
482
|
-
// prizeType: { lucksea: {} },
|
|
483
|
-
// availableQuantity: 2000
|
|
484
|
-
// },
|
|
485
491
|
{
|
|
486
|
-
rangeMin:
|
|
487
|
-
rangeMax:
|
|
488
|
-
prizeType: {
|
|
489
|
-
availableQuantity:
|
|
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
|
|
492
|
+
rangeMin: 65622,
|
|
493
|
+
rangeMax: 165622,
|
|
494
|
+
prizeType: { lucksea: {} },
|
|
495
|
+
availableQuantity: 18
|
|
502
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);
|
|
@@ -524,8 +536,3 @@ const getSpinPrize = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
524
536
|
}));
|
|
525
537
|
console.log(prizes.filter((prize) => !prize.prizeType.none));
|
|
526
538
|
});
|
|
527
|
-
const buyToken = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
528
|
-
const response = yield triadProtocol.buyToken(1);
|
|
529
|
-
console.log(response);
|
|
530
|
-
});
|
|
531
|
-
buyToken();
|
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,
|
|
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({ wallet, nftName, 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,16 +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({ wallet, nftName, collections }) {
|
|
42
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
const stakePDA = (0, stake_1.getStakePDA)(this.program.programId, wallet, nftName);
|
|
44
|
-
const stake = yield this.program.account.stakeV2.fetch(stakePDA);
|
|
45
|
-
return (0, helpers_1.calculateStakeRewards)((0, helpers_1.formatStake)(stake), collections);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
38
|
/**
|
|
49
39
|
* Get all Stakes
|
|
50
40
|
*/
|
|
@@ -75,22 +65,14 @@ class Stake {
|
|
|
75
65
|
* @param wallet - User wallet
|
|
76
66
|
* @param collections - NFT collections
|
|
77
67
|
* @param tensor rank
|
|
68
|
+
*
|
|
78
69
|
*/
|
|
79
70
|
getStakeByWallet(wallet, collections) {
|
|
80
71
|
return __awaiter(this, void 0, void 0, function* () {
|
|
81
72
|
const response = yield this.getUserStakes(wallet);
|
|
82
73
|
const data = [];
|
|
83
74
|
for (const stake of response) {
|
|
84
|
-
let available = 0;
|
|
85
|
-
try {
|
|
86
|
-
available = yield this.getStakeRewards({
|
|
87
|
-
wallet,
|
|
88
|
-
nftName: stake.name,
|
|
89
|
-
rank: 963,
|
|
90
|
-
collections
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
catch (_a) { }
|
|
75
|
+
let available = (0, helpers_1.calculateStakeRewards)(stake, collections);
|
|
94
76
|
data.push(Object.assign(Object.assign({}, stake), { available }));
|
|
95
77
|
}
|
|
96
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": {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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
|
+
};
|
package/dist/types/stake.d.ts
CHANGED
|
@@ -37,10 +37,8 @@ export type WithdrawArgs = {
|
|
|
37
37
|
mint: PublicKey;
|
|
38
38
|
};
|
|
39
39
|
export type ClaimStakeRewardsArgs = {
|
|
40
|
-
|
|
41
|
-
nftName: string;
|
|
40
|
+
stake: Stake;
|
|
42
41
|
collections: number;
|
|
43
|
-
rank: number;
|
|
44
42
|
};
|
|
45
43
|
export type UpdateBoostArgs = {
|
|
46
44
|
wallet: PublicKey;
|
|
@@ -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";
|
package/dist/utils/constants.js
CHANGED
|
@@ -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;
|
package/dist/utils/pda/index.js
CHANGED
|
@@ -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;
|