@triadxyz/triad-protocol 1.3.3-beta → 1.3.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/index.d.ts +14 -0
- package/dist/index.js +31 -2
- package/dist/local-test.js +9 -8
- package/dist/types/idl_triad_protocol.json +0 -33
- package/dist/types/triad_protocol.d.ts +0 -33
- package/dist/utils/constants.d.ts +2 -0
- package/dist/utils/constants.js +4 -2
- package/dist/utils/sendVersionedTransaction.d.ts +1 -1
- package/dist/utils/sendVersionedTransaction.js +7 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -83,4 +83,18 @@ export default class TriadProtocolClient {
|
|
|
83
83
|
* @param options - RPC options
|
|
84
84
|
*/
|
|
85
85
|
spinWheel(isSol: boolean, options?: RpcOptions): Promise<any>;
|
|
86
|
+
/**
|
|
87
|
+
* Mint Poseidon
|
|
88
|
+
* @param number - Poseidon number
|
|
89
|
+
* @param attributes - Poseidon attributes
|
|
90
|
+
* @param options - RPC options
|
|
91
|
+
*
|
|
92
|
+
*/
|
|
93
|
+
mintPoseidon(items: {
|
|
94
|
+
number: number;
|
|
95
|
+
attributes: {
|
|
96
|
+
key: string;
|
|
97
|
+
value: string;
|
|
98
|
+
}[];
|
|
99
|
+
}[], options?: RpcOptions): Promise<string>;
|
|
86
100
|
}
|
package/dist/index.js
CHANGED
|
@@ -233,14 +233,14 @@ class TriadProtocolClient {
|
|
|
233
233
|
const method = this.program.methods.spinWheel(isSol).accounts({
|
|
234
234
|
signer: this.provider.wallet.publicKey,
|
|
235
235
|
spin: spinPDA,
|
|
236
|
-
mint:
|
|
236
|
+
mint: constants_1.TCMAS_MINT
|
|
237
237
|
});
|
|
238
238
|
const tx = yield (0, sendTransactionWithOptions_1.default)(method, options);
|
|
239
239
|
const txLogs = yield this.provider.connection.getTransaction(tx, {
|
|
240
240
|
commitment: 'confirmed',
|
|
241
241
|
maxSupportedTransactionVersion: 0
|
|
242
242
|
});
|
|
243
|
-
const eventLog = txLogs.meta.logMessages.find((log) => log.includes('
|
|
243
|
+
const eventLog = txLogs.meta.logMessages.find((log) => log.includes('SpinWheelResult'));
|
|
244
244
|
if (!eventLog) {
|
|
245
245
|
throw new Error('Spin result not found in transaction logs');
|
|
246
246
|
}
|
|
@@ -249,5 +249,34 @@ class TriadProtocolClient {
|
|
|
249
249
|
return prizeType;
|
|
250
250
|
});
|
|
251
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* Mint Poseidon
|
|
254
|
+
* @param number - Poseidon number
|
|
255
|
+
* @param attributes - Poseidon attributes
|
|
256
|
+
* @param options - RPC options
|
|
257
|
+
*
|
|
258
|
+
*/
|
|
259
|
+
mintPoseidon(items, options) {
|
|
260
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
261
|
+
const assets = [];
|
|
262
|
+
const ixs = [];
|
|
263
|
+
for (const item of items) {
|
|
264
|
+
const asset = web3_js_1.Keypair.generate();
|
|
265
|
+
assets.push(asset);
|
|
266
|
+
ixs.push(yield this.program.methods
|
|
267
|
+
.mintPoseidon({
|
|
268
|
+
collectionSymbol: constants_1.POSEIDON_COLLECTION_SYMBOL,
|
|
269
|
+
number: new anchor_1.BN(item.number)
|
|
270
|
+
})
|
|
271
|
+
.accounts({
|
|
272
|
+
signer: this.provider.wallet.publicKey,
|
|
273
|
+
asset: asset.publicKey,
|
|
274
|
+
coreCollection: constants_1.POSEIDON_CORE_COLLECTION
|
|
275
|
+
})
|
|
276
|
+
.instruction());
|
|
277
|
+
}
|
|
278
|
+
return (0, sendVersionedTransaction_1.default)(this.provider, ixs, options, undefined, [], undefined, assets);
|
|
279
|
+
});
|
|
280
|
+
}
|
|
252
281
|
}
|
|
253
282
|
exports.default = TriadProtocolClient;
|
package/dist/local-test.js
CHANGED
|
@@ -428,10 +428,10 @@ const getMinteds = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
428
428
|
// ];
|
|
429
429
|
const addSpinPrize = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
430
430
|
const response = yield triadProtocol.addSpinPrize({
|
|
431
|
-
rangeMin:
|
|
432
|
-
rangeMax:
|
|
433
|
-
prizeType: {
|
|
434
|
-
availableQuantity:
|
|
431
|
+
rangeMin: 26615,
|
|
432
|
+
rangeMax: 66614,
|
|
433
|
+
prizeType: { ore: {} },
|
|
434
|
+
availableQuantity: 500
|
|
435
435
|
});
|
|
436
436
|
console.log(response);
|
|
437
437
|
});
|
|
@@ -446,10 +446,11 @@ const getSpinPrize = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
446
446
|
console.log(prizes);
|
|
447
447
|
});
|
|
448
448
|
const spinWheel = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
449
|
-
const response = yield triadProtocol.spinWheel(false, {
|
|
450
|
-
skipPreflight: true,
|
|
451
|
-
microLamports: 5000
|
|
452
|
-
});
|
|
449
|
+
const response = yield triadProtocol.spinWheel(false, { skipPreflight: true });
|
|
453
450
|
console.log(response);
|
|
454
451
|
});
|
|
455
452
|
spinWheel();
|
|
453
|
+
const mintPoseidon = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
454
|
+
const response = yield triadProtocol.mintPoseidon([]);
|
|
455
|
+
console.log(response);
|
|
456
|
+
});
|
|
@@ -785,10 +785,6 @@
|
|
|
785
785
|
"writable": true,
|
|
786
786
|
"signer": true
|
|
787
787
|
},
|
|
788
|
-
{
|
|
789
|
-
"name": "nft_mint",
|
|
790
|
-
"writable": true
|
|
791
|
-
},
|
|
792
788
|
{
|
|
793
789
|
"name": "collection",
|
|
794
790
|
"writable": true,
|
|
@@ -2538,19 +2534,6 @@
|
|
|
2538
2534
|
{
|
|
2539
2535
|
"name": "number",
|
|
2540
2536
|
"type": "u64"
|
|
2541
|
-
},
|
|
2542
|
-
{
|
|
2543
|
-
"name": "attributes",
|
|
2544
|
-
"type": {
|
|
2545
|
-
"array": [
|
|
2546
|
-
{
|
|
2547
|
-
"defined": {
|
|
2548
|
-
"name": "PoseidonAttribute"
|
|
2549
|
-
}
|
|
2550
|
-
},
|
|
2551
|
-
7
|
|
2552
|
-
]
|
|
2553
|
-
}
|
|
2554
2537
|
}
|
|
2555
2538
|
]
|
|
2556
2539
|
}
|
|
@@ -2814,22 +2797,6 @@
|
|
|
2814
2797
|
]
|
|
2815
2798
|
}
|
|
2816
2799
|
},
|
|
2817
|
-
{
|
|
2818
|
-
"name": "PoseidonAttribute",
|
|
2819
|
-
"type": {
|
|
2820
|
-
"kind": "struct",
|
|
2821
|
-
"fields": [
|
|
2822
|
-
{
|
|
2823
|
-
"name": "key",
|
|
2824
|
-
"type": "string"
|
|
2825
|
-
},
|
|
2826
|
-
{
|
|
2827
|
-
"name": "value",
|
|
2828
|
-
"type": "string"
|
|
2829
|
-
}
|
|
2830
|
-
]
|
|
2831
|
-
}
|
|
2832
|
-
},
|
|
2833
2800
|
{
|
|
2834
2801
|
"name": "PriceUpdate",
|
|
2835
2802
|
"type": {
|
|
@@ -1110,10 +1110,6 @@ export type TriadProtocol = {
|
|
|
1110
1110
|
writable: true;
|
|
1111
1111
|
signer: true;
|
|
1112
1112
|
},
|
|
1113
|
-
{
|
|
1114
|
-
name: 'nftMint';
|
|
1115
|
-
writable: true;
|
|
1116
|
-
},
|
|
1117
1113
|
{
|
|
1118
1114
|
name: 'collection';
|
|
1119
1115
|
writable: true;
|
|
@@ -3294,19 +3290,6 @@ export type TriadProtocol = {
|
|
|
3294
3290
|
{
|
|
3295
3291
|
name: 'number';
|
|
3296
3292
|
type: 'u64';
|
|
3297
|
-
},
|
|
3298
|
-
{
|
|
3299
|
-
name: 'attributes';
|
|
3300
|
-
type: {
|
|
3301
|
-
array: [
|
|
3302
|
-
{
|
|
3303
|
-
defined: {
|
|
3304
|
-
name: 'poseidonAttribute';
|
|
3305
|
-
};
|
|
3306
|
-
},
|
|
3307
|
-
7
|
|
3308
|
-
];
|
|
3309
|
-
};
|
|
3310
3293
|
}
|
|
3311
3294
|
];
|
|
3312
3295
|
};
|
|
@@ -3570,22 +3553,6 @@ export type TriadProtocol = {
|
|
|
3570
3553
|
];
|
|
3571
3554
|
};
|
|
3572
3555
|
},
|
|
3573
|
-
{
|
|
3574
|
-
name: 'poseidonAttribute';
|
|
3575
|
-
type: {
|
|
3576
|
-
kind: 'struct';
|
|
3577
|
-
fields: [
|
|
3578
|
-
{
|
|
3579
|
-
name: 'key';
|
|
3580
|
-
type: 'string';
|
|
3581
|
-
},
|
|
3582
|
-
{
|
|
3583
|
-
name: 'value';
|
|
3584
|
-
type: 'string';
|
|
3585
|
-
}
|
|
3586
|
-
];
|
|
3587
|
-
};
|
|
3588
|
-
},
|
|
3589
3556
|
{
|
|
3590
3557
|
name: 'priceUpdate';
|
|
3591
3558
|
type: {
|
|
@@ -8,3 +8,5 @@ export declare const SOL_MINT: PublicKey;
|
|
|
8
8
|
export declare const TICKET_CORE_COLLECTION: PublicKey;
|
|
9
9
|
export declare const SPIN_NAME = "christmas";
|
|
10
10
|
export declare const TCMAS_MINT: PublicKey;
|
|
11
|
+
export declare const POSEIDON_COLLECTION_SYMBOL = "$PSN";
|
|
12
|
+
export declare const POSEIDON_CORE_COLLECTION: PublicKey;
|
package/dist/utils/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
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.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;
|
|
@@ -10,4 +10,6 @@ exports.TRIAD_ADMIN = new web3_js_1.PublicKey('82ppCojm3yrEKgdpH8B5AmBJTU1r1uAWX
|
|
|
10
10
|
exports.SOL_MINT = new web3_js_1.PublicKey('So11111111111111111111111111111111111111112');
|
|
11
11
|
exports.TICKET_CORE_COLLECTION = new web3_js_1.PublicKey('BaqopH1VXYUCT6VsojbTibVcd3k5jpGGT6296HFb6fVa');
|
|
12
12
|
exports.SPIN_NAME = 'christmas';
|
|
13
|
-
exports.TCMAS_MINT = new web3_js_1.PublicKey('
|
|
13
|
+
exports.TCMAS_MINT = new web3_js_1.PublicKey('tCMraBSGHeMcQS76hNnBhnfbMzrtnnT3nbt3vAnSCE2');
|
|
14
|
+
exports.POSEIDON_COLLECTION_SYMBOL = '$PSN';
|
|
15
|
+
exports.POSEIDON_CORE_COLLECTION = new web3_js_1.PublicKey('69CLccefLRmvDSAJP7Er632dvn878qkpdcnvq5ZUspSm');
|
|
@@ -3,5 +3,5 @@ import { RpcOptions } from '../types';
|
|
|
3
3
|
import { AddressLookupTableAccount } from '@solana/web3.js';
|
|
4
4
|
import { AnchorProvider } from '@coral-xyz/anchor';
|
|
5
5
|
import { Keypair } from '@solana/web3.js';
|
|
6
|
-
declare const sendVersionedTransaction: (provider: AnchorProvider, ixs: TransactionInstruction[], options?: RpcOptions, payer?: Keypair, addressLookupTableAccounts?: AddressLookupTableAccount[], verifier?: Keypair) => Promise<string>;
|
|
6
|
+
declare const sendVersionedTransaction: (provider: AnchorProvider, ixs: TransactionInstruction[], options?: RpcOptions, payer?: Keypair, addressLookupTableAccounts?: AddressLookupTableAccount[], verifier?: Keypair, assets?: Keypair[]) => Promise<string>;
|
|
7
7
|
export default sendVersionedTransaction;
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const web3_js_1 = require("@solana/web3.js");
|
|
13
|
-
const sendVersionedTransaction = (provider, ixs, options, payer, addressLookupTableAccounts, verifier) => __awaiter(void 0, void 0, void 0, function* () {
|
|
13
|
+
const sendVersionedTransaction = (provider, ixs, options, payer, addressLookupTableAccounts, verifier, assets) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
14
|
if (options === null || options === void 0 ? void 0 : options.microLamports) {
|
|
15
15
|
ixs.push(web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({
|
|
16
16
|
microLamports: options.microLamports
|
|
@@ -31,6 +31,12 @@ const sendVersionedTransaction = (provider, ixs, options, payer, addressLookupTa
|
|
|
31
31
|
tx.sign([verifier]);
|
|
32
32
|
signers.push(verifier);
|
|
33
33
|
}
|
|
34
|
+
if (assets) {
|
|
35
|
+
for (const asset of assets) {
|
|
36
|
+
tx.sign([asset]);
|
|
37
|
+
signers.push(asset);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
34
40
|
return provider.sendAndConfirm(tx, signers, {
|
|
35
41
|
skipPreflight: options === null || options === void 0 ? void 0 : options.skipPreflight,
|
|
36
42
|
commitment: 'confirmed'
|