@triadxyz/triad-protocol 0.1.2-alpha.7 → 0.1.2-alpha.8
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/vault.d.ts +4 -0
- package/dist/vault.js +14 -12
- package/package.json +1 -1
package/dist/vault.d.ts
CHANGED
|
@@ -57,6 +57,8 @@ export default class Vault {
|
|
|
57
57
|
amount: string;
|
|
58
58
|
position: 'Long' | 'Short';
|
|
59
59
|
mint: PublicKey;
|
|
60
|
+
}, options?: {
|
|
61
|
+
priorityFee: number;
|
|
60
62
|
}): Promise<string>;
|
|
61
63
|
/**
|
|
62
64
|
* Withdraw from a vault
|
|
@@ -71,5 +73,7 @@ export default class Vault {
|
|
|
71
73
|
tickerPDA: PublicKey;
|
|
72
74
|
mint: PublicKey;
|
|
73
75
|
positionIndex: number;
|
|
76
|
+
}, options?: {
|
|
77
|
+
priorityFee: number;
|
|
74
78
|
}): Promise<string>;
|
|
75
79
|
}
|
package/dist/vault.js
CHANGED
|
@@ -49,7 +49,7 @@ class Vault {
|
|
|
49
49
|
* @param position - Long or Short
|
|
50
50
|
* @param mint - Token mint for the vault (e.g. USDC)
|
|
51
51
|
*/
|
|
52
|
-
openPosition({ tickerPDA, amount, position, mint }) {
|
|
52
|
+
openPosition({ tickerPDA, amount, position, mint }, options) {
|
|
53
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
54
54
|
try {
|
|
55
55
|
const UserPositionPDA = (0, helpers_1.getUserPositionAddressSync)(this.program.programId, this.provider.wallet.publicKey, tickerPDA);
|
|
@@ -62,11 +62,12 @@ class Vault {
|
|
|
62
62
|
hasUserPosition = true;
|
|
63
63
|
}
|
|
64
64
|
catch (_a) { }
|
|
65
|
-
const instructions = [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
const instructions = [];
|
|
66
|
+
if (options === null || options === void 0 ? void 0 : options.priorityFee) {
|
|
67
|
+
instructions.push(web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({
|
|
68
|
+
microLamports: options.priorityFee
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
70
71
|
if (!hasUserPosition) {
|
|
71
72
|
instructions.push(yield this.program.methods
|
|
72
73
|
.createUserPosition()
|
|
@@ -112,7 +113,7 @@ class Vault {
|
|
|
112
113
|
* @param positionPubkey - The position public key
|
|
113
114
|
*
|
|
114
115
|
*/
|
|
115
|
-
closePosition({ tickerPDA, mint, positionIndex }) {
|
|
116
|
+
closePosition({ tickerPDA, mint, positionIndex }, options) {
|
|
116
117
|
return __awaiter(this, void 0, void 0, function* () {
|
|
117
118
|
try {
|
|
118
119
|
const UserPositionPDA = (0, helpers_1.getUserPositionAddressSync)(this.program.programId, this.provider.wallet.publicKey, tickerPDA);
|
|
@@ -127,11 +128,12 @@ class Vault {
|
|
|
127
128
|
catch (e) {
|
|
128
129
|
console.log(e);
|
|
129
130
|
}
|
|
130
|
-
const instructions = [
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
131
|
+
const instructions = [];
|
|
132
|
+
if (options === null || options === void 0 ? void 0 : options.priorityFee) {
|
|
133
|
+
instructions.push(web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({
|
|
134
|
+
microLamports: options.priorityFee
|
|
135
|
+
}));
|
|
136
|
+
}
|
|
135
137
|
if (!hasUser) {
|
|
136
138
|
instructions.push(yield this.program.methods
|
|
137
139
|
.createUserPosition()
|