flash-sdk 2.5.6 → 2.6.2

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.
@@ -47,9 +47,9 @@ export declare class PerpetualsClient {
47
47
  };
48
48
  private postSendTxCallback?;
49
49
  private prioritizationFee;
50
- private useCustomOracle;
50
+ private useExtOracleAccount;
51
51
  private txConfirmationCommitment;
52
- constructor(provider: AnchorProvider, programId: PublicKey, composabilityProgramId: PublicKey, fbNftRewardProgramId: PublicKey, opts: PerpClientOptions, useCustomOracle?: boolean);
52
+ constructor(provider: AnchorProvider, programId: PublicKey, composabilityProgramId: PublicKey, fbNftRewardProgramId: PublicKey, opts: PerpClientOptions, useExtOracleAccount?: boolean);
53
53
  setPrioritizationFee: (fee: number) => void;
54
54
  loadAddressLookupTable: (poolConfig: PoolConfig) => Promise<void>;
55
55
  findProgramAddress: (label: string, extraSeeds?: any) => {
@@ -71,8 +71,8 @@ export declare class PerpetualsClient {
71
71
  isVirtual: boolean;
72
72
  distributeRewards: boolean;
73
73
  oracle: {
74
- oracleAccount: PublicKey;
75
- customOracleAccount: PublicKey;
74
+ intOracleAccount: PublicKey;
75
+ extOracleAccount: PublicKey;
76
76
  oracleType: {
77
77
  none?: Record<string, never>;
78
78
  custom?: Record<string, never>;
@@ -332,8 +332,8 @@ export declare class PerpetualsClient {
332
332
  isVirtual: boolean;
333
333
  distributeRewards: boolean;
334
334
  oracle: {
335
- oracleAccount: PublicKey;
336
- customOracleAccount: PublicKey;
335
+ intOracleAccount: PublicKey;
336
+ extOracleAccount: PublicKey;
337
337
  oracleType: {
338
338
  none?: Record<string, never>;
339
339
  custom?: Record<string, never>;
@@ -592,8 +592,8 @@ export declare class PerpetualsClient {
592
592
  isVirtual: boolean;
593
593
  distributeRewards: boolean;
594
594
  oracle: {
595
- oracleAccount: PublicKey;
596
- customOracleAccount: PublicKey;
595
+ intOracleAccount: PublicKey;
596
+ extOracleAccount: PublicKey;
597
597
  oracleType: {
598
598
  none?: Record<string, never>;
599
599
  custom?: Record<string, never>;
@@ -855,8 +855,8 @@ export declare class PerpetualsClient {
855
855
  isVirtual: boolean;
856
856
  distributeRewards: boolean;
857
857
  oracle: {
858
- oracleAccount: PublicKey;
859
- customOracleAccount: PublicKey;
858
+ intOracleAccount: PublicKey;
859
+ extOracleAccount: PublicKey;
860
860
  oracleType: {
861
861
  none?: Record<string, never>;
862
862
  custom?: Record<string, never>;
@@ -1117,8 +1117,8 @@ export declare class PerpetualsClient {
1117
1117
  isVirtual: boolean;
1118
1118
  distributeRewards: boolean;
1119
1119
  oracle: {
1120
- oracleAccount: PublicKey;
1121
- customOracleAccount: PublicKey;
1120
+ intOracleAccount: PublicKey;
1121
+ extOracleAccount: PublicKey;
1122
1122
  oracleType: {
1123
1123
  none?: Record<string, never>;
1124
1124
  custom?: Record<string, never>;
@@ -1377,8 +1377,8 @@ export declare class PerpetualsClient {
1377
1377
  isVirtual: boolean;
1378
1378
  distributeRewards: boolean;
1379
1379
  oracle: {
1380
- oracleAccount: PublicKey;
1381
- customOracleAccount: PublicKey;
1380
+ intOracleAccount: PublicKey;
1381
+ extOracleAccount: PublicKey;
1382
1382
  oracleType: {
1383
1383
  none?: Record<string, never>;
1384
1384
  custom?: Record<string, never>;
@@ -1670,8 +1670,8 @@ export declare class PerpetualsClient {
1670
1670
  isVirtual: boolean;
1671
1671
  distributeRewards: boolean;
1672
1672
  oracle: {
1673
- oracleAccount: PublicKey;
1674
- customOracleAccount: PublicKey;
1673
+ intOracleAccount: PublicKey;
1674
+ extOracleAccount: PublicKey;
1675
1675
  oracleType: {
1676
1676
  none?: Record<string, never>;
1677
1677
  custom?: Record<string, never>;
@@ -1930,8 +1930,8 @@ export declare class PerpetualsClient {
1930
1930
  isVirtual: boolean;
1931
1931
  distributeRewards: boolean;
1932
1932
  oracle: {
1933
- oracleAccount: PublicKey;
1934
- customOracleAccount: PublicKey;
1933
+ intOracleAccount: PublicKey;
1934
+ extOracleAccount: PublicKey;
1935
1935
  oracleType: {
1936
1936
  none?: Record<string, never>;
1937
1937
  custom?: Record<string, never>;
@@ -2379,7 +2379,15 @@ export declare class PerpetualsClient {
2379
2379
  instructions: TransactionInstruction[];
2380
2380
  additionalSigners: Signer[];
2381
2381
  }>;
2382
- reimburse: (poolName: string, tokenMint: PublicKey, amountIn: BN, poolConfig: PoolConfig) => Promise<{
2382
+ reimburse: (tokenMint: PublicKey, amountIn: BN, poolConfig: PoolConfig) => Promise<{
2383
+ instructions: TransactionInstruction[];
2384
+ additionalSigners: Signer[];
2385
+ }>;
2386
+ setCustomOraclePrice: (tokenMint: PublicKey, price: BN, expo: number, conf: BN, ema: BN, publishTime: BN, poolConfig: PoolConfig) => Promise<{
2387
+ instructions: TransactionInstruction[];
2388
+ additionalSigners: Signer[];
2389
+ }>;
2390
+ setInternalOraclePrice: (tokenMint: PublicKey, price: BN, expo: number, conf: BN, ema: BN, publishTime: BN, poolConfig: PoolConfig) => Promise<{
2383
2391
  instructions: TransactionInstruction[];
2384
2392
  additionalSigners: Signer[];
2385
2393
  }>;
@@ -77,8 +77,8 @@ var constants_1 = require("./constants");
77
77
  var bignumber_js_1 = __importDefault(require("bignumber.js"));
78
78
  var getNftAccounts_1 = require("./utils/getNftAccounts");
79
79
  var PerpetualsClient = (function () {
80
- function PerpetualsClient(provider, programId, composabilityProgramId, fbNftRewardProgramId, opts, useCustomOracle) {
81
- if (useCustomOracle === void 0) { useCustomOracle = false; }
80
+ function PerpetualsClient(provider, programId, composabilityProgramId, fbNftRewardProgramId, opts, useExtOracleAccount) {
81
+ if (useExtOracleAccount === void 0) { useExtOracleAccount = false; }
82
82
  var _this = this;
83
83
  var _a;
84
84
  this.addressLookupTables = [];
@@ -559,9 +559,9 @@ var PerpetualsClient = (function () {
559
559
  position: positionAccount,
560
560
  market: marketPk,
561
561
  targetCustody: targetCustodyConfig.custodyAccount,
562
- targetOracleAccount: this.useCustomOracle ? targetCustodyConfig.customOracleAddress : targetCustodyConfig.oracleAddress,
562
+ targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
563
563
  collateralCustody: collateralCustodyConfig.custodyAccount,
564
- collateralOracleAccount: this.useCustomOracle ? collateralCustodyConfig.customOracleAddress : collateralCustodyConfig.oracleAddress,
564
+ collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
565
565
  eventAuthority: this.eventAuthority.publicKey,
566
566
  program: this.program.programId,
567
567
  ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
@@ -1695,9 +1695,9 @@ var PerpetualsClient = (function () {
1695
1695
  position: positionAccount,
1696
1696
  market: marketAccount,
1697
1697
  targetCustody: targetCustodyConfig.custodyAccount,
1698
- targetOracleAccount: this.useCustomOracle ? targetCustodyConfig.customOracleAddress : targetCustodyConfig.oracleAddress,
1698
+ targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
1699
1699
  collateralCustody: collateralCustodyConfig.custodyAccount,
1700
- collateralOracleAccount: this.useCustomOracle ? collateralCustodyConfig.customOracleAddress : collateralCustodyConfig.oracleAddress,
1700
+ collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
1701
1701
  collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
1702
1702
  systemProgram: web3_js_1.SystemProgram.programId,
1703
1703
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
@@ -1806,7 +1806,7 @@ var PerpetualsClient = (function () {
1806
1806
  isWritable: false,
1807
1807
  });
1808
1808
  custodyOracleAccountMetas.push({
1809
- pubkey: this.useCustomOracle ? custody.customOracleAddress : custody.oracleAddress,
1809
+ pubkey: this.useExtOracleAccount ? custody.extOracleAccount : custody.intOracleAccount,
1810
1810
  isSigner: false,
1811
1811
  isWritable: false,
1812
1812
  });
@@ -1828,18 +1828,18 @@ var PerpetualsClient = (function () {
1828
1828
  perpetuals: swapPoolConfig.perpetuals,
1829
1829
  swapPool: swapPoolConfig.poolAddress,
1830
1830
  receivingCustody: swapInCustodyConfig.custodyAccount,
1831
- receivingCustodyOracleAccount: this.useCustomOracle ? swapInCustodyConfig.customOracleAddress : swapInCustodyConfig.oracleAddress,
1831
+ receivingCustodyOracleAccount: this.useExtOracleAccount ? swapInCustodyConfig.extOracleAccount : swapInCustodyConfig.intOracleAccount,
1832
1832
  receivingCustodyTokenAccount: swapInCustodyConfig.tokenAccount,
1833
1833
  dispensingCustody: swapOutCustodyConfig.custodyAccount,
1834
- dispensingCustodyOracleAccount: this.useCustomOracle ? swapOutCustodyConfig.customOracleAddress : swapOutCustodyConfig.oracleAddress,
1834
+ dispensingCustodyOracleAccount: this.useExtOracleAccount ? swapOutCustodyConfig.extOracleAccount : swapOutCustodyConfig.intOracleAccount,
1835
1835
  dispensingCustodyTokenAccount: swapOutCustodyConfig.tokenAccount,
1836
1836
  positionPool: positionPoolConfig.poolAddress,
1837
1837
  position: positionAccount,
1838
1838
  market: marketAccount,
1839
1839
  targetCustody: targetCustodyConfig.custodyAccount,
1840
- targetOracleAccount: this.useCustomOracle ? targetCustodyConfig.customOracleAddress : targetCustodyConfig.oracleAddress,
1840
+ targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
1841
1841
  collateralCustody: collateralCustodyConfig.custodyAccount,
1842
- collateralOracleAccount: this.useCustomOracle ? collateralCustodyConfig.customOracleAddress : collateralCustodyConfig.oracleAddress,
1842
+ collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
1843
1843
  collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
1844
1844
  eventAuthority: this.eventAuthority.publicKey,
1845
1845
  systemProgram: web3_js_1.SystemProgram.programId,
@@ -1930,9 +1930,9 @@ var PerpetualsClient = (function () {
1930
1930
  position: positionAccount,
1931
1931
  market: marketAccount,
1932
1932
  targetCustody: targetCustodyConfig.custodyAccount,
1933
- targetOracleAccount: this.useCustomOracle ? targetCustodyConfig.customOracleAddress : targetCustodyConfig.oracleAddress,
1933
+ targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
1934
1934
  collateralCustody: collateralCustodyConfig.custodyAccount,
1935
- collateralOracleAccount: this.useCustomOracle ? collateralCustodyConfig.customOracleAddress : collateralCustodyConfig.oracleAddress,
1935
+ collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
1936
1936
  collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
1937
1937
  eventAuthority: this.eventAuthority.publicKey,
1938
1938
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
@@ -2027,7 +2027,7 @@ var PerpetualsClient = (function () {
2027
2027
  isWritable: false,
2028
2028
  });
2029
2029
  custodyOracleAccountMetas.push({
2030
- pubkey: this.useCustomOracle ? custody.customOracleAddress : custody.oracleAddress,
2030
+ pubkey: this.useExtOracleAccount ? custody.extOracleAccount : custody.intOracleAccount,
2031
2031
  isSigner: false,
2032
2032
  isWritable: false,
2033
2033
  });
@@ -2047,18 +2047,18 @@ var PerpetualsClient = (function () {
2047
2047
  perpetuals: swapPoolConfig.perpetuals,
2048
2048
  swapPool: swapPoolConfig.poolAddress,
2049
2049
  receivingCustody: swapInCustodyConfig.custodyAccount,
2050
- receivingCustodyOracleAccount: this.useCustomOracle ? swapInCustodyConfig.customOracleAddress : swapInCustodyConfig.oracleAddress,
2050
+ receivingCustodyOracleAccount: this.useExtOracleAccount ? swapInCustodyConfig.extOracleAccount : swapInCustodyConfig.intOracleAccount,
2051
2051
  receivingCustodyTokenAccount: swapInCustodyConfig.tokenAccount,
2052
2052
  dispensingCustody: swapOutCustodyConfig.custodyAccount,
2053
- dispensingCustodyOracleAccount: this.useCustomOracle ? swapOutCustodyConfig.customOracleAddress : swapOutCustodyConfig.oracleAddress,
2053
+ dispensingCustodyOracleAccount: this.useExtOracleAccount ? swapOutCustodyConfig.extOracleAccount : swapOutCustodyConfig.intOracleAccount,
2054
2054
  dispensingCustodyTokenAccount: swapOutCustodyConfig.tokenAccount,
2055
2055
  positionPool: positionPoolConfig.poolAddress,
2056
2056
  position: positionAccount,
2057
2057
  market: marketAccount,
2058
2058
  targetCustody: targetCustodyConfig.custodyAccount,
2059
- targetOracleAccount: this.useCustomOracle ? targetCustodyConfig.customOracleAddress : targetCustodyConfig.oracleAddress,
2059
+ targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
2060
2060
  collateralCustody: collateralCustodyConfig.custodyAccount,
2061
- collateralOracleAccount: this.useCustomOracle ? collateralCustodyConfig.customOracleAddress : collateralCustodyConfig.oracleAddress,
2061
+ collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
2062
2062
  collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
2063
2063
  eventAuthority: this.eventAuthority.publicKey,
2064
2064
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
@@ -2232,7 +2232,7 @@ var PerpetualsClient = (function () {
2232
2232
  isWritable: false,
2233
2233
  });
2234
2234
  custodyOracleAccountMetas.push({
2235
- pubkey: this.useCustomOracle ? custody.customOracleAddress : custody.oracleAddress,
2235
+ pubkey: this.useExtOracleAccount ? custody.extOracleAccount : custody.intOracleAccount,
2236
2236
  isSigner: false,
2237
2237
  isWritable: false,
2238
2238
  });
@@ -2252,10 +2252,10 @@ var PerpetualsClient = (function () {
2252
2252
  perpetuals: poolConfig.perpetuals,
2253
2253
  pool: poolConfig.poolAddress,
2254
2254
  receivingCustody: userInputCustodyConfig.custodyAccount,
2255
- receivingCustodyOracleAccount: this.useCustomOracle ? userInputCustodyConfig.customOracleAddress : userInputCustodyConfig.oracleAddress,
2255
+ receivingCustodyOracleAccount: this.useExtOracleAccount ? userInputCustodyConfig.extOracleAccount : userInputCustodyConfig.intOracleAccount,
2256
2256
  receivingCustodyTokenAccount: userInputCustodyConfig.tokenAccount,
2257
2257
  dispensingCustody: userOutputCustodyConfig.custodyAccount,
2258
- dispensingCustodyOracleAccount: this.useCustomOracle ? userOutputCustodyConfig.customOracleAddress : userOutputCustodyConfig.oracleAddress,
2258
+ dispensingCustodyOracleAccount: this.useExtOracleAccount ? userOutputCustodyConfig.extOracleAccount : userOutputCustodyConfig.intOracleAccount,
2259
2259
  dispensingCustodyTokenAccount: userOutputCustodyConfig.tokenAccount,
2260
2260
  eventAuthority: this.eventAuthority.publicKey,
2261
2261
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
@@ -2362,9 +2362,9 @@ var PerpetualsClient = (function () {
2362
2362
  perpetuals: poolConfig.perpetuals,
2363
2363
  pool: poolConfig.poolAddress,
2364
2364
  targetCustody: targetCustodyConfig.custodyAccount,
2365
- targetOracleAccount: this.useCustomOracle ? targetCustodyConfig.customOracleAddress : targetCustodyConfig.oracleAddress,
2365
+ targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
2366
2366
  collateralCustody: collateralCustodyConfig.custodyAccount,
2367
- collateralOracleAccount: this.useCustomOracle ? collateralCustodyConfig.customOracleAddress : collateralCustodyConfig.oracleAddress,
2367
+ collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
2368
2368
  collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
2369
2369
  eventAuthority: this.eventAuthority.publicKey,
2370
2370
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
@@ -2469,7 +2469,7 @@ var PerpetualsClient = (function () {
2469
2469
  isWritable: false,
2470
2470
  });
2471
2471
  custodyOracleAccountMetas.push({
2472
- pubkey: this.useCustomOracle ? custody.customOracleAddress : custody.oracleAddress,
2472
+ pubkey: this.useExtOracleAccount ? custody.extOracleAccount : custody.intOracleAccount,
2473
2473
  isSigner: false,
2474
2474
  isWritable: false,
2475
2475
  });
@@ -2487,18 +2487,18 @@ var PerpetualsClient = (function () {
2487
2487
  perpetuals: poolConfigSwap.perpetuals,
2488
2488
  swapPool: poolConfigSwap.poolAddress,
2489
2489
  receivingCustody: inputCustodyConfig.custodyAccount,
2490
- receivingCustodyOracleAccount: this.useCustomOracle ? inputCustodyConfig.customOracleAddress : inputCustodyConfig.oracleAddress,
2490
+ receivingCustodyOracleAccount: this.useExtOracleAccount ? inputCustodyConfig.extOracleAccount : inputCustodyConfig.intOracleAccount,
2491
2491
  receivingCustodyTokenAccount: inputCustodyConfig.tokenAccount,
2492
2492
  dispensingCustody: outputCustodyConfig.custodyAccount,
2493
- dispensingCustodyOracleAccount: this.useCustomOracle ? outputCustodyConfig.customOracleAddress : outputCustodyConfig.oracleAddress,
2493
+ dispensingCustodyOracleAccount: this.useExtOracleAccount ? outputCustodyConfig.extOracleAccount : outputCustodyConfig.intOracleAccount,
2494
2494
  dispensingCustodyTokenAccount: outputCustodyConfig.tokenAccount,
2495
2495
  positionPool: poolConfigPosition.poolAddress,
2496
2496
  position: positionPubKey,
2497
2497
  market: marketAccount,
2498
2498
  targetCustody: targetCustodyConfig.custodyAccount,
2499
- targetOracleAccount: this.useCustomOracle ? targetCustodyConfig.customOracleAddress : targetCustodyConfig.oracleAddress,
2499
+ targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
2500
2500
  collateralCustody: collateralCustodyConfig.custodyAccount,
2501
- collateralOracleAccount: this.useCustomOracle ? collateralCustodyConfig.customOracleAddress : collateralCustodyConfig.oracleAddress,
2501
+ collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
2502
2502
  collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
2503
2503
  eventAuthority: this.eventAuthority.publicKey,
2504
2504
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
@@ -2594,9 +2594,9 @@ var PerpetualsClient = (function () {
2594
2594
  position: positionPubKey,
2595
2595
  market: marketAccount,
2596
2596
  targetCustody: targetCustodyConfig.custodyAccount,
2597
- targetOracleAccount: this.useCustomOracle ? targetCustodyConfig.customOracleAddress : targetCustodyConfig.oracleAddress,
2597
+ targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
2598
2598
  collateralCustody: collateralCustodyConfig.custodyAccount,
2599
- collateralOracleAccount: this.useCustomOracle ? collateralCustodyConfig.customOracleAddress : collateralCustodyConfig.oracleAddress,
2599
+ collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
2600
2600
  collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
2601
2601
  eventAuthority: this.eventAuthority.publicKey,
2602
2602
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
@@ -2690,7 +2690,7 @@ var PerpetualsClient = (function () {
2690
2690
  isWritable: false,
2691
2691
  });
2692
2692
  custodyOracleAccountMetas.push({
2693
- pubkey: this.useCustomOracle ? custody.customOracleAddress : custody.oracleAddress,
2693
+ pubkey: this.useExtOracleAccount ? custody.extOracleAccount : custody.intOracleAccount,
2694
2694
  isSigner: false,
2695
2695
  isWritable: false,
2696
2696
  });
@@ -2709,18 +2709,18 @@ var PerpetualsClient = (function () {
2709
2709
  perpetuals: poolConfigSwap.perpetuals,
2710
2710
  swapPool: poolConfigSwap.poolAddress,
2711
2711
  receivingCustody: inputCusotdyConfig.custodyAccount,
2712
- receivingCustodyOracleAccount: this.useCustomOracle ? inputCusotdyConfig.customOracleAddress : inputCusotdyConfig.oracleAddress,
2712
+ receivingCustodyOracleAccount: this.useExtOracleAccount ? inputCusotdyConfig.extOracleAccount : inputCusotdyConfig.intOracleAccount,
2713
2713
  receivingCustodyTokenAccount: inputCusotdyConfig.tokenAccount,
2714
2714
  dispensingCustody: outputCustodyConfig.custodyAccount,
2715
- dispensingCustodyOracleAccount: this.useCustomOracle ? outputCustodyConfig.customOracleAddress : outputCustodyConfig.oracleAddress,
2715
+ dispensingCustodyOracleAccount: this.useExtOracleAccount ? outputCustodyConfig.extOracleAccount : outputCustodyConfig.intOracleAccount,
2716
2716
  dispensingCustodyTokenAccount: outputCustodyConfig.tokenAccount,
2717
2717
  positionPool: poolConfigPosition.poolAddress,
2718
2718
  position: positionAccount,
2719
2719
  market: marketAccount,
2720
2720
  targetCustody: targetCustodyConfig.custodyAccount,
2721
- targetOracleAccount: this.useCustomOracle ? targetCustodyConfig.customOracleAddress : targetCustodyConfig.oracleAddress,
2721
+ targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
2722
2722
  collateralCustody: collateralCustodyConfig.custodyAccount,
2723
- collateralOracleAccount: this.useCustomOracle ? collateralCustodyConfig.customOracleAddress : collateralCustodyConfig.oracleAddress,
2723
+ collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
2724
2724
  collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
2725
2725
  eventAuthority: this.eventAuthority.publicKey,
2726
2726
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
@@ -2772,9 +2772,9 @@ var PerpetualsClient = (function () {
2772
2772
  position: positionPubKey,
2773
2773
  market: marketAccount,
2774
2774
  targetCustody: targetCustodyConfig.custodyAccount,
2775
- targetOracleAccount: this.useCustomOracle ? targetCustodyConfig.customOracleAddress : targetCustodyConfig.oracleAddress,
2775
+ targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
2776
2776
  collateralCustody: collateralCustodyConfig.custodyAccount,
2777
- collateralOracleAccount: this.useCustomOracle ? collateralCustodyConfig.customOracleAddress : collateralCustodyConfig.oracleAddress,
2777
+ collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
2778
2778
  collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
2779
2779
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
2780
2780
  eventAuthority: this.eventAuthority.publicKey,
@@ -2827,9 +2827,9 @@ var PerpetualsClient = (function () {
2827
2827
  position: positionPubKey,
2828
2828
  market: marketAccount,
2829
2829
  targetCustody: targetCustodyConfig.custodyAccount,
2830
- targetOracleAccount: this.useCustomOracle ? targetCustodyConfig.customOracleAddress : targetCustodyConfig.oracleAddress,
2830
+ targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
2831
2831
  collateralCustody: collateralCustodyConfig.custodyAccount,
2832
- collateralOracleAccount: this.useCustomOracle ? collateralCustodyConfig.customOracleAddress : collateralCustodyConfig.oracleAddress,
2832
+ collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
2833
2833
  collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
2834
2834
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
2835
2835
  eventAuthority: this.eventAuthority.publicKey,
@@ -2884,7 +2884,7 @@ var PerpetualsClient = (function () {
2884
2884
  isWritable: false,
2885
2885
  });
2886
2886
  custodyOracleAccountMetas.push({
2887
- pubkey: this.useCustomOracle ? custody.customOracleAddress : custody.oracleAddress,
2887
+ pubkey: this.useExtOracleAccount ? custody.extOracleAccount : custody.intOracleAccount,
2888
2888
  isSigner: false,
2889
2889
  isWritable: false,
2890
2890
  });
@@ -2959,7 +2959,7 @@ var PerpetualsClient = (function () {
2959
2959
  perpetuals: poolConfig.perpetuals,
2960
2960
  pool: poolConfig.poolAddress,
2961
2961
  custody: payTokenCustodyConfig.custodyAccount,
2962
- custodyOracleAccount: this.useCustomOracle ? payTokenCustodyConfig.customOracleAddress : payTokenCustodyConfig.oracleAddress,
2962
+ custodyOracleAccount: this.useExtOracleAccount ? payTokenCustodyConfig.extOracleAccount : payTokenCustodyConfig.intOracleAccount,
2963
2963
  custodyTokenAccount: payTokenCustodyConfig.tokenAccount,
2964
2964
  lpTokenMint: poolConfig.lpTokenMint,
2965
2965
  eventAuthority: this.eventAuthority.publicKey,
@@ -3020,7 +3020,7 @@ var PerpetualsClient = (function () {
3020
3020
  isWritable: false,
3021
3021
  });
3022
3022
  custodyOracleAccountMetas.push({
3023
- pubkey: this.useCustomOracle ? custody.customOracleAddress : custody.oracleAddress,
3023
+ pubkey: this.useExtOracleAccount ? custody.extOracleAccount : custody.intOracleAccount,
3024
3024
  isSigner: false,
3025
3025
  isWritable: false,
3026
3026
  });
@@ -3083,7 +3083,7 @@ var PerpetualsClient = (function () {
3083
3083
  perpetuals: poolConfig.perpetuals,
3084
3084
  pool: poolConfig.poolAddress,
3085
3085
  custody: recieveTokenCustodyConfig.custodyAccount,
3086
- custodyOracleAccount: this.useCustomOracle ? recieveTokenCustodyConfig.customOracleAddress : recieveTokenCustodyConfig.oracleAddress,
3086
+ custodyOracleAccount: this.useExtOracleAccount ? recieveTokenCustodyConfig.extOracleAccount : recieveTokenCustodyConfig.intOracleAccount,
3087
3087
  custodyTokenAccount: recieveTokenCustodyConfig.tokenAccount,
3088
3088
  lpTokenMint: poolConfig.lpTokenMint,
3089
3089
  eventAuthority: this.eventAuthority.publicKey,
@@ -4040,9 +4040,9 @@ var PerpetualsClient = (function () {
4040
4040
  position: positionAccount,
4041
4041
  market: marketAccount,
4042
4042
  targetCustody: targetCustodyConfig.custodyAccount,
4043
- targetOracleAccount: this.useCustomOracle ? targetCustodyConfig.customOracleAddress : targetCustodyConfig.oracleAddress,
4043
+ targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
4044
4044
  collateralCustody: collateralCustodyConfig.custodyAccount,
4045
- collateralOracleAccount: this.useCustomOracle ? collateralCustodyConfig.customOracleAddress : collateralCustodyConfig.oracleAddress,
4045
+ collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
4046
4046
  eventAuthority: this.eventAuthority.publicKey,
4047
4047
  program: this.programId,
4048
4048
  ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
@@ -4131,9 +4131,9 @@ var PerpetualsClient = (function () {
4131
4131
  position: positionAccount.publicKey,
4132
4132
  market: marketAccount,
4133
4133
  targetCustody: targetCustodyConfig.custodyAccount,
4134
- targetOracleAccount: this.useCustomOracle ? targetCustodyConfig.customOracleAddress : targetCustodyConfig.oracleAddress,
4134
+ targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
4135
4135
  collateralCustody: collateralCustodyConfig.custodyAccount,
4136
- collateralOracleAccount: this.useCustomOracle ? collateralCustodyConfig.customOracleAddress : collateralCustodyConfig.oracleAddress,
4136
+ collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
4137
4137
  collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
4138
4138
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
4139
4139
  eventAuthority: this.eventAuthority.publicKey,
@@ -4180,9 +4180,9 @@ var PerpetualsClient = (function () {
4180
4180
  position: position.publicKey,
4181
4181
  market: marketConfig.marketAccount,
4182
4182
  targetCustody: targetCustodyConfig.custodyAccount,
4183
- custodyOracleAccount: this.useCustomOracle ? targetCustodyConfig.customOracleAddress : targetCustodyConfig.oracleAddress,
4183
+ custodyOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
4184
4184
  collateralCustody: collateralCustodyConfig.custodyAccount,
4185
- collateralOracleAccount: this.useCustomOracle ? collateralCustodyConfig.customOracleAddress : collateralCustodyConfig.oracleAddress,
4185
+ collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
4186
4186
  ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
4187
4187
  })
4188
4188
  .view()];
@@ -4280,7 +4280,7 @@ var PerpetualsClient = (function () {
4280
4280
  }
4281
4281
  });
4282
4282
  }); };
4283
- this.reimburse = function (poolName, tokenMint, amountIn, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
4283
+ this.reimburse = function (tokenMint, amountIn, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
4284
4284
  var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e, err_26;
4285
4285
  var _f;
4286
4286
  return __generator(this, function (_g) {
@@ -4297,7 +4297,7 @@ var PerpetualsClient = (function () {
4297
4297
  isWritable: false,
4298
4298
  });
4299
4299
  custodyOracleAccountMetas.push({
4300
- pubkey: custody.customOracleAddress,
4300
+ pubkey: this.useExtOracleAccount ? custody.extOracleAccount : custody.intOracleAccount,
4301
4301
  isSigner: false,
4302
4302
  isWritable: false,
4303
4303
  });
@@ -4327,9 +4327,9 @@ var PerpetualsClient = (function () {
4327
4327
  return [4, (0, spl_token_1.getAssociatedTokenAddress)(tokenMint, this.provider.wallet.publicKey)];
4328
4328
  case 2: return [4, _e.apply(_d, [(_f.fundingAccount = _g.sent(),
4329
4329
  _f.perpetuals = poolConfig.perpetuals,
4330
- _f.pool = this.getPoolKey(poolName),
4331
- _f.custody = this.getCustodyKey(poolName, tokenMint),
4332
- _f.custodyOracleAccount = this.useCustomOracle ? custodyConfig.customOracleAddress : custodyConfig.oracleAddress,
4330
+ _f.pool = poolConfig.poolAddress,
4331
+ _f.custody = custodyConfig.custodyAccount,
4332
+ _f.custodyOracleAccount = this.useExtOracleAccount ? custodyConfig.extOracleAccount : custodyConfig.intOracleAccount,
4333
4333
  _f.custodyTokenAccount = custodyConfig.tokenAccount,
4334
4334
  _f.tokenProgram = spl_token_1.TOKEN_PROGRAM_ID,
4335
4335
  _f.program = poolConfig.programId,
@@ -4352,6 +4352,95 @@ var PerpetualsClient = (function () {
4352
4352
  }
4353
4353
  });
4354
4354
  }); };
4355
+ this.setCustomOraclePrice = function (tokenMint, price, expo, conf, ema, publishTime, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
4356
+ var instructions, additionalSigners, custodyConfig, setCustomOraclePrice, err_27;
4357
+ return __generator(this, function (_a) {
4358
+ switch (_a.label) {
4359
+ case 0:
4360
+ instructions = [];
4361
+ additionalSigners = [];
4362
+ custodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(tokenMint); });
4363
+ _a.label = 1;
4364
+ case 1:
4365
+ _a.trys.push([1, 3, , 4]);
4366
+ return [4, this.program.methods
4367
+ .setCustomOraclePrice({
4368
+ price: price,
4369
+ expo: expo,
4370
+ conf: conf,
4371
+ ema: ema,
4372
+ publishTime: publishTime,
4373
+ })
4374
+ .accounts({
4375
+ admin: this.provider.wallet.publicKey,
4376
+ multisig: poolConfig.multisig,
4377
+ perpetuals: poolConfig.perpetuals,
4378
+ pool: poolConfig.poolAddress,
4379
+ custody: custodyConfig.custodyAccount,
4380
+ intOracleAccount: custodyConfig.intOracleAccount,
4381
+ extOracleAccount: custodyConfig.extOracleAccount,
4382
+ systemProgram: web3_js_1.SystemProgram.programId,
4383
+ })
4384
+ .instruction()];
4385
+ case 2:
4386
+ setCustomOraclePrice = _a.sent();
4387
+ instructions.push(setCustomOraclePrice);
4388
+ return [3, 4];
4389
+ case 3:
4390
+ err_27 = _a.sent();
4391
+ console.log("perpClient setCustomOracleAccount error:: ", err_27);
4392
+ throw err_27;
4393
+ case 4: return [2, {
4394
+ instructions: __spreadArray([], instructions, true),
4395
+ additionalSigners: additionalSigners
4396
+ }];
4397
+ }
4398
+ });
4399
+ }); };
4400
+ this.setInternalOraclePrice = function (tokenMint, price, expo, conf, ema, publishTime, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
4401
+ var instructions, additionalSigners, custodyConfig, setInternalOraclePrice, err_28;
4402
+ return __generator(this, function (_a) {
4403
+ switch (_a.label) {
4404
+ case 0:
4405
+ instructions = [];
4406
+ additionalSigners = [];
4407
+ custodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(tokenMint); });
4408
+ _a.label = 1;
4409
+ case 1:
4410
+ _a.trys.push([1, 3, , 4]);
4411
+ return [4, this.program.methods
4412
+ .setInternalOraclePrice({
4413
+ price: price,
4414
+ expo: expo,
4415
+ conf: conf,
4416
+ ema: ema,
4417
+ publishTime: publishTime,
4418
+ })
4419
+ .accounts({
4420
+ authority: poolConfig.backupOracle,
4421
+ perpetuals: poolConfig.perpetuals,
4422
+ pool: poolConfig.poolAddress,
4423
+ custody: custodyConfig.custodyAccount,
4424
+ intOracleAccount: custodyConfig.intOracleAccount,
4425
+ extOracleAccount: custodyConfig.extOracleAccount,
4426
+ systemProgram: web3_js_1.SystemProgram.programId,
4427
+ })
4428
+ .instruction()];
4429
+ case 2:
4430
+ setInternalOraclePrice = _a.sent();
4431
+ instructions.push(setInternalOraclePrice);
4432
+ return [3, 4];
4433
+ case 3:
4434
+ err_28 = _a.sent();
4435
+ console.log("perpClient setInternalOracleAccount error:: ", err_28);
4436
+ throw err_28;
4437
+ case 4: return [2, {
4438
+ instructions: __spreadArray([], instructions, true),
4439
+ additionalSigners: additionalSigners
4440
+ }];
4441
+ }
4442
+ });
4443
+ }); };
4355
4444
  this.provider = provider;
4356
4445
  (0, anchor_1.setProvider)(provider);
4357
4446
  this.program = new anchor_1.Program(perpetuals_1.IDL, programId);
@@ -4365,7 +4454,7 @@ var PerpetualsClient = (function () {
4365
4454
  this.perpetuals = this.findProgramAddress("perpetuals");
4366
4455
  this.eventAuthority = this.findProgramAddress("__event_authority");
4367
4456
  this.prioritizationFee = (opts === null || opts === void 0 ? void 0 : opts.prioritizationFee) || 0;
4368
- this.useCustomOracle = useCustomOracle;
4457
+ this.useExtOracleAccount = useExtOracleAccount;
4369
4458
  this.postSendTxCallback = opts === null || opts === void 0 ? void 0 : opts.postSendTxCallback;
4370
4459
  this.txConfirmationCommitment = (_a = opts === null || opts === void 0 ? void 0 : opts.txConfirmationCommitment) !== null && _a !== void 0 ? _a : 'processed';
4371
4460
  anchor_1.BN.prototype.toJSON = function () {
@@ -13,8 +13,8 @@ export interface CustodyConfig {
13
13
  tokenPrecision: number;
14
14
  isStable: boolean;
15
15
  isVirtual: boolean;
16
- oracleAddress: PublicKey;
17
- customOracleAddress: PublicKey;
16
+ intOracleAccount: PublicKey;
17
+ extOracleAccount: PublicKey;
18
18
  pythTicker: string;
19
19
  pythPriceId: string;
20
20
  }
@@ -138,7 +138,7 @@ var PoolConfig = (function () {
138
138
  var custodies;
139
139
  try {
140
140
  custodies = poolConfig['custodies'].map(function (i, index) {
141
- return __assign(__assign({}, i), { custodyId: i.custodyId, custodyAccount: new web3_js_1.PublicKey(i.custodyAccount), tokenAccount: new web3_js_1.PublicKey(i.tokenAccount), mintKey: new web3_js_1.PublicKey(i.mintKey), oracleAddress: new web3_js_1.PublicKey(i.oracleAddress), customOracleAddress: new web3_js_1.PublicKey(i.customOracleAddress), usdPrecision: i.usdPrecision, tokenPrecision: i.tokenPrecision });
141
+ return __assign(__assign({}, i), { custodyId: i.custodyId, custodyAccount: new web3_js_1.PublicKey(i.custodyAccount), tokenAccount: new web3_js_1.PublicKey(i.tokenAccount), mintKey: new web3_js_1.PublicKey(i.mintKey), intOracleAccount: new web3_js_1.PublicKey(i.intOracleAddress), extOracleAccount: new web3_js_1.PublicKey(i.extOracleAddress), usdPrecision: i.usdPrecision, tokenPrecision: i.tokenPrecision });
142
142
  });
143
143
  }
144
144
  catch (error) {