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

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
  };
@@ -27221,726 +26587,1891 @@ declare enum SplAccountType {
27221
26587
  Mint = 1,
27222
26588
  Account = 2
27223
26589
  }
27224
- declare const ACCOUNT_TYPE_SIZE = 1;
27225
- /** Buffer layout for de/serializing a token account */
27226
- declare const AccountLayout: _solana_buffer_layout.Structure<RawAccount>;
27227
- /** Byte length of a token account */
27228
- declare const ACCOUNT_SIZE: number;
27229
- declare const NATIVE_MINT: PublicKey;
26590
+ declare const ACCOUNT_TYPE_SIZE = 1;
26591
+ /** Buffer layout for de/serializing a token account */
26592
+ declare const AccountLayout: _solana_buffer_layout.Structure<RawAccount>;
26593
+ /** Byte length of a token account */
26594
+ declare const ACCOUNT_SIZE: number;
26595
+ declare const NATIVE_MINT: PublicKey;
26596
+ /**
26597
+ * Retrieve information about a token account
26598
+ *
26599
+ * @param connection Connection to use
26600
+ * @param address Token account
26601
+ * @param commitment Desired level of commitment for querying the state
26602
+ * @param programId SPL Token program account
26603
+ *
26604
+ * @return Token account information
26605
+ */
26606
+ declare function getAccount(connection: Connection, address: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise<Account>;
26607
+ /**
26608
+ * Retrieve information about multiple token accounts in a single RPC call
26609
+ *
26610
+ * @param connection Connection to use
26611
+ * @param addresses Token accounts
26612
+ * @param commitment Desired level of commitment for querying the state
26613
+ * @param programId SPL Token program account
26614
+ *
26615
+ * @return Token account information
26616
+ */
26617
+ declare function getMultipleAccounts(connection: Connection, addresses: PublicKey[], commitment?: Commitment, programId?: PublicKey): Promise<Account[]>;
26618
+ /** Get the minimum lamport balance for a base token account to be rent exempt
26619
+ *
26620
+ * @param connection Connection to use
26621
+ * @param commitment Desired level of commitment for querying the state
26622
+ *
26623
+ * @return Amount of lamports required
26624
+ */
26625
+ declare function getMinimumBalanceForRentExemptAccount(connection: Connection, commitment?: Commitment): Promise<number>;
26626
+ declare enum ExtensionType {
26627
+ Uninitialized = 0,
26628
+ TransferFeeConfig = 1,
26629
+ TransferFeeAmount = 2,
26630
+ MintCloseAuthority = 3,
26631
+ ConfidentialTransferMint = 4,
26632
+ ConfidentialTransferAccount = 5,
26633
+ DefaultAccountState = 6,
26634
+ ImmutableOwner = 7,
26635
+ MemoTransfer = 8,
26636
+ NonTransferable = 9,
26637
+ InterestBearingMint = 10
26638
+ }
26639
+ declare function getAccountLen(extensionTypes: ExtensionType[]): number;
26640
+ declare const TYPE_SIZE = 2;
26641
+ declare const LENGTH_SIZE = 2;
26642
+ /** Get the minimum lamport balance for a rent-exempt token account with extensions
26643
+ *
26644
+ * @param connection Connection to use
26645
+ * @param extensions
26646
+ * @param commitment Desired level of commitment for querying the state
26647
+ *
26648
+ * @return Amount of lamports required
26649
+ */
26650
+ declare function getMinimumBalanceForRentExemptAccountWithExtensions(connection: Connection, extensions: ExtensionType[], commitment?: Commitment): Promise<number>;
26651
+ /**
26652
+ * Unpack a token account
26653
+ *
26654
+ * @param address Token account
26655
+ * @param info Token account data
26656
+ * @param programId SPL Token program account
26657
+ *
26658
+ * @return Unpacked token account
26659
+ */
26660
+ declare function unpackAccount(address: PublicKey, info: AccountInfo<Buffer$1> | null, programId?: PublicKey): Account;
26661
+
26662
+ /**
26663
+ * Get the address of the associated token account for a given mint and owner
26664
+ *
26665
+ * @param mint Token mint account
26666
+ * @param owner Owner of the new account
26667
+ * @param allowOwnerOffCurve Allow the owner account to be a PDA (Program Derived Address)
26668
+ * @param programId SPL Token program account
26669
+ * @param associatedTokenProgramId SPL Associated Token program account
26670
+ *
26671
+ * @return Address of the associated token account
26672
+ */
26673
+ declare function getAssociatedTokenAddressSync(mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, programId?: PublicKey, associatedTokenProgramId?: PublicKey): PublicKey;
26674
+
26675
+ /** @internal */
26676
+ declare function addSigners(keys: AccountMeta$1[], ownerOrAuthority: PublicKey, multiSigners: Signer[]): AccountMeta$1[];
26677
+
26678
+ /** Buffer layout for de/serializing a mint */
26679
+ declare const MintLayout: _solana_buffer_layout.Structure<RawMint>;
26680
+ /** Byte length of a mint */
26681
+ declare const MINT_SIZE: number;
26682
+ /**
26683
+ * Retrieve information about a mint
26684
+ *
26685
+ * @param connection Connection to use
26686
+ * @param address Mint account
26687
+ * @param commitment Desired level of commitment for querying the state
26688
+ * @param programId SPL Token program account
26689
+ *
26690
+ * @return Mint information
26691
+ */
26692
+ declare function getMint(connection: Connection, address: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise<Mint>;
26693
+
26694
+ /** Multisig as stored by the program */
26695
+ type RawMultisig = Omit<Multisig, "address">;
26696
+ /** Buffer layout for de/serializing a multisig */
26697
+ declare const MultisigLayout: _solana_buffer_layout.Structure<RawMultisig>;
26698
+ /** Byte length of a multisig */
26699
+ declare const MULTISIG_SIZE: number;
26700
+
26701
+ declare const MEMO_PROGRAM_ID: PublicKey;
26702
+ /** Address of the SPL Associated Token Account program */
26703
+ declare const ASSOCIATED_TOKEN_PROGRAM_ID: PublicKey;
26704
+ declare const TOKEN_PROGRAM_ID: PublicKey;
26705
+ declare const TOKEN_2022_PROGRAM_ID: PublicKey;
26706
+
26707
+ /** Base class for errors */
26708
+ declare abstract class TokenError extends Error {
26709
+ constructor(message?: string);
26710
+ }
26711
+ /** Thrown if an account is not found at the expected address */
26712
+ declare class TokenAccountNotFoundError extends TokenError {
26713
+ name: string;
26714
+ }
26715
+ /** Thrown if a program state account is not a valid Account */
26716
+ declare class TokenInvalidAccountError extends TokenError {
26717
+ name: string;
26718
+ }
26719
+ /** Thrown if a program state account is not owned by the expected token program */
26720
+ declare class TokenInvalidAccountOwnerError extends TokenError {
26721
+ name: string;
26722
+ }
26723
+ /** Thrown if the byte length of an program state account doesn't match the expected size */
26724
+ declare class TokenInvalidAccountSizeError extends TokenError {
26725
+ name: string;
26726
+ }
26727
+ /** Thrown if the mint of a token account doesn't match the expected mint */
26728
+ declare class TokenInvalidMintError extends TokenError {
26729
+ name: string;
26730
+ }
26731
+ /** Thrown if the owner of a token account doesn't match the expected owner */
26732
+ declare class TokenInvalidOwnerError extends TokenError {
26733
+ name: string;
26734
+ }
26735
+ /** Thrown if the owner of a token account is a PDA (Program Derived Address) */
26736
+ declare class TokenOwnerOffCurveError extends TokenError {
26737
+ name: string;
26738
+ }
26739
+ /** Thrown if an instruction's program is invalid */
26740
+ declare class TokenInvalidInstructionProgramError extends TokenError {
26741
+ name: string;
26742
+ }
26743
+ /** Thrown if an instruction's keys are invalid */
26744
+ declare class TokenInvalidInstructionKeysError extends TokenError {
26745
+ name: string;
26746
+ }
26747
+ /** Thrown if an instruction's data is invalid */
26748
+ declare class TokenInvalidInstructionDataError extends TokenError {
26749
+ name: string;
26750
+ }
26751
+ /** Thrown if an instruction's type is invalid */
26752
+ declare class TokenInvalidInstructionTypeError extends TokenError {
26753
+ name: string;
26754
+ }
26755
+ /** Thrown if the program does not support the desired instruction */
26756
+ declare class TokenUnsupportedInstructionError extends TokenError {
26757
+ name: string;
26758
+ }
26759
+
26760
+ /**
26761
+ * Creates and returns an instruction which validates a string of UTF-8
26762
+ * encoded characters and verifies that any accounts provided are signers of
26763
+ * the transaction. The program also logs the memo, as well as any verified
26764
+ * signer addresses, to the transaction log, so that anyone can easily observe
26765
+ * memos and know they were approved by zero or more addresses by inspecting
26766
+ * the transaction log from a trusted provider.
26767
+ *
26768
+ * Public keys passed in via the signerPubkeys will identify Signers which
26769
+ * must subsequently sign the Transaction including the returned
26770
+ * TransactionInstruction in order for the transaction to be valid.
26771
+ *
26772
+ * @param memo The UTF-8 encoded memo string to validate
26773
+ * @param signerPubkeys An array of public keys which must sign the
26774
+ * Transaction including the returned TransactionInstruction in order
26775
+ * for the transaction to be valid and the memo verification to
26776
+ * succeed. null is allowed if there are no signers for the memo
26777
+ * verification.
26778
+ **/
26779
+ declare function createMemoInstruction(memo: string, signerPubkeys?: Array<PublicKey>): TransactionInstruction;
26780
+ /** Instructions defined by the program */
26781
+ declare enum TokenInstruction {
26782
+ Approve = 4,
26783
+ InitializeAccount = 1,
26784
+ TransferChecked = 12,
26785
+ CloseAccount = 9,
26786
+ SyncNative = 17
26787
+ }
26788
+ /** TODO: docs */
26789
+ interface ApproveInstructionData {
26790
+ instruction: TokenInstruction.Approve;
26791
+ amount: bigint;
26792
+ }
26793
+ declare const approveInstructionData: _solana_buffer_layout.Structure<ApproveInstructionData>;
26794
+ /**
26795
+ * Construct an Approve instruction
26796
+ *
26797
+ * @param account Account to set the delegate for
26798
+ * @param delegate Account authorized to transfer tokens from the account
26799
+ * @param owner Owner of the account
26800
+ * @param amount Maximum number of tokens the delegate may transfer
26801
+ * @param multiSigners Signing accounts if `owner` is a multisig
26802
+ * @param programId SPL Token program account
26803
+ *
26804
+ * @return Instruction to add to a transaction
26805
+ */
26806
+ declare function createApproveInstruction(account: PublicKey, delegate: PublicKey, owner: PublicKey, amount: number | bigint, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction;
26807
+ /** TODO: docs */
26808
+ interface InitializeAccountInstructionData {
26809
+ instruction: TokenInstruction.InitializeAccount;
26810
+ }
26811
+ declare const initializeAccountInstructionData: _solana_buffer_layout.Structure<InitializeAccountInstructionData>;
27230
26812
  /**
27231
- * Retrieve information about a token account
26813
+ * Construct an InitializeAccount instruction
27232
26814
  *
27233
- * @param connection Connection to use
27234
- * @param address Token account
27235
- * @param commitment Desired level of commitment for querying the state
27236
- * @param programId SPL Token program account
26815
+ * @param account New token account
26816
+ * @param mint Mint account
26817
+ * @param owner Owner of the new account
26818
+ * @param programId SPL Token program account
27237
26819
  *
27238
- * @return Token account information
26820
+ * @return Instruction to add to a transaction
27239
26821
  */
27240
- declare function getAccount(connection: Connection, address: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise<Account>;
26822
+ declare function createInitializeAccountInstruction(account: PublicKey, mint: PublicKey, owner: PublicKey, programId?: PublicKey): TransactionInstruction;
27241
26823
  /**
27242
- * Retrieve information about multiple token accounts in a single RPC call
26824
+ * Construct an AssociatedTokenAccount instruction
27243
26825
  *
27244
- * @param connection Connection to use
27245
- * @param addresses Token accounts
27246
- * @param commitment Desired level of commitment for querying the state
27247
- * @param programId SPL Token program account
26826
+ * @param payer Payer of the initialization fees
26827
+ * @param associatedToken New associated token account
26828
+ * @param owner Owner of the new account
26829
+ * @param mint Token mint account
26830
+ * @param programId SPL Token program account
26831
+ * @param associatedTokenProgramId SPL Associated Token program account
27248
26832
  *
27249
- * @return Token account information
26833
+ * @return Instruction to add to a transaction
27250
26834
  */
27251
- declare function getMultipleAccounts(connection: Connection, addresses: PublicKey[], commitment?: Commitment, programId?: PublicKey): Promise<Account[]>;
27252
- /** Get the minimum lamport balance for a base token account to be rent exempt
26835
+ declare function createAssociatedTokenAccountInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey): TransactionInstruction;
26836
+ /**
26837
+ * Construct a CreateAssociatedTokenAccountIdempotent instruction
27253
26838
  *
27254
- * @param connection Connection to use
27255
- * @param commitment Desired level of commitment for querying the state
26839
+ * @param payer Payer of the initialization fees
26840
+ * @param associatedToken New associated token account
26841
+ * @param owner Owner of the new account
26842
+ * @param mint Token mint account
26843
+ * @param programId SPL Token program account
26844
+ * @param associatedTokenProgramId SPL Associated Token program account
27256
26845
  *
27257
- * @return Amount of lamports required
26846
+ * @return Instruction to add to a transaction
27258
26847
  */
27259
- declare function getMinimumBalanceForRentExemptAccount(connection: Connection, commitment?: Commitment): Promise<number>;
27260
- declare enum ExtensionType {
27261
- Uninitialized = 0,
27262
- TransferFeeConfig = 1,
27263
- TransferFeeAmount = 2,
27264
- MintCloseAuthority = 3,
27265
- ConfidentialTransferMint = 4,
27266
- ConfidentialTransferAccount = 5,
27267
- DefaultAccountState = 6,
27268
- ImmutableOwner = 7,
27269
- MemoTransfer = 8,
27270
- NonTransferable = 9,
27271
- InterestBearingMint = 10
26848
+ declare function createAssociatedTokenAccountIdempotentInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey): TransactionInstruction;
26849
+ /** TODO: docs */
26850
+ interface SyncNativeInstructionData {
26851
+ instruction: TokenInstruction.SyncNative;
27272
26852
  }
27273
- declare function getAccountLen(extensionTypes: ExtensionType[]): number;
27274
- declare const TYPE_SIZE = 2;
27275
- declare const LENGTH_SIZE = 2;
27276
- /** Get the minimum lamport balance for a rent-exempt token account with extensions
27277
- *
27278
- * @param connection Connection to use
27279
- * @param extensions
27280
- * @param commitment Desired level of commitment for querying the state
27281
- *
27282
- * @return Amount of lamports required
27283
- */
27284
- declare function getMinimumBalanceForRentExemptAccountWithExtensions(connection: Connection, extensions: ExtensionType[], commitment?: Commitment): Promise<number>;
26853
+ /** TODO: docs */
26854
+ declare const syncNativeInstructionData: _solana_buffer_layout.Structure<SyncNativeInstructionData>;
27285
26855
  /**
27286
- * Unpack a token account
26856
+ * Construct a SyncNative instruction
27287
26857
  *
27288
- * @param address Token account
27289
- * @param info Token account data
26858
+ * @param account Native account to sync lamports from
27290
26859
  * @param programId SPL Token program account
27291
26860
  *
27292
- * @return Unpacked token account
26861
+ * @return Instruction to add to a transaction
27293
26862
  */
27294
- declare function unpackAccount(address: PublicKey, info: AccountInfo<Buffer$1> | null, programId?: PublicKey): Account;
27295
-
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>;
27296
26870
  /**
27297
- * Get the address of the associated token account for a given mint and owner
26871
+ * Construct a CloseAccount instruction
27298
26872
  *
27299
- * @param mint Token mint account
27300
- * @param owner Owner of the new account
27301
- * @param allowOwnerOffCurve Allow the owner account to be a PDA (Program Derived Address)
27302
- * @param programId SPL Token program account
27303
- * @param associatedTokenProgramId SPL Associated Token program account
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
27304
26878
  *
27305
- * @return Address of the associated token account
26879
+ * @return Instruction to add to a transaction
27306
26880
  */
27307
- declare function getAssociatedTokenAddressSync(mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, programId?: PublicKey, associatedTokenProgramId?: PublicKey): PublicKey;
27308
-
27309
- /** @internal */
27310
- declare function addSigners(keys: AccountMeta$1[], ownerOrAuthority: PublicKey, multiSigners: Signer[]): AccountMeta$1[];
27311
-
27312
- /** Buffer layout for de/serializing a mint */
27313
- declare const MintLayout: _solana_buffer_layout.Structure<RawMint>;
27314
- /** Byte length of a mint */
27315
- declare const MINT_SIZE: number;
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>;
27316
26890
  /**
27317
- * Retrieve information about a mint
26891
+ * Construct a TransferChecked instruction
27318
26892
  *
27319
- * @param connection Connection to use
27320
- * @param address Mint account
27321
- * @param commitment Desired level of commitment for querying the state
27322
- * @param programId SPL Token program account
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
27323
26901
  *
27324
- * @return Mint information
26902
+ * @return Instruction to add to a transaction
27325
26903
  */
27326
- declare function getMint(connection: Connection, address: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise<Mint>;
27327
-
27328
- /** Multisig as stored by the program */
27329
- type RawMultisig = Omit<Multisig, "address">;
27330
- /** Buffer layout for de/serializing a multisig */
27331
- declare const MultisigLayout: _solana_buffer_layout.Structure<RawMultisig>;
27332
- /** Byte length of a multisig */
27333
- declare const MULTISIG_SIZE: number;
27334
-
27335
- declare const MEMO_PROGRAM_ID: PublicKey;
27336
- /** Address of the SPL Associated Token Account program */
27337
- declare const ASSOCIATED_TOKEN_PROGRAM_ID: PublicKey;
27338
- declare const TOKEN_PROGRAM_ID: PublicKey;
27339
- declare const TOKEN_2022_PROGRAM_ID: PublicKey;
26904
+ declare function createTransferCheckedInstruction(source: PublicKey, mint: PublicKey, destination: PublicKey, owner: PublicKey, amount: number | bigint, decimals: number, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction;
27340
26905
 
27341
- /** Base class for errors */
27342
- declare abstract class TokenError extends Error {
27343
- constructor(message?: string);
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;
27344
26997
  }
27345
- /** Thrown if an account is not found at the expected address */
27346
- declare class TokenAccountNotFoundError extends TokenError {
27347
- name: string;
26998
+ declare enum SwapVersion {
26999
+ V2 = 2,
27000
+ V3 = 3
27348
27001
  }
27349
- /** Thrown if a program state account is not a valid Account */
27350
- declare class TokenInvalidAccountError extends TokenError {
27351
- name: string;
27002
+ interface QuoteUpdateParams {
27003
+ intervalMs?: Uint64;
27004
+ num_quotes: number;
27352
27005
  }
27353
- /** Thrown if a program state account is not owned by the expected token program */
27354
- declare class TokenInvalidAccountOwnerError extends TokenError {
27355
- name: string;
27006
+ interface StopStreamRequest {
27007
+ id: number;
27356
27008
  }
27357
- /** Thrown if the byte length of an program state account doesn't match the expected size */
27358
- declare class TokenInvalidAccountSizeError extends TokenError {
27359
- name: string;
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;
27360
27026
  }
27361
- /** Thrown if the mint of a token account doesn't match the expected mint */
27362
- declare class TokenInvalidMintError extends TokenError {
27363
- name: string;
27027
+ interface ResponseSuccess {
27028
+ requestId: number;
27029
+ data: ResponseData;
27030
+ stream?: StreamStart;
27364
27031
  }
27365
- /** Thrown if the owner of a token account doesn't match the expected owner */
27366
- declare class TokenInvalidOwnerError extends TokenError {
27367
- name: string;
27032
+ interface ResponseError {
27033
+ requestId: number;
27034
+ code: number;
27035
+ message: string;
27368
27036
  }
27369
- /** Thrown if the owner of a token account is a PDA (Program Derived Address) */
27370
- declare class TokenOwnerOffCurveError extends TokenError {
27371
- name: string;
27037
+ type StreamDataPayload = {
27038
+ SwapQuotes: SwapQuotes;
27039
+ };
27040
+ interface StreamData {
27041
+ id: number;
27042
+ seq: number;
27043
+ payload: StreamDataPayload;
27372
27044
  }
27373
- /** Thrown if an instruction's program is invalid */
27374
- declare class TokenInvalidInstructionProgramError extends TokenError {
27375
- name: string;
27045
+ interface StreamEnd {
27046
+ id: number;
27047
+ errorCode?: number;
27048
+ errorMessage?: string;
27376
27049
  }
27377
- /** Thrown if an instruction's keys are invalid */
27378
- declare class TokenInvalidInstructionKeysError extends TokenError {
27379
- name: string;
27050
+ interface QuoteSwapStreamResponse {
27051
+ intervalMs: number;
27380
27052
  }
27381
- /** Thrown if an instruction's data is invalid */
27382
- declare class TokenInvalidInstructionDataError extends TokenError {
27383
- name: string;
27053
+ interface StopStreamResponse {
27054
+ id: number;
27384
27055
  }
27385
- /** Thrown if an instruction's type is invalid */
27386
- declare class TokenInvalidInstructionTypeError extends TokenError {
27387
- name: string;
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
+ };
27388
27069
  }
27389
- /** Thrown if the program does not support the desired instruction */
27390
- declare class TokenUnsupportedInstructionError extends TokenError {
27391
- name: string;
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;
27392
27102
  }
27393
27103
 
27394
- /**
27395
- * Creates and returns an instruction which validates a string of UTF-8
27396
- * encoded characters and verifies that any accounts provided are signers of
27397
- * the transaction. The program also logs the memo, as well as any verified
27398
- * signer addresses, to the transaction log, so that anyone can easily observe
27399
- * memos and know they were approved by zero or more addresses by inspecting
27400
- * the transaction log from a trusted provider.
27401
- *
27402
- * Public keys passed in via the signerPubkeys will identify Signers which
27403
- * must subsequently sign the Transaction including the returned
27404
- * TransactionInstruction in order for the transaction to be valid.
27405
- *
27406
- * @param memo The UTF-8 encoded memo string to validate
27407
- * @param signerPubkeys An array of public keys which must sign the
27408
- * Transaction including the returned TransactionInstruction in order
27409
- * for the transaction to be valid and the memo verification to
27410
- * succeed. null is allowed if there are no signers for the memo
27411
- * verification.
27412
- **/
27413
- declare function createMemoInstruction(memo: string, signerPubkeys?: Array<PublicKey>): TransactionInstruction;
27414
- /** Instructions defined by the program */
27415
- declare enum TokenInstruction {
27416
- Approve = 4,
27417
- InitializeAccount = 1,
27418
- TransferChecked = 12,
27419
- CloseAccount = 9,
27420
- SyncNative = 17
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);
27112
+ }
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;
27150
+ }
27151
+
27152
+ interface SerializedInstruction {
27153
+ p: string;
27154
+ a: {
27155
+ p: string;
27156
+ s: boolean;
27157
+ w: boolean;
27158
+ }[];
27159
+ d: string;
27160
+ }
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;
27173
+ }
27174
+ interface TitanProxySwapQuoteResponse {
27175
+ quotes: {
27176
+ [providerId: string]: SerializedSwapRoute;
27177
+ };
27178
+ inputMint: string;
27179
+ outputMint: string;
27180
+ swapMode: string;
27181
+ amount: number;
27182
+ }
27183
+ interface TitanProxyExactOutResponse {
27184
+ inAmount: number;
27185
+ outAmount: number;
27186
+ otherAmountThreshold: string;
27187
+ slippageBps: number;
27188
+ }
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;
27421
27207
  }
27422
- /** TODO: docs */
27423
- interface ApproveInstructionData {
27424
- instruction: TokenInstruction.Approve;
27425
- amount: bigint;
27208
+ declare function buildSwapQuoteResult(route: {
27209
+ inAmount: number | bigint;
27210
+ outAmount: number | bigint;
27211
+ slippageBps: number;
27212
+ platformFee?: {
27213
+ amount: number | bigint;
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[];
27426
27226
  }
27427
- declare const approveInstructionData: _solana_buffer_layout.Structure<ApproveInstructionData>;
27227
+ interface TitanTransactionTemplate {
27228
+ i: Instruction[];
27229
+ a: TitanTemplateLut[];
27230
+ m: {
27231
+ p: Uint8Array;
27232
+ s: boolean;
27233
+ w: boolean;
27234
+ }[];
27235
+ }
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;
27428
27240
  /**
27429
- * Construct an Approve instruction
27430
- *
27431
- * @param account Account to set the delegate for
27432
- * @param delegate Account authorized to transfer tokens from the account
27433
- * @param owner Owner of the account
27434
- * @param amount Maximum number of tokens the delegate may transfer
27435
- * @param multiSigners Signing accounts if `owner` is a multisig
27436
- * @param programId SPL Token program account
27437
- *
27438
- * @return Instruction to add to a transaction
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.
27439
27243
  */
27440
- declare function createApproveInstruction(account: PublicKey, delegate: PublicKey, owner: PublicKey, amount: number | bigint, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction;
27441
- /** TODO: docs */
27442
- interface InitializeAccountInstructionData {
27443
- instruction: TokenInstruction.InitializeAccount;
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;
27265
+ slippageBps?: number;
27266
+ swapMode?: "ExactIn" | "ExactOut";
27267
+ dexes?: string[];
27268
+ excludeDexes?: string[];
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). */
27279
+ addSizeConstraint?: boolean;
27280
+ sizeConstraint?: number;
27281
+ accountsLimitTotal?: number;
27282
+ accountsLimitWritable?: number;
27283
+ feeBps?: number;
27284
+ feeAccount?: string;
27285
+ }
27286
+ interface TitanGatewayQuoteResponse {
27287
+ quotes: {
27288
+ [id: string]: SwapRoute;
27289
+ };
27290
+ metadata?: {
27291
+ ExpectedWinner?: string;
27292
+ };
27444
27293
  }
27445
- declare const initializeAccountInstructionData: _solana_buffer_layout.Structure<InitializeAccountInstructionData>;
27446
27294
  /**
27447
- * Construct an InitializeAccount instruction
27448
- *
27449
- * @param account New token account
27450
- * @param mint Mint account
27451
- * @param owner Owner of the new account
27452
- * @param programId SPL Token program account
27453
- *
27454
- * @return Instruction to add to a transaction
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).
27455
27298
  */
27456
- declare function createInitializeAccountInstruction(account: PublicKey, mint: PublicKey, owner: PublicKey, programId?: PublicKey): TransactionInstruction;
27299
+ declare function fetchTitanQuoteSwapV3(params: TitanGatewayQuoteParams): Promise<{
27300
+ route: SwapRoute;
27301
+ raw: TitanGatewayQuoteResponse;
27302
+ }>;
27457
27303
  /**
27458
- * Construct an AssociatedTokenAccount instruction
27459
- *
27460
- * @param payer Payer of the initialization fees
27461
- * @param associatedToken New associated token account
27462
- * @param owner Owner of the new account
27463
- * @param mint Token mint account
27464
- * @param programId SPL Token program account
27465
- * @param associatedTokenProgramId SPL Associated Token program account
27466
- *
27467
- * @return Instruction to add to a transaction
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.
27468
27307
  */
27469
- declare function createAssociatedTokenAccountInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey): TransactionInstruction;
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
+
27470
27312
  /**
27471
- * Construct a CreateAssociatedTokenAccountIdempotent instruction
27472
- *
27473
- * @param payer Payer of the initialization fees
27474
- * @param associatedToken New associated token account
27475
- * @param owner Owner of the new account
27476
- * @param mint Token mint account
27477
- * @param programId SPL Token program account
27478
- * @param associatedTokenProgramId SPL Associated Token program account
27479
- *
27480
- * @return Instruction to add to a transaction
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.
27481
27316
  */
27482
- declare function createAssociatedTokenAccountIdempotentInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey): TransactionInstruction;
27483
- /** TODO: docs */
27484
- interface SyncNativeInstructionData {
27485
- instruction: TokenInstruction.SyncNative;
27317
+ interface ExponentCpiInterfaceContext {
27318
+ /** Index into the market's address lookup table. */
27319
+ altIndex: number;
27320
+ isSigner: boolean;
27321
+ isWritable: boolean;
27486
27322
  }
27487
- /** TODO: docs */
27488
- declare const syncNativeInstructionData: _solana_buffer_layout.Structure<SyncNativeInstructionData>;
27489
27323
  /**
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
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.
27496
27327
  */
27497
- declare function createSyncNativeInstruction(account: PublicKey, programId?: PublicKey): TransactionInstruction;
27498
- /** TODO: docs */
27499
- interface CloseAccountInstructionData {
27500
- instruction: TokenInstruction.CloseAccount;
27328
+ interface ExponentMarketTwoCpiAccounts {
27329
+ getSyState: ExponentCpiInterfaceContext[];
27330
+ depositSy: ExponentCpiInterfaceContext[];
27331
+ withdrawSy: ExponentCpiInterfaceContext[];
27501
27332
  }
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;
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;
27521
27351
  }
27522
- /** TODO: docs */
27523
- declare const transferCheckedInstructionData: _solana_buffer_layout.Structure<TransferCheckedInstructionData>;
27524
27352
  /**
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
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}).
27537
27356
  */
27538
- declare function createTransferCheckedInstruction(source: PublicKey, mint: PublicKey, destination: PublicKey, owner: PublicKey, amount: number | bigint, decimals: number, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction;
27539
-
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;
27550
- }
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;
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[];
27559
27383
  }
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[];
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;
27566
27394
  }
27567
27395
  /**
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[];
27579
- }
27580
- declare enum SwapMode {
27581
- ExactIn = "ExactIn",
27582
- ExactOut = "ExactOut"
27583
- }
27584
- type Uint64 = number | bigint;
27585
- interface ClientRequest {
27586
- id: number;
27587
- data: RequestData;
27588
- }
27589
- type RequestData = {
27590
- NewSwapQuoteStream: SwapQuoteRequest;
27591
- } | {
27592
- StopStream: StopStreamRequest;
27593
- };
27594
- interface SwapQuoteRequest {
27595
- swap: SwapParams;
27596
- transaction: TransactionParams;
27597
- update?: QuoteUpdateParams;
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
+ };
27598
27417
  }
27599
- interface SwapParams {
27600
- inputMint: Pubkey;
27601
- outputMint: Pubkey;
27602
- amount: Uint64;
27603
- swapMode?: SwapMode;
27604
- slippageBps?: number;
27605
- dexes?: string[];
27606
- excludeDexes?: string[];
27607
- onlyDirectRoutes?: boolean;
27608
- addSizeConstraint?: boolean;
27609
- sizeConstraint?: number;
27610
- providers?: string[];
27611
- /** Limit total number of accounts used by routes. Default: 256. Available since v1.1. */
27612
- accountsLimitTotal?: number;
27613
- /** Limit writable accounts used by routes. Default: 64. Available since v1.1. */
27614
- accountsLimitWritable?: number;
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;
27615
27430
  /**
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.
27431
+ * SY-program CPI account lists (referenced by ALT index). `merge` appends
27432
+ * `get_sy_state ++ withdraw_sy` as remaining accounts.
27619
27433
  */
27620
- transactionTemplate?: TransactionTemplate;
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;
27621
27448
  }
27622
- interface TransactionParams {
27623
- userPublicKey: Pubkey;
27624
- closeInputTokenAccount?: boolean;
27625
- createOutputTokenAccount?: boolean;
27626
- feeAccount?: Pubkey;
27627
- feeBps?: number;
27628
- feeFromInputMint?: boolean;
27629
- outputAccount?: Pubkey;
27630
- titanSwapVersion?: SwapVersion;
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[];
27631
27491
  }
27632
- declare enum SwapVersion {
27633
- V2 = 2,
27634
- V3 = 3
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;
27635
27504
  }
27636
- interface QuoteUpdateParams {
27637
- intervalMs?: Uint64;
27638
- num_quotes: number;
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;
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;
27639
27531
  }
27640
- interface StopStreamRequest {
27641
- id: number;
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[];
27642
27567
  }
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;
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;
27660
27580
  }
27661
- interface ResponseSuccess {
27662
- requestId: number;
27663
- data: ResponseData;
27664
- stream?: StreamStart;
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;
27665
27614
  }
27666
- interface ResponseError {
27667
- requestId: number;
27668
- code: number;
27669
- message: string;
27615
+
27616
+ /**
27617
+ * Accounts required by `wrapper_merge` — the core instruction that merges PT **and**
27618
+ * redeems the resulting SY into the underlying **base** token in one go (so the buy leg can
27619
+ * swap a normal token, not the un-swappable SY). The 16 fixed accounts mirror the IDL's
27620
+ * `WrapperMerge` struct (same vault-side fields as `merge`, minus the SY destination order);
27621
+ * `remainingAccounts` is the assembled `[...redeem, ...cpi]` list and `redeemSyAccountsUntil`
27622
+ * marks the boundary between them.
27623
+ */
27624
+ interface ExponentWrapperMergeAccounts {
27625
+ /** Position owner / signer (the marginfi account authority). */
27626
+ owner: PublicKey;
27627
+ /** Owner's SY token account (intermediate; the redeem consumes it). */
27628
+ syAta: PublicKey;
27629
+ /** The maturity vault address. */
27630
+ vault: PublicKey;
27631
+ /** `Vault.escrow_sy`. */
27632
+ escrowSy: PublicKey;
27633
+ /** Owner's YT token account (source; empty/0 after maturity). */
27634
+ ytAta: PublicKey;
27635
+ /** Owner's PT token account (source; holds the withdrawn PT). */
27636
+ ptAta: PublicKey;
27637
+ /** `Vault.mint_yt`. */
27638
+ mintYt: PublicKey;
27639
+ /** `Vault.mint_pt`. */
27640
+ mintPt: PublicKey;
27641
+ /** `Vault.authority`. */
27642
+ authority: PublicKey;
27643
+ /** `Vault.address_lookup_table`. */
27644
+ addressLookupTable: PublicKey;
27645
+ /** `Vault.yield_position` (the vault robot yield position). */
27646
+ yieldPosition: PublicKey;
27647
+ /** `Vault.sy_program`. */
27648
+ syProgram: PublicKey;
27649
+ /** SPL token program for the PT/YT/SY mints (defaults to classic Token). */
27650
+ tokenProgram?: PublicKey;
27651
+ /**
27652
+ * Assembled SY-program remaining accounts: the flavor's `redeem_sy` accounts first
27653
+ * (count = `redeemSyAccountsUntil`), then the vault's deduped `withdraw_sy ++ get_sy_state`
27654
+ * CPI accounts. The redeem's first account is the owner and keeps its signer flag.
27655
+ */
27656
+ remainingAccounts: AccountMeta$1[];
27657
+ /** Number of leading `remainingAccounts` that are the flavor redeem accounts. */
27658
+ redeemSyAccountsUntil: number;
27670
27659
  }
27671
- type StreamDataPayload = {
27672
- SwapQuotes: SwapQuotes;
27660
+ interface ResolveExponentWrapperMergeContextParams {
27661
+ connection: Connection;
27662
+ /** Position owner / signer (the marginfi account authority). */
27663
+ owner: PublicKey;
27664
+ /** The maturity vault, or… */
27665
+ vault?: PublicKey;
27666
+ /** …the `MarketTwo` address (its `vault` is read). One of `vault`/`market` is required. */
27667
+ market?: PublicKey;
27668
+ /**
27669
+ * The flavor's underlying **base** token (e.g. bulkSOL). Required — it isn't on the
27670
+ * vault; the caller supplies it (config). The redeem unwraps SY into this token.
27671
+ */
27672
+ baseMint: PublicKey;
27673
+ /** Token program for the base mint (defaults to classic Token). */
27674
+ baseTokenProgram?: PublicKey;
27675
+ /** Token program for the PT/YT mints (Exponent uses classic Token). */
27676
+ ptYtTokenProgram?: PublicKey;
27677
+ /** Token program for the SY mint (may be token-2022). Defaults to classic Token. */
27678
+ syTokenProgram?: PublicKey;
27679
+ }
27680
+ /**
27681
+ * Resolved inputs for the roll's redeem leg: the `wrapper_merge` accounts, the SPL
27682
+ * stake-pool refresh that must run before it (so the SY↔base rate is current), the base
27683
+ * token the swap leg consumes, and a helper to size the redeemed base from the vault rates.
27684
+ */
27685
+ interface ExponentWrapperMergeContext {
27686
+ vaultAddress: PublicKey;
27687
+ vault: ExponentVault;
27688
+ wrapperMergeAccounts: ExponentWrapperMergeAccounts;
27689
+ /**
27690
+ * Instruction(s) the flavor requires *before* `wrapper_merge` (for an SPL-stake-pool LST
27691
+ * like bulkSOL, the stake pool's `UpdateStakePoolBalance` refresh). Empty for flavors that
27692
+ * need none.
27693
+ */
27694
+ preInstructions: TransactionInstruction[];
27695
+ /** The vault's address lookup table — add it to the transaction's lookup tables. */
27696
+ addressLookupTable: AddressLookupTableAccount;
27697
+ /** The redeemed underlying base token (swap-leg input). */
27698
+ baseToken: {
27699
+ mint: PublicKey;
27700
+ decimals: number;
27701
+ tokenProgram: PublicKey;
27702
+ };
27703
+ /** ATAs the bundle touches and must create idempotently (sy, pt, yt, base). */
27704
+ setupMints: {
27705
+ mint: PublicKey;
27706
+ tokenProgram: PublicKey;
27707
+ }[];
27708
+ /**
27709
+ * Native base the wrapper yields for a native PT amount: `merge` gives
27710
+ * `sy = floor(pt × sy_for_pt / pt_supply)`, then the redeem gives
27711
+ * `base = floor(sy × sy_exchange_rate)`. Feed into the swap-engine input sizing.
27712
+ */
27713
+ computeRedeemedBaseNative(ptAmountNative: bigint): bigint;
27714
+ }
27715
+
27716
+ /**
27717
+ * Exponent Finance program IDs (mainnet), taken from the official SDK's
27718
+ * `@exponent-labs/exponent-sdk` `environment.js`.
27719
+ *
27720
+ * The **core** program owns the `Vault` / `MarketTwo` accounts and runs the PT
27721
+ * instructions (`merge`, `strip`, `trade_pt`, …). It is `ExponentnaRg…` — the same key as
27722
+ * the repo's `declare_id!`. (An earlier version of this file mislabelled `declare_id!` as a
27723
+ * localnet-only key and used the **generic SY** program `XP1BRLn8…` as "core"; that is
27724
+ * wrong — `XP1BRLn8…` is one of the per-flavor SY programs, and a `merge`/`trade_pt` sent
27725
+ * to it fails because it does not own the core-owned `Vault`/`MarketTwo` accounts. Verified
27726
+ * on mainnet: vault `78MLjM…` is owned by `ExponentnaRg…`.)
27727
+ *
27728
+ * Instruction encoding/accounts come from the committed IDL (`idl/exponent_core.json`).
27729
+ */
27730
+ declare const EXPONENT_CORE_PROGRAM_ID: PublicKey;
27731
+ /** CLMM (`MarketThree`) program — concentrated-liquidity PT/YT trading. */
27732
+ declare const EXPONENT_CLMM_PROGRAM_ID: PublicKey;
27733
+ /** Orderbook program — limit-order PT/YT trading. */
27734
+ declare const EXPONENT_ORDERBOOK_PROGRAM_ID: PublicKey;
27735
+ /** Strategy-vaults program. */
27736
+ declare const EXPONENT_VAULTS_PROGRAM_ID: PublicKey;
27737
+ /**
27738
+ * Per-flavor SY programs. A `Vault.sy_program` is one of these; `merge`/`trade_pt` carry it
27739
+ * as the `sy_program` account (and CPI into it to value SY). bulkSOL uses the **generic**
27740
+ * flavor (`XP1BRLn8…`).
27741
+ */
27742
+ declare const EXPONENT_GENERIC_SY_PROGRAM_ID: PublicKey;
27743
+ declare const EXPONENT_MARGINFI_SY_PROGRAM_ID: PublicKey;
27744
+ declare const EXPONENT_KAMINO_SY_PROGRAM_ID: PublicKey;
27745
+ declare const EXPONENT_JITO_RESTAKING_SY_PROGRAM_ID: PublicKey;
27746
+ declare const EXPONENT_PERENA_SY_PROGRAM_ID: PublicKey;
27747
+ /** Anchor event-CPI authority seed. */
27748
+ declare const EXPONENT_EVENT_AUTHORITY_SEED = "__event_authority";
27749
+
27750
+ /**
27751
+ * Raw Exponent core IDL (as committed in github.com/exponent-finance/exponent-core).
27752
+ * Kept for reference / future codegen. NOTE: its `address` field is the IDL-declared
27753
+ * program id, which differs from the live deployment — see `../constants.ts`.
27754
+ */
27755
+ declare const EXPONENT_CORE_IDL: {
27756
+ address: string;
27757
+ metadata: {
27758
+ name: string;
27759
+ version: string;
27760
+ spec: string;
27761
+ description: string;
27762
+ };
27763
+ instructions: ({
27764
+ name: string;
27765
+ discriminator: number[];
27766
+ accounts: ({
27767
+ name: string;
27768
+ signer: boolean;
27769
+ writable?: undefined;
27770
+ docs?: undefined;
27771
+ } | {
27772
+ name: string;
27773
+ writable: boolean;
27774
+ signer: boolean;
27775
+ docs?: undefined;
27776
+ } | {
27777
+ name: string;
27778
+ writable: boolean;
27779
+ signer?: undefined;
27780
+ docs?: undefined;
27781
+ } | {
27782
+ name: string;
27783
+ signer?: undefined;
27784
+ writable?: undefined;
27785
+ docs?: undefined;
27786
+ } | {
27787
+ name: string;
27788
+ docs: string[];
27789
+ signer?: undefined;
27790
+ writable?: undefined;
27791
+ } | {
27792
+ name: string;
27793
+ docs: string[];
27794
+ writable: boolean;
27795
+ signer?: undefined;
27796
+ })[];
27797
+ args: ({
27798
+ name: string;
27799
+ type: {
27800
+ defined: {
27801
+ name: string;
27802
+ };
27803
+ };
27804
+ } | {
27805
+ name: string;
27806
+ type: string;
27807
+ })[];
27808
+ returns?: undefined;
27809
+ docs?: undefined;
27810
+ } | {
27811
+ name: string;
27812
+ discriminator: number[];
27813
+ accounts: ({
27814
+ name: string;
27815
+ writable: boolean;
27816
+ signer: boolean;
27817
+ } | {
27818
+ name: string;
27819
+ writable: boolean;
27820
+ signer?: undefined;
27821
+ } | {
27822
+ name: string;
27823
+ writable?: undefined;
27824
+ signer?: undefined;
27825
+ })[];
27826
+ args: ({
27827
+ name: string;
27828
+ type: string;
27829
+ } | {
27830
+ name: string;
27831
+ type: {
27832
+ defined: {
27833
+ name: string;
27834
+ };
27835
+ };
27836
+ })[];
27837
+ returns: {
27838
+ defined: {
27839
+ name: string;
27840
+ };
27841
+ };
27842
+ docs?: undefined;
27843
+ } | {
27844
+ name: string;
27845
+ discriminator: number[];
27846
+ accounts: ({
27847
+ name: string;
27848
+ docs: string[];
27849
+ writable: boolean;
27850
+ signer: boolean;
27851
+ } | {
27852
+ name: string;
27853
+ docs: string[];
27854
+ writable: boolean;
27855
+ signer?: undefined;
27856
+ } | {
27857
+ name: string;
27858
+ writable: boolean;
27859
+ docs?: undefined;
27860
+ signer?: undefined;
27861
+ } | {
27862
+ name: string;
27863
+ docs?: undefined;
27864
+ writable?: undefined;
27865
+ signer?: undefined;
27866
+ })[];
27867
+ args: {
27868
+ name: string;
27869
+ type: {
27870
+ defined: {
27871
+ name: string;
27872
+ };
27873
+ };
27874
+ }[];
27875
+ returns: {
27876
+ defined: {
27877
+ name: string;
27878
+ };
27879
+ };
27880
+ docs?: undefined;
27881
+ } | {
27882
+ name: string;
27883
+ docs: string[];
27884
+ discriminator: number[];
27885
+ accounts: ({
27886
+ name: string;
27887
+ docs: string[];
27888
+ writable: boolean;
27889
+ signer: boolean;
27890
+ } | {
27891
+ name: string;
27892
+ docs: string[];
27893
+ writable: boolean;
27894
+ signer?: undefined;
27895
+ } | {
27896
+ name: string;
27897
+ docs?: undefined;
27898
+ writable?: undefined;
27899
+ signer?: undefined;
27900
+ } | {
27901
+ name: string;
27902
+ docs: string[];
27903
+ writable?: undefined;
27904
+ signer?: undefined;
27905
+ })[];
27906
+ args: {
27907
+ name: string;
27908
+ type: string;
27909
+ }[];
27910
+ returns: {
27911
+ defined: {
27912
+ name: string;
27913
+ };
27914
+ };
27915
+ } | {
27916
+ name: string;
27917
+ docs: string[];
27918
+ discriminator: number[];
27919
+ accounts: ({
27920
+ name: string;
27921
+ writable: boolean;
27922
+ signer: boolean;
27923
+ docs?: undefined;
27924
+ } | {
27925
+ name: string;
27926
+ writable?: undefined;
27927
+ signer?: undefined;
27928
+ docs?: undefined;
27929
+ } | {
27930
+ name: string;
27931
+ docs: string[];
27932
+ writable?: undefined;
27933
+ signer?: undefined;
27934
+ } | {
27935
+ name: string;
27936
+ writable: boolean;
27937
+ signer?: undefined;
27938
+ docs?: undefined;
27939
+ })[];
27940
+ args: ({
27941
+ name: string;
27942
+ type: string;
27943
+ } | {
27944
+ name: string;
27945
+ type: {
27946
+ defined: {
27947
+ name: string;
27948
+ };
27949
+ };
27950
+ })[];
27951
+ returns?: undefined;
27952
+ } | {
27953
+ name: string;
27954
+ discriminator: number[];
27955
+ accounts: ({
27956
+ name: string;
27957
+ writable: boolean;
27958
+ signer: boolean;
27959
+ docs?: undefined;
27960
+ } | {
27961
+ name: string;
27962
+ writable: boolean;
27963
+ signer?: undefined;
27964
+ docs?: undefined;
27965
+ } | {
27966
+ name: string;
27967
+ docs: string[];
27968
+ writable: boolean;
27969
+ signer?: undefined;
27970
+ } | {
27971
+ name: string;
27972
+ docs: string[];
27973
+ writable?: undefined;
27974
+ signer?: undefined;
27975
+ } | {
27976
+ name: string;
27977
+ writable?: undefined;
27978
+ signer?: undefined;
27979
+ docs?: undefined;
27980
+ })[];
27981
+ args: {
27982
+ name: string;
27983
+ type: string;
27984
+ }[];
27985
+ returns: {
27986
+ defined: {
27987
+ name: string;
27988
+ };
27989
+ };
27990
+ docs?: undefined;
27991
+ } | {
27992
+ name: string;
27993
+ docs: string[];
27994
+ discriminator: number[];
27995
+ accounts: ({
27996
+ name: string;
27997
+ writable: boolean;
27998
+ signer: boolean;
27999
+ docs?: undefined;
28000
+ } | {
28001
+ name: string;
28002
+ writable: boolean;
28003
+ signer?: undefined;
28004
+ docs?: undefined;
28005
+ } | {
28006
+ name: string;
28007
+ docs: string[];
28008
+ writable: boolean;
28009
+ signer?: undefined;
28010
+ } | {
28011
+ name: string;
28012
+ writable?: undefined;
28013
+ signer?: undefined;
28014
+ docs?: undefined;
28015
+ } | {
28016
+ name: string;
28017
+ docs: string[];
28018
+ writable?: undefined;
28019
+ signer?: undefined;
28020
+ })[];
28021
+ args: {
28022
+ name: string;
28023
+ type: string;
28024
+ }[];
28025
+ returns: {
28026
+ defined: {
28027
+ name: string;
28028
+ };
28029
+ };
28030
+ } | {
28031
+ name: string;
28032
+ docs: string[];
28033
+ discriminator: number[];
28034
+ accounts: ({
28035
+ name: string;
28036
+ writable: boolean;
28037
+ signer: boolean;
28038
+ docs?: undefined;
28039
+ } | {
28040
+ name: string;
28041
+ docs: string[];
28042
+ writable?: undefined;
28043
+ signer?: undefined;
28044
+ } | {
28045
+ name: string;
28046
+ writable: boolean;
28047
+ signer?: undefined;
28048
+ docs?: undefined;
28049
+ } | {
28050
+ name: string;
28051
+ docs: string[];
28052
+ writable: boolean;
28053
+ signer?: undefined;
28054
+ } | {
28055
+ name: string;
28056
+ writable?: undefined;
28057
+ signer?: undefined;
28058
+ docs?: undefined;
28059
+ })[];
28060
+ args: {
28061
+ name: string;
28062
+ type: string;
28063
+ }[];
28064
+ returns?: undefined;
28065
+ })[];
28066
+ accounts: {
28067
+ name: string;
28068
+ discriminator: number[];
28069
+ }[];
28070
+ events: {
28071
+ name: string;
28072
+ discriminator: number[];
28073
+ }[];
28074
+ errors: {
28075
+ code: number;
28076
+ name: string;
28077
+ msg: string;
28078
+ }[];
28079
+ types: ({
28080
+ name: string;
28081
+ type: {
28082
+ kind: string;
28083
+ fields: ({
28084
+ name: string;
28085
+ type: string;
28086
+ } | {
28087
+ name: string;
28088
+ type: {
28089
+ option: string;
28090
+ defined?: undefined;
28091
+ };
28092
+ } | {
28093
+ name: string;
28094
+ type: {
28095
+ defined: {
28096
+ name: string;
28097
+ };
28098
+ option?: undefined;
28099
+ };
28100
+ })[];
28101
+ variants?: undefined;
28102
+ };
28103
+ docs?: undefined;
28104
+ } | {
28105
+ name: string;
28106
+ type: {
28107
+ kind: string;
28108
+ variants: ({
28109
+ name: string;
28110
+ fields: string[];
28111
+ } | {
28112
+ name: string;
28113
+ fields: {
28114
+ name: string;
28115
+ type: string;
28116
+ }[];
28117
+ } | {
28118
+ name: string;
28119
+ fields: {
28120
+ name: string;
28121
+ type: {
28122
+ defined: {
28123
+ name: string;
28124
+ };
28125
+ };
28126
+ }[];
28127
+ })[];
28128
+ fields?: undefined;
28129
+ };
28130
+ docs?: undefined;
28131
+ } | {
28132
+ name: string;
28133
+ type: {
28134
+ kind: string;
28135
+ variants: ({
28136
+ name: string;
28137
+ fields?: undefined;
28138
+ } | {
28139
+ name: string;
28140
+ fields: string[];
28141
+ })[];
28142
+ fields?: undefined;
28143
+ };
28144
+ docs?: undefined;
28145
+ } | {
28146
+ name: string;
28147
+ docs: string[];
28148
+ type: {
28149
+ kind: string;
28150
+ fields: ({
28151
+ name: string;
28152
+ docs: string[];
28153
+ type: {
28154
+ vec: {
28155
+ defined: {
28156
+ name: string;
28157
+ };
28158
+ vec?: undefined;
28159
+ };
28160
+ };
28161
+ } | {
28162
+ name: string;
28163
+ docs: string[];
28164
+ type: {
28165
+ vec: {
28166
+ vec: {
28167
+ defined: {
28168
+ name: string;
28169
+ };
28170
+ };
28171
+ defined?: undefined;
28172
+ };
28173
+ };
28174
+ })[];
28175
+ variants?: undefined;
28176
+ };
28177
+ } | {
28178
+ name: string;
28179
+ docs: string[];
28180
+ type: {
28181
+ kind: string;
28182
+ fields: {
28183
+ array: (string | number)[];
28184
+ }[];
28185
+ variants?: undefined;
28186
+ };
28187
+ } | {
28188
+ name: string;
28189
+ docs: string[];
28190
+ type: {
28191
+ kind: string;
28192
+ fields: ({
28193
+ name: string;
28194
+ docs: string[];
28195
+ type: {
28196
+ defined: {
28197
+ name: string;
28198
+ };
28199
+ };
28200
+ } | {
28201
+ name: string;
28202
+ docs: string[];
28203
+ type: string;
28204
+ })[];
28205
+ variants?: undefined;
28206
+ };
28207
+ } | {
28208
+ name: string;
28209
+ type: {
28210
+ kind: string;
28211
+ fields: ({
28212
+ name: string;
28213
+ type: string;
28214
+ } | {
28215
+ name: string;
28216
+ type: {
28217
+ defined: {
28218
+ name: string;
28219
+ };
28220
+ vec?: undefined;
28221
+ };
28222
+ } | {
28223
+ name: string;
28224
+ type: {
28225
+ vec: string;
28226
+ defined?: undefined;
28227
+ };
28228
+ })[];
28229
+ variants?: undefined;
28230
+ };
28231
+ docs?: undefined;
28232
+ } | {
28233
+ name: string;
28234
+ type: {
28235
+ kind: string;
28236
+ fields: ({
28237
+ name: string;
28238
+ docs: string[];
28239
+ type: string;
28240
+ } | {
28241
+ name: string;
28242
+ docs: string[];
28243
+ type: {
28244
+ array: (string | number)[];
28245
+ defined?: undefined;
28246
+ vec?: undefined;
28247
+ };
28248
+ } | {
28249
+ name: string;
28250
+ docs: string[];
28251
+ type: {
28252
+ defined: {
28253
+ name: string;
28254
+ };
28255
+ array?: undefined;
28256
+ vec?: undefined;
28257
+ };
28258
+ } | {
28259
+ name: string;
28260
+ type: string;
28261
+ docs?: undefined;
28262
+ } | {
28263
+ name: string;
28264
+ type: {
28265
+ vec: {
28266
+ defined: {
28267
+ name: string;
28268
+ };
28269
+ };
28270
+ array?: undefined;
28271
+ defined?: undefined;
28272
+ };
28273
+ docs?: undefined;
28274
+ } | {
28275
+ name: string;
28276
+ type: {
28277
+ defined: {
28278
+ name: string;
28279
+ };
28280
+ array?: undefined;
28281
+ vec?: undefined;
28282
+ };
28283
+ docs?: undefined;
28284
+ })[];
28285
+ variants?: undefined;
28286
+ };
28287
+ docs?: undefined;
28288
+ } | {
28289
+ name: string;
28290
+ type: {
28291
+ kind: string;
28292
+ fields: ({
28293
+ name: string;
28294
+ docs: string[];
28295
+ type: string;
28296
+ } | {
28297
+ name: string;
28298
+ docs: string[];
28299
+ type: {
28300
+ defined: {
28301
+ name: string;
28302
+ };
28303
+ vec?: undefined;
28304
+ };
28305
+ } | {
28306
+ name: string;
28307
+ docs: string[];
28308
+ type: {
28309
+ vec: {
28310
+ defined: {
28311
+ name: string;
28312
+ };
28313
+ };
28314
+ defined?: undefined;
28315
+ };
28316
+ })[];
28317
+ variants?: undefined;
28318
+ };
28319
+ docs?: undefined;
28320
+ })[];
27673
28321
  };
27674
- interface StreamData {
27675
- id: number;
27676
- seq: number;
27677
- payload: StreamDataPayload;
27678
- }
27679
- interface StreamEnd {
27680
- id: number;
27681
- errorCode?: number;
27682
- errorMessage?: string;
27683
- }
27684
- interface QuoteSwapStreamResponse {
27685
- intervalMs: number;
27686
- }
27687
- interface StopStreamResponse {
27688
- id: number;
27689
- }
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;
27702
- };
27703
- }
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;
27720
- }
27721
- interface PlatformFee {
27722
- amount: number;
27723
- fee_bps: number;
27724
- }
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;
27736
- }
27737
28322
 
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
- }
28323
+ /**
28324
+ * Exponent's high-precision `Number` is a little-endian U256 (`[u64; 4]`) scaled by 1e12
28325
+ * (`precise_number::ONE`). See exponent-core `libraries/precise_number`.
28326
+ */
28327
+ declare const EXPONENT_NUMBER_DENOM: BigNumber;
28328
+ /** Convert a decoded Exponent `Number` (LE `[u64; 4]` U256) to a scaled BigNumber. */
28329
+ declare function exponentNumberToBigNumber(raw: unknown): BigNumber;
28330
+ /** Decode a raw `Vault` account buffer into {@link ExponentVault}. */
28331
+ declare function decodeExponentVault(data: Buffer): ExponentVault;
28332
+ /** Decode a `MarketTwo` account and return its `vault` address. */
28333
+ declare function decodeExponentMarketVault(data: Buffer): PublicKey;
28334
+ /** Decode a raw `MarketTwo` account buffer into {@link ExponentMarketTwo}. */
28335
+ declare function decodeExponentMarketTwo(data: Buffer): ExponentMarketTwo;
28336
+ /** Fetch + decode an Exponent `MarketTwo` account. */
28337
+ declare function fetchExponentMarketTwo(connection: Connection, market: PublicKey): Promise<ExponentMarketTwo>;
28338
+ /** Fetch + decode an Exponent `Vault` account. */
28339
+ declare function fetchExponentVault(connection: Connection, vault: PublicKey): Promise<ExponentVault>;
28340
+ /** Fetch a `MarketTwo` account and resolve + fetch its `Vault`. */
28341
+ declare function fetchExponentVaultFromMarket(connection: Connection, market: PublicKey): Promise<{
28342
+ vault: PublicKey;
28343
+ account: ExponentVault;
28344
+ }>;
28345
+ /** Read an SPL mint's decimals (classic + token-2022 share the offset-44 layout). */
28346
+ declare function getMintDecimals(connection: Connection, mint: PublicKey): Promise<number>;
27785
28347
 
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[]>;
28348
+ /** Derive the Anchor event-CPI authority PDA for the Exponent core program. */
28349
+ declare function deriveExponentEventAuthority(): PublicKey;
27854
28350
 
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
28351
  /**
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.
28352
+ * Resolve everything `makeRollPtTx` needs for an Exponent PT roll by decoding the maturity
28353
+ * `Vault` (every vault-side `merge` account is a `has_one` field on it), deriving the
28354
+ * owner's PT/YT/SY token accounts, and resolving the SY-program CPI remaining accounts
28355
+ * (`get_sy_state ++ withdraw_sy`) from the vault's address lookup table.
27877
28356
  */
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
- }
28357
+ declare function resolveExponentMergeContext(params: ResolveExponentMergeContextParams): Promise<ExponentMergeContext>;
27928
28358
  /**
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).
28359
+ * Resolve everything `makeRollPtTx` needs to buy the successor PT natively (SY PT,
28360
+ * no unwrap, no external aggregator) by trading on the successor maturity's `MarketTwo`.
28361
+ *
28362
+ * Decodes the market, resolves the SY-program CPI accounts from the market's address
28363
+ * lookup table (every `CpiInterfaceContext` is an ALT index), and derives the owner's
28364
+ * SY/PT token accounts. The returned {@link ExponentTradePtContext.addressLookupTable}
28365
+ * must be added to the transaction's lookup tables.
27932
28366
  */
27933
- declare function fetchTitanQuoteSwapV3(params: TitanGatewayQuoteParams): Promise<{
27934
- route: SwapRoute;
27935
- raw: TitanGatewayQuoteResponse;
27936
- }>;
28367
+ declare function resolveExponentTradePtContext(params: ResolveExponentTradePtContextParams): Promise<ExponentTradePtContext>;
27937
28368
  /**
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.
28369
+ * Resolve everything needed to `strip` SY PT + YT on an Exponent vault (the buy leg that
28370
+ * *mints* the successor PT, unbounded by AMM depth). Decodes the vault, derives the owner's
28371
+ * SY/PT/YT token accounts, resolves the `deposit_sy` CPI remaining accounts from the vault's
28372
+ * address lookup table, and exposes the last-seen SY exchange rate for sizing the minted PT.
27941
28373
  */
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;
28374
+ declare function resolveExponentStripContext(params: ResolveExponentStripContextParams): Promise<ExponentStripContext>;
28375
+ /**
28376
+ * Resolve everything the roll's redeem leg needs to turn matured PT into the underlying
28377
+ * **base** token via `wrapper_merge` (merge PT → SY, then CPI-redeem SY → base, in one ix) —
28378
+ * so the buy leg swaps a normal token, not the un-swappable SY.
28379
+ *
28380
+ * Decodes the maturity `Vault`, derives the owner's SY/PT/YT/base token accounts, assembles
28381
+ * the flavor redeem accounts (all derivable: the generic SY state is `get_sy_state[0]`, the
28382
+ * SPL stake pool is `get_sy_state[3]`, the base escrow is `ATA(syState, baseMint)`), appends
28383
+ * the vault's `withdraw_sy ++ get_sy_state` CPI accounts, and builds the stake-pool refresh
28384
+ * that must run first. Validated byte-for-byte against the Exponent SDK's `ixMergeToBase`.
28385
+ */
28386
+ declare function resolveExponentWrapperMergeContext(params: ResolveExponentWrapperMergeContextParams): Promise<ExponentWrapperMergeContext>;
28387
+
28388
+ /**
28389
+ * Build the Exponent `merge(amount)` instruction — redeems `amount` PT (post-maturity,
28390
+ * 1:1, no AMM/slippage) into SY at `sySrcDstAta`.
28391
+ *
28392
+ * @param accounts resolved merge accounts (see {@link ExponentMergeAccounts})
28393
+ * @param amountNative PT amount to redeem, in native units (u64)
28394
+ */
28395
+ declare function makeExponentMergeIx(accounts: ExponentMergeAccounts, amountNative: bigint): TransactionInstruction;
28396
+ /**
28397
+ * Signed `trade_pt` args for **buying** PT with SY (the roll's buy leg).
28398
+ *
28399
+ * The program's convention is signed-from-the-trader's-perspective: a buy makes PT flow
28400
+ * *to* the trader (`net_trader_pt > 0`) and SY flow *away* (`sy_constraint < 0`, the most
28401
+ * negative SY balance change the trader will tolerate — i.e. the max SY spent).
28402
+ *
28403
+ * @param ptOutNative exact PT the trader receives (native u64). Set to a conservative
28404
+ * floor; the trade gives exactly this many PT.
28405
+ * @param maxSyInNative max SY the trader is willing to spend (native u64).
28406
+ */
28407
+ declare function exponentBuyPtArgs({ ptOutNative, maxSyInNative, }: {
28408
+ ptOutNative: bigint;
28409
+ maxSyInNative: bigint;
28410
+ }): {
28411
+ netTraderPt: bigint;
28412
+ syConstraint: bigint;
28413
+ };
28414
+ /**
28415
+ * Build the Exponent `trade_pt(net_trader_pt, sy_constraint)` instruction — an
28416
+ * implied-APY AMM trade of SY ↔ PT on a `MarketTwo`. For a buy use {@link exponentBuyPtArgs}.
28417
+ *
28418
+ * Pricing PT reads the SY exchange rate on-chain, so `accounts.remainingAccounts` (the
28419
+ * flavor's SY-program CPI accounts, resolved from the market ALT) are appended after the
28420
+ * 12 fixed accounts, and the transaction must carry the market's address lookup table.
28421
+ *
28422
+ * @param accounts resolved trade accounts (see {@link ExponentTradePtAccounts})
28423
+ * @param args signed `net_trader_pt` / `sy_constraint` (i64 LE)
28424
+ */
28425
+ declare function makeExponentTradePtIx(accounts: ExponentTradePtAccounts, args: {
28426
+ netTraderPt: bigint;
28427
+ syConstraint: bigint;
28428
+ }): TransactionInstruction;
28429
+ /**
28430
+ * Build the Exponent `strip(amount)` instruction — splits `amount` SY into PT + YT on an
28431
+ * active vault. The minted PT lands in `ptDst`, the YT in `ytDst`. Because PT is minted (not
28432
+ * swapped), this is the buy leg for rolling more PT than a thin AMM pool could provide.
28433
+ *
28434
+ * Pricing PT/YT reads the SY rate on-chain, so `accounts.remainingAccounts` (the flavor's
28435
+ * `deposit_sy` CPI accounts, resolved from the vault ALT) are appended after the 15 fixed
28436
+ * accounts, and the transaction must carry the vault's address lookup table.
28437
+ *
28438
+ * @param accounts resolved strip accounts (see {@link ExponentStripAccounts})
28439
+ * @param amountNative SY amount to strip, in native units (u64)
28440
+ */
28441
+ declare function makeExponentStripIx(accounts: ExponentStripAccounts, amountNative: bigint): TransactionInstruction;
28442
+ /**
28443
+ * Build the Exponent `wrapper_merge(amount_py, redeem_sy_accounts_until)` instruction —
28444
+ * redeems `amountPyNative` PT into the underlying base token at the owner's base ATA.
28445
+ *
28446
+ * The remaining accounts are `[...flavor redeem accounts, ...vault SY-CPI accounts]`;
28447
+ * `redeemSyAccountsUntil` tells the program where the redeem accounts end. The redeem's first
28448
+ * account is the owner and keeps its signer flag (the SY-CPI accounts are forced non-signer,
28449
+ * resolved upstream). The transaction must carry the vault's address lookup table.
28450
+ *
28451
+ * @param accounts resolved wrapper-merge accounts (see {@link ExponentWrapperMergeAccounts})
28452
+ * @param args `amountPyNative` (u64) PT to redeem + `redeemSyAccountsUntil` (u8)
28453
+ */
28454
+ declare function makeExponentWrapperMergeIx(accounts: ExponentWrapperMergeAccounts, args: {
28455
+ amountPyNative: bigint;
28456
+ redeemSyAccountsUntil: number;
28457
+ }): TransactionInstruction;
28458
+ /**
28459
+ * Build the SPL Stake Pool `UpdateStakePoolBalance` instruction — refreshes a stake pool's
28460
+ * total-lamports / pool-token-supply so the pool↔token exchange rate is current for the
28461
+ * epoch. An SPL-stake-pool SY flavor (e.g. bulkSOL) requires this immediately before
28462
+ * `wrapper_merge`, otherwise the redeem reads a stale SY↔base rate.
28463
+ *
28464
+ * Account order matches the SPL Stake Pool program's `UpdateStakePoolBalance`.
28465
+ */
28466
+ declare function makeSplStakePoolUpdateBalanceIx(accounts: {
28467
+ stakePoolProgram: PublicKey;
28468
+ stakePool: PublicKey;
28469
+ withdrawAuthority: PublicKey;
28470
+ validatorList: PublicKey;
28471
+ reserveStake: PublicKey;
28472
+ managerFeeAccount: PublicKey;
28473
+ poolMint: PublicKey;
28474
+ tokenProgram?: PublicKey;
28475
+ }): TransactionInstruction;
27945
28476
 
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 };
28477
+ 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, type ExponentWrapperMergeAccounts, type ExponentWrapperMergeContext, 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 ResolveExponentWrapperMergeContextParams, 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, makeExponentWrapperMergeIx, makeRefreshObligationIx, makeRefreshReservesBatchIx, makeRefreshingIxs, makeSplStakePoolUpdateBalanceIx, makeUpdateJupLendRate, makeUpdateJupLendRateIx, makeUpdateSpotMarketCumulativeInterestIx, makeUpdateSpotMarketIx, obligationRawToDto, parsePriceData, parsePriceInfo, replenishPoolIx, reserveRawToDto, resolveExponentMergeContext, resolveExponentStripContext, resolveExponentTradePtContext, resolveExponentWrapperMergeContext, resolveLookupTables, scaledSupplies, selectBestRoute, selectGatewayRoute, slotAdjustmentFactor, syncNativeInstructionData, transferCheckedInstructionData, truncateBorrowCurve, unpackAccount };