@0dotxyz/p0-ts-sdk 2.3.0-alpha.2 → 2.3.0-alpha.3

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/vendor.d.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  import * as _solana_web3_js from '@solana/web3.js';
2
2
  import { PublicKey, TransactionInstruction, Connection, Transaction, Commitment, AccountInfo, AccountMeta as AccountMeta$1, Signer, AddressLookupTableAccount } from '@solana/web3.js';
3
3
  import BigNumber$1 from 'bignumber.js';
4
- import { E as ExponentVault, R as ResolveExponentMergeContextParams, a as ExponentMergeContext, b as ExponentMergeAccounts } from './merge.types-Coz1eQZg.js';
5
- export { c as CrossbarSimulatePayload, C as CurrentResult, F as FeedResponse, O as OracleSubmission, P as PullFeedAccountData, S as SWITCHBOARD_ONDEMANDE_PRICE_PRECISION, d as decodeSwitchboardPullFeedData, g as getSwitchboardProgram, s as switchboardAccountCoder } from './merge.types-Coz1eQZg.js';
4
+ export { a as CrossbarSimulatePayload, C as CurrentResult, F as FeedResponse, O as OracleSubmission, P as PullFeedAccountData, S as SWITCHBOARD_ONDEMANDE_PRICE_PRECISION, d as decodeSwitchboardPullFeedData, g as getSwitchboardProgram, s as switchboardAccountCoder } from './index-BDDVBMdM.js';
6
5
  import { Program, BorshCoder, Address } from '@coral-xyz/anchor';
7
6
  import { R as ReserveRaw, O as ObligationRaw, h as ObligationJSON, g as ReserveJSON, C as CurvePointFields, r as RewardInfoFields, F as FarmStateRaw, i as FarmStateJSON, H as HistoricalOracleData, s as HistoricalIndexData, P as PoolBalance, I as InsuranceFund, t as FeeStructureJSON, u as OracleGuardRailsJSON, v as FeeStructure, w as OracleGuardRails, S as SpotPosition, c as DriftUserStats, m as DriftUserStatsJSON, a as DriftUser, k as DriftUserJSON, D as DriftSpotMarket, j as DriftSpotMarketJSON, b as DriftRewards, l as DriftRewardsJSON, x as DriftSpotBalanceType, J as JupLendingState, n as JupLendingStateJSON, d as JupTokenReserve, o as JupTokenReserveJSON, e as JupLendingRewardsRateModel, p as JupLendingRewardsRateModelJSON, f as JupRateModel, q as JupRateModelJSON } from './dto-rate-model.types-DveIB9Ll.js';
8
7
  export { aa as BigFractionBytesFields, ac as BigFractionBytesJSON, E as BorrowRateCurveFields, X as BorrowRateCurveJSON, Y as CurvePointJSON, ak as FeeTier, al as FeeTierJSON, at as HistoricalIndexDataJSON, as as HistoricalOracleDataJSON, av as InsuranceFundJSON, a9 as LastUpdateFields, ab as LastUpdateJSON, a6 as ObligationCollateralFields, a4 as ObligationCollateralJSON, a7 as ObligationLiquidityFields, a3 as ObligationLiquidityJSON, a8 as ObligationOrderFields, a5 as ObligationOrderJSON, am as OrderFillerRewardStructure, an as OrderFillerRewardStructureJSON, au as PoolBalanceJSON, ao as PriceDivergenceGuardRails, ap as PriceDivergenceGuardRailsJSON, G as PriceHeuristicFields, _ as PriceHeuristicJSON, M as PythConfigurationFields, a1 as PythConfigurationJSON, z as ReserveCollateralFields, Q as ReserveCollateralJSON, A as ReserveConfigFields, U as ReserveConfigJSON, B as ReserveFeesFields, V as ReserveFeesJSON, y as ReserveLiquidityFields, N as ReserveLiquidityJSON, ad as RewardPerTimeUnitPointFields, ag as RewardPerTimeUnitPointJSON, ae as RewardScheduleCurveFields, af as RewardScheduleCurveJSON, K as ScopeConfigurationFields, $ as ScopeConfigurationJSON, aw as SpotBalanceType, ax as SpotPositionJSON, L as SwitchboardConfigurationFields, a0 as SwitchboardConfigurationJSON, T as TokenInfoFields, Z as TokenInfoJSON, ai as UserFeesFields, ah as UserFeesJSON, aq as ValidityGuardRails, ar as ValidityGuardRailsJSON, W as WithdrawalCapsFields, a2 as WithdrawalCapsJSON, aj as isSpotBalanceTypeVariant } from './dto-rate-model.types-DveIB9Ll.js';
@@ -26322,787 +26321,154 @@ type MakeUpdateJupLendRateParams = {
26322
26321
  };
26323
26322
  declare function makeUpdateJupLendRate({ lendingState }: MakeUpdateJupLendRateParams): _solana_web3_js.TransactionInstruction;
26324
26323
 
26324
+ /** Number of slots that can pass before a publisher's price is no longer included in the aggregate. */
26325
+ declare const MAX_SLOT_DIFFERENCE = 25;
26326
+ interface Price {
26327
+ priceComponent: bigint;
26328
+ price: number;
26329
+ confidenceComponent: bigint;
26330
+ confidence: number;
26331
+ status: PriceStatus;
26332
+ corporateAction: CorpAction;
26333
+ publishSlot: number;
26334
+ }
26335
+ declare enum PriceStatus {
26336
+ Unknown = 0,
26337
+ Trading = 1,
26338
+ Halted = 2,
26339
+ Auction = 3,
26340
+ Ignored = 4
26341
+ }
26342
+ declare enum CorpAction {
26343
+ NoCorpAct = 0
26344
+ }
26345
+ interface PriceData extends Base {
26346
+ priceType: PriceType;
26347
+ exponent: number;
26348
+ numComponentPrices: number;
26349
+ numQuoters: number;
26350
+ lastSlot: bigint;
26351
+ validSlot: bigint;
26352
+ emaPrice: Ema;
26353
+ emaConfidence: Ema;
26354
+ timestamp: bigint;
26355
+ minPublishers: number;
26356
+ drv2: number;
26357
+ drv3: number;
26358
+ drv4: number;
26359
+ productAccountKey: PublicKey;
26360
+ nextPriceAccountKey: PublicKey | null;
26361
+ previousSlot: bigint;
26362
+ previousPriceComponent: bigint;
26363
+ previousPrice: number;
26364
+ previousConfidenceComponent: bigint;
26365
+ previousConfidence: number;
26366
+ previousTimestamp: bigint;
26367
+ priceComponents: PriceComponent[];
26368
+ aggregate: Price;
26369
+ price: number | undefined;
26370
+ confidence: number | undefined;
26371
+ status: PriceStatus;
26372
+ }
26373
+ interface Base {
26374
+ magic: number;
26375
+ version: number;
26376
+ type: AccountType;
26377
+ size: number;
26378
+ }
26379
+ declare enum AccountType {
26380
+ Unknown = 0,
26381
+ Mapping = 1,
26382
+ Product = 2,
26383
+ Price = 3,
26384
+ Test = 4,
26385
+ Permission = 5
26386
+ }
26387
+ declare enum PriceType {
26388
+ Unknown = 0,
26389
+ Price = 1
26390
+ }
26325
26391
  /**
26326
- * Exponent Finance program IDs (mainnet).
26327
- *
26328
- * The exponent-core repo's `declare_id!` / `Anchor.toml` use
26329
- * `ExponentnaRg3CQbW6dqQNZKXp7gtZ9DGMp1cwC4HAS7`, but that is the **localnet** key
26330
- * (`[programs.localnet]`); the **mainnet** core deployment is
26331
- * `XP1BRLn8eCYSygrd8er5P4GKdzqKbC3DLoSsS5UYVZy` (confirmed: it's the program that
26332
- * executes the PT instructions in real mainnet transactions), fronted by the
26333
- * wrapper/router `XPC1MM4dYACDfykNuXYZ5una2DsMDWL24CrYubCvarC`.
26334
- *
26335
- * The instruction encoding/accounts come straight from the committed IDL
26336
- * (`idl/exponent_core.json`) — same source Exponent's own tooling uses.
26392
+ * valueComponent = numerator / denominator
26393
+ * value = valueComponent * 10 ^ exponent (from PriceData)
26337
26394
  */
26338
- declare const EXPONENT_CORE_PROGRAM_ID: PublicKey;
26339
- declare const EXPONENT_WRAPPER_PROGRAM_ID: PublicKey;
26340
- /** The program's localnet `declare_id!` (from the exponent-core repo). */
26341
- declare const EXPONENT_LOCALNET_PROGRAM_ID: PublicKey;
26342
- /** Anchor event-CPI authority seed. */
26343
- declare const EXPONENT_EVENT_AUTHORITY_SEED = "__event_authority";
26395
+ interface Ema {
26396
+ valueComponent: bigint;
26397
+ value: number;
26398
+ numerator: bigint;
26399
+ denominator: bigint;
26400
+ }
26401
+ interface PriceComponent {
26402
+ publisher: PublicKey;
26403
+ aggregate: Price;
26404
+ latest: Price;
26405
+ }
26406
+ declare const parsePriceData: (data: Buffer, currentSlot?: number) => PriceData;
26407
+
26408
+ type PriceUpdateV2 = {
26409
+ writeAuthority: Buffer;
26410
+ verificationLevel: number;
26411
+ priceMessage: {
26412
+ feedId: Buffer;
26413
+ price: bigint;
26414
+ conf: bigint;
26415
+ exponent: number;
26416
+ publishTime: bigint;
26417
+ prevPublishTime: bigint;
26418
+ emaPrice: bigint;
26419
+ emaConf: bigint;
26420
+ };
26421
+ };
26422
+ declare const parsePriceInfo: (data: Buffer) => PriceUpdateV2;
26423
+
26424
+ declare const SinglePoolInstruction: {
26425
+ initializePool: (voteAccount: PublicKey) => TransactionInstruction;
26426
+ initializeOnRamp: (pool: PublicKey) => TransactionInstruction;
26427
+ depositStake: (pool: PublicKey, userStakeAccount: PublicKey, userTokenAccount: PublicKey, userLamportAccount: PublicKey) => Promise<TransactionInstruction>;
26428
+ withdrawStake: (pool: PublicKey, userStakeAccount: PublicKey, userStakeAuthority: PublicKey, userTokenAccount: PublicKey, tokenAmount: BigNumber$1) => Promise<TransactionInstruction>;
26429
+ createTokenMetadata: (pool: PublicKey, payer: PublicKey) => Promise<TransactionInstruction>;
26430
+ updateTokenMetadata: (voteAccount: PublicKey, authorizedWithdrawer: PublicKey, tokenName: string, tokenSymbol: string, tokenUri?: string) => Promise<TransactionInstruction>;
26431
+ };
26432
+ declare const findPoolMintAddressByVoteAccount: (voteAccountAddress: PublicKey) => PublicKey;
26433
+ declare const findPoolAddress: (voteAccountAddress: PublicKey) => PublicKey;
26434
+ declare const findPoolMintAddress: (poolAddress: PublicKey) => PublicKey;
26435
+ declare const findPoolStakeAddress: (poolAddress: PublicKey) => PublicKey;
26436
+ declare const findPoolStakeAuthorityAddress: (poolAddress: PublicKey) => PublicKey;
26437
+ declare const findPoolMintAuthorityAddress: (poolAddress: PublicKey) => PublicKey;
26438
+ declare const findPoolMplAuthorityAddress: (poolAddress: PublicKey) => PublicKey;
26439
+ declare const findPoolOnRampAddress: (poolAddress: PublicKey) => PublicKey;
26440
+ declare const findMplMetadataAddress: (poolMintAddress: PublicKey) => Promise<PublicKey>;
26441
+ declare function initializeStakedPoolTx(connection: Connection, payer: PublicKey, voteAccountAddress: PublicKey): Promise<Transaction>;
26442
+ declare function initializeStakedPoolIxs(connection: Connection, payer: PublicKey, voteAccountAddress: PublicKey): Promise<TransactionInstruction[]>;
26443
+ declare const createAccountIx: (from: PublicKey, newAccount: PublicKey, lamports: number, space: number, programAddress: PublicKey) => TransactionInstruction;
26444
+ declare const createPoolOnrampIx: (voteAccount: PublicKey) => TransactionInstruction;
26445
+ declare const replenishPoolIx: (voteAccount: PublicKey) => TransactionInstruction;
26344
26446
 
