flash-sdk 7.0.4 → 8.0.0-alpha.0
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/OraclePrice.d.ts +0 -1
- package/dist/OrderAccount.d.ts +2 -1
- package/dist/PerpetualsClient.d.ts +70 -20
- package/dist/PerpetualsClient.js +384 -496
- package/dist/PoolAccount.d.ts +0 -1
- package/dist/PoolConfig.d.ts +4 -1
- package/dist/PoolConfig.js +10 -2
- package/dist/PoolConfig.json +1717 -398
- package/dist/PoolDataClient.d.ts +0 -1
- package/dist/PositionAccount.d.ts +0 -1
- package/dist/TokenStakeAccount.d.ts +0 -1
- package/dist/TokenVaultAccount.d.ts +0 -1
- package/dist/TradingAccount.d.ts +0 -1
- package/dist/ViewHelper.js +2 -2
- package/dist/backupOracle.js +4 -4
- package/dist/constants/index.d.ts +0 -1
- package/dist/idl/perpetuals.d.ts +236 -518
- package/dist/idl/perpetuals.js +237 -519
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.js +3 -3
- package/dist/utils/IdlCoder.js +17 -7
- package/dist/utils/alt.js +5 -6
- package/dist/utils/anchorCpiEvents.d.ts +0 -1
- package/dist/utils/anchorCpiEvents.js +4 -4
- package/dist/utils/index.js +6 -6
- package/dist/utils/rpc.js +9 -9
- package/package.json +2 -1
package/dist/PerpetualsClient.js
CHANGED
|
@@ -20,8 +20,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g =
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -87,14 +87,59 @@ var PerpetualsClient = (function () {
|
|
|
87
87
|
var _this = this;
|
|
88
88
|
var _a;
|
|
89
89
|
this.addressLookupTables = [];
|
|
90
|
+
this.poolAddressLookupTables = new Map();
|
|
91
|
+
this.poolPusherAddressLookupTables = new Map();
|
|
90
92
|
this.setPrioritizationFee = function (fee) {
|
|
91
93
|
_this.prioritizationFee = fee;
|
|
92
94
|
};
|
|
93
95
|
this.loadAddressLookupTable = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
94
|
-
var addresses, _i, _a, address, addressLookupTable, accCreationLamports;
|
|
96
|
+
var addresses, _i, _a, address, addressLookupTable, _b, accCreationLamports;
|
|
97
|
+
return __generator(this, function (_c) {
|
|
98
|
+
switch (_c.label) {
|
|
99
|
+
case 0:
|
|
100
|
+
addresses = [];
|
|
101
|
+
_i = 0, _a = poolConfig.addressLookupTableAddresses;
|
|
102
|
+
_c.label = 1;
|
|
103
|
+
case 1:
|
|
104
|
+
if (!(_i < _a.length)) return [3, 4];
|
|
105
|
+
address = _a[_i];
|
|
106
|
+
return [4, this.provider.connection.getAddressLookupTable(address)];
|
|
107
|
+
case 2:
|
|
108
|
+
addressLookupTable = (_c.sent()).value;
|
|
109
|
+
if (addressLookupTable) {
|
|
110
|
+
addresses.push(addressLookupTable);
|
|
111
|
+
}
|
|
112
|
+
_c.label = 3;
|
|
113
|
+
case 3:
|
|
114
|
+
_i++;
|
|
115
|
+
return [3, 1];
|
|
116
|
+
case 4:
|
|
117
|
+
this.addressLookupTables = addresses;
|
|
118
|
+
_b = this;
|
|
119
|
+
return [4, this.provider.connection.getAddressLookupTable(poolConfig.pusherAddressLookupTableAddress)];
|
|
120
|
+
case 5:
|
|
121
|
+
_b.pusherAddressLookupTables = (_c.sent()).value;
|
|
122
|
+
return [4, (0, spl_token_1.getMinimumBalanceForRentExemptAccount)(this.provider.connection)];
|
|
123
|
+
case 6:
|
|
124
|
+
accCreationLamports = (_c.sent());
|
|
125
|
+
if (accCreationLamports) {
|
|
126
|
+
this.minimumBalanceForRentExemptAccountLamports = accCreationLamports;
|
|
127
|
+
}
|
|
128
|
+
return [2];
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}); };
|
|
132
|
+
this.getOrLoadAddressLookupTable = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
133
|
+
var cachedTables, addresses, _i, _a, address, addressLookupTable, accCreationLamports;
|
|
95
134
|
return __generator(this, function (_b) {
|
|
96
135
|
switch (_b.label) {
|
|
97
136
|
case 0:
|
|
137
|
+
cachedTables = this.poolAddressLookupTables.get(poolConfig.poolAddress.toBase58());
|
|
138
|
+
if (cachedTables) {
|
|
139
|
+
return [2, {
|
|
140
|
+
addressLookupTables: cachedTables,
|
|
141
|
+
}];
|
|
142
|
+
}
|
|
98
143
|
addresses = [];
|
|
99
144
|
_i = 0, _a = poolConfig.addressLookupTableAddresses;
|
|
100
145
|
_b.label = 1;
|
|
@@ -112,14 +157,18 @@ var PerpetualsClient = (function () {
|
|
|
112
157
|
_i++;
|
|
113
158
|
return [3, 1];
|
|
114
159
|
case 4:
|
|
115
|
-
this.
|
|
160
|
+
this.poolAddressLookupTables.set(poolConfig.poolAddress.toBase58(), addresses);
|
|
161
|
+
if (!!this.minimumBalanceForRentExemptAccountLamports) return [3, 6];
|
|
116
162
|
return [4, (0, spl_token_1.getMinimumBalanceForRentExemptAccount)(this.provider.connection)];
|
|
117
163
|
case 5:
|
|
118
164
|
accCreationLamports = (_b.sent());
|
|
119
165
|
if (accCreationLamports) {
|
|
120
166
|
this.minimumBalanceForRentExemptAccountLamports = accCreationLamports;
|
|
121
167
|
}
|
|
122
|
-
|
|
168
|
+
_b.label = 6;
|
|
169
|
+
case 6: return [2, {
|
|
170
|
+
addressLookupTables: addresses,
|
|
171
|
+
}];
|
|
123
172
|
}
|
|
124
173
|
});
|
|
125
174
|
}); };
|
|
@@ -1887,7 +1936,7 @@ var PerpetualsClient = (function () {
|
|
|
1887
1936
|
});
|
|
1888
1937
|
};
|
|
1889
1938
|
this.getStakedLpTokenPrice = function (poolKey, POOL_CONFIG) { return __awaiter(_this, void 0, void 0, function () {
|
|
1890
|
-
var backUpOracleInstructionPromise, custodies, custodyMetas, marketMetas, _i, custodies_1, token, _a, custodies_2, custody, _b, _c, market, transaction, backUpOracleInstruction, result, index, res;
|
|
1939
|
+
var backUpOracleInstructionPromise, custodies, custodyMetas, marketMetas, _i, custodies_1, token, _a, custodies_2, custody, _b, _c, market, transaction, backUpOracleInstruction, setCULimitIx, result, index, res;
|
|
1891
1940
|
var _d;
|
|
1892
1941
|
return __generator(this, function (_e) {
|
|
1893
1942
|
switch (_e.label) {
|
|
@@ -1935,6 +1984,8 @@ var PerpetualsClient = (function () {
|
|
|
1935
1984
|
return [4, backUpOracleInstructionPromise];
|
|
1936
1985
|
case 2:
|
|
1937
1986
|
backUpOracleInstruction = _e.sent();
|
|
1987
|
+
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
1988
|
+
transaction.instructions.unshift(setCULimitIx);
|
|
1938
1989
|
(_d = transaction.instructions).unshift.apply(_d, backUpOracleInstruction);
|
|
1939
1990
|
return [4, this.viewHelper.simulateTransaction(transaction)];
|
|
1940
1991
|
case 3:
|
|
@@ -2001,7 +2052,7 @@ var PerpetualsClient = (function () {
|
|
|
2001
2052
|
args_1[_i - 4] = arguments[_i];
|
|
2002
2053
|
}
|
|
2003
2054
|
return __awaiter(_this, __spreadArray([amount_1, poolKey_1, depositCustodyKey_1, POOL_CONFIG_1], args_1, true), void 0, function (amount, poolKey, depositCustodyKey, POOL_CONFIG, userPublicKey, enableBackupOracle) {
|
|
2004
|
-
var custodies, custodyMetas, marketMetas, _a, custodies_5, token, _b, custodies_6, custody, _c, _d, market, depositCustodyConfig, transaction, backUpOracleInstruction, result, index, res;
|
|
2055
|
+
var custodies, custodyMetas, marketMetas, _a, custodies_5, token, _b, custodies_6, custody, _c, _d, market, depositCustodyConfig, transaction, setCULimitIx, backUpOracleInstruction, result, index, res;
|
|
2005
2056
|
var _e;
|
|
2006
2057
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
2007
2058
|
if (enableBackupOracle === void 0) { enableBackupOracle = false; }
|
|
@@ -2052,6 +2103,8 @@ var PerpetualsClient = (function () {
|
|
|
2052
2103
|
.transaction()];
|
|
2053
2104
|
case 1:
|
|
2054
2105
|
transaction = _f.sent();
|
|
2106
|
+
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2107
|
+
transaction.instructions.unshift(setCULimitIx);
|
|
2055
2108
|
if (!enableBackupOracle) return [3, 3];
|
|
2056
2109
|
return [4, (0, backupOracle_1.createBackupOracleInstruction)(POOL_CONFIG.poolAddress.toBase58(), true)];
|
|
2057
2110
|
case 2:
|
|
@@ -2077,7 +2130,7 @@ var PerpetualsClient = (function () {
|
|
|
2077
2130
|
args_1[_i - 4] = arguments[_i];
|
|
2078
2131
|
}
|
|
2079
2132
|
return __awaiter(_this, __spreadArray([amount_1, poolKey_1, removeTokenCustodyKey_1, POOL_CONFIG_1], args_1, true), void 0, function (amount, poolKey, removeTokenCustodyKey, POOL_CONFIG, userPublicKey, enableBackupOracle) {
|
|
2080
|
-
var custodies, custodyMetas, marketMetas, _a, custodies_7, token, _b, custodies_8, custody, _c, _d, market, removeCustodyConfig, transaction, backUpOracleInstruction, result, index, res;
|
|
2133
|
+
var custodies, custodyMetas, marketMetas, _a, custodies_7, token, _b, custodies_8, custody, _c, _d, market, removeCustodyConfig, transaction, setCULimitIx, backUpOracleInstruction, result, index, res;
|
|
2081
2134
|
var _e;
|
|
2082
2135
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
2083
2136
|
if (enableBackupOracle === void 0) { enableBackupOracle = false; }
|
|
@@ -2128,6 +2181,8 @@ var PerpetualsClient = (function () {
|
|
|
2128
2181
|
.transaction()];
|
|
2129
2182
|
case 1:
|
|
2130
2183
|
transaction = _f.sent();
|
|
2184
|
+
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2185
|
+
transaction.instructions.unshift(setCULimitIx);
|
|
2131
2186
|
if (!enableBackupOracle) return [3, 3];
|
|
2132
2187
|
return [4, (0, backupOracle_1.createBackupOracleInstruction)(POOL_CONFIG.poolAddress.toBase58(), true)];
|
|
2133
2188
|
case 2:
|
|
@@ -2154,7 +2209,7 @@ var PerpetualsClient = (function () {
|
|
|
2154
2209
|
});
|
|
2155
2210
|
};
|
|
2156
2211
|
this.getCompoundingLPTokenPrice = function (poolKey, POOL_CONFIG) { return __awaiter(_this, void 0, void 0, function () {
|
|
2157
|
-
var backUpOracleInstructionPromise, custodies, custodyMetas, marketMetas, _i, custodies_9, token, _a, custodies_10, custody, _b, _c, market, backUpOracleInstruction, transaction, result, index, res;
|
|
2212
|
+
var backUpOracleInstructionPromise, custodies, custodyMetas, marketMetas, _i, custodies_9, token, _a, custodies_10, custody, _b, _c, market, backUpOracleInstruction, transaction, setCULimitIx, result, index, res;
|
|
2158
2213
|
var _d;
|
|
2159
2214
|
return __generator(this, function (_e) {
|
|
2160
2215
|
switch (_e.label) {
|
|
@@ -2202,6 +2257,8 @@ var PerpetualsClient = (function () {
|
|
|
2202
2257
|
.transaction()];
|
|
2203
2258
|
case 2:
|
|
2204
2259
|
transaction = _e.sent();
|
|
2260
|
+
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2261
|
+
transaction.instructions.unshift(setCULimitIx);
|
|
2205
2262
|
(_d = transaction.instructions).unshift.apply(_d, backUpOracleInstruction);
|
|
2206
2263
|
return [4, this.viewHelper.simulateTransaction(transaction)];
|
|
2207
2264
|
case 3:
|
|
@@ -2218,7 +2275,7 @@ var PerpetualsClient = (function () {
|
|
|
2218
2275
|
args_1[_i - 4] = arguments[_i];
|
|
2219
2276
|
}
|
|
2220
2277
|
return __awaiter(_this, __spreadArray([amount_1, poolKey_1, depositCustodyKey_1, POOL_CONFIG_1], args_1, true), void 0, function (amount, poolKey, depositCustodyKey, POOL_CONFIG, userPublicKey, enableBackupOracle) {
|
|
2221
|
-
var custodies, custodyMetas, marketMetas, _a, custodies_11, token, _b, custodies_12, custody, _c, _d, market, depositCustodyConfig, rewardCustody, transaction, backUpOracleInstruction, result, index, res;
|
|
2278
|
+
var custodies, custodyMetas, marketMetas, _a, custodies_11, token, _b, custodies_12, custody, _c, _d, market, depositCustodyConfig, rewardCustody, transaction, setCULimitIx, backUpOracleInstruction, result, index, res;
|
|
2222
2279
|
var _e;
|
|
2223
2280
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
2224
2281
|
if (enableBackupOracle === void 0) { enableBackupOracle = false; }
|
|
@@ -2273,6 +2330,8 @@ var PerpetualsClient = (function () {
|
|
|
2273
2330
|
.transaction()];
|
|
2274
2331
|
case 1:
|
|
2275
2332
|
transaction = _f.sent();
|
|
2333
|
+
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2334
|
+
transaction.instructions.unshift(setCULimitIx);
|
|
2276
2335
|
if (!enableBackupOracle) return [3, 3];
|
|
2277
2336
|
return [4, (0, backupOracle_1.createBackupOracleInstruction)(POOL_CONFIG.poolAddress.toBase58(), true)];
|
|
2278
2337
|
case 2:
|
|
@@ -2298,7 +2357,7 @@ var PerpetualsClient = (function () {
|
|
|
2298
2357
|
args_1[_i - 4] = arguments[_i];
|
|
2299
2358
|
}
|
|
2300
2359
|
return __awaiter(_this, __spreadArray([amount_1, poolKey_1, removeTokenCustodyKey_1, POOL_CONFIG_1], args_1, true), void 0, function (amount, poolKey, removeTokenCustodyKey, POOL_CONFIG, userPublicKey, enableBackupOracle) {
|
|
2301
|
-
var custodies, custodyMetas, marketMetas, _a, custodies_13, token, _b, custodies_14, custody, _c, _d, market, removeCustodyConfig, rewardCustody, transaction, backUpOracleInstruction, result, index, res;
|
|
2360
|
+
var custodies, custodyMetas, marketMetas, _a, custodies_13, token, _b, custodies_14, custody, _c, _d, market, removeCustodyConfig, rewardCustody, transaction, setCULimitIx, backUpOracleInstruction, result, index, res;
|
|
2302
2361
|
var _e;
|
|
2303
2362
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
2304
2363
|
if (enableBackupOracle === void 0) { enableBackupOracle = false; }
|
|
@@ -2353,6 +2412,8 @@ var PerpetualsClient = (function () {
|
|
|
2353
2412
|
.transaction()];
|
|
2354
2413
|
case 1:
|
|
2355
2414
|
transaction = _f.sent();
|
|
2415
|
+
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2416
|
+
transaction.instructions.unshift(setCULimitIx);
|
|
2356
2417
|
if (!enableBackupOracle) return [3, 3];
|
|
2357
2418
|
return [4, (0, backupOracle_1.createBackupOracleInstruction)(POOL_CONFIG.poolAddress.toBase58(), true)];
|
|
2358
2419
|
case 2:
|
|
@@ -4084,119 +4145,8 @@ var PerpetualsClient = (function () {
|
|
|
4084
4145
|
}
|
|
4085
4146
|
});
|
|
4086
4147
|
}); };
|
|
4087
|
-
this.updateNftAccount = function (nftMint, updateReferer, updateBooster, flpStakeAccounts) { return __awaiter(_this, void 0, void 0, function () {
|
|
4088
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, nftTradingAccount, nftReferralAccount, nftTokenAccount, flpStakeAccountMetas, _i, flpStakeAccounts_1, flpStakeAccountPk, updateNftTradingAccountInstruction, err_8;
|
|
4089
|
-
return __generator(this, function (_a) {
|
|
4090
|
-
switch (_a.label) {
|
|
4091
|
-
case 0:
|
|
4092
|
-
publicKey = this.provider.wallet.publicKey;
|
|
4093
|
-
preInstructions = [];
|
|
4094
|
-
instructions = [];
|
|
4095
|
-
postInstructions = [];
|
|
4096
|
-
additionalSigners = [];
|
|
4097
|
-
_a.label = 1;
|
|
4098
|
-
case 1:
|
|
4099
|
-
_a.trys.push([1, 4, , 5]);
|
|
4100
|
-
nftTradingAccount = web3_js_1.PublicKey.findProgramAddressSync([
|
|
4101
|
-
Buffer.from("trading"),
|
|
4102
|
-
nftMint.toBuffer(),
|
|
4103
|
-
], this.programId)[0];
|
|
4104
|
-
nftReferralAccount = web3_js_1.PublicKey.findProgramAddressSync([
|
|
4105
|
-
Buffer.from("referral"),
|
|
4106
|
-
publicKey.toBuffer(),
|
|
4107
|
-
], this.programId)[0];
|
|
4108
|
-
return [4, (0, spl_token_1.getAssociatedTokenAddress)(nftMint, publicKey, true)];
|
|
4109
|
-
case 2:
|
|
4110
|
-
nftTokenAccount = _a.sent();
|
|
4111
|
-
flpStakeAccountMetas = [];
|
|
4112
|
-
for (_i = 0, flpStakeAccounts_1 = flpStakeAccounts; _i < flpStakeAccounts_1.length; _i++) {
|
|
4113
|
-
flpStakeAccountPk = flpStakeAccounts_1[_i];
|
|
4114
|
-
flpStakeAccountMetas.push({
|
|
4115
|
-
pubkey: flpStakeAccountPk,
|
|
4116
|
-
isSigner: false,
|
|
4117
|
-
isWritable: true,
|
|
4118
|
-
});
|
|
4119
|
-
}
|
|
4120
|
-
return [4, this.program.methods
|
|
4121
|
-
.updateTradingAccount({
|
|
4122
|
-
updateReferer: updateReferer,
|
|
4123
|
-
updateBooster: updateBooster
|
|
4124
|
-
})
|
|
4125
|
-
.accounts({
|
|
4126
|
-
owner: publicKey,
|
|
4127
|
-
feePayer: publicKey,
|
|
4128
|
-
nftTokenAccount: nftTokenAccount,
|
|
4129
|
-
referralAccount: nftReferralAccount,
|
|
4130
|
-
tradingAccount: nftTradingAccount
|
|
4131
|
-
})
|
|
4132
|
-
.instruction()];
|
|
4133
|
-
case 3:
|
|
4134
|
-
updateNftTradingAccountInstruction = _a.sent();
|
|
4135
|
-
instructions.push(updateNftTradingAccountInstruction);
|
|
4136
|
-
return [3, 5];
|
|
4137
|
-
case 4:
|
|
4138
|
-
err_8 = _a.sent();
|
|
4139
|
-
console.log("perpClient updateNftAccount error:: ", err_8);
|
|
4140
|
-
throw err_8;
|
|
4141
|
-
case 5: return [2, {
|
|
4142
|
-
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4143
|
-
additionalSigners: additionalSigners
|
|
4144
|
-
}];
|
|
4145
|
-
}
|
|
4146
|
-
});
|
|
4147
|
-
}); };
|
|
4148
|
-
this.levelUp = function (poolConfig, nftMint, authorizationRulesAccount) { return __awaiter(_this, void 0, void 0, function () {
|
|
4149
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, nftTradingAccount, metadataAccount, levelUpInstruction, err_9;
|
|
4150
|
-
return __generator(this, function (_a) {
|
|
4151
|
-
switch (_a.label) {
|
|
4152
|
-
case 0:
|
|
4153
|
-
publicKey = this.provider.wallet.publicKey;
|
|
4154
|
-
preInstructions = [];
|
|
4155
|
-
instructions = [];
|
|
4156
|
-
postInstructions = [];
|
|
4157
|
-
additionalSigners = [];
|
|
4158
|
-
_a.label = 1;
|
|
4159
|
-
case 1:
|
|
4160
|
-
_a.trys.push([1, 3, , 4]);
|
|
4161
|
-
nftTradingAccount = web3_js_1.PublicKey.findProgramAddressSync([
|
|
4162
|
-
Buffer.from("trading"),
|
|
4163
|
-
nftMint.toBuffer(),
|
|
4164
|
-
], this.programId)[0];
|
|
4165
|
-
metadataAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), nftMint.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
|
|
4166
|
-
return [4, this.program.methods
|
|
4167
|
-
.levelUp({})
|
|
4168
|
-
.accounts({
|
|
4169
|
-
owner: publicKey,
|
|
4170
|
-
perpetuals: this.perpetuals.publicKey,
|
|
4171
|
-
pool: poolConfig.poolAddress,
|
|
4172
|
-
metadataAccount: metadataAccount,
|
|
4173
|
-
nftMint: nftMint,
|
|
4174
|
-
metadataProgram: constants_1.METAPLEX_PROGRAM_ID,
|
|
4175
|
-
tradingAccount: nftTradingAccount,
|
|
4176
|
-
transferAuthority: this.authority.publicKey,
|
|
4177
|
-
authorizationRulesAccount: authorizationRulesAccount,
|
|
4178
|
-
authorizationRulesProgram: new web3_js_1.PublicKey('auth9SigNpDKz4sJJ1DfCTuZrZNSAgh9sFD3rboVmgg'),
|
|
4179
|
-
systemProgram: web3_js_1.SystemProgram.programId,
|
|
4180
|
-
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
|
|
4181
|
-
})
|
|
4182
|
-
.instruction()];
|
|
4183
|
-
case 2:
|
|
4184
|
-
levelUpInstruction = _a.sent();
|
|
4185
|
-
instructions.push(levelUpInstruction);
|
|
4186
|
-
return [3, 4];
|
|
4187
|
-
case 3:
|
|
4188
|
-
err_9 = _a.sent();
|
|
4189
|
-
console.log("perpClient levelUp error:: ", err_9);
|
|
4190
|
-
throw err_9;
|
|
4191
|
-
case 4: return [2, {
|
|
4192
|
-
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4193
|
-
additionalSigners: additionalSigners
|
|
4194
|
-
}];
|
|
4195
|
-
}
|
|
4196
|
-
});
|
|
4197
|
-
}); };
|
|
4198
4148
|
this.depositStake = function (owner, feePayer, depositAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
4199
|
-
var preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, depositStakeInstruction,
|
|
4149
|
+
var preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, depositStakeInstruction, err_8;
|
|
4200
4150
|
return __generator(this, function (_a) {
|
|
4201
4151
|
switch (_a.label) {
|
|
4202
4152
|
case 0:
|
|
@@ -4238,9 +4188,9 @@ var PerpetualsClient = (function () {
|
|
|
4238
4188
|
instructions.push(depositStakeInstruction);
|
|
4239
4189
|
return [3, 5];
|
|
4240
4190
|
case 4:
|
|
4241
|
-
|
|
4242
|
-
console.log("perpClient depositStaking error:: ",
|
|
4243
|
-
throw
|
|
4191
|
+
err_8 = _a.sent();
|
|
4192
|
+
console.log("perpClient depositStaking error:: ", err_8);
|
|
4193
|
+
throw err_8;
|
|
4244
4194
|
case 5: return [2, {
|
|
4245
4195
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4246
4196
|
additionalSigners: additionalSigners
|
|
@@ -4249,7 +4199,7 @@ var PerpetualsClient = (function () {
|
|
|
4249
4199
|
});
|
|
4250
4200
|
}); };
|
|
4251
4201
|
this.refreshStakeWithAllFlpStakeAccounts = function (rewardSymbol, poolConfig, flpStakeAccountPks) { return __awaiter(_this, void 0, void 0, function () {
|
|
4252
|
-
var rewardCustodyMint, rewardCustodyConfig, pool, feeDistributionTokenAccount, custodyAccountMetas, _i, _a, custody, maxFlpStakeAccountPkLength, flpStakeAccountMetas, _b, flpStakeAccountPks_1, flpStakeAccountPk, refreshStakeInstruction,
|
|
4202
|
+
var rewardCustodyMint, rewardCustodyConfig, pool, feeDistributionTokenAccount, custodyAccountMetas, _i, _a, custody, maxFlpStakeAccountPkLength, flpStakeAccountMetas, _b, flpStakeAccountPks_1, flpStakeAccountPk, refreshStakeInstruction, err_9;
|
|
4253
4203
|
return __generator(this, function (_c) {
|
|
4254
4204
|
switch (_c.label) {
|
|
4255
4205
|
case 0:
|
|
@@ -4296,9 +4246,9 @@ var PerpetualsClient = (function () {
|
|
|
4296
4246
|
refreshStakeInstruction = _c.sent();
|
|
4297
4247
|
return [2, refreshStakeInstruction];
|
|
4298
4248
|
case 2:
|
|
4299
|
-
|
|
4300
|
-
console.log("perpClient refreshStaking error:: ",
|
|
4301
|
-
throw
|
|
4249
|
+
err_9 = _c.sent();
|
|
4250
|
+
console.log("perpClient refreshStaking error:: ", err_9);
|
|
4251
|
+
throw err_9;
|
|
4302
4252
|
case 3: return [2];
|
|
4303
4253
|
}
|
|
4304
4254
|
});
|
|
@@ -4309,7 +4259,7 @@ var PerpetualsClient = (function () {
|
|
|
4309
4259
|
args_1[_i - 3] = arguments[_i];
|
|
4310
4260
|
}
|
|
4311
4261
|
return __awaiter(_this, __spreadArray([rewardSymbol_1, poolConfig_1, flpStakeAccountPk_1], args_1, true), void 0, function (rewardSymbol, poolConfig, flpStakeAccountPk, userPublicKey) {
|
|
4312
|
-
var publicKey, rewardCustodyMint, rewardCustodyConfig, pool, feeDistributionTokenAccount, custodyAccountMetas, _a, _b, custody, stakeAccountMetas, tokenStakeAccount, refreshStakeInstruction,
|
|
4262
|
+
var publicKey, rewardCustodyMint, rewardCustodyConfig, pool, feeDistributionTokenAccount, custodyAccountMetas, _a, _b, custody, stakeAccountMetas, tokenStakeAccount, refreshStakeInstruction, err_10;
|
|
4313
4263
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
4314
4264
|
return __generator(this, function (_c) {
|
|
4315
4265
|
switch (_c.label) {
|
|
@@ -4357,9 +4307,9 @@ var PerpetualsClient = (function () {
|
|
|
4357
4307
|
refreshStakeInstruction = _c.sent();
|
|
4358
4308
|
return [2, refreshStakeInstruction];
|
|
4359
4309
|
case 2:
|
|
4360
|
-
|
|
4361
|
-
console.log("perpClient refreshStaking error:: ",
|
|
4362
|
-
throw
|
|
4310
|
+
err_10 = _c.sent();
|
|
4311
|
+
console.log("perpClient refreshStaking error:: ", err_10);
|
|
4312
|
+
throw err_10;
|
|
4363
4313
|
case 3: return [2];
|
|
4364
4314
|
}
|
|
4365
4315
|
});
|
|
@@ -4371,7 +4321,7 @@ var PerpetualsClient = (function () {
|
|
|
4371
4321
|
args_1[_i - 3] = arguments[_i];
|
|
4372
4322
|
}
|
|
4373
4323
|
return __awaiter(_this, __spreadArray([rewardSymbol_1, unstakeAmount_1, poolConfig_1], args_1, true), void 0, function (rewardSymbol, unstakeAmount, poolConfig, userPublicKey) {
|
|
4374
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, pool, flpStakeAccount, tokenStakeAccount, tokenStakeAccounts, _a, unstakeInstantInstruction,
|
|
4324
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, pool, flpStakeAccount, tokenStakeAccount, tokenStakeAccounts, _a, unstakeInstantInstruction, err_11;
|
|
4375
4325
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
4376
4326
|
return __generator(this, function (_b) {
|
|
4377
4327
|
switch (_b.label) {
|
|
@@ -4423,9 +4373,9 @@ var PerpetualsClient = (function () {
|
|
|
4423
4373
|
instructions.push(unstakeInstantInstruction);
|
|
4424
4374
|
return [3, 6];
|
|
4425
4375
|
case 5:
|
|
4426
|
-
|
|
4427
|
-
console.log("perpClient unstakeInstant error:: ",
|
|
4428
|
-
throw
|
|
4376
|
+
err_11 = _b.sent();
|
|
4377
|
+
console.log("perpClient unstakeInstant error:: ", err_11);
|
|
4378
|
+
throw err_11;
|
|
4429
4379
|
case 6: return [2, {
|
|
4430
4380
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4431
4381
|
additionalSigners: additionalSigners
|
|
@@ -4435,7 +4385,7 @@ var PerpetualsClient = (function () {
|
|
|
4435
4385
|
});
|
|
4436
4386
|
};
|
|
4437
4387
|
this.setFeeShareBps = function (poolConfig, flpStakeAccountPks) { return __awaiter(_this, void 0, void 0, function () {
|
|
4438
|
-
var publicKey, pool, custodyAccountMetas, _i, _a, custody, maxFlpStakeAccountPkLength, flpStakeAccountMetas, _b, flpStakeAccountPks_2, flpStakeAccountPk, refreshStakeInstruction,
|
|
4388
|
+
var publicKey, pool, custodyAccountMetas, _i, _a, custody, maxFlpStakeAccountPkLength, flpStakeAccountMetas, _b, flpStakeAccountPks_2, flpStakeAccountPk, refreshStakeInstruction, err_12;
|
|
4439
4389
|
return __generator(this, function (_c) {
|
|
4440
4390
|
switch (_c.label) {
|
|
4441
4391
|
case 0:
|
|
@@ -4479,15 +4429,15 @@ var PerpetualsClient = (function () {
|
|
|
4479
4429
|
refreshStakeInstruction = _c.sent();
|
|
4480
4430
|
return [2, refreshStakeInstruction];
|
|
4481
4431
|
case 2:
|
|
4482
|
-
|
|
4483
|
-
console.log("perpClient refreshStaking error:: ",
|
|
4484
|
-
throw
|
|
4432
|
+
err_12 = _c.sent();
|
|
4433
|
+
console.log("perpClient refreshStaking error:: ", err_12);
|
|
4434
|
+
throw err_12;
|
|
4485
4435
|
case 3: return [2];
|
|
4486
4436
|
}
|
|
4487
4437
|
});
|
|
4488
4438
|
}); };
|
|
4489
4439
|
this.unstakeRequest = function (unstakeAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
4490
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, unstakeRequestInstruction,
|
|
4440
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, unstakeRequestInstruction, err_13;
|
|
4491
4441
|
return __generator(this, function (_a) {
|
|
4492
4442
|
switch (_a.label) {
|
|
4493
4443
|
case 0:
|
|
@@ -4521,9 +4471,9 @@ var PerpetualsClient = (function () {
|
|
|
4521
4471
|
instructions.push(unstakeRequestInstruction);
|
|
4522
4472
|
return [3, 4];
|
|
4523
4473
|
case 3:
|
|
4524
|
-
|
|
4525
|
-
console.log("perpClient unstakeRequest error:: ",
|
|
4526
|
-
throw
|
|
4474
|
+
err_13 = _a.sent();
|
|
4475
|
+
console.log("perpClient unstakeRequest error:: ", err_13);
|
|
4476
|
+
throw err_13;
|
|
4527
4477
|
case 4: return [2, {
|
|
4528
4478
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4529
4479
|
additionalSigners: additionalSigners
|
|
@@ -4537,7 +4487,7 @@ var PerpetualsClient = (function () {
|
|
|
4537
4487
|
args_1[_i - 1] = arguments[_i];
|
|
4538
4488
|
}
|
|
4539
4489
|
return __awaiter(_this, __spreadArray([poolConfig_1], args_1, true), void 0, function (poolConfig, pendingActivation, deactivated, createUserLPTA, userPublicKey) {
|
|
4540
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, pool, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, _a, withdrawStakeInstruction,
|
|
4490
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, pool, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, _a, withdrawStakeInstruction, err_14;
|
|
4541
4491
|
if (pendingActivation === void 0) { pendingActivation = true; }
|
|
4542
4492
|
if (deactivated === void 0) { deactivated = true; }
|
|
4543
4493
|
if (createUserLPTA === void 0) { createUserLPTA = true; }
|
|
@@ -4593,9 +4543,9 @@ var PerpetualsClient = (function () {
|
|
|
4593
4543
|
instructions.push(withdrawStakeInstruction);
|
|
4594
4544
|
return [3, 6];
|
|
4595
4545
|
case 5:
|
|
4596
|
-
|
|
4597
|
-
console.log("perpClient withdrawStake error:: ",
|
|
4598
|
-
throw
|
|
4546
|
+
err_14 = _b.sent();
|
|
4547
|
+
console.log("perpClient withdrawStake error:: ", err_14);
|
|
4548
|
+
throw err_14;
|
|
4599
4549
|
case 6: return [2, {
|
|
4600
4550
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4601
4551
|
additionalSigners: additionalSigners
|
|
@@ -4610,7 +4560,7 @@ var PerpetualsClient = (function () {
|
|
|
4610
4560
|
args_1[_i - 3] = arguments[_i];
|
|
4611
4561
|
}
|
|
4612
4562
|
return __awaiter(_this, __spreadArray([rewardSymbol_1, poolConfig_1, tokenStakeAccount_1], args_1, true), void 0, function (rewardSymbol, poolConfig, tokenStakeAccount, createUserATA) {
|
|
4613
|
-
var publicKey, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tokenStakeAccounts, withdrawStakeInstruction,
|
|
4563
|
+
var publicKey, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tokenStakeAccounts, withdrawStakeInstruction, err_15;
|
|
4614
4564
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
4615
4565
|
return __generator(this, function (_b) {
|
|
4616
4566
|
switch (_b.label) {
|
|
@@ -4671,9 +4621,9 @@ var PerpetualsClient = (function () {
|
|
|
4671
4621
|
instructions.push(withdrawStakeInstruction);
|
|
4672
4622
|
return [3, 6];
|
|
4673
4623
|
case 5:
|
|
4674
|
-
|
|
4675
|
-
console.log("perpClient withdrawStake error:: ",
|
|
4676
|
-
throw
|
|
4624
|
+
err_15 = _b.sent();
|
|
4625
|
+
console.log("perpClient withdrawStake error:: ", err_15);
|
|
4626
|
+
throw err_15;
|
|
4677
4627
|
case 6: return [2, {
|
|
4678
4628
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4679
4629
|
additionalSigners: additionalSigners
|
|
@@ -4688,7 +4638,7 @@ var PerpetualsClient = (function () {
|
|
|
4688
4638
|
args_1[_i - 5] = arguments[_i];
|
|
4689
4639
|
}
|
|
4690
4640
|
return __awaiter(_this, __spreadArray([amountIn_1, minCompoundingAmountOut_1, inTokenSymbol_1, rewardTokenMint_1, poolConfig_1], args_1, true), void 0, function (amountIn, minCompoundingAmountOut, inTokenSymbol, rewardTokenMint, poolConfig, skipBalanceChecks, ephemeralSignerPubkey, userPublicKey) {
|
|
4691
|
-
var publicKey, preInstructions, instructions, additionalSigners, postInstructions, rewardCustody, inCustodyConfig, lpTokenMint, compoundingTokenMint, wrappedSolAccount, lpTokenAccount, compoundingTokenAccount, fundingAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, lamports, unWrappedSolBalance, _e, addCompoundingLiquidity,
|
|
4641
|
+
var publicKey, preInstructions, instructions, additionalSigners, postInstructions, rewardCustody, inCustodyConfig, lpTokenMint, compoundingTokenMint, wrappedSolAccount, lpTokenAccount, compoundingTokenAccount, fundingAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, lamports, unWrappedSolBalance, _e, addCompoundingLiquidity, err_16;
|
|
4692
4642
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
|
4693
4643
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
4694
4644
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
@@ -4816,8 +4766,8 @@ var PerpetualsClient = (function () {
|
|
|
4816
4766
|
instructions.push(addCompoundingLiquidity);
|
|
4817
4767
|
return [3, 10];
|
|
4818
4768
|
case 9:
|
|
4819
|
-
|
|
4820
|
-
console.log("perpClient addCompoundingLiquidity error:: ",
|
|
4769
|
+
err_16 = _f.sent();
|
|
4770
|
+
console.log("perpClient addCompoundingLiquidity error:: ", err_16);
|
|
4821
4771
|
return [3, 10];
|
|
4822
4772
|
case 10: return [2, {
|
|
4823
4773
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
@@ -4833,7 +4783,7 @@ var PerpetualsClient = (function () {
|
|
|
4833
4783
|
args_1[_i - 5] = arguments[_i];
|
|
4834
4784
|
}
|
|
4835
4785
|
return __awaiter(_this, __spreadArray([compoundingAmountIn_1, minAmountOut_1, outTokenSymbol_1, rewardTokenMint_1, poolConfig_1], args_1, true), void 0, function (compoundingAmountIn, minAmountOut, outTokenSymbol, rewardTokenMint, poolConfig, createUserATA, ephemeralSignerPubkey, userPublicKey) {
|
|
4836
|
-
var publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, outCustodyConfig, lpTokenMint, compoundingTokenMint, lamports, _a, custodyAccountMetas, custodyOracleAccountMetas, markets, _b, _c, custody, _d, _e, market, compoundingTokenAccount, removeCompoundingLiquidity,
|
|
4786
|
+
var publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, outCustodyConfig, lpTokenMint, compoundingTokenMint, lamports, _a, custodyAccountMetas, custodyOracleAccountMetas, markets, _b, _c, custody, _d, _e, market, compoundingTokenAccount, removeCompoundingLiquidity, err_17;
|
|
4837
4787
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
4838
4788
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
4839
4789
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
@@ -4945,8 +4895,8 @@ var PerpetualsClient = (function () {
|
|
|
4945
4895
|
instructions.push(removeCompoundingLiquidity);
|
|
4946
4896
|
return [3, 8];
|
|
4947
4897
|
case 7:
|
|
4948
|
-
|
|
4949
|
-
console.log("perpClient removeCompoundingLiquidity error:: ",
|
|
4898
|
+
err_17 = _f.sent();
|
|
4899
|
+
console.log("perpClient removeCompoundingLiquidity error:: ", err_17);
|
|
4950
4900
|
return [3, 8];
|
|
4951
4901
|
case 8: return [2, {
|
|
4952
4902
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
@@ -4962,7 +4912,7 @@ var PerpetualsClient = (function () {
|
|
|
4962
4912
|
args_1[_i - 3] = arguments[_i];
|
|
4963
4913
|
}
|
|
4964
4914
|
return __awaiter(_this, __spreadArray([amount_1, rewardTokenMint_1, poolConfig_1], args_1, true), void 0, function (amount, rewardTokenMint, poolConfig, createUserATA) {
|
|
4965
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, _a, flpStakeAccount, tokenStakeAccount, tokenStakeAccounts, _b, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _c, _d, custody, _e, _f, market, migrateStake,
|
|
4915
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, _a, flpStakeAccount, tokenStakeAccount, tokenStakeAccounts, _b, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _c, _d, custody, _e, _f, market, migrateStake, err_18;
|
|
4966
4916
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
4967
4917
|
return __generator(this, function (_g) {
|
|
4968
4918
|
switch (_g.label) {
|
|
@@ -5060,8 +5010,8 @@ var PerpetualsClient = (function () {
|
|
|
5060
5010
|
instructions.push(migrateStake);
|
|
5061
5011
|
return [3, 8];
|
|
5062
5012
|
case 7:
|
|
5063
|
-
|
|
5064
|
-
console.log("perpClient migrateStake error:: ",
|
|
5013
|
+
err_18 = _g.sent();
|
|
5014
|
+
console.log("perpClient migrateStake error:: ", err_18);
|
|
5065
5015
|
return [3, 8];
|
|
5066
5016
|
case 8: return [2, {
|
|
5067
5017
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
@@ -5072,7 +5022,7 @@ var PerpetualsClient = (function () {
|
|
|
5072
5022
|
});
|
|
5073
5023
|
};
|
|
5074
5024
|
this.migrateFlp = function (amount, rewardTokenMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5075
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, migrateFlp,
|
|
5025
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, migrateFlp, err_19;
|
|
5076
5026
|
return __generator(this, function (_d) {
|
|
5077
5027
|
switch (_d.label) {
|
|
5078
5028
|
case 0:
|
|
@@ -5144,8 +5094,8 @@ var PerpetualsClient = (function () {
|
|
|
5144
5094
|
instructions.push(migrateFlp);
|
|
5145
5095
|
return [3, 4];
|
|
5146
5096
|
case 3:
|
|
5147
|
-
|
|
5148
|
-
console.log("perpClient migrateFlp error:: ",
|
|
5097
|
+
err_19 = _d.sent();
|
|
5098
|
+
console.log("perpClient migrateFlp error:: ", err_19);
|
|
5149
5099
|
return [3, 4];
|
|
5150
5100
|
case 4: return [2, {
|
|
5151
5101
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
@@ -5160,7 +5110,7 @@ var PerpetualsClient = (function () {
|
|
|
5160
5110
|
args_1[_i - 1] = arguments[_i];
|
|
5161
5111
|
}
|
|
5162
5112
|
return __awaiter(_this, __spreadArray([poolConfig_1], args_1, true), void 0, function (poolConfig, rewardTokenSymbol) {
|
|
5163
|
-
var instructions, additionalSigners, rewardCustody, lpTokenMint, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, compoundingFee,
|
|
5113
|
+
var instructions, additionalSigners, rewardCustody, lpTokenMint, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, compoundingFee, err_20;
|
|
5164
5114
|
if (rewardTokenSymbol === void 0) { rewardTokenSymbol = 'USDC'; }
|
|
5165
5115
|
return __generator(this, function (_e) {
|
|
5166
5116
|
switch (_e.label) {
|
|
@@ -5218,8 +5168,8 @@ var PerpetualsClient = (function () {
|
|
|
5218
5168
|
instructions.push(compoundingFee);
|
|
5219
5169
|
return [3, 4];
|
|
5220
5170
|
case 3:
|
|
5221
|
-
|
|
5222
|
-
console.log("perpClient compoundingFee error:: ",
|
|
5171
|
+
err_20 = _e.sent();
|
|
5172
|
+
console.log("perpClient compoundingFee error:: ", err_20);
|
|
5223
5173
|
return [3, 4];
|
|
5224
5174
|
case 4: return [2, {
|
|
5225
5175
|
instructions: __spreadArray([], instructions, true),
|
|
@@ -5229,146 +5179,8 @@ var PerpetualsClient = (function () {
|
|
|
5229
5179
|
});
|
|
5230
5180
|
});
|
|
5231
5181
|
};
|
|
5232
|
-
this.burnAndClaim = function (owner, nftMint, poolConfig, createAta) { return __awaiter(_this, void 0, void 0, function () {
|
|
5233
|
-
var preInstructions, instructions, postInstructions, additionalSigners, userTokenAccount, _a, nftTokenAccount, nftTradingAccount, metadataAccount, collectionMetadata, edition, tokenRecord, burnAndClaimInstruction, err_23;
|
|
5234
|
-
return __generator(this, function (_b) {
|
|
5235
|
-
switch (_b.label) {
|
|
5236
|
-
case 0:
|
|
5237
|
-
preInstructions = [];
|
|
5238
|
-
instructions = [];
|
|
5239
|
-
postInstructions = [];
|
|
5240
|
-
additionalSigners = [];
|
|
5241
|
-
_b.label = 1;
|
|
5242
|
-
case 1:
|
|
5243
|
-
_b.trys.push([1, 7, , 8]);
|
|
5244
|
-
return [4, (0, spl_token_1.getAssociatedTokenAddress)(poolConfig.tokenMint, owner, true)];
|
|
5245
|
-
case 2:
|
|
5246
|
-
userTokenAccount = _b.sent();
|
|
5247
|
-
_a = createAta;
|
|
5248
|
-
if (!_a) return [3, 4];
|
|
5249
|
-
return [4, (0, utils_1.checkIfAccountExists)(userTokenAccount, this.provider.connection)];
|
|
5250
|
-
case 3:
|
|
5251
|
-
_a = !(_b.sent());
|
|
5252
|
-
_b.label = 4;
|
|
5253
|
-
case 4:
|
|
5254
|
-
if (_a) {
|
|
5255
|
-
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(owner, userTokenAccount, owner, poolConfig.tokenMint));
|
|
5256
|
-
}
|
|
5257
|
-
return [4, (0, spl_token_1.getAssociatedTokenAddress)(nftMint, owner, true)];
|
|
5258
|
-
case 5:
|
|
5259
|
-
nftTokenAccount = _b.sent();
|
|
5260
|
-
nftTradingAccount = web3_js_1.PublicKey.findProgramAddressSync([
|
|
5261
|
-
Buffer.from("trading"),
|
|
5262
|
-
nftMint.toBuffer(),
|
|
5263
|
-
], this.programId)[0];
|
|
5264
|
-
metadataAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), nftMint.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
|
|
5265
|
-
collectionMetadata = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), poolConfig.nftCollectionAddress.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
|
|
5266
|
-
edition = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), nftMint.toBuffer(), Buffer.from("edition")], constants_1.METAPLEX_PROGRAM_ID)[0];
|
|
5267
|
-
tokenRecord = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), nftMint.toBuffer(), Buffer.from("token_record"), nftTokenAccount.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
|
|
5268
|
-
return [4, this.program.methods
|
|
5269
|
-
.burnAndClaim({})
|
|
5270
|
-
.accounts({
|
|
5271
|
-
owner: owner,
|
|
5272
|
-
receivingTokenAccount: userTokenAccount,
|
|
5273
|
-
perpetuals: this.perpetuals.publicKey,
|
|
5274
|
-
tokenVault: poolConfig.tokenVault,
|
|
5275
|
-
tokenVaultTokenAccount: poolConfig.tokenVaultTokenAccount,
|
|
5276
|
-
metadataAccount: metadataAccount,
|
|
5277
|
-
collectionMetadata: collectionMetadata,
|
|
5278
|
-
edition: edition,
|
|
5279
|
-
tokenRecord: tokenRecord,
|
|
5280
|
-
tradingAccount: nftTradingAccount,
|
|
5281
|
-
transferAuthority: poolConfig.transferAuthority,
|
|
5282
|
-
metadataProgram: constants_1.METAPLEX_PROGRAM_ID,
|
|
5283
|
-
nftMint: nftMint,
|
|
5284
|
-
nftTokenAccount: nftTokenAccount,
|
|
5285
|
-
systemProgram: web3_js_1.SystemProgram.programId,
|
|
5286
|
-
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
5287
|
-
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
5288
|
-
eventAuthority: this.eventAuthority.publicKey,
|
|
5289
|
-
program: this.programId,
|
|
5290
|
-
receivingTokenMint: poolConfig.tokenMint,
|
|
5291
|
-
})
|
|
5292
|
-
.instruction()];
|
|
5293
|
-
case 6:
|
|
5294
|
-
burnAndClaimInstruction = _b.sent();
|
|
5295
|
-
instructions.push(burnAndClaimInstruction);
|
|
5296
|
-
return [3, 8];
|
|
5297
|
-
case 7:
|
|
5298
|
-
err_23 = _b.sent();
|
|
5299
|
-
console.log("perpClient burnAndClaimInstruction error:: ", err_23);
|
|
5300
|
-
throw err_23;
|
|
5301
|
-
case 8: return [2, {
|
|
5302
|
-
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5303
|
-
additionalSigners: additionalSigners
|
|
5304
|
-
}];
|
|
5305
|
-
}
|
|
5306
|
-
});
|
|
5307
|
-
}); };
|
|
5308
|
-
this.burnAndStake = function (owner, feePayer, nftMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5309
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, nftTokenAccount, nftTradingAccount, metadataAccount, collectionMetadata, edition, tokenRecord, burnAndStakeInstruction, err_24;
|
|
5310
|
-
return __generator(this, function (_a) {
|
|
5311
|
-
switch (_a.label) {
|
|
5312
|
-
case 0:
|
|
5313
|
-
preInstructions = [];
|
|
5314
|
-
instructions = [];
|
|
5315
|
-
postInstructions = [];
|
|
5316
|
-
additionalSigners = [];
|
|
5317
|
-
_a.label = 1;
|
|
5318
|
-
case 1:
|
|
5319
|
-
_a.trys.push([1, 3, , 4]);
|
|
5320
|
-
tokenStakeAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("token_stake"), owner.toBuffer()], this.programId)[0];
|
|
5321
|
-
nftTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(nftMint, owner, true);
|
|
5322
|
-
nftTradingAccount = web3_js_1.PublicKey.findProgramAddressSync([
|
|
5323
|
-
Buffer.from("trading"),
|
|
5324
|
-
nftMint.toBuffer(),
|
|
5325
|
-
], this.programId)[0];
|
|
5326
|
-
metadataAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), nftMint.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
|
|
5327
|
-
collectionMetadata = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), poolConfig.nftCollectionAddress.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
|
|
5328
|
-
edition = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), nftMint.toBuffer(), Buffer.from("edition")], constants_1.METAPLEX_PROGRAM_ID)[0];
|
|
5329
|
-
tokenRecord = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), nftMint.toBuffer(), Buffer.from("token_record"), nftTokenAccount.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
|
|
5330
|
-
return [4, this.program.methods
|
|
5331
|
-
.burnAndStake({})
|
|
5332
|
-
.accounts({
|
|
5333
|
-
owner: owner,
|
|
5334
|
-
feePayer: feePayer,
|
|
5335
|
-
perpetuals: this.perpetuals.publicKey,
|
|
5336
|
-
tokenVault: poolConfig.tokenVault,
|
|
5337
|
-
tokenVaultTokenAccount: poolConfig.tokenVaultTokenAccount,
|
|
5338
|
-
tokenStakeAccount: tokenStakeAccount,
|
|
5339
|
-
metadataAccount: metadataAccount,
|
|
5340
|
-
collectionMetadata: collectionMetadata,
|
|
5341
|
-
edition: edition,
|
|
5342
|
-
tokenRecord: tokenRecord,
|
|
5343
|
-
tradingAccount: nftTradingAccount,
|
|
5344
|
-
transferAuthority: poolConfig.transferAuthority,
|
|
5345
|
-
metadataProgram: constants_1.METAPLEX_PROGRAM_ID,
|
|
5346
|
-
nftMint: nftMint,
|
|
5347
|
-
nftTokenAccount: nftTokenAccount,
|
|
5348
|
-
systemProgram: web3_js_1.SystemProgram.programId,
|
|
5349
|
-
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
5350
|
-
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
5351
|
-
eventAuthority: this.eventAuthority.publicKey,
|
|
5352
|
-
program: this.programId
|
|
5353
|
-
})
|
|
5354
|
-
.instruction()];
|
|
5355
|
-
case 2:
|
|
5356
|
-
burnAndStakeInstruction = _a.sent();
|
|
5357
|
-
instructions.push(burnAndStakeInstruction);
|
|
5358
|
-
return [3, 4];
|
|
5359
|
-
case 3:
|
|
5360
|
-
err_24 = _a.sent();
|
|
5361
|
-
console.log("perpClient burnAndStakeInstruction error:: ", err_24);
|
|
5362
|
-
throw err_24;
|
|
5363
|
-
case 4: return [2, {
|
|
5364
|
-
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5365
|
-
additionalSigners: additionalSigners
|
|
5366
|
-
}];
|
|
5367
|
-
}
|
|
5368
|
-
});
|
|
5369
|
-
}); };
|
|
5370
5182
|
this.depositTokenStake = function (owner, feePayer, depositAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5371
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, depositTokenStakeInstruction,
|
|
5183
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, depositTokenStakeInstruction, err_21;
|
|
5372
5184
|
return __generator(this, function (_a) {
|
|
5373
5185
|
switch (_a.label) {
|
|
5374
5186
|
case 0:
|
|
@@ -5410,9 +5222,9 @@ var PerpetualsClient = (function () {
|
|
|
5410
5222
|
instructions.push(depositTokenStakeInstruction);
|
|
5411
5223
|
return [3, 5];
|
|
5412
5224
|
case 4:
|
|
5413
|
-
|
|
5414
|
-
console.log("perpClient depositStakingInstruction error:: ",
|
|
5415
|
-
throw
|
|
5225
|
+
err_21 = _a.sent();
|
|
5226
|
+
console.log("perpClient depositStakingInstruction error:: ", err_21);
|
|
5227
|
+
throw err_21;
|
|
5416
5228
|
case 5: return [2, {
|
|
5417
5229
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5418
5230
|
additionalSigners: additionalSigners
|
|
@@ -5421,7 +5233,7 @@ var PerpetualsClient = (function () {
|
|
|
5421
5233
|
});
|
|
5422
5234
|
}); };
|
|
5423
5235
|
this.unstakeTokenRequest = function (owner, unstakeAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5424
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, unstakeTokenRequestInstruction,
|
|
5236
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, unstakeTokenRequestInstruction, err_22;
|
|
5425
5237
|
return __generator(this, function (_a) {
|
|
5426
5238
|
switch (_a.label) {
|
|
5427
5239
|
case 0:
|
|
@@ -5450,9 +5262,9 @@ var PerpetualsClient = (function () {
|
|
|
5450
5262
|
instructions.push(unstakeTokenRequestInstruction);
|
|
5451
5263
|
return [3, 4];
|
|
5452
5264
|
case 3:
|
|
5453
|
-
|
|
5454
|
-
console.log("perpClient unstakeTokenRequestInstruction error:: ",
|
|
5455
|
-
throw
|
|
5265
|
+
err_22 = _a.sent();
|
|
5266
|
+
console.log("perpClient unstakeTokenRequestInstruction error:: ", err_22);
|
|
5267
|
+
throw err_22;
|
|
5456
5268
|
case 4: return [2, {
|
|
5457
5269
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5458
5270
|
additionalSigners: additionalSigners
|
|
@@ -5461,7 +5273,7 @@ var PerpetualsClient = (function () {
|
|
|
5461
5273
|
});
|
|
5462
5274
|
}); };
|
|
5463
5275
|
this.unstakeTokenInstant = function (owner, unstakeAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5464
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, unstakeTokenInstantInstruction,
|
|
5276
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, unstakeTokenInstantInstruction, err_23;
|
|
5465
5277
|
return __generator(this, function (_a) {
|
|
5466
5278
|
switch (_a.label) {
|
|
5467
5279
|
case 0:
|
|
@@ -5502,9 +5314,9 @@ var PerpetualsClient = (function () {
|
|
|
5502
5314
|
instructions.push(unstakeTokenInstantInstruction);
|
|
5503
5315
|
return [3, 5];
|
|
5504
5316
|
case 4:
|
|
5505
|
-
|
|
5506
|
-
console.log("perpClient unstakeTokenInstantInstruction error:: ",
|
|
5507
|
-
throw
|
|
5317
|
+
err_23 = _a.sent();
|
|
5318
|
+
console.log("perpClient unstakeTokenInstantInstruction error:: ", err_23);
|
|
5319
|
+
throw err_23;
|
|
5508
5320
|
case 5: return [2, {
|
|
5509
5321
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5510
5322
|
additionalSigners: additionalSigners
|
|
@@ -5513,7 +5325,7 @@ var PerpetualsClient = (function () {
|
|
|
5513
5325
|
});
|
|
5514
5326
|
}); };
|
|
5515
5327
|
this.withdrawToken = function (owner, withdrawRequestId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5516
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, withdrawTokenInstruction,
|
|
5328
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, withdrawTokenInstruction, err_24;
|
|
5517
5329
|
return __generator(this, function (_a) {
|
|
5518
5330
|
switch (_a.label) {
|
|
5519
5331
|
case 0:
|
|
@@ -5554,9 +5366,9 @@ var PerpetualsClient = (function () {
|
|
|
5554
5366
|
instructions.push(withdrawTokenInstruction);
|
|
5555
5367
|
return [3, 5];
|
|
5556
5368
|
case 4:
|
|
5557
|
-
|
|
5558
|
-
console.log("perpClient withdrawTokenInstruction error:: ",
|
|
5559
|
-
throw
|
|
5369
|
+
err_24 = _a.sent();
|
|
5370
|
+
console.log("perpClient withdrawTokenInstruction error:: ", err_24);
|
|
5371
|
+
throw err_24;
|
|
5560
5372
|
case 5: return [2, {
|
|
5561
5373
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5562
5374
|
additionalSigners: additionalSigners
|
|
@@ -5565,7 +5377,7 @@ var PerpetualsClient = (function () {
|
|
|
5565
5377
|
});
|
|
5566
5378
|
}); };
|
|
5567
5379
|
this.cancelUnstakeRequest = function (owner, withdrawRequestId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5568
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, cancelUnstakeRequestInstruction,
|
|
5380
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, cancelUnstakeRequestInstruction, err_25;
|
|
5569
5381
|
return __generator(this, function (_a) {
|
|
5570
5382
|
switch (_a.label) {
|
|
5571
5383
|
case 0:
|
|
@@ -5594,9 +5406,9 @@ var PerpetualsClient = (function () {
|
|
|
5594
5406
|
instructions.push(cancelUnstakeRequestInstruction);
|
|
5595
5407
|
return [3, 4];
|
|
5596
5408
|
case 3:
|
|
5597
|
-
|
|
5598
|
-
console.log("perpClient cancelUnstakeRequestInstruction error:: ",
|
|
5599
|
-
throw
|
|
5409
|
+
err_25 = _a.sent();
|
|
5410
|
+
console.log("perpClient cancelUnstakeRequestInstruction error:: ", err_25);
|
|
5411
|
+
throw err_25;
|
|
5600
5412
|
case 4: return [2, {
|
|
5601
5413
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5602
5414
|
additionalSigners: additionalSigners
|
|
@@ -5610,7 +5422,7 @@ var PerpetualsClient = (function () {
|
|
|
5610
5422
|
args_1[_i - 2] = arguments[_i];
|
|
5611
5423
|
}
|
|
5612
5424
|
return __awaiter(_this, __spreadArray([owner_1, poolConfig_1], args_1, true), void 0, function (owner, poolConfig, createUserATA) {
|
|
5613
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, _a, collectTokenRewardInstruction,
|
|
5425
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, _a, collectTokenRewardInstruction, err_26;
|
|
5614
5426
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5615
5427
|
return __generator(this, function (_b) {
|
|
5616
5428
|
switch (_b.label) {
|
|
@@ -5656,9 +5468,9 @@ var PerpetualsClient = (function () {
|
|
|
5656
5468
|
instructions.push(collectTokenRewardInstruction);
|
|
5657
5469
|
return [3, 6];
|
|
5658
5470
|
case 5:
|
|
5659
|
-
|
|
5660
|
-
console.log("perpClient collectTokenRewardInstruction error:: ",
|
|
5661
|
-
throw
|
|
5471
|
+
err_26 = _b.sent();
|
|
5472
|
+
console.log("perpClient collectTokenRewardInstruction error:: ", err_26);
|
|
5473
|
+
throw err_26;
|
|
5662
5474
|
case 6: return [2, {
|
|
5663
5475
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5664
5476
|
additionalSigners: additionalSigners
|
|
@@ -5673,7 +5485,7 @@ var PerpetualsClient = (function () {
|
|
|
5673
5485
|
args_1[_i - 3] = arguments[_i];
|
|
5674
5486
|
}
|
|
5675
5487
|
return __awaiter(_this, __spreadArray([owner_1, rewardSymbol_1, poolConfig_1], args_1, true), void 0, function (owner, rewardSymbol, poolConfig, createUserATA) {
|
|
5676
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, tokenStakeAccount, userTokenAccount, _a, collectRevenueInstruction,
|
|
5488
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, tokenStakeAccount, userTokenAccount, _a, collectRevenueInstruction, err_27;
|
|
5677
5489
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5678
5490
|
return __generator(this, function (_b) {
|
|
5679
5491
|
switch (_b.label) {
|
|
@@ -5720,9 +5532,9 @@ var PerpetualsClient = (function () {
|
|
|
5720
5532
|
instructions.push(collectRevenueInstruction);
|
|
5721
5533
|
return [3, 6];
|
|
5722
5534
|
case 5:
|
|
5723
|
-
|
|
5724
|
-
console.log("perpClient collectRevenueInstruction error:: ",
|
|
5725
|
-
throw
|
|
5535
|
+
err_27 = _b.sent();
|
|
5536
|
+
console.log("perpClient collectRevenueInstruction error:: ", err_27);
|
|
5537
|
+
throw err_27;
|
|
5726
5538
|
case 6: return [2, {
|
|
5727
5539
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5728
5540
|
additionalSigners: additionalSigners
|
|
@@ -5732,7 +5544,7 @@ var PerpetualsClient = (function () {
|
|
|
5732
5544
|
});
|
|
5733
5545
|
};
|
|
5734
5546
|
this.initRewardVault = function (nftCount, rewardSymbol, collectionMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5735
|
-
var publicKey, rewardCustodyMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, nftTransferAuthority, initRewardVault,
|
|
5547
|
+
var publicKey, rewardCustodyMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, nftTransferAuthority, initRewardVault, err_28;
|
|
5736
5548
|
return __generator(this, function (_a) {
|
|
5737
5549
|
switch (_a.label) {
|
|
5738
5550
|
case 0:
|
|
@@ -5769,9 +5581,9 @@ var PerpetualsClient = (function () {
|
|
|
5769
5581
|
instructions.push(initRewardVault);
|
|
5770
5582
|
return [3, 4];
|
|
5771
5583
|
case 3:
|
|
5772
|
-
|
|
5773
|
-
console.log("perpClient InitRewardVault error:: ",
|
|
5774
|
-
throw
|
|
5584
|
+
err_28 = _a.sent();
|
|
5585
|
+
console.log("perpClient InitRewardVault error:: ", err_28);
|
|
5586
|
+
throw err_28;
|
|
5775
5587
|
case 4: return [2, {
|
|
5776
5588
|
instructions: __spreadArray([], instructions, true),
|
|
5777
5589
|
additionalSigners: additionalSigners
|
|
@@ -5780,7 +5592,7 @@ var PerpetualsClient = (function () {
|
|
|
5780
5592
|
});
|
|
5781
5593
|
}); };
|
|
5782
5594
|
this.distributeReward = function (rewardAmount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5783
|
-
var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, distributeReward,
|
|
5595
|
+
var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, distributeReward, err_29;
|
|
5784
5596
|
return __generator(this, function (_a) {
|
|
5785
5597
|
switch (_a.label) {
|
|
5786
5598
|
case 0:
|
|
@@ -5811,9 +5623,9 @@ var PerpetualsClient = (function () {
|
|
|
5811
5623
|
instructions.push(distributeReward);
|
|
5812
5624
|
return [3, 4];
|
|
5813
5625
|
case 3:
|
|
5814
|
-
|
|
5815
|
-
console.log("perpClient distributeReward error:: ",
|
|
5816
|
-
throw
|
|
5626
|
+
err_29 = _a.sent();
|
|
5627
|
+
console.log("perpClient distributeReward error:: ", err_29);
|
|
5628
|
+
throw err_29;
|
|
5817
5629
|
case 4: return [2, {
|
|
5818
5630
|
instructions: __spreadArray([], instructions, true),
|
|
5819
5631
|
additionalSigners: additionalSigners
|
|
@@ -5827,7 +5639,7 @@ var PerpetualsClient = (function () {
|
|
|
5827
5639
|
args_1[_i - 3] = arguments[_i];
|
|
5828
5640
|
}
|
|
5829
5641
|
return __awaiter(_this, __spreadArray([rewardSymbol_1, poolConfig_1, nftMint_1], args_1, true), void 0, function (rewardSymbol, poolConfig, nftMint, createUserATA) {
|
|
5830
|
-
var publicKey, rewardToken, rewardCustodyMint, instructions, additionalSigners, nftTokenAccount, metadataAccount, receivingTokenAccount, _a, rewardRecord, rewardVault, rewardTokenAccount, nftTransferAuthority, collectNftReward,
|
|
5642
|
+
var publicKey, rewardToken, rewardCustodyMint, instructions, additionalSigners, nftTokenAccount, metadataAccount, receivingTokenAccount, _a, rewardRecord, rewardVault, rewardTokenAccount, nftTransferAuthority, collectNftReward, err_30;
|
|
5831
5643
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5832
5644
|
return __generator(this, function (_b) {
|
|
5833
5645
|
switch (_b.label) {
|
|
@@ -5879,8 +5691,8 @@ var PerpetualsClient = (function () {
|
|
|
5879
5691
|
instructions.push(collectNftReward);
|
|
5880
5692
|
return [3, 6];
|
|
5881
5693
|
case 5:
|
|
5882
|
-
|
|
5883
|
-
throw
|
|
5694
|
+
err_30 = _b.sent();
|
|
5695
|
+
throw err_30;
|
|
5884
5696
|
case 6: return [2, {
|
|
5885
5697
|
instructions: __spreadArray([], instructions, true),
|
|
5886
5698
|
additionalSigners: additionalSigners
|
|
@@ -5895,7 +5707,7 @@ var PerpetualsClient = (function () {
|
|
|
5895
5707
|
args_1[_i - 2] = arguments[_i];
|
|
5896
5708
|
}
|
|
5897
5709
|
return __awaiter(_this, __spreadArray([rewardSymbol_1, poolConfig_1], args_1, true), void 0, function (rewardSymbol, poolConfig, createUserATA, nftTradingAccount) {
|
|
5898
|
-
var publicKey, rewardToken, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tradingAccount, rewardVault, rewardTokenAccount, withdrawStakeInstruction,
|
|
5710
|
+
var publicKey, rewardToken, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tradingAccount, rewardVault, rewardTokenAccount, withdrawStakeInstruction, err_31;
|
|
5899
5711
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5900
5712
|
return __generator(this, function (_b) {
|
|
5901
5713
|
switch (_b.label) {
|
|
@@ -5961,9 +5773,9 @@ var PerpetualsClient = (function () {
|
|
|
5961
5773
|
instructions.push(withdrawStakeInstruction);
|
|
5962
5774
|
return [3, 6];
|
|
5963
5775
|
case 5:
|
|
5964
|
-
|
|
5965
|
-
console.log("perpClient withdrawStake error:: ",
|
|
5966
|
-
throw
|
|
5776
|
+
err_31 = _b.sent();
|
|
5777
|
+
console.log("perpClient withdrawStake error:: ", err_31);
|
|
5778
|
+
throw err_31;
|
|
5967
5779
|
case 6: return [2, {
|
|
5968
5780
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5969
5781
|
additionalSigners: additionalSigners
|
|
@@ -5978,7 +5790,7 @@ var PerpetualsClient = (function () {
|
|
|
5978
5790
|
args_1[_i - 11] = arguments[_i];
|
|
5979
5791
|
}
|
|
5980
5792
|
return __awaiter(_this, __spreadArray([targetSymbol_1, collateralSymbol_1, reserveSymbol_1, receiveSymbol_1, side_1, limitPrice_1, reserveAmount_1, sizeAmount_1, stopLossPrice_1, takeProfitPrice_1, poolConfig_1], args_1, true), void 0, function (targetSymbol, collateralSymbol, reserveSymbol, receiveSymbol, side, limitPrice, reserveAmount, sizeAmount, stopLossPrice, takeProfitPrice, poolConfig, skipBalanceChecks, ephemeralSignerPubkey) {
|
|
5981
|
-
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, userReserveTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, orderAccount, placeLimitOrder,
|
|
5793
|
+
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, userReserveTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, orderAccount, placeLimitOrder, err_32;
|
|
5982
5794
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
|
5983
5795
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
5984
5796
|
return __generator(this, function (_c) {
|
|
@@ -6084,9 +5896,9 @@ var PerpetualsClient = (function () {
|
|
|
6084
5896
|
instructions.push(placeLimitOrder);
|
|
6085
5897
|
return [3, 10];
|
|
6086
5898
|
case 9:
|
|
6087
|
-
|
|
6088
|
-
console.log("perpClient placeLimitOrder error:: ",
|
|
6089
|
-
throw
|
|
5899
|
+
err_32 = _c.sent();
|
|
5900
|
+
console.log("perpClient placeLimitOrder error:: ", err_32);
|
|
5901
|
+
throw err_32;
|
|
6090
5902
|
case 10: return [2, {
|
|
6091
5903
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6092
5904
|
additionalSigners: additionalSigners
|
|
@@ -6101,7 +5913,7 @@ var PerpetualsClient = (function () {
|
|
|
6101
5913
|
args_1[_i - 11] = arguments[_i];
|
|
6102
5914
|
}
|
|
6103
5915
|
return __awaiter(_this, __spreadArray([targetSymbol_1, collateralSymbol_1, reserveSymbol_1, receiveSymbol_1, side_1, orderId_1, limitPrice_1, sizeAmount_1, stopLossPrice_1, takeProfitPrice_1, poolConfig_1], args_1, true), void 0, function (targetSymbol, collateralSymbol, reserveSymbol, receiveSymbol, side, orderId, limitPrice, sizeAmount, stopLossPrice, takeProfitPrice, poolConfig, createUserATA, ephemeralSignerPubkey) {
|
|
6104
|
-
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, wrappedSolAccount, userReceivingTokenAccount, lamports, _a, positionAccount, orderAccount, editLimitOrder,
|
|
5916
|
+
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, wrappedSolAccount, userReceivingTokenAccount, lamports, _a, positionAccount, orderAccount, editLimitOrder, err_33;
|
|
6105
5917
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6106
5918
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
6107
5919
|
return __generator(this, function (_b) {
|
|
@@ -6192,9 +6004,9 @@ var PerpetualsClient = (function () {
|
|
|
6192
6004
|
instructions.push(editLimitOrder);
|
|
6193
6005
|
return [3, 8];
|
|
6194
6006
|
case 7:
|
|
6195
|
-
|
|
6196
|
-
console.log("perpClient editLimitOrder error:: ",
|
|
6197
|
-
throw
|
|
6007
|
+
err_33 = _b.sent();
|
|
6008
|
+
console.log("perpClient editLimitOrder error:: ", err_33);
|
|
6009
|
+
throw err_33;
|
|
6198
6010
|
case 8: return [2, {
|
|
6199
6011
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6200
6012
|
additionalSigners: additionalSigners
|
|
@@ -6209,7 +6021,7 @@ var PerpetualsClient = (function () {
|
|
|
6209
6021
|
args_1[_i - 7] = arguments[_i];
|
|
6210
6022
|
}
|
|
6211
6023
|
return __awaiter(_this, __spreadArray([userPubkey_1, targetSymbol_1, collateralSymbol_1, side_1, orderId_1, poolConfig_1, privilege_1], args_1, true), void 0, function (userPubkey, targetSymbol, collateralSymbol, side, orderId, poolConfig, privilege, tokenStakeAccount, userReferralAccount, rebateTokenAccount) {
|
|
6212
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder,
|
|
6024
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder, err_34;
|
|
6213
6025
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
6214
6026
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
|
6215
6027
|
if (rebateTokenAccount === void 0) { rebateTokenAccount = web3_js_1.PublicKey.default; }
|
|
@@ -6262,9 +6074,9 @@ var PerpetualsClient = (function () {
|
|
|
6262
6074
|
instructions.push(executeLimitOrder);
|
|
6263
6075
|
return [3, 4];
|
|
6264
6076
|
case 3:
|
|
6265
|
-
|
|
6266
|
-
console.log("perpClient executeLimitOrder error:: ",
|
|
6267
|
-
throw
|
|
6077
|
+
err_34 = _a.sent();
|
|
6078
|
+
console.log("perpClient executeLimitOrder error:: ", err_34);
|
|
6079
|
+
throw err_34;
|
|
6268
6080
|
case 4: return [2, {
|
|
6269
6081
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6270
6082
|
additionalSigners: additionalSigners
|
|
@@ -6279,7 +6091,7 @@ var PerpetualsClient = (function () {
|
|
|
6279
6091
|
args_1[_i - 8] = arguments[_i];
|
|
6280
6092
|
}
|
|
6281
6093
|
return __awaiter(_this, __spreadArray([userPubkey_1, targetSymbol_1, collateralSymbol_1, reserveSymbol_1, side_1, orderId_1, poolConfig_1, privilege_1], args_1, true), void 0, function (userPubkey, targetSymbol, collateralSymbol, reserveSymbol, side, orderId, poolConfig, privilege, tokenStakeAccount, userReferralAccount, rebateTokenAccount) {
|
|
6282
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitWithSwap,
|
|
6094
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitWithSwap, err_35;
|
|
6283
6095
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
6284
6096
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
|
6285
6097
|
if (rebateTokenAccount === void 0) { rebateTokenAccount = web3_js_1.PublicKey.default; }
|
|
@@ -6335,9 +6147,9 @@ var PerpetualsClient = (function () {
|
|
|
6335
6147
|
instructions.push(executeLimitWithSwap);
|
|
6336
6148
|
return [3, 4];
|
|
6337
6149
|
case 3:
|
|
6338
|
-
|
|
6339
|
-
console.log("perpClient executeLimitWithSwap error:: ",
|
|
6340
|
-
throw
|
|
6150
|
+
err_35 = _a.sent();
|
|
6151
|
+
console.log("perpClient executeLimitWithSwap error:: ", err_35);
|
|
6152
|
+
throw err_35;
|
|
6341
6153
|
case 4: return [2, {
|
|
6342
6154
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6343
6155
|
additionalSigners: additionalSigners
|
|
@@ -6347,7 +6159,7 @@ var PerpetualsClient = (function () {
|
|
|
6347
6159
|
});
|
|
6348
6160
|
};
|
|
6349
6161
|
this.placeTriggerOrder = function (targetSymbol, collateralSymbol, receiveSymbol, side, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6350
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder,
|
|
6162
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder, err_36;
|
|
6351
6163
|
return __generator(this, function (_a) {
|
|
6352
6164
|
switch (_a.label) {
|
|
6353
6165
|
case 0:
|
|
@@ -6395,9 +6207,9 @@ var PerpetualsClient = (function () {
|
|
|
6395
6207
|
instructions.push(placeTriggerOrder);
|
|
6396
6208
|
return [3, 4];
|
|
6397
6209
|
case 3:
|
|
6398
|
-
|
|
6399
|
-
console.log("perpClient placeTriggerOrder error:: ",
|
|
6400
|
-
throw
|
|
6210
|
+
err_36 = _a.sent();
|
|
6211
|
+
console.log("perpClient placeTriggerOrder error:: ", err_36);
|
|
6212
|
+
throw err_36;
|
|
6401
6213
|
case 4: return [2, {
|
|
6402
6214
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6403
6215
|
additionalSigners: additionalSigners
|
|
@@ -6406,7 +6218,7 @@ var PerpetualsClient = (function () {
|
|
|
6406
6218
|
});
|
|
6407
6219
|
}); };
|
|
6408
6220
|
this.editTriggerOrder = function (targetSymbol, collateralSymbol, receiveSymbol, side, orderId, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6409
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder,
|
|
6221
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder, err_37;
|
|
6410
6222
|
return __generator(this, function (_a) {
|
|
6411
6223
|
switch (_a.label) {
|
|
6412
6224
|
case 0:
|
|
@@ -6453,9 +6265,9 @@ var PerpetualsClient = (function () {
|
|
|
6453
6265
|
instructions.push(editTriggerOrder);
|
|
6454
6266
|
return [3, 4];
|
|
6455
6267
|
case 3:
|
|
6456
|
-
|
|
6457
|
-
console.log("perpClient editTriggerOrder error:: ",
|
|
6458
|
-
throw
|
|
6268
|
+
err_37 = _a.sent();
|
|
6269
|
+
console.log("perpClient editTriggerOrder error:: ", err_37);
|
|
6270
|
+
throw err_37;
|
|
6459
6271
|
case 4: return [2, {
|
|
6460
6272
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6461
6273
|
additionalSigners: additionalSigners
|
|
@@ -6464,7 +6276,7 @@ var PerpetualsClient = (function () {
|
|
|
6464
6276
|
});
|
|
6465
6277
|
}); };
|
|
6466
6278
|
this.cancelTriggerOrder = function (targetSymbol, collateralSymbol, side, orderId, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6467
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder,
|
|
6279
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder, err_38;
|
|
6468
6280
|
return __generator(this, function (_a) {
|
|
6469
6281
|
switch (_a.label) {
|
|
6470
6282
|
case 0:
|
|
@@ -6497,9 +6309,9 @@ var PerpetualsClient = (function () {
|
|
|
6497
6309
|
instructions.push(cancelTriggerOrder);
|
|
6498
6310
|
return [3, 4];
|
|
6499
6311
|
case 3:
|
|
6500
|
-
|
|
6501
|
-
console.log("perpClient cancelTriggerOrder error:: ",
|
|
6502
|
-
throw
|
|
6312
|
+
err_38 = _a.sent();
|
|
6313
|
+
console.log("perpClient cancelTriggerOrder error:: ", err_38);
|
|
6314
|
+
throw err_38;
|
|
6503
6315
|
case 4: return [2, {
|
|
6504
6316
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6505
6317
|
additionalSigners: additionalSigners
|
|
@@ -6508,7 +6320,7 @@ var PerpetualsClient = (function () {
|
|
|
6508
6320
|
});
|
|
6509
6321
|
}); };
|
|
6510
6322
|
this.cancelAllTriggerOrders = function (targetSymbol, collateralSymbol, side, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6511
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, positionAccount, cancelAllTriggerOrders,
|
|
6323
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, positionAccount, cancelAllTriggerOrders, err_39;
|
|
6512
6324
|
return __generator(this, function (_a) {
|
|
6513
6325
|
switch (_a.label) {
|
|
6514
6326
|
case 0:
|
|
@@ -6539,9 +6351,9 @@ var PerpetualsClient = (function () {
|
|
|
6539
6351
|
instructions.push(cancelAllTriggerOrders);
|
|
6540
6352
|
return [3, 4];
|
|
6541
6353
|
case 3:
|
|
6542
|
-
|
|
6543
|
-
console.log("perpClient cancelAllTriggerOrders error:: ",
|
|
6544
|
-
throw
|
|
6354
|
+
err_39 = _a.sent();
|
|
6355
|
+
console.log("perpClient cancelAllTriggerOrders error:: ", err_39);
|
|
6356
|
+
throw err_39;
|
|
6545
6357
|
case 4: return [2, {
|
|
6546
6358
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6547
6359
|
additionalSigners: additionalSigners
|
|
@@ -6555,7 +6367,7 @@ var PerpetualsClient = (function () {
|
|
|
6555
6367
|
args_1[_i - 9] = arguments[_i];
|
|
6556
6368
|
}
|
|
6557
6369
|
return __awaiter(_this, __spreadArray([owner_1, targetSymbol_1, collateralSymbol_1, receivingSymbol_1, side_1, orderId_1, isStopLoss_1, privilege_1, poolConfig_1], args_1, true), void 0, function (owner, targetSymbol, collateralSymbol, receivingSymbol, side, orderId, isStopLoss, privilege, poolConfig, createUserATA, ephemeralSignerPubkey, tokenStakeAccount, userReferralAccount, rebateTokenAccount) {
|
|
6558
|
-
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, userReceivingTokenAccount, userReceivingTokenAccountCollateral, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, collateralToken, receivingToken, _a, _b, positionAccount, orderAccount, custodyAccountMetas, custodyOracleAccountMetas, _c, _d, custody, executeTriggerWithSwap,
|
|
6370
|
+
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, userReceivingTokenAccount, userReceivingTokenAccountCollateral, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, collateralToken, receivingToken, _a, _b, positionAccount, orderAccount, custodyAccountMetas, custodyOracleAccountMetas, _c, _d, custody, executeTriggerWithSwap, err_40;
|
|
6559
6371
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6560
6372
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
6561
6373
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
@@ -6662,9 +6474,9 @@ var PerpetualsClient = (function () {
|
|
|
6662
6474
|
instructions.push(executeTriggerWithSwap);
|
|
6663
6475
|
return [3, 10];
|
|
6664
6476
|
case 9:
|
|
6665
|
-
|
|
6666
|
-
console.log("perpClient executeTriggerWithSwap error:: ",
|
|
6667
|
-
throw
|
|
6477
|
+
err_40 = _e.sent();
|
|
6478
|
+
console.log("perpClient executeTriggerWithSwap error:: ", err_40);
|
|
6479
|
+
throw err_40;
|
|
6668
6480
|
case 10: return [2, {
|
|
6669
6481
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6670
6482
|
additionalSigners: additionalSigners
|
|
@@ -6679,7 +6491,7 @@ var PerpetualsClient = (function () {
|
|
|
6679
6491
|
args_1[_i - 8] = arguments[_i];
|
|
6680
6492
|
}
|
|
6681
6493
|
return __awaiter(_this, __spreadArray([owner_1, targetSymbol_1, collateralSymbol_1, side_1, orderId_1, isStopLoss_1, privilege_1, poolConfig_1], args_1, true), void 0, function (owner, targetSymbol, collateralSymbol, side, orderId, isStopLoss, privilege, poolConfig, createUserATA, ephemeralSignerPubkey, tokenStakeAccount, userReferralAccount, rebateTokenAccount) {
|
|
6682
|
-
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder,
|
|
6494
|
+
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder, err_41;
|
|
6683
6495
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6684
6496
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
6685
6497
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
@@ -6751,9 +6563,9 @@ var PerpetualsClient = (function () {
|
|
|
6751
6563
|
instructions.push(executeTriggerOrder);
|
|
6752
6564
|
return [3, 8];
|
|
6753
6565
|
case 7:
|
|
6754
|
-
|
|
6755
|
-
console.log("perpClient executeTriggerOrder error:: ",
|
|
6756
|
-
throw
|
|
6566
|
+
err_41 = _b.sent();
|
|
6567
|
+
console.log("perpClient executeTriggerOrder error:: ", err_41);
|
|
6568
|
+
throw err_41;
|
|
6757
6569
|
case 8: return [2, {
|
|
6758
6570
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6759
6571
|
additionalSigners: additionalSigners
|
|
@@ -6768,7 +6580,7 @@ var PerpetualsClient = (function () {
|
|
|
6768
6580
|
args_1[_i - 5] = arguments[_i];
|
|
6769
6581
|
}
|
|
6770
6582
|
return __awaiter(_this, __spreadArray([userInputTokenSymbol_1, userOutputTokenSymbol_1, amountIn_1, minAmountOut_1, poolConfig_1], args_1, true), void 0, function (userInputTokenSymbol, userOutputTokenSymbol, amountIn, minAmountOut, poolConfig, useFeesPool, createUserATA, unWrapSol, skipBalanceChecks, ephemeralSignerPubkey) {
|
|
6771
|
-
var userInputCustodyConfig, userOutputCustodyConfig, publicKey, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userOutputTokenAccount, userInputTokenAccount, wsolAssociatedTokenAccount, wsolATAExist, unWrappedSolBalance, _a, wsolAssociatedTokenAccount, closeWsolATAIns, accCreationLamports, lamports, unWrappedSolBalance, _b, tokenAccountBalance, _c, lamports, _d, custodyAccountMetas, custodyOracleAccountMetas, _e, _f, custody, params, inx, closeWsolATAIns,
|
|
6583
|
+
var userInputCustodyConfig, userOutputCustodyConfig, publicKey, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userOutputTokenAccount, userInputTokenAccount, wsolAssociatedTokenAccount, wsolATAExist, unWrappedSolBalance, _a, wsolAssociatedTokenAccount, closeWsolATAIns, accCreationLamports, lamports, unWrappedSolBalance, _b, tokenAccountBalance, _c, lamports, _d, custodyAccountMetas, custodyOracleAccountMetas, _e, _f, custody, params, inx, closeWsolATAIns, err_42;
|
|
6772
6584
|
if (useFeesPool === void 0) { useFeesPool = false; }
|
|
6773
6585
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6774
6586
|
if (unWrapSol === void 0) { unWrapSol = false; }
|
|
@@ -6915,7 +6727,7 @@ var PerpetualsClient = (function () {
|
|
|
6915
6727
|
_g.label = 16;
|
|
6916
6728
|
case 16:
|
|
6917
6729
|
if (_d) {
|
|
6918
|
-
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, userOutputTokenAccount, publicKey, poolConfig.getTokenFromSymbol(userOutputTokenSymbol).mintKey));
|
|
6730
|
+
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, userOutputTokenAccount, publicKey, poolConfig.getTokenFromSymbol(userOutputTokenSymbol).mintKey, poolConfig.getTokenFromSymbol(userOutputTokenSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID));
|
|
6919
6731
|
}
|
|
6920
6732
|
_g.label = 17;
|
|
6921
6733
|
case 17:
|
|
@@ -6973,9 +6785,9 @@ var PerpetualsClient = (function () {
|
|
|
6973
6785
|
}
|
|
6974
6786
|
return [3, 20];
|
|
6975
6787
|
case 19:
|
|
6976
|
-
|
|
6977
|
-
console.error("perpClient Swap error:: ",
|
|
6978
|
-
throw
|
|
6788
|
+
err_42 = _g.sent();
|
|
6789
|
+
console.error("perpClient Swap error:: ", err_42);
|
|
6790
|
+
throw err_42;
|
|
6979
6791
|
case 20: return [2, {
|
|
6980
6792
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6981
6793
|
additionalSigners: additionalSigners
|
|
@@ -6985,7 +6797,7 @@ var PerpetualsClient = (function () {
|
|
|
6985
6797
|
});
|
|
6986
6798
|
};
|
|
6987
6799
|
this.swapFeeInternal = function (rewardTokenSymbol, swapTokenSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6988
|
-
var rewardCustody, custody, publicKey, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody_1, params, inx,
|
|
6800
|
+
var rewardCustody, custody, publicKey, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody_1, params, inx, err_43;
|
|
6989
6801
|
return __generator(this, function (_b) {
|
|
6990
6802
|
switch (_b.label) {
|
|
6991
6803
|
case 0:
|
|
@@ -7045,9 +6857,9 @@ var PerpetualsClient = (function () {
|
|
|
7045
6857
|
instructions.push(inx);
|
|
7046
6858
|
return [3, 4];
|
|
7047
6859
|
case 3:
|
|
7048
|
-
|
|
7049
|
-
console.error("perpClient Swap error:: ",
|
|
7050
|
-
throw
|
|
6860
|
+
err_43 = _b.sent();
|
|
6861
|
+
console.error("perpClient Swap error:: ", err_43);
|
|
6862
|
+
throw err_43;
|
|
7051
6863
|
case 4: return [2, {
|
|
7052
6864
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7053
6865
|
additionalSigners: additionalSigners
|
|
@@ -7056,7 +6868,7 @@ var PerpetualsClient = (function () {
|
|
|
7056
6868
|
});
|
|
7057
6869
|
}); };
|
|
7058
6870
|
this.setLpTokenPrice = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7059
|
-
var instructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, setLpTokenPriceInstruction,
|
|
6871
|
+
var instructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, setLpTokenPriceInstruction, err_44;
|
|
7060
6872
|
return __generator(this, function (_d) {
|
|
7061
6873
|
switch (_d.label) {
|
|
7062
6874
|
case 0:
|
|
@@ -7104,9 +6916,9 @@ var PerpetualsClient = (function () {
|
|
|
7104
6916
|
instructions.push(setLpTokenPriceInstruction);
|
|
7105
6917
|
return [3, 4];
|
|
7106
6918
|
case 3:
|
|
7107
|
-
|
|
7108
|
-
console.log("perpClient setLpTokenPriceInstruction error:: ",
|
|
7109
|
-
throw
|
|
6919
|
+
err_44 = _d.sent();
|
|
6920
|
+
console.log("perpClient setLpTokenPriceInstruction error:: ", err_44);
|
|
6921
|
+
throw err_44;
|
|
7110
6922
|
case 4: return [2, {
|
|
7111
6923
|
instructions: __spreadArray([], instructions, true),
|
|
7112
6924
|
additionalSigners: additionalSigners
|
|
@@ -7154,7 +6966,7 @@ var PerpetualsClient = (function () {
|
|
|
7154
6966
|
});
|
|
7155
6967
|
}); };
|
|
7156
6968
|
this.setAdminSigners = function (admins, minSignatures) { return __awaiter(_this, void 0, void 0, function () {
|
|
7157
|
-
var adminMetas, _i, admins_2, admin,
|
|
6969
|
+
var adminMetas, _i, admins_2, admin, err_45;
|
|
7158
6970
|
return __generator(this, function (_a) {
|
|
7159
6971
|
switch (_a.label) {
|
|
7160
6972
|
case 0:
|
|
@@ -7184,11 +6996,11 @@ var PerpetualsClient = (function () {
|
|
|
7184
6996
|
_a.sent();
|
|
7185
6997
|
return [3, 4];
|
|
7186
6998
|
case 3:
|
|
7187
|
-
|
|
6999
|
+
err_45 = _a.sent();
|
|
7188
7000
|
if (this.printErrors) {
|
|
7189
|
-
console.error("setAdminSigners err:",
|
|
7001
|
+
console.error("setAdminSigners err:", err_45);
|
|
7190
7002
|
}
|
|
7191
|
-
throw
|
|
7003
|
+
throw err_45;
|
|
7192
7004
|
case 4: return [2];
|
|
7193
7005
|
}
|
|
7194
7006
|
});
|
|
@@ -7377,7 +7189,7 @@ var PerpetualsClient = (function () {
|
|
|
7377
7189
|
});
|
|
7378
7190
|
}); };
|
|
7379
7191
|
this.protocolWithdrawFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7380
|
-
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx,
|
|
7192
|
+
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx, err_46;
|
|
7381
7193
|
return __generator(this, function (_a) {
|
|
7382
7194
|
switch (_a.label) {
|
|
7383
7195
|
case 0:
|
|
@@ -7410,9 +7222,9 @@ var PerpetualsClient = (function () {
|
|
|
7410
7222
|
instructions.push(withdrawFeesIx);
|
|
7411
7223
|
return [3, 5];
|
|
7412
7224
|
case 4:
|
|
7413
|
-
|
|
7414
|
-
console.log("perpClient setPool error:: ",
|
|
7415
|
-
throw
|
|
7225
|
+
err_46 = _a.sent();
|
|
7226
|
+
console.log("perpClient setPool error:: ", err_46);
|
|
7227
|
+
throw err_46;
|
|
7416
7228
|
case 5: return [2, {
|
|
7417
7229
|
instructions: __spreadArray([], instructions, true),
|
|
7418
7230
|
additionalSigners: additionalSigners
|
|
@@ -7421,7 +7233,7 @@ var PerpetualsClient = (function () {
|
|
|
7421
7233
|
});
|
|
7422
7234
|
}); };
|
|
7423
7235
|
this.moveProtocolFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7424
|
-
var publicKey, custodyConfig, instructions, additionalSigners, moveProtocolFeesIx,
|
|
7236
|
+
var publicKey, custodyConfig, instructions, additionalSigners, moveProtocolFeesIx, err_47;
|
|
7425
7237
|
return __generator(this, function (_a) {
|
|
7426
7238
|
switch (_a.label) {
|
|
7427
7239
|
case 0:
|
|
@@ -7455,9 +7267,9 @@ var PerpetualsClient = (function () {
|
|
|
7455
7267
|
instructions.push(moveProtocolFeesIx);
|
|
7456
7268
|
return [3, 4];
|
|
7457
7269
|
case 3:
|
|
7458
|
-
|
|
7459
|
-
console.log("perpClient setPool error:: ",
|
|
7460
|
-
throw
|
|
7270
|
+
err_47 = _a.sent();
|
|
7271
|
+
console.log("perpClient setPool error:: ", err_47);
|
|
7272
|
+
throw err_47;
|
|
7461
7273
|
case 4: return [2, {
|
|
7462
7274
|
instructions: __spreadArray([], instructions, true),
|
|
7463
7275
|
additionalSigners: additionalSigners
|
|
@@ -7466,7 +7278,7 @@ var PerpetualsClient = (function () {
|
|
|
7466
7278
|
});
|
|
7467
7279
|
}); };
|
|
7468
7280
|
this.setProtocolFeeShareBps = function (feeShareBps, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7469
|
-
var publicKey, setProtocolFeeShareBpsIx,
|
|
7281
|
+
var publicKey, setProtocolFeeShareBpsIx, err_48;
|
|
7470
7282
|
return __generator(this, function (_a) {
|
|
7471
7283
|
switch (_a.label) {
|
|
7472
7284
|
case 0:
|
|
@@ -7486,15 +7298,15 @@ var PerpetualsClient = (function () {
|
|
|
7486
7298
|
setProtocolFeeShareBpsIx = _a.sent();
|
|
7487
7299
|
return [2, setProtocolFeeShareBpsIx];
|
|
7488
7300
|
case 2:
|
|
7489
|
-
|
|
7490
|
-
console.log("perpClient setProtocolFeeShareBpsIx error:: ",
|
|
7491
|
-
throw
|
|
7301
|
+
err_48 = _a.sent();
|
|
7302
|
+
console.log("perpClient setProtocolFeeShareBpsIx error:: ", err_48);
|
|
7303
|
+
throw err_48;
|
|
7492
7304
|
case 3: return [2];
|
|
7493
7305
|
}
|
|
7494
7306
|
});
|
|
7495
7307
|
}); };
|
|
7496
7308
|
this.setPermissions = function (permissions) { return __awaiter(_this, void 0, void 0, function () {
|
|
7497
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction,
|
|
7309
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_49;
|
|
7498
7310
|
return __generator(this, function (_a) {
|
|
7499
7311
|
switch (_a.label) {
|
|
7500
7312
|
case 0:
|
|
@@ -7521,9 +7333,9 @@ var PerpetualsClient = (function () {
|
|
|
7521
7333
|
instructions.push(setPermissionsInstruction);
|
|
7522
7334
|
return [3, 4];
|
|
7523
7335
|
case 3:
|
|
7524
|
-
|
|
7525
|
-
console.log("perpClient setPool error:: ",
|
|
7526
|
-
throw
|
|
7336
|
+
err_49 = _a.sent();
|
|
7337
|
+
console.log("perpClient setPool error:: ", err_49);
|
|
7338
|
+
throw err_49;
|
|
7527
7339
|
case 4: return [2, {
|
|
7528
7340
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7529
7341
|
additionalSigners: additionalSigners
|
|
@@ -7532,7 +7344,7 @@ var PerpetualsClient = (function () {
|
|
|
7532
7344
|
});
|
|
7533
7345
|
}); };
|
|
7534
7346
|
this.reimburse = function (tokenMint, amountIn, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7535
|
-
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e,
|
|
7347
|
+
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e, err_50;
|
|
7536
7348
|
var _f;
|
|
7537
7349
|
return __generator(this, function (_g) {
|
|
7538
7350
|
switch (_g.label) {
|
|
@@ -7593,9 +7405,9 @@ var PerpetualsClient = (function () {
|
|
|
7593
7405
|
instructions.push(reimburse);
|
|
7594
7406
|
return [3, 5];
|
|
7595
7407
|
case 4:
|
|
7596
|
-
|
|
7597
|
-
console.log("perpClient setPool error:: ",
|
|
7598
|
-
throw
|
|
7408
|
+
err_50 = _g.sent();
|
|
7409
|
+
console.log("perpClient setPool error:: ", err_50);
|
|
7410
|
+
throw err_50;
|
|
7599
7411
|
case 5: return [2, {
|
|
7600
7412
|
instructions: __spreadArray([], instructions, true),
|
|
7601
7413
|
additionalSigners: additionalSigners
|
|
@@ -7603,8 +7415,8 @@ var PerpetualsClient = (function () {
|
|
|
7603
7415
|
}
|
|
7604
7416
|
});
|
|
7605
7417
|
}); };
|
|
7606
|
-
this.setInternalOraclePrice = function (tokenMint, price, expo, conf, ema, publishTime, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7607
|
-
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice,
|
|
7418
|
+
this.setInternalOraclePrice = function (tokenMint, useCurrentTime, price, expo, conf, ema, publishTime, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7419
|
+
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice, err_51;
|
|
7608
7420
|
return __generator(this, function (_a) {
|
|
7609
7421
|
switch (_a.label) {
|
|
7610
7422
|
case 0:
|
|
@@ -7616,6 +7428,7 @@ var PerpetualsClient = (function () {
|
|
|
7616
7428
|
_a.trys.push([1, 3, , 4]);
|
|
7617
7429
|
return [4, this.program.methods
|
|
7618
7430
|
.setInternalOraclePrice({
|
|
7431
|
+
useCurrentTime: useCurrentTime,
|
|
7619
7432
|
price: price,
|
|
7620
7433
|
expo: expo,
|
|
7621
7434
|
conf: conf,
|
|
@@ -7637,9 +7450,9 @@ var PerpetualsClient = (function () {
|
|
|
7637
7450
|
instructions.push(setInternalOraclePrice);
|
|
7638
7451
|
return [3, 4];
|
|
7639
7452
|
case 3:
|
|
7640
|
-
|
|
7641
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
|
7642
|
-
throw
|
|
7453
|
+
err_51 = _a.sent();
|
|
7454
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_51);
|
|
7455
|
+
throw err_51;
|
|
7643
7456
|
case 4: return [2, {
|
|
7644
7457
|
instructions: __spreadArray([], instructions, true),
|
|
7645
7458
|
additionalSigners: additionalSigners
|
|
@@ -7647,8 +7460,8 @@ var PerpetualsClient = (function () {
|
|
|
7647
7460
|
}
|
|
7648
7461
|
});
|
|
7649
7462
|
}); };
|
|
7650
|
-
this.setInternalOraclePriceBatch = function (tokenMintList, tokenInternalPrices, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
|
|
7651
|
-
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_1, _i, tokenMintList_1, tokenMint, instructions, additionalSigners, setInternalOraclePrice,
|
|
7463
|
+
this.setInternalOraclePriceBatch = function (useCurrentTime, tokenMintList, tokenInternalPrices, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
|
|
7464
|
+
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_1, _i, tokenMintList_1, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_52;
|
|
7652
7465
|
return __generator(this, function (_a) {
|
|
7653
7466
|
switch (_a.label) {
|
|
7654
7467
|
case 0:
|
|
@@ -7659,11 +7472,6 @@ var PerpetualsClient = (function () {
|
|
|
7659
7472
|
accountMetas = [];
|
|
7660
7473
|
_loop_1 = function (tokenMint) {
|
|
7661
7474
|
var custody = ALL_CUSTODY_CONFIGS.find(function (i) { return i.mintKey.equals(tokenMint); });
|
|
7662
|
-
accountMetas.push({
|
|
7663
|
-
pubkey: custody.custodyAccount,
|
|
7664
|
-
isSigner: false,
|
|
7665
|
-
isWritable: false,
|
|
7666
|
-
});
|
|
7667
7475
|
accountMetas.push({
|
|
7668
7476
|
pubkey: custody.intOracleAccount,
|
|
7669
7477
|
isSigner: false,
|
|
@@ -7686,6 +7494,7 @@ var PerpetualsClient = (function () {
|
|
|
7686
7494
|
_a.trys.push([1, 3, , 4]);
|
|
7687
7495
|
return [4, this.program.methods
|
|
7688
7496
|
.setInternalCurrentPrice({
|
|
7497
|
+
useCurrentTime: useCurrentTime,
|
|
7689
7498
|
prices: tokenInternalPrices
|
|
7690
7499
|
})
|
|
7691
7500
|
.accounts({
|
|
@@ -7698,9 +7507,9 @@ var PerpetualsClient = (function () {
|
|
|
7698
7507
|
instructions.push(setInternalOraclePrice);
|
|
7699
7508
|
return [3, 4];
|
|
7700
7509
|
case 3:
|
|
7701
|
-
|
|
7702
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
|
7703
|
-
throw
|
|
7510
|
+
err_52 = _a.sent();
|
|
7511
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_52);
|
|
7512
|
+
throw err_52;
|
|
7704
7513
|
case 4: return [2, {
|
|
7705
7514
|
instructions: __spreadArray([], instructions, true),
|
|
7706
7515
|
additionalSigners: additionalSigners
|
|
@@ -7709,7 +7518,7 @@ var PerpetualsClient = (function () {
|
|
|
7709
7518
|
});
|
|
7710
7519
|
}); };
|
|
7711
7520
|
this.setInternalOracleEmaPriceBatch = function (tokenMintList, tokenInternalEmaPrices, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
|
|
7712
|
-
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_2, _i, tokenMintList_2, tokenMint, instructions, additionalSigners, setInternalOraclePrice,
|
|
7521
|
+
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_2, _i, tokenMintList_2, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_53;
|
|
7713
7522
|
return __generator(this, function (_a) {
|
|
7714
7523
|
switch (_a.label) {
|
|
7715
7524
|
case 0:
|
|
@@ -7720,21 +7529,11 @@ var PerpetualsClient = (function () {
|
|
|
7720
7529
|
accountMetas = [];
|
|
7721
7530
|
_loop_2 = function (tokenMint) {
|
|
7722
7531
|
var custody = ALL_CUSTODY_CONFIGS.find(function (i) { return i.mintKey.equals(tokenMint); });
|
|
7723
|
-
accountMetas.push({
|
|
7724
|
-
pubkey: custody.custodyAccount,
|
|
7725
|
-
isSigner: false,
|
|
7726
|
-
isWritable: false,
|
|
7727
|
-
});
|
|
7728
7532
|
accountMetas.push({
|
|
7729
7533
|
pubkey: custody.intOracleAccount,
|
|
7730
7534
|
isSigner: false,
|
|
7731
7535
|
isWritable: true,
|
|
7732
7536
|
});
|
|
7733
|
-
accountMetas.push({
|
|
7734
|
-
pubkey: custody.extOracleAccount,
|
|
7735
|
-
isSigner: false,
|
|
7736
|
-
isWritable: false,
|
|
7737
|
-
});
|
|
7738
7537
|
};
|
|
7739
7538
|
for (_i = 0, tokenMintList_2 = tokenMintList; _i < tokenMintList_2.length; _i++) {
|
|
7740
7539
|
tokenMint = tokenMintList_2[_i];
|
|
@@ -7759,9 +7558,9 @@ var PerpetualsClient = (function () {
|
|
|
7759
7558
|
instructions.push(setInternalOraclePrice);
|
|
7760
7559
|
return [3, 4];
|
|
7761
7560
|
case 3:
|
|
7762
|
-
|
|
7763
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
|
7764
|
-
throw
|
|
7561
|
+
err_53 = _a.sent();
|
|
7562
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_53);
|
|
7563
|
+
throw err_53;
|
|
7765
7564
|
case 4: return [2, {
|
|
7766
7565
|
instructions: __spreadArray([], instructions, true),
|
|
7767
7566
|
additionalSigners: additionalSigners
|
|
@@ -7770,7 +7569,7 @@ var PerpetualsClient = (function () {
|
|
|
7770
7569
|
});
|
|
7771
7570
|
}); };
|
|
7772
7571
|
this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7773
|
-
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp,
|
|
7572
|
+
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_54;
|
|
7774
7573
|
return __generator(this, function (_a) {
|
|
7775
7574
|
switch (_a.label) {
|
|
7776
7575
|
case 0:
|
|
@@ -7808,8 +7607,8 @@ var PerpetualsClient = (function () {
|
|
|
7808
7607
|
instructions.push(renameFlp);
|
|
7809
7608
|
return [3, 4];
|
|
7810
7609
|
case 3:
|
|
7811
|
-
|
|
7812
|
-
console.log("perpClient renameFlp error:: ",
|
|
7610
|
+
err_54 = _a.sent();
|
|
7611
|
+
console.log("perpClient renameFlp error:: ", err_54);
|
|
7813
7612
|
return [3, 4];
|
|
7814
7613
|
case 4: return [2, {
|
|
7815
7614
|
instructions: __spreadArray([], instructions, true),
|
|
@@ -7819,7 +7618,7 @@ var PerpetualsClient = (function () {
|
|
|
7819
7618
|
});
|
|
7820
7619
|
}); };
|
|
7821
7620
|
this.initStake = function (stakingFeeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7822
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction,
|
|
7621
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction, err_55;
|
|
7823
7622
|
return __generator(this, function (_a) {
|
|
7824
7623
|
switch (_a.label) {
|
|
7825
7624
|
case 0:
|
|
@@ -7857,9 +7656,9 @@ var PerpetualsClient = (function () {
|
|
|
7857
7656
|
instructions.push(initStakeInstruction);
|
|
7858
7657
|
return [3, 4];
|
|
7859
7658
|
case 3:
|
|
7860
|
-
|
|
7861
|
-
console.log("perpClient InitStaking error:: ",
|
|
7862
|
-
throw
|
|
7659
|
+
err_55 = _a.sent();
|
|
7660
|
+
console.log("perpClient InitStaking error:: ", err_55);
|
|
7661
|
+
throw err_55;
|
|
7863
7662
|
case 4: return [2, {
|
|
7864
7663
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7865
7664
|
additionalSigners: additionalSigners
|
|
@@ -7868,7 +7667,7 @@ var PerpetualsClient = (function () {
|
|
|
7868
7667
|
});
|
|
7869
7668
|
}); };
|
|
7870
7669
|
this.initCompounding = function (feeShareBps, metadataTitle, metadataSymbol, metadataUri, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7871
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction,
|
|
7670
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction, err_56;
|
|
7872
7671
|
return __generator(this, function (_a) {
|
|
7873
7672
|
switch (_a.label) {
|
|
7874
7673
|
case 0:
|
|
@@ -7897,7 +7696,6 @@ var PerpetualsClient = (function () {
|
|
|
7897
7696
|
transferAuthority: poolConfig.transferAuthority,
|
|
7898
7697
|
perpetuals: this.perpetuals.publicKey,
|
|
7899
7698
|
pool: poolConfig.poolAddress,
|
|
7900
|
-
custody: rewardCustodyConfig.custodyAccount,
|
|
7901
7699
|
lpTokenMint: poolConfig.stakedLpTokenMint,
|
|
7902
7700
|
compoundingVault: compoundingVault,
|
|
7903
7701
|
compoundingTokenMint: compoundingTokenMint,
|
|
@@ -7913,9 +7711,9 @@ var PerpetualsClient = (function () {
|
|
|
7913
7711
|
instructions.push(initCompoundingInstruction);
|
|
7914
7712
|
return [3, 4];
|
|
7915
7713
|
case 3:
|
|
7916
|
-
|
|
7917
|
-
console.log("perpClient initCompounding error:: ",
|
|
7918
|
-
throw
|
|
7714
|
+
err_56 = _a.sent();
|
|
7715
|
+
console.log("perpClient initCompounding error:: ", err_56);
|
|
7716
|
+
throw err_56;
|
|
7919
7717
|
case 4: return [2, {
|
|
7920
7718
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7921
7719
|
additionalSigners: additionalSigners
|
|
@@ -7924,7 +7722,7 @@ var PerpetualsClient = (function () {
|
|
|
7924
7722
|
});
|
|
7925
7723
|
}); };
|
|
7926
7724
|
this.initTokenVault = function (token_permissions, tokens_to_distribute, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7927
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction,
|
|
7725
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction, err_57;
|
|
7928
7726
|
return __generator(this, function (_a) {
|
|
7929
7727
|
switch (_a.label) {
|
|
7930
7728
|
case 0:
|
|
@@ -7965,9 +7763,9 @@ var PerpetualsClient = (function () {
|
|
|
7965
7763
|
instructions.push(initTokenVaultInstruction);
|
|
7966
7764
|
return [3, 4];
|
|
7967
7765
|
case 3:
|
|
7968
|
-
|
|
7969
|
-
console.log("perpClient InitTokenVaultInstruction error:: ",
|
|
7970
|
-
throw
|
|
7766
|
+
err_57 = _a.sent();
|
|
7767
|
+
console.log("perpClient InitTokenVaultInstruction error:: ", err_57);
|
|
7768
|
+
throw err_57;
|
|
7971
7769
|
case 4: return [2, {
|
|
7972
7770
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7973
7771
|
additionalSigners: additionalSigners
|
|
@@ -7976,7 +7774,7 @@ var PerpetualsClient = (function () {
|
|
|
7976
7774
|
});
|
|
7977
7775
|
}); };
|
|
7978
7776
|
this.setTokenVaultConfig = function (token_permissions, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7979
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction,
|
|
7777
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction, err_58;
|
|
7980
7778
|
return __generator(this, function (_a) {
|
|
7981
7779
|
switch (_a.label) {
|
|
7982
7780
|
case 0:
|
|
@@ -8007,9 +7805,9 @@ var PerpetualsClient = (function () {
|
|
|
8007
7805
|
instructions.push(setTokenVaultConfigInstruction);
|
|
8008
7806
|
return [3, 4];
|
|
8009
7807
|
case 3:
|
|
8010
|
-
|
|
8011
|
-
console.log("perpClient setTokenVaultConfigInstruction error:: ",
|
|
8012
|
-
throw
|
|
7808
|
+
err_58 = _a.sent();
|
|
7809
|
+
console.log("perpClient setTokenVaultConfigInstruction error:: ", err_58);
|
|
7810
|
+
throw err_58;
|
|
8013
7811
|
case 4: return [2, {
|
|
8014
7812
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8015
7813
|
additionalSigners: additionalSigners
|
|
@@ -8018,7 +7816,7 @@ var PerpetualsClient = (function () {
|
|
|
8018
7816
|
});
|
|
8019
7817
|
}); };
|
|
8020
7818
|
this.withdrawInstantFee = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8021
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction,
|
|
7819
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction, err_59;
|
|
8022
7820
|
return __generator(this, function (_a) {
|
|
8023
7821
|
switch (_a.label) {
|
|
8024
7822
|
case 0:
|
|
@@ -8057,9 +7855,59 @@ var PerpetualsClient = (function () {
|
|
|
8057
7855
|
instructions.push(withdrawInstantFeeInstruction);
|
|
8058
7856
|
return [3, 6];
|
|
8059
7857
|
case 5:
|
|
8060
|
-
|
|
8061
|
-
console.log("perpClient withdrawInstantFeeInstruction error:: ",
|
|
8062
|
-
throw
|
|
7858
|
+
err_59 = _a.sent();
|
|
7859
|
+
console.log("perpClient withdrawInstantFeeInstruction error:: ", err_59);
|
|
7860
|
+
throw err_59;
|
|
7861
|
+
case 6: return [2, {
|
|
7862
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7863
|
+
additionalSigners: additionalSigners
|
|
7864
|
+
}];
|
|
7865
|
+
}
|
|
7866
|
+
});
|
|
7867
|
+
}); };
|
|
7868
|
+
this.withdrawUnclaimedTokens = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7869
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawUnclaimedTokensInstruction, err_60;
|
|
7870
|
+
return __generator(this, function (_a) {
|
|
7871
|
+
switch (_a.label) {
|
|
7872
|
+
case 0:
|
|
7873
|
+
publicKey = this.provider.wallet.publicKey;
|
|
7874
|
+
preInstructions = [];
|
|
7875
|
+
instructions = [];
|
|
7876
|
+
postInstructions = [];
|
|
7877
|
+
additionalSigners = [];
|
|
7878
|
+
_a.label = 1;
|
|
7879
|
+
case 1:
|
|
7880
|
+
_a.trys.push([1, 5, , 6]);
|
|
7881
|
+
return [4, (0, spl_token_1.getAssociatedTokenAddress)(poolConfig.tokenMint, publicKey, true)];
|
|
7882
|
+
case 2:
|
|
7883
|
+
receivingTokenAccount = _a.sent();
|
|
7884
|
+
return [4, (0, utils_1.checkIfAccountExists)(receivingTokenAccount, this.provider.connection)];
|
|
7885
|
+
case 3:
|
|
7886
|
+
if (!(_a.sent())) {
|
|
7887
|
+
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, receivingTokenAccount, publicKey, poolConfig.tokenMint));
|
|
7888
|
+
}
|
|
7889
|
+
return [4, this.program.methods
|
|
7890
|
+
.withdrawUnclaimedTokens({})
|
|
7891
|
+
.accounts({
|
|
7892
|
+
admin: publicKey,
|
|
7893
|
+
multisig: this.multisig.publicKey,
|
|
7894
|
+
perpetuals: this.perpetuals.publicKey,
|
|
7895
|
+
transferAuthority: poolConfig.transferAuthority,
|
|
7896
|
+
tokenVault: poolConfig.tokenVault,
|
|
7897
|
+
tokenVaultTokenAccount: poolConfig.tokenVaultTokenAccount,
|
|
7898
|
+
receivingTokenAccount: receivingTokenAccount,
|
|
7899
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
7900
|
+
receivingTokenMint: poolConfig.tokenMint,
|
|
7901
|
+
})
|
|
7902
|
+
.instruction()];
|
|
7903
|
+
case 4:
|
|
7904
|
+
withdrawUnclaimedTokensInstruction = _a.sent();
|
|
7905
|
+
instructions.push(withdrawUnclaimedTokensInstruction);
|
|
7906
|
+
return [3, 6];
|
|
7907
|
+
case 5:
|
|
7908
|
+
err_60 = _a.sent();
|
|
7909
|
+
console.log("perpClient withdrawUnclaimedTokensInstruction error:: ", err_60);
|
|
7910
|
+
throw err_60;
|
|
8063
7911
|
case 6: return [2, {
|
|
8064
7912
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8065
7913
|
additionalSigners: additionalSigners
|
|
@@ -8068,7 +7916,7 @@ var PerpetualsClient = (function () {
|
|
|
8068
7916
|
});
|
|
8069
7917
|
}); };
|
|
8070
7918
|
this.initRevenueTokenAccount = function (feeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8071
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction,
|
|
7919
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction, err_61;
|
|
8072
7920
|
return __generator(this, function (_a) {
|
|
8073
7921
|
switch (_a.label) {
|
|
8074
7922
|
case 0:
|
|
@@ -8105,9 +7953,9 @@ var PerpetualsClient = (function () {
|
|
|
8105
7953
|
instructions.push(initRevenueTokenAccountInstruction);
|
|
8106
7954
|
return [3, 4];
|
|
8107
7955
|
case 3:
|
|
8108
|
-
|
|
8109
|
-
console.log("perpClient initRevenueTokenAccountInstruction error:: ",
|
|
8110
|
-
throw
|
|
7956
|
+
err_61 = _a.sent();
|
|
7957
|
+
console.log("perpClient initRevenueTokenAccountInstruction error:: ", err_61);
|
|
7958
|
+
throw err_61;
|
|
8111
7959
|
case 4: return [2, {
|
|
8112
7960
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8113
7961
|
additionalSigners: additionalSigners
|
|
@@ -8116,7 +7964,7 @@ var PerpetualsClient = (function () {
|
|
|
8116
7964
|
});
|
|
8117
7965
|
}); };
|
|
8118
7966
|
this.distributeTokenReward = function (amount, epochCount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8119
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction,
|
|
7967
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction, err_62;
|
|
8120
7968
|
return __generator(this, function (_a) {
|
|
8121
7969
|
switch (_a.label) {
|
|
8122
7970
|
case 0:
|
|
@@ -8155,9 +8003,9 @@ var PerpetualsClient = (function () {
|
|
|
8155
8003
|
instructions.push(distributeTokenRewardInstruction);
|
|
8156
8004
|
return [3, 4];
|
|
8157
8005
|
case 3:
|
|
8158
|
-
|
|
8159
|
-
console.log("perpClient distributeTokenRewardInstruction error:: ",
|
|
8160
|
-
throw
|
|
8006
|
+
err_62 = _a.sent();
|
|
8007
|
+
console.log("perpClient distributeTokenRewardInstruction error:: ", err_62);
|
|
8008
|
+
throw err_62;
|
|
8161
8009
|
case 4: return [2, {
|
|
8162
8010
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8163
8011
|
additionalSigners: additionalSigners
|
|
@@ -8166,7 +8014,7 @@ var PerpetualsClient = (function () {
|
|
|
8166
8014
|
});
|
|
8167
8015
|
}); };
|
|
8168
8016
|
this.setTokenStakeLevel = function (owner, stakeLevel) { return __awaiter(_this, void 0, void 0, function () {
|
|
8169
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction,
|
|
8017
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction, err_63;
|
|
8170
8018
|
return __generator(this, function (_a) {
|
|
8171
8019
|
switch (_a.label) {
|
|
8172
8020
|
case 0:
|
|
@@ -8194,9 +8042,9 @@ var PerpetualsClient = (function () {
|
|
|
8194
8042
|
instructions.push(setTokenStakeLevelInstruction);
|
|
8195
8043
|
return [3, 4];
|
|
8196
8044
|
case 3:
|
|
8197
|
-
|
|
8198
|
-
console.log("perpClient setTokenStakeLevelInstruction error:: ",
|
|
8199
|
-
throw
|
|
8045
|
+
err_63 = _a.sent();
|
|
8046
|
+
console.log("perpClient setTokenStakeLevelInstruction error:: ", err_63);
|
|
8047
|
+
throw err_63;
|
|
8200
8048
|
case 4: return [2, {
|
|
8201
8049
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8202
8050
|
additionalSigners: additionalSigners
|
|
@@ -8205,7 +8053,7 @@ var PerpetualsClient = (function () {
|
|
|
8205
8053
|
});
|
|
8206
8054
|
}); };
|
|
8207
8055
|
this.setTokenReward = function (owner, amount, epochCount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8208
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction,
|
|
8056
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction, err_64;
|
|
8209
8057
|
return __generator(this, function (_a) {
|
|
8210
8058
|
switch (_a.label) {
|
|
8211
8059
|
case 0:
|
|
@@ -8237,9 +8085,49 @@ var PerpetualsClient = (function () {
|
|
|
8237
8085
|
instructions.push(setTokenRewardInstruction);
|
|
8238
8086
|
return [3, 4];
|
|
8239
8087
|
case 3:
|
|
8240
|
-
|
|
8241
|
-
console.log("perpClient setTokenRewardInstruction error:: ",
|
|
8242
|
-
throw
|
|
8088
|
+
err_64 = _a.sent();
|
|
8089
|
+
console.log("perpClient setTokenRewardInstruction error:: ", err_64);
|
|
8090
|
+
throw err_64;
|
|
8091
|
+
case 4: return [2, {
|
|
8092
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8093
|
+
additionalSigners: additionalSigners
|
|
8094
|
+
}];
|
|
8095
|
+
}
|
|
8096
|
+
});
|
|
8097
|
+
}); };
|
|
8098
|
+
this.resizeInternalOracle = function (extOracle, tokenMint, intOracleAccount) { return __awaiter(_this, void 0, void 0, function () {
|
|
8099
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction, err_65;
|
|
8100
|
+
return __generator(this, function (_a) {
|
|
8101
|
+
switch (_a.label) {
|
|
8102
|
+
case 0:
|
|
8103
|
+
publicKey = this.provider.wallet.publicKey;
|
|
8104
|
+
preInstructions = [];
|
|
8105
|
+
instructions = [];
|
|
8106
|
+
postInstructions = [];
|
|
8107
|
+
additionalSigners = [];
|
|
8108
|
+
_a.label = 1;
|
|
8109
|
+
case 1:
|
|
8110
|
+
_a.trys.push([1, 3, , 4]);
|
|
8111
|
+
return [4, this.program.methods
|
|
8112
|
+
.resizeInternalOracle({
|
|
8113
|
+
extOracle: extOracle
|
|
8114
|
+
})
|
|
8115
|
+
.accounts({
|
|
8116
|
+
admin: publicKey,
|
|
8117
|
+
multisig: this.multisig.publicKey,
|
|
8118
|
+
custodyTokenMint: tokenMint,
|
|
8119
|
+
intOracleAccount: intOracleAccount,
|
|
8120
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
8121
|
+
})
|
|
8122
|
+
.instruction()];
|
|
8123
|
+
case 2:
|
|
8124
|
+
resizeInternalOracleInstruction = _a.sent();
|
|
8125
|
+
instructions.push(resizeInternalOracleInstruction);
|
|
8126
|
+
return [3, 4];
|
|
8127
|
+
case 3:
|
|
8128
|
+
err_65 = _a.sent();
|
|
8129
|
+
console.log("perpClient resizeInternalOracleInstruction error:: ", err_65);
|
|
8130
|
+
throw err_65;
|
|
8243
8131
|
case 4: return [2, {
|
|
8244
8132
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8245
8133
|
additionalSigners: additionalSigners
|