@triadxyz/triad-protocol 1.5.1-beta → 1.5.3-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 +2 -2
- package/dist/index.js +6 -3
- package/dist/utils/{priorityFee.js → getPriorityFee.js} +1 -1
- package/dist/utils/sendTransactionWithOptions.js +23 -2
- package/dist/utils/sendVersionedTransaction.js +10 -0
- package/package.json +1 -1
- /package/dist/utils/{priorityFee.d.ts → getPriorityFee.d.ts} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -59,9 +59,9 @@ export default class TriadProtocolClient {
|
|
|
59
59
|
}, options?: RpcOptions): Promise<string>;
|
|
60
60
|
/**
|
|
61
61
|
* Collect Royalty
|
|
62
|
-
* @param collection - Collection
|
|
62
|
+
* @param collection - Collection Symbol
|
|
63
63
|
*
|
|
64
64
|
* @param options - RPC options
|
|
65
65
|
*/
|
|
66
|
-
collectRoyalty(collection:
|
|
66
|
+
collectRoyalty(collection: string, options?: RpcOptions): Promise<string>;
|
|
67
67
|
}
|
package/dist/index.js
CHANGED
|
@@ -24,7 +24,9 @@ const constants_1 = require("./utils/constants");
|
|
|
24
24
|
const sendTransactionWithOptions_1 = __importDefault(require("./utils/sendTransactionWithOptions"));
|
|
25
25
|
class TriadProtocolClient {
|
|
26
26
|
constructor(connection, wallet) {
|
|
27
|
-
this.provider = new anchor_1.AnchorProvider(connection, wallet
|
|
27
|
+
this.provider = new anchor_1.AnchorProvider(connection, wallet, {
|
|
28
|
+
commitment: 'processed'
|
|
29
|
+
});
|
|
28
30
|
this.program = new anchor_1.Program(idl_triad_protocol_json_1.default, this.provider);
|
|
29
31
|
this.trade = new trade_1.default(this.program, this.provider);
|
|
30
32
|
this.stake = new stake_1.default(this.program, this.provider);
|
|
@@ -154,15 +156,16 @@ class TriadProtocolClient {
|
|
|
154
156
|
}
|
|
155
157
|
/**
|
|
156
158
|
* Collect Royalty
|
|
157
|
-
* @param collection - Collection
|
|
159
|
+
* @param collection - Collection Symbol
|
|
158
160
|
*
|
|
159
161
|
* @param options - RPC options
|
|
160
162
|
*/
|
|
161
163
|
collectRoyalty(collection, options) {
|
|
162
164
|
return __awaiter(this, void 0, void 0, function* () {
|
|
165
|
+
const collectionPDA = (0, pda_1.getCollectionPDA)(this.program.programId, collection);
|
|
163
166
|
return (0, sendTransactionWithOptions_1.default)(this.program.methods.collectRoyalty().accounts({
|
|
164
167
|
signer: this.provider.wallet.publicKey,
|
|
165
|
-
collection
|
|
168
|
+
collection: collectionPDA
|
|
166
169
|
}), options);
|
|
167
170
|
});
|
|
168
171
|
}
|
|
@@ -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[
|
|
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
|
|
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
|
File without changes
|