@triadxyz/triad-protocol 1.5.0-beta → 1.5.2-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
@@ -57,4 +57,11 @@ export default class TriadProtocolClient {
57
57
  poseidonAsset: PublicKey;
58
58
  nft: number;
59
59
  }, options?: RpcOptions): Promise<string>;
60
+ /**
61
+ * Collect Royalty
62
+ * @param collection - Collection PublicKey
63
+ *
64
+ * @param options - RPC options
65
+ */
66
+ collectRoyalty(collection: PublicKey, options?: RpcOptions): Promise<string>;
60
67
  }
package/dist/index.js CHANGED
@@ -152,5 +152,19 @@ class TriadProtocolClient {
152
152
  }), options);
153
153
  });
154
154
  }
155
+ /**
156
+ * Collect Royalty
157
+ * @param collection - Collection PublicKey
158
+ *
159
+ * @param options - RPC options
160
+ */
161
+ collectRoyalty(collection, options) {
162
+ return __awaiter(this, void 0, void 0, function* () {
163
+ return (0, sendTransactionWithOptions_1.default)(this.program.methods.collectRoyalty().accounts({
164
+ signer: this.provider.wallet.publicKey,
165
+ collection
166
+ }), options);
167
+ });
168
+ }
155
169
  }
156
170
  exports.default = TriadProtocolClient;
@@ -421,6 +421,31 @@
421
421
  ],
422
422
  "args": []
423
423
  },
424
+ {
425
+ "name": "collect_royalty",
426
+ "discriminator": [189, 235, 7, 168, 255, 50, 30, 75],
427
+ "accounts": [
428
+ {
429
+ "name": "signer",
430
+ "writable": true,
431
+ "signer": true
432
+ },
433
+ {
434
+ "name": "squads",
435
+ "writable": true,
436
+ "address": "6fcSf6qfwPNR9AUUNC1UWYZDy5cQ4TzTb2aaipN2zFdq"
437
+ },
438
+ {
439
+ "name": "collection",
440
+ "writable": true
441
+ },
442
+ {
443
+ "name": "system_program",
444
+ "address": "11111111111111111111111111111111"
445
+ }
446
+ ],
447
+ "args": []
448
+ },
424
449
  {
425
450
  "name": "create_user_trade",
426
451
  "discriminator": [232, 235, 58, 194, 135, 248, 153, 1],
@@ -659,6 +659,31 @@ export type TriadProtocol = {
659
659
  ];
660
660
  args: [];
661
661
  },
662
+ {
663
+ name: 'collectRoyalty';
664
+ discriminator: [189, 235, 7, 168, 255, 50, 30, 75];
665
+ accounts: [
666
+ {
667
+ name: 'signer';
668
+ writable: true;
669
+ signer: true;
670
+ },
671
+ {
672
+ name: 'squads';
673
+ writable: true;
674
+ address: '6fcSf6qfwPNR9AUUNC1UWYZDy5cQ4TzTb2aaipN2zFdq';
675
+ },
676
+ {
677
+ name: 'collection';
678
+ writable: true;
679
+ },
680
+ {
681
+ name: 'systemProgram';
682
+ address: '11111111111111111111111111111111';
683
+ }
684
+ ];
685
+ args: [];
686
+ },
662
687
  {
663
688
  name: 'createUserTrade';
664
689
  discriminator: [232, 235, 58, 194, 135, 248, 153, 1];
@@ -15,6 +15,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const axios_1 = __importDefault(require("axios"));
16
16
  const getPriorityFee = () => __awaiter(void 0, void 0, void 0, function* () {
17
17
  const response = yield axios_1.default.get('https://solanacompass.com/api/fees');
18
- return response.data[5].priorityTx || 1000;
18
+ return response.data[1].priorityTx || 1000;
19
19
  });
20
20
  exports.default = getPriorityFee;
@@ -1,7 +1,20 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
2
14
  Object.defineProperty(exports, "__esModule", { value: true });
3
15
  const web3_js_1 = require("@solana/web3.js");
4
- const sendTransactionWithOptions = (method, options) => {
16
+ const getPriorityFee_1 = __importDefault(require("./getPriorityFee"));
17
+ const sendTransactionWithOptions = (method, options) => __awaiter(void 0, void 0, void 0, function* () {
5
18
  if (options === null || options === void 0 ? void 0 : options.microLamports) {
6
19
  method.postInstructions([
7
20
  web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({
@@ -9,6 +22,14 @@ const sendTransactionWithOptions = (method, options) => {
9
22
  })
10
23
  ]);
11
24
  }
25
+ if (!(options === null || options === void 0 ? void 0 : options.microLamports)) {
26
+ const priorityFee = yield (0, getPriorityFee_1.default)();
27
+ method.postInstructions([
28
+ web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({
29
+ microLamports: priorityFee
30
+ })
31
+ ]);
32
+ }
12
33
  return method.rpc({ skipPreflight: options === null || options === void 0 ? void 0 : options.skipPreflight });
13
- };
34
+ });
14
35
  exports.default = sendTransactionWithOptions;
@@ -8,14 +8,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  const web3_js_1 = require("@solana/web3.js");
16
+ const getPriorityFee_1 = __importDefault(require("./getPriorityFee"));
13
17
  const sendVersionedTransaction = (provider, ixs, options, payer, addressLookupTableAccounts, verifier) => __awaiter(void 0, void 0, void 0, function* () {
14
18
  if (options === null || options === void 0 ? void 0 : options.microLamports) {
15
19
  ixs.push(web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({
16
20
  microLamports: options.microLamports
17
21
  }));
18
22
  }
23
+ if (!(options === null || options === void 0 ? void 0 : options.microLamports)) {
24
+ const priorityFee = yield (0, getPriorityFee_1.default)();
25
+ ixs.push(web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({
26
+ microLamports: priorityFee
27
+ }));
28
+ }
19
29
  const { blockhash } = yield provider.connection.getLatestBlockhash();
20
30
  const tx = new web3_js_1.VersionedTransaction(new web3_js_1.TransactionMessage({
21
31
  instructions: ixs,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "1.5.0-beta",
3
+ "version": "1.5.2-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",