26345
26447
  /**
26346
- * Raw Exponent core IDL (as committed in github.com/exponent-finance/exponent-core).
26347
- * Kept for reference / future codegen. NOTE: its `address` field is the IDL-declared
26348
- * program id, which differs from the live deployment — see `../constants.ts`.
26349
- */
26350
- declare const EXPONENT_CORE_IDL: {
26351
- address: string;
26352
- metadata: {
26353
- name: string;
26354
- version: string;
26355
- spec: string;
26356
- description: string;
26448
+ * Parsed content of an on-chain StakeAccount
26449
+ *
26450
+ * Copied from https://github.com/solana-developers/solana-rpc-get-stake-activation/blob/main/web3js-1.0/src/stake.ts
26451
+ * */
26452
+ type StakeAccount = {
26453
+ discriminant: bigint;
26454
+ meta: {
26455
+ rentExemptReserve: bigint;
26456
+ authorized: {
26457
+ staker: PublicKey;
26458
+ withdrawer: PublicKey;
26459
+ };
26460
+ lockup: {
26461
+ unixTimestamp: bigint;
26462
+ epoch: bigint;
26463
+ custodian: PublicKey;
26464
+ };
26357
26465
  };
26358
- instructions: ({
26359
- name: string;
26360
- discriminator: number[];
26361
- accounts: ({
26362
- name: string;
26363
- signer: boolean;
26364
- writable?: undefined;
26365
- docs?: undefined;
26366
- } | {
26367
- name: string;
26368
- writable: boolean;
26369
- signer: boolean;
26370
- docs?: undefined;
26371
- } | {
26372
- name: string;
26373
- writable: boolean;
26374
- signer?: undefined;
26375
- docs?: undefined;
26376
- } | {
26377
- name: string;
26378
- signer?: undefined;
26379
- writable?: undefined;
26380
- docs?: undefined;
26381
- } | {
26382
- name: string;
26383
- docs: string[];
26384
- signer?: undefined;
26385
- writable?: undefined;
26386
- } | {
26387
- name: string;
26388
- docs: string[];
26389
- writable: boolean;
26390
- signer?: undefined;
26391
- })[];
26392
- args: ({
26393
- name: string;
26394
- type: {
26395
- defined: {
26396
- name: string;
26397
- };
26398
- };
26399
- } | {
26400
- name: string;
26401
- type: string;
26402
- })[];
26403
- returns?: undefined;
26404
- docs?: undefined;
26405
- } | {
26406
- name: string;
26407
- discriminator: number[];
26408
- accounts: ({
26409
- name: string;
26410
- writable: boolean;
26411
- signer: boolean;
26412
- } | {
26413
- name: string;
26414
- writable: boolean;
26415
- signer?: undefined;
26416
- } | {
26417
- name: string;
26418
- writable?: undefined;
26419
- signer?: undefined;
26420
- })[];
26421
- args: ({
26422
- name: string;
26423
- type: string;
26424
- } | {
26425
- name: string;
26426
- type: {
26427
- defined: {
26428
- name: string;
26429
- };
26430
- };
26431
- })[];
26432
- returns: {
26433
- defined: {
26434
- name: string;
26435
- };
26436
- };
26437
- docs?: undefined;
26438
- } | {
26439
- name: string;
26440
- discriminator: number[];
26441
- accounts: ({
26442
- name: string;
26443
- docs: string[];
26444
- writable: boolean;
26445
- signer: boolean;
26446
- } | {
26447
- name: string;
26448
- docs: string[];
26449
- writable: boolean;
26450
- signer?: undefined;
26451
- } | {
26452
- name: string;
26453
- writable: boolean;
26454
- docs?: undefined;
26455
- signer?: undefined;
26456
- } | {
26457
- name: string;
26458
- docs?: undefined;
26459
- writable?: undefined;
26460
- signer?: undefined;
26461
- })[];
26462
- args: {
26463
- name: string;
26464
- type: {
26465
- defined: {
26466
- name: string;
26467
- };
26468
- };
26469
- }[];
26470
- returns: {
26471
- defined: {
26472
- name: string;
26473
- };
26474
- };
26475
- docs?: undefined;
26476
- } | {
26477
- name: string;
26478
- docs: string[];
26479
- discriminator: number[];
26480
- accounts: ({
26481
- name: string;
26482
- docs: string[];
26483
- writable: boolean;
26484
- signer: boolean;
26485
- } | {
26486
- name: string;
26487
- docs: string[];
26488
- writable: boolean;
26489
- signer?: undefined;
26490
- } | {
26491
- name: string;
26492
- docs?: undefined;
26493
- writable?: undefined;
26494
- signer?: undefined;
26495
- } | {
26496
- name: string;
26497
- docs: string[];
26498
- writable?: undefined;
26499
- signer?: undefined;
26500
- })[];
26501
- args: {
26502
- name: string;
26503
- type: string;
26504
- }[];
26505
- returns: {
26506
- defined: {
26507
- name: string;
26508
- };
26509
- };
26510
- } | {
26511
- name: string;
26512
- docs: string[];
26513
- discriminator: number[];
26514
- accounts: ({
26515
- name: string;
26516
- writable: boolean;
26517
- signer: boolean;
26518
- docs?: undefined;
26519
- } | {
26520
- name: string;
26521
- writable?: undefined;
26522
- signer?: undefined;
26523
- docs?: undefined;
26524
- } | {
26525
- name: string;
26526
- docs: string[];
26527
- writable?: undefined;
26528
- signer?: undefined;
26529
- } | {
26530
- name: string;
26531
- writable: boolean;
26532
- signer?: undefined;
26533
- docs?: undefined;
26534
- })[];
26535
- args: ({
26536
- name: string;
26537
- type: string;
26538
- } | {
26539
- name: string;
26540
- type: {
26541
- defined: {
26542
- name: string;
26543
- };
26544
- };
26545
- })[];
26546
- returns?: undefined;
26547
- } | {
26548
- name: string;
26549
- discriminator: number[];
26550
- accounts: ({
26551
- name: string;
26552
- writable: boolean;
26553
- signer: boolean;
26554
- docs?: undefined;
26555
- } | {
26556
- name: string;
26557
- writable: boolean;
26558
- signer?: undefined;
26559
- docs?: undefined;
26560
- } | {
26561
- name: string;
26562
- docs: string[];
26563
- writable: boolean;
26564
- signer?: undefined;
26565
- } | {
26566
- name: string;
26567
- docs: string[];
26568
- writable?: undefined;
26569
- signer?: undefined;
26570
- } | {
26571
- name: string;
26572
- writable?: undefined;
26573
- signer?: undefined;
26574
- docs?: undefined;
26575
- })[];
26576
- args: {
26577
- name: string;
26578
- type: string;
26579
- }[];
26580
- returns: {
26581
- defined: {
26582
- name: string;
26583
- };
26584
- };
26585
- docs?: undefined;
26586
- } | {
26587
- name: string;
26588
- docs: string[];
26589
- discriminator: number[];
26590
- accounts: ({
26591
- name: string;
26592
- writable: boolean;
26593
- signer: boolean;
26594
- docs?: undefined;
26595
- } | {
26596
- name: string;
26597
- writable: boolean;
26598
- signer?: undefined;
26599
- docs?: undefined;
26600
- } | {
26601
- name: string;
26602
- docs: string[];
26603
- writable: boolean;
26604
- signer?: undefined;
26605
- } | {
26606
- name: string;
26607
- writable?: undefined;
26608
- signer?: undefined;
26609
- docs?: undefined;
26610
- } | {
26611
- name: string;
26612
- docs: string[];
26613
- writable?: undefined;
26614
- signer?: undefined;
26615
- })[];
26616
- args: {
26617
- name: string;
26618
- type: string;
26619
- }[];
26620
- returns: {
26621
- defined: {
26622
- name: string;
26623
- };
26624
- };
26625
- } | {
26626
- name: string;
26627
- docs: string[];
26628
- discriminator: number[];
26629
- accounts: ({
26630
- name: string;
26631
- writable: boolean;
26632
- signer: boolean;
26633
- docs?: undefined;
26634
- } | {
26635
- name: string;
26636
- docs: string[];
26637
- writable?: undefined;
26638
- signer?: undefined;
26639
- } | {
26640
- name: string;
26641
- writable: boolean;
26642
- signer?: undefined;
26643
- docs?: undefined;
26644
- } | {
26645
- name: string;
26646
- docs: string[];
26647
- writable: boolean;
26648
- signer?: undefined;
26649
- } | {
26650
- name: string;
26651
- writable?: undefined;
26652
- signer?: undefined;
26653
- docs?: undefined;
26654
- })[];
26655
- args: {
26656
- name: string;
26657
- type: string;
26658
- }[];
26659
- returns?: undefined;
26660
- })[];
26661
- accounts: {
26662
- name: string;
26663
- discriminator: number[];
26664
- }[];
26665
- events: {
26666
- name: string;
26667
- discriminator: number[];
26668
- }[];
26669
- errors: {
26670
- code: number;
26671
- name: string;
26672
- msg: string;
26673
- }[];
26674
- types: ({
26675
- name: string;
26676
- type: {
26677
- kind: string;
26678
- fields: ({
26679
- name: string;
26680
- type: string;
26681
- } | {
26682
- name: string;
26683
- type: {
26684
- option: string;
26685
- defined?: undefined;
26686
- };
26687
- } | {
26688
- name: string;
26689
- type: {
26690
- defined: {
26691
- name: string;
26692
- };
26693
- option?: undefined;
26694
- };
26695
- })[];
26696
- variants?: undefined;
26697
- };
26698
- docs?: undefined;
26699
- } | {
26700
- name: string;
26701
- type: {
26702
- kind: string;
26703
- variants: ({
26704
- name: string;
26705
- fields: string[];
26706
- } | {
26707
- name: string;
26708
- fields: {
26709
- name: string;
26710
- type: string;
26711
- }[];
26712
- } | {
26713
- name: string;
26714
- fields: {
26715
- name: string;
26716
- type: {
26717
- defined: {
26718
- name: string;
26719
- };
26720
- };
26721
- }[];
26722
- })[];
26723
- fields?: undefined;
26724
- };
26725
- docs?: undefined;
26726
- } | {
26727
- name: string;
26728
- type: {
26729
- kind: string;
26730
- variants: ({
26731
- name: string;
26732
- fields?: undefined;
26733
- } | {
26734
- name: string;
26735
- fields: string[];
26736
- })[];
26737
- fields?: undefined;
26738
- };
26739
- docs?: undefined;
26740
- } | {
26741
- name: string;
26742
- docs: string[];
26743
- type: {
26744
- kind: string;
26745
- fields: ({
26746
- name: string;
26747
- docs: string[];
26748
- type: {
26749
- vec: {
26750
- defined: {
26751
- name: string;
26752
- };
26753
- vec?: undefined;
26754
- };
26755
- };
26756
- } | {
26757
- name: string;
26758
- docs: string[];
26759
- type: {
26760
- vec: {
26761
- vec: {
26762
- defined: {
26763
- name: string;
26764
- };
26765
- };
26766
- defined?: undefined;
26767
- };
26768
- };
26769
- })[];
26770
- variants?: undefined;
26771
- };
26772
- } | {
26773
- name: string;
26774
- docs: string[];
26775
- type: {
26776
- kind: string;
26777
- fields: {
26778
- array: (string | number)[];
26779
- }[];
26780
- variants?: undefined;
26781
- };
26782
- } | {
26783
- name: string;
26784
- docs: string[];
26785
- type: {
26786
- kind: string;
26787
- fields: ({
26788
- name: string;
26789
- docs: string[];
26790
- type: {
26791
- defined: {
26792
- name: string;
26793
- };
26794
- };
26795
- } | {
26796
- name: string;
26797
- docs: string[];
26798
- type: string;
26799
- })[];
26800
- variants?: undefined;
26801
- };
26802
- } | {
26803
- name: string;
26804
- type: {
26805
- kind: string;
26806
- fields: ({
26807
- name: string;
26808
- type: string;
26809
- } | {
26810
- name: string;
26811
- type: {
26812
- defined: {
26813
- name: string;
26814
- };
26815
- vec?: undefined;
26816
- };
26817
- } | {
26818
- name: string;
26819
- type: {
26820
- vec: string;
26821
- defined?: undefined;
26822
- };
26823
- })[];
26824
- variants?: undefined;
26825
- };
26826
- docs?: undefined;
26827
- } | {
26828
- name: string;
26829
- type: {
26830
- kind: string;
26831
- fields: ({
26832
- name: string;
26833
- docs: string[];
26834
- type: string;
26835
- } | {
26836
- name: string;
26837
- docs: string[];
26838
- type: {
26839
- array: (string | number)[];
26840
- defined?: undefined;
26841
- vec?: undefined;
26842
- };
26843
- } | {
26844
- name: string;
26845
- docs: string[];
26846
- type: {
26847
- defined: {
26848
- name: string;
26849
- };
26850
- array?: undefined;
26851
- vec?: undefined;
26852
- };
26853
- } | {
26854
- name: string;
26855
- type: string;
26856
- docs?: undefined;
26857
- } | {
26858
- name: string;
26859
- type: {
26860
- vec: {
26861
- defined: {
26862
- name: string;
26863
- };
26864
- };
26865
- array?: undefined;
26866
- defined?: undefined;
26867
- };
26868
- docs?: undefined;
26869
- } | {
26870
- name: string;
26871
- type: {
26872
- defined: {
26873
- name: string;
26874
- };
26875
- array?: undefined;
26876
- vec?: undefined;
26877
- };
26878
- docs?: undefined;
26879
- })[];
26880
- variants?: undefined;
26881
- };
26882
- docs?: undefined;
26883
- } | {
26884
- name: string;
26885
- type: {
26886
- kind: string;
26887
- fields: ({
26888
- name: string;
26889
- docs: string[];
26890
- type: string;
26891
- } | {
26892
- name: string;
26893
- docs: string[];
26894
- type: {
26895
- defined: {
26896
- name: string;
26897
- };
26898
- vec?: undefined;
26899
- };
26900
- } | {
26901
- name: string;
26902
- docs: string[];
26903
- type: {
26904
- vec: {
26905
- defined: {
26906
- name: string;
26907
- };
26908
- };
26909
- defined?: undefined;
26910
- };
26911
- })[];
26912
- variants?: undefined;
26913
- };
26914
- docs?: undefined;
26915
- })[];
26916
- };
26917
-
26918
- /**
26919
- * Exponent's high-precision `Number` is a little-endian U256 (`[u64; 4]`) scaled by 1e12
26920
- * (`precise_number::ONE`). See exponent-core `libraries/precise_number`.
26921
- */
26922
- declare const EXPONENT_NUMBER_DENOM: BigNumber;
26923
- /** Convert a decoded Exponent `Number` (LE `[u64; 4]` U256) to a scaled BigNumber. */
26924
- declare function exponentNumberToBigNumber(raw: unknown): BigNumber;
26925
- /** Decode a raw `Vault` account buffer into {@link ExponentVault}. */
26926
- declare function decodeExponentVault(data: Buffer): ExponentVault;
26927
- /** Decode a `MarketTwo` account and return its `vault` address. */
26928
- declare function decodeExponentMarketVault(data: Buffer): PublicKey;
26929
- /** Fetch + decode an Exponent `Vault` account. */
26930
- declare function fetchExponentVault(connection: Connection, vault: PublicKey): Promise<ExponentVault>;
26931
- /** Fetch a `MarketTwo` account and resolve + fetch its `Vault`. */
26932
- declare function fetchExponentVaultFromMarket(connection: Connection, market: PublicKey): Promise<{
26933
- vault: PublicKey;
26934
- account: ExponentVault;
26935
- }>;
26936
- /** Read an SPL mint's decimals (classic + token-2022 share the offset-44 layout). */
26937
- declare function getMintDecimals(connection: Connection, mint: PublicKey): Promise<number>;
26938
-
26939
- /** Derive the Anchor event-CPI authority PDA for the Exponent core program. */
26940
- declare function deriveExponentEventAuthority(): PublicKey;
26941
-
26942
- /**
26943
- * Resolve everything `makeRollPtTx` needs for an Exponent PT roll by decoding the maturity
26944
- * `Vault` (every vault-side `merge` account is a `has_one` field on it) and deriving the
26945
- * owner's PT/YT/SY token accounts.
26946
- */
26947
- declare function resolveExponentMergeContext(params: ResolveExponentMergeContextParams): Promise<ExponentMergeContext>;
26948
-
26949
- /**
26950
- * Build the Exponent `merge(amount)` instruction — redeems `amount` PT (post-maturity,
26951
- * 1:1, no AMM/slippage) into SY at `sySrcDstAta`.
26952
- *
26953
- * @param accounts resolved merge accounts (see {@link ExponentMergeAccounts})
26954
- * @param amountNative PT amount to redeem, in native units (u64)
26955
- */
26956
- declare function makeExponentMergeIx(accounts: ExponentMergeAccounts, amountNative: bigint): TransactionInstruction;
26957
-
26958
- /** Number of slots that can pass before a publisher's price is no longer included in the aggregate. */
26959
- declare const MAX_SLOT_DIFFERENCE = 25;
26960
- interface Price {
26961
- priceComponent: bigint;
26962
- price: number;
26963
- confidenceComponent: bigint;
26964
- confidence: number;
26965
- status: PriceStatus;
26966
- corporateAction: CorpAction;
26967
- publishSlot: number;
26968
- }
26969
- declare enum PriceStatus {
26970
- Unknown = 0,
26971
- Trading = 1,
26972
- Halted = 2,
26973
- Auction = 3,
26974
- Ignored = 4
26975
- }
26976
- declare enum CorpAction {
26977
- NoCorpAct = 0
26978
- }
26979
- interface PriceData extends Base {
26980
- priceType: PriceType;
26981
- exponent: number;
26982
- numComponentPrices: number;
26983
- numQuoters: number;
26984
- lastSlot: bigint;
26985
- validSlot: bigint;
26986
- emaPrice: Ema;
26987
- emaConfidence: Ema;
26988
- timestamp: bigint;
26989
- minPublishers: number;
26990
- drv2: number;
26991
- drv3: number;
26992
- drv4: number;
26993
- productAccountKey: PublicKey;
26994
- nextPriceAccountKey: PublicKey | null;
26995
- previousSlot: bigint;
26996
- previousPriceComponent: bigint;
26997
- previousPrice: number;
26998
- previousConfidenceComponent: bigint;
26999
- previousConfidence: number;
27000
- previousTimestamp: bigint;
27001
- priceComponents: PriceComponent[];
27002
- aggregate: Price;
27003
- price: number | undefined;
27004
- confidence: number | undefined;
27005
- status: PriceStatus;
27006
- }
27007
- interface Base {
27008
- magic: number;
27009
- version: number;
27010
- type: AccountType;
27011
- size: number;
27012
- }
27013
- declare enum AccountType {
27014
- Unknown = 0,
27015
- Mapping = 1,
27016
- Product = 2,
27017
- Price = 3,
27018
- Test = 4,
27019
- Permission = 5
27020
- }
27021
- declare enum PriceType {
27022
- Unknown = 0,
27023
- Price = 1
27024
- }
27025
- /**
27026
- * valueComponent = numerator / denominator
27027
- * value = valueComponent * 10 ^ exponent (from PriceData)
27028
- */
27029
- interface Ema {
27030
- valueComponent: bigint;
27031
- value: number;
27032
- numerator: bigint;
27033
- denominator: bigint;
27034
- }
27035
- interface PriceComponent {
27036
- publisher: PublicKey;
27037
- aggregate: Price;
27038
- latest: Price;
27039
- }
27040
- declare const parsePriceData: (data: Buffer, currentSlot?: number) => PriceData;
27041
-
27042
- type PriceUpdateV2 = {
27043
- writeAuthority: Buffer;
27044
- verificationLevel: number;
27045
- priceMessage: {
27046
- feedId: Buffer;
27047
- price: bigint;
27048
- conf: bigint;
27049
- exponent: number;
27050
- publishTime: bigint;
27051
- prevPublishTime: bigint;
27052
- emaPrice: bigint;
27053
- emaConf: bigint;
27054
- };
27055
- };
27056
- declare const parsePriceInfo: (data: Buffer) => PriceUpdateV2;
27057
-
27058
- declare const SinglePoolInstruction: {
27059
- initializePool: (voteAccount: PublicKey) => TransactionInstruction;
27060
- initializeOnRamp: (pool: PublicKey) => TransactionInstruction;
27061
- depositStake: (pool: PublicKey, userStakeAccount: PublicKey, userTokenAccount: PublicKey, userLamportAccount: PublicKey) => Promise<TransactionInstruction>;
27062
- withdrawStake: (pool: PublicKey, userStakeAccount: PublicKey, userStakeAuthority: PublicKey, userTokenAccount: PublicKey, tokenAmount: BigNumber$1) => Promise<TransactionInstruction>;
27063
- createTokenMetadata: (pool: PublicKey, payer: PublicKey) => Promise<TransactionInstruction>;
27064
- updateTokenMetadata: (voteAccount: PublicKey, authorizedWithdrawer: PublicKey, tokenName: string, tokenSymbol: string, tokenUri?: string) => Promise<TransactionInstruction>;
27065
- };
27066
- declare const findPoolMintAddressByVoteAccount: (voteAccountAddress: PublicKey) => PublicKey;
27067
- declare const findPoolAddress: (voteAccountAddress: PublicKey) => PublicKey;
27068
- declare const findPoolMintAddress: (poolAddress: PublicKey) => PublicKey;
27069
- declare const findPoolStakeAddress: (poolAddress: PublicKey) => PublicKey;
27070
- declare const findPoolStakeAuthorityAddress: (poolAddress: PublicKey) => PublicKey;
27071
- declare const findPoolMintAuthorityAddress: (poolAddress: PublicKey) => PublicKey;
27072
- declare const findPoolMplAuthorityAddress: (poolAddress: PublicKey) => PublicKey;
27073
- declare const findPoolOnRampAddress: (poolAddress: PublicKey) => PublicKey;
27074
- declare const findMplMetadataAddress: (poolMintAddress: PublicKey) => Promise<PublicKey>;
27075
- declare function initializeStakedPoolTx(connection: Connection, payer: PublicKey, voteAccountAddress: PublicKey): Promise<Transaction>;
27076
- declare function initializeStakedPoolIxs(connection: Connection, payer: PublicKey, voteAccountAddress: PublicKey): Promise<TransactionInstruction[]>;
27077
- declare const createAccountIx: (from: PublicKey, newAccount: PublicKey, lamports: number, space: number, programAddress: PublicKey) => TransactionInstruction;
27078
- declare const createPoolOnrampIx: (voteAccount: PublicKey) => TransactionInstruction;
27079
- declare const replenishPoolIx: (voteAccount: PublicKey) => TransactionInstruction;
27080
-
27081
- /**
27082
- * Parsed content of an on-chain StakeAccount
27083
- *
27084
- * Copied from https://github.com/solana-developers/solana-rpc-get-stake-activation/blob/main/web3js-1.0/src/stake.ts
27085
- * */
27086
- type StakeAccount = {
27087
- discriminant: bigint;
27088
- meta: {
27089
- rentExemptReserve: bigint;
27090
- authorized: {
27091
- staker: PublicKey;
27092
- withdrawer: PublicKey;
27093
- };
27094
- lockup: {
27095
- unixTimestamp: bigint;
27096
- epoch: bigint;
27097
- custodian: PublicKey;
27098
- };
27099
- };
27100
- stake: {
27101
- delegation: {
27102
- voterPubkey: PublicKey;
27103
- stake: bigint;
27104
- activationEpoch: bigint;
27105
- deactivationEpoch: bigint;
26466
+ stake: {
26467
+ delegation: {
26468
+ voterPubkey: PublicKey;
26469
+ stake: bigint;
26470
+ activationEpoch: bigint;
26471
+ deactivationEpoch: bigint;
27106
26472
  };
27107
26473
  creditsObserved: bigint;
27108
26474
  };
@@ -27484,463 +26850,1482 @@ declare function createAssociatedTokenAccountIdempotentInstruction(payer: Public
27484
26850
  interface SyncNativeInstructionData {
27485
26851
  instruction: TokenInstruction.SyncNative;
27486
26852
  }
27487
- /** TODO: docs */
27488
- declare const syncNativeInstructionData: _solana_buffer_layout.Structure<SyncNativeInstructionData>;
27489
- /**
27490
- * Construct a SyncNative instruction
27491
- *
27492
- * @param account Native account to sync lamports from
27493
- * @param programId SPL Token program account
27494
- *
27495
- * @return Instruction to add to a transaction
27496
- */
27497
- declare function createSyncNativeInstruction(account: PublicKey, programId?: PublicKey): TransactionInstruction;
27498
- /** TODO: docs */
27499
- interface CloseAccountInstructionData {
27500
- instruction: TokenInstruction.CloseAccount;
26853
+ /** TODO: docs */
26854
+ declare const syncNativeInstructionData: _solana_buffer_layout.Structure<SyncNativeInstructionData>;
26855
+ /**
26856
+ * Construct a SyncNative instruction
26857
+ *
26858
+ * @param account Native account to sync lamports from
26859
+ * @param programId SPL Token program account
26860
+ *
26861
+ * @return Instruction to add to a transaction
26862
+ */
26863
+ declare function createSyncNativeInstruction(account: PublicKey, programId?: PublicKey): TransactionInstruction;
26864
+ /** TODO: docs */
26865
+ interface CloseAccountInstructionData {
26866
+ instruction: TokenInstruction.CloseAccount;
26867
+ }
26868
+ /** TODO: docs */
26869
+ declare const closeAccountInstructionData: _solana_buffer_layout.Structure<CloseAccountInstructionData>;
26870
+ /**
26871
+ * Construct a CloseAccount instruction
26872
+ *
26873
+ * @param account Account to close
26874
+ * @param destination Account to receive the remaining balance of the closed account
26875
+ * @param authority Account close authority
26876
+ * @param multiSigners Signing accounts if `authority` is a multisig
26877
+ * @param programId SPL Token program account
26878
+ *
26879
+ * @return Instruction to add to a transaction
26880
+ */
26881
+ declare function createCloseAccountInstruction(account: PublicKey, destination: PublicKey, authority: PublicKey, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction;
26882
+ /** TODO: docs */
26883
+ interface TransferCheckedInstructionData {
26884
+ instruction: TokenInstruction.TransferChecked;
26885
+ amount: bigint;
26886
+ decimals: number;
26887
+ }
26888
+ /** TODO: docs */
26889
+ declare const transferCheckedInstructionData: _solana_buffer_layout.Structure<TransferCheckedInstructionData>;
26890
+ /**
26891
+ * Construct a TransferChecked instruction
26892
+ *
26893
+ * @param source Source account
26894
+ * @param mint Mint account
26895
+ * @param destination Destination account
26896
+ * @param owner Owner of the source account
26897
+ * @param amount Number of tokens to transfer
26898
+ * @param decimals Number of decimals in transfer amount
26899
+ * @param multiSigners Signing accounts if `owner` is a multisig
26900
+ * @param programId SPL Token program account
26901
+ *
26902
+ * @return Instruction to add to a transaction
26903
+ */
26904
+ declare function createTransferCheckedInstruction(source: PublicKey, mint: PublicKey, destination: PublicKey, owner: PublicKey, amount: number | bigint, decimals: number, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction;
26905
+
26906
+ /** A Solana account public key, encoded as 32 bytes by msgpack. */
26907
+ type Pubkey = Uint8Array;
26908
+ /** Solana account metadata for an instruction. */
26909
+ interface AccountMeta {
26910
+ /** Public key for the account. */
26911
+ p: Pubkey;
26912
+ /** Whether the account is a signer. */
26913
+ s: boolean;
26914
+ /** Whether the account is writable. */
26915
+ w: boolean;
26916
+ }
26917
+ /** A single instruction to be executed as part of a transaction. */
26918
+ interface Instruction {
26919
+ /** Program id. */
26920
+ p: Pubkey;
26921
+ /** Account metadata. */
26922
+ a: AccountMeta[];
26923
+ /** Instruction data. */
26924
+ d: Uint8Array;
26925
+ }
26926
+ /** An address lookup table referenced by a transaction template (key + inner addresses). */
26927
+ interface TransactionTemplateLut {
26928
+ /** ALT account address. */
26929
+ p: Pubkey;
26930
+ /** Addresses stored inside the ALT, in order. */
26931
+ a: Pubkey[];
26932
+ }
26933
+ /**
26934
+ * Footprint of the instructions/ALTs surrounding the swap, so the router sizes
26935
+ * routes to fit alongside them. Wire format uses single-letter fields: `i`
26936
+ * instructions, `a` ALTs, `m` extra account metas. See the gateway helper
26937
+ * `buildTitanTemplate`. Over the WebSocket this is sent as a native msgpack
26938
+ * object (no base64) — unlike the gateway GET there is no URL-length limit, so
26939
+ * large ALTs are fine.
26940
+ */
26941
+ interface TransactionTemplate {
26942
+ i: Instruction[];
26943
+ a: TransactionTemplateLut[];
26944
+ m: AccountMeta[];
26945
+ }
26946
+ declare enum SwapMode {
26947
+ ExactIn = "ExactIn",
26948
+ ExactOut = "ExactOut"
26949
+ }
26950
+ type Uint64 = number | bigint;
26951
+ interface ClientRequest {
26952
+ id: number;
26953
+ data: RequestData;
26954
+ }
26955
+ type RequestData = {
26956
+ NewSwapQuoteStream: SwapQuoteRequest;
26957
+ } | {
26958
+ StopStream: StopStreamRequest;
26959
+ };
26960
+ interface SwapQuoteRequest {
26961
+ swap: SwapParams;
26962
+ transaction: TransactionParams;
26963
+ update?: QuoteUpdateParams;
26964
+ }
26965
+ interface SwapParams {
26966
+ inputMint: Pubkey;
26967
+ outputMint: Pubkey;
26968
+ amount: Uint64;
26969
+ swapMode?: SwapMode;
26970
+ slippageBps?: number;
26971
+ dexes?: string[];
26972
+ excludeDexes?: string[];
26973
+ onlyDirectRoutes?: boolean;
26974
+ addSizeConstraint?: boolean;
26975
+ sizeConstraint?: number;
26976
+ providers?: string[];
26977
+ /** Limit total number of accounts used by routes. Default: 256. Available since v1.1. */
26978
+ accountsLimitTotal?: number;
26979
+ /** Limit writable accounts used by routes. Default: 64. Available since v1.1. */
26980
+ accountsLimitWritable?: number;
26981
+ /**
26982
+ * Reserve room for the surrounding (non-swap) instructions + ALTs so the
26983
+ * router sizes routes to fit. Mutually exclusive with `sizeConstraint` /
26984
+ * `accountsLimitTotal` / `accountsLimitWritable`. Available since v1.2.
26985
+ */
26986
+ transactionTemplate?: TransactionTemplate;
26987
+ }
26988
+ interface TransactionParams {
26989
+ userPublicKey: Pubkey;
26990
+ closeInputTokenAccount?: boolean;
26991
+ createOutputTokenAccount?: boolean;
26992
+ feeAccount?: Pubkey;
26993
+ feeBps?: number;
26994
+ feeFromInputMint?: boolean;
26995
+ outputAccount?: Pubkey;
26996
+ titanSwapVersion?: SwapVersion;
26997
+ }
26998
+ declare enum SwapVersion {
26999
+ V2 = 2,
27000
+ V3 = 3
27001
+ }
27002
+ interface QuoteUpdateParams {
27003
+ intervalMs?: Uint64;
27004
+ num_quotes: number;
27005
+ }
27006
+ interface StopStreamRequest {
27007
+ id: number;
27008
+ }
27009
+ type ServerMessage = {
27010
+ Response: ResponseSuccess;
27011
+ } | {
27012
+ Error: ResponseError;
27013
+ } | {
27014
+ StreamData: StreamData;
27015
+ } | {
27016
+ StreamEnd: StreamEnd;
27017
+ };
27018
+ type ResponseData = {
27019
+ NewSwapQuoteStream: QuoteSwapStreamResponse;
27020
+ } | {
27021
+ StreamStopped: StopStreamResponse;
27022
+ };
27023
+ interface StreamStart {
27024
+ id: number;
27025
+ dataType: string;
27026
+ }
27027
+ interface ResponseSuccess {
27028
+ requestId: number;
27029
+ data: ResponseData;
27030
+ stream?: StreamStart;
27031
+ }
27032
+ interface ResponseError {
27033
+ requestId: number;
27034
+ code: number;
27035
+ message: string;
27036
+ }
27037
+ type StreamDataPayload = {
27038
+ SwapQuotes: SwapQuotes;
27039
+ };
27040
+ interface StreamData {
27041
+ id: number;
27042
+ seq: number;
27043
+ payload: StreamDataPayload;
27044
+ }
27045
+ interface StreamEnd {
27046
+ id: number;
27047
+ errorCode?: number;
27048
+ errorMessage?: string;
27049
+ }
27050
+ interface QuoteSwapStreamResponse {
27051
+ intervalMs: number;
27052
+ }
27053
+ interface StopStreamResponse {
27054
+ id: number;
27055
+ }
27056
+ interface SwapQuotes {
27057
+ id: string;
27058
+ inputMint: Uint8Array;
27059
+ outputMint: Uint8Array;
27060
+ swapMode: SwapMode;
27061
+ amount: number;
27062
+ quotes: {
27063
+ [key: string]: SwapRoute;
27064
+ };
27065
+ /** Present when DART is enabled; names the route Titan recommends. */
27066
+ metadata?: {
27067
+ ExpectedWinner?: string;
27068
+ };
27069
+ }
27070
+ interface SwapRoute {
27071
+ inAmount: number;
27072
+ outAmount: number;
27073
+ slippageBps: number;
27074
+ platformFee?: PlatformFee;
27075
+ steps: RoutePlanStep[];
27076
+ instructions: Instruction[];
27077
+ addressLookupTables: Pubkey[];
27078
+ contextSlot?: number;
27079
+ timeTaken?: number;
27080
+ expiresAtMs?: number;
27081
+ expiresAfterSlot?: number;
27082
+ computeUnits?: number;
27083
+ computeUnitsSafe?: number;
27084
+ transaction?: Uint8Array;
27085
+ referenceId?: string;
27086
+ }
27087
+ interface PlatformFee {
27088
+ amount: number;
27089
+ fee_bps: number;
27090
+ }
27091
+ interface RoutePlanStep {
27092
+ ammKey: Uint8Array;
27093
+ label: string;
27094
+ inputMint: Uint8Array;
27095
+ outputMint: Uint8Array;
27096
+ inAmount: number;
27097
+ outAmount: number;
27098
+ allocPpb: number;
27099
+ feeMint?: Uint8Array;
27100
+ feeAmount?: number;
27101
+ contextSlot?: number;
27102
+ }
27103
+
27104
+ declare class ConnectionClosed extends Error {
27105
+ code: number;
27106
+ reason: string;
27107
+ constructor(code: number, reason: string);
27108
+ }
27109
+ declare class ErrorResponse extends Error {
27110
+ response: ResponseError;
27111
+ constructor(response: ResponseError);
27501
27112
  }
27502
- /** TODO: docs */
27503
- declare const closeAccountInstructionData: _solana_buffer_layout.Structure<CloseAccountInstructionData>;
27504
- /**
27505
- * Construct a CloseAccount instruction
27506
- *
27507
- * @param account Account to close
27508
- * @param destination Account to receive the remaining balance of the closed account
27509
- * @param authority Account close authority
27510
- * @param multiSigners Signing accounts if `authority` is a multisig
27511
- * @param programId SPL Token program account
27512
- *
27513
- * @return Instruction to add to a transaction
27514
- */
27515
- declare function createCloseAccountInstruction(account: PublicKey, destination: PublicKey, authority: PublicKey, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction;
27516
- /** TODO: docs */
27517
- interface TransferCheckedInstructionData {
27518
- instruction: TokenInstruction.TransferChecked;
27519
- amount: bigint;
27520
- decimals: number;
27113
+ declare class StreamError extends Error {
27114
+ streamId: number;
27115
+ errorCode: number;
27116
+ errorMessage: string;
27117
+ constructor(packet: StreamEnd);
27118
+ }
27119
+ interface ResponseWithStream<T, D> {
27120
+ response: T;
27121
+ stream: ReadableStream<D>;
27122
+ streamId: number;
27123
+ }
27124
+ declare class V1Client {
27125
+ private socket;
27126
+ private nextId;
27127
+ private _closed;
27128
+ private _closing;
27129
+ private pending;
27130
+ private streams;
27131
+ private streamStopping;
27132
+ private closeListeners;
27133
+ static connect(url: string): Promise<V1Client>;
27134
+ private constructor();
27135
+ private nextRequestId;
27136
+ get closed(): boolean;
27137
+ close(): Promise<void>;
27138
+ newSwapQuoteStream(params: SwapQuoteRequest): Promise<ResponseWithStream<QuoteSwapStreamResponse, SwapQuotes>>;
27139
+ stopStream(streamId: number): Promise<StopStreamResponse>;
27140
+ private send;
27141
+ private handleMessage;
27142
+ private handleResponse;
27143
+ private handleResponseError;
27144
+ private handleStreamData;
27145
+ private handleStreamEnd;
27146
+ private cancelStream;
27147
+ private rejectAll;
27148
+ private handleClose;
27149
+ private handleError;
27521
27150
  }
27522
- /** TODO: docs */
27523
- declare const transferCheckedInstructionData: _solana_buffer_layout.Structure<TransferCheckedInstructionData>;
27524
- /**
27525
- * Construct a TransferChecked instruction
27526
- *
27527
- * @param source Source account
27528
- * @param mint Mint account
27529
- * @param destination Destination account
27530
- * @param owner Owner of the source account
27531
- * @param amount Number of tokens to transfer
27532
- * @param decimals Number of decimals in transfer amount
27533
- * @param multiSigners Signing accounts if `owner` is a multisig
27534
- * @param programId SPL Token program account
27535
- *
27536
- * @return Instruction to add to a transaction
27537
- */
27538
- declare function createTransferCheckedInstruction(source: PublicKey, mint: PublicKey, destination: PublicKey, owner: PublicKey, amount: number | bigint, decimals: number, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction;
27539
27151
 
27540
- /** A Solana account public key, encoded as 32 bytes by msgpack. */
27541
- type Pubkey = Uint8Array;
27542
- /** Solana account metadata for an instruction. */
27543
- interface AccountMeta {
27544
- /** Public key for the account. */
27545
- p: Pubkey;
27546
- /** Whether the account is a signer. */
27547
- s: boolean;
27548
- /** Whether the account is writable. */
27549
- w: boolean;
27152
+ interface SerializedInstruction {
27153
+ p: string;
27154
+ a: {
27155
+ p: string;
27156
+ s: boolean;
27157
+ w: boolean;
27158
+ }[];
27159
+ d: string;
27550
27160
  }
27551
- /** A single instruction to be executed as part of a transaction. */
27552
- interface Instruction {
27553
- /** Program id. */
27554
- p: Pubkey;
27555
- /** Account metadata. */
27556
- a: AccountMeta[];
27557
- /** Instruction data. */
27558
- d: Uint8Array;
27161
+ interface SerializedSwapRoute {
27162
+ inAmount: number;
27163
+ outAmount: number;
27164
+ slippageBps: number;
27165
+ platformFee?: {
27166
+ amount: number;
27167
+ fee_bps: number;
27168
+ };
27169
+ instructions: SerializedInstruction[];
27170
+ addressLookupTables: string[];
27171
+ contextSlot?: number;
27172
+ timeTaken?: number;
27559
27173
  }
27560
- /** An address lookup table referenced by a transaction template (key + inner addresses). */
27561
- interface TransactionTemplateLut {
27562
- /** ALT account address. */
27563
- p: Pubkey;
27564
- /** Addresses stored inside the ALT, in order. */
27565
- a: Pubkey[];
27174
+ interface TitanProxySwapQuoteResponse {
27175
+ quotes: {
27176
+ [providerId: string]: SerializedSwapRoute;
27177
+ };
27178
+ inputMint: string;
27179
+ outputMint: string;
27180
+ swapMode: string;
27181
+ amount: number;
27566
27182
  }
27567
- /**
27568
- * Footprint of the instructions/ALTs surrounding the swap, so the router sizes
27569
- * routes to fit alongside them. Wire format uses single-letter fields: `i`
27570
- * instructions, `a` ALTs, `m` extra account metas. See the gateway helper
27571
- * `buildTitanTemplate`. Over the WebSocket this is sent as a native msgpack
27572
- * object (no base64) — unlike the gateway GET there is no URL-length limit, so
27573
- * large ALTs are fine.
27574
- */
27575
- interface TransactionTemplate {
27576
- i: Instruction[];
27577
- a: TransactionTemplateLut[];
27578
- m: AccountMeta[];
27183
+ interface TitanProxyExactOutResponse {
27184
+ inAmount: number;
27185
+ outAmount: number;
27186
+ otherAmountThreshold: string;
27187
+ slippageBps: number;
27579
27188
  }
27580
- declare enum SwapMode {
27581
- ExactIn = "ExactIn",
27582
- ExactOut = "ExactOut"
27189
+ declare function deserializeSerializedInstruction(ix: SerializedInstruction): TransactionInstruction;
27190
+ declare function selectBestRoute<T extends {
27191
+ inAmount: number;
27192
+ outAmount: number;
27193
+ }>(quotes: {
27194
+ [id: string]: T;
27195
+ }, swapMode: "ExactIn" | "ExactOut"): T | null;
27196
+ interface TitanSwapQuoteResult {
27197
+ inAmount: string;
27198
+ outAmount: string;
27199
+ otherAmountThreshold: string;
27200
+ slippageBps: number;
27201
+ platformFee?: {
27202
+ amount: string;
27203
+ feeBps: number;
27204
+ };
27205
+ contextSlot?: number;
27206
+ timeTaken?: number;
27583
27207
  }
27584
- type Uint64 = number | bigint;
27585
- interface ClientRequest {
27586
- id: number;
27587
- data: RequestData;
27208
+ declare function buildSwapQuoteResult(route: {
27209
+ inAmount: number;
27210
+ outAmount: number;
27211
+ slippageBps: number;
27212
+ platformFee?: {
27213
+ amount: number;
27214
+ fee_bps: number;
27215
+ };
27216
+ contextSlot?: number;
27217
+ timeTaken?: number;
27218
+ }, swapMode: "ExactIn" | "ExactOut"): TitanSwapQuoteResult;
27219
+ declare function resolveLookupTables(connection: Connection, lutPubkeys: PublicKey[]): Promise<AddressLookupTableAccount[]>;
27220
+
27221
+ interface TitanTemplateLut {
27222
+ /** ALT account address (32 raw bytes). */
27223
+ p: Uint8Array;
27224
+ /** Addresses stored inside the ALT, in order (32 raw bytes each). */
27225
+ a: Uint8Array[];
27588
27226
  }
27589
- type RequestData = {
27590
- NewSwapQuoteStream: SwapQuoteRequest;
27591
- } | {
27592
- StopStream: StopStreamRequest;
27593
- };
27594
- interface SwapQuoteRequest {
27595
- swap: SwapParams;
27596
- transaction: TransactionParams;
27597
- update?: QuoteUpdateParams;
27227
+ interface TitanTransactionTemplate {
27228
+ i: Instruction[];
27229
+ a: TitanTemplateLut[];
27230
+ m: {
27231
+ p: Uint8Array;
27232
+ s: boolean;
27233
+ w: boolean;
27234
+ }[];
27598
27235
  }
27599
- interface SwapParams {
27600
- inputMint: Pubkey;
27601
- outputMint: Pubkey;
27602
- amount: Uint64;
27603
- swapMode?: SwapMode;
27236
+ /** Convert a web3.js instruction into Titan wire format (raw bytes). */
27237
+ declare function instructionToTitanWire(ix: TransactionInstruction): Instruction;
27238
+ /** Convert a web3.js ALT into Titan wire format (key + inner addresses). */
27239
+ declare function lutToTitanWire(lut: AddressLookupTableAccount): TitanTemplateLut;
27240
+ /**
27241
+ * Build a Titan `transactionTemplate` from the surrounding (non-swap) footprint.
27242
+ * ALT order is preserved — pass them in the order the final message will use.
27243
+ */
27244
+ declare function buildTitanTemplate(footprint: {
27245
+ instructions: TransactionInstruction[];
27246
+ luts: AddressLookupTableAccount[];
27247
+ extraAccountMetas?: {
27248
+ pubkey: PublicKey;
27249
+ isSigner: boolean;
27250
+ isWritable: boolean;
27251
+ }[];
27252
+ }): TitanTransactionTemplate;
27253
+ /** msgpack-encode then base64 a template for the gateway query string. */
27254
+ declare function encodeTitanTemplate(template: TitanTransactionTemplate): string;
27255
+ interface TitanGatewayQuoteParams {
27256
+ /** Gateway base path, e.g. `https://<host>/api/v1`. `/quote/swap` is appended. */
27257
+ basePath: string;
27258
+ apiKey?: string;
27259
+ headers?: Record<string, string>;
27260
+ inputMint: string;
27261
+ outputMint: string;
27262
+ amount: number;
27263
+ userPublicKey: string;
27264
+ outputAccount: string;
27604
27265
  slippageBps?: number;
27266
+ swapMode?: "ExactIn" | "ExactOut";
27605
27267
  dexes?: string[];
27606
27268
  excludeDexes?: string[];
27607
27269
  onlyDirectRoutes?: boolean;
27270
+ /** Allowlist of quote providers by id. The gateway has no exclude-list, so to
27271
+ * drop a provider (e.g. Titan-DART) we list the ones we want. */
27272
+ providers?: string[];
27273
+ /** msgpack+base64 template. Mutually exclusive with the size/account limits
27274
+ * below. Note: sent as a query-string value, so a template that embeds large
27275
+ * ALTs can exceed the gateway's URI limit (414) — prefer the numeric limits
27276
+ * for flashloan footprints that reference big lookup tables. */
27277
+ transactionTemplate?: string;
27278
+ /** Numeric sizing (small query params; safe for LUT-heavy footprints). */
27608
27279
  addSizeConstraint?: boolean;
27609
27280
  sizeConstraint?: number;
27610
- providers?: string[];
27611
- /** Limit total number of accounts used by routes. Default: 256. Available since v1.1. */
27612
27281
  accountsLimitTotal?: number;
27613
- /** Limit writable accounts used by routes. Default: 64. Available since v1.1. */
27614
27282
  accountsLimitWritable?: number;
27615
- /**
27616
- * Reserve room for the surrounding (non-swap) instructions + ALTs so the
27617
- * router sizes routes to fit. Mutually exclusive with `sizeConstraint` /
27618
- * `accountsLimitTotal` / `accountsLimitWritable`. Available since v1.2.
27619
- */
27620
- transactionTemplate?: TransactionTemplate;
27621
- }
27622
- interface TransactionParams {
27623
- userPublicKey: Pubkey;
27624
- closeInputTokenAccount?: boolean;
27625
- createOutputTokenAccount?: boolean;
27626
- feeAccount?: Pubkey;
27627
27283
  feeBps?: number;
27628
- feeFromInputMint?: boolean;
27629
- outputAccount?: Pubkey;
27630
- titanSwapVersion?: SwapVersion;
27284
+ feeAccount?: string;
27631
27285
  }
27632
- declare enum SwapVersion {
27633
- V2 = 2,
27634
- V3 = 3
27286
+ interface TitanGatewayQuoteResponse {
27287
+ quotes: {
27288
+ [id: string]: SwapRoute;
27289
+ };
27290
+ metadata?: {
27291
+ ExpectedWinner?: string;
27292
+ };
27635
27293
  }
27636
- interface QuoteUpdateParams {
27637
- intervalMs?: Uint64;
27638
- num_quotes: number;
27294
+ /**
27295
+ * Fetch a V3 quote/swap from the Titan gateway and return the best route.
27296
+ * Honors the gateway's `ExpectedWinner` when present, otherwise falls back to
27297
+ * `selectBestRoute` semantics (max out for ExactIn, min in for ExactOut).
27298
+ */
27299
+ declare function fetchTitanQuoteSwapV3(params: TitanGatewayQuoteParams): Promise<{
27300
+ route: SwapRoute;
27301
+ raw: TitanGatewayQuoteResponse;
27302
+ }>;
27303
+ /**
27304
+ * Pick the best usable route from a quotes map, honoring Titan's
27305
+ * `ExpectedWinner` when present and skipping non-viable (zero-amount) routes.
27306
+ * Shared by the gateway REST path and the WebSocket adapter.
27307
+ */
27308
+ declare function selectGatewayRoute(raw: TitanGatewayQuoteResponse, swapMode: "ExactIn" | "ExactOut"): SwapRoute | null;
27309
+ /** Deserialize a Titan wire instruction (raw bytes) into a web3.js instruction. */
27310
+ declare function deserializeTitanWireInstruction(ix: Instruction): TransactionInstruction;
27311
+
27312
+ /**
27313
+ * An Exponent `CpiInterfaceContext` — one SY-program account a `trade_pt` CPI needs,
27314
+ * referenced by its index into the **market's address lookup table** (not an inline
27315
+ * pubkey). `resolveExponentTradePtContext` turns these into concrete {@link AccountMeta}s.
27316
+ */
27317
+ interface ExponentCpiInterfaceContext {
27318
+ /** Index into the market's address lookup table. */
27319
+ altIndex: number;
27320
+ isSigner: boolean;
27321
+ isWritable: boolean;
27639
27322
  }
27640
- interface StopStreamRequest {
27641
- id: number;
27323
+ /**
27324
+ * The SY-program CPI account lists that `trade_pt` appends as remaining accounts
27325
+ * (order: `getSyState` ++ `depositSy` ++ `withdrawSy`). Pricing PT reads the SY rate
27326
+ * on-chain, so the trade must carry the flavor's SY-state/deposit/withdraw accounts.
27327
+ */
27328
+ interface ExponentMarketTwoCpiAccounts {
27329
+ getSyState: ExponentCpiInterfaceContext[];
27330
+ depositSy: ExponentCpiInterfaceContext[];
27331
+ withdrawSy: ExponentCpiInterfaceContext[];
27642
27332
  }
27643
- type ServerMessage = {
27644
- Response: ResponseSuccess;
27645
- } | {
27646
- Error: ResponseError;
27647
- } | {
27648
- StreamData: StreamData;
27649
- } | {
27650
- StreamEnd: StreamEnd;
27651
- };
27652
- type ResponseData = {
27653
- NewSwapQuoteStream: QuoteSwapStreamResponse;
27654
- } | {
27655
- StreamStopped: StopStreamResponse;
27656
- };
27657
- interface StreamStart {
27658
- id: number;
27659
- dataType: string;
27333
+ /** The subset of an Exponent `MarketTwo` account that `trade_pt` needs. */
27334
+ interface ExponentMarketTwo {
27335
+ /** The market's own address (`self_address`). */
27336
+ selfAddress: PublicKey;
27337
+ mintPt: PublicKey;
27338
+ mintSy: PublicKey;
27339
+ vault: PublicKey;
27340
+ /** Market liquidity escrow for PT (`token_pt_escrow`). */
27341
+ tokenPtEscrow: PublicKey;
27342
+ /** Market pass-through SY escrow (`token_sy_escrow`). */
27343
+ tokenSyEscrow: PublicKey;
27344
+ /** SY account holding treasury fees from PT trading (`token_fee_treasury_sy`). */
27345
+ tokenFeeTreasurySy: PublicKey;
27346
+ addressLookupTable: PublicKey;
27347
+ syProgram: PublicKey;
27348
+ statusFlags: number;
27349
+ /** SY-program CPI account lists, referenced by ALT index. */
27350
+ cpiAccounts: ExponentMarketTwoCpiAccounts;
27660
27351
  }
27661
- interface ResponseSuccess {
27662
- requestId: number;
27663
- data: ResponseData;
27664
- stream?: StreamStart;
27352
+ /**
27353
+ * Accounts required by `trade_pt`. The first 12 are the fixed `#[derive(Accounts)]`
27354
+ * accounts; `remainingAccounts` are the SY-program CPI accounts (already resolved from
27355
+ * the market ALT by {@link ResolveExponentTradePtContextParams}).
27356
+ */
27357
+ interface ExponentTradePtAccounts {
27358
+ /** Trader / signer (the marginfi account authority). */
27359
+ trader: PublicKey;
27360
+ /** The `MarketTwo` address. */
27361
+ market: PublicKey;
27362
+ /** Trader's SY token account (source of the SY spent buying PT). */
27363
+ tokenSyTrader: PublicKey;
27364
+ /** Trader's PT token account (destination of the bought PT). */
27365
+ tokenPtTrader: PublicKey;
27366
+ /** `MarketTwo.token_sy_escrow`. */
27367
+ tokenSyEscrow: PublicKey;
27368
+ /** `MarketTwo.token_pt_escrow`. */
27369
+ tokenPtEscrow: PublicKey;
27370
+ /** `MarketTwo.address_lookup_table`. */
27371
+ addressLookupTable: PublicKey;
27372
+ /** `MarketTwo.sy_program`. */
27373
+ syProgram: PublicKey;
27374
+ /** `MarketTwo.token_fee_treasury_sy`. */
27375
+ tokenFeeTreasurySy: PublicKey;
27376
+ /** SPL token program for the PT/SY mints (defaults to the classic Token program). */
27377
+ tokenProgram?: PublicKey;
27378
+ /**
27379
+ * SY-program CPI accounts (`getSyState` ++ `depositSy` ++ `withdrawSy`), pubkeys
27380
+ * already resolved from the market ALT. Appended after the 12 fixed accounts.
27381
+ */
27382
+ remainingAccounts: AccountMeta$1[];
27665
27383
  }
27666
- interface ResponseError {
27667
- requestId: number;
27668
- code: number;
27669
- message: string;
27384
+ interface ResolveExponentTradePtContextParams {
27385
+ connection: Connection;
27386
+ /** Trader / signer (the marginfi account authority). */
27387
+ owner: PublicKey;
27388
+ /** The successor maturity's `MarketTwo` address (where the new PT trades). */
27389
+ market: PublicKey;
27390
+ /** Token program for the PT mint (Exponent uses the classic Token program). */
27391
+ ptTokenProgram?: PublicKey;
27392
+ /** Token program for the SY mint. Defaults to classic Token. */
27393
+ syTokenProgram?: PublicKey;
27670
27394
  }
27671
- type StreamDataPayload = {
27672
- SwapQuotes: SwapQuotes;
27673
- };
27674
- interface StreamData {
27675
- id: number;
27676
- seq: number;
27677
- payload: StreamDataPayload;
27395
+ /**
27396
+ * Resolved inputs for a native `trade_pt` (SY → PT) on an Exponent `MarketTwo`: the
27397
+ * fully-resolved `trade_pt` accounts (including the ALT-derived SY-CPI remaining
27398
+ * accounts), the market ALT to add to the transaction's lookup tables, and the SY/PT
27399
+ * token info. Feed `tradePtAccounts` + `addressLookupTable` into `makeRollPtTx`.
27400
+ */
27401
+ interface ExponentTradePtContext {
27402
+ marketAddress: PublicKey;
27403
+ market: ExponentMarketTwo;
27404
+ tradePtAccounts: ExponentTradePtAccounts;
27405
+ /** The market's address lookup table account — must be carried by the transaction. */
27406
+ addressLookupTable: AddressLookupTableAccount;
27407
+ sy: {
27408
+ mint: PublicKey;
27409
+ decimals: number;
27410
+ tokenProgram: PublicKey;
27411
+ };
27412
+ pt: {
27413
+ mint: PublicKey;
27414
+ decimals: number;
27415
+ tokenProgram: PublicKey;
27416
+ };
27678
27417
  }
27679
- interface StreamEnd {
27680
- id: number;
27681
- errorCode?: number;
27682
- errorMessage?: string;
27418
+
27419
+ /** The subset of Exponent's `Vault` account that `merge` / the roll needs. */
27420
+ interface ExponentVault {
27421
+ /** Vault signer authority (`merge.authority`, via `has_one = authority`). */
27422
+ authority: PublicKey;
27423
+ syProgram: PublicKey;
27424
+ mintSy: PublicKey;
27425
+ mintYt: PublicKey;
27426
+ mintPt: PublicKey;
27427
+ escrowSy: PublicKey;
27428
+ yieldPosition: PublicKey;
27429
+ addressLookupTable: PublicKey;
27430
+ /**
27431
+ * SY-program CPI account lists (referenced by ALT index). `merge` appends
27432
+ * `get_sy_state ++ withdraw_sy` as remaining accounts.
27433
+ */
27434
+ cpiAccounts: ExponentMarketTwoCpiAccounts;
27435
+ /**
27436
+ * Total SY backing all PT (native u64). The PT→SY redemption rate is
27437
+ * `sy_for_pt / pt_supply` (Exponent's `Vault::pt_redemption_rate`).
27438
+ */
27439
+ syForPt: bigint;
27440
+ /** Total PT supply (native u64). */
27441
+ ptSupply: bigint;
27442
+ /** Last-seen SY exchange rate (underlying per SY), scaled by 1e12 → BigNumber. Sizes `strip`. */
27443
+ lastSeenSyExchangeRate: BigNumber;
27444
+ /** Final (maturity) SY exchange rate, already scaled by 1e12 → BigNumber (informational). */
27445
+ finalSyExchangeRate: BigNumber;
27446
+ /** Raw status byte. */
27447
+ status: number;
27683
27448
  }
27684
- interface QuoteSwapStreamResponse {
27685
- intervalMs: number;
27449
+
27450
+ /**
27451
+ * Accounts required by `merge`. Most are read off the maturity's `Vault` account
27452
+ * (`mintYt`, `mintPt`, `escrowSy`, `syProgram`, `addressLookupTable`, `yieldPosition`,
27453
+ * `authority`); the `*Ata` accounts are the owner's token accounts.
27454
+ *
27455
+ * After maturity, `merge` burns PT only (the YT burn is skipped because the vault is
27456
+ * inactive) — but the YT accounts are still required by the instruction, so `ytSrcAta`
27457
+ * must be a valid (possibly empty, freshly-created) YT token account.
27458
+ */
27459
+ interface ExponentMergeAccounts {
27460
+ /** Position owner / signer (the marginfi account authority). */
27461
+ owner: PublicKey;
27462
+ /** Vault signer authority (`Vault.authority`). */
27463
+ authority: PublicKey;
27464
+ /** The maturity vault address. */
27465
+ vault: PublicKey;
27466
+ /** Owner's SY token account (destination of the redeemed SY). */
27467
+ sySrcDstAta: PublicKey;
27468
+ /** `Vault.escrow_sy`. */
27469
+ escrowSy: PublicKey;
27470
+ /** Owner's YT token account (source; empty/0 after maturity). */
27471
+ ytSrcAta: PublicKey;
27472
+ /** Owner's PT token account (source; holds the withdrawn PT). */
27473
+ ptSrcAta: PublicKey;
27474
+ /** `Vault.mint_yt`. */
27475
+ mintYt: PublicKey;
27476
+ /** `Vault.mint_pt`. */
27477
+ mintPt: PublicKey;
27478
+ /** `Vault.sy_program`. */
27479
+ syProgram: PublicKey;
27480
+ /** `Vault.address_lookup_table`. */
27481
+ addressLookupTable: PublicKey;
27482
+ /** `Vault.yield_position`. */
27483
+ yieldPosition: PublicKey;
27484
+ /** SPL token program for PT/YT/SY mints (defaults to the classic token program). */
27485
+ tokenProgram?: PublicKey;
27486
+ /**
27487
+ * SY-program CPI accounts (`get_sy_state` ++ `withdraw_sy`), pubkeys already resolved
27488
+ * from the vault's address lookup table. Appended after the 15 fixed accounts.
27489
+ */
27490
+ remainingAccounts?: AccountMeta$1[];
27686
27491
  }
27687
- interface StopStreamResponse {
27688
- id: number;
27492
+ interface ResolveExponentMergeContextParams {
27493
+ connection: Connection;
27494
+ /** Position owner / signer (the marginfi account authority). */
27495
+ owner: PublicKey;
27496
+ /** The maturity vault, or… */
27497
+ vault?: PublicKey;
27498
+ /** …the `MarketTwo` address (its `vault` will be read). One of `vault`/`market` is required. */
27499
+ market?: PublicKey;
27500
+ /** Token program for the PT/YT mints (Exponent's `merge` uses the classic Token program). */
27501
+ ptYtTokenProgram?: PublicKey;
27502
+ /** Token program for the SY mint (may be token-2022). Defaults to classic Token. */
27503
+ syTokenProgram?: PublicKey;
27689
27504
  }
27690
- interface SwapQuotes {
27691
- id: string;
27692
- inputMint: Uint8Array;
27693
- outputMint: Uint8Array;
27694
- swapMode: SwapMode;
27695
- amount: number;
27696
- quotes: {
27697
- [key: string]: SwapRoute;
27698
- };
27699
- /** Present when DART is enabled; names the route Titan recommends. */
27700
- metadata?: {
27701
- ExpectedWinner?: string;
27505
+ /**
27506
+ * Resolved inputs for `makeRollPtTx`, derived from the maturity `Vault`: the `merge`
27507
+ * accounts, the SY (underlying) token the swap leg consumes, and a helper to size the
27508
+ * redeemed SY amount from the vault's PT redemption rate.
27509
+ */
27510
+ interface ExponentMergeContext {
27511
+ vaultAddress: PublicKey;
27512
+ vault: ExponentVault;
27513
+ mergeAccounts: ExponentMergeAccounts;
27514
+ /**
27515
+ * The vault's address lookup table — `merge`'s SY-CPI remaining accounts are referenced
27516
+ * by ALT index, so adding it to the transaction's lookup tables keeps the tx within size
27517
+ * limits. Add it to `MakeRollPtTxParams.addressLookupTableAccounts`.
27518
+ */
27519
+ addressLookupTable: AddressLookupTableAccount;
27520
+ underlying: {
27521
+ mint: PublicKey;
27522
+ decimals: number;
27523
+ tokenProgram: PublicKey;
27702
27524
  };
27525
+ /**
27526
+ * Native SY that `merge` yields for a given native PT amount, mirroring Exponent's
27527
+ * on-chain math: `floor(ptAmountNative × sy_for_pt / pt_supply)`
27528
+ * (`Vault::pt_redemption_rate`). Feed its result into `MakeRollPtTxParams.redeemedAmountNative`.
27529
+ */
27530
+ computeRedeemedAmountNative(ptAmountNative: bigint): bigint;
27703
27531
  }
27704
- interface SwapRoute {
27705
- inAmount: number;
27706
- outAmount: number;
27707
- slippageBps: number;
27708
- platformFee?: PlatformFee;
27709
- steps: RoutePlanStep[];
27710
- instructions: Instruction[];
27711
- addressLookupTables: Pubkey[];
27712
- contextSlot?: number;
27713
- timeTaken?: number;
27714
- expiresAtMs?: number;
27715
- expiresAfterSlot?: number;
27716
- computeUnits?: number;
27717
- computeUnitsSafe?: number;
27718
- transaction?: Uint8Array;
27719
- referenceId?: string;
27532
+
27533
+ /**
27534
+ * Accounts required by `strip` (SY → PT + YT). The first 15 are the fixed
27535
+ * `#[derive(Accounts)]` accounts; `remainingAccounts` are the flavor's `deposit_sy` CPI
27536
+ * accounts (resolved from the vault ALT by {@link ResolveExponentStripContextParams}).
27537
+ */
27538
+ interface ExponentStripAccounts {
27539
+ /** Depositor / signer (the marginfi account authority). */
27540
+ depositor: PublicKey;
27541
+ /** Vault signer authority (`Vault.authority`). */
27542
+ authority: PublicKey;
27543
+ /** The vault address. */
27544
+ vault: PublicKey;
27545
+ /** Owner's SY token account (source of the SY being stripped). */
27546
+ sySrc: PublicKey;
27547
+ /** `Vault.escrow_sy`. */
27548
+ escrowSy: PublicKey;
27549
+ /** Owner's YT token account (destination of the minted YT). */
27550
+ ytDst: PublicKey;
27551
+ /** Owner's PT token account (destination of the minted PT). */
27552
+ ptDst: PublicKey;
27553
+ /** `Vault.mint_yt`. */
27554
+ mintYt: PublicKey;
27555
+ /** `Vault.mint_pt`. */
27556
+ mintPt: PublicKey;
27557
+ /** `Vault.sy_program`. */
27558
+ syProgram: PublicKey;
27559
+ /** `Vault.address_lookup_table`. */
27560
+ addressLookupTable: PublicKey;
27561
+ /** `Vault.yield_position`. */
27562
+ yieldPosition: PublicKey;
27563
+ /** SPL token program for PT/YT/SY mints (defaults to the classic Token program). */
27564
+ tokenProgram?: PublicKey;
27565
+ /** SY-program CPI accounts (`deposit_sy`), pubkeys already resolved from the vault ALT. */
27566
+ remainingAccounts?: AccountMeta$1[];
27720
27567
  }
27721
- interface PlatformFee {
27722
- amount: number;
27723
- fee_bps: number;
27568
+ interface ResolveExponentStripContextParams {
27569
+ connection: Connection;
27570
+ /** Depositor / signer (the marginfi account authority). */
27571
+ owner: PublicKey;
27572
+ /** The (active, successor) vault to strip into, or… */
27573
+ vault?: PublicKey;
27574
+ /** …its `MarketTwo` address (its `vault` will be read). One of `vault`/`market` is required. */
27575
+ market?: PublicKey;
27576
+ /** Token program for the PT/YT mints (Exponent uses the classic Token program). */
27577
+ ptYtTokenProgram?: PublicKey;
27578
+ /** Token program for the SY mint. Defaults to classic Token. */
27579
+ syTokenProgram?: PublicKey;
27724
27580
  }
27725
- interface RoutePlanStep {
27726
- ammKey: Uint8Array;
27727
- label: string;
27728
- inputMint: Uint8Array;
27729
- outputMint: Uint8Array;
27730
- inAmount: number;
27731
- outAmount: number;
27732
- allocPpb: number;
27733
- feeMint?: Uint8Array;
27734
- feeAmount?: number;
27735
- contextSlot?: number;
27581
+ /**
27582
+ * Resolved inputs for `strip` (SY → PT + YT) on an Exponent vault: the strip accounts
27583
+ * (incl. the ALT-derived `deposit_sy` remaining accounts), the vault ALT to add to the
27584
+ * transaction's lookup tables, the SY/PT/YT token info, and a helper to size the minted PT.
27585
+ */
27586
+ interface ExponentStripContext {
27587
+ vaultAddress: PublicKey;
27588
+ vault: ExponentVault;
27589
+ stripAccounts: ExponentStripAccounts;
27590
+ /** The vault's address lookup table — must be carried by the transaction. */
27591
+ addressLookupTable: AddressLookupTableAccount;
27592
+ sy: {
27593
+ mint: PublicKey;
27594
+ decimals: number;
27595
+ tokenProgram: PublicKey;
27596
+ };
27597
+ pt: {
27598
+ mint: PublicKey;
27599
+ decimals: number;
27600
+ tokenProgram: PublicKey;
27601
+ };
27602
+ yt: {
27603
+ mint: PublicKey;
27604
+ tokenProgram: PublicKey;
27605
+ };
27606
+ /** Last-seen SY exchange rate (underlying per SY), from `Vault.last_seen_sy_exchange_rate`. */
27607
+ syExchangeRate: number;
27608
+ /**
27609
+ * Native PT `strip` mints for a given native SY in: `floor(syIn × last_seen_sy_exchange_rate)`.
27610
+ * The last-seen rate can lag the live rate slightly, so apply a small safety buffer (the
27611
+ * minted PT is also the YT amount). Use the result as `MakeRollPtTxParams.ptOutNative`.
27612
+ */
27613
+ computeStrippedPtNative(syInNative: bigint): bigint;
27736
27614
  }
27737
27615
 
27738
- declare class ConnectionClosed extends Error {
27739
- code: number;
27740
- reason: string;
27741
- constructor(code: number, reason: string);
27742
- }
27743
- declare class ErrorResponse extends Error {
27744
- response: ResponseError;
27745
- constructor(response: ResponseError);
27746
- }
27747
- declare class StreamError extends Error {
27748
- streamId: number;
27749
- errorCode: number;
27750
- errorMessage: string;
27751
- constructor(packet: StreamEnd);
27752
- }
27753
- interface ResponseWithStream<T, D> {
27754
- response: T;
27755
- stream: ReadableStream<D>;
27756
- streamId: number;
27757
- }
27758
- declare class V1Client {
27759
- private socket;
27760
- private nextId;
27761
- private _closed;
27762
- private _closing;
27763
- private pending;
27764
- private streams;
27765
- private streamStopping;
27766
- private closeListeners;
27767
- static connect(url: string): Promise<V1Client>;
27768
- private constructor();
27769
- private nextRequestId;
27770
- get closed(): boolean;
27771
- close(): Promise<void>;
27772
- newSwapQuoteStream(params: SwapQuoteRequest): Promise<ResponseWithStream<QuoteSwapStreamResponse, SwapQuotes>>;
27773
- stopStream(streamId: number): Promise<StopStreamResponse>;
27774
- private send;
27775
- private handleMessage;
27776
- private handleResponse;
27777
- private handleResponseError;
27778
- private handleStreamData;
27779
- private handleStreamEnd;
27780
- private cancelStream;
27781
- private rejectAll;
27782
- private handleClose;
27783
- private handleError;
27784
- }
27616
+ /**
27617
+ * Exponent Finance program IDs (mainnet), taken from the official SDK's
27618
+ * `@exponent-labs/exponent-sdk` `environment.js`.
27619
+ *
27620
+ * The **core** program owns the `Vault` / `MarketTwo` accounts and runs the PT
27621
+ * instructions (`merge`, `strip`, `trade_pt`, …). It is `ExponentnaRg…` — the same key as
27622
+ * the repo's `declare_id!`. (An earlier version of this file mislabelled `declare_id!` as a
27623
+ * localnet-only key and used the **generic SY** program `XP1BRLn8…` as "core"; that is
27624
+ * wrong — `XP1BRLn8…` is one of the per-flavor SY programs, and a `merge`/`trade_pt` sent
27625
+ * to it fails because it does not own the core-owned `Vault`/`MarketTwo` accounts. Verified
27626
+ * on mainnet: vault `78MLjM…` is owned by `ExponentnaRg…`.)
27627
+ *
27628
+ * Instruction encoding/accounts come from the committed IDL (`idl/exponent_core.json`).
27629
+ */
27630
+ declare const EXPONENT_CORE_PROGRAM_ID: PublicKey;
27631
+ /** CLMM (`MarketThree`) program — concentrated-liquidity PT/YT trading. */
27632
+ declare const EXPONENT_CLMM_PROGRAM_ID: PublicKey;
27633
+ /** Orderbook program — limit-order PT/YT trading. */
27634
+ declare const EXPONENT_ORDERBOOK_PROGRAM_ID: PublicKey;
27635
+ /** Strategy-vaults program. */
27636
+ declare const EXPONENT_VAULTS_PROGRAM_ID: PublicKey;
27637
+ /**
27638
+ * Per-flavor SY programs. A `Vault.sy_program` is one of these; `merge`/`trade_pt` carry it
27639
+ * as the `sy_program` account (and CPI into it to value SY). bulkSOL uses the **generic**
27640
+ * flavor (`XP1BRLn8…`).
27641
+ */
27642
+ declare const EXPONENT_GENERIC_SY_PROGRAM_ID: PublicKey;
27643
+ declare const EXPONENT_MARGINFI_SY_PROGRAM_ID: PublicKey;
27644
+ declare const EXPONENT_KAMINO_SY_PROGRAM_ID: PublicKey;
27645
+ declare const EXPONENT_JITO_RESTAKING_SY_PROGRAM_ID: PublicKey;
27646
+ declare const EXPONENT_PERENA_SY_PROGRAM_ID: PublicKey;
27647
+ /** Anchor event-CPI authority seed. */
27648
+ declare const EXPONENT_EVENT_AUTHORITY_SEED = "__event_authority";
27649
+
27650
+ /**
27651
+ * Raw Exponent core IDL (as committed in github.com/exponent-finance/exponent-core).
27652
+ * Kept for reference / future codegen. NOTE: its `address` field is the IDL-declared
27653
+ * program id, which differs from the live deployment — see `../constants.ts`.
27654
+ */
27655
+ declare const EXPONENT_CORE_IDL: {
27656
+ address: string;
27657
+ metadata: {
27658
+ name: string;
27659
+ version: string;
27660
+ spec: string;
27661
+ description: string;
27662
+ };
27663
+ instructions: ({
27664
+ name: string;
27665
+ discriminator: number[];
27666
+ accounts: ({
27667
+ name: string;
27668
+ signer: boolean;
27669
+ writable?: undefined;
27670
+ docs?: undefined;
27671
+ } | {
27672
+ name: string;
27673
+ writable: boolean;
27674
+ signer: boolean;
27675
+ docs?: undefined;
27676
+ } | {
27677
+ name: string;
27678
+ writable: boolean;
27679
+ signer?: undefined;
27680
+ docs?: undefined;
27681
+ } | {
27682
+ name: string;
27683
+ signer?: undefined;
27684
+ writable?: undefined;
27685
+ docs?: undefined;
27686
+ } | {
27687
+ name: string;
27688
+ docs: string[];
27689
+ signer?: undefined;
27690
+ writable?: undefined;
27691
+ } | {
27692
+ name: string;
27693
+ docs: string[];
27694
+ writable: boolean;
27695
+ signer?: undefined;
27696
+ })[];
27697
+ args: ({
27698
+ name: string;
27699
+ type: {
27700
+ defined: {
27701
+ name: string;
27702
+ };
27703
+ };
27704
+ } | {
27705
+ name: string;
27706
+ type: string;
27707
+ })[];
27708
+ returns?: undefined;
27709
+ docs?: undefined;
27710
+ } | {
27711
+ name: string;
27712
+ discriminator: number[];
27713
+ accounts: ({
27714
+ name: string;
27715
+ writable: boolean;
27716
+ signer: boolean;
27717
+ } | {
27718
+ name: string;
27719
+ writable: boolean;
27720
+ signer?: undefined;
27721
+ } | {
27722
+ name: string;
27723
+ writable?: undefined;
27724
+ signer?: undefined;
27725
+ })[];
27726
+ args: ({
27727
+ name: string;
27728
+ type: string;
27729
+ } | {
27730
+ name: string;
27731
+ type: {
27732
+ defined: {
27733
+ name: string;
27734
+ };
27735
+ };
27736
+ })[];
27737
+ returns: {
27738
+ defined: {
27739
+ name: string;
27740
+ };
27741
+ };
27742
+ docs?: undefined;
27743
+ } | {
27744
+ name: string;
27745
+ discriminator: number[];
27746
+ accounts: ({
27747
+ name: string;
27748
+ docs: string[];
27749
+ writable: boolean;
27750
+ signer: boolean;
27751
+ } | {
27752
+ name: string;
27753
+ docs: string[];
27754
+ writable: boolean;
27755
+ signer?: undefined;
27756
+ } | {
27757
+ name: string;
27758
+ writable: boolean;
27759
+ docs?: undefined;
27760
+ signer?: undefined;
27761
+ } | {
27762
+ name: string;
27763
+ docs?: undefined;
27764
+ writable?: undefined;
27765
+ signer?: undefined;
27766
+ })[];
27767
+ args: {
27768
+ name: string;
27769
+ type: {
27770
+ defined: {
27771
+ name: string;
27772
+ };
27773
+ };
27774
+ }[];
27775
+ returns: {
27776
+ defined: {
27777
+ name: string;
27778
+ };
27779
+ };
27780
+ docs?: undefined;
27781
+ } | {
27782
+ name: string;
27783
+ docs: string[];
27784
+ discriminator: number[];
27785
+ accounts: ({
27786
+ name: string;
27787
+ docs: string[];
27788
+ writable: boolean;
27789
+ signer: boolean;
27790
+ } | {
27791
+ name: string;
27792
+ docs: string[];
27793
+ writable: boolean;
27794
+ signer?: undefined;
27795
+ } | {
27796
+ name: string;
27797
+ docs?: undefined;
27798
+ writable?: undefined;
27799
+ signer?: undefined;
27800
+ } | {
27801
+ name: string;
27802
+ docs: string[];
27803
+ writable?: undefined;
27804
+ signer?: undefined;
27805
+ })[];
27806
+ args: {
27807
+ name: string;
27808
+ type: string;
27809
+ }[];
27810
+ returns: {
27811
+ defined: {
27812
+ name: string;
27813
+ };
27814
+ };
27815
+ } | {
27816
+ name: string;
27817
+ docs: string[];
27818
+ discriminator: number[];
27819
+ accounts: ({
27820
+ name: string;
27821
+ writable: boolean;
27822
+ signer: boolean;
27823
+ docs?: undefined;
27824
+ } | {
27825
+ name: string;
27826
+ writable?: undefined;
27827
+ signer?: undefined;
27828
+ docs?: undefined;
27829
+ } | {
27830
+ name: string;
27831
+ docs: string[];
27832
+ writable?: undefined;
27833
+ signer?: undefined;
27834
+ } | {
27835
+ name: string;
27836
+ writable: boolean;
27837
+ signer?: undefined;
27838
+ docs?: undefined;
27839
+ })[];
27840
+ args: ({
27841
+ name: string;
27842
+ type: string;
27843
+ } | {
27844
+ name: string;
27845
+ type: {
27846
+ defined: {
27847
+ name: string;
27848
+ };
27849
+ };
27850
+ })[];
27851
+ returns?: undefined;
27852
+ } | {
27853
+ name: string;
27854
+ discriminator: number[];
27855
+ accounts: ({
27856
+ name: string;
27857
+ writable: boolean;
27858
+ signer: boolean;
27859
+ docs?: undefined;
27860
+ } | {
27861
+ name: string;
27862
+ writable: boolean;
27863
+ signer?: undefined;
27864
+ docs?: undefined;
27865
+ } | {
27866
+ name: string;
27867
+ docs: string[];
27868
+ writable: boolean;
27869
+ signer?: undefined;
27870
+ } | {
27871
+ name: string;
27872
+ docs: string[];
27873
+ writable?: undefined;
27874
+ signer?: undefined;
27875
+ } | {
27876
+ name: string;
27877
+ writable?: undefined;
27878
+ signer?: undefined;
27879
+ docs?: undefined;
27880
+ })[];
27881
+ args: {
27882
+ name: string;
27883
+ type: string;
27884
+ }[];
27885
+ returns: {
27886
+ defined: {
27887
+ name: string;
27888
+ };
27889
+ };
27890
+ docs?: undefined;
27891
+ } | {
27892
+ name: string;
27893
+ docs: string[];
27894
+ discriminator: number[];
27895
+ accounts: ({
27896
+ name: string;
27897
+ writable: boolean;
27898
+ signer: boolean;
27899
+ docs?: undefined;
27900
+ } | {
27901
+ name: string;
27902
+ writable: boolean;
27903
+ signer?: undefined;
27904
+ docs?: undefined;
27905
+ } | {
27906
+ name: string;
27907
+ docs: string[];
27908
+ writable: boolean;
27909
+ signer?: undefined;
27910
+ } | {
27911
+ name: string;
27912
+ writable?: undefined;
27913
+ signer?: undefined;
27914
+ docs?: undefined;
27915
+ } | {
27916
+ name: string;
27917
+ docs: string[];
27918
+ writable?: undefined;
27919
+ signer?: undefined;
27920
+ })[];
27921
+ args: {
27922
+ name: string;
27923
+ type: string;
27924
+ }[];
27925
+ returns: {
27926
+ defined: {
27927
+ name: string;
27928
+ };
27929
+ };
27930
+ } | {
27931
+ name: string;
27932
+ docs: string[];
27933
+ discriminator: number[];
27934
+ accounts: ({
27935
+ name: string;
27936
+ writable: boolean;
27937
+ signer: boolean;
27938
+ docs?: undefined;
27939
+ } | {
27940
+ name: string;
27941
+ docs: string[];
27942
+ writable?: undefined;
27943
+ signer?: undefined;
27944
+ } | {
27945
+ name: string;
27946
+ writable: boolean;
27947
+ signer?: undefined;
27948
+ docs?: undefined;
27949
+ } | {
27950
+ name: string;
27951
+ docs: string[];
27952
+ writable: boolean;
27953
+ signer?: undefined;
27954
+ } | {
27955
+ name: string;
27956
+ writable?: undefined;
27957
+ signer?: undefined;
27958
+ docs?: undefined;
27959
+ })[];
27960
+ args: {
27961
+ name: string;
27962
+ type: string;
27963
+ }[];
27964
+ returns?: undefined;
27965
+ })[];
27966
+ accounts: {
27967
+ name: string;
27968
+ discriminator: number[];
27969
+ }[];
27970
+ events: {
27971
+ name: string;
27972
+ discriminator: number[];
27973
+ }[];
27974
+ errors: {
27975
+ code: number;
27976
+ name: string;
27977
+ msg: string;
27978
+ }[];
27979
+ types: ({
27980
+ name: string;
27981
+ type: {
27982
+ kind: string;
27983
+ fields: ({
27984
+ name: string;
27985
+ type: string;
27986
+ } | {
27987
+ name: string;
27988
+ type: {
27989
+ option: string;
27990
+ defined?: undefined;
27991
+ };
27992
+ } | {
27993
+ name: string;
27994
+ type: {
27995
+ defined: {
27996
+ name: string;
27997
+ };
27998
+ option?: undefined;
27999
+ };
28000
+ })[];
28001
+ variants?: undefined;
28002
+ };
28003
+ docs?: undefined;
28004
+ } | {
28005
+ name: string;
28006
+ type: {
28007
+ kind: string;
28008
+ variants: ({
28009
+ name: string;
28010
+ fields: string[];
28011
+ } | {
28012
+ name: string;
28013
+ fields: {
28014
+ name: string;
28015
+ type: string;
28016
+ }[];
28017
+ } | {
28018
+ name: string;
28019
+ fields: {
28020
+ name: string;
28021
+ type: {
28022
+ defined: {
28023
+ name: string;
28024
+ };
28025
+ };
28026
+ }[];
28027
+ })[];
28028
+ fields?: undefined;
28029
+ };
28030
+ docs?: undefined;
28031
+ } | {
28032
+ name: string;
28033
+ type: {
28034
+ kind: string;
28035
+ variants: ({
28036
+ name: string;
28037
+ fields?: undefined;
28038
+ } | {
28039
+ name: string;
28040
+ fields: string[];
28041
+ })[];
28042
+ fields?: undefined;
28043
+ };
28044
+ docs?: undefined;
28045
+ } | {
28046
+ name: string;
28047
+ docs: string[];
28048
+ type: {
28049
+ kind: string;
28050
+ fields: ({
28051
+ name: string;
28052
+ docs: string[];
28053
+ type: {
28054
+ vec: {
28055
+ defined: {
28056
+ name: string;
28057
+ };
28058
+ vec?: undefined;
28059
+ };
28060
+ };
28061
+ } | {
28062
+ name: string;
28063
+ docs: string[];
28064
+ type: {
28065
+ vec: {
28066
+ vec: {
28067
+ defined: {
28068
+ name: string;
28069
+ };
28070
+ };
28071
+ defined?: undefined;
28072
+ };
28073
+ };
28074
+ })[];
28075
+ variants?: undefined;
28076
+ };
28077
+ } | {
28078
+ name: string;
28079
+ docs: string[];
28080
+ type: {
28081
+ kind: string;
28082
+ fields: {
28083
+ array: (string | number)[];
28084
+ }[];
28085
+ variants?: undefined;
28086
+ };
28087
+ } | {
28088
+ name: string;
28089
+ docs: string[];
28090
+ type: {
28091
+ kind: string;
28092
+ fields: ({
28093
+ name: string;
28094
+ docs: string[];
28095
+ type: {
28096
+ defined: {
28097
+ name: string;
28098
+ };
28099
+ };
28100
+ } | {
28101
+ name: string;
28102
+ docs: string[];
28103
+ type: string;
28104
+ })[];
28105
+ variants?: undefined;
28106
+ };
28107
+ } | {
28108
+ name: string;
28109
+ type: {
28110
+ kind: string;
28111
+ fields: ({
28112
+ name: string;
28113
+ type: string;
28114
+ } | {
28115
+ name: string;
28116
+ type: {
28117
+ defined: {
28118
+ name: string;
28119
+ };
28120
+ vec?: undefined;
28121
+ };
28122
+ } | {
28123
+ name: string;
28124
+ type: {
28125
+ vec: string;
28126
+ defined?: undefined;
28127
+ };
28128
+ })[];
28129
+ variants?: undefined;
28130
+ };
28131
+ docs?: undefined;
28132
+ } | {
28133
+ name: string;
28134
+ type: {
28135
+ kind: string;
28136
+ fields: ({
28137
+ name: string;
28138
+ docs: string[];
28139
+ type: string;
28140
+ } | {
28141
+ name: string;
28142
+ docs: string[];
28143
+ type: {
28144
+ array: (string | number)[];
28145
+ defined?: undefined;
28146
+ vec?: undefined;
28147
+ };
28148
+ } | {
28149
+ name: string;
28150
+ docs: string[];
28151
+ type: {
28152
+ defined: {
28153
+ name: string;
28154
+ };
28155
+ array?: undefined;
28156
+ vec?: undefined;
28157
+ };
28158
+ } | {
28159
+ name: string;
28160
+ type: string;
28161
+ docs?: undefined;
28162
+ } | {
28163
+ name: string;
28164
+ type: {
28165
+ vec: {
28166
+ defined: {
28167
+ name: string;
28168
+ };
28169
+ };
28170
+ array?: undefined;
28171
+ defined?: undefined;
28172
+ };
28173
+ docs?: undefined;
28174
+ } | {
28175
+ name: string;
28176
+ type: {
28177
+ defined: {
28178
+ name: string;
28179
+ };
28180
+ array?: undefined;
28181
+ vec?: undefined;
28182
+ };
28183
+ docs?: undefined;
28184
+ })[];
28185
+ variants?: undefined;
28186
+ };
28187
+ docs?: undefined;
28188
+ } | {
28189
+ name: string;
28190
+ type: {
28191
+ kind: string;
28192
+ fields: ({
28193
+ name: string;
28194
+ docs: string[];
28195
+ type: string;
28196
+ } | {
28197
+ name: string;
28198
+ docs: string[];
28199
+ type: {
28200
+ defined: {
28201
+ name: string;
28202
+ };
28203
+ vec?: undefined;
28204
+ };
28205
+ } | {
28206
+ name: string;
28207
+ docs: string[];
28208
+ type: {
28209
+ vec: {
28210
+ defined: {
28211
+ name: string;
28212
+ };
28213
+ };
28214
+ defined?: undefined;
28215
+ };
28216
+ })[];
28217
+ variants?: undefined;
28218
+ };
28219
+ docs?: undefined;
28220
+ })[];
28221
+ };
28222
+
28223
+ /**
28224
+ * Exponent's high-precision `Number` is a little-endian U256 (`[u64; 4]`) scaled by 1e12
28225
+ * (`precise_number::ONE`). See exponent-core `libraries/precise_number`.
28226
+ */
28227
+ declare const EXPONENT_NUMBER_DENOM: BigNumber;
28228
+ /** Convert a decoded Exponent `Number` (LE `[u64; 4]` U256) to a scaled BigNumber. */
28229
+ declare function exponentNumberToBigNumber(raw: unknown): BigNumber;
28230
+ /** Decode a raw `Vault` account buffer into {@link ExponentVault}. */
28231
+ declare function decodeExponentVault(data: Buffer): ExponentVault;
28232
+ /** Decode a `MarketTwo` account and return its `vault` address. */
28233
+ declare function decodeExponentMarketVault(data: Buffer): PublicKey;
28234
+ /** Decode a raw `MarketTwo` account buffer into {@link ExponentMarketTwo}. */
28235
+ declare function decodeExponentMarketTwo(data: Buffer): ExponentMarketTwo;
28236
+ /** Fetch + decode an Exponent `MarketTwo` account. */
28237
+ declare function fetchExponentMarketTwo(connection: Connection, market: PublicKey): Promise<ExponentMarketTwo>;
28238
+ /** Fetch + decode an Exponent `Vault` account. */
28239
+ declare function fetchExponentVault(connection: Connection, vault: PublicKey): Promise<ExponentVault>;
28240
+ /** Fetch a `MarketTwo` account and resolve + fetch its `Vault`. */
28241
+ declare function fetchExponentVaultFromMarket(connection: Connection, market: PublicKey): Promise<{
28242
+ vault: PublicKey;
28243
+ account: ExponentVault;
28244
+ }>;
28245
+ /** Read an SPL mint's decimals (classic + token-2022 share the offset-44 layout). */
28246
+ declare function getMintDecimals(connection: Connection, mint: PublicKey): Promise<number>;
27785
28247
 
27786
- interface SerializedInstruction {
27787
- p: string;
27788
- a: {
27789
- p: string;
27790
- s: boolean;
27791
- w: boolean;
27792
- }[];
27793
- d: string;
27794
- }
27795
- interface SerializedSwapRoute {
27796
- inAmount: number;
27797
- outAmount: number;
27798
- slippageBps: number;
27799
- platformFee?: {
27800
- amount: number;
27801
- fee_bps: number;
27802
- };
27803
- instructions: SerializedInstruction[];
27804
- addressLookupTables: string[];
27805
- contextSlot?: number;
27806
- timeTaken?: number;
27807
- }
27808
- interface TitanProxySwapQuoteResponse {
27809
- quotes: {
27810
- [providerId: string]: SerializedSwapRoute;
27811
- };
27812
- inputMint: string;
27813
- outputMint: string;
27814
- swapMode: string;
27815
- amount: number;
27816
- }
27817
- interface TitanProxyExactOutResponse {
27818
- inAmount: number;
27819
- outAmount: number;
27820
- otherAmountThreshold: string;
27821
- slippageBps: number;
27822
- }
27823
- declare function deserializeSerializedInstruction(ix: SerializedInstruction): TransactionInstruction;
27824
- declare function selectBestRoute<T extends {
27825
- inAmount: number;
27826
- outAmount: number;
27827
- }>(quotes: {
27828
- [id: string]: T;
27829
- }, swapMode: "ExactIn" | "ExactOut"): T | null;
27830
- interface TitanSwapQuoteResult {
27831
- inAmount: string;
27832
- outAmount: string;
27833
- otherAmountThreshold: string;
27834
- slippageBps: number;
27835
- platformFee?: {
27836
- amount: string;
27837
- feeBps: number;
27838
- };
27839
- contextSlot?: number;
27840
- timeTaken?: number;
27841
- }
27842
- declare function buildSwapQuoteResult(route: {
27843
- inAmount: number;
27844
- outAmount: number;
27845
- slippageBps: number;
27846
- platformFee?: {
27847
- amount: number;
27848
- fee_bps: number;
27849
- };
27850
- contextSlot?: number;
27851
- timeTaken?: number;
27852
- }, swapMode: "ExactIn" | "ExactOut"): TitanSwapQuoteResult;
27853
- declare function resolveLookupTables(connection: Connection, lutPubkeys: PublicKey[]): Promise<AddressLookupTableAccount[]>;
28248
+ /** Derive the Anchor event-CPI authority PDA for the Exponent core program. */
28249
+ declare function deriveExponentEventAuthority(): PublicKey;
27854
28250
 
27855
- interface TitanTemplateLut {
27856
- /** ALT account address (32 raw bytes). */
27857
- p: Uint8Array;
27858
- /** Addresses stored inside the ALT, in order (32 raw bytes each). */
27859
- a: Uint8Array[];
27860
- }
27861
- interface TitanTransactionTemplate {
27862
- i: Instruction[];
27863
- a: TitanTemplateLut[];
27864
- m: {
27865
- p: Uint8Array;
27866
- s: boolean;
27867
- w: boolean;
27868
- }[];
27869
- }
27870
- /** Convert a web3.js instruction into Titan wire format (raw bytes). */
27871
- declare function instructionToTitanWire(ix: TransactionInstruction): Instruction;
27872
- /** Convert a web3.js ALT into Titan wire format (key + inner addresses). */
27873
- declare function lutToTitanWire(lut: AddressLookupTableAccount): TitanTemplateLut;
27874
28251
  /**
27875
- * Build a Titan `transactionTemplate` from the surrounding (non-swap) footprint.
27876
- * ALT order is preserved pass them in the order the final message will use.
28252
+ * Resolve everything `makeRollPtTx` needs for an Exponent PT roll by decoding the maturity
28253
+ * `Vault` (every vault-side `merge` account is a `has_one` field on it), deriving the
28254
+ * owner's PT/YT/SY token accounts, and resolving the SY-program CPI remaining accounts
28255
+ * (`get_sy_state ++ withdraw_sy`) from the vault's address lookup table.
27877
28256
  */
27878
- declare function buildTitanTemplate(footprint: {
27879
- instructions: TransactionInstruction[];
27880
- luts: AddressLookupTableAccount[];
27881
- extraAccountMetas?: {
27882
- pubkey: PublicKey;
27883
- isSigner: boolean;
27884
- isWritable: boolean;
27885
- }[];
27886
- }): TitanTransactionTemplate;
27887
- /** msgpack-encode then base64 a template for the gateway query string. */
27888
- declare function encodeTitanTemplate(template: TitanTransactionTemplate): string;
27889
- interface TitanGatewayQuoteParams {
27890
- /** Gateway base path, e.g. `https://<host>/api/v1`. `/quote/swap` is appended. */
27891
- basePath: string;
27892
- apiKey?: string;
27893
- headers?: Record<string, string>;
27894
- inputMint: string;
27895
- outputMint: string;
27896
- amount: number;
27897
- userPublicKey: string;
27898
- outputAccount: string;
27899
- slippageBps?: number;
27900
- swapMode?: "ExactIn" | "ExactOut";
27901
- dexes?: string[];
27902
- excludeDexes?: string[];
27903
- onlyDirectRoutes?: boolean;
27904
- /** Allowlist of quote providers by id. The gateway has no exclude-list, so to
27905
- * drop a provider (e.g. Titan-DART) we list the ones we want. */
27906
- providers?: string[];
27907
- /** msgpack+base64 template. Mutually exclusive with the size/account limits
27908
- * below. Note: sent as a query-string value, so a template that embeds large
27909
- * ALTs can exceed the gateway's URI limit (414) — prefer the numeric limits
27910
- * for flashloan footprints that reference big lookup tables. */
27911
- transactionTemplate?: string;
27912
- /** Numeric sizing (small query params; safe for LUT-heavy footprints). */
27913
- addSizeConstraint?: boolean;
27914
- sizeConstraint?: number;
27915
- accountsLimitTotal?: number;
27916
- accountsLimitWritable?: number;
27917
- feeBps?: number;
27918
- feeAccount?: string;
27919
- }
27920
- interface TitanGatewayQuoteResponse {
27921
- quotes: {
27922
- [id: string]: SwapRoute;
27923
- };
27924
- metadata?: {
27925
- ExpectedWinner?: string;
27926
- };
27927
- }
28257
+ declare function resolveExponentMergeContext(params: ResolveExponentMergeContextParams): Promise<ExponentMergeContext>;
27928
28258
  /**
27929
- * Fetch a V3 quote/swap from the Titan gateway and return the best route.
27930
- * Honors the gateway's `ExpectedWinner` when present, otherwise falls back to
27931
- * `selectBestRoute` semantics (max out for ExactIn, min in for ExactOut).
28259
+ * Resolve everything `makeRollPtTx` needs to buy the successor PT natively (SY PT,
28260
+ * no unwrap, no external aggregator) by trading on the successor maturity's `MarketTwo`.
28261
+ *
28262
+ * Decodes the market, resolves the SY-program CPI accounts from the market's address
28263
+ * lookup table (every `CpiInterfaceContext` is an ALT index), and derives the owner's
28264
+ * SY/PT token accounts. The returned {@link ExponentTradePtContext.addressLookupTable}
28265
+ * must be added to the transaction's lookup tables.
27932
28266
  */
27933
- declare function fetchTitanQuoteSwapV3(params: TitanGatewayQuoteParams): Promise<{
27934
- route: SwapRoute;
27935
- raw: TitanGatewayQuoteResponse;
27936
- }>;
28267
+ declare function resolveExponentTradePtContext(params: ResolveExponentTradePtContextParams): Promise<ExponentTradePtContext>;
27937
28268
  /**
27938
- * Pick the best usable route from a quotes map, honoring Titan's
27939
- * `ExpectedWinner` when present and skipping non-viable (zero-amount) routes.
27940
- * Shared by the gateway REST path and the WebSocket adapter.
28269
+ * Resolve everything needed to `strip` SY PT + YT on an Exponent vault (the buy leg that
28270
+ * *mints* the successor PT, unbounded by AMM depth). Decodes the vault, derives the owner's
28271
+ * SY/PT/YT token accounts, resolves the `deposit_sy` CPI remaining accounts from the vault's
28272
+ * address lookup table, and exposes the last-seen SY exchange rate for sizing the minted PT.
27941
28273
  */
27942
- declare function selectGatewayRoute(raw: TitanGatewayQuoteResponse, swapMode: "ExactIn" | "ExactOut"): SwapRoute | null;
27943
- /** Deserialize a Titan wire instruction (raw bytes) into a web3.js instruction. */
27944
- declare function deserializeTitanWireInstruction(ix: Instruction): TransactionInstruction;
28274
+ declare function resolveExponentStripContext(params: ResolveExponentStripContextParams): Promise<ExponentStripContext>;
28275
+
28276
+ /**
28277
+ * Build the Exponent `merge(amount)` instruction — redeems `amount` PT (post-maturity,
28278
+ * 1:1, no AMM/slippage) into SY at `sySrcDstAta`.
28279
+ *
28280
+ * @param accounts resolved merge accounts (see {@link ExponentMergeAccounts})
28281
+ * @param amountNative PT amount to redeem, in native units (u64)
28282
+ */
28283
+ declare function makeExponentMergeIx(accounts: ExponentMergeAccounts, amountNative: bigint): TransactionInstruction;
28284
+ /**
28285
+ * Signed `trade_pt` args for **buying** PT with SY (the roll's buy leg).
28286
+ *
28287
+ * The program's convention is signed-from-the-trader's-perspective: a buy makes PT flow
28288
+ * *to* the trader (`net_trader_pt > 0`) and SY flow *away* (`sy_constraint < 0`, the most
28289
+ * negative SY balance change the trader will tolerate — i.e. the max SY spent).
28290
+ *
28291
+ * @param ptOutNative exact PT the trader receives (native u64). Set to a conservative
28292
+ * floor; the trade gives exactly this many PT.
28293
+ * @param maxSyInNative max SY the trader is willing to spend (native u64).
28294
+ */
28295
+ declare function exponentBuyPtArgs({ ptOutNative, maxSyInNative, }: {
28296
+ ptOutNative: bigint;
28297
+ maxSyInNative: bigint;
28298
+ }): {
28299
+ netTraderPt: bigint;
28300
+ syConstraint: bigint;
28301
+ };
28302
+ /**
28303
+ * Build the Exponent `trade_pt(net_trader_pt, sy_constraint)` instruction — an
28304
+ * implied-APY AMM trade of SY ↔ PT on a `MarketTwo`. For a buy use {@link exponentBuyPtArgs}.
28305
+ *
28306
+ * Pricing PT reads the SY exchange rate on-chain, so `accounts.remainingAccounts` (the
28307
+ * flavor's SY-program CPI accounts, resolved from the market ALT) are appended after the
28308
+ * 12 fixed accounts, and the transaction must carry the market's address lookup table.
28309
+ *
28310
+ * @param accounts resolved trade accounts (see {@link ExponentTradePtAccounts})
28311
+ * @param args signed `net_trader_pt` / `sy_constraint` (i64 LE)
28312
+ */
28313
+ declare function makeExponentTradePtIx(accounts: ExponentTradePtAccounts, args: {
28314
+ netTraderPt: bigint;
28315
+ syConstraint: bigint;
28316
+ }): TransactionInstruction;
28317
+ /**
28318
+ * Build the Exponent `strip(amount)` instruction — splits `amount` SY into PT + YT on an
28319
+ * active vault. The minted PT lands in `ptDst`, the YT in `ytDst`. Because PT is minted (not
28320
+ * swapped), this is the buy leg for rolling more PT than a thin AMM pool could provide.
28321
+ *
28322
+ * Pricing PT/YT reads the SY rate on-chain, so `accounts.remainingAccounts` (the flavor's
28323
+ * `deposit_sy` CPI accounts, resolved from the vault ALT) are appended after the 15 fixed
28324
+ * accounts, and the transaction must carry the vault's address lookup table.
28325
+ *
28326
+ * @param accounts resolved strip accounts (see {@link ExponentStripAccounts})
28327
+ * @param amountNative SY amount to strip, in native units (u64)
28328
+ */
28329
+ declare function makeExponentStripIx(accounts: ExponentStripAccounts, amountNative: bigint): TransactionInstruction;
27945
28330
 
27946
- export { ACCOUNT_SIZE, ACCOUNT_TYPE_SIZE, ASSOCIATED_TOKEN_PROGRAM_ID, type Account, AccountLayout, type AccountMeta, AccountState, AccountType, type ApproveInstructionData, type Base, type ClientRequest, type CloseAccountInstructionData, ConnectionClosed, CorpAction, CurvePointFields, DEFAULT_RECENT_SLOT_DURATION_MS, DRIFT_IDL, DRIFT_PROGRAM_ID, type DriftIdlType, type DriftInterestRateCurvePoint, DriftRewards, DriftRewardsJSON, DriftSpotBalanceType, DriftSpotMarket, DriftSpotMarketJSON, type DriftSpotMarketRaw, type DriftState, type DriftStateJSON, DriftUser, DriftUserJSON, type DriftUserRaw, DriftUserStats, DriftUserStatsJSON, EXPONENT_CORE_IDL, EXPONENT_CORE_PROGRAM_ID, EXPONENT_EVENT_AUTHORITY_SEED, EXPONENT_LOCALNET_PROGRAM_ID, EXPONENT_NUMBER_DENOM, EXPONENT_WRAPPER_PROGRAM_ID, type Ema, ErrorResponse, ExponentMergeAccounts, ExponentMergeContext, ExponentVault, ExtensionType, FARMS_PROGRAM_ID, FarmStateJSON, FarmStateRaw, FeeStructure, FeeStructureJSON, HistoricalIndexData, HistoricalOracleData, type InitializeAccountInstructionData, type Instruction, InsuranceFund, JUP_EXCHANGE_PRICES_PRECISION, JUP_LEND_IDL, JUP_LEND_PROGRAM_ID, JUP_LIQUIDITY_IDL, JUP_LIQUIDITY_PROGRAM_ID, JUP_MAX_REWARDS_RATE, JUP_REWARDS_PROGRAM_ID, JUP_SECONDS_PER_YEAR, type JupLendIdlType, type JupLendInterestRateCurvePoint, type JupLendRewardsResult, JupLendingRewardsRateModel, JupLendingRewardsRateModelJSON, type JupLendingRewardsRateModelRaw, JupLendingState, JupLendingStateJSON, type JupLendingStateRaw, type JupLiquidityIdlType, JupRateModel, JupRateModelJSON, type JupRateModelRaw, JupTokenReserve, JupTokenReserveJSON, type JupTokenReserveRaw, KFARMS_IDL, KLEND_ACCOUNT_CODER, KLEND_IDL, KLEND_PROGRAM_ID, type KaminoReserveCurveData, type KfarmsIdlType, type KlendIdlType, type KlendInterestRateCurvePoint, LENGTH_SIZE, MAX_SLOT_DIFFERENCE, MEMO_PROGRAM_ID, MINT_SIZE, MULTISIG_SIZE, type Mint, MintLayout, type Multisig, MultisigLayout, NATIVE_MINT, ONE, ONE_HUNDRED_PCT_IN_BPS, ONE_YEAR, ObligationJSON, ObligationRaw, OracleGuardRails, OracleGuardRailsJSON, PERCENTAGE_PRECISION, PERCENTAGE_PRECISION_EXP, type PlatformFee, PoolBalance, type Price, type PriceComponent, type PriceData, PriceStatus, PriceType, type Pubkey, type QuoteSwapStreamResponse, type QuoteUpdateParams, REFRESH_OBLIGATION_DISCRIMINATOR, type RawAccount, type RawMint, type RawMultisig, type RefreshObligationAccounts, type RequestData, ReserveJSON, ReserveRaw, ResolveExponentMergeContextParams, type ResponseData, type ResponseError, type ResponseSuccess, type ResponseWithStream, RewardInfoFields, type RoutePlanStep, SEED_BASE_REFERRER_STATE, SEED_BASE_REFERRER_TOKEN_STATE, SEED_BASE_SHORT_URL, SEED_BASE_USER_METADATA, SEED_DRIFT_SIGNER, SEED_DRIFT_STATE, SEED_FEE_RECEIVER, SEED_F_TOKEN_MINT, SEED_LENDING, SEED_LENDING_ADMIN, SEED_LENDING_MARKET_AUTH, SEED_LENDING_REWARDS_RATE_MODEL, SEED_LIQUIDITY, SEED_RATE_MODEL, SEED_RESERVE, SEED_RESERVE_COLL_MINT, SEED_RESERVE_COLL_SUPPLY, SEED_RESERVE_LIQ_SUPPLY, SEED_SPOT_MARKET, SEED_SPOT_MARKET_VAULT, SEED_USER, SEED_USER_CLAIM, SEED_USER_STATE, SEED_USER_STATS, SEED_USER_SUPPLY_POSITION, SLOTS_PER_DAY, SLOTS_PER_HOUR, SLOTS_PER_MINUTE, SLOTS_PER_SECOND, SLOTS_PER_YEAR, SPOT_MARKET_RATE_PRECISION, SPOT_MARKET_RATE_PRECISION_EXP, SPOT_MARKET_UTILIZATION_PRECISION, SPOT_MARKET_UTILIZATION_PRECISION_EXP, type SerializedInstruction, type SerializedSwapRoute, type ServerMessage, SinglePoolInstruction, SplAccountType, SpotPosition, type StakeAccount, type StopStreamRequest, type StopStreamResponse, type StreamData, type StreamDataPayload, type StreamEnd, StreamError, type StreamStart, SwapMode, type SwapParams, type SwapQuoteRequest, type SwapQuotes, type SwapRoute, SwapVersion, type SyncNativeInstructionData, TEN, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, TYPE_SIZE, type TitanGatewayQuoteParams, type TitanGatewayQuoteResponse, type TitanProxyExactOutResponse, type TitanProxySwapQuoteResponse, type TitanSwapQuoteResult, type TitanTemplateLut, type TitanTransactionTemplate, TokenAccountNotFoundError, TokenError, TokenInstruction, TokenInvalidAccountError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError, TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, TokenInvalidMintError, TokenInvalidOwnerError, TokenOwnerOffCurveError, TokenUnsupportedInstructionError, type TransactionParams, type TransactionTemplate, type TransactionTemplateLut, type TransferCheckedInstructionData, type Uint64, V1Client, ZERO, addSigners, approveInstructionData, buildSwapQuoteResult, buildTitanTemplate, calculateAPYFromAPR, calculateDriftBorrowAPR, calculateDriftBorrowAPY, calculateDriftBorrowRate, calculateDriftDepositRate, calculateDriftInterestRate, calculateDriftLendingAPR, calculateDriftLendingAPY, calculateDriftUtilization, calculateJupLendBorrowRate, calculateJupLendLiquiditySupplyRate, calculateJupLendNewExchangePrice, calculateJupLendRewardsRate, calculateJupLendRewardsRateForExchangePrice, calculateJupLendSupplyAPY, calculateJupLendSupplyRate, calculateJupLendTotalAssets, calculateKaminoEstimatedBorrowRate, calculateKaminoEstimatedSupplyRate, calculateKaminoSupplyAPY, calculateRewardApy, calculateSlotAdjustmentFactor, calculateUtilizationRatio, closeAccountInstructionData, createAccountIx, createApproveInstruction, createAssociatedTokenAccountIdempotentInstruction, createAssociatedTokenAccountInstruction, createCloseAccountInstruction, createInitializeAccountInstruction, createMemoInstruction, createPoolOnrampIx, createSyncNativeInstruction, createTransferCheckedInstruction, decodeDriftSpotMarketData, decodeDriftStateData, decodeDriftUserData, decodeDriftUserStatsData, decodeExponentMarketVault, decodeExponentVault, decodeFarmDataRaw, decodeJupLendingRewardsRateModelData, decodeJupLendingStateData, decodeJupRateModelData, decodeJupTokenReserveData, decodeKlendObligationData, decodeKlendReserveData, deriveBaseObligation, deriveDriftSigner, deriveDriftSpotMarket, deriveDriftSpotMarketVault, deriveDriftState, deriveDriftUser, deriveDriftUserStats, deriveExponentEventAuthority, deriveFeeReceiver, deriveJupLendClaimAccount, deriveJupLendFTokenMint, deriveJupLendLending, deriveJupLendLendingAdmin, deriveJupLendLendingPdas, deriveJupLendLendingRewardsRateModel, deriveJupLendLiquidity, deriveJupLendLiquiditySupplyPositionPda, deriveJupLendLiquidityVaultAta, deriveJupLendRateModel, deriveJupLendTokenReserve, deriveLendingMarketAuthority, deriveObligation, deriveReferrerState, deriveReferrerTokenState, deriveReserveCollateralMint, deriveReserveCollateralSupply, deriveReserveLiquiditySupply, deriveShortUrl, deriveUserMetadata, deriveUserState, deserializeSerializedInstruction, deserializeTitanWireInstruction, driftRewardsRawToDto, driftSpotMarketRawToDto, driftStateRawToDto, driftUserRawToDto, driftUserStatsRawToDto, dtoToDriftRewardsRaw, dtoToDriftSpotMarketRaw, dtoToDriftStateRaw, dtoToDriftUserRaw, dtoToDriftUserStatsRaw, dtoToFarmRaw, dtoToJupLendingRewardsRateModelRaw, dtoToJupLendingStateRaw, dtoToJupRateModelRaw, dtoToJupTokenReserveRaw, dtoToObligationRaw, dtoToReserveRaw, encodeTitanTemplate, exponentNumberToBigNumber, farmRawToDto, fetchExponentVault, fetchExponentVaultFromMarket, fetchTitanQuoteSwapV3, findMplMetadataAddress, findPoolAddress, findPoolMintAddress, findPoolMintAddressByVoteAccount, findPoolMintAuthorityAddress, findPoolMplAuthorityAddress, findPoolOnRampAddress, findPoolStakeAddress, findPoolStakeAuthorityAddress, generateDriftReserveCurve, generateJupLendSupplyCurve, generateKaminoReserveCurve, getAccount, getAccountLen, getAllDerivedDriftAccounts, getAllDerivedJupLendAccounts, getAllDerivedKaminoAccounts, getAllRequiredMarkets, getAssociatedTokenAddressSync, getDriftRewards, getDriftTokenAmount, getFixedHostInterestRate, getJupLendRewards, getKaminoBorrowRate, getKaminoTotalSupply, getMinimumBalanceForRentExemptAccount, getMinimumBalanceForRentExemptAccountWithExtensions, getMint, getMintDecimals, getMultipleAccounts, getProtocolTakeRatePct, getReserveRewardsApy, getRewardPerTimeUnitSecond, getStakeAccount, initializeAccountInstructionData, initializeStakedPoolIxs, initializeStakedPoolTx, instructionToTitanWire, interpolateLinear, jupLendingRewardsRateModelRawToDto, jupLendingStateRawToDto, jupRateModelRawToDto, jupTokenReserveRawToDto, layout, lutToTitanWire, makeExponentMergeIx, makeRefreshObligationIx, makeRefreshReservesBatchIx, makeRefreshingIxs, makeUpdateJupLendRate, makeUpdateJupLendRateIx, makeUpdateSpotMarketCumulativeInterestIx, makeUpdateSpotMarketIx, obligationRawToDto, parsePriceData, parsePriceInfo, replenishPoolIx, reserveRawToDto, resolveExponentMergeContext, resolveLookupTables, scaledSupplies, selectBestRoute, selectGatewayRoute, slotAdjustmentFactor, syncNativeInstructionData, transferCheckedInstructionData, truncateBorrowCurve, unpackAccount };
28331
+ export { ACCOUNT_SIZE, ACCOUNT_TYPE_SIZE, ASSOCIATED_TOKEN_PROGRAM_ID, type Account, AccountLayout, type AccountMeta, AccountState, AccountType, type ApproveInstructionData, type Base, type ClientRequest, type CloseAccountInstructionData, ConnectionClosed, CorpAction, CurvePointFields, DEFAULT_RECENT_SLOT_DURATION_MS, DRIFT_IDL, DRIFT_PROGRAM_ID, type DriftIdlType, type DriftInterestRateCurvePoint, DriftRewards, DriftRewardsJSON, DriftSpotBalanceType, DriftSpotMarket, DriftSpotMarketJSON, type DriftSpotMarketRaw, type DriftState, type DriftStateJSON, DriftUser, DriftUserJSON, type DriftUserRaw, DriftUserStats, DriftUserStatsJSON, EXPONENT_CLMM_PROGRAM_ID, EXPONENT_CORE_IDL, EXPONENT_CORE_PROGRAM_ID, EXPONENT_EVENT_AUTHORITY_SEED, EXPONENT_GENERIC_SY_PROGRAM_ID, EXPONENT_JITO_RESTAKING_SY_PROGRAM_ID, EXPONENT_KAMINO_SY_PROGRAM_ID, EXPONENT_MARGINFI_SY_PROGRAM_ID, EXPONENT_NUMBER_DENOM, EXPONENT_ORDERBOOK_PROGRAM_ID, EXPONENT_PERENA_SY_PROGRAM_ID, EXPONENT_VAULTS_PROGRAM_ID, type Ema, ErrorResponse, type ExponentCpiInterfaceContext, type ExponentMarketTwo, type ExponentMarketTwoCpiAccounts, type ExponentMergeAccounts, type ExponentMergeContext, type ExponentStripAccounts, type ExponentStripContext, type ExponentTradePtAccounts, type ExponentTradePtContext, type ExponentVault, ExtensionType, FARMS_PROGRAM_ID, FarmStateJSON, FarmStateRaw, FeeStructure, FeeStructureJSON, HistoricalIndexData, HistoricalOracleData, type InitializeAccountInstructionData, type Instruction, InsuranceFund, JUP_EXCHANGE_PRICES_PRECISION, JUP_LEND_IDL, JUP_LEND_PROGRAM_ID, JUP_LIQUIDITY_IDL, JUP_LIQUIDITY_PROGRAM_ID, JUP_MAX_REWARDS_RATE, JUP_REWARDS_PROGRAM_ID, JUP_SECONDS_PER_YEAR, type JupLendIdlType, type JupLendInterestRateCurvePoint, type JupLendRewardsResult, JupLendingRewardsRateModel, JupLendingRewardsRateModelJSON, type JupLendingRewardsRateModelRaw, JupLendingState, JupLendingStateJSON, type JupLendingStateRaw, type JupLiquidityIdlType, JupRateModel, JupRateModelJSON, type JupRateModelRaw, JupTokenReserve, JupTokenReserveJSON, type JupTokenReserveRaw, KFARMS_IDL, KLEND_ACCOUNT_CODER, KLEND_IDL, KLEND_PROGRAM_ID, type KaminoReserveCurveData, type KfarmsIdlType, type KlendIdlType, type KlendInterestRateCurvePoint, LENGTH_SIZE, MAX_SLOT_DIFFERENCE, MEMO_PROGRAM_ID, MINT_SIZE, MULTISIG_SIZE, type Mint, MintLayout, type Multisig, MultisigLayout, NATIVE_MINT, ONE, ONE_HUNDRED_PCT_IN_BPS, ONE_YEAR, ObligationJSON, ObligationRaw, OracleGuardRails, OracleGuardRailsJSON, PERCENTAGE_PRECISION, PERCENTAGE_PRECISION_EXP, type PlatformFee, PoolBalance, type Price, type PriceComponent, type PriceData, PriceStatus, PriceType, type Pubkey, type QuoteSwapStreamResponse, type QuoteUpdateParams, REFRESH_OBLIGATION_DISCRIMINATOR, type RawAccount, type RawMint, type RawMultisig, type RefreshObligationAccounts, type RequestData, ReserveJSON, ReserveRaw, type ResolveExponentMergeContextParams, type ResolveExponentStripContextParams, type ResolveExponentTradePtContextParams, type ResponseData, type ResponseError, type ResponseSuccess, type ResponseWithStream, RewardInfoFields, type RoutePlanStep, SEED_BASE_REFERRER_STATE, SEED_BASE_REFERRER_TOKEN_STATE, SEED_BASE_SHORT_URL, SEED_BASE_USER_METADATA, SEED_DRIFT_SIGNER, SEED_DRIFT_STATE, SEED_FEE_RECEIVER, SEED_F_TOKEN_MINT, SEED_LENDING, SEED_LENDING_ADMIN, SEED_LENDING_MARKET_AUTH, SEED_LENDING_REWARDS_RATE_MODEL, SEED_LIQUIDITY, SEED_RATE_MODEL, SEED_RESERVE, SEED_RESERVE_COLL_MINT, SEED_RESERVE_COLL_SUPPLY, SEED_RESERVE_LIQ_SUPPLY, SEED_SPOT_MARKET, SEED_SPOT_MARKET_VAULT, SEED_USER, SEED_USER_CLAIM, SEED_USER_STATE, SEED_USER_STATS, SEED_USER_SUPPLY_POSITION, SLOTS_PER_DAY, SLOTS_PER_HOUR, SLOTS_PER_MINUTE, SLOTS_PER_SECOND, SLOTS_PER_YEAR, SPOT_MARKET_RATE_PRECISION, SPOT_MARKET_RATE_PRECISION_EXP, SPOT_MARKET_UTILIZATION_PRECISION, SPOT_MARKET_UTILIZATION_PRECISION_EXP, type SerializedInstruction, type SerializedSwapRoute, type ServerMessage, SinglePoolInstruction, SplAccountType, SpotPosition, type StakeAccount, type StopStreamRequest, type StopStreamResponse, type StreamData, type StreamDataPayload, type StreamEnd, StreamError, type StreamStart, SwapMode, type SwapParams, type SwapQuoteRequest, type SwapQuotes, type SwapRoute, SwapVersion, type SyncNativeInstructionData, TEN, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, TYPE_SIZE, type TitanGatewayQuoteParams, type TitanGatewayQuoteResponse, type TitanProxyExactOutResponse, type TitanProxySwapQuoteResponse, type TitanSwapQuoteResult, type TitanTemplateLut, type TitanTransactionTemplate, TokenAccountNotFoundError, TokenError, TokenInstruction, TokenInvalidAccountError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError, TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, TokenInvalidMintError, TokenInvalidOwnerError, TokenOwnerOffCurveError, TokenUnsupportedInstructionError, type TransactionParams, type TransactionTemplate, type TransactionTemplateLut, type TransferCheckedInstructionData, type Uint64, V1Client, ZERO, addSigners, approveInstructionData, buildSwapQuoteResult, buildTitanTemplate, calculateAPYFromAPR, calculateDriftBorrowAPR, calculateDriftBorrowAPY, calculateDriftBorrowRate, calculateDriftDepositRate, calculateDriftInterestRate, calculateDriftLendingAPR, calculateDriftLendingAPY, calculateDriftUtilization, calculateJupLendBorrowRate, calculateJupLendLiquiditySupplyRate, calculateJupLendNewExchangePrice, calculateJupLendRewardsRate, calculateJupLendRewardsRateForExchangePrice, calculateJupLendSupplyAPY, calculateJupLendSupplyRate, calculateJupLendTotalAssets, calculateKaminoEstimatedBorrowRate, calculateKaminoEstimatedSupplyRate, calculateKaminoSupplyAPY, calculateRewardApy, calculateSlotAdjustmentFactor, calculateUtilizationRatio, closeAccountInstructionData, createAccountIx, createApproveInstruction, createAssociatedTokenAccountIdempotentInstruction, createAssociatedTokenAccountInstruction, createCloseAccountInstruction, createInitializeAccountInstruction, createMemoInstruction, createPoolOnrampIx, createSyncNativeInstruction, createTransferCheckedInstruction, decodeDriftSpotMarketData, decodeDriftStateData, decodeDriftUserData, decodeDriftUserStatsData, decodeExponentMarketTwo, decodeExponentMarketVault, decodeExponentVault, decodeFarmDataRaw, decodeJupLendingRewardsRateModelData, decodeJupLendingStateData, decodeJupRateModelData, decodeJupTokenReserveData, decodeKlendObligationData, decodeKlendReserveData, deriveBaseObligation, deriveDriftSigner, deriveDriftSpotMarket, deriveDriftSpotMarketVault, deriveDriftState, deriveDriftUser, deriveDriftUserStats, deriveExponentEventAuthority, deriveFeeReceiver, deriveJupLendClaimAccount, deriveJupLendFTokenMint, deriveJupLendLending, deriveJupLendLendingAdmin, deriveJupLendLendingPdas, deriveJupLendLendingRewardsRateModel, deriveJupLendLiquidity, deriveJupLendLiquiditySupplyPositionPda, deriveJupLendLiquidityVaultAta, deriveJupLendRateModel, deriveJupLendTokenReserve, deriveLendingMarketAuthority, deriveObligation, deriveReferrerState, deriveReferrerTokenState, deriveReserveCollateralMint, deriveReserveCollateralSupply, deriveReserveLiquiditySupply, deriveShortUrl, deriveUserMetadata, deriveUserState, deserializeSerializedInstruction, deserializeTitanWireInstruction, driftRewardsRawToDto, driftSpotMarketRawToDto, driftStateRawToDto, driftUserRawToDto, driftUserStatsRawToDto, dtoToDriftRewardsRaw, dtoToDriftSpotMarketRaw, dtoToDriftStateRaw, dtoToDriftUserRaw, dtoToDriftUserStatsRaw, dtoToFarmRaw, dtoToJupLendingRewardsRateModelRaw, dtoToJupLendingStateRaw, dtoToJupRateModelRaw, dtoToJupTokenReserveRaw, dtoToObligationRaw, dtoToReserveRaw, encodeTitanTemplate, exponentBuyPtArgs, exponentNumberToBigNumber, farmRawToDto, fetchExponentMarketTwo, fetchExponentVault, fetchExponentVaultFromMarket, fetchTitanQuoteSwapV3, findMplMetadataAddress, findPoolAddress, findPoolMintAddress, findPoolMintAddressByVoteAccount, findPoolMintAuthorityAddress, findPoolMplAuthorityAddress, findPoolOnRampAddress, findPoolStakeAddress, findPoolStakeAuthorityAddress, generateDriftReserveCurve, generateJupLendSupplyCurve, generateKaminoReserveCurve, getAccount, getAccountLen, getAllDerivedDriftAccounts, getAllDerivedJupLendAccounts, getAllDerivedKaminoAccounts, getAllRequiredMarkets, getAssociatedTokenAddressSync, getDriftRewards, getDriftTokenAmount, getFixedHostInterestRate, getJupLendRewards, getKaminoBorrowRate, getKaminoTotalSupply, getMinimumBalanceForRentExemptAccount, getMinimumBalanceForRentExemptAccountWithExtensions, getMint, getMintDecimals, getMultipleAccounts, getProtocolTakeRatePct, getReserveRewardsApy, getRewardPerTimeUnitSecond, getStakeAccount, initializeAccountInstructionData, initializeStakedPoolIxs, initializeStakedPoolTx, instructionToTitanWire, interpolateLinear, jupLendingRewardsRateModelRawToDto, jupLendingStateRawToDto, jupRateModelRawToDto, jupTokenReserveRawToDto, layout, lutToTitanWire, makeExponentMergeIx, makeExponentStripIx, makeExponentTradePtIx, makeRefreshObligationIx, makeRefreshReservesBatchIx, makeRefreshingIxs, makeUpdateJupLendRate, makeUpdateJupLendRateIx, makeUpdateSpotMarketCumulativeInterestIx, makeUpdateSpotMarketIx, obligationRawToDto, parsePriceData, parsePriceInfo, replenishPoolIx, reserveRawToDto, resolveExponentMergeContext, resolveExponentStripContext, resolveExponentTradePtContext, resolveLookupTables, scaledSupplies, selectBestRoute, selectGatewayRoute, slotAdjustmentFactor, syncNativeInstructionData, transferCheckedInstructionData, truncateBorrowCurve, unpackAccount };