flash-sdk 10.5.0 → 10.6.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 +4 -18
- package/dist/PerpetualsClient.js +285 -476
- package/dist/PoolAccount.d.ts +0 -1
- package/dist/PoolConfig.json +517 -21
- 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 +69 -432
- package/dist/idl/perpetuals.js +69 -432
- 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.");
|
|
@@ -1887,7 +1887,7 @@ var PerpetualsClient = (function () {
|
|
|
1887
1887
|
});
|
|
1888
1888
|
};
|
|
1889
1889
|
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;
|
|
1890
|
+
var backUpOracleInstructionPromise, custodies, custodyMetas, marketMetas, _i, custodies_1, token, _a, custodies_2, custody, _b, _c, market, transaction, backUpOracleInstruction, setCULimitIx, result, index, res;
|
|
1891
1891
|
var _d;
|
|
1892
1892
|
return __generator(this, function (_e) {
|
|
1893
1893
|
switch (_e.label) {
|
|
@@ -1935,6 +1935,8 @@ var PerpetualsClient = (function () {
|
|
|
1935
1935
|
return [4, backUpOracleInstructionPromise];
|
|
1936
1936
|
case 2:
|
|
1937
1937
|
backUpOracleInstruction = _e.sent();
|
|
1938
|
+
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
1939
|
+
transaction.instructions.unshift(setCULimitIx);
|
|
1938
1940
|
(_d = transaction.instructions).unshift.apply(_d, backUpOracleInstruction);
|
|
1939
1941
|
return [4, this.viewHelper.simulateTransaction(transaction)];
|
|
1940
1942
|
case 3:
|
|
@@ -2001,7 +2003,7 @@ var PerpetualsClient = (function () {
|
|
|
2001
2003
|
args_1[_i - 4] = arguments[_i];
|
|
2002
2004
|
}
|
|
2003
2005
|
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;
|
|
2006
|
+
var custodies, custodyMetas, marketMetas, _a, custodies_5, token, _b, custodies_6, custody, _c, _d, market, depositCustodyConfig, transaction, setCULimitIx, backUpOracleInstruction, result, index, res;
|
|
2005
2007
|
var _e;
|
|
2006
2008
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
2007
2009
|
if (enableBackupOracle === void 0) { enableBackupOracle = false; }
|
|
@@ -2052,6 +2054,8 @@ var PerpetualsClient = (function () {
|
|
|
2052
2054
|
.transaction()];
|
|
2053
2055
|
case 1:
|
|
2054
2056
|
transaction = _f.sent();
|
|
2057
|
+
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2058
|
+
transaction.instructions.unshift(setCULimitIx);
|
|
2055
2059
|
if (!enableBackupOracle) return [3, 3];
|
|
2056
2060
|
return [4, (0, backupOracle_1.createBackupOracleInstruction)(POOL_CONFIG.poolAddress.toBase58(), true)];
|
|
2057
2061
|
case 2:
|
|
@@ -2077,7 +2081,7 @@ var PerpetualsClient = (function () {
|
|
|
2077
2081
|
args_1[_i - 4] = arguments[_i];
|
|
2078
2082
|
}
|
|
2079
2083
|
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;
|
|
2084
|
+
var custodies, custodyMetas, marketMetas, _a, custodies_7, token, _b, custodies_8, custody, _c, _d, market, removeCustodyConfig, transaction, setCULimitIx, backUpOracleInstruction, result, index, res;
|
|
2081
2085
|
var _e;
|
|
2082
2086
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
2083
2087
|
if (enableBackupOracle === void 0) { enableBackupOracle = false; }
|
|
@@ -2128,6 +2132,8 @@ var PerpetualsClient = (function () {
|
|
|
2128
2132
|
.transaction()];
|
|
2129
2133
|
case 1:
|
|
2130
2134
|
transaction = _f.sent();
|
|
2135
|
+
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2136
|
+
transaction.instructions.unshift(setCULimitIx);
|
|
2131
2137
|
if (!enableBackupOracle) return [3, 3];
|
|
2132
2138
|
return [4, (0, backupOracle_1.createBackupOracleInstruction)(POOL_CONFIG.poolAddress.toBase58(), true)];
|
|
2133
2139
|
case 2:
|
|
@@ -2154,7 +2160,7 @@ var PerpetualsClient = (function () {
|
|
|
2154
2160
|
});
|
|
2155
2161
|
};
|
|
2156
2162
|
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;
|
|
2163
|
+
var backUpOracleInstructionPromise, custodies, custodyMetas, marketMetas, _i, custodies_9, token, _a, custodies_10, custody, _b, _c, market, backUpOracleInstruction, transaction, setCULimitIx, result, index, res;
|
|
2158
2164
|
var _d;
|
|
2159
2165
|
return __generator(this, function (_e) {
|
|
2160
2166
|
switch (_e.label) {
|
|
@@ -2202,6 +2208,8 @@ var PerpetualsClient = (function () {
|
|
|
2202
2208
|
.transaction()];
|
|
2203
2209
|
case 2:
|
|
2204
2210
|
transaction = _e.sent();
|
|
2211
|
+
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2212
|
+
transaction.instructions.unshift(setCULimitIx);
|
|
2205
2213
|
(_d = transaction.instructions).unshift.apply(_d, backUpOracleInstruction);
|
|
2206
2214
|
return [4, this.viewHelper.simulateTransaction(transaction)];
|
|
2207
2215
|
case 3:
|
|
@@ -4088,119 +4096,8 @@ var PerpetualsClient = (function () {
|
|
|
4088
4096
|
}
|
|
4089
4097
|
});
|
|
4090
4098
|
}); };
|
|
4091
|
-
this.updateNftAccount = function (nftMint, updateReferer, updateBooster, flpStakeAccounts) { return __awaiter(_this, void 0, void 0, function () {
|
|
4092
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, nftTradingAccount, nftReferralAccount, nftTokenAccount, flpStakeAccountMetas, _i, flpStakeAccounts_1, flpStakeAccountPk, updateNftTradingAccountInstruction, err_8;
|
|
4093
|
-
return __generator(this, function (_a) {
|
|
4094
|
-
switch (_a.label) {
|
|
4095
|
-
case 0:
|
|
4096
|
-
publicKey = this.provider.wallet.publicKey;
|
|
4097
|
-
preInstructions = [];
|
|
4098
|
-
instructions = [];
|
|
4099
|
-
postInstructions = [];
|
|
4100
|
-
additionalSigners = [];
|
|
4101
|
-
_a.label = 1;
|
|
4102
|
-
case 1:
|
|
4103
|
-
_a.trys.push([1, 4, , 5]);
|
|
4104
|
-
nftTradingAccount = web3_js_1.PublicKey.findProgramAddressSync([
|
|
4105
|
-
Buffer.from("trading"),
|
|
4106
|
-
nftMint.toBuffer(),
|
|
4107
|
-
], this.programId)[0];
|
|
4108
|
-
nftReferralAccount = web3_js_1.PublicKey.findProgramAddressSync([
|
|
4109
|
-
Buffer.from("referral"),
|
|
4110
|
-
publicKey.toBuffer(),
|
|
4111
|
-
], this.programId)[0];
|
|
4112
|
-
return [4, (0, spl_token_1.getAssociatedTokenAddress)(nftMint, publicKey, true)];
|
|
4113
|
-
case 2:
|
|
4114
|
-
nftTokenAccount = _a.sent();
|
|
4115
|
-
flpStakeAccountMetas = [];
|
|
4116
|
-
for (_i = 0, flpStakeAccounts_1 = flpStakeAccounts; _i < flpStakeAccounts_1.length; _i++) {
|
|
4117
|
-
flpStakeAccountPk = flpStakeAccounts_1[_i];
|
|
4118
|
-
flpStakeAccountMetas.push({
|
|
4119
|
-
pubkey: flpStakeAccountPk,
|
|
4120
|
-
isSigner: false,
|
|
4121
|
-
isWritable: true,
|
|
4122
|
-
});
|
|
4123
|
-
}
|
|
4124
|
-
return [4, this.program.methods
|
|
4125
|
-
.updateTradingAccount({
|
|
4126
|
-
updateReferer: updateReferer,
|
|
4127
|
-
updateBooster: updateBooster
|
|
4128
|
-
})
|
|
4129
|
-
.accounts({
|
|
4130
|
-
owner: publicKey,
|
|
4131
|
-
feePayer: publicKey,
|
|
4132
|
-
nftTokenAccount: nftTokenAccount,
|
|
4133
|
-
referralAccount: nftReferralAccount,
|
|
4134
|
-
tradingAccount: nftTradingAccount
|
|
4135
|
-
})
|
|
4136
|
-
.instruction()];
|
|
4137
|
-
case 3:
|
|
4138
|
-
updateNftTradingAccountInstruction = _a.sent();
|
|
4139
|
-
instructions.push(updateNftTradingAccountInstruction);
|
|
4140
|
-
return [3, 5];
|
|
4141
|
-
case 4:
|
|
4142
|
-
err_8 = _a.sent();
|
|
4143
|
-
console.log("perpClient updateNftAccount error:: ", err_8);
|
|
4144
|
-
throw err_8;
|
|
4145
|
-
case 5: return [2, {
|
|
4146
|
-
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4147
|
-
additionalSigners: additionalSigners
|
|
4148
|
-
}];
|
|
4149
|
-
}
|
|
4150
|
-
});
|
|
4151
|
-
}); };
|
|
4152
|
-
this.levelUp = function (poolConfig, nftMint, authorizationRulesAccount) { return __awaiter(_this, void 0, void 0, function () {
|
|
4153
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, nftTradingAccount, metadataAccount, levelUpInstruction, err_9;
|
|
4154
|
-
return __generator(this, function (_a) {
|
|
4155
|
-
switch (_a.label) {
|
|
4156
|
-
case 0:
|
|
4157
|
-
publicKey = this.provider.wallet.publicKey;
|
|
4158
|
-
preInstructions = [];
|
|
4159
|
-
instructions = [];
|
|
4160
|
-
postInstructions = [];
|
|
4161
|
-
additionalSigners = [];
|
|
4162
|
-
_a.label = 1;
|
|
4163
|
-
case 1:
|
|
4164
|
-
_a.trys.push([1, 3, , 4]);
|
|
4165
|
-
nftTradingAccount = web3_js_1.PublicKey.findProgramAddressSync([
|
|
4166
|
-
Buffer.from("trading"),
|
|
4167
|
-
nftMint.toBuffer(),
|
|
4168
|
-
], this.programId)[0];
|
|
4169
|
-
metadataAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), nftMint.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
|
|
4170
|
-
return [4, this.program.methods
|
|
4171
|
-
.levelUp({})
|
|
4172
|
-
.accounts({
|
|
4173
|
-
owner: publicKey,
|
|
4174
|
-
perpetuals: this.perpetuals.publicKey,
|
|
4175
|
-
pool: poolConfig.poolAddress,
|
|
4176
|
-
metadataAccount: metadataAccount,
|
|
4177
|
-
nftMint: nftMint,
|
|
4178
|
-
metadataProgram: constants_1.METAPLEX_PROGRAM_ID,
|
|
4179
|
-
tradingAccount: nftTradingAccount,
|
|
4180
|
-
transferAuthority: this.authority.publicKey,
|
|
4181
|
-
authorizationRulesAccount: authorizationRulesAccount,
|
|
4182
|
-
authorizationRulesProgram: new web3_js_1.PublicKey('auth9SigNpDKz4sJJ1DfCTuZrZNSAgh9sFD3rboVmgg'),
|
|
4183
|
-
systemProgram: web3_js_1.SystemProgram.programId,
|
|
4184
|
-
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
|
|
4185
|
-
})
|
|
4186
|
-
.instruction()];
|
|
4187
|
-
case 2:
|
|
4188
|
-
levelUpInstruction = _a.sent();
|
|
4189
|
-
instructions.push(levelUpInstruction);
|
|
4190
|
-
return [3, 4];
|
|
4191
|
-
case 3:
|
|
4192
|
-
err_9 = _a.sent();
|
|
4193
|
-
console.log("perpClient levelUp error:: ", err_9);
|
|
4194
|
-
throw err_9;
|
|
4195
|
-
case 4: return [2, {
|
|
4196
|
-
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4197
|
-
additionalSigners: additionalSigners
|
|
4198
|
-
}];
|
|
4199
|
-
}
|
|
4200
|
-
});
|
|
4201
|
-
}); };
|
|
4202
4099
|
this.depositStake = function (owner, feePayer, depositAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
4203
|
-
var preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, depositStakeInstruction,
|
|
4100
|
+
var preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, depositStakeInstruction, err_8;
|
|
4204
4101
|
return __generator(this, function (_a) {
|
|
4205
4102
|
switch (_a.label) {
|
|
4206
4103
|
case 0:
|
|
@@ -4242,9 +4139,9 @@ var PerpetualsClient = (function () {
|
|
|
4242
4139
|
instructions.push(depositStakeInstruction);
|
|
4243
4140
|
return [3, 5];
|
|
4244
4141
|
case 4:
|
|
4245
|
-
|
|
4246
|
-
console.log("perpClient depositStaking error:: ",
|
|
4247
|
-
throw
|
|
4142
|
+
err_8 = _a.sent();
|
|
4143
|
+
console.log("perpClient depositStaking error:: ", err_8);
|
|
4144
|
+
throw err_8;
|
|
4248
4145
|
case 5: return [2, {
|
|
4249
4146
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4250
4147
|
additionalSigners: additionalSigners
|
|
@@ -4253,7 +4150,7 @@ var PerpetualsClient = (function () {
|
|
|
4253
4150
|
});
|
|
4254
4151
|
}); };
|
|
4255
4152
|
this.refreshStakeWithAllFlpStakeAccounts = function (rewardSymbol, poolConfig, flpStakeAccountPks) { return __awaiter(_this, void 0, void 0, function () {
|
|
4256
|
-
var rewardCustodyMint, rewardCustodyConfig, pool, feeDistributionTokenAccount, custodyAccountMetas, _i, _a, custody, maxFlpStakeAccountPkLength, flpStakeAccountMetas, _b, flpStakeAccountPks_1, flpStakeAccountPk, refreshStakeInstruction,
|
|
4153
|
+
var rewardCustodyMint, rewardCustodyConfig, pool, feeDistributionTokenAccount, custodyAccountMetas, _i, _a, custody, maxFlpStakeAccountPkLength, flpStakeAccountMetas, _b, flpStakeAccountPks_1, flpStakeAccountPk, refreshStakeInstruction, err_9;
|
|
4257
4154
|
return __generator(this, function (_c) {
|
|
4258
4155
|
switch (_c.label) {
|
|
4259
4156
|
case 0:
|
|
@@ -4300,9 +4197,9 @@ var PerpetualsClient = (function () {
|
|
|
4300
4197
|
refreshStakeInstruction = _c.sent();
|
|
4301
4198
|
return [2, refreshStakeInstruction];
|
|
4302
4199
|
case 2:
|
|
4303
|
-
|
|
4304
|
-
console.log("perpClient refreshStaking error:: ",
|
|
4305
|
-
throw
|
|
4200
|
+
err_9 = _c.sent();
|
|
4201
|
+
console.log("perpClient refreshStaking error:: ", err_9);
|
|
4202
|
+
throw err_9;
|
|
4306
4203
|
case 3: return [2];
|
|
4307
4204
|
}
|
|
4308
4205
|
});
|
|
@@ -4313,7 +4210,7 @@ var PerpetualsClient = (function () {
|
|
|
4313
4210
|
args_1[_i - 3] = arguments[_i];
|
|
4314
4211
|
}
|
|
4315
4212
|
return __awaiter(_this, __spreadArray([rewardSymbol_1, poolConfig_1, flpStakeAccountPk_1], args_1, true), void 0, function (rewardSymbol, poolConfig, flpStakeAccountPk, userPublicKey) {
|
|
4316
|
-
var publicKey, rewardCustodyMint, rewardCustodyConfig, pool, feeDistributionTokenAccount, custodyAccountMetas, _a, _b, custody, stakeAccountMetas, tokenStakeAccount, refreshStakeInstruction,
|
|
4213
|
+
var publicKey, rewardCustodyMint, rewardCustodyConfig, pool, feeDistributionTokenAccount, custodyAccountMetas, _a, _b, custody, stakeAccountMetas, tokenStakeAccount, refreshStakeInstruction, err_10;
|
|
4317
4214
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
4318
4215
|
return __generator(this, function (_c) {
|
|
4319
4216
|
switch (_c.label) {
|
|
@@ -4361,9 +4258,9 @@ var PerpetualsClient = (function () {
|
|
|
4361
4258
|
refreshStakeInstruction = _c.sent();
|
|
4362
4259
|
return [2, refreshStakeInstruction];
|
|
4363
4260
|
case 2:
|
|
4364
|
-
|
|
4365
|
-
console.log("perpClient refreshStaking error:: ",
|
|
4366
|
-
throw
|
|
4261
|
+
err_10 = _c.sent();
|
|
4262
|
+
console.log("perpClient refreshStaking error:: ", err_10);
|
|
4263
|
+
throw err_10;
|
|
4367
4264
|
case 3: return [2];
|
|
4368
4265
|
}
|
|
4369
4266
|
});
|
|
@@ -4375,7 +4272,7 @@ var PerpetualsClient = (function () {
|
|
|
4375
4272
|
args_1[_i - 3] = arguments[_i];
|
|
4376
4273
|
}
|
|
4377
4274
|
return __awaiter(_this, __spreadArray([rewardSymbol_1, unstakeAmount_1, poolConfig_1], args_1, true), void 0, function (rewardSymbol, unstakeAmount, poolConfig, userPublicKey) {
|
|
4378
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, pool, flpStakeAccount, tokenStakeAccount, tokenStakeAccounts, _a, unstakeInstantInstruction,
|
|
4275
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, pool, flpStakeAccount, tokenStakeAccount, tokenStakeAccounts, _a, unstakeInstantInstruction, err_11;
|
|
4379
4276
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
4380
4277
|
return __generator(this, function (_b) {
|
|
4381
4278
|
switch (_b.label) {
|
|
@@ -4427,9 +4324,9 @@ var PerpetualsClient = (function () {
|
|
|
4427
4324
|
instructions.push(unstakeInstantInstruction);
|
|
4428
4325
|
return [3, 6];
|
|
4429
4326
|
case 5:
|
|
4430
|
-
|
|
4431
|
-
console.log("perpClient unstakeInstant error:: ",
|
|
4432
|
-
throw
|
|
4327
|
+
err_11 = _b.sent();
|
|
4328
|
+
console.log("perpClient unstakeInstant error:: ", err_11);
|
|
4329
|
+
throw err_11;
|
|
4433
4330
|
case 6: return [2, {
|
|
4434
4331
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4435
4332
|
additionalSigners: additionalSigners
|
|
@@ -4439,7 +4336,7 @@ var PerpetualsClient = (function () {
|
|
|
4439
4336
|
});
|
|
4440
4337
|
};
|
|
4441
4338
|
this.setFeeShareBps = function (poolConfig, flpStakeAccountPks) { return __awaiter(_this, void 0, void 0, function () {
|
|
4442
|
-
var publicKey, pool, custodyAccountMetas, _i, _a, custody, maxFlpStakeAccountPkLength, flpStakeAccountMetas, _b, flpStakeAccountPks_2, flpStakeAccountPk, refreshStakeInstruction,
|
|
4339
|
+
var publicKey, pool, custodyAccountMetas, _i, _a, custody, maxFlpStakeAccountPkLength, flpStakeAccountMetas, _b, flpStakeAccountPks_2, flpStakeAccountPk, refreshStakeInstruction, err_12;
|
|
4443
4340
|
return __generator(this, function (_c) {
|
|
4444
4341
|
switch (_c.label) {
|
|
4445
4342
|
case 0:
|
|
@@ -4483,15 +4380,15 @@ var PerpetualsClient = (function () {
|
|
|
4483
4380
|
refreshStakeInstruction = _c.sent();
|
|
4484
4381
|
return [2, refreshStakeInstruction];
|
|
4485
4382
|
case 2:
|
|
4486
|
-
|
|
4487
|
-
console.log("perpClient refreshStaking error:: ",
|
|
4488
|
-
throw
|
|
4383
|
+
err_12 = _c.sent();
|
|
4384
|
+
console.log("perpClient refreshStaking error:: ", err_12);
|
|
4385
|
+
throw err_12;
|
|
4489
4386
|
case 3: return [2];
|
|
4490
4387
|
}
|
|
4491
4388
|
});
|
|
4492
4389
|
}); };
|
|
4493
4390
|
this.unstakeRequest = function (unstakeAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
4494
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, unstakeRequestInstruction,
|
|
4391
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, unstakeRequestInstruction, err_13;
|
|
4495
4392
|
return __generator(this, function (_a) {
|
|
4496
4393
|
switch (_a.label) {
|
|
4497
4394
|
case 0:
|
|
@@ -4525,9 +4422,9 @@ var PerpetualsClient = (function () {
|
|
|
4525
4422
|
instructions.push(unstakeRequestInstruction);
|
|
4526
4423
|
return [3, 4];
|
|
4527
4424
|
case 3:
|
|
4528
|
-
|
|
4529
|
-
console.log("perpClient unstakeRequest error:: ",
|
|
4530
|
-
throw
|
|
4425
|
+
err_13 = _a.sent();
|
|
4426
|
+
console.log("perpClient unstakeRequest error:: ", err_13);
|
|
4427
|
+
throw err_13;
|
|
4531
4428
|
case 4: return [2, {
|
|
4532
4429
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4533
4430
|
additionalSigners: additionalSigners
|
|
@@ -4541,7 +4438,7 @@ var PerpetualsClient = (function () {
|
|
|
4541
4438
|
args_1[_i - 1] = arguments[_i];
|
|
4542
4439
|
}
|
|
4543
4440
|
return __awaiter(_this, __spreadArray([poolConfig_1], args_1, true), void 0, function (poolConfig, pendingActivation, deactivated, createUserLPTA, userPublicKey) {
|
|
4544
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, pool, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, _a, withdrawStakeInstruction,
|
|
4441
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, pool, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, _a, withdrawStakeInstruction, err_14;
|
|
4545
4442
|
if (pendingActivation === void 0) { pendingActivation = true; }
|
|
4546
4443
|
if (deactivated === void 0) { deactivated = true; }
|
|
4547
4444
|
if (createUserLPTA === void 0) { createUserLPTA = true; }
|
|
@@ -4597,9 +4494,9 @@ var PerpetualsClient = (function () {
|
|
|
4597
4494
|
instructions.push(withdrawStakeInstruction);
|
|
4598
4495
|
return [3, 6];
|
|
4599
4496
|
case 5:
|
|
4600
|
-
|
|
4601
|
-
console.log("perpClient withdrawStake error:: ",
|
|
4602
|
-
throw
|
|
4497
|
+
err_14 = _b.sent();
|
|
4498
|
+
console.log("perpClient withdrawStake error:: ", err_14);
|
|
4499
|
+
throw err_14;
|
|
4603
4500
|
case 6: return [2, {
|
|
4604
4501
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4605
4502
|
additionalSigners: additionalSigners
|
|
@@ -4614,7 +4511,7 @@ var PerpetualsClient = (function () {
|
|
|
4614
4511
|
args_1[_i - 3] = arguments[_i];
|
|
4615
4512
|
}
|
|
4616
4513
|
return __awaiter(_this, __spreadArray([rewardSymbol_1, poolConfig_1, tokenStakeAccount_1], args_1, true), void 0, function (rewardSymbol, poolConfig, tokenStakeAccount, createUserATA) {
|
|
4617
|
-
var publicKey, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tokenStakeAccounts, withdrawStakeInstruction,
|
|
4514
|
+
var publicKey, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tokenStakeAccounts, withdrawStakeInstruction, err_15;
|
|
4618
4515
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
4619
4516
|
return __generator(this, function (_b) {
|
|
4620
4517
|
switch (_b.label) {
|
|
@@ -4675,9 +4572,9 @@ var PerpetualsClient = (function () {
|
|
|
4675
4572
|
instructions.push(withdrawStakeInstruction);
|
|
4676
4573
|
return [3, 6];
|
|
4677
4574
|
case 5:
|
|
4678
|
-
|
|
4679
|
-
console.log("perpClient withdrawStake error:: ",
|
|
4680
|
-
throw
|
|
4575
|
+
err_15 = _b.sent();
|
|
4576
|
+
console.log("perpClient withdrawStake error:: ", err_15);
|
|
4577
|
+
throw err_15;
|
|
4681
4578
|
case 6: return [2, {
|
|
4682
4579
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4683
4580
|
additionalSigners: additionalSigners
|
|
@@ -4692,7 +4589,7 @@ var PerpetualsClient = (function () {
|
|
|
4692
4589
|
args_1[_i - 5] = arguments[_i];
|
|
4693
4590
|
}
|
|
4694
4591
|
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) {
|
|
4695
|
-
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,
|
|
4592
|
+
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;
|
|
4696
4593
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
|
4697
4594
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
4698
4595
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
@@ -4820,8 +4717,8 @@ var PerpetualsClient = (function () {
|
|
|
4820
4717
|
instructions.push(addCompoundingLiquidity);
|
|
4821
4718
|
return [3, 10];
|
|
4822
4719
|
case 9:
|
|
4823
|
-
|
|
4824
|
-
console.log("perpClient addCompoundingLiquidity error:: ",
|
|
4720
|
+
err_16 = _f.sent();
|
|
4721
|
+
console.log("perpClient addCompoundingLiquidity error:: ", err_16);
|
|
4825
4722
|
return [3, 10];
|
|
4826
4723
|
case 10: return [2, {
|
|
4827
4724
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
@@ -4837,7 +4734,7 @@ var PerpetualsClient = (function () {
|
|
|
4837
4734
|
args_1[_i - 5] = arguments[_i];
|
|
4838
4735
|
}
|
|
4839
4736
|
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) {
|
|
4840
|
-
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,
|
|
4737
|
+
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;
|
|
4841
4738
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
4842
4739
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
4843
4740
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
@@ -4949,8 +4846,8 @@ var PerpetualsClient = (function () {
|
|
|
4949
4846
|
instructions.push(removeCompoundingLiquidity);
|
|
4950
4847
|
return [3, 8];
|
|
4951
4848
|
case 7:
|
|
4952
|
-
|
|
4953
|
-
console.log("perpClient removeCompoundingLiquidity error:: ",
|
|
4849
|
+
err_17 = _f.sent();
|
|
4850
|
+
console.log("perpClient removeCompoundingLiquidity error:: ", err_17);
|
|
4954
4851
|
return [3, 8];
|
|
4955
4852
|
case 8: return [2, {
|
|
4956
4853
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
@@ -4966,7 +4863,7 @@ var PerpetualsClient = (function () {
|
|
|
4966
4863
|
args_1[_i - 3] = arguments[_i];
|
|
4967
4864
|
}
|
|
4968
4865
|
return __awaiter(_this, __spreadArray([amount_1, rewardTokenMint_1, poolConfig_1], args_1, true), void 0, function (amount, rewardTokenMint, poolConfig, createUserATA) {
|
|
4969
|
-
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,
|
|
4866
|
+
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;
|
|
4970
4867
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
4971
4868
|
return __generator(this, function (_g) {
|
|
4972
4869
|
switch (_g.label) {
|
|
@@ -5064,8 +4961,8 @@ var PerpetualsClient = (function () {
|
|
|
5064
4961
|
instructions.push(migrateStake);
|
|
5065
4962
|
return [3, 8];
|
|
5066
4963
|
case 7:
|
|
5067
|
-
|
|
5068
|
-
console.log("perpClient migrateStake error:: ",
|
|
4964
|
+
err_18 = _g.sent();
|
|
4965
|
+
console.log("perpClient migrateStake error:: ", err_18);
|
|
5069
4966
|
return [3, 8];
|
|
5070
4967
|
case 8: return [2, {
|
|
5071
4968
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
@@ -5076,7 +4973,7 @@ var PerpetualsClient = (function () {
|
|
|
5076
4973
|
});
|
|
5077
4974
|
};
|
|
5078
4975
|
this.migrateFlp = function (amount, rewardTokenMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5079
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, migrateFlp,
|
|
4976
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, migrateFlp, err_19;
|
|
5080
4977
|
return __generator(this, function (_d) {
|
|
5081
4978
|
switch (_d.label) {
|
|
5082
4979
|
case 0:
|
|
@@ -5148,8 +5045,8 @@ var PerpetualsClient = (function () {
|
|
|
5148
5045
|
instructions.push(migrateFlp);
|
|
5149
5046
|
return [3, 4];
|
|
5150
5047
|
case 3:
|
|
5151
|
-
|
|
5152
|
-
console.log("perpClient migrateFlp error:: ",
|
|
5048
|
+
err_19 = _d.sent();
|
|
5049
|
+
console.log("perpClient migrateFlp error:: ", err_19);
|
|
5153
5050
|
return [3, 4];
|
|
5154
5051
|
case 4: return [2, {
|
|
5155
5052
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
@@ -5164,7 +5061,7 @@ var PerpetualsClient = (function () {
|
|
|
5164
5061
|
args_1[_i - 1] = arguments[_i];
|
|
5165
5062
|
}
|
|
5166
5063
|
return __awaiter(_this, __spreadArray([poolConfig_1], args_1, true), void 0, function (poolConfig, rewardTokenSymbol) {
|
|
5167
|
-
var instructions, additionalSigners, rewardCustody, lpTokenMint, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, compoundingFee,
|
|
5064
|
+
var instructions, additionalSigners, rewardCustody, lpTokenMint, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, compoundingFee, err_20;
|
|
5168
5065
|
if (rewardTokenSymbol === void 0) { rewardTokenSymbol = 'USDC'; }
|
|
5169
5066
|
return __generator(this, function (_e) {
|
|
5170
5067
|
switch (_e.label) {
|
|
@@ -5222,8 +5119,8 @@ var PerpetualsClient = (function () {
|
|
|
5222
5119
|
instructions.push(compoundingFee);
|
|
5223
5120
|
return [3, 4];
|
|
5224
5121
|
case 3:
|
|
5225
|
-
|
|
5226
|
-
console.log("perpClient compoundingFee error:: ",
|
|
5122
|
+
err_20 = _e.sent();
|
|
5123
|
+
console.log("perpClient compoundingFee error:: ", err_20);
|
|
5227
5124
|
return [3, 4];
|
|
5228
5125
|
case 4: return [2, {
|
|
5229
5126
|
instructions: __spreadArray([], instructions, true),
|
|
@@ -5233,146 +5130,8 @@ var PerpetualsClient = (function () {
|
|
|
5233
5130
|
});
|
|
5234
5131
|
});
|
|
5235
5132
|
};
|
|
5236
|
-
this.burnAndClaim = function (owner, nftMint, poolConfig, createAta) { return __awaiter(_this, void 0, void 0, function () {
|
|
5237
|
-
var preInstructions, instructions, postInstructions, additionalSigners, userTokenAccount, _a, nftTokenAccount, nftTradingAccount, metadataAccount, collectionMetadata, edition, tokenRecord, burnAndClaimInstruction, err_23;
|
|
5238
|
-
return __generator(this, function (_b) {
|
|
5239
|
-
switch (_b.label) {
|
|
5240
|
-
case 0:
|
|
5241
|
-
preInstructions = [];
|
|
5242
|
-
instructions = [];
|
|
5243
|
-
postInstructions = [];
|
|
5244
|
-
additionalSigners = [];
|
|
5245
|
-
_b.label = 1;
|
|
5246
|
-
case 1:
|
|
5247
|
-
_b.trys.push([1, 7, , 8]);
|
|
5248
|
-
return [4, (0, spl_token_1.getAssociatedTokenAddress)(poolConfig.tokenMint, owner, true)];
|
|
5249
|
-
case 2:
|
|
5250
|
-
userTokenAccount = _b.sent();
|
|
5251
|
-
_a = createAta;
|
|
5252
|
-
if (!_a) return [3, 4];
|
|
5253
|
-
return [4, (0, utils_1.checkIfAccountExists)(userTokenAccount, this.provider.connection)];
|
|
5254
|
-
case 3:
|
|
5255
|
-
_a = !(_b.sent());
|
|
5256
|
-
_b.label = 4;
|
|
5257
|
-
case 4:
|
|
5258
|
-
if (_a) {
|
|
5259
|
-
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(owner, userTokenAccount, owner, poolConfig.tokenMint));
|
|
5260
|
-
}
|
|
5261
|
-
return [4, (0, spl_token_1.getAssociatedTokenAddress)(nftMint, owner, true)];
|
|
5262
|
-
case 5:
|
|
5263
|
-
nftTokenAccount = _b.sent();
|
|
5264
|
-
nftTradingAccount = web3_js_1.PublicKey.findProgramAddressSync([
|
|
5265
|
-
Buffer.from("trading"),
|
|
5266
|
-
nftMint.toBuffer(),
|
|
5267
|
-
], this.programId)[0];
|
|
5268
|
-
metadataAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), nftMint.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
|
|
5269
|
-
collectionMetadata = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), poolConfig.nftCollectionAddress.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
|
|
5270
|
-
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];
|
|
5271
|
-
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];
|
|
5272
|
-
return [4, this.program.methods
|
|
5273
|
-
.burnAndClaim({})
|
|
5274
|
-
.accounts({
|
|
5275
|
-
owner: owner,
|
|
5276
|
-
receivingTokenAccount: userTokenAccount,
|
|
5277
|
-
perpetuals: this.perpetuals.publicKey,
|
|
5278
|
-
tokenVault: poolConfig.tokenVault,
|
|
5279
|
-
tokenVaultTokenAccount: poolConfig.tokenVaultTokenAccount,
|
|
5280
|
-
metadataAccount: metadataAccount,
|
|
5281
|
-
collectionMetadata: collectionMetadata,
|
|
5282
|
-
edition: edition,
|
|
5283
|
-
tokenRecord: tokenRecord,
|
|
5284
|
-
tradingAccount: nftTradingAccount,
|
|
5285
|
-
transferAuthority: poolConfig.transferAuthority,
|
|
5286
|
-
metadataProgram: constants_1.METAPLEX_PROGRAM_ID,
|
|
5287
|
-
nftMint: nftMint,
|
|
5288
|
-
nftTokenAccount: nftTokenAccount,
|
|
5289
|
-
systemProgram: web3_js_1.SystemProgram.programId,
|
|
5290
|
-
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
5291
|
-
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
5292
|
-
eventAuthority: this.eventAuthority.publicKey,
|
|
5293
|
-
program: this.programId,
|
|
5294
|
-
receivingTokenMint: poolConfig.tokenMint,
|
|
5295
|
-
})
|
|
5296
|
-
.instruction()];
|
|
5297
|
-
case 6:
|
|
5298
|
-
burnAndClaimInstruction = _b.sent();
|
|
5299
|
-
instructions.push(burnAndClaimInstruction);
|
|
5300
|
-
return [3, 8];
|
|
5301
|
-
case 7:
|
|
5302
|
-
err_23 = _b.sent();
|
|
5303
|
-
console.log("perpClient burnAndClaimInstruction error:: ", err_23);
|
|
5304
|
-
throw err_23;
|
|
5305
|
-
case 8: return [2, {
|
|
5306
|
-
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5307
|
-
additionalSigners: additionalSigners
|
|
5308
|
-
}];
|
|
5309
|
-
}
|
|
5310
|
-
});
|
|
5311
|
-
}); };
|
|
5312
|
-
this.burnAndStake = function (owner, feePayer, nftMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5313
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, nftTokenAccount, nftTradingAccount, metadataAccount, collectionMetadata, edition, tokenRecord, burnAndStakeInstruction, err_24;
|
|
5314
|
-
return __generator(this, function (_a) {
|
|
5315
|
-
switch (_a.label) {
|
|
5316
|
-
case 0:
|
|
5317
|
-
preInstructions = [];
|
|
5318
|
-
instructions = [];
|
|
5319
|
-
postInstructions = [];
|
|
5320
|
-
additionalSigners = [];
|
|
5321
|
-
_a.label = 1;
|
|
5322
|
-
case 1:
|
|
5323
|
-
_a.trys.push([1, 3, , 4]);
|
|
5324
|
-
tokenStakeAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("token_stake"), owner.toBuffer()], this.programId)[0];
|
|
5325
|
-
nftTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(nftMint, owner, true);
|
|
5326
|
-
nftTradingAccount = web3_js_1.PublicKey.findProgramAddressSync([
|
|
5327
|
-
Buffer.from("trading"),
|
|
5328
|
-
nftMint.toBuffer(),
|
|
5329
|
-
], this.programId)[0];
|
|
5330
|
-
metadataAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), nftMint.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
|
|
5331
|
-
collectionMetadata = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), poolConfig.nftCollectionAddress.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
|
|
5332
|
-
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];
|
|
5333
|
-
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];
|
|
5334
|
-
return [4, this.program.methods
|
|
5335
|
-
.burnAndStake({})
|
|
5336
|
-
.accounts({
|
|
5337
|
-
owner: owner,
|
|
5338
|
-
feePayer: feePayer,
|
|
5339
|
-
perpetuals: this.perpetuals.publicKey,
|
|
5340
|
-
tokenVault: poolConfig.tokenVault,
|
|
5341
|
-
tokenVaultTokenAccount: poolConfig.tokenVaultTokenAccount,
|
|
5342
|
-
tokenStakeAccount: tokenStakeAccount,
|
|
5343
|
-
metadataAccount: metadataAccount,
|
|
5344
|
-
collectionMetadata: collectionMetadata,
|
|
5345
|
-
edition: edition,
|
|
5346
|
-
tokenRecord: tokenRecord,
|
|
5347
|
-
tradingAccount: nftTradingAccount,
|
|
5348
|
-
transferAuthority: poolConfig.transferAuthority,
|
|
5349
|
-
metadataProgram: constants_1.METAPLEX_PROGRAM_ID,
|
|
5350
|
-
nftMint: nftMint,
|
|
5351
|
-
nftTokenAccount: nftTokenAccount,
|
|
5352
|
-
systemProgram: web3_js_1.SystemProgram.programId,
|
|
5353
|
-
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
5354
|
-
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
5355
|
-
eventAuthority: this.eventAuthority.publicKey,
|
|
5356
|
-
program: this.programId
|
|
5357
|
-
})
|
|
5358
|
-
.instruction()];
|
|
5359
|
-
case 2:
|
|
5360
|
-
burnAndStakeInstruction = _a.sent();
|
|
5361
|
-
instructions.push(burnAndStakeInstruction);
|
|
5362
|
-
return [3, 4];
|
|
5363
|
-
case 3:
|
|
5364
|
-
err_24 = _a.sent();
|
|
5365
|
-
console.log("perpClient burnAndStakeInstruction error:: ", err_24);
|
|
5366
|
-
throw err_24;
|
|
5367
|
-
case 4: return [2, {
|
|
5368
|
-
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5369
|
-
additionalSigners: additionalSigners
|
|
5370
|
-
}];
|
|
5371
|
-
}
|
|
5372
|
-
});
|
|
5373
|
-
}); };
|
|
5374
5133
|
this.depositTokenStake = function (owner, feePayer, depositAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5375
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, depositTokenStakeInstruction,
|
|
5134
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, depositTokenStakeInstruction, err_21;
|
|
5376
5135
|
return __generator(this, function (_a) {
|
|
5377
5136
|
switch (_a.label) {
|
|
5378
5137
|
case 0:
|
|
@@ -5414,9 +5173,9 @@ var PerpetualsClient = (function () {
|
|
|
5414
5173
|
instructions.push(depositTokenStakeInstruction);
|
|
5415
5174
|
return [3, 5];
|
|
5416
5175
|
case 4:
|
|
5417
|
-
|
|
5418
|
-
console.log("perpClient depositStakingInstruction error:: ",
|
|
5419
|
-
throw
|
|
5176
|
+
err_21 = _a.sent();
|
|
5177
|
+
console.log("perpClient depositStakingInstruction error:: ", err_21);
|
|
5178
|
+
throw err_21;
|
|
5420
5179
|
case 5: return [2, {
|
|
5421
5180
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5422
5181
|
additionalSigners: additionalSigners
|
|
@@ -5425,7 +5184,7 @@ var PerpetualsClient = (function () {
|
|
|
5425
5184
|
});
|
|
5426
5185
|
}); };
|
|
5427
5186
|
this.unstakeTokenRequest = function (owner, unstakeAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5428
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, unstakeTokenRequestInstruction,
|
|
5187
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, unstakeTokenRequestInstruction, err_22;
|
|
5429
5188
|
return __generator(this, function (_a) {
|
|
5430
5189
|
switch (_a.label) {
|
|
5431
5190
|
case 0:
|
|
@@ -5454,9 +5213,9 @@ var PerpetualsClient = (function () {
|
|
|
5454
5213
|
instructions.push(unstakeTokenRequestInstruction);
|
|
5455
5214
|
return [3, 4];
|
|
5456
5215
|
case 3:
|
|
5457
|
-
|
|
5458
|
-
console.log("perpClient unstakeTokenRequestInstruction error:: ",
|
|
5459
|
-
throw
|
|
5216
|
+
err_22 = _a.sent();
|
|
5217
|
+
console.log("perpClient unstakeTokenRequestInstruction error:: ", err_22);
|
|
5218
|
+
throw err_22;
|
|
5460
5219
|
case 4: return [2, {
|
|
5461
5220
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5462
5221
|
additionalSigners: additionalSigners
|
|
@@ -5465,7 +5224,7 @@ var PerpetualsClient = (function () {
|
|
|
5465
5224
|
});
|
|
5466
5225
|
}); };
|
|
5467
5226
|
this.unstakeTokenInstant = function (owner, unstakeAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5468
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, unstakeTokenInstantInstruction,
|
|
5227
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, unstakeTokenInstantInstruction, err_23;
|
|
5469
5228
|
return __generator(this, function (_a) {
|
|
5470
5229
|
switch (_a.label) {
|
|
5471
5230
|
case 0:
|
|
@@ -5506,9 +5265,9 @@ var PerpetualsClient = (function () {
|
|
|
5506
5265
|
instructions.push(unstakeTokenInstantInstruction);
|
|
5507
5266
|
return [3, 5];
|
|
5508
5267
|
case 4:
|
|
5509
|
-
|
|
5510
|
-
console.log("perpClient unstakeTokenInstantInstruction error:: ",
|
|
5511
|
-
throw
|
|
5268
|
+
err_23 = _a.sent();
|
|
5269
|
+
console.log("perpClient unstakeTokenInstantInstruction error:: ", err_23);
|
|
5270
|
+
throw err_23;
|
|
5512
5271
|
case 5: return [2, {
|
|
5513
5272
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5514
5273
|
additionalSigners: additionalSigners
|
|
@@ -5517,7 +5276,7 @@ var PerpetualsClient = (function () {
|
|
|
5517
5276
|
});
|
|
5518
5277
|
}); };
|
|
5519
5278
|
this.withdrawToken = function (owner, withdrawRequestId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5520
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, withdrawTokenInstruction,
|
|
5279
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, withdrawTokenInstruction, err_24;
|
|
5521
5280
|
return __generator(this, function (_a) {
|
|
5522
5281
|
switch (_a.label) {
|
|
5523
5282
|
case 0:
|
|
@@ -5558,9 +5317,9 @@ var PerpetualsClient = (function () {
|
|
|
5558
5317
|
instructions.push(withdrawTokenInstruction);
|
|
5559
5318
|
return [3, 5];
|
|
5560
5319
|
case 4:
|
|
5561
|
-
|
|
5562
|
-
console.log("perpClient withdrawTokenInstruction error:: ",
|
|
5563
|
-
throw
|
|
5320
|
+
err_24 = _a.sent();
|
|
5321
|
+
console.log("perpClient withdrawTokenInstruction error:: ", err_24);
|
|
5322
|
+
throw err_24;
|
|
5564
5323
|
case 5: return [2, {
|
|
5565
5324
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5566
5325
|
additionalSigners: additionalSigners
|
|
@@ -5569,7 +5328,7 @@ var PerpetualsClient = (function () {
|
|
|
5569
5328
|
});
|
|
5570
5329
|
}); };
|
|
5571
5330
|
this.cancelUnstakeRequest = function (owner, withdrawRequestId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5572
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, cancelUnstakeRequestInstruction,
|
|
5331
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, cancelUnstakeRequestInstruction, err_25;
|
|
5573
5332
|
return __generator(this, function (_a) {
|
|
5574
5333
|
switch (_a.label) {
|
|
5575
5334
|
case 0:
|
|
@@ -5598,9 +5357,9 @@ var PerpetualsClient = (function () {
|
|
|
5598
5357
|
instructions.push(cancelUnstakeRequestInstruction);
|
|
5599
5358
|
return [3, 4];
|
|
5600
5359
|
case 3:
|
|
5601
|
-
|
|
5602
|
-
console.log("perpClient cancelUnstakeRequestInstruction error:: ",
|
|
5603
|
-
throw
|
|
5360
|
+
err_25 = _a.sent();
|
|
5361
|
+
console.log("perpClient cancelUnstakeRequestInstruction error:: ", err_25);
|
|
5362
|
+
throw err_25;
|
|
5604
5363
|
case 4: return [2, {
|
|
5605
5364
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5606
5365
|
additionalSigners: additionalSigners
|
|
@@ -5614,7 +5373,7 @@ var PerpetualsClient = (function () {
|
|
|
5614
5373
|
args_1[_i - 2] = arguments[_i];
|
|
5615
5374
|
}
|
|
5616
5375
|
return __awaiter(_this, __spreadArray([owner_1, poolConfig_1], args_1, true), void 0, function (owner, poolConfig, createUserATA) {
|
|
5617
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, _a, collectTokenRewardInstruction,
|
|
5376
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, _a, collectTokenRewardInstruction, err_26;
|
|
5618
5377
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5619
5378
|
return __generator(this, function (_b) {
|
|
5620
5379
|
switch (_b.label) {
|
|
@@ -5660,9 +5419,9 @@ var PerpetualsClient = (function () {
|
|
|
5660
5419
|
instructions.push(collectTokenRewardInstruction);
|
|
5661
5420
|
return [3, 6];
|
|
5662
5421
|
case 5:
|
|
5663
|
-
|
|
5664
|
-
console.log("perpClient collectTokenRewardInstruction error:: ",
|
|
5665
|
-
throw
|
|
5422
|
+
err_26 = _b.sent();
|
|
5423
|
+
console.log("perpClient collectTokenRewardInstruction error:: ", err_26);
|
|
5424
|
+
throw err_26;
|
|
5666
5425
|
case 6: return [2, {
|
|
5667
5426
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5668
5427
|
additionalSigners: additionalSigners
|
|
@@ -5677,7 +5436,7 @@ var PerpetualsClient = (function () {
|
|
|
5677
5436
|
args_1[_i - 3] = arguments[_i];
|
|
5678
5437
|
}
|
|
5679
5438
|
return __awaiter(_this, __spreadArray([owner_1, rewardSymbol_1, poolConfig_1], args_1, true), void 0, function (owner, rewardSymbol, poolConfig, createUserATA) {
|
|
5680
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, tokenStakeAccount, userTokenAccount, _a, collectRevenueInstruction,
|
|
5439
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, tokenStakeAccount, userTokenAccount, _a, collectRevenueInstruction, err_27;
|
|
5681
5440
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5682
5441
|
return __generator(this, function (_b) {
|
|
5683
5442
|
switch (_b.label) {
|
|
@@ -5724,9 +5483,9 @@ var PerpetualsClient = (function () {
|
|
|
5724
5483
|
instructions.push(collectRevenueInstruction);
|
|
5725
5484
|
return [3, 6];
|
|
5726
5485
|
case 5:
|
|
5727
|
-
|
|
5728
|
-
console.log("perpClient collectRevenueInstruction error:: ",
|
|
5729
|
-
throw
|
|
5486
|
+
err_27 = _b.sent();
|
|
5487
|
+
console.log("perpClient collectRevenueInstruction error:: ", err_27);
|
|
5488
|
+
throw err_27;
|
|
5730
5489
|
case 6: return [2, {
|
|
5731
5490
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5732
5491
|
additionalSigners: additionalSigners
|
|
@@ -5736,7 +5495,7 @@ var PerpetualsClient = (function () {
|
|
|
5736
5495
|
});
|
|
5737
5496
|
};
|
|
5738
5497
|
this.initRewardVault = function (nftCount, rewardSymbol, collectionMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5739
|
-
var publicKey, rewardCustodyMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, nftTransferAuthority, initRewardVault,
|
|
5498
|
+
var publicKey, rewardCustodyMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, nftTransferAuthority, initRewardVault, err_28;
|
|
5740
5499
|
return __generator(this, function (_a) {
|
|
5741
5500
|
switch (_a.label) {
|
|
5742
5501
|
case 0:
|
|
@@ -5773,9 +5532,9 @@ var PerpetualsClient = (function () {
|
|
|
5773
5532
|
instructions.push(initRewardVault);
|
|
5774
5533
|
return [3, 4];
|
|
5775
5534
|
case 3:
|
|
5776
|
-
|
|
5777
|
-
console.log("perpClient InitRewardVault error:: ",
|
|
5778
|
-
throw
|
|
5535
|
+
err_28 = _a.sent();
|
|
5536
|
+
console.log("perpClient InitRewardVault error:: ", err_28);
|
|
5537
|
+
throw err_28;
|
|
5779
5538
|
case 4: return [2, {
|
|
5780
5539
|
instructions: __spreadArray([], instructions, true),
|
|
5781
5540
|
additionalSigners: additionalSigners
|
|
@@ -5784,7 +5543,7 @@ var PerpetualsClient = (function () {
|
|
|
5784
5543
|
});
|
|
5785
5544
|
}); };
|
|
5786
5545
|
this.distributeReward = function (rewardAmount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5787
|
-
var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, distributeReward,
|
|
5546
|
+
var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, distributeReward, err_29;
|
|
5788
5547
|
return __generator(this, function (_a) {
|
|
5789
5548
|
switch (_a.label) {
|
|
5790
5549
|
case 0:
|
|
@@ -5815,9 +5574,9 @@ var PerpetualsClient = (function () {
|
|
|
5815
5574
|
instructions.push(distributeReward);
|
|
5816
5575
|
return [3, 4];
|
|
5817
5576
|
case 3:
|
|
5818
|
-
|
|
5819
|
-
console.log("perpClient distributeReward error:: ",
|
|
5820
|
-
throw
|
|
5577
|
+
err_29 = _a.sent();
|
|
5578
|
+
console.log("perpClient distributeReward error:: ", err_29);
|
|
5579
|
+
throw err_29;
|
|
5821
5580
|
case 4: return [2, {
|
|
5822
5581
|
instructions: __spreadArray([], instructions, true),
|
|
5823
5582
|
additionalSigners: additionalSigners
|
|
@@ -5831,7 +5590,7 @@ var PerpetualsClient = (function () {
|
|
|
5831
5590
|
args_1[_i - 3] = arguments[_i];
|
|
5832
5591
|
}
|
|
5833
5592
|
return __awaiter(_this, __spreadArray([rewardSymbol_1, poolConfig_1, nftMint_1], args_1, true), void 0, function (rewardSymbol, poolConfig, nftMint, createUserATA) {
|
|
5834
|
-
var publicKey, rewardToken, rewardCustodyMint, instructions, additionalSigners, nftTokenAccount, metadataAccount, receivingTokenAccount, _a, rewardRecord, rewardVault, rewardTokenAccount, nftTransferAuthority, collectNftReward,
|
|
5593
|
+
var publicKey, rewardToken, rewardCustodyMint, instructions, additionalSigners, nftTokenAccount, metadataAccount, receivingTokenAccount, _a, rewardRecord, rewardVault, rewardTokenAccount, nftTransferAuthority, collectNftReward, err_30;
|
|
5835
5594
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5836
5595
|
return __generator(this, function (_b) {
|
|
5837
5596
|
switch (_b.label) {
|
|
@@ -5883,8 +5642,8 @@ var PerpetualsClient = (function () {
|
|
|
5883
5642
|
instructions.push(collectNftReward);
|
|
5884
5643
|
return [3, 6];
|
|
5885
5644
|
case 5:
|
|
5886
|
-
|
|
5887
|
-
throw
|
|
5645
|
+
err_30 = _b.sent();
|
|
5646
|
+
throw err_30;
|
|
5888
5647
|
case 6: return [2, {
|
|
5889
5648
|
instructions: __spreadArray([], instructions, true),
|
|
5890
5649
|
additionalSigners: additionalSigners
|
|
@@ -5899,7 +5658,7 @@ var PerpetualsClient = (function () {
|
|
|
5899
5658
|
args_1[_i - 2] = arguments[_i];
|
|
5900
5659
|
}
|
|
5901
5660
|
return __awaiter(_this, __spreadArray([rewardSymbol_1, poolConfig_1], args_1, true), void 0, function (rewardSymbol, poolConfig, createUserATA, nftTradingAccount) {
|
|
5902
|
-
var publicKey, rewardToken, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tradingAccount, rewardVault, rewardTokenAccount, withdrawStakeInstruction,
|
|
5661
|
+
var publicKey, rewardToken, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tradingAccount, rewardVault, rewardTokenAccount, withdrawStakeInstruction, err_31;
|
|
5903
5662
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5904
5663
|
return __generator(this, function (_b) {
|
|
5905
5664
|
switch (_b.label) {
|
|
@@ -5965,9 +5724,9 @@ var PerpetualsClient = (function () {
|
|
|
5965
5724
|
instructions.push(withdrawStakeInstruction);
|
|
5966
5725
|
return [3, 6];
|
|
5967
5726
|
case 5:
|
|
5968
|
-
|
|
5969
|
-
console.log("perpClient withdrawStake error:: ",
|
|
5970
|
-
throw
|
|
5727
|
+
err_31 = _b.sent();
|
|
5728
|
+
console.log("perpClient withdrawStake error:: ", err_31);
|
|
5729
|
+
throw err_31;
|
|
5971
5730
|
case 6: return [2, {
|
|
5972
5731
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5973
5732
|
additionalSigners: additionalSigners
|
|
@@ -5982,7 +5741,7 @@ var PerpetualsClient = (function () {
|
|
|
5982
5741
|
args_1[_i - 11] = arguments[_i];
|
|
5983
5742
|
}
|
|
5984
5743
|
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) {
|
|
5985
|
-
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, userReserveTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, orderAccount, placeLimitOrder,
|
|
5744
|
+
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, userReserveTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, orderAccount, placeLimitOrder, err_32;
|
|
5986
5745
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
|
5987
5746
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
5988
5747
|
return __generator(this, function (_c) {
|
|
@@ -6088,9 +5847,9 @@ var PerpetualsClient = (function () {
|
|
|
6088
5847
|
instructions.push(placeLimitOrder);
|
|
6089
5848
|
return [3, 10];
|
|
6090
5849
|
case 9:
|
|
6091
|
-
|
|
6092
|
-
console.log("perpClient placeLimitOrder error:: ",
|
|
6093
|
-
throw
|
|
5850
|
+
err_32 = _c.sent();
|
|
5851
|
+
console.log("perpClient placeLimitOrder error:: ", err_32);
|
|
5852
|
+
throw err_32;
|
|
6094
5853
|
case 10: return [2, {
|
|
6095
5854
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6096
5855
|
additionalSigners: additionalSigners
|
|
@@ -6105,7 +5864,7 @@ var PerpetualsClient = (function () {
|
|
|
6105
5864
|
args_1[_i - 11] = arguments[_i];
|
|
6106
5865
|
}
|
|
6107
5866
|
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) {
|
|
6108
|
-
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, wrappedSolAccount, userReceivingTokenAccount, lamports, _a, positionAccount, orderAccount, editLimitOrder,
|
|
5867
|
+
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, wrappedSolAccount, userReceivingTokenAccount, lamports, _a, positionAccount, orderAccount, editLimitOrder, err_33;
|
|
6109
5868
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6110
5869
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
6111
5870
|
return __generator(this, function (_b) {
|
|
@@ -6196,9 +5955,9 @@ var PerpetualsClient = (function () {
|
|
|
6196
5955
|
instructions.push(editLimitOrder);
|
|
6197
5956
|
return [3, 8];
|
|
6198
5957
|
case 7:
|
|
6199
|
-
|
|
6200
|
-
console.log("perpClient editLimitOrder error:: ",
|
|
6201
|
-
throw
|
|
5958
|
+
err_33 = _b.sent();
|
|
5959
|
+
console.log("perpClient editLimitOrder error:: ", err_33);
|
|
5960
|
+
throw err_33;
|
|
6202
5961
|
case 8: return [2, {
|
|
6203
5962
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6204
5963
|
additionalSigners: additionalSigners
|
|
@@ -6213,7 +5972,7 @@ var PerpetualsClient = (function () {
|
|
|
6213
5972
|
args_1[_i - 7] = arguments[_i];
|
|
6214
5973
|
}
|
|
6215
5974
|
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) {
|
|
6216
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder,
|
|
5975
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder, err_34;
|
|
6217
5976
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
6218
5977
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
|
6219
5978
|
if (rebateTokenAccount === void 0) { rebateTokenAccount = web3_js_1.PublicKey.default; }
|
|
@@ -6266,9 +6025,9 @@ var PerpetualsClient = (function () {
|
|
|
6266
6025
|
instructions.push(executeLimitOrder);
|
|
6267
6026
|
return [3, 4];
|
|
6268
6027
|
case 3:
|
|
6269
|
-
|
|
6270
|
-
console.log("perpClient executeLimitOrder error:: ",
|
|
6271
|
-
throw
|
|
6028
|
+
err_34 = _a.sent();
|
|
6029
|
+
console.log("perpClient executeLimitOrder error:: ", err_34);
|
|
6030
|
+
throw err_34;
|
|
6272
6031
|
case 4: return [2, {
|
|
6273
6032
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6274
6033
|
additionalSigners: additionalSigners
|
|
@@ -6283,7 +6042,7 @@ var PerpetualsClient = (function () {
|
|
|
6283
6042
|
args_1[_i - 8] = arguments[_i];
|
|
6284
6043
|
}
|
|
6285
6044
|
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) {
|
|
6286
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitWithSwap,
|
|
6045
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitWithSwap, err_35;
|
|
6287
6046
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
6288
6047
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
|
6289
6048
|
if (rebateTokenAccount === void 0) { rebateTokenAccount = web3_js_1.PublicKey.default; }
|
|
@@ -6339,9 +6098,9 @@ var PerpetualsClient = (function () {
|
|
|
6339
6098
|
instructions.push(executeLimitWithSwap);
|
|
6340
6099
|
return [3, 4];
|
|
6341
6100
|
case 3:
|
|
6342
|
-
|
|
6343
|
-
console.log("perpClient executeLimitWithSwap error:: ",
|
|
6344
|
-
throw
|
|
6101
|
+
err_35 = _a.sent();
|
|
6102
|
+
console.log("perpClient executeLimitWithSwap error:: ", err_35);
|
|
6103
|
+
throw err_35;
|
|
6345
6104
|
case 4: return [2, {
|
|
6346
6105
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6347
6106
|
additionalSigners: additionalSigners
|
|
@@ -6351,7 +6110,7 @@ var PerpetualsClient = (function () {
|
|
|
6351
6110
|
});
|
|
6352
6111
|
};
|
|
6353
6112
|
this.placeTriggerOrder = function (targetSymbol, collateralSymbol, receiveSymbol, side, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6354
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder,
|
|
6113
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder, err_36;
|
|
6355
6114
|
return __generator(this, function (_a) {
|
|
6356
6115
|
switch (_a.label) {
|
|
6357
6116
|
case 0:
|
|
@@ -6399,9 +6158,9 @@ var PerpetualsClient = (function () {
|
|
|
6399
6158
|
instructions.push(placeTriggerOrder);
|
|
6400
6159
|
return [3, 4];
|
|
6401
6160
|
case 3:
|
|
6402
|
-
|
|
6403
|
-
console.log("perpClient placeTriggerOrder error:: ",
|
|
6404
|
-
throw
|
|
6161
|
+
err_36 = _a.sent();
|
|
6162
|
+
console.log("perpClient placeTriggerOrder error:: ", err_36);
|
|
6163
|
+
throw err_36;
|
|
6405
6164
|
case 4: return [2, {
|
|
6406
6165
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6407
6166
|
additionalSigners: additionalSigners
|
|
@@ -6410,7 +6169,7 @@ var PerpetualsClient = (function () {
|
|
|
6410
6169
|
});
|
|
6411
6170
|
}); };
|
|
6412
6171
|
this.editTriggerOrder = function (targetSymbol, collateralSymbol, receiveSymbol, side, orderId, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6413
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder,
|
|
6172
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder, err_37;
|
|
6414
6173
|
return __generator(this, function (_a) {
|
|
6415
6174
|
switch (_a.label) {
|
|
6416
6175
|
case 0:
|
|
@@ -6457,9 +6216,9 @@ var PerpetualsClient = (function () {
|
|
|
6457
6216
|
instructions.push(editTriggerOrder);
|
|
6458
6217
|
return [3, 4];
|
|
6459
6218
|
case 3:
|
|
6460
|
-
|
|
6461
|
-
console.log("perpClient editTriggerOrder error:: ",
|
|
6462
|
-
throw
|
|
6219
|
+
err_37 = _a.sent();
|
|
6220
|
+
console.log("perpClient editTriggerOrder error:: ", err_37);
|
|
6221
|
+
throw err_37;
|
|
6463
6222
|
case 4: return [2, {
|
|
6464
6223
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6465
6224
|
additionalSigners: additionalSigners
|
|
@@ -6468,7 +6227,7 @@ var PerpetualsClient = (function () {
|
|
|
6468
6227
|
});
|
|
6469
6228
|
}); };
|
|
6470
6229
|
this.cancelTriggerOrder = function (targetSymbol, collateralSymbol, side, orderId, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6471
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder,
|
|
6230
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder, err_38;
|
|
6472
6231
|
return __generator(this, function (_a) {
|
|
6473
6232
|
switch (_a.label) {
|
|
6474
6233
|
case 0:
|
|
@@ -6501,9 +6260,9 @@ var PerpetualsClient = (function () {
|
|
|
6501
6260
|
instructions.push(cancelTriggerOrder);
|
|
6502
6261
|
return [3, 4];
|
|
6503
6262
|
case 3:
|
|
6504
|
-
|
|
6505
|
-
console.log("perpClient cancelTriggerOrder error:: ",
|
|
6506
|
-
throw
|
|
6263
|
+
err_38 = _a.sent();
|
|
6264
|
+
console.log("perpClient cancelTriggerOrder error:: ", err_38);
|
|
6265
|
+
throw err_38;
|
|
6507
6266
|
case 4: return [2, {
|
|
6508
6267
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6509
6268
|
additionalSigners: additionalSigners
|
|
@@ -6512,7 +6271,7 @@ var PerpetualsClient = (function () {
|
|
|
6512
6271
|
});
|
|
6513
6272
|
}); };
|
|
6514
6273
|
this.cancelAllTriggerOrders = function (targetSymbol, collateralSymbol, side, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6515
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, positionAccount, cancelAllTriggerOrders,
|
|
6274
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, positionAccount, cancelAllTriggerOrders, err_39;
|
|
6516
6275
|
return __generator(this, function (_a) {
|
|
6517
6276
|
switch (_a.label) {
|
|
6518
6277
|
case 0:
|
|
@@ -6543,9 +6302,9 @@ var PerpetualsClient = (function () {
|
|
|
6543
6302
|
instructions.push(cancelAllTriggerOrders);
|
|
6544
6303
|
return [3, 4];
|
|
6545
6304
|
case 3:
|
|
6546
|
-
|
|
6547
|
-
console.log("perpClient cancelAllTriggerOrders error:: ",
|
|
6548
|
-
throw
|
|
6305
|
+
err_39 = _a.sent();
|
|
6306
|
+
console.log("perpClient cancelAllTriggerOrders error:: ", err_39);
|
|
6307
|
+
throw err_39;
|
|
6549
6308
|
case 4: return [2, {
|
|
6550
6309
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6551
6310
|
additionalSigners: additionalSigners
|
|
@@ -6559,7 +6318,7 @@ var PerpetualsClient = (function () {
|
|
|
6559
6318
|
args_1[_i - 9] = arguments[_i];
|
|
6560
6319
|
}
|
|
6561
6320
|
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) {
|
|
6562
|
-
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,
|
|
6321
|
+
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;
|
|
6563
6322
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6564
6323
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
6565
6324
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
@@ -6666,9 +6425,9 @@ var PerpetualsClient = (function () {
|
|
|
6666
6425
|
instructions.push(executeTriggerWithSwap);
|
|
6667
6426
|
return [3, 10];
|
|
6668
6427
|
case 9:
|
|
6669
|
-
|
|
6670
|
-
console.log("perpClient executeTriggerWithSwap error:: ",
|
|
6671
|
-
throw
|
|
6428
|
+
err_40 = _e.sent();
|
|
6429
|
+
console.log("perpClient executeTriggerWithSwap error:: ", err_40);
|
|
6430
|
+
throw err_40;
|
|
6672
6431
|
case 10: return [2, {
|
|
6673
6432
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6674
6433
|
additionalSigners: additionalSigners
|
|
@@ -6683,7 +6442,7 @@ var PerpetualsClient = (function () {
|
|
|
6683
6442
|
args_1[_i - 8] = arguments[_i];
|
|
6684
6443
|
}
|
|
6685
6444
|
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) {
|
|
6686
|
-
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder,
|
|
6445
|
+
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder, err_41;
|
|
6687
6446
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6688
6447
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
6689
6448
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
@@ -6755,9 +6514,9 @@ var PerpetualsClient = (function () {
|
|
|
6755
6514
|
instructions.push(executeTriggerOrder);
|
|
6756
6515
|
return [3, 8];
|
|
6757
6516
|
case 7:
|
|
6758
|
-
|
|
6759
|
-
console.log("perpClient executeTriggerOrder error:: ",
|
|
6760
|
-
throw
|
|
6517
|
+
err_41 = _b.sent();
|
|
6518
|
+
console.log("perpClient executeTriggerOrder error:: ", err_41);
|
|
6519
|
+
throw err_41;
|
|
6761
6520
|
case 8: return [2, {
|
|
6762
6521
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6763
6522
|
additionalSigners: additionalSigners
|
|
@@ -6772,7 +6531,7 @@ var PerpetualsClient = (function () {
|
|
|
6772
6531
|
args_1[_i - 5] = arguments[_i];
|
|
6773
6532
|
}
|
|
6774
6533
|
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) {
|
|
6775
|
-
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,
|
|
6534
|
+
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;
|
|
6776
6535
|
if (useFeesPool === void 0) { useFeesPool = false; }
|
|
6777
6536
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6778
6537
|
if (unWrapSol === void 0) { unWrapSol = false; }
|
|
@@ -6977,9 +6736,9 @@ var PerpetualsClient = (function () {
|
|
|
6977
6736
|
}
|
|
6978
6737
|
return [3, 20];
|
|
6979
6738
|
case 19:
|
|
6980
|
-
|
|
6981
|
-
console.error("perpClient Swap error:: ",
|
|
6982
|
-
throw
|
|
6739
|
+
err_42 = _g.sent();
|
|
6740
|
+
console.error("perpClient Swap error:: ", err_42);
|
|
6741
|
+
throw err_42;
|
|
6983
6742
|
case 20: return [2, {
|
|
6984
6743
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6985
6744
|
additionalSigners: additionalSigners
|
|
@@ -6989,7 +6748,7 @@ var PerpetualsClient = (function () {
|
|
|
6989
6748
|
});
|
|
6990
6749
|
};
|
|
6991
6750
|
this.swapFeeInternal = function (rewardTokenSymbol, swapTokenSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6992
|
-
var rewardCustody, custody, publicKey, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody_1, params, inx,
|
|
6751
|
+
var rewardCustody, custody, publicKey, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody_1, params, inx, err_43;
|
|
6993
6752
|
return __generator(this, function (_b) {
|
|
6994
6753
|
switch (_b.label) {
|
|
6995
6754
|
case 0:
|
|
@@ -7049,9 +6808,9 @@ var PerpetualsClient = (function () {
|
|
|
7049
6808
|
instructions.push(inx);
|
|
7050
6809
|
return [3, 4];
|
|
7051
6810
|
case 3:
|
|
7052
|
-
|
|
7053
|
-
console.error("perpClient Swap error:: ",
|
|
7054
|
-
throw
|
|
6811
|
+
err_43 = _b.sent();
|
|
6812
|
+
console.error("perpClient Swap error:: ", err_43);
|
|
6813
|
+
throw err_43;
|
|
7055
6814
|
case 4: return [2, {
|
|
7056
6815
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7057
6816
|
additionalSigners: additionalSigners
|
|
@@ -7060,7 +6819,7 @@ var PerpetualsClient = (function () {
|
|
|
7060
6819
|
});
|
|
7061
6820
|
}); };
|
|
7062
6821
|
this.setLpTokenPrice = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7063
|
-
var instructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, setLpTokenPriceInstruction,
|
|
6822
|
+
var instructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, setLpTokenPriceInstruction, err_44;
|
|
7064
6823
|
return __generator(this, function (_d) {
|
|
7065
6824
|
switch (_d.label) {
|
|
7066
6825
|
case 0:
|
|
@@ -7108,9 +6867,9 @@ var PerpetualsClient = (function () {
|
|
|
7108
6867
|
instructions.push(setLpTokenPriceInstruction);
|
|
7109
6868
|
return [3, 4];
|
|
7110
6869
|
case 3:
|
|
7111
|
-
|
|
7112
|
-
console.log("perpClient setLpTokenPriceInstruction error:: ",
|
|
7113
|
-
throw
|
|
6870
|
+
err_44 = _d.sent();
|
|
6871
|
+
console.log("perpClient setLpTokenPriceInstruction error:: ", err_44);
|
|
6872
|
+
throw err_44;
|
|
7114
6873
|
case 4: return [2, {
|
|
7115
6874
|
instructions: __spreadArray([], instructions, true),
|
|
7116
6875
|
additionalSigners: additionalSigners
|
|
@@ -7158,7 +6917,7 @@ var PerpetualsClient = (function () {
|
|
|
7158
6917
|
});
|
|
7159
6918
|
}); };
|
|
7160
6919
|
this.setAdminSigners = function (admins, minSignatures) { return __awaiter(_this, void 0, void 0, function () {
|
|
7161
|
-
var adminMetas, _i, admins_2, admin,
|
|
6920
|
+
var adminMetas, _i, admins_2, admin, err_45;
|
|
7162
6921
|
return __generator(this, function (_a) {
|
|
7163
6922
|
switch (_a.label) {
|
|
7164
6923
|
case 0:
|
|
@@ -7188,11 +6947,11 @@ var PerpetualsClient = (function () {
|
|
|
7188
6947
|
_a.sent();
|
|
7189
6948
|
return [3, 4];
|
|
7190
6949
|
case 3:
|
|
7191
|
-
|
|
6950
|
+
err_45 = _a.sent();
|
|
7192
6951
|
if (this.printErrors) {
|
|
7193
|
-
console.error("setAdminSigners err:",
|
|
6952
|
+
console.error("setAdminSigners err:", err_45);
|
|
7194
6953
|
}
|
|
7195
|
-
throw
|
|
6954
|
+
throw err_45;
|
|
7196
6955
|
case 4: return [2];
|
|
7197
6956
|
}
|
|
7198
6957
|
});
|
|
@@ -7381,7 +7140,7 @@ var PerpetualsClient = (function () {
|
|
|
7381
7140
|
});
|
|
7382
7141
|
}); };
|
|
7383
7142
|
this.protocolWithdrawFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7384
|
-
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx,
|
|
7143
|
+
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx, err_46;
|
|
7385
7144
|
return __generator(this, function (_a) {
|
|
7386
7145
|
switch (_a.label) {
|
|
7387
7146
|
case 0:
|
|
@@ -7414,9 +7173,9 @@ var PerpetualsClient = (function () {
|
|
|
7414
7173
|
instructions.push(withdrawFeesIx);
|
|
7415
7174
|
return [3, 5];
|
|
7416
7175
|
case 4:
|
|
7417
|
-
|
|
7418
|
-
console.log("perpClient setPool error:: ",
|
|
7419
|
-
throw
|
|
7176
|
+
err_46 = _a.sent();
|
|
7177
|
+
console.log("perpClient setPool error:: ", err_46);
|
|
7178
|
+
throw err_46;
|
|
7420
7179
|
case 5: return [2, {
|
|
7421
7180
|
instructions: __spreadArray([], instructions, true),
|
|
7422
7181
|
additionalSigners: additionalSigners
|
|
@@ -7425,7 +7184,7 @@ var PerpetualsClient = (function () {
|
|
|
7425
7184
|
});
|
|
7426
7185
|
}); };
|
|
7427
7186
|
this.moveProtocolFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7428
|
-
var publicKey, custodyConfig, instructions, additionalSigners, moveProtocolFeesIx,
|
|
7187
|
+
var publicKey, custodyConfig, instructions, additionalSigners, moveProtocolFeesIx, err_47;
|
|
7429
7188
|
return __generator(this, function (_a) {
|
|
7430
7189
|
switch (_a.label) {
|
|
7431
7190
|
case 0:
|
|
@@ -7459,9 +7218,9 @@ var PerpetualsClient = (function () {
|
|
|
7459
7218
|
instructions.push(moveProtocolFeesIx);
|
|
7460
7219
|
return [3, 4];
|
|
7461
7220
|
case 3:
|
|
7462
|
-
|
|
7463
|
-
console.log("perpClient setPool error:: ",
|
|
7464
|
-
throw
|
|
7221
|
+
err_47 = _a.sent();
|
|
7222
|
+
console.log("perpClient setPool error:: ", err_47);
|
|
7223
|
+
throw err_47;
|
|
7465
7224
|
case 4: return [2, {
|
|
7466
7225
|
instructions: __spreadArray([], instructions, true),
|
|
7467
7226
|
additionalSigners: additionalSigners
|
|
@@ -7470,7 +7229,7 @@ var PerpetualsClient = (function () {
|
|
|
7470
7229
|
});
|
|
7471
7230
|
}); };
|
|
7472
7231
|
this.setProtocolFeeShareBps = function (feeShareBps, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7473
|
-
var publicKey, setProtocolFeeShareBpsIx,
|
|
7232
|
+
var publicKey, setProtocolFeeShareBpsIx, err_48;
|
|
7474
7233
|
return __generator(this, function (_a) {
|
|
7475
7234
|
switch (_a.label) {
|
|
7476
7235
|
case 0:
|
|
@@ -7490,15 +7249,15 @@ var PerpetualsClient = (function () {
|
|
|
7490
7249
|
setProtocolFeeShareBpsIx = _a.sent();
|
|
7491
7250
|
return [2, setProtocolFeeShareBpsIx];
|
|
7492
7251
|
case 2:
|
|
7493
|
-
|
|
7494
|
-
console.log("perpClient setProtocolFeeShareBpsIx error:: ",
|
|
7495
|
-
throw
|
|
7252
|
+
err_48 = _a.sent();
|
|
7253
|
+
console.log("perpClient setProtocolFeeShareBpsIx error:: ", err_48);
|
|
7254
|
+
throw err_48;
|
|
7496
7255
|
case 3: return [2];
|
|
7497
7256
|
}
|
|
7498
7257
|
});
|
|
7499
7258
|
}); };
|
|
7500
7259
|
this.setPermissions = function (permissions) { return __awaiter(_this, void 0, void 0, function () {
|
|
7501
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction,
|
|
7260
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_49;
|
|
7502
7261
|
return __generator(this, function (_a) {
|
|
7503
7262
|
switch (_a.label) {
|
|
7504
7263
|
case 0:
|
|
@@ -7525,9 +7284,9 @@ var PerpetualsClient = (function () {
|
|
|
7525
7284
|
instructions.push(setPermissionsInstruction);
|
|
7526
7285
|
return [3, 4];
|
|
7527
7286
|
case 3:
|
|
7528
|
-
|
|
7529
|
-
console.log("perpClient setPool error:: ",
|
|
7530
|
-
throw
|
|
7287
|
+
err_49 = _a.sent();
|
|
7288
|
+
console.log("perpClient setPool error:: ", err_49);
|
|
7289
|
+
throw err_49;
|
|
7531
7290
|
case 4: return [2, {
|
|
7532
7291
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7533
7292
|
additionalSigners: additionalSigners
|
|
@@ -7536,7 +7295,7 @@ var PerpetualsClient = (function () {
|
|
|
7536
7295
|
});
|
|
7537
7296
|
}); };
|
|
7538
7297
|
this.reimburse = function (tokenMint, amountIn, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7539
|
-
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e,
|
|
7298
|
+
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e, err_50;
|
|
7540
7299
|
var _f;
|
|
7541
7300
|
return __generator(this, function (_g) {
|
|
7542
7301
|
switch (_g.label) {
|
|
@@ -7597,9 +7356,9 @@ var PerpetualsClient = (function () {
|
|
|
7597
7356
|
instructions.push(reimburse);
|
|
7598
7357
|
return [3, 5];
|
|
7599
7358
|
case 4:
|
|
7600
|
-
|
|
7601
|
-
console.log("perpClient setPool error:: ",
|
|
7602
|
-
throw
|
|
7359
|
+
err_50 = _g.sent();
|
|
7360
|
+
console.log("perpClient setPool error:: ", err_50);
|
|
7361
|
+
throw err_50;
|
|
7603
7362
|
case 5: return [2, {
|
|
7604
7363
|
instructions: __spreadArray([], instructions, true),
|
|
7605
7364
|
additionalSigners: additionalSigners
|
|
@@ -7608,7 +7367,7 @@ var PerpetualsClient = (function () {
|
|
|
7608
7367
|
});
|
|
7609
7368
|
}); };
|
|
7610
7369
|
this.setInternalOraclePrice = function (tokenMint, useCurrentTime, price, expo, conf, ema, publishTime, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7611
|
-
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice,
|
|
7370
|
+
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice, err_51;
|
|
7612
7371
|
return __generator(this, function (_a) {
|
|
7613
7372
|
switch (_a.label) {
|
|
7614
7373
|
case 0:
|
|
@@ -7642,9 +7401,9 @@ var PerpetualsClient = (function () {
|
|
|
7642
7401
|
instructions.push(setInternalOraclePrice);
|
|
7643
7402
|
return [3, 4];
|
|
7644
7403
|
case 3:
|
|
7645
|
-
|
|
7646
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
|
7647
|
-
throw
|
|
7404
|
+
err_51 = _a.sent();
|
|
7405
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_51);
|
|
7406
|
+
throw err_51;
|
|
7648
7407
|
case 4: return [2, {
|
|
7649
7408
|
instructions: __spreadArray([], instructions, true),
|
|
7650
7409
|
additionalSigners: additionalSigners
|
|
@@ -7653,7 +7412,7 @@ var PerpetualsClient = (function () {
|
|
|
7653
7412
|
});
|
|
7654
7413
|
}); };
|
|
7655
7414
|
this.setInternalOraclePriceBatch = function (useCurrentTime, tokenMintList, tokenInternalPrices, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
|
|
7656
|
-
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_1, _i, tokenMintList_1, tokenMint, instructions, additionalSigners, setInternalOraclePrice,
|
|
7415
|
+
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_1, _i, tokenMintList_1, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_52;
|
|
7657
7416
|
return __generator(this, function (_a) {
|
|
7658
7417
|
switch (_a.label) {
|
|
7659
7418
|
case 0:
|
|
@@ -7699,9 +7458,9 @@ var PerpetualsClient = (function () {
|
|
|
7699
7458
|
instructions.push(setInternalOraclePrice);
|
|
7700
7459
|
return [3, 4];
|
|
7701
7460
|
case 3:
|
|
7702
|
-
|
|
7703
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
|
7704
|
-
throw
|
|
7461
|
+
err_52 = _a.sent();
|
|
7462
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_52);
|
|
7463
|
+
throw err_52;
|
|
7705
7464
|
case 4: return [2, {
|
|
7706
7465
|
instructions: __spreadArray([], instructions, true),
|
|
7707
7466
|
additionalSigners: additionalSigners
|
|
@@ -7710,7 +7469,7 @@ var PerpetualsClient = (function () {
|
|
|
7710
7469
|
});
|
|
7711
7470
|
}); };
|
|
7712
7471
|
this.setInternalOracleEmaPriceBatch = function (tokenMintList, tokenInternalEmaPrices, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
|
|
7713
|
-
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_2, _i, tokenMintList_2, tokenMint, instructions, additionalSigners, setInternalOraclePrice,
|
|
7472
|
+
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_2, _i, tokenMintList_2, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_53;
|
|
7714
7473
|
return __generator(this, function (_a) {
|
|
7715
7474
|
switch (_a.label) {
|
|
7716
7475
|
case 0:
|
|
@@ -7750,9 +7509,9 @@ var PerpetualsClient = (function () {
|
|
|
7750
7509
|
instructions.push(setInternalOraclePrice);
|
|
7751
7510
|
return [3, 4];
|
|
7752
7511
|
case 3:
|
|
7753
|
-
|
|
7754
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
|
7755
|
-
throw
|
|
7512
|
+
err_53 = _a.sent();
|
|
7513
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_53);
|
|
7514
|
+
throw err_53;
|
|
7756
7515
|
case 4: return [2, {
|
|
7757
7516
|
instructions: __spreadArray([], instructions, true),
|
|
7758
7517
|
additionalSigners: additionalSigners
|
|
@@ -7761,7 +7520,7 @@ var PerpetualsClient = (function () {
|
|
|
7761
7520
|
});
|
|
7762
7521
|
}); };
|
|
7763
7522
|
this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7764
|
-
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp,
|
|
7523
|
+
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_54;
|
|
7765
7524
|
return __generator(this, function (_a) {
|
|
7766
7525
|
switch (_a.label) {
|
|
7767
7526
|
case 0:
|
|
@@ -7799,8 +7558,8 @@ var PerpetualsClient = (function () {
|
|
|
7799
7558
|
instructions.push(renameFlp);
|
|
7800
7559
|
return [3, 4];
|
|
7801
7560
|
case 3:
|
|
7802
|
-
|
|
7803
|
-
console.log("perpClient renameFlp error:: ",
|
|
7561
|
+
err_54 = _a.sent();
|
|
7562
|
+
console.log("perpClient renameFlp error:: ", err_54);
|
|
7804
7563
|
return [3, 4];
|
|
7805
7564
|
case 4: return [2, {
|
|
7806
7565
|
instructions: __spreadArray([], instructions, true),
|
|
@@ -7810,7 +7569,7 @@ var PerpetualsClient = (function () {
|
|
|
7810
7569
|
});
|
|
7811
7570
|
}); };
|
|
7812
7571
|
this.initStake = function (stakingFeeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7813
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction,
|
|
7572
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction, err_55;
|
|
7814
7573
|
return __generator(this, function (_a) {
|
|
7815
7574
|
switch (_a.label) {
|
|
7816
7575
|
case 0:
|
|
@@ -7848,9 +7607,9 @@ var PerpetualsClient = (function () {
|
|
|
7848
7607
|
instructions.push(initStakeInstruction);
|
|
7849
7608
|
return [3, 4];
|
|
7850
7609
|
case 3:
|
|
7851
|
-
|
|
7852
|
-
console.log("perpClient InitStaking error:: ",
|
|
7853
|
-
throw
|
|
7610
|
+
err_55 = _a.sent();
|
|
7611
|
+
console.log("perpClient InitStaking error:: ", err_55);
|
|
7612
|
+
throw err_55;
|
|
7854
7613
|
case 4: return [2, {
|
|
7855
7614
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7856
7615
|
additionalSigners: additionalSigners
|
|
@@ -7859,7 +7618,7 @@ var PerpetualsClient = (function () {
|
|
|
7859
7618
|
});
|
|
7860
7619
|
}); };
|
|
7861
7620
|
this.initCompounding = function (feeShareBps, metadataTitle, metadataSymbol, metadataUri, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7862
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction,
|
|
7621
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction, err_56;
|
|
7863
7622
|
return __generator(this, function (_a) {
|
|
7864
7623
|
switch (_a.label) {
|
|
7865
7624
|
case 0:
|
|
@@ -7904,9 +7663,9 @@ var PerpetualsClient = (function () {
|
|
|
7904
7663
|
instructions.push(initCompoundingInstruction);
|
|
7905
7664
|
return [3, 4];
|
|
7906
7665
|
case 3:
|
|
7907
|
-
|
|
7908
|
-
console.log("perpClient initCompounding error:: ",
|
|
7909
|
-
throw
|
|
7666
|
+
err_56 = _a.sent();
|
|
7667
|
+
console.log("perpClient initCompounding error:: ", err_56);
|
|
7668
|
+
throw err_56;
|
|
7910
7669
|
case 4: return [2, {
|
|
7911
7670
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7912
7671
|
additionalSigners: additionalSigners
|
|
@@ -7915,7 +7674,7 @@ var PerpetualsClient = (function () {
|
|
|
7915
7674
|
});
|
|
7916
7675
|
}); };
|
|
7917
7676
|
this.initTokenVault = function (token_permissions, tokens_to_distribute, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7918
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction,
|
|
7677
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction, err_57;
|
|
7919
7678
|
return __generator(this, function (_a) {
|
|
7920
7679
|
switch (_a.label) {
|
|
7921
7680
|
case 0:
|
|
@@ -7956,9 +7715,9 @@ var PerpetualsClient = (function () {
|
|
|
7956
7715
|
instructions.push(initTokenVaultInstruction);
|
|
7957
7716
|
return [3, 4];
|
|
7958
7717
|
case 3:
|
|
7959
|
-
|
|
7960
|
-
console.log("perpClient InitTokenVaultInstruction error:: ",
|
|
7961
|
-
throw
|
|
7718
|
+
err_57 = _a.sent();
|
|
7719
|
+
console.log("perpClient InitTokenVaultInstruction error:: ", err_57);
|
|
7720
|
+
throw err_57;
|
|
7962
7721
|
case 4: return [2, {
|
|
7963
7722
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7964
7723
|
additionalSigners: additionalSigners
|
|
@@ -7967,7 +7726,7 @@ var PerpetualsClient = (function () {
|
|
|
7967
7726
|
});
|
|
7968
7727
|
}); };
|
|
7969
7728
|
this.setTokenVaultConfig = function (token_permissions, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7970
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction,
|
|
7729
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction, err_58;
|
|
7971
7730
|
return __generator(this, function (_a) {
|
|
7972
7731
|
switch (_a.label) {
|
|
7973
7732
|
case 0:
|
|
@@ -7998,9 +7757,9 @@ var PerpetualsClient = (function () {
|
|
|
7998
7757
|
instructions.push(setTokenVaultConfigInstruction);
|
|
7999
7758
|
return [3, 4];
|
|
8000
7759
|
case 3:
|
|
8001
|
-
|
|
8002
|
-
console.log("perpClient setTokenVaultConfigInstruction error:: ",
|
|
8003
|
-
throw
|
|
7760
|
+
err_58 = _a.sent();
|
|
7761
|
+
console.log("perpClient setTokenVaultConfigInstruction error:: ", err_58);
|
|
7762
|
+
throw err_58;
|
|
8004
7763
|
case 4: return [2, {
|
|
8005
7764
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8006
7765
|
additionalSigners: additionalSigners
|
|
@@ -8009,7 +7768,7 @@ var PerpetualsClient = (function () {
|
|
|
8009
7768
|
});
|
|
8010
7769
|
}); };
|
|
8011
7770
|
this.withdrawInstantFee = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8012
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction,
|
|
7771
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction, err_59;
|
|
8013
7772
|
return __generator(this, function (_a) {
|
|
8014
7773
|
switch (_a.label) {
|
|
8015
7774
|
case 0:
|
|
@@ -8048,9 +7807,59 @@ var PerpetualsClient = (function () {
|
|
|
8048
7807
|
instructions.push(withdrawInstantFeeInstruction);
|
|
8049
7808
|
return [3, 6];
|
|
8050
7809
|
case 5:
|
|
8051
|
-
|
|
8052
|
-
console.log("perpClient withdrawInstantFeeInstruction error:: ",
|
|
8053
|
-
throw
|
|
7810
|
+
err_59 = _a.sent();
|
|
7811
|
+
console.log("perpClient withdrawInstantFeeInstruction error:: ", err_59);
|
|
7812
|
+
throw err_59;
|
|
7813
|
+
case 6: return [2, {
|
|
7814
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7815
|
+
additionalSigners: additionalSigners
|
|
7816
|
+
}];
|
|
7817
|
+
}
|
|
7818
|
+
});
|
|
7819
|
+
}); };
|
|
7820
|
+
this.withdrawUnclaimedTokens = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7821
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawUnclaimedTokensInstruction, err_60;
|
|
7822
|
+
return __generator(this, function (_a) {
|
|
7823
|
+
switch (_a.label) {
|
|
7824
|
+
case 0:
|
|
7825
|
+
publicKey = this.provider.wallet.publicKey;
|
|
7826
|
+
preInstructions = [];
|
|
7827
|
+
instructions = [];
|
|
7828
|
+
postInstructions = [];
|
|
7829
|
+
additionalSigners = [];
|
|
7830
|
+
_a.label = 1;
|
|
7831
|
+
case 1:
|
|
7832
|
+
_a.trys.push([1, 5, , 6]);
|
|
7833
|
+
return [4, (0, spl_token_1.getAssociatedTokenAddress)(poolConfig.tokenMint, publicKey, true)];
|
|
7834
|
+
case 2:
|
|
7835
|
+
receivingTokenAccount = _a.sent();
|
|
7836
|
+
return [4, (0, utils_1.checkIfAccountExists)(receivingTokenAccount, this.provider.connection)];
|
|
7837
|
+
case 3:
|
|
7838
|
+
if (!(_a.sent())) {
|
|
7839
|
+
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, receivingTokenAccount, publicKey, poolConfig.tokenMint));
|
|
7840
|
+
}
|
|
7841
|
+
return [4, this.program.methods
|
|
7842
|
+
.withdrawUnclaimedTokens({})
|
|
7843
|
+
.accounts({
|
|
7844
|
+
admin: publicKey,
|
|
7845
|
+
multisig: this.multisig.publicKey,
|
|
7846
|
+
perpetuals: this.perpetuals.publicKey,
|
|
7847
|
+
transferAuthority: poolConfig.transferAuthority,
|
|
7848
|
+
tokenVault: poolConfig.tokenVault,
|
|
7849
|
+
tokenVaultTokenAccount: poolConfig.tokenVaultTokenAccount,
|
|
7850
|
+
receivingTokenAccount: receivingTokenAccount,
|
|
7851
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
7852
|
+
receivingTokenMint: poolConfig.tokenMint,
|
|
7853
|
+
})
|
|
7854
|
+
.instruction()];
|
|
7855
|
+
case 4:
|
|
7856
|
+
withdrawUnclaimedTokensInstruction = _a.sent();
|
|
7857
|
+
instructions.push(withdrawUnclaimedTokensInstruction);
|
|
7858
|
+
return [3, 6];
|
|
7859
|
+
case 5:
|
|
7860
|
+
err_60 = _a.sent();
|
|
7861
|
+
console.log("perpClient withdrawUnclaimedTokensInstruction error:: ", err_60);
|
|
7862
|
+
throw err_60;
|
|
8054
7863
|
case 6: return [2, {
|
|
8055
7864
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8056
7865
|
additionalSigners: additionalSigners
|
|
@@ -8059,7 +7868,7 @@ var PerpetualsClient = (function () {
|
|
|
8059
7868
|
});
|
|
8060
7869
|
}); };
|
|
8061
7870
|
this.initRevenueTokenAccount = function (feeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8062
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction,
|
|
7871
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction, err_61;
|
|
8063
7872
|
return __generator(this, function (_a) {
|
|
8064
7873
|
switch (_a.label) {
|
|
8065
7874
|
case 0:
|
|
@@ -8096,9 +7905,9 @@ var PerpetualsClient = (function () {
|
|
|
8096
7905
|
instructions.push(initRevenueTokenAccountInstruction);
|
|
8097
7906
|
return [3, 4];
|
|
8098
7907
|
case 3:
|
|
8099
|
-
|
|
8100
|
-
console.log("perpClient initRevenueTokenAccountInstruction error:: ",
|
|
8101
|
-
throw
|
|
7908
|
+
err_61 = _a.sent();
|
|
7909
|
+
console.log("perpClient initRevenueTokenAccountInstruction error:: ", err_61);
|
|
7910
|
+
throw err_61;
|
|
8102
7911
|
case 4: return [2, {
|
|
8103
7912
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8104
7913
|
additionalSigners: additionalSigners
|
|
@@ -8107,7 +7916,7 @@ var PerpetualsClient = (function () {
|
|
|
8107
7916
|
});
|
|
8108
7917
|
}); };
|
|
8109
7918
|
this.distributeTokenReward = function (amount, epochCount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8110
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction,
|
|
7919
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction, err_62;
|
|
8111
7920
|
return __generator(this, function (_a) {
|
|
8112
7921
|
switch (_a.label) {
|
|
8113
7922
|
case 0:
|
|
@@ -8146,9 +7955,9 @@ var PerpetualsClient = (function () {
|
|
|
8146
7955
|
instructions.push(distributeTokenRewardInstruction);
|
|
8147
7956
|
return [3, 4];
|
|
8148
7957
|
case 3:
|
|
8149
|
-
|
|
8150
|
-
console.log("perpClient distributeTokenRewardInstruction error:: ",
|
|
8151
|
-
throw
|
|
7958
|
+
err_62 = _a.sent();
|
|
7959
|
+
console.log("perpClient distributeTokenRewardInstruction error:: ", err_62);
|
|
7960
|
+
throw err_62;
|
|
8152
7961
|
case 4: return [2, {
|
|
8153
7962
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8154
7963
|
additionalSigners: additionalSigners
|
|
@@ -8157,7 +7966,7 @@ var PerpetualsClient = (function () {
|
|
|
8157
7966
|
});
|
|
8158
7967
|
}); };
|
|
8159
7968
|
this.setTokenStakeLevel = function (owner, stakeLevel) { return __awaiter(_this, void 0, void 0, function () {
|
|
8160
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction,
|
|
7969
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction, err_63;
|
|
8161
7970
|
return __generator(this, function (_a) {
|
|
8162
7971
|
switch (_a.label) {
|
|
8163
7972
|
case 0:
|
|
@@ -8185,9 +7994,9 @@ var PerpetualsClient = (function () {
|
|
|
8185
7994
|
instructions.push(setTokenStakeLevelInstruction);
|
|
8186
7995
|
return [3, 4];
|
|
8187
7996
|
case 3:
|
|
8188
|
-
|
|
8189
|
-
console.log("perpClient setTokenStakeLevelInstruction error:: ",
|
|
8190
|
-
throw
|
|
7997
|
+
err_63 = _a.sent();
|
|
7998
|
+
console.log("perpClient setTokenStakeLevelInstruction error:: ", err_63);
|
|
7999
|
+
throw err_63;
|
|
8191
8000
|
case 4: return [2, {
|
|
8192
8001
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8193
8002
|
additionalSigners: additionalSigners
|
|
@@ -8196,7 +8005,7 @@ var PerpetualsClient = (function () {
|
|
|
8196
8005
|
});
|
|
8197
8006
|
}); };
|
|
8198
8007
|
this.setTokenReward = function (owner, amount, epochCount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8199
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction,
|
|
8008
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction, err_64;
|
|
8200
8009
|
return __generator(this, function (_a) {
|
|
8201
8010
|
switch (_a.label) {
|
|
8202
8011
|
case 0:
|
|
@@ -8228,9 +8037,9 @@ var PerpetualsClient = (function () {
|
|
|
8228
8037
|
instructions.push(setTokenRewardInstruction);
|
|
8229
8038
|
return [3, 4];
|
|
8230
8039
|
case 3:
|
|
8231
|
-
|
|
8232
|
-
console.log("perpClient setTokenRewardInstruction error:: ",
|
|
8233
|
-
throw
|
|
8040
|
+
err_64 = _a.sent();
|
|
8041
|
+
console.log("perpClient setTokenRewardInstruction error:: ", err_64);
|
|
8042
|
+
throw err_64;
|
|
8234
8043
|
case 4: return [2, {
|
|
8235
8044
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8236
8045
|
additionalSigners: additionalSigners
|
|
@@ -8239,7 +8048,7 @@ var PerpetualsClient = (function () {
|
|
|
8239
8048
|
});
|
|
8240
8049
|
}); };
|
|
8241
8050
|
this.resizeInternalOracle = function (extOracle, tokenMint, intOracleAccount) { return __awaiter(_this, void 0, void 0, function () {
|
|
8242
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction,
|
|
8051
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction, err_65;
|
|
8243
8052
|
return __generator(this, function (_a) {
|
|
8244
8053
|
switch (_a.label) {
|
|
8245
8054
|
case 0:
|
|
@@ -8268,9 +8077,9 @@ var PerpetualsClient = (function () {
|
|
|
8268
8077
|
instructions.push(resizeInternalOracleInstruction);
|
|
8269
8078
|
return [3, 4];
|
|
8270
8079
|
case 3:
|
|
8271
|
-
|
|
8272
|
-
console.log("perpClient resizeInternalOracleInstruction error:: ",
|
|
8273
|
-
throw
|
|
8080
|
+
err_65 = _a.sent();
|
|
8081
|
+
console.log("perpClient resizeInternalOracleInstruction error:: ", err_65);
|
|
8082
|
+
throw err_65;
|
|
8274
8083
|
case 4: return [2, {
|
|
8275
8084
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8276
8085
|
additionalSigners: additionalSigners
|