@triadxyz/triad-protocol 1.5.1-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.
@@ -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.1-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",