flash-sdk 11.3.2 → 11.3.3-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.
@@ -4815,7 +4815,7 @@ export declare class PerpetualsClient {
4815
4815
  getLiquidationPriceContractHelper: (entryOraclePrice: OraclePrice, lockAndUnsettledFeeUsd: BN, side: Side, targetCustodyAccount: CustodyAccount, positionAccount: PositionAccount) => OraclePrice;
4816
4816
  getLiquidationPriceSync: (collateralUsd: BN, entryOraclePrice: OraclePrice, lockAndUnsettledFeeUsd: BN, side: Side, targetCustodyAccount: CustodyAccount, positionAccount: PositionAccount) => OraclePrice;
4817
4817
  getLiquidationPriceWithOrder: (collateralUsd: BN, sizeAmount: BN, sizeUsd: BN, sizeDecimals: number, limitOraclePrice: OraclePrice, side: Side, targetCustodyAccount: CustodyAccount) => OraclePrice;
4818
- getMaxProfitPriceSync: (entryPrice: OraclePrice, marketCorrelation: boolean, side: Side, collateralPrice: OraclePrice, positionAccount: PositionAccount) => OraclePrice;
4818
+ getMaxProfitPriceSync: (entryPrice: OraclePrice, marketCorrelation: boolean, side: Side, collateralPrice: OraclePrice, collateralDecimals: number, positionAccount: PositionAccount) => OraclePrice;
4819
4819
  getEstimateProfitLossforTpSlEntry: (positionAccount: PositionAccount | null, isTakeProfit: boolean, userEntrytpSlOraclePrice: OraclePrice, collateralDeltaAmount: BN, sizeDeltaAmount: BN, side: Side, marketCorrelation: boolean, maxPayOffBps: BN, marketAccountPk: PublicKey, targetTokenPrice: OraclePrice, targetTokenEmaPrice: OraclePrice, targetCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount, poolConfig: PoolConfig) => {
4820
4820
  pnlUsd: BN;
4821
4821
  pnlPercentage: BN;
@@ -1462,7 +1462,7 @@ var PerpetualsClient = (function () {
1462
1462
  }
1463
1463
  return liquidationPrice.price.isNeg() ? zeroOraclePrice : liquidationPrice;
1464
1464
  };
1465
- this.getMaxProfitPriceSync = function (entryPrice, marketCorrelation, side, collateralPrice, positionAccount) {
1465
+ this.getMaxProfitPriceSync = function (entryPrice, marketCorrelation, side, collateralPrice, collateralDecimals, positionAccount) {
1466
1466
  var zeroOraclePrice = OraclePrice_1.OraclePrice.from({
1467
1467
  price: constants_1.BN_ZERO,
1468
1468
  exponent: constants_1.BN_ZERO,
@@ -1473,7 +1473,7 @@ var PerpetualsClient = (function () {
1473
1473
  return zeroOraclePrice;
1474
1474
  }
1475
1475
  var priceDiffProfit = OraclePrice_1.OraclePrice.from({
1476
- price: (collateralPrice.price.mul(positionAccount.lockedAmount)).mul(new anchor_1.BN(10).pow(new anchor_1.BN(positionAccount.sizeDecimals + 3)))
1476
+ price: (collateralPrice.getAssetAmountUsd(positionAccount.lockedAmount, collateralDecimals)).mul(new anchor_1.BN(10).pow(new anchor_1.BN(positionAccount.sizeDecimals + 3)))
1477
1477
  .div(positionAccount.sizeAmount),
1478
1478
  exponent: new anchor_1.BN(-1 * constants_1.RATE_DECIMALS),
1479
1479
  confidence: constants_1.BN_ZERO,
@@ -7143,8 +7143,6 @@ var PerpetualsClient = (function () {
7143
7143
  perpetuals: this.perpetuals.publicKey,
7144
7144
  tokenVault: poolConfig.tokenVault,
7145
7145
  pool: poolConfig.poolAddress,
7146
- custody: custodyConfig.custodyAccount,
7147
- custodyTokenAccount: custodyConfig.tokenAccount,
7148
7146
  revenueTokenAccount: poolConfig.revenueTokenAccount,
7149
7147
  protocolVault: poolConfig.protocolVault,
7150
7148
  protocolTokenAccount: poolConfig.protocolTokenAccount,
@@ -2909,6 +2909,19 @@
2909
2909
  "pythTicker": "Commodities.WTIG6/USD",
2910
2910
  "pythPriceId": "0x7e91242dfd2cea64715b26edaa3e51bafc712a56ac4228a77bd53b51fd66db52",
2911
2911
  "isToken2022": false
2912
+ },
2913
+ {
2914
+ "symbol": "XAUt",
2915
+ "mintKey": "xaut1dB1uihYCwjReVgwZ4mBBJzwkXn4picqqmk4v2H",
2916
+ "decimals": 6,
2917
+ "usdPrecision": 4,
2918
+ "tokenPrecision": 4,
2919
+ "isStable": false,
2920
+ "isVirtual": false,
2921
+ "lazerId": 172,
2922
+ "pythTicker": "Crypto.XAUT/USD",
2923
+ "pythPriceId": "0x44465e17d2e9d390e70c999d5a11fda4f092847fcd2e3e5aa089d96c98a30e67",
2924
+ "isToken2022": false
2912
2925
  }
2913
2926
  ],
2914
2927
  "custodies": [
@@ -3009,10 +3022,27 @@
3009
3022
  "isStable": false,
3010
3023
  "isVirtual": true,
3011
3024
  "intOracleAddress": "BeqYMCytDcEJrpikXhz8ZLaBb9ACGDVvmp9ekwbgBgma",
3012
- "extOracleAddress": "8nMThr5gWoXaoWHR3gMXrz8ZULukjsBgoW83kuYCDzqG",
3013
- "lazerId": 2691,
3014
- "pythTicker": "Commodities.WTIG6/USD",
3015
- "pythPriceId": "0x7e91242dfd2cea64715b26edaa3e51bafc712a56ac4228a77bd53b51fd66db52"
3025
+ "extOracleAddress": "4rriGpoRbLXkk7nJBxUCnBT474faTW9q8ACWW2v1Tdif",
3026
+ "lazerId": 2315,
3027
+ "pythTicker": "Commodities.WTIF6/USD",
3028
+ "pythPriceId": "0x0f402711648215fd68b3ac1deafc9f7edd072d59fbfd0ac720c723d048e64908"
3029
+ },
3030
+ {
3031
+ "custodyId": 7,
3032
+ "custodyAccount": "8sriDinQT789N7AJrEtQ2Q1jvVm7jGHhkdw4zTLKZxGe",
3033
+ "tokenAccount": "DpnfaMR5kJhVyy5SGk6yB1JHXYuqJhsm53wdewd8gNd1",
3034
+ "symbol": "XAUt",
3035
+ "mintKey": "xaut1dB1uihYCwjReVgwZ4mBBJzwkXn4picqqmk4v2H",
3036
+ "decimals": 6,
3037
+ "usdPrecision": 4,
3038
+ "tokenPrecision": 4,
3039
+ "isStable": false,
3040
+ "isVirtual": false,
3041
+ "intOracleAddress": "6fCDXgCYMnY29RENXKE2yGxvtMVUCMU59kkmS212MjMc",
3042
+ "extOracleAddress": "6aLRPrkf5SM4mZdQCbb23YMZirN8bX7pqbbk1mZfb1s9",
3043
+ "lazerId": 172,
3044
+ "pythTicker": "Crypto.XAUT/USD",
3045
+ "pythPriceId": "0x44465e17d2e9d390e70c999d5a11fda4f092847fcd2e3e5aa089d96c98a30e67"
3016
3046
  }
3017
3047
  ],
3018
3048
  "markets": [
@@ -3175,6 +3205,22 @@
3175
3205
  "collateralCustodyId": 0,
3176
3206
  "targetMint": "oi1DkCGa5CVm379ZuznLMevqjg7KGWnDDFB96JXAi7a",
3177
3207
  "collateralMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr"
3208
+ },
3209
+ {
3210
+ "marketId": 12,
3211
+ "marketAccount": "HCHwtnbLgZPPkYqrbXF1oF688dxHW6cbhfU7yFLgfCpY",
3212
+ "marketCorrelation": true,
3213
+ "pool": "Ar7yp9PJkRpvXasLB4NYdbDHnuvAZ1gDA8ALnkPKivbb",
3214
+ "targetCustody": "EXumu4qqjXYpv1RUzTGiVJAvjvL3BWzn592SSwxrtZwW",
3215
+ "collateralCustody": "8sriDinQT789N7AJrEtQ2Q1jvVm7jGHhkdw4zTLKZxGe",
3216
+ "side": "long",
3217
+ "maxLev": 50,
3218
+ "degenMinLev": 1,
3219
+ "degenMaxLev": 50,
3220
+ "targetCustodyId": 6,
3221
+ "collateralCustodyId": 0,
3222
+ "targetMint": "xaucSYSxjZF4EbsLqAGRvPcuD1uXAj9awmsxYkUAavx",
3223
+ "collateralMint": "xaut1dB1uihYCwjReVgwZ4mBBJzwkXn4picqqmk4v2H"
3178
3224
  }
3179
3225
  ]
3180
3226
  },
@@ -896,35 +896,6 @@ export type Perpetuals = {
896
896
  ];
897
897
  "returns": "u8";
898
898
  },
899
- {
900
- "name": "setFlpStakeConfig";
901
- "accounts": [
902
- {
903
- "name": "admin";
904
- "isMut": true;
905
- "isSigner": true;
906
- },
907
- {
908
- "name": "multisig";
909
- "isMut": true;
910
- "isSigner": false;
911
- },
912
- {
913
- "name": "flpStakeAccount";
914
- "isMut": true;
915
- "isSigner": false;
916
- }
917
- ];
918
- "args": [
919
- {
920
- "name": "params";
921
- "type": {
922
- "defined": "SetFlpStakeConfigParams";
923
- };
924
- }
925
- ];
926
- "returns": "u8";
927
- },
928
899
  {
929
900
  "name": "setTokenReward";
930
901
  "accounts": [
@@ -1248,79 +1219,6 @@ export type Perpetuals = {
1248
1219
  ];
1249
1220
  "returns": "u8";
1250
1221
  },
1251
- {
1252
- "name": "updateCustody";
1253
- "accounts": [
1254
- {
1255
- "name": "admin";
1256
- "isMut": true;
1257
- "isSigner": true;
1258
- },
1259
- {
1260
- "name": "multisig";
1261
- "isMut": true;
1262
- "isSigner": false;
1263
- },
1264
- {
1265
- "name": "pool";
1266
- "isMut": true;
1267
- "isSigner": false;
1268
- },
1269
- {
1270
- "name": "custody";
1271
- "isMut": true;
1272
- "isSigner": false;
1273
- },
1274
- {
1275
- "name": "systemProgram";
1276
- "isMut": false;
1277
- "isSigner": false;
1278
- }
1279
- ];
1280
- "args": [
1281
- {
1282
- "name": "params";
1283
- "type": {
1284
- "defined": "UpdateCustodyParams";
1285
- };
1286
- }
1287
- ];
1288
- "returns": "u8";
1289
- },
1290
- {
1291
- "name": "updateTokenRatios";
1292
- "accounts": [
1293
- {
1294
- "name": "admin";
1295
- "isMut": true;
1296
- "isSigner": true;
1297
- },
1298
- {
1299
- "name": "multisig";
1300
- "isMut": true;
1301
- "isSigner": false;
1302
- },
1303
- {
1304
- "name": "perpetuals";
1305
- "isMut": false;
1306
- "isSigner": false;
1307
- },
1308
- {
1309
- "name": "pool";
1310
- "isMut": true;
1311
- "isSigner": false;
1312
- }
1313
- ];
1314
- "args": [
1315
- {
1316
- "name": "params";
1317
- "type": {
1318
- "defined": "UpdateTokenRatiosParams";
1319
- };
1320
- }
1321
- ];
1322
- "returns": "u8";
1323
- },
1324
1222
  {
1325
1223
  "name": "initStaking";
1326
1224
  "accounts": [
@@ -1952,6 +1850,149 @@ export type Perpetuals = {
1952
1850
  ];
1953
1851
  "returns": "u8";
1954
1852
  },
1853
+ {
1854
+ "name": "migrateXauPosition";
1855
+ "accounts": [
1856
+ {
1857
+ "name": "feePayer";
1858
+ "isMut": true;
1859
+ "isSigner": true;
1860
+ },
1861
+ {
1862
+ "name": "perpetuals";
1863
+ "isMut": false;
1864
+ "isSigner": false;
1865
+ },
1866
+ {
1867
+ "name": "pool";
1868
+ "isMut": false;
1869
+ "isSigner": false;
1870
+ },
1871
+ {
1872
+ "name": "oldPosition";
1873
+ "isMut": true;
1874
+ "isSigner": false;
1875
+ },
1876
+ {
1877
+ "name": "oldMarket";
1878
+ "isMut": true;
1879
+ "isSigner": false;
1880
+ },
1881
+ {
1882
+ "name": "oldCollateralCustody";
1883
+ "isMut": true;
1884
+ "isSigner": false;
1885
+ },
1886
+ {
1887
+ "name": "oldCollateralOracleAccount";
1888
+ "isMut": false;
1889
+ "isSigner": false;
1890
+ },
1891
+ {
1892
+ "name": "newPosition";
1893
+ "isMut": true;
1894
+ "isSigner": false;
1895
+ },
1896
+ {
1897
+ "name": "newMarket";
1898
+ "isMut": true;
1899
+ "isSigner": false;
1900
+ },
1901
+ {
1902
+ "name": "newCollateralCustody";
1903
+ "isMut": true;
1904
+ "isSigner": false;
1905
+ },
1906
+ {
1907
+ "name": "newCollateralOracleAccount";
1908
+ "isMut": false;
1909
+ "isSigner": false;
1910
+ },
1911
+ {
1912
+ "name": "eventAuthority";
1913
+ "isMut": false;
1914
+ "isSigner": false;
1915
+ },
1916
+ {
1917
+ "name": "program";
1918
+ "isMut": false;
1919
+ "isSigner": false;
1920
+ },
1921
+ {
1922
+ "name": "ixSysvar";
1923
+ "isMut": false;
1924
+ "isSigner": false;
1925
+ },
1926
+ {
1927
+ "name": "systemProgram";
1928
+ "isMut": false;
1929
+ "isSigner": false;
1930
+ }
1931
+ ];
1932
+ "args": [
1933
+ {
1934
+ "name": "params";
1935
+ "type": {
1936
+ "defined": "MigrateXauPositionParams";
1937
+ };
1938
+ }
1939
+ ];
1940
+ "returns": "u8";
1941
+ },
1942
+ {
1943
+ "name": "migrateXauOrder";
1944
+ "accounts": [
1945
+ {
1946
+ "name": "feePayer";
1947
+ "isMut": true;
1948
+ "isSigner": true;
1949
+ },
1950
+ {
1951
+ "name": "oldOrder";
1952
+ "isMut": true;
1953
+ "isSigner": false;
1954
+ },
1955
+ {
1956
+ "name": "oldMarket";
1957
+ "isMut": false;
1958
+ "isSigner": false;
1959
+ },
1960
+ {
1961
+ "name": "newOrder";
1962
+ "isMut": true;
1963
+ "isSigner": false;
1964
+ },
1965
+ {
1966
+ "name": "newMarket";
1967
+ "isMut": false;
1968
+ "isSigner": false;
1969
+ },
1970
+ {
1971
+ "name": "program";
1972
+ "isMut": false;
1973
+ "isSigner": false;
1974
+ },
1975
+ {
1976
+ "name": "ixSysvar";
1977
+ "isMut": false;
1978
+ "isSigner": false;
1979
+ },
1980
+ {
1981
+ "name": "systemProgram";
1982
+ "isMut": false;
1983
+ "isSigner": false;
1984
+ }
1985
+ ];
1986
+ "args": [
1987
+ {
1988
+ "name": "params";
1989
+ "type": {
1990
+ "defined": "MigrateXauOrderParams";
1991
+ };
1992
+ }
1993
+ ];
1994
+ "returns": "u8";
1995
+ },
1955
1996
  {
1956
1997
  "name": "testInit";
1957
1998
  "accounts": [
@@ -4162,12 +4203,12 @@ export type Perpetuals = {
4162
4203
  "isSigner": false;
4163
4204
  },
4164
4205
  {
4165
- "name": "custody";
4206
+ "name": "rewardCustody";
4166
4207
  "isMut": true;
4167
4208
  "isSigner": false;
4168
4209
  },
4169
4210
  {
4170
- "name": "custodyTokenAccount";
4211
+ "name": "rewardCustodyTokenAccount";
4171
4212
  "isMut": true;
4172
4213
  "isSigner": false;
4173
4214
  },
@@ -9242,6 +9283,20 @@ export type Perpetuals = {
9242
9283
  ];
9243
9284
  };
9244
9285
  },
9286
+ {
9287
+ "name": "MigrateXauOrderParams";
9288
+ "type": {
9289
+ "kind": "struct";
9290
+ "fields": [];
9291
+ };
9292
+ },
9293
+ {
9294
+ "name": "MigrateXauPositionParams";
9295
+ "type": {
9296
+ "kind": "struct";
9297
+ "fields": [];
9298
+ };
9299
+ },
9245
9300
  {
9246
9301
  "name": "OpenPositionParams";
9247
9302
  "type": {
@@ -9585,18 +9640,6 @@ export type Perpetuals = {
9585
9640
  ];
9586
9641
  };
9587
9642
  },
9588
- {
9589
- "name": "SetFlpStakeConfigParams";
9590
- "type": {
9591
- "kind": "struct";
9592
- "fields": [
9593
- {
9594
- "name": "feeShareBps";
9595
- "type": "u64";
9596
- }
9597
- ];
9598
- };
9599
- },
9600
9643
  {
9601
9644
  "name": "SetInternalCurrentPriceParams";
9602
9645
  "type": {
@@ -10047,38 +10090,6 @@ export type Perpetuals = {
10047
10090
  ];
10048
10091
  };
10049
10092
  },
10050
- {
10051
- "name": "UpdateCustodyParams";
10052
- "type": {
10053
- "kind": "struct";
10054
- "fields": [
10055
- {
10056
- "name": "minReserveUsd";
10057
- "type": "u64";
10058
- },
10059
- {
10060
- "name": "limitPriceBufferBps";
10061
- "type": "u64";
10062
- }
10063
- ];
10064
- };
10065
- },
10066
- {
10067
- "name": "UpdateTokenRatiosParams";
10068
- "type": {
10069
- "kind": "struct";
10070
- "fields": [
10071
- {
10072
- "name": "ratios";
10073
- "type": {
10074
- "vec": {
10075
- "defined": "TokenRatios";
10076
- };
10077
- };
10078
- }
10079
- ];
10080
- };
10081
- },
10082
10093
  {
10083
10094
  "name": "WithdrawFeesParams";
10084
10095
  "type": {
@@ -15381,6 +15392,66 @@ export type Perpetuals = {
15381
15392
  }
15382
15393
  ];
15383
15394
  },
15395
+ {
15396
+ "name": "MigrateXauPositionLog";
15397
+ "fields": [
15398
+ {
15399
+ "name": "owner";
15400
+ "type": "publicKey";
15401
+ "index": false;
15402
+ },
15403
+ {
15404
+ "name": "market";
15405
+ "type": "publicKey";
15406
+ "index": false;
15407
+ },
15408
+ {
15409
+ "name": "position";
15410
+ "type": "publicKey";
15411
+ "index": false;
15412
+ },
15413
+ {
15414
+ "name": "entryPrice";
15415
+ "type": "u64";
15416
+ "index": false;
15417
+ },
15418
+ {
15419
+ "name": "entryPriceExponent";
15420
+ "type": "i32";
15421
+ "index": false;
15422
+ },
15423
+ {
15424
+ "name": "sizeAmount";
15425
+ "type": "u64";
15426
+ "index": false;
15427
+ },
15428
+ {
15429
+ "name": "sizeUsd";
15430
+ "type": "u64";
15431
+ "index": false;
15432
+ },
15433
+ {
15434
+ "name": "collateralAmount";
15435
+ "type": "u64";
15436
+ "index": false;
15437
+ },
15438
+ {
15439
+ "name": "collateralUsd";
15440
+ "type": "u64";
15441
+ "index": false;
15442
+ },
15443
+ {
15444
+ "name": "collateralPrice";
15445
+ "type": "u64";
15446
+ "index": false;
15447
+ },
15448
+ {
15449
+ "name": "collateralPriceExponent";
15450
+ "type": "i32";
15451
+ "index": false;
15452
+ }
15453
+ ];
15454
+ },
15384
15455
  {
15385
15456
  "name": "MoveProtocolFeesLog";
15386
15457
  "fields": [