flash-sdk 2.0.51 → 2.0.52
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/PerpetualsClient.d.ts +8 -0
- package/dist/PerpetualsClient.js +159 -12
- package/dist/idl/perpetuals.d.ts +357 -0
- package/dist/idl/perpetuals.js +358 -1
- package/dist/test2.js +8 -18
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -2304,6 +2304,14 @@ export declare class PerpetualsClient {
|
|
2304
2304
|
instructions: TransactionInstruction[];
|
2305
2305
|
additionalSigners: Signer[];
|
2306
2306
|
}>;
|
2307
|
+
setTriggerPrice: (targetSymbol: string, collateralSymbol: string, side: Side, triggerPrice: ContractOraclePrice, isStopLoss: boolean, poolConfig: PoolConfig) => Promise<{
|
2308
|
+
instructions: TransactionInstruction[];
|
2309
|
+
additionalSigners: Signer[];
|
2310
|
+
}>;
|
2311
|
+
forceClosePosition: (targetSymbol: string, collateralSymbol: string, side: Side, isStopLoss: boolean, poolConfig: PoolConfig, nftTradingAccount: PublicKey, nftReferralAccount: PublicKey, nftRebateTokenAccount: PublicKey, privilege: Privilege, createUserATA?: boolean, closeUsersWSOLATA?: boolean) => Promise<{
|
2312
|
+
instructions: TransactionInstruction[];
|
2313
|
+
additionalSigners: Signer[];
|
2314
|
+
}>;
|
2307
2315
|
setPoolConfig: (permissions: Permissions, oracleAuthority: PublicKey, maxAumUsd: BN, stakingFeeShareBps: BN, poolConfig: PoolConfig) => Promise<{
|
2308
2316
|
instructions: TransactionInstruction[];
|
2309
2317
|
additionalSigners: Signer[];
|
package/dist/PerpetualsClient.js
CHANGED
@@ -1150,9 +1150,8 @@ var PerpetualsClient = (function () {
|
|
1150
1150
|
}
|
1151
1151
|
newPosition.collateralAmount = newPosition.collateralAmount.sub(collateralAmountReceived);
|
1152
1152
|
newPosition.collateralUsd = collateralMinMaxPrice.min.getAssetAmountUsd(newPosition.collateralAmount, collateralCustodyAccount.decimals);
|
1153
|
-
var entryPrice = OraclePrice_1.OraclePrice.from({ price: newPosition.entryPrice.price, exponent: new anchor_1.BN(newPosition.entryPrice.exponent), confidence: constants_1.BN_ZERO, timestamp: constants_1.BN_ZERO });
|
1154
1153
|
var finalInterestUsd = _this.getLockFeeAndUnsettledUsdForPosition(newPosition, collateralCustodyAccount, currentTimestamp);
|
1155
|
-
var finalLiquidationPrice = _this.getLiquidationPriceSync(newPosition.collateralAmount, newPosition.sizeAmount, entryPrice.
|
1154
|
+
var finalLiquidationPrice = _this.getLiquidationPriceSync(newPosition.collateralAmount, newPosition.sizeAmount, newPosition.entryPrice.price, finalInterestUsd, marketCorrelation, side, targetCustodyAccount, collateralPrice, collateralEmaPrice, collateralCustodyAccount, newPosition);
|
1156
1155
|
var finalPnl = _this.getPnlSync(newPosition, targetPrice, targetEmaPrice, targetCustodyAccount, collateralPrice, collateralEmaPrice, collateralCustodyAccount, currentTimestamp, targetCustodyAccount.pricing.delaySeconds, poolConfig);
|
1157
1156
|
var finalPnlUsd = finalPnl.profitUsd.sub(finalPnl.lossUsd);
|
1158
1157
|
var newExitFee = _this.getExitFeeSync(newPosition, targetCustodyAccount, collateralCustodyAccount, collateralPrice, collateralEmaPrice);
|
@@ -1170,9 +1169,8 @@ var PerpetualsClient = (function () {
|
|
1170
1169
|
};
|
1171
1170
|
}
|
1172
1171
|
else {
|
1173
|
-
var entryPrice = OraclePrice_1.OraclePrice.from({ price: newPosition.entryPrice.price, exponent: new anchor_1.BN(newPosition.entryPrice.exponent), confidence: constants_1.BN_ZERO, timestamp: constants_1.BN_ZERO });
|
1174
1172
|
var finalInterestUsd = _this.getLockFeeAndUnsettledUsdForPosition(newPosition, collateralCustodyAccount, currentTimestamp);
|
1175
|
-
var finalLiquidationPrice = _this.getLiquidationPriceSync(newPosition.collateralAmount, newPosition.sizeAmount, entryPrice.
|
1173
|
+
var finalLiquidationPrice = _this.getLiquidationPriceSync(newPosition.collateralAmount, newPosition.sizeAmount, newPosition.entryPrice.price, finalInterestUsd, marketCorrelation, side, targetCustodyAccount, collateralPrice, collateralEmaPrice, collateralCustodyAccount, newPosition);
|
1176
1174
|
var finalPnl = _this.getPnlSync(newPosition, targetPrice, targetEmaPrice, targetCustodyAccount, collateralPrice, collateralEmaPrice, collateralCustodyAccount, currentTimestamp, targetCustodyAccount.pricing.delaySeconds, poolConfig);
|
1177
1175
|
var finalPnlUsd = finalPnl.profitUsd.sub(finalPnl.lossUsd);
|
1178
1176
|
var exitFee = _this.getExitFeeSync(newPosition, targetCustodyAccount, collateralCustodyAccount, collateralPrice, collateralEmaPrice);
|
@@ -3752,8 +3750,157 @@ var PerpetualsClient = (function () {
|
|
3752
3750
|
});
|
3753
3751
|
});
|
3754
3752
|
};
|
3753
|
+
this.setTriggerPrice = function (targetSymbol, collateralSymbol, side, triggerPrice, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
3754
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, positionAccount, instructions, additionalSigners, setTriggerPrice, err_19;
|
3755
|
+
return __generator(this, function (_a) {
|
3756
|
+
switch (_a.label) {
|
3757
|
+
case 0:
|
3758
|
+
publicKey = this.provider.wallet.publicKey;
|
3759
|
+
targetCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(targetSymbol).mintKey); });
|
3760
|
+
collateralCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey); });
|
3761
|
+
marketAccount = poolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
|
3762
|
+
positionAccount = poolConfig.getPositionFromMarketPk(publicKey, marketAccount);
|
3763
|
+
instructions = [];
|
3764
|
+
additionalSigners = [];
|
3765
|
+
_a.label = 1;
|
3766
|
+
case 1:
|
3767
|
+
_a.trys.push([1, 3, , 4]);
|
3768
|
+
return [4, this.program.methods
|
3769
|
+
.setTriggerPrice({
|
3770
|
+
triggerPrice: triggerPrice,
|
3771
|
+
isStopLoss: isStopLoss
|
3772
|
+
})
|
3773
|
+
.accounts({
|
3774
|
+
owner: publicKey,
|
3775
|
+
perpetuals: this.perpetuals.publicKey,
|
3776
|
+
pool: poolConfig.poolAddress,
|
3777
|
+
position: positionAccount,
|
3778
|
+
market: marketAccount,
|
3779
|
+
targetCustody: targetCustodyConfig.custodyAccount,
|
3780
|
+
targetOracleAccount: targetCustodyConfig.oracleAddress,
|
3781
|
+
collateralCustody: collateralCustodyConfig.custodyAccount,
|
3782
|
+
collateralOracleAccount: collateralCustodyConfig.oracleAddress,
|
3783
|
+
eventAuthority: this.eventAuthority.publicKey,
|
3784
|
+
program: this.programId,
|
3785
|
+
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
|
3786
|
+
})
|
3787
|
+
.instruction()];
|
3788
|
+
case 2:
|
3789
|
+
setTriggerPrice = _a.sent();
|
3790
|
+
instructions.push(setTriggerPrice);
|
3791
|
+
return [3, 4];
|
3792
|
+
case 3:
|
3793
|
+
err_19 = _a.sent();
|
3794
|
+
console.log("perpClient setTriggerPrice error:: ", err_19);
|
3795
|
+
throw err_19;
|
3796
|
+
case 4: return [2, {
|
3797
|
+
instructions: __spreadArray([], instructions, true),
|
3798
|
+
additionalSigners: additionalSigners
|
3799
|
+
}];
|
3800
|
+
}
|
3801
|
+
});
|
3802
|
+
}); };
|
3803
|
+
this.forceClosePosition = function (targetSymbol, collateralSymbol, side, isStopLoss, poolConfig, nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, privilege, createUserATA, closeUsersWSOLATA) {
|
3804
|
+
if (createUserATA === void 0) { createUserATA = true; }
|
3805
|
+
if (closeUsersWSOLATA === void 0) { closeUsersWSOLATA = false; }
|
3806
|
+
return __awaiter(_this, void 0, void 0, function () {
|
3807
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, positionAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, lamports, _a, forceClosePosition, closeWsolATAIns, err_20;
|
3808
|
+
return __generator(this, function (_b) {
|
3809
|
+
switch (_b.label) {
|
3810
|
+
case 0:
|
3811
|
+
publicKey = this.provider.wallet.publicKey;
|
3812
|
+
targetCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(targetSymbol).mintKey); });
|
3813
|
+
collateralCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey); });
|
3814
|
+
marketAccount = poolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
|
3815
|
+
positionAccount = poolConfig.getPositionFromMarketPk(publicKey, marketAccount);
|
3816
|
+
preInstructions = [];
|
3817
|
+
instructions = [];
|
3818
|
+
postInstructions = [];
|
3819
|
+
additionalSigners = [];
|
3820
|
+
_b.label = 1;
|
3821
|
+
case 1:
|
3822
|
+
_b.trys.push([1, 9, , 10]);
|
3823
|
+
if (!(collateralSymbol == 'SOL')) return [3, 3];
|
3824
|
+
wrappedSolAccount = new web3_js_1.Keypair();
|
3825
|
+
return [4, (0, spl_token_1.getMinimumBalanceForRentExemptAccount)(this.provider.connection)];
|
3826
|
+
case 2:
|
3827
|
+
lamports = (_b.sent());
|
3828
|
+
preInstructions = [
|
3829
|
+
web3_js_1.SystemProgram.createAccount({
|
3830
|
+
fromPubkey: publicKey,
|
3831
|
+
newAccountPubkey: wrappedSolAccount.publicKey,
|
3832
|
+
lamports: lamports,
|
3833
|
+
space: 165,
|
3834
|
+
programId: spl_token_1.TOKEN_PROGRAM_ID,
|
3835
|
+
}),
|
3836
|
+
(0, spl_token_1.createInitializeAccount3Instruction)(wrappedSolAccount.publicKey, spl_token_1.NATIVE_MINT, publicKey),
|
3837
|
+
];
|
3838
|
+
postInstructions = [
|
3839
|
+
(0, spl_token_1.createCloseAccountInstruction)(wrappedSolAccount.publicKey, publicKey, publicKey),
|
3840
|
+
];
|
3841
|
+
additionalSigners.push(wrappedSolAccount);
|
3842
|
+
return [3, 7];
|
3843
|
+
case 3: return [4, (0, spl_token_1.getAssociatedTokenAddress)(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey, publicKey)];
|
3844
|
+
case 4:
|
3845
|
+
userReceivingTokenAccount = _b.sent();
|
3846
|
+
_a = createUserATA;
|
3847
|
+
if (!_a) return [3, 6];
|
3848
|
+
return [4, (0, utils_1.checkIfAccountExists)(userReceivingTokenAccount, this.provider.connection)];
|
3849
|
+
case 5:
|
3850
|
+
_a = !(_b.sent());
|
3851
|
+
_b.label = 6;
|
3852
|
+
case 6:
|
3853
|
+
if (_a) {
|
3854
|
+
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, userReceivingTokenAccount, publicKey, poolConfig.getTokenFromSymbol(collateralSymbol).mintKey));
|
3855
|
+
}
|
3856
|
+
_b.label = 7;
|
3857
|
+
case 7: return [4, this.program.methods
|
3858
|
+
.forceClosePosition({
|
3859
|
+
privilege: privilege,
|
3860
|
+
isStopLoss: isStopLoss
|
3861
|
+
})
|
3862
|
+
.accounts({
|
3863
|
+
owner: publicKey,
|
3864
|
+
receivingAccount: collateralSymbol == 'SOL' ? wrappedSolAccount.publicKey : userReceivingTokenAccount,
|
3865
|
+
transferAuthority: poolConfig.transferAuthority,
|
3866
|
+
perpetuals: this.perpetuals.publicKey,
|
3867
|
+
pool: poolConfig.poolAddress,
|
3868
|
+
position: positionAccount,
|
3869
|
+
market: marketAccount,
|
3870
|
+
targetCustody: targetCustodyConfig.custodyAccount,
|
3871
|
+
targetOracleAccount: targetCustodyConfig.oracleAddress,
|
3872
|
+
collateralCustody: collateralCustodyConfig.custodyAccount,
|
3873
|
+
collateralOracleAccount: collateralCustodyConfig.oracleAddress,
|
3874
|
+
collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
|
3875
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
3876
|
+
eventAuthority: this.eventAuthority.publicKey,
|
3877
|
+
program: this.programId,
|
3878
|
+
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
|
3879
|
+
})
|
3880
|
+
.remainingAccounts(__spreadArray([], (0, getNftAccounts_1.getNftAccounts)(nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, privilege), true))
|
3881
|
+
.instruction()];
|
3882
|
+
case 8:
|
3883
|
+
forceClosePosition = _b.sent();
|
3884
|
+
instructions.push(forceClosePosition);
|
3885
|
+
if (collateralSymbol == 'WSOL' && closeUsersWSOLATA) {
|
3886
|
+
closeWsolATAIns = (0, spl_token_1.createCloseAccountInstruction)(userReceivingTokenAccount, publicKey, publicKey);
|
3887
|
+
postInstructions.push(closeWsolATAIns);
|
3888
|
+
}
|
3889
|
+
return [3, 10];
|
3890
|
+
case 9:
|
3891
|
+
err_20 = _b.sent();
|
3892
|
+
console.log("perpClient forceClosePosition error:: ", err_20);
|
3893
|
+
throw err_20;
|
3894
|
+
case 10: return [2, {
|
3895
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
3896
|
+
additionalSigners: additionalSigners
|
3897
|
+
}];
|
3898
|
+
}
|
3899
|
+
});
|
3900
|
+
});
|
3901
|
+
};
|
3755
3902
|
this.setPoolConfig = function (permissions, oracleAuthority, maxAumUsd, stakingFeeShareBps, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
3756
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPoolConfigInstruction,
|
3903
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPoolConfigInstruction, err_21;
|
3757
3904
|
return __generator(this, function (_a) {
|
3758
3905
|
switch (_a.label) {
|
3759
3906
|
case 0:
|
@@ -3783,9 +3930,9 @@ var PerpetualsClient = (function () {
|
|
3783
3930
|
instructions.push(setPoolConfigInstruction);
|
3784
3931
|
return [3, 4];
|
3785
3932
|
case 3:
|
3786
|
-
|
3787
|
-
console.log("perpClient setPool error:: ",
|
3788
|
-
throw
|
3933
|
+
err_21 = _a.sent();
|
3934
|
+
console.log("perpClient setPool error:: ", err_21);
|
3935
|
+
throw err_21;
|
3789
3936
|
case 4: return [2, {
|
3790
3937
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
3791
3938
|
additionalSigners: additionalSigners
|
@@ -3794,7 +3941,7 @@ var PerpetualsClient = (function () {
|
|
3794
3941
|
});
|
3795
3942
|
}); };
|
3796
3943
|
this.setPermissions = function (permissions) { return __awaiter(_this, void 0, void 0, function () {
|
3797
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction,
|
3944
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_22;
|
3798
3945
|
return __generator(this, function (_a) {
|
3799
3946
|
switch (_a.label) {
|
3800
3947
|
case 0:
|
@@ -3821,9 +3968,9 @@ var PerpetualsClient = (function () {
|
|
3821
3968
|
instructions.push(setPermissionsInstruction);
|
3822
3969
|
return [3, 4];
|
3823
3970
|
case 3:
|
3824
|
-
|
3825
|
-
console.log("perpClient setPool error:: ",
|
3826
|
-
throw
|
3971
|
+
err_22 = _a.sent();
|
3972
|
+
console.log("perpClient setPool error:: ", err_22);
|
3973
|
+
throw err_22;
|
3827
3974
|
case 4: return [2, {
|
3828
3975
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
3829
3976
|
additionalSigners: additionalSigners
|
package/dist/idl/perpetuals.d.ts
CHANGED
@@ -1169,6 +1169,7 @@ export type Perpetuals = {
|
|
1169
1169
|
};
|
1170
1170
|
}
|
1171
1171
|
];
|
1172
|
+
"returns": "u64";
|
1172
1173
|
},
|
1173
1174
|
{
|
1174
1175
|
"name": "removeLiquidity";
|
@@ -1818,6 +1819,79 @@ export type Perpetuals = {
|
|
1818
1819
|
}
|
1819
1820
|
];
|
1820
1821
|
},
|
1822
|
+
{
|
1823
|
+
"name": "setTriggerPrice";
|
1824
|
+
"accounts": [
|
1825
|
+
{
|
1826
|
+
"name": "owner";
|
1827
|
+
"isMut": false;
|
1828
|
+
"isSigner": true;
|
1829
|
+
},
|
1830
|
+
{
|
1831
|
+
"name": "perpetuals";
|
1832
|
+
"isMut": false;
|
1833
|
+
"isSigner": false;
|
1834
|
+
},
|
1835
|
+
{
|
1836
|
+
"name": "pool";
|
1837
|
+
"isMut": false;
|
1838
|
+
"isSigner": false;
|
1839
|
+
},
|
1840
|
+
{
|
1841
|
+
"name": "position";
|
1842
|
+
"isMut": true;
|
1843
|
+
"isSigner": false;
|
1844
|
+
},
|
1845
|
+
{
|
1846
|
+
"name": "market";
|
1847
|
+
"isMut": false;
|
1848
|
+
"isSigner": false;
|
1849
|
+
},
|
1850
|
+
{
|
1851
|
+
"name": "targetCustody";
|
1852
|
+
"isMut": false;
|
1853
|
+
"isSigner": false;
|
1854
|
+
},
|
1855
|
+
{
|
1856
|
+
"name": "targetOracleAccount";
|
1857
|
+
"isMut": false;
|
1858
|
+
"isSigner": false;
|
1859
|
+
},
|
1860
|
+
{
|
1861
|
+
"name": "collateralCustody";
|
1862
|
+
"isMut": false;
|
1863
|
+
"isSigner": false;
|
1864
|
+
},
|
1865
|
+
{
|
1866
|
+
"name": "collateralOracleAccount";
|
1867
|
+
"isMut": false;
|
1868
|
+
"isSigner": false;
|
1869
|
+
},
|
1870
|
+
{
|
1871
|
+
"name": "eventAuthority";
|
1872
|
+
"isMut": false;
|
1873
|
+
"isSigner": false;
|
1874
|
+
},
|
1875
|
+
{
|
1876
|
+
"name": "program";
|
1877
|
+
"isMut": false;
|
1878
|
+
"isSigner": false;
|
1879
|
+
},
|
1880
|
+
{
|
1881
|
+
"name": "ixSysvar";
|
1882
|
+
"isMut": false;
|
1883
|
+
"isSigner": false;
|
1884
|
+
}
|
1885
|
+
];
|
1886
|
+
"args": [
|
1887
|
+
{
|
1888
|
+
"name": "params";
|
1889
|
+
"type": {
|
1890
|
+
"defined": "SetTriggerPriceParams";
|
1891
|
+
};
|
1892
|
+
}
|
1893
|
+
];
|
1894
|
+
},
|
1821
1895
|
{
|
1822
1896
|
"name": "addCollateral";
|
1823
1897
|
"accounts": [
|
@@ -2275,6 +2349,100 @@ export type Perpetuals = {
|
|
2275
2349
|
];
|
2276
2350
|
"returns": "u64";
|
2277
2351
|
},
|
2352
|
+
{
|
2353
|
+
"name": "forceClosePosition";
|
2354
|
+
"accounts": [
|
2355
|
+
{
|
2356
|
+
"name": "owner";
|
2357
|
+
"isMut": true;
|
2358
|
+
"isSigner": false;
|
2359
|
+
},
|
2360
|
+
{
|
2361
|
+
"name": "receivingAccount";
|
2362
|
+
"isMut": true;
|
2363
|
+
"isSigner": false;
|
2364
|
+
},
|
2365
|
+
{
|
2366
|
+
"name": "transferAuthority";
|
2367
|
+
"isMut": false;
|
2368
|
+
"isSigner": false;
|
2369
|
+
},
|
2370
|
+
{
|
2371
|
+
"name": "perpetuals";
|
2372
|
+
"isMut": false;
|
2373
|
+
"isSigner": false;
|
2374
|
+
},
|
2375
|
+
{
|
2376
|
+
"name": "pool";
|
2377
|
+
"isMut": false;
|
2378
|
+
"isSigner": false;
|
2379
|
+
},
|
2380
|
+
{
|
2381
|
+
"name": "position";
|
2382
|
+
"isMut": true;
|
2383
|
+
"isSigner": false;
|
2384
|
+
},
|
2385
|
+
{
|
2386
|
+
"name": "market";
|
2387
|
+
"isMut": true;
|
2388
|
+
"isSigner": false;
|
2389
|
+
},
|
2390
|
+
{
|
2391
|
+
"name": "targetCustody";
|
2392
|
+
"isMut": false;
|
2393
|
+
"isSigner": false;
|
2394
|
+
},
|
2395
|
+
{
|
2396
|
+
"name": "targetOracleAccount";
|
2397
|
+
"isMut": false;
|
2398
|
+
"isSigner": false;
|
2399
|
+
},
|
2400
|
+
{
|
2401
|
+
"name": "collateralCustody";
|
2402
|
+
"isMut": true;
|
2403
|
+
"isSigner": false;
|
2404
|
+
},
|
2405
|
+
{
|
2406
|
+
"name": "collateralOracleAccount";
|
2407
|
+
"isMut": false;
|
2408
|
+
"isSigner": false;
|
2409
|
+
},
|
2410
|
+
{
|
2411
|
+
"name": "collateralCustodyTokenAccount";
|
2412
|
+
"isMut": true;
|
2413
|
+
"isSigner": false;
|
2414
|
+
},
|
2415
|
+
{
|
2416
|
+
"name": "tokenProgram";
|
2417
|
+
"isMut": false;
|
2418
|
+
"isSigner": false;
|
2419
|
+
},
|
2420
|
+
{
|
2421
|
+
"name": "eventAuthority";
|
2422
|
+
"isMut": false;
|
2423
|
+
"isSigner": false;
|
2424
|
+
},
|
2425
|
+
{
|
2426
|
+
"name": "program";
|
2427
|
+
"isMut": false;
|
2428
|
+
"isSigner": false;
|
2429
|
+
},
|
2430
|
+
{
|
2431
|
+
"name": "ixSysvar";
|
2432
|
+
"isMut": false;
|
2433
|
+
"isSigner": false;
|
2434
|
+
}
|
2435
|
+
];
|
2436
|
+
"args": [
|
2437
|
+
{
|
2438
|
+
"name": "params";
|
2439
|
+
"type": {
|
2440
|
+
"defined": "ForceClosePositionParams";
|
2441
|
+
};
|
2442
|
+
}
|
2443
|
+
];
|
2444
|
+
"returns": "u64";
|
2445
|
+
},
|
2278
2446
|
{
|
2279
2447
|
"name": "levelUp";
|
2280
2448
|
"accounts": [
|
@@ -2750,6 +2918,62 @@ export type Perpetuals = {
|
|
2750
2918
|
];
|
2751
2919
|
"returns": "u8";
|
2752
2920
|
},
|
2921
|
+
{
|
2922
|
+
"name": "getLiquidationPrice";
|
2923
|
+
"accounts": [
|
2924
|
+
{
|
2925
|
+
"name": "perpetuals";
|
2926
|
+
"isMut": false;
|
2927
|
+
"isSigner": false;
|
2928
|
+
},
|
2929
|
+
{
|
2930
|
+
"name": "pool";
|
2931
|
+
"isMut": false;
|
2932
|
+
"isSigner": false;
|
2933
|
+
},
|
2934
|
+
{
|
2935
|
+
"name": "position";
|
2936
|
+
"isMut": false;
|
2937
|
+
"isSigner": false;
|
2938
|
+
},
|
2939
|
+
{
|
2940
|
+
"name": "market";
|
2941
|
+
"isMut": false;
|
2942
|
+
"isSigner": false;
|
2943
|
+
},
|
2944
|
+
{
|
2945
|
+
"name": "targetCustody";
|
2946
|
+
"isMut": false;
|
2947
|
+
"isSigner": false;
|
2948
|
+
},
|
2949
|
+
{
|
2950
|
+
"name": "collateralCustody";
|
2951
|
+
"isMut": false;
|
2952
|
+
"isSigner": false;
|
2953
|
+
},
|
2954
|
+
{
|
2955
|
+
"name": "collateralOracleAccount";
|
2956
|
+
"isMut": false;
|
2957
|
+
"isSigner": false;
|
2958
|
+
},
|
2959
|
+
{
|
2960
|
+
"name": "ixSysvar";
|
2961
|
+
"isMut": false;
|
2962
|
+
"isSigner": false;
|
2963
|
+
}
|
2964
|
+
];
|
2965
|
+
"args": [
|
2966
|
+
{
|
2967
|
+
"name": "params";
|
2968
|
+
"type": {
|
2969
|
+
"defined": "GetLiquidationPriceParams";
|
2970
|
+
};
|
2971
|
+
}
|
2972
|
+
];
|
2973
|
+
"returns": {
|
2974
|
+
"defined": "OraclePrice";
|
2975
|
+
};
|
2976
|
+
},
|
2753
2977
|
{
|
2754
2978
|
"name": "getOraclePrice";
|
2755
2979
|
"accounts": [
|
@@ -3772,6 +3996,24 @@ export type Perpetuals = {
|
|
3772
3996
|
];
|
3773
3997
|
};
|
3774
3998
|
},
|
3999
|
+
{
|
4000
|
+
"name": "ForceClosePositionParams";
|
4001
|
+
"type": {
|
4002
|
+
"kind": "struct";
|
4003
|
+
"fields": [
|
4004
|
+
{
|
4005
|
+
"name": "privilege";
|
4006
|
+
"type": {
|
4007
|
+
"defined": "Privilege";
|
4008
|
+
};
|
4009
|
+
},
|
4010
|
+
{
|
4011
|
+
"name": "isStopLoss";
|
4012
|
+
"type": "bool";
|
4013
|
+
}
|
4014
|
+
];
|
4015
|
+
};
|
4016
|
+
},
|
3775
4017
|
{
|
3776
4018
|
"name": "GetAddLiquidityAmountAndFeeParams";
|
3777
4019
|
"type": {
|
@@ -3820,6 +4062,13 @@ export type Perpetuals = {
|
|
3820
4062
|
"fields": [];
|
3821
4063
|
};
|
3822
4064
|
},
|
4065
|
+
{
|
4066
|
+
"name": "GetLiquidationPriceParams";
|
4067
|
+
"type": {
|
4068
|
+
"kind": "struct";
|
4069
|
+
"fields": [];
|
4070
|
+
};
|
4071
|
+
},
|
3823
4072
|
{
|
3824
4073
|
"name": "GetLiquidationStateParams";
|
3825
4074
|
"type": {
|
@@ -4258,6 +4507,24 @@ export type Perpetuals = {
|
|
4258
4507
|
];
|
4259
4508
|
};
|
4260
4509
|
},
|
4510
|
+
{
|
4511
|
+
"name": "SetTriggerPriceParams";
|
4512
|
+
"type": {
|
4513
|
+
"kind": "struct";
|
4514
|
+
"fields": [
|
4515
|
+
{
|
4516
|
+
"name": "triggerPrice";
|
4517
|
+
"type": {
|
4518
|
+
"defined": "OraclePrice";
|
4519
|
+
};
|
4520
|
+
},
|
4521
|
+
{
|
4522
|
+
"name": "isStopLoss";
|
4523
|
+
"type": "bool";
|
4524
|
+
}
|
4525
|
+
];
|
4526
|
+
};
|
4527
|
+
},
|
4261
4528
|
{
|
4262
4529
|
"name": "SwapParams";
|
4263
4530
|
"type": {
|
@@ -5415,6 +5682,56 @@ export type Perpetuals = {
|
|
5415
5682
|
}
|
5416
5683
|
];
|
5417
5684
|
},
|
5685
|
+
{
|
5686
|
+
"name": "ForceClosePositionLog";
|
5687
|
+
"fields": [
|
5688
|
+
{
|
5689
|
+
"name": "owner";
|
5690
|
+
"type": "publicKey";
|
5691
|
+
"index": false;
|
5692
|
+
},
|
5693
|
+
{
|
5694
|
+
"name": "market";
|
5695
|
+
"type": "publicKey";
|
5696
|
+
"index": false;
|
5697
|
+
},
|
5698
|
+
{
|
5699
|
+
"name": "priceUsd";
|
5700
|
+
"type": "u64";
|
5701
|
+
"index": false;
|
5702
|
+
},
|
5703
|
+
{
|
5704
|
+
"name": "sizeAmount";
|
5705
|
+
"type": "u64";
|
5706
|
+
"index": false;
|
5707
|
+
},
|
5708
|
+
{
|
5709
|
+
"name": "sizeUsd";
|
5710
|
+
"type": "u64";
|
5711
|
+
"index": false;
|
5712
|
+
},
|
5713
|
+
{
|
5714
|
+
"name": "profitUsd";
|
5715
|
+
"type": "u64";
|
5716
|
+
"index": false;
|
5717
|
+
},
|
5718
|
+
{
|
5719
|
+
"name": "lossUsd";
|
5720
|
+
"type": "u64";
|
5721
|
+
"index": false;
|
5722
|
+
},
|
5723
|
+
{
|
5724
|
+
"name": "feeAmount";
|
5725
|
+
"type": "u64";
|
5726
|
+
"index": false;
|
5727
|
+
},
|
5728
|
+
{
|
5729
|
+
"name": "isStopLoss";
|
5730
|
+
"type": "bool";
|
5731
|
+
"index": false;
|
5732
|
+
}
|
5733
|
+
];
|
5734
|
+
},
|
5418
5735
|
{
|
5419
5736
|
"name": "IncreaseSizeLog";
|
5420
5737
|
"fields": [
|
@@ -5590,6 +5907,31 @@ export type Perpetuals = {
|
|
5590
5907
|
}
|
5591
5908
|
];
|
5592
5909
|
},
|
5910
|
+
{
|
5911
|
+
"name": "SetTriggerPriceLog";
|
5912
|
+
"fields": [
|
5913
|
+
{
|
5914
|
+
"name": "owner";
|
5915
|
+
"type": "publicKey";
|
5916
|
+
"index": false;
|
5917
|
+
},
|
5918
|
+
{
|
5919
|
+
"name": "market";
|
5920
|
+
"type": "publicKey";
|
5921
|
+
"index": false;
|
5922
|
+
},
|
5923
|
+
{
|
5924
|
+
"name": "priceUsd";
|
5925
|
+
"type": "u64";
|
5926
|
+
"index": false;
|
5927
|
+
},
|
5928
|
+
{
|
5929
|
+
"name": "isStopLoss";
|
5930
|
+
"type": "bool";
|
5931
|
+
"index": false;
|
5932
|
+
}
|
5933
|
+
];
|
5934
|
+
},
|
5593
5935
|
{
|
5594
5936
|
"name": "SwapLog";
|
5595
5937
|
"fields": [
|
@@ -5906,6 +6248,21 @@ export type Perpetuals = {
|
|
5906
6248
|
"code": 6047;
|
5907
6249
|
"name": "TradingAccountMismatch";
|
5908
6250
|
"msg": "Trading account doesnot match referral account";
|
6251
|
+
},
|
6252
|
+
{
|
6253
|
+
"code": 6048;
|
6254
|
+
"name": "MaxDepostsReached";
|
6255
|
+
"msg": "Max deposits reached";
|
6256
|
+
},
|
6257
|
+
{
|
6258
|
+
"code": 6049;
|
6259
|
+
"name": "InvalidStopLossPrice";
|
6260
|
+
"msg": "Invalid Stop Loss price";
|
6261
|
+
},
|
6262
|
+
{
|
6263
|
+
"code": 6050;
|
6264
|
+
"name": "InvalidTakeProfitPrice";
|
6265
|
+
"msg": "Invalid Take Profit price";
|
5909
6266
|
}
|
5910
6267
|
];
|
5911
6268
|
};
|