flash-sdk 9.0.2 → 9.9.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 +0 -1
- package/dist/PerpetualsClient.d.ts +24 -20
- package/dist/PerpetualsClient.js +344 -501
- package/dist/PoolAccount.d.ts +0 -1
- package/dist/PoolConfig.d.ts +2 -1
- package/dist/PoolConfig.js +10 -2
- package/dist/PoolConfig.json +1605 -396
- 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 +226 -524
- package/dist/idl/perpetuals.js +225 -523
- 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 +1 -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.");
|
|
@@ -91,31 +91,35 @@ var PerpetualsClient = (function () {
|
|
|
91
91
|
_this.prioritizationFee = fee;
|
|
92
92
|
};
|
|
93
93
|
this.loadAddressLookupTable = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
94
|
-
var addresses, _i, _a, address, addressLookupTable, accCreationLamports;
|
|
95
|
-
return __generator(this, function (
|
|
96
|
-
switch (
|
|
94
|
+
var addresses, _i, _a, address, addressLookupTable, _b, accCreationLamports;
|
|
95
|
+
return __generator(this, function (_c) {
|
|
96
|
+
switch (_c.label) {
|
|
97
97
|
case 0:
|
|
98
98
|
addresses = [];
|
|
99
99
|
_i = 0, _a = poolConfig.addressLookupTableAddresses;
|
|
100
|
-
|
|
100
|
+
_c.label = 1;
|
|
101
101
|
case 1:
|
|
102
102
|
if (!(_i < _a.length)) return [3, 4];
|
|
103
103
|
address = _a[_i];
|
|
104
104
|
return [4, this.provider.connection.getAddressLookupTable(address)];
|
|
105
105
|
case 2:
|
|
106
|
-
addressLookupTable = (
|
|
106
|
+
addressLookupTable = (_c.sent()).value;
|
|
107
107
|
if (addressLookupTable) {
|
|
108
108
|
addresses.push(addressLookupTable);
|
|
109
109
|
}
|
|
110
|
-
|
|
110
|
+
_c.label = 3;
|
|
111
111
|
case 3:
|
|
112
112
|
_i++;
|
|
113
113
|
return [3, 1];
|
|
114
114
|
case 4:
|
|
115
115
|
this.addressLookupTables = addresses;
|
|
116
|
-
|
|
116
|
+
_b = this;
|
|
117
|
+
return [4, this.provider.connection.getAddressLookupTable(poolConfig.pusherAddressLookupTableAddress)];
|
|
117
118
|
case 5:
|
|
118
|
-
|
|
119
|
+
_b.pusherAddressLookupTables = (_c.sent()).value;
|
|
120
|
+
return [4, (0, spl_token_1.getMinimumBalanceForRentExemptAccount)(this.provider.connection)];
|
|
121
|
+
case 6:
|
|
122
|
+
accCreationLamports = (_c.sent());
|
|
119
123
|
if (accCreationLamports) {
|
|
120
124
|
this.minimumBalanceForRentExemptAccountLamports = accCreationLamports;
|
|
121
125
|
}
|
|
@@ -1887,7 +1891,7 @@ var PerpetualsClient = (function () {
|
|
|
1887
1891
|
});
|
|
1888
1892
|
};
|
|
1889
1893
|
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;
|
|
1894
|
+
var backUpOracleInstructionPromise, custodies, custodyMetas, marketMetas, _i, custodies_1, token, _a, custodies_2, custody, _b, _c, market, transaction, backUpOracleInstruction, setCULimitIx, result, index, res;
|
|
1891
1895
|
var _d;
|
|
1892
1896
|
return __generator(this, function (_e) {
|
|
1893
1897
|
switch (_e.label) {
|
|
@@ -1935,6 +1939,8 @@ var PerpetualsClient = (function () {
|
|
|
1935
1939
|
return [4, backUpOracleInstructionPromise];
|
|
1936
1940
|
case 2:
|
|
1937
1941
|
backUpOracleInstruction = _e.sent();
|
|
1942
|
+
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
1943
|
+
transaction.instructions.unshift(setCULimitIx);
|
|
1938
1944
|
(_d = transaction.instructions).unshift.apply(_d, backUpOracleInstruction);
|
|
1939
1945
|
return [4, this.viewHelper.simulateTransaction(transaction)];
|
|
1940
1946
|
case 3:
|
|
@@ -2001,7 +2007,7 @@ var PerpetualsClient = (function () {
|
|
|
2001
2007
|
args_1[_i - 4] = arguments[_i];
|
|
2002
2008
|
}
|
|
2003
2009
|
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;
|
|
2010
|
+
var custodies, custodyMetas, marketMetas, _a, custodies_5, token, _b, custodies_6, custody, _c, _d, market, depositCustodyConfig, transaction, setCULimitIx, backUpOracleInstruction, result, index, res;
|
|
2005
2011
|
var _e;
|
|
2006
2012
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
2007
2013
|
if (enableBackupOracle === void 0) { enableBackupOracle = false; }
|
|
@@ -2052,6 +2058,8 @@ var PerpetualsClient = (function () {
|
|
|
2052
2058
|
.transaction()];
|
|
2053
2059
|
case 1:
|
|
2054
2060
|
transaction = _f.sent();
|
|
2061
|
+
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2062
|
+
transaction.instructions.unshift(setCULimitIx);
|
|
2055
2063
|
if (!enableBackupOracle) return [3, 3];
|
|
2056
2064
|
return [4, (0, backupOracle_1.createBackupOracleInstruction)(POOL_CONFIG.poolAddress.toBase58(), true)];
|
|
2057
2065
|
case 2:
|
|
@@ -2077,7 +2085,7 @@ var PerpetualsClient = (function () {
|
|
|
2077
2085
|
args_1[_i - 4] = arguments[_i];
|
|
2078
2086
|
}
|
|
2079
2087
|
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;
|
|
2088
|
+
var custodies, custodyMetas, marketMetas, _a, custodies_7, token, _b, custodies_8, custody, _c, _d, market, removeCustodyConfig, transaction, setCULimitIx, backUpOracleInstruction, result, index, res;
|
|
2081
2089
|
var _e;
|
|
2082
2090
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
2083
2091
|
if (enableBackupOracle === void 0) { enableBackupOracle = false; }
|
|
@@ -2128,6 +2136,8 @@ var PerpetualsClient = (function () {
|
|
|
2128
2136
|
.transaction()];
|
|
2129
2137
|
case 1:
|
|
2130
2138
|
transaction = _f.sent();
|
|
2139
|
+
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2140
|
+
transaction.instructions.unshift(setCULimitIx);
|
|
2131
2141
|
if (!enableBackupOracle) return [3, 3];
|
|
2132
2142
|
return [4, (0, backupOracle_1.createBackupOracleInstruction)(POOL_CONFIG.poolAddress.toBase58(), true)];
|
|
2133
2143
|
case 2:
|
|
@@ -2154,7 +2164,7 @@ var PerpetualsClient = (function () {
|
|
|
2154
2164
|
});
|
|
2155
2165
|
};
|
|
2156
2166
|
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;
|
|
2167
|
+
var backUpOracleInstructionPromise, custodies, custodyMetas, marketMetas, _i, custodies_9, token, _a, custodies_10, custody, _b, _c, market, backUpOracleInstruction, transaction, setCULimitIx, result, index, res;
|
|
2158
2168
|
var _d;
|
|
2159
2169
|
return __generator(this, function (_e) {
|
|
2160
2170
|
switch (_e.label) {
|
|
@@ -2202,6 +2212,8 @@ var PerpetualsClient = (function () {
|
|
|
2202
2212
|
.transaction()];
|
|
2203
2213
|
case 2:
|
|
2204
2214
|
transaction = _e.sent();
|
|
2215
|
+
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2216
|
+
transaction.instructions.unshift(setCULimitIx);
|
|
2205
2217
|
(_d = transaction.instructions).unshift.apply(_d, backUpOracleInstruction);
|
|
2206
2218
|
return [4, this.viewHelper.simulateTransaction(transaction)];
|
|
2207
2219
|
case 3:
|
|
@@ -2218,7 +2230,7 @@ var PerpetualsClient = (function () {
|
|
|
2218
2230
|
args_1[_i - 4] = arguments[_i];
|
|
2219
2231
|
}
|
|
2220
2232
|
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;
|
|
2233
|
+
var custodies, custodyMetas, marketMetas, _a, custodies_11, token, _b, custodies_12, custody, _c, _d, market, depositCustodyConfig, rewardCustody, transaction, setCULimitIx, backUpOracleInstruction, result, index, res;
|
|
2222
2234
|
var _e;
|
|
2223
2235
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
2224
2236
|
if (enableBackupOracle === void 0) { enableBackupOracle = false; }
|
|
@@ -2273,6 +2285,8 @@ var PerpetualsClient = (function () {
|
|
|
2273
2285
|
.transaction()];
|
|
2274
2286
|
case 1:
|
|
2275
2287
|
transaction = _f.sent();
|
|
2288
|
+
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2289
|
+
transaction.instructions.unshift(setCULimitIx);
|
|
2276
2290
|
if (!enableBackupOracle) return [3, 3];
|
|
2277
2291
|
return [4, (0, backupOracle_1.createBackupOracleInstruction)(POOL_CONFIG.poolAddress.toBase58(), true)];
|
|
2278
2292
|
case 2:
|
|
@@ -2298,7 +2312,7 @@ var PerpetualsClient = (function () {
|
|
|
2298
2312
|
args_1[_i - 4] = arguments[_i];
|
|
2299
2313
|
}
|
|
2300
2314
|
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;
|
|
2315
|
+
var custodies, custodyMetas, marketMetas, _a, custodies_13, token, _b, custodies_14, custody, _c, _d, market, removeCustodyConfig, rewardCustody, transaction, setCULimitIx, backUpOracleInstruction, result, index, res;
|
|
2302
2316
|
var _e;
|
|
2303
2317
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
2304
2318
|
if (enableBackupOracle === void 0) { enableBackupOracle = false; }
|
|
@@ -2353,6 +2367,8 @@ var PerpetualsClient = (function () {
|
|
|
2353
2367
|
.transaction()];
|
|
2354
2368
|
case 1:
|
|
2355
2369
|
transaction = _f.sent();
|
|
2370
|
+
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2371
|
+
transaction.instructions.unshift(setCULimitIx);
|
|
2356
2372
|
if (!enableBackupOracle) return [3, 3];
|
|
2357
2373
|
return [4, (0, backupOracle_1.createBackupOracleInstruction)(POOL_CONFIG.poolAddress.toBase58(), true)];
|
|
2358
2374
|
case 2:
|
|
@@ -4084,119 +4100,8 @@ var PerpetualsClient = (function () {
|
|
|
4084
4100
|
}
|
|
4085
4101
|
});
|
|
4086
4102
|
}); };
|
|
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
4103
|
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,
|
|
4104
|
+
var preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, depositStakeInstruction, err_8;
|
|
4200
4105
|
return __generator(this, function (_a) {
|
|
4201
4106
|
switch (_a.label) {
|
|
4202
4107
|
case 0:
|
|
@@ -4238,9 +4143,9 @@ var PerpetualsClient = (function () {
|
|
|
4238
4143
|
instructions.push(depositStakeInstruction);
|
|
4239
4144
|
return [3, 5];
|
|
4240
4145
|
case 4:
|
|
4241
|
-
|
|
4242
|
-
console.log("perpClient depositStaking error:: ",
|
|
4243
|
-
throw
|
|
4146
|
+
err_8 = _a.sent();
|
|
4147
|
+
console.log("perpClient depositStaking error:: ", err_8);
|
|
4148
|
+
throw err_8;
|
|
4244
4149
|
case 5: return [2, {
|
|
4245
4150
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4246
4151
|
additionalSigners: additionalSigners
|
|
@@ -4249,7 +4154,7 @@ var PerpetualsClient = (function () {
|
|
|
4249
4154
|
});
|
|
4250
4155
|
}); };
|
|
4251
4156
|
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,
|
|
4157
|
+
var rewardCustodyMint, rewardCustodyConfig, pool, feeDistributionTokenAccount, custodyAccountMetas, _i, _a, custody, maxFlpStakeAccountPkLength, flpStakeAccountMetas, _b, flpStakeAccountPks_1, flpStakeAccountPk, refreshStakeInstruction, err_9;
|
|
4253
4158
|
return __generator(this, function (_c) {
|
|
4254
4159
|
switch (_c.label) {
|
|
4255
4160
|
case 0:
|
|
@@ -4296,9 +4201,9 @@ var PerpetualsClient = (function () {
|
|
|
4296
4201
|
refreshStakeInstruction = _c.sent();
|
|
4297
4202
|
return [2, refreshStakeInstruction];
|
|
4298
4203
|
case 2:
|
|
4299
|
-
|
|
4300
|
-
console.log("perpClient refreshStaking error:: ",
|
|
4301
|
-
throw
|
|
4204
|
+
err_9 = _c.sent();
|
|
4205
|
+
console.log("perpClient refreshStaking error:: ", err_9);
|
|
4206
|
+
throw err_9;
|
|
4302
4207
|
case 3: return [2];
|
|
4303
4208
|
}
|
|
4304
4209
|
});
|
|
@@ -4309,7 +4214,7 @@ var PerpetualsClient = (function () {
|
|
|
4309
4214
|
args_1[_i - 3] = arguments[_i];
|
|
4310
4215
|
}
|
|
4311
4216
|
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,
|
|
4217
|
+
var publicKey, rewardCustodyMint, rewardCustodyConfig, pool, feeDistributionTokenAccount, custodyAccountMetas, _a, _b, custody, stakeAccountMetas, tokenStakeAccount, refreshStakeInstruction, err_10;
|
|
4313
4218
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
4314
4219
|
return __generator(this, function (_c) {
|
|
4315
4220
|
switch (_c.label) {
|
|
@@ -4357,9 +4262,9 @@ var PerpetualsClient = (function () {
|
|
|
4357
4262
|
refreshStakeInstruction = _c.sent();
|
|
4358
4263
|
return [2, refreshStakeInstruction];
|
|
4359
4264
|
case 2:
|
|
4360
|
-
|
|
4361
|
-
console.log("perpClient refreshStaking error:: ",
|
|
4362
|
-
throw
|
|
4265
|
+
err_10 = _c.sent();
|
|
4266
|
+
console.log("perpClient refreshStaking error:: ", err_10);
|
|
4267
|
+
throw err_10;
|
|
4363
4268
|
case 3: return [2];
|
|
4364
4269
|
}
|
|
4365
4270
|
});
|
|
@@ -4371,7 +4276,7 @@ var PerpetualsClient = (function () {
|
|
|
4371
4276
|
args_1[_i - 3] = arguments[_i];
|
|
4372
4277
|
}
|
|
4373
4278
|
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,
|
|
4279
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, pool, flpStakeAccount, tokenStakeAccount, tokenStakeAccounts, _a, unstakeInstantInstruction, err_11;
|
|
4375
4280
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
4376
4281
|
return __generator(this, function (_b) {
|
|
4377
4282
|
switch (_b.label) {
|
|
@@ -4423,9 +4328,9 @@ var PerpetualsClient = (function () {
|
|
|
4423
4328
|
instructions.push(unstakeInstantInstruction);
|
|
4424
4329
|
return [3, 6];
|
|
4425
4330
|
case 5:
|
|
4426
|
-
|
|
4427
|
-
console.log("perpClient unstakeInstant error:: ",
|
|
4428
|
-
throw
|
|
4331
|
+
err_11 = _b.sent();
|
|
4332
|
+
console.log("perpClient unstakeInstant error:: ", err_11);
|
|
4333
|
+
throw err_11;
|
|
4429
4334
|
case 6: return [2, {
|
|
4430
4335
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4431
4336
|
additionalSigners: additionalSigners
|
|
@@ -4435,7 +4340,7 @@ var PerpetualsClient = (function () {
|
|
|
4435
4340
|
});
|
|
4436
4341
|
};
|
|
4437
4342
|
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,
|
|
4343
|
+
var publicKey, pool, custodyAccountMetas, _i, _a, custody, maxFlpStakeAccountPkLength, flpStakeAccountMetas, _b, flpStakeAccountPks_2, flpStakeAccountPk, refreshStakeInstruction, err_12;
|
|
4439
4344
|
return __generator(this, function (_c) {
|
|
4440
4345
|
switch (_c.label) {
|
|
4441
4346
|
case 0:
|
|
@@ -4479,15 +4384,15 @@ var PerpetualsClient = (function () {
|
|
|
4479
4384
|
refreshStakeInstruction = _c.sent();
|
|
4480
4385
|
return [2, refreshStakeInstruction];
|
|
4481
4386
|
case 2:
|
|
4482
|
-
|
|
4483
|
-
console.log("perpClient refreshStaking error:: ",
|
|
4484
|
-
throw
|
|
4387
|
+
err_12 = _c.sent();
|
|
4388
|
+
console.log("perpClient refreshStaking error:: ", err_12);
|
|
4389
|
+
throw err_12;
|
|
4485
4390
|
case 3: return [2];
|
|
4486
4391
|
}
|
|
4487
4392
|
});
|
|
4488
4393
|
}); };
|
|
4489
4394
|
this.unstakeRequest = function (unstakeAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
4490
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, unstakeRequestInstruction,
|
|
4395
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, unstakeRequestInstruction, err_13;
|
|
4491
4396
|
return __generator(this, function (_a) {
|
|
4492
4397
|
switch (_a.label) {
|
|
4493
4398
|
case 0:
|
|
@@ -4521,9 +4426,9 @@ var PerpetualsClient = (function () {
|
|
|
4521
4426
|
instructions.push(unstakeRequestInstruction);
|
|
4522
4427
|
return [3, 4];
|
|
4523
4428
|
case 3:
|
|
4524
|
-
|
|
4525
|
-
console.log("perpClient unstakeRequest error:: ",
|
|
4526
|
-
throw
|
|
4429
|
+
err_13 = _a.sent();
|
|
4430
|
+
console.log("perpClient unstakeRequest error:: ", err_13);
|
|
4431
|
+
throw err_13;
|
|
4527
4432
|
case 4: return [2, {
|
|
4528
4433
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4529
4434
|
additionalSigners: additionalSigners
|
|
@@ -4537,7 +4442,7 @@ var PerpetualsClient = (function () {
|
|
|
4537
4442
|
args_1[_i - 1] = arguments[_i];
|
|
4538
4443
|
}
|
|
4539
4444
|
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,
|
|
4445
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, pool, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, _a, withdrawStakeInstruction, err_14;
|
|
4541
4446
|
if (pendingActivation === void 0) { pendingActivation = true; }
|
|
4542
4447
|
if (deactivated === void 0) { deactivated = true; }
|
|
4543
4448
|
if (createUserLPTA === void 0) { createUserLPTA = true; }
|
|
@@ -4593,9 +4498,9 @@ var PerpetualsClient = (function () {
|
|
|
4593
4498
|
instructions.push(withdrawStakeInstruction);
|
|
4594
4499
|
return [3, 6];
|
|
4595
4500
|
case 5:
|
|
4596
|
-
|
|
4597
|
-
console.log("perpClient withdrawStake error:: ",
|
|
4598
|
-
throw
|
|
4501
|
+
err_14 = _b.sent();
|
|
4502
|
+
console.log("perpClient withdrawStake error:: ", err_14);
|
|
4503
|
+
throw err_14;
|
|
4599
4504
|
case 6: return [2, {
|
|
4600
4505
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4601
4506
|
additionalSigners: additionalSigners
|
|
@@ -4610,7 +4515,7 @@ var PerpetualsClient = (function () {
|
|
|
4610
4515
|
args_1[_i - 3] = arguments[_i];
|
|
4611
4516
|
}
|
|
4612
4517
|
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,
|
|
4518
|
+
var publicKey, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tokenStakeAccounts, withdrawStakeInstruction, err_15;
|
|
4614
4519
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
4615
4520
|
return __generator(this, function (_b) {
|
|
4616
4521
|
switch (_b.label) {
|
|
@@ -4671,9 +4576,9 @@ var PerpetualsClient = (function () {
|
|
|
4671
4576
|
instructions.push(withdrawStakeInstruction);
|
|
4672
4577
|
return [3, 6];
|
|
4673
4578
|
case 5:
|
|
4674
|
-
|
|
4675
|
-
console.log("perpClient withdrawStake error:: ",
|
|
4676
|
-
throw
|
|
4579
|
+
err_15 = _b.sent();
|
|
4580
|
+
console.log("perpClient withdrawStake error:: ", err_15);
|
|
4581
|
+
throw err_15;
|
|
4677
4582
|
case 6: return [2, {
|
|
4678
4583
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4679
4584
|
additionalSigners: additionalSigners
|
|
@@ -4688,7 +4593,7 @@ var PerpetualsClient = (function () {
|
|
|
4688
4593
|
args_1[_i - 5] = arguments[_i];
|
|
4689
4594
|
}
|
|
4690
4595
|
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,
|
|
4596
|
+
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
4597
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
|
4693
4598
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
4694
4599
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
@@ -4816,8 +4721,8 @@ var PerpetualsClient = (function () {
|
|
|
4816
4721
|
instructions.push(addCompoundingLiquidity);
|
|
4817
4722
|
return [3, 10];
|
|
4818
4723
|
case 9:
|
|
4819
|
-
|
|
4820
|
-
console.log("perpClient addCompoundingLiquidity error:: ",
|
|
4724
|
+
err_16 = _f.sent();
|
|
4725
|
+
console.log("perpClient addCompoundingLiquidity error:: ", err_16);
|
|
4821
4726
|
return [3, 10];
|
|
4822
4727
|
case 10: return [2, {
|
|
4823
4728
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
@@ -4833,7 +4738,7 @@ var PerpetualsClient = (function () {
|
|
|
4833
4738
|
args_1[_i - 5] = arguments[_i];
|
|
4834
4739
|
}
|
|
4835
4740
|
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,
|
|
4741
|
+
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
4742
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
4838
4743
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
4839
4744
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
@@ -4945,8 +4850,8 @@ var PerpetualsClient = (function () {
|
|
|
4945
4850
|
instructions.push(removeCompoundingLiquidity);
|
|
4946
4851
|
return [3, 8];
|
|
4947
4852
|
case 7:
|
|
4948
|
-
|
|
4949
|
-
console.log("perpClient removeCompoundingLiquidity error:: ",
|
|
4853
|
+
err_17 = _f.sent();
|
|
4854
|
+
console.log("perpClient removeCompoundingLiquidity error:: ", err_17);
|
|
4950
4855
|
return [3, 8];
|
|
4951
4856
|
case 8: return [2, {
|
|
4952
4857
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
@@ -4962,7 +4867,7 @@ var PerpetualsClient = (function () {
|
|
|
4962
4867
|
args_1[_i - 3] = arguments[_i];
|
|
4963
4868
|
}
|
|
4964
4869
|
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,
|
|
4870
|
+
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
4871
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
4967
4872
|
return __generator(this, function (_g) {
|
|
4968
4873
|
switch (_g.label) {
|
|
@@ -5060,8 +4965,8 @@ var PerpetualsClient = (function () {
|
|
|
5060
4965
|
instructions.push(migrateStake);
|
|
5061
4966
|
return [3, 8];
|
|
5062
4967
|
case 7:
|
|
5063
|
-
|
|
5064
|
-
console.log("perpClient migrateStake error:: ",
|
|
4968
|
+
err_18 = _g.sent();
|
|
4969
|
+
console.log("perpClient migrateStake error:: ", err_18);
|
|
5065
4970
|
return [3, 8];
|
|
5066
4971
|
case 8: return [2, {
|
|
5067
4972
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
@@ -5072,7 +4977,7 @@ var PerpetualsClient = (function () {
|
|
|
5072
4977
|
});
|
|
5073
4978
|
};
|
|
5074
4979
|
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,
|
|
4980
|
+
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
4981
|
return __generator(this, function (_d) {
|
|
5077
4982
|
switch (_d.label) {
|
|
5078
4983
|
case 0:
|
|
@@ -5144,8 +5049,8 @@ var PerpetualsClient = (function () {
|
|
|
5144
5049
|
instructions.push(migrateFlp);
|
|
5145
5050
|
return [3, 4];
|
|
5146
5051
|
case 3:
|
|
5147
|
-
|
|
5148
|
-
console.log("perpClient migrateFlp error:: ",
|
|
5052
|
+
err_19 = _d.sent();
|
|
5053
|
+
console.log("perpClient migrateFlp error:: ", err_19);
|
|
5149
5054
|
return [3, 4];
|
|
5150
5055
|
case 4: return [2, {
|
|
5151
5056
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
@@ -5160,7 +5065,7 @@ var PerpetualsClient = (function () {
|
|
|
5160
5065
|
args_1[_i - 1] = arguments[_i];
|
|
5161
5066
|
}
|
|
5162
5067
|
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,
|
|
5068
|
+
var instructions, additionalSigners, rewardCustody, lpTokenMint, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, compoundingFee, err_20;
|
|
5164
5069
|
if (rewardTokenSymbol === void 0) { rewardTokenSymbol = 'USDC'; }
|
|
5165
5070
|
return __generator(this, function (_e) {
|
|
5166
5071
|
switch (_e.label) {
|
|
@@ -5218,8 +5123,8 @@ var PerpetualsClient = (function () {
|
|
|
5218
5123
|
instructions.push(compoundingFee);
|
|
5219
5124
|
return [3, 4];
|
|
5220
5125
|
case 3:
|
|
5221
|
-
|
|
5222
|
-
console.log("perpClient compoundingFee error:: ",
|
|
5126
|
+
err_20 = _e.sent();
|
|
5127
|
+
console.log("perpClient compoundingFee error:: ", err_20);
|
|
5223
5128
|
return [3, 4];
|
|
5224
5129
|
case 4: return [2, {
|
|
5225
5130
|
instructions: __spreadArray([], instructions, true),
|
|
@@ -5229,146 +5134,8 @@ var PerpetualsClient = (function () {
|
|
|
5229
5134
|
});
|
|
5230
5135
|
});
|
|
5231
5136
|
};
|
|
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
5137
|
this.depositTokenStake = function (owner, feePayer, depositAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5371
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, depositTokenStakeInstruction,
|
|
5138
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, depositTokenStakeInstruction, err_21;
|
|
5372
5139
|
return __generator(this, function (_a) {
|
|
5373
5140
|
switch (_a.label) {
|
|
5374
5141
|
case 0:
|
|
@@ -5410,9 +5177,9 @@ var PerpetualsClient = (function () {
|
|
|
5410
5177
|
instructions.push(depositTokenStakeInstruction);
|
|
5411
5178
|
return [3, 5];
|
|
5412
5179
|
case 4:
|
|
5413
|
-
|
|
5414
|
-
console.log("perpClient depositStakingInstruction error:: ",
|
|
5415
|
-
throw
|
|
5180
|
+
err_21 = _a.sent();
|
|
5181
|
+
console.log("perpClient depositStakingInstruction error:: ", err_21);
|
|
5182
|
+
throw err_21;
|
|
5416
5183
|
case 5: return [2, {
|
|
5417
5184
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5418
5185
|
additionalSigners: additionalSigners
|
|
@@ -5421,7 +5188,7 @@ var PerpetualsClient = (function () {
|
|
|
5421
5188
|
});
|
|
5422
5189
|
}); };
|
|
5423
5190
|
this.unstakeTokenRequest = function (owner, unstakeAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5424
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, unstakeTokenRequestInstruction,
|
|
5191
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, unstakeTokenRequestInstruction, err_22;
|
|
5425
5192
|
return __generator(this, function (_a) {
|
|
5426
5193
|
switch (_a.label) {
|
|
5427
5194
|
case 0:
|
|
@@ -5450,9 +5217,9 @@ var PerpetualsClient = (function () {
|
|
|
5450
5217
|
instructions.push(unstakeTokenRequestInstruction);
|
|
5451
5218
|
return [3, 4];
|
|
5452
5219
|
case 3:
|
|
5453
|
-
|
|
5454
|
-
console.log("perpClient unstakeTokenRequestInstruction error:: ",
|
|
5455
|
-
throw
|
|
5220
|
+
err_22 = _a.sent();
|
|
5221
|
+
console.log("perpClient unstakeTokenRequestInstruction error:: ", err_22);
|
|
5222
|
+
throw err_22;
|
|
5456
5223
|
case 4: return [2, {
|
|
5457
5224
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5458
5225
|
additionalSigners: additionalSigners
|
|
@@ -5461,7 +5228,7 @@ var PerpetualsClient = (function () {
|
|
|
5461
5228
|
});
|
|
5462
5229
|
}); };
|
|
5463
5230
|
this.unstakeTokenInstant = function (owner, unstakeAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5464
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, unstakeTokenInstantInstruction,
|
|
5231
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, unstakeTokenInstantInstruction, err_23;
|
|
5465
5232
|
return __generator(this, function (_a) {
|
|
5466
5233
|
switch (_a.label) {
|
|
5467
5234
|
case 0:
|
|
@@ -5502,9 +5269,9 @@ var PerpetualsClient = (function () {
|
|
|
5502
5269
|
instructions.push(unstakeTokenInstantInstruction);
|
|
5503
5270
|
return [3, 5];
|
|
5504
5271
|
case 4:
|
|
5505
|
-
|
|
5506
|
-
console.log("perpClient unstakeTokenInstantInstruction error:: ",
|
|
5507
|
-
throw
|
|
5272
|
+
err_23 = _a.sent();
|
|
5273
|
+
console.log("perpClient unstakeTokenInstantInstruction error:: ", err_23);
|
|
5274
|
+
throw err_23;
|
|
5508
5275
|
case 5: return [2, {
|
|
5509
5276
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5510
5277
|
additionalSigners: additionalSigners
|
|
@@ -5513,7 +5280,7 @@ var PerpetualsClient = (function () {
|
|
|
5513
5280
|
});
|
|
5514
5281
|
}); };
|
|
5515
5282
|
this.withdrawToken = function (owner, withdrawRequestId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5516
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, withdrawTokenInstruction,
|
|
5283
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, withdrawTokenInstruction, err_24;
|
|
5517
5284
|
return __generator(this, function (_a) {
|
|
5518
5285
|
switch (_a.label) {
|
|
5519
5286
|
case 0:
|
|
@@ -5554,9 +5321,9 @@ var PerpetualsClient = (function () {
|
|
|
5554
5321
|
instructions.push(withdrawTokenInstruction);
|
|
5555
5322
|
return [3, 5];
|
|
5556
5323
|
case 4:
|
|
5557
|
-
|
|
5558
|
-
console.log("perpClient withdrawTokenInstruction error:: ",
|
|
5559
|
-
throw
|
|
5324
|
+
err_24 = _a.sent();
|
|
5325
|
+
console.log("perpClient withdrawTokenInstruction error:: ", err_24);
|
|
5326
|
+
throw err_24;
|
|
5560
5327
|
case 5: return [2, {
|
|
5561
5328
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5562
5329
|
additionalSigners: additionalSigners
|
|
@@ -5565,7 +5332,7 @@ var PerpetualsClient = (function () {
|
|
|
5565
5332
|
});
|
|
5566
5333
|
}); };
|
|
5567
5334
|
this.cancelUnstakeRequest = function (owner, withdrawRequestId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5568
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, cancelUnstakeRequestInstruction,
|
|
5335
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, cancelUnstakeRequestInstruction, err_25;
|
|
5569
5336
|
return __generator(this, function (_a) {
|
|
5570
5337
|
switch (_a.label) {
|
|
5571
5338
|
case 0:
|
|
@@ -5594,9 +5361,9 @@ var PerpetualsClient = (function () {
|
|
|
5594
5361
|
instructions.push(cancelUnstakeRequestInstruction);
|
|
5595
5362
|
return [3, 4];
|
|
5596
5363
|
case 3:
|
|
5597
|
-
|
|
5598
|
-
console.log("perpClient cancelUnstakeRequestInstruction error:: ",
|
|
5599
|
-
throw
|
|
5364
|
+
err_25 = _a.sent();
|
|
5365
|
+
console.log("perpClient cancelUnstakeRequestInstruction error:: ", err_25);
|
|
5366
|
+
throw err_25;
|
|
5600
5367
|
case 4: return [2, {
|
|
5601
5368
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5602
5369
|
additionalSigners: additionalSigners
|
|
@@ -5610,7 +5377,7 @@ var PerpetualsClient = (function () {
|
|
|
5610
5377
|
args_1[_i - 2] = arguments[_i];
|
|
5611
5378
|
}
|
|
5612
5379
|
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,
|
|
5380
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, _a, collectTokenRewardInstruction, err_26;
|
|
5614
5381
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5615
5382
|
return __generator(this, function (_b) {
|
|
5616
5383
|
switch (_b.label) {
|
|
@@ -5656,9 +5423,9 @@ var PerpetualsClient = (function () {
|
|
|
5656
5423
|
instructions.push(collectTokenRewardInstruction);
|
|
5657
5424
|
return [3, 6];
|
|
5658
5425
|
case 5:
|
|
5659
|
-
|
|
5660
|
-
console.log("perpClient collectTokenRewardInstruction error:: ",
|
|
5661
|
-
throw
|
|
5426
|
+
err_26 = _b.sent();
|
|
5427
|
+
console.log("perpClient collectTokenRewardInstruction error:: ", err_26);
|
|
5428
|
+
throw err_26;
|
|
5662
5429
|
case 6: return [2, {
|
|
5663
5430
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5664
5431
|
additionalSigners: additionalSigners
|
|
@@ -5673,7 +5440,7 @@ var PerpetualsClient = (function () {
|
|
|
5673
5440
|
args_1[_i - 3] = arguments[_i];
|
|
5674
5441
|
}
|
|
5675
5442
|
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,
|
|
5443
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, tokenStakeAccount, userTokenAccount, _a, collectRevenueInstruction, err_27;
|
|
5677
5444
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5678
5445
|
return __generator(this, function (_b) {
|
|
5679
5446
|
switch (_b.label) {
|
|
@@ -5720,9 +5487,9 @@ var PerpetualsClient = (function () {
|
|
|
5720
5487
|
instructions.push(collectRevenueInstruction);
|
|
5721
5488
|
return [3, 6];
|
|
5722
5489
|
case 5:
|
|
5723
|
-
|
|
5724
|
-
console.log("perpClient collectRevenueInstruction error:: ",
|
|
5725
|
-
throw
|
|
5490
|
+
err_27 = _b.sent();
|
|
5491
|
+
console.log("perpClient collectRevenueInstruction error:: ", err_27);
|
|
5492
|
+
throw err_27;
|
|
5726
5493
|
case 6: return [2, {
|
|
5727
5494
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5728
5495
|
additionalSigners: additionalSigners
|
|
@@ -5732,7 +5499,7 @@ var PerpetualsClient = (function () {
|
|
|
5732
5499
|
});
|
|
5733
5500
|
};
|
|
5734
5501
|
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,
|
|
5502
|
+
var publicKey, rewardCustodyMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, nftTransferAuthority, initRewardVault, err_28;
|
|
5736
5503
|
return __generator(this, function (_a) {
|
|
5737
5504
|
switch (_a.label) {
|
|
5738
5505
|
case 0:
|
|
@@ -5769,9 +5536,9 @@ var PerpetualsClient = (function () {
|
|
|
5769
5536
|
instructions.push(initRewardVault);
|
|
5770
5537
|
return [3, 4];
|
|
5771
5538
|
case 3:
|
|
5772
|
-
|
|
5773
|
-
console.log("perpClient InitRewardVault error:: ",
|
|
5774
|
-
throw
|
|
5539
|
+
err_28 = _a.sent();
|
|
5540
|
+
console.log("perpClient InitRewardVault error:: ", err_28);
|
|
5541
|
+
throw err_28;
|
|
5775
5542
|
case 4: return [2, {
|
|
5776
5543
|
instructions: __spreadArray([], instructions, true),
|
|
5777
5544
|
additionalSigners: additionalSigners
|
|
@@ -5780,7 +5547,7 @@ var PerpetualsClient = (function () {
|
|
|
5780
5547
|
});
|
|
5781
5548
|
}); };
|
|
5782
5549
|
this.distributeReward = function (rewardAmount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5783
|
-
var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, distributeReward,
|
|
5550
|
+
var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, distributeReward, err_29;
|
|
5784
5551
|
return __generator(this, function (_a) {
|
|
5785
5552
|
switch (_a.label) {
|
|
5786
5553
|
case 0:
|
|
@@ -5811,9 +5578,9 @@ var PerpetualsClient = (function () {
|
|
|
5811
5578
|
instructions.push(distributeReward);
|
|
5812
5579
|
return [3, 4];
|
|
5813
5580
|
case 3:
|
|
5814
|
-
|
|
5815
|
-
console.log("perpClient distributeReward error:: ",
|
|
5816
|
-
throw
|
|
5581
|
+
err_29 = _a.sent();
|
|
5582
|
+
console.log("perpClient distributeReward error:: ", err_29);
|
|
5583
|
+
throw err_29;
|
|
5817
5584
|
case 4: return [2, {
|
|
5818
5585
|
instructions: __spreadArray([], instructions, true),
|
|
5819
5586
|
additionalSigners: additionalSigners
|
|
@@ -5827,7 +5594,7 @@ var PerpetualsClient = (function () {
|
|
|
5827
5594
|
args_1[_i - 3] = arguments[_i];
|
|
5828
5595
|
}
|
|
5829
5596
|
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,
|
|
5597
|
+
var publicKey, rewardToken, rewardCustodyMint, instructions, additionalSigners, nftTokenAccount, metadataAccount, receivingTokenAccount, _a, rewardRecord, rewardVault, rewardTokenAccount, nftTransferAuthority, collectNftReward, err_30;
|
|
5831
5598
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5832
5599
|
return __generator(this, function (_b) {
|
|
5833
5600
|
switch (_b.label) {
|
|
@@ -5879,8 +5646,8 @@ var PerpetualsClient = (function () {
|
|
|
5879
5646
|
instructions.push(collectNftReward);
|
|
5880
5647
|
return [3, 6];
|
|
5881
5648
|
case 5:
|
|
5882
|
-
|
|
5883
|
-
throw
|
|
5649
|
+
err_30 = _b.sent();
|
|
5650
|
+
throw err_30;
|
|
5884
5651
|
case 6: return [2, {
|
|
5885
5652
|
instructions: __spreadArray([], instructions, true),
|
|
5886
5653
|
additionalSigners: additionalSigners
|
|
@@ -5895,7 +5662,7 @@ var PerpetualsClient = (function () {
|
|
|
5895
5662
|
args_1[_i - 2] = arguments[_i];
|
|
5896
5663
|
}
|
|
5897
5664
|
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,
|
|
5665
|
+
var publicKey, rewardToken, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tradingAccount, rewardVault, rewardTokenAccount, withdrawStakeInstruction, err_31;
|
|
5899
5666
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5900
5667
|
return __generator(this, function (_b) {
|
|
5901
5668
|
switch (_b.label) {
|
|
@@ -5961,9 +5728,9 @@ var PerpetualsClient = (function () {
|
|
|
5961
5728
|
instructions.push(withdrawStakeInstruction);
|
|
5962
5729
|
return [3, 6];
|
|
5963
5730
|
case 5:
|
|
5964
|
-
|
|
5965
|
-
console.log("perpClient withdrawStake error:: ",
|
|
5966
|
-
throw
|
|
5731
|
+
err_31 = _b.sent();
|
|
5732
|
+
console.log("perpClient withdrawStake error:: ", err_31);
|
|
5733
|
+
throw err_31;
|
|
5967
5734
|
case 6: return [2, {
|
|
5968
5735
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5969
5736
|
additionalSigners: additionalSigners
|
|
@@ -5978,7 +5745,7 @@ var PerpetualsClient = (function () {
|
|
|
5978
5745
|
args_1[_i - 11] = arguments[_i];
|
|
5979
5746
|
}
|
|
5980
5747
|
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,
|
|
5748
|
+
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
5749
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
|
5983
5750
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
5984
5751
|
return __generator(this, function (_c) {
|
|
@@ -6084,9 +5851,9 @@ var PerpetualsClient = (function () {
|
|
|
6084
5851
|
instructions.push(placeLimitOrder);
|
|
6085
5852
|
return [3, 10];
|
|
6086
5853
|
case 9:
|
|
6087
|
-
|
|
6088
|
-
console.log("perpClient placeLimitOrder error:: ",
|
|
6089
|
-
throw
|
|
5854
|
+
err_32 = _c.sent();
|
|
5855
|
+
console.log("perpClient placeLimitOrder error:: ", err_32);
|
|
5856
|
+
throw err_32;
|
|
6090
5857
|
case 10: return [2, {
|
|
6091
5858
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6092
5859
|
additionalSigners: additionalSigners
|
|
@@ -6101,7 +5868,7 @@ var PerpetualsClient = (function () {
|
|
|
6101
5868
|
args_1[_i - 11] = arguments[_i];
|
|
6102
5869
|
}
|
|
6103
5870
|
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,
|
|
5871
|
+
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, wrappedSolAccount, userReceivingTokenAccount, lamports, _a, positionAccount, orderAccount, editLimitOrder, err_33;
|
|
6105
5872
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6106
5873
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
6107
5874
|
return __generator(this, function (_b) {
|
|
@@ -6192,9 +5959,9 @@ var PerpetualsClient = (function () {
|
|
|
6192
5959
|
instructions.push(editLimitOrder);
|
|
6193
5960
|
return [3, 8];
|
|
6194
5961
|
case 7:
|
|
6195
|
-
|
|
6196
|
-
console.log("perpClient editLimitOrder error:: ",
|
|
6197
|
-
throw
|
|
5962
|
+
err_33 = _b.sent();
|
|
5963
|
+
console.log("perpClient editLimitOrder error:: ", err_33);
|
|
5964
|
+
throw err_33;
|
|
6198
5965
|
case 8: return [2, {
|
|
6199
5966
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6200
5967
|
additionalSigners: additionalSigners
|
|
@@ -6209,7 +5976,7 @@ var PerpetualsClient = (function () {
|
|
|
6209
5976
|
args_1[_i - 7] = arguments[_i];
|
|
6210
5977
|
}
|
|
6211
5978
|
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,
|
|
5979
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder, err_34;
|
|
6213
5980
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
6214
5981
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
|
6215
5982
|
if (rebateTokenAccount === void 0) { rebateTokenAccount = web3_js_1.PublicKey.default; }
|
|
@@ -6262,9 +6029,9 @@ var PerpetualsClient = (function () {
|
|
|
6262
6029
|
instructions.push(executeLimitOrder);
|
|
6263
6030
|
return [3, 4];
|
|
6264
6031
|
case 3:
|
|
6265
|
-
|
|
6266
|
-
console.log("perpClient executeLimitOrder error:: ",
|
|
6267
|
-
throw
|
|
6032
|
+
err_34 = _a.sent();
|
|
6033
|
+
console.log("perpClient executeLimitOrder error:: ", err_34);
|
|
6034
|
+
throw err_34;
|
|
6268
6035
|
case 4: return [2, {
|
|
6269
6036
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6270
6037
|
additionalSigners: additionalSigners
|
|
@@ -6279,7 +6046,7 @@ var PerpetualsClient = (function () {
|
|
|
6279
6046
|
args_1[_i - 8] = arguments[_i];
|
|
6280
6047
|
}
|
|
6281
6048
|
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,
|
|
6049
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitWithSwap, err_35;
|
|
6283
6050
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
6284
6051
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
|
6285
6052
|
if (rebateTokenAccount === void 0) { rebateTokenAccount = web3_js_1.PublicKey.default; }
|
|
@@ -6335,9 +6102,9 @@ var PerpetualsClient = (function () {
|
|
|
6335
6102
|
instructions.push(executeLimitWithSwap);
|
|
6336
6103
|
return [3, 4];
|
|
6337
6104
|
case 3:
|
|
6338
|
-
|
|
6339
|
-
console.log("perpClient executeLimitWithSwap error:: ",
|
|
6340
|
-
throw
|
|
6105
|
+
err_35 = _a.sent();
|
|
6106
|
+
console.log("perpClient executeLimitWithSwap error:: ", err_35);
|
|
6107
|
+
throw err_35;
|
|
6341
6108
|
case 4: return [2, {
|
|
6342
6109
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6343
6110
|
additionalSigners: additionalSigners
|
|
@@ -6347,7 +6114,7 @@ var PerpetualsClient = (function () {
|
|
|
6347
6114
|
});
|
|
6348
6115
|
};
|
|
6349
6116
|
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,
|
|
6117
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder, err_36;
|
|
6351
6118
|
return __generator(this, function (_a) {
|
|
6352
6119
|
switch (_a.label) {
|
|
6353
6120
|
case 0:
|
|
@@ -6395,9 +6162,9 @@ var PerpetualsClient = (function () {
|
|
|
6395
6162
|
instructions.push(placeTriggerOrder);
|
|
6396
6163
|
return [3, 4];
|
|
6397
6164
|
case 3:
|
|
6398
|
-
|
|
6399
|
-
console.log("perpClient placeTriggerOrder error:: ",
|
|
6400
|
-
throw
|
|
6165
|
+
err_36 = _a.sent();
|
|
6166
|
+
console.log("perpClient placeTriggerOrder error:: ", err_36);
|
|
6167
|
+
throw err_36;
|
|
6401
6168
|
case 4: return [2, {
|
|
6402
6169
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6403
6170
|
additionalSigners: additionalSigners
|
|
@@ -6406,7 +6173,7 @@ var PerpetualsClient = (function () {
|
|
|
6406
6173
|
});
|
|
6407
6174
|
}); };
|
|
6408
6175
|
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,
|
|
6176
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder, err_37;
|
|
6410
6177
|
return __generator(this, function (_a) {
|
|
6411
6178
|
switch (_a.label) {
|
|
6412
6179
|
case 0:
|
|
@@ -6453,9 +6220,9 @@ var PerpetualsClient = (function () {
|
|
|
6453
6220
|
instructions.push(editTriggerOrder);
|
|
6454
6221
|
return [3, 4];
|
|
6455
6222
|
case 3:
|
|
6456
|
-
|
|
6457
|
-
console.log("perpClient editTriggerOrder error:: ",
|
|
6458
|
-
throw
|
|
6223
|
+
err_37 = _a.sent();
|
|
6224
|
+
console.log("perpClient editTriggerOrder error:: ", err_37);
|
|
6225
|
+
throw err_37;
|
|
6459
6226
|
case 4: return [2, {
|
|
6460
6227
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6461
6228
|
additionalSigners: additionalSigners
|
|
@@ -6464,7 +6231,7 @@ var PerpetualsClient = (function () {
|
|
|
6464
6231
|
});
|
|
6465
6232
|
}); };
|
|
6466
6233
|
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,
|
|
6234
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder, err_38;
|
|
6468
6235
|
return __generator(this, function (_a) {
|
|
6469
6236
|
switch (_a.label) {
|
|
6470
6237
|
case 0:
|
|
@@ -6497,9 +6264,9 @@ var PerpetualsClient = (function () {
|
|
|
6497
6264
|
instructions.push(cancelTriggerOrder);
|
|
6498
6265
|
return [3, 4];
|
|
6499
6266
|
case 3:
|
|
6500
|
-
|
|
6501
|
-
console.log("perpClient cancelTriggerOrder error:: ",
|
|
6502
|
-
throw
|
|
6267
|
+
err_38 = _a.sent();
|
|
6268
|
+
console.log("perpClient cancelTriggerOrder error:: ", err_38);
|
|
6269
|
+
throw err_38;
|
|
6503
6270
|
case 4: return [2, {
|
|
6504
6271
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6505
6272
|
additionalSigners: additionalSigners
|
|
@@ -6508,7 +6275,7 @@ var PerpetualsClient = (function () {
|
|
|
6508
6275
|
});
|
|
6509
6276
|
}); };
|
|
6510
6277
|
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,
|
|
6278
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, positionAccount, cancelAllTriggerOrders, err_39;
|
|
6512
6279
|
return __generator(this, function (_a) {
|
|
6513
6280
|
switch (_a.label) {
|
|
6514
6281
|
case 0:
|
|
@@ -6539,9 +6306,9 @@ var PerpetualsClient = (function () {
|
|
|
6539
6306
|
instructions.push(cancelAllTriggerOrders);
|
|
6540
6307
|
return [3, 4];
|
|
6541
6308
|
case 3:
|
|
6542
|
-
|
|
6543
|
-
console.log("perpClient cancelAllTriggerOrders error:: ",
|
|
6544
|
-
throw
|
|
6309
|
+
err_39 = _a.sent();
|
|
6310
|
+
console.log("perpClient cancelAllTriggerOrders error:: ", err_39);
|
|
6311
|
+
throw err_39;
|
|
6545
6312
|
case 4: return [2, {
|
|
6546
6313
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6547
6314
|
additionalSigners: additionalSigners
|
|
@@ -6555,7 +6322,7 @@ var PerpetualsClient = (function () {
|
|
|
6555
6322
|
args_1[_i - 9] = arguments[_i];
|
|
6556
6323
|
}
|
|
6557
6324
|
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,
|
|
6325
|
+
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
6326
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6560
6327
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
6561
6328
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
@@ -6662,9 +6429,9 @@ var PerpetualsClient = (function () {
|
|
|
6662
6429
|
instructions.push(executeTriggerWithSwap);
|
|
6663
6430
|
return [3, 10];
|
|
6664
6431
|
case 9:
|
|
6665
|
-
|
|
6666
|
-
console.log("perpClient executeTriggerWithSwap error:: ",
|
|
6667
|
-
throw
|
|
6432
|
+
err_40 = _e.sent();
|
|
6433
|
+
console.log("perpClient executeTriggerWithSwap error:: ", err_40);
|
|
6434
|
+
throw err_40;
|
|
6668
6435
|
case 10: return [2, {
|
|
6669
6436
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6670
6437
|
additionalSigners: additionalSigners
|
|
@@ -6679,7 +6446,7 @@ var PerpetualsClient = (function () {
|
|
|
6679
6446
|
args_1[_i - 8] = arguments[_i];
|
|
6680
6447
|
}
|
|
6681
6448
|
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,
|
|
6449
|
+
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder, err_41;
|
|
6683
6450
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6684
6451
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
6685
6452
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
@@ -6751,9 +6518,9 @@ var PerpetualsClient = (function () {
|
|
|
6751
6518
|
instructions.push(executeTriggerOrder);
|
|
6752
6519
|
return [3, 8];
|
|
6753
6520
|
case 7:
|
|
6754
|
-
|
|
6755
|
-
console.log("perpClient executeTriggerOrder error:: ",
|
|
6756
|
-
throw
|
|
6521
|
+
err_41 = _b.sent();
|
|
6522
|
+
console.log("perpClient executeTriggerOrder error:: ", err_41);
|
|
6523
|
+
throw err_41;
|
|
6757
6524
|
case 8: return [2, {
|
|
6758
6525
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6759
6526
|
additionalSigners: additionalSigners
|
|
@@ -6768,7 +6535,7 @@ var PerpetualsClient = (function () {
|
|
|
6768
6535
|
args_1[_i - 5] = arguments[_i];
|
|
6769
6536
|
}
|
|
6770
6537
|
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,
|
|
6538
|
+
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
6539
|
if (useFeesPool === void 0) { useFeesPool = false; }
|
|
6773
6540
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6774
6541
|
if (unWrapSol === void 0) { unWrapSol = false; }
|
|
@@ -6915,7 +6682,7 @@ var PerpetualsClient = (function () {
|
|
|
6915
6682
|
_g.label = 16;
|
|
6916
6683
|
case 16:
|
|
6917
6684
|
if (_d) {
|
|
6918
|
-
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, userOutputTokenAccount, publicKey, poolConfig.getTokenFromSymbol(userOutputTokenSymbol).mintKey));
|
|
6685
|
+
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
6686
|
}
|
|
6920
6687
|
_g.label = 17;
|
|
6921
6688
|
case 17:
|
|
@@ -6973,9 +6740,9 @@ var PerpetualsClient = (function () {
|
|
|
6973
6740
|
}
|
|
6974
6741
|
return [3, 20];
|
|
6975
6742
|
case 19:
|
|
6976
|
-
|
|
6977
|
-
console.error("perpClient Swap error:: ",
|
|
6978
|
-
throw
|
|
6743
|
+
err_42 = _g.sent();
|
|
6744
|
+
console.error("perpClient Swap error:: ", err_42);
|
|
6745
|
+
throw err_42;
|
|
6979
6746
|
case 20: return [2, {
|
|
6980
6747
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6981
6748
|
additionalSigners: additionalSigners
|
|
@@ -6985,7 +6752,7 @@ var PerpetualsClient = (function () {
|
|
|
6985
6752
|
});
|
|
6986
6753
|
};
|
|
6987
6754
|
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,
|
|
6755
|
+
var rewardCustody, custody, publicKey, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody_1, params, inx, err_43;
|
|
6989
6756
|
return __generator(this, function (_b) {
|
|
6990
6757
|
switch (_b.label) {
|
|
6991
6758
|
case 0:
|
|
@@ -7045,9 +6812,9 @@ var PerpetualsClient = (function () {
|
|
|
7045
6812
|
instructions.push(inx);
|
|
7046
6813
|
return [3, 4];
|
|
7047
6814
|
case 3:
|
|
7048
|
-
|
|
7049
|
-
console.error("perpClient Swap error:: ",
|
|
7050
|
-
throw
|
|
6815
|
+
err_43 = _b.sent();
|
|
6816
|
+
console.error("perpClient Swap error:: ", err_43);
|
|
6817
|
+
throw err_43;
|
|
7051
6818
|
case 4: return [2, {
|
|
7052
6819
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7053
6820
|
additionalSigners: additionalSigners
|
|
@@ -7056,7 +6823,7 @@ var PerpetualsClient = (function () {
|
|
|
7056
6823
|
});
|
|
7057
6824
|
}); };
|
|
7058
6825
|
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,
|
|
6826
|
+
var instructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, setLpTokenPriceInstruction, err_44;
|
|
7060
6827
|
return __generator(this, function (_d) {
|
|
7061
6828
|
switch (_d.label) {
|
|
7062
6829
|
case 0:
|
|
@@ -7104,9 +6871,9 @@ var PerpetualsClient = (function () {
|
|
|
7104
6871
|
instructions.push(setLpTokenPriceInstruction);
|
|
7105
6872
|
return [3, 4];
|
|
7106
6873
|
case 3:
|
|
7107
|
-
|
|
7108
|
-
console.log("perpClient setLpTokenPriceInstruction error:: ",
|
|
7109
|
-
throw
|
|
6874
|
+
err_44 = _d.sent();
|
|
6875
|
+
console.log("perpClient setLpTokenPriceInstruction error:: ", err_44);
|
|
6876
|
+
throw err_44;
|
|
7110
6877
|
case 4: return [2, {
|
|
7111
6878
|
instructions: __spreadArray([], instructions, true),
|
|
7112
6879
|
additionalSigners: additionalSigners
|
|
@@ -7154,7 +6921,7 @@ var PerpetualsClient = (function () {
|
|
|
7154
6921
|
});
|
|
7155
6922
|
}); };
|
|
7156
6923
|
this.setAdminSigners = function (admins, minSignatures) { return __awaiter(_this, void 0, void 0, function () {
|
|
7157
|
-
var adminMetas, _i, admins_2, admin,
|
|
6924
|
+
var adminMetas, _i, admins_2, admin, err_45;
|
|
7158
6925
|
return __generator(this, function (_a) {
|
|
7159
6926
|
switch (_a.label) {
|
|
7160
6927
|
case 0:
|
|
@@ -7184,11 +6951,11 @@ var PerpetualsClient = (function () {
|
|
|
7184
6951
|
_a.sent();
|
|
7185
6952
|
return [3, 4];
|
|
7186
6953
|
case 3:
|
|
7187
|
-
|
|
6954
|
+
err_45 = _a.sent();
|
|
7188
6955
|
if (this.printErrors) {
|
|
7189
|
-
console.error("setAdminSigners err:",
|
|
6956
|
+
console.error("setAdminSigners err:", err_45);
|
|
7190
6957
|
}
|
|
7191
|
-
throw
|
|
6958
|
+
throw err_45;
|
|
7192
6959
|
case 4: return [2];
|
|
7193
6960
|
}
|
|
7194
6961
|
});
|
|
@@ -7377,7 +7144,7 @@ var PerpetualsClient = (function () {
|
|
|
7377
7144
|
});
|
|
7378
7145
|
}); };
|
|
7379
7146
|
this.protocolWithdrawFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7380
|
-
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx,
|
|
7147
|
+
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx, err_46;
|
|
7381
7148
|
return __generator(this, function (_a) {
|
|
7382
7149
|
switch (_a.label) {
|
|
7383
7150
|
case 0:
|
|
@@ -7410,9 +7177,9 @@ var PerpetualsClient = (function () {
|
|
|
7410
7177
|
instructions.push(withdrawFeesIx);
|
|
7411
7178
|
return [3, 5];
|
|
7412
7179
|
case 4:
|
|
7413
|
-
|
|
7414
|
-
console.log("perpClient setPool error:: ",
|
|
7415
|
-
throw
|
|
7180
|
+
err_46 = _a.sent();
|
|
7181
|
+
console.log("perpClient setPool error:: ", err_46);
|
|
7182
|
+
throw err_46;
|
|
7416
7183
|
case 5: return [2, {
|
|
7417
7184
|
instructions: __spreadArray([], instructions, true),
|
|
7418
7185
|
additionalSigners: additionalSigners
|
|
@@ -7421,7 +7188,7 @@ var PerpetualsClient = (function () {
|
|
|
7421
7188
|
});
|
|
7422
7189
|
}); };
|
|
7423
7190
|
this.moveProtocolFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7424
|
-
var publicKey, custodyConfig, instructions, additionalSigners, moveProtocolFeesIx,
|
|
7191
|
+
var publicKey, custodyConfig, instructions, additionalSigners, moveProtocolFeesIx, err_47;
|
|
7425
7192
|
return __generator(this, function (_a) {
|
|
7426
7193
|
switch (_a.label) {
|
|
7427
7194
|
case 0:
|
|
@@ -7455,9 +7222,9 @@ var PerpetualsClient = (function () {
|
|
|
7455
7222
|
instructions.push(moveProtocolFeesIx);
|
|
7456
7223
|
return [3, 4];
|
|
7457
7224
|
case 3:
|
|
7458
|
-
|
|
7459
|
-
console.log("perpClient setPool error:: ",
|
|
7460
|
-
throw
|
|
7225
|
+
err_47 = _a.sent();
|
|
7226
|
+
console.log("perpClient setPool error:: ", err_47);
|
|
7227
|
+
throw err_47;
|
|
7461
7228
|
case 4: return [2, {
|
|
7462
7229
|
instructions: __spreadArray([], instructions, true),
|
|
7463
7230
|
additionalSigners: additionalSigners
|
|
@@ -7466,7 +7233,7 @@ var PerpetualsClient = (function () {
|
|
|
7466
7233
|
});
|
|
7467
7234
|
}); };
|
|
7468
7235
|
this.setProtocolFeeShareBps = function (feeShareBps, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7469
|
-
var publicKey, setProtocolFeeShareBpsIx,
|
|
7236
|
+
var publicKey, setProtocolFeeShareBpsIx, err_48;
|
|
7470
7237
|
return __generator(this, function (_a) {
|
|
7471
7238
|
switch (_a.label) {
|
|
7472
7239
|
case 0:
|
|
@@ -7486,15 +7253,15 @@ var PerpetualsClient = (function () {
|
|
|
7486
7253
|
setProtocolFeeShareBpsIx = _a.sent();
|
|
7487
7254
|
return [2, setProtocolFeeShareBpsIx];
|
|
7488
7255
|
case 2:
|
|
7489
|
-
|
|
7490
|
-
console.log("perpClient setProtocolFeeShareBpsIx error:: ",
|
|
7491
|
-
throw
|
|
7256
|
+
err_48 = _a.sent();
|
|
7257
|
+
console.log("perpClient setProtocolFeeShareBpsIx error:: ", err_48);
|
|
7258
|
+
throw err_48;
|
|
7492
7259
|
case 3: return [2];
|
|
7493
7260
|
}
|
|
7494
7261
|
});
|
|
7495
7262
|
}); };
|
|
7496
7263
|
this.setPermissions = function (permissions) { return __awaiter(_this, void 0, void 0, function () {
|
|
7497
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction,
|
|
7264
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_49;
|
|
7498
7265
|
return __generator(this, function (_a) {
|
|
7499
7266
|
switch (_a.label) {
|
|
7500
7267
|
case 0:
|
|
@@ -7521,9 +7288,9 @@ var PerpetualsClient = (function () {
|
|
|
7521
7288
|
instructions.push(setPermissionsInstruction);
|
|
7522
7289
|
return [3, 4];
|
|
7523
7290
|
case 3:
|
|
7524
|
-
|
|
7525
|
-
console.log("perpClient setPool error:: ",
|
|
7526
|
-
throw
|
|
7291
|
+
err_49 = _a.sent();
|
|
7292
|
+
console.log("perpClient setPool error:: ", err_49);
|
|
7293
|
+
throw err_49;
|
|
7527
7294
|
case 4: return [2, {
|
|
7528
7295
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7529
7296
|
additionalSigners: additionalSigners
|
|
@@ -7532,7 +7299,7 @@ var PerpetualsClient = (function () {
|
|
|
7532
7299
|
});
|
|
7533
7300
|
}); };
|
|
7534
7301
|
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,
|
|
7302
|
+
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e, err_50;
|
|
7536
7303
|
var _f;
|
|
7537
7304
|
return __generator(this, function (_g) {
|
|
7538
7305
|
switch (_g.label) {
|
|
@@ -7593,9 +7360,9 @@ var PerpetualsClient = (function () {
|
|
|
7593
7360
|
instructions.push(reimburse);
|
|
7594
7361
|
return [3, 5];
|
|
7595
7362
|
case 4:
|
|
7596
|
-
|
|
7597
|
-
console.log("perpClient setPool error:: ",
|
|
7598
|
-
throw
|
|
7363
|
+
err_50 = _g.sent();
|
|
7364
|
+
console.log("perpClient setPool error:: ", err_50);
|
|
7365
|
+
throw err_50;
|
|
7599
7366
|
case 5: return [2, {
|
|
7600
7367
|
instructions: __spreadArray([], instructions, true),
|
|
7601
7368
|
additionalSigners: additionalSigners
|
|
@@ -7603,8 +7370,8 @@ var PerpetualsClient = (function () {
|
|
|
7603
7370
|
}
|
|
7604
7371
|
});
|
|
7605
7372
|
}); };
|
|
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,
|
|
7373
|
+
this.setInternalOraclePrice = function (tokenMint, useCurrentTime, price, expo, conf, ema, publishTime, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7374
|
+
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice, err_51;
|
|
7608
7375
|
return __generator(this, function (_a) {
|
|
7609
7376
|
switch (_a.label) {
|
|
7610
7377
|
case 0:
|
|
@@ -7616,6 +7383,7 @@ var PerpetualsClient = (function () {
|
|
|
7616
7383
|
_a.trys.push([1, 3, , 4]);
|
|
7617
7384
|
return [4, this.program.methods
|
|
7618
7385
|
.setInternalOraclePrice({
|
|
7386
|
+
useCurrentTime: useCurrentTime,
|
|
7619
7387
|
price: price,
|
|
7620
7388
|
expo: expo,
|
|
7621
7389
|
conf: conf,
|
|
@@ -7637,9 +7405,9 @@ var PerpetualsClient = (function () {
|
|
|
7637
7405
|
instructions.push(setInternalOraclePrice);
|
|
7638
7406
|
return [3, 4];
|
|
7639
7407
|
case 3:
|
|
7640
|
-
|
|
7641
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
|
7642
|
-
throw
|
|
7408
|
+
err_51 = _a.sent();
|
|
7409
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_51);
|
|
7410
|
+
throw err_51;
|
|
7643
7411
|
case 4: return [2, {
|
|
7644
7412
|
instructions: __spreadArray([], instructions, true),
|
|
7645
7413
|
additionalSigners: additionalSigners
|
|
@@ -7647,8 +7415,8 @@ var PerpetualsClient = (function () {
|
|
|
7647
7415
|
}
|
|
7648
7416
|
});
|
|
7649
7417
|
}); };
|
|
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,
|
|
7418
|
+
this.setInternalOraclePriceBatch = function (useCurrentTime, tokenMintList, tokenInternalPrices, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
|
|
7419
|
+
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_1, _i, tokenMintList_1, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_52;
|
|
7652
7420
|
return __generator(this, function (_a) {
|
|
7653
7421
|
switch (_a.label) {
|
|
7654
7422
|
case 0:
|
|
@@ -7659,11 +7427,6 @@ var PerpetualsClient = (function () {
|
|
|
7659
7427
|
accountMetas = [];
|
|
7660
7428
|
_loop_1 = function (tokenMint) {
|
|
7661
7429
|
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
7430
|
accountMetas.push({
|
|
7668
7431
|
pubkey: custody.intOracleAccount,
|
|
7669
7432
|
isSigner: false,
|
|
@@ -7686,6 +7449,7 @@ var PerpetualsClient = (function () {
|
|
|
7686
7449
|
_a.trys.push([1, 3, , 4]);
|
|
7687
7450
|
return [4, this.program.methods
|
|
7688
7451
|
.setInternalCurrentPrice({
|
|
7452
|
+
useCurrentTime: useCurrentTime,
|
|
7689
7453
|
prices: tokenInternalPrices
|
|
7690
7454
|
})
|
|
7691
7455
|
.accounts({
|
|
@@ -7698,9 +7462,9 @@ var PerpetualsClient = (function () {
|
|
|
7698
7462
|
instructions.push(setInternalOraclePrice);
|
|
7699
7463
|
return [3, 4];
|
|
7700
7464
|
case 3:
|
|
7701
|
-
|
|
7702
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
|
7703
|
-
throw
|
|
7465
|
+
err_52 = _a.sent();
|
|
7466
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_52);
|
|
7467
|
+
throw err_52;
|
|
7704
7468
|
case 4: return [2, {
|
|
7705
7469
|
instructions: __spreadArray([], instructions, true),
|
|
7706
7470
|
additionalSigners: additionalSigners
|
|
@@ -7709,7 +7473,7 @@ var PerpetualsClient = (function () {
|
|
|
7709
7473
|
});
|
|
7710
7474
|
}); };
|
|
7711
7475
|
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,
|
|
7476
|
+
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_2, _i, tokenMintList_2, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_53;
|
|
7713
7477
|
return __generator(this, function (_a) {
|
|
7714
7478
|
switch (_a.label) {
|
|
7715
7479
|
case 0:
|
|
@@ -7720,21 +7484,11 @@ var PerpetualsClient = (function () {
|
|
|
7720
7484
|
accountMetas = [];
|
|
7721
7485
|
_loop_2 = function (tokenMint) {
|
|
7722
7486
|
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
7487
|
accountMetas.push({
|
|
7729
7488
|
pubkey: custody.intOracleAccount,
|
|
7730
7489
|
isSigner: false,
|
|
7731
7490
|
isWritable: true,
|
|
7732
7491
|
});
|
|
7733
|
-
accountMetas.push({
|
|
7734
|
-
pubkey: custody.extOracleAccount,
|
|
7735
|
-
isSigner: false,
|
|
7736
|
-
isWritable: false,
|
|
7737
|
-
});
|
|
7738
7492
|
};
|
|
7739
7493
|
for (_i = 0, tokenMintList_2 = tokenMintList; _i < tokenMintList_2.length; _i++) {
|
|
7740
7494
|
tokenMint = tokenMintList_2[_i];
|
|
@@ -7759,9 +7513,9 @@ var PerpetualsClient = (function () {
|
|
|
7759
7513
|
instructions.push(setInternalOraclePrice);
|
|
7760
7514
|
return [3, 4];
|
|
7761
7515
|
case 3:
|
|
7762
|
-
|
|
7763
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
|
7764
|
-
throw
|
|
7516
|
+
err_53 = _a.sent();
|
|
7517
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_53);
|
|
7518
|
+
throw err_53;
|
|
7765
7519
|
case 4: return [2, {
|
|
7766
7520
|
instructions: __spreadArray([], instructions, true),
|
|
7767
7521
|
additionalSigners: additionalSigners
|
|
@@ -7770,7 +7524,7 @@ var PerpetualsClient = (function () {
|
|
|
7770
7524
|
});
|
|
7771
7525
|
}); };
|
|
7772
7526
|
this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7773
|
-
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp,
|
|
7527
|
+
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_54;
|
|
7774
7528
|
return __generator(this, function (_a) {
|
|
7775
7529
|
switch (_a.label) {
|
|
7776
7530
|
case 0:
|
|
@@ -7808,8 +7562,8 @@ var PerpetualsClient = (function () {
|
|
|
7808
7562
|
instructions.push(renameFlp);
|
|
7809
7563
|
return [3, 4];
|
|
7810
7564
|
case 3:
|
|
7811
|
-
|
|
7812
|
-
console.log("perpClient renameFlp error:: ",
|
|
7565
|
+
err_54 = _a.sent();
|
|
7566
|
+
console.log("perpClient renameFlp error:: ", err_54);
|
|
7813
7567
|
return [3, 4];
|
|
7814
7568
|
case 4: return [2, {
|
|
7815
7569
|
instructions: __spreadArray([], instructions, true),
|
|
@@ -7819,7 +7573,7 @@ var PerpetualsClient = (function () {
|
|
|
7819
7573
|
});
|
|
7820
7574
|
}); };
|
|
7821
7575
|
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,
|
|
7576
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction, err_55;
|
|
7823
7577
|
return __generator(this, function (_a) {
|
|
7824
7578
|
switch (_a.label) {
|
|
7825
7579
|
case 0:
|
|
@@ -7857,9 +7611,9 @@ var PerpetualsClient = (function () {
|
|
|
7857
7611
|
instructions.push(initStakeInstruction);
|
|
7858
7612
|
return [3, 4];
|
|
7859
7613
|
case 3:
|
|
7860
|
-
|
|
7861
|
-
console.log("perpClient InitStaking error:: ",
|
|
7862
|
-
throw
|
|
7614
|
+
err_55 = _a.sent();
|
|
7615
|
+
console.log("perpClient InitStaking error:: ", err_55);
|
|
7616
|
+
throw err_55;
|
|
7863
7617
|
case 4: return [2, {
|
|
7864
7618
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7865
7619
|
additionalSigners: additionalSigners
|
|
@@ -7868,7 +7622,7 @@ var PerpetualsClient = (function () {
|
|
|
7868
7622
|
});
|
|
7869
7623
|
}); };
|
|
7870
7624
|
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,
|
|
7625
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction, err_56;
|
|
7872
7626
|
return __generator(this, function (_a) {
|
|
7873
7627
|
switch (_a.label) {
|
|
7874
7628
|
case 0:
|
|
@@ -7897,7 +7651,6 @@ var PerpetualsClient = (function () {
|
|
|
7897
7651
|
transferAuthority: poolConfig.transferAuthority,
|
|
7898
7652
|
perpetuals: this.perpetuals.publicKey,
|
|
7899
7653
|
pool: poolConfig.poolAddress,
|
|
7900
|
-
custody: rewardCustodyConfig.custodyAccount,
|
|
7901
7654
|
lpTokenMint: poolConfig.stakedLpTokenMint,
|
|
7902
7655
|
compoundingVault: compoundingVault,
|
|
7903
7656
|
compoundingTokenMint: compoundingTokenMint,
|
|
@@ -7913,9 +7666,9 @@ var PerpetualsClient = (function () {
|
|
|
7913
7666
|
instructions.push(initCompoundingInstruction);
|
|
7914
7667
|
return [3, 4];
|
|
7915
7668
|
case 3:
|
|
7916
|
-
|
|
7917
|
-
console.log("perpClient initCompounding error:: ",
|
|
7918
|
-
throw
|
|
7669
|
+
err_56 = _a.sent();
|
|
7670
|
+
console.log("perpClient initCompounding error:: ", err_56);
|
|
7671
|
+
throw err_56;
|
|
7919
7672
|
case 4: return [2, {
|
|
7920
7673
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7921
7674
|
additionalSigners: additionalSigners
|
|
@@ -7924,7 +7677,7 @@ var PerpetualsClient = (function () {
|
|
|
7924
7677
|
});
|
|
7925
7678
|
}); };
|
|
7926
7679
|
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,
|
|
7680
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction, err_57;
|
|
7928
7681
|
return __generator(this, function (_a) {
|
|
7929
7682
|
switch (_a.label) {
|
|
7930
7683
|
case 0:
|
|
@@ -7965,9 +7718,9 @@ var PerpetualsClient = (function () {
|
|
|
7965
7718
|
instructions.push(initTokenVaultInstruction);
|
|
7966
7719
|
return [3, 4];
|
|
7967
7720
|
case 3:
|
|
7968
|
-
|
|
7969
|
-
console.log("perpClient InitTokenVaultInstruction error:: ",
|
|
7970
|
-
throw
|
|
7721
|
+
err_57 = _a.sent();
|
|
7722
|
+
console.log("perpClient InitTokenVaultInstruction error:: ", err_57);
|
|
7723
|
+
throw err_57;
|
|
7971
7724
|
case 4: return [2, {
|
|
7972
7725
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7973
7726
|
additionalSigners: additionalSigners
|
|
@@ -7976,7 +7729,7 @@ var PerpetualsClient = (function () {
|
|
|
7976
7729
|
});
|
|
7977
7730
|
}); };
|
|
7978
7731
|
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,
|
|
7732
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction, err_58;
|
|
7980
7733
|
return __generator(this, function (_a) {
|
|
7981
7734
|
switch (_a.label) {
|
|
7982
7735
|
case 0:
|
|
@@ -8007,9 +7760,9 @@ var PerpetualsClient = (function () {
|
|
|
8007
7760
|
instructions.push(setTokenVaultConfigInstruction);
|
|
8008
7761
|
return [3, 4];
|
|
8009
7762
|
case 3:
|
|
8010
|
-
|
|
8011
|
-
console.log("perpClient setTokenVaultConfigInstruction error:: ",
|
|
8012
|
-
throw
|
|
7763
|
+
err_58 = _a.sent();
|
|
7764
|
+
console.log("perpClient setTokenVaultConfigInstruction error:: ", err_58);
|
|
7765
|
+
throw err_58;
|
|
8013
7766
|
case 4: return [2, {
|
|
8014
7767
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8015
7768
|
additionalSigners: additionalSigners
|
|
@@ -8018,7 +7771,7 @@ var PerpetualsClient = (function () {
|
|
|
8018
7771
|
});
|
|
8019
7772
|
}); };
|
|
8020
7773
|
this.withdrawInstantFee = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8021
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction,
|
|
7774
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction, err_59;
|
|
8022
7775
|
return __generator(this, function (_a) {
|
|
8023
7776
|
switch (_a.label) {
|
|
8024
7777
|
case 0:
|
|
@@ -8057,9 +7810,59 @@ var PerpetualsClient = (function () {
|
|
|
8057
7810
|
instructions.push(withdrawInstantFeeInstruction);
|
|
8058
7811
|
return [3, 6];
|
|
8059
7812
|
case 5:
|
|
8060
|
-
|
|
8061
|
-
console.log("perpClient withdrawInstantFeeInstruction error:: ",
|
|
8062
|
-
throw
|
|
7813
|
+
err_59 = _a.sent();
|
|
7814
|
+
console.log("perpClient withdrawInstantFeeInstruction error:: ", err_59);
|
|
7815
|
+
throw err_59;
|
|
7816
|
+
case 6: return [2, {
|
|
7817
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7818
|
+
additionalSigners: additionalSigners
|
|
7819
|
+
}];
|
|
7820
|
+
}
|
|
7821
|
+
});
|
|
7822
|
+
}); };
|
|
7823
|
+
this.withdrawUnclaimedTokens = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7824
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawUnclaimedTokensInstruction, err_60;
|
|
7825
|
+
return __generator(this, function (_a) {
|
|
7826
|
+
switch (_a.label) {
|
|
7827
|
+
case 0:
|
|
7828
|
+
publicKey = this.provider.wallet.publicKey;
|
|
7829
|
+
preInstructions = [];
|
|
7830
|
+
instructions = [];
|
|
7831
|
+
postInstructions = [];
|
|
7832
|
+
additionalSigners = [];
|
|
7833
|
+
_a.label = 1;
|
|
7834
|
+
case 1:
|
|
7835
|
+
_a.trys.push([1, 5, , 6]);
|
|
7836
|
+
return [4, (0, spl_token_1.getAssociatedTokenAddress)(poolConfig.tokenMint, publicKey, true)];
|
|
7837
|
+
case 2:
|
|
7838
|
+
receivingTokenAccount = _a.sent();
|
|
7839
|
+
return [4, (0, utils_1.checkIfAccountExists)(receivingTokenAccount, this.provider.connection)];
|
|
7840
|
+
case 3:
|
|
7841
|
+
if (!(_a.sent())) {
|
|
7842
|
+
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, receivingTokenAccount, publicKey, poolConfig.tokenMint));
|
|
7843
|
+
}
|
|
7844
|
+
return [4, this.program.methods
|
|
7845
|
+
.withdrawUnclaimedTokens({})
|
|
7846
|
+
.accounts({
|
|
7847
|
+
admin: publicKey,
|
|
7848
|
+
multisig: this.multisig.publicKey,
|
|
7849
|
+
perpetuals: this.perpetuals.publicKey,
|
|
7850
|
+
transferAuthority: poolConfig.transferAuthority,
|
|
7851
|
+
tokenVault: poolConfig.tokenVault,
|
|
7852
|
+
tokenVaultTokenAccount: poolConfig.tokenVaultTokenAccount,
|
|
7853
|
+
receivingTokenAccount: receivingTokenAccount,
|
|
7854
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
7855
|
+
receivingTokenMint: poolConfig.tokenMint,
|
|
7856
|
+
})
|
|
7857
|
+
.instruction()];
|
|
7858
|
+
case 4:
|
|
7859
|
+
withdrawUnclaimedTokensInstruction = _a.sent();
|
|
7860
|
+
instructions.push(withdrawUnclaimedTokensInstruction);
|
|
7861
|
+
return [3, 6];
|
|
7862
|
+
case 5:
|
|
7863
|
+
err_60 = _a.sent();
|
|
7864
|
+
console.log("perpClient withdrawUnclaimedTokensInstruction error:: ", err_60);
|
|
7865
|
+
throw err_60;
|
|
8063
7866
|
case 6: return [2, {
|
|
8064
7867
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8065
7868
|
additionalSigners: additionalSigners
|
|
@@ -8068,7 +7871,7 @@ var PerpetualsClient = (function () {
|
|
|
8068
7871
|
});
|
|
8069
7872
|
}); };
|
|
8070
7873
|
this.initRevenueTokenAccount = function (feeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8071
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction,
|
|
7874
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction, err_61;
|
|
8072
7875
|
return __generator(this, function (_a) {
|
|
8073
7876
|
switch (_a.label) {
|
|
8074
7877
|
case 0:
|
|
@@ -8105,9 +7908,9 @@ var PerpetualsClient = (function () {
|
|
|
8105
7908
|
instructions.push(initRevenueTokenAccountInstruction);
|
|
8106
7909
|
return [3, 4];
|
|
8107
7910
|
case 3:
|
|
8108
|
-
|
|
8109
|
-
console.log("perpClient initRevenueTokenAccountInstruction error:: ",
|
|
8110
|
-
throw
|
|
7911
|
+
err_61 = _a.sent();
|
|
7912
|
+
console.log("perpClient initRevenueTokenAccountInstruction error:: ", err_61);
|
|
7913
|
+
throw err_61;
|
|
8111
7914
|
case 4: return [2, {
|
|
8112
7915
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8113
7916
|
additionalSigners: additionalSigners
|
|
@@ -8116,7 +7919,7 @@ var PerpetualsClient = (function () {
|
|
|
8116
7919
|
});
|
|
8117
7920
|
}); };
|
|
8118
7921
|
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,
|
|
7922
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction, err_62;
|
|
8120
7923
|
return __generator(this, function (_a) {
|
|
8121
7924
|
switch (_a.label) {
|
|
8122
7925
|
case 0:
|
|
@@ -8155,9 +7958,9 @@ var PerpetualsClient = (function () {
|
|
|
8155
7958
|
instructions.push(distributeTokenRewardInstruction);
|
|
8156
7959
|
return [3, 4];
|
|
8157
7960
|
case 3:
|
|
8158
|
-
|
|
8159
|
-
console.log("perpClient distributeTokenRewardInstruction error:: ",
|
|
8160
|
-
throw
|
|
7961
|
+
err_62 = _a.sent();
|
|
7962
|
+
console.log("perpClient distributeTokenRewardInstruction error:: ", err_62);
|
|
7963
|
+
throw err_62;
|
|
8161
7964
|
case 4: return [2, {
|
|
8162
7965
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8163
7966
|
additionalSigners: additionalSigners
|
|
@@ -8166,7 +7969,7 @@ var PerpetualsClient = (function () {
|
|
|
8166
7969
|
});
|
|
8167
7970
|
}); };
|
|
8168
7971
|
this.setTokenStakeLevel = function (owner, stakeLevel) { return __awaiter(_this, void 0, void 0, function () {
|
|
8169
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction,
|
|
7972
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction, err_63;
|
|
8170
7973
|
return __generator(this, function (_a) {
|
|
8171
7974
|
switch (_a.label) {
|
|
8172
7975
|
case 0:
|
|
@@ -8194,9 +7997,9 @@ var PerpetualsClient = (function () {
|
|
|
8194
7997
|
instructions.push(setTokenStakeLevelInstruction);
|
|
8195
7998
|
return [3, 4];
|
|
8196
7999
|
case 3:
|
|
8197
|
-
|
|
8198
|
-
console.log("perpClient setTokenStakeLevelInstruction error:: ",
|
|
8199
|
-
throw
|
|
8000
|
+
err_63 = _a.sent();
|
|
8001
|
+
console.log("perpClient setTokenStakeLevelInstruction error:: ", err_63);
|
|
8002
|
+
throw err_63;
|
|
8200
8003
|
case 4: return [2, {
|
|
8201
8004
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8202
8005
|
additionalSigners: additionalSigners
|
|
@@ -8205,7 +8008,7 @@ var PerpetualsClient = (function () {
|
|
|
8205
8008
|
});
|
|
8206
8009
|
}); };
|
|
8207
8010
|
this.setTokenReward = function (owner, amount, epochCount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8208
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction,
|
|
8011
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction, err_64;
|
|
8209
8012
|
return __generator(this, function (_a) {
|
|
8210
8013
|
switch (_a.label) {
|
|
8211
8014
|
case 0:
|
|
@@ -8237,9 +8040,49 @@ var PerpetualsClient = (function () {
|
|
|
8237
8040
|
instructions.push(setTokenRewardInstruction);
|
|
8238
8041
|
return [3, 4];
|
|
8239
8042
|
case 3:
|
|
8240
|
-
|
|
8241
|
-
console.log("perpClient setTokenRewardInstruction error:: ",
|
|
8242
|
-
throw
|
|
8043
|
+
err_64 = _a.sent();
|
|
8044
|
+
console.log("perpClient setTokenRewardInstruction error:: ", err_64);
|
|
8045
|
+
throw err_64;
|
|
8046
|
+
case 4: return [2, {
|
|
8047
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8048
|
+
additionalSigners: additionalSigners
|
|
8049
|
+
}];
|
|
8050
|
+
}
|
|
8051
|
+
});
|
|
8052
|
+
}); };
|
|
8053
|
+
this.resizeInternalOracle = function (extOracle, tokenMint, intOracleAccount) { return __awaiter(_this, void 0, void 0, function () {
|
|
8054
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction, err_65;
|
|
8055
|
+
return __generator(this, function (_a) {
|
|
8056
|
+
switch (_a.label) {
|
|
8057
|
+
case 0:
|
|
8058
|
+
publicKey = this.provider.wallet.publicKey;
|
|
8059
|
+
preInstructions = [];
|
|
8060
|
+
instructions = [];
|
|
8061
|
+
postInstructions = [];
|
|
8062
|
+
additionalSigners = [];
|
|
8063
|
+
_a.label = 1;
|
|
8064
|
+
case 1:
|
|
8065
|
+
_a.trys.push([1, 3, , 4]);
|
|
8066
|
+
return [4, this.program.methods
|
|
8067
|
+
.resizeInternalOracle({
|
|
8068
|
+
extOracle: extOracle
|
|
8069
|
+
})
|
|
8070
|
+
.accounts({
|
|
8071
|
+
admin: publicKey,
|
|
8072
|
+
multisig: this.multisig.publicKey,
|
|
8073
|
+
custodyTokenMint: tokenMint,
|
|
8074
|
+
intOracleAccount: intOracleAccount,
|
|
8075
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
8076
|
+
})
|
|
8077
|
+
.instruction()];
|
|
8078
|
+
case 2:
|
|
8079
|
+
resizeInternalOracleInstruction = _a.sent();
|
|
8080
|
+
instructions.push(resizeInternalOracleInstruction);
|
|
8081
|
+
return [3, 4];
|
|
8082
|
+
case 3:
|
|
8083
|
+
err_65 = _a.sent();
|
|
8084
|
+
console.log("perpClient resizeInternalOracleInstruction error:: ", err_65);
|
|
8085
|
+
throw err_65;
|
|
8243
8086
|
case 4: return [2, {
|
|
8244
8087
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8245
8088
|
additionalSigners: additionalSigners
|