@triadxyz/triad-protocol 1.3.3-beta → 1.3.4-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
@@ -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: new web3_js_1.PublicKey('9LGNCsQsoeJK2jBMKNiX8UGJv5NPyBHhouTcQLLqWTt9')
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('RouletteSpinResult'));
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,36 @@ 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
+ attributes: item.attributes
271
+ })
272
+ .accounts({
273
+ signer: this.provider.wallet.publicKey,
274
+ asset: asset.publicKey,
275
+ coreCollection: constants_1.POSEIDON_CORE_COLLECTION,
276
+ nftMint: new web3_js_1.PublicKey('EzhK3EPW5PfWBRdyNaZbxTBfnYE5M2JSordnCBdMoCvp')
277
+ })
278
+ .instruction());
279
+ }
280
+ return (0, sendVersionedTransaction_1.default)(this.provider, ixs, options, undefined, [], undefined, assets);
281
+ });
282
+ }
252
283
  }
253
284
  exports.default = TriadProtocolClient;
@@ -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: 66615,
432
- rangeMax: 166614,
433
- prizeType: { lucksea: {} },
434
- availableQuantity: 2000
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);
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
+ });
@@ -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;
@@ -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;
@@ -11,3 +11,5 @@ exports.SOL_MINT = new web3_js_1.PublicKey('So1111111111111111111111111111111111
11
11
  exports.TICKET_CORE_COLLECTION = new web3_js_1.PublicKey('BaqopH1VXYUCT6VsojbTibVcd3k5jpGGT6296HFb6fVa');
12
12
  exports.SPIN_NAME = 'christmas';
13
13
  exports.TCMAS_MINT = new web3_js_1.PublicKey('9LGNCsQsoeJK2jBMKNiX8UGJv5NPyBHhouTcQLLqWTt9');
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'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "1.3.3-beta",
3
+ "version": "1.3.4-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",