@glamsystems/glam-sdk 1.1.0-alpha.1 → 1.1.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/index.cjs.js +6583 -2920
  2. package/index.esm.js +6575 -2909
  3. package/package.json +2 -2
  4. package/target/idl/glam_mint-staging.json +18 -15
  5. package/target/idl/glam_protocol-staging.json +5 -0
  6. package/target/idl/glam_protocol.json +5 -0
  7. package/target/types/glam_mint-staging.ts +18 -15
  8. package/target/types/glam_protocol-staging.ts +5 -0
  9. package/target/types/glam_protocol.ts +5 -0
  10. package/src/assets.d.ts +0 -39
  11. package/src/client/access.d.ts +0 -57
  12. package/src/client/base.d.ts +0 -184
  13. package/src/client/bridge.d.ts +0 -183
  14. package/src/client/bridgeRegistry.d.ts +0 -32
  15. package/src/client/cctp.d.ts +0 -156
  16. package/src/client/epi.d.ts +0 -78
  17. package/src/client/fees.d.ts +0 -33
  18. package/src/client/invest.d.ts +0 -37
  19. package/src/client/jupiter.d.ts +0 -45
  20. package/src/client/kamino/farm.d.ts +0 -39
  21. package/src/client/kamino/index.d.ts +0 -4
  22. package/src/client/kamino/lending.d.ts +0 -86
  23. package/src/client/kamino/types.d.ts +0 -56
  24. package/src/client/kamino/vaults.d.ts +0 -31
  25. package/src/client/loopscale.d.ts +0 -84
  26. package/src/client/marinade.d.ts +0 -42
  27. package/src/client/mint.d.ts +0 -127
  28. package/src/client/neutral.d.ts +0 -109
  29. package/src/client/price.d.ts +0 -138
  30. package/src/client/stake-pool.d.ts +0 -39
  31. package/src/client/stake.d.ts +0 -34
  32. package/src/client/state.d.ts +0 -56
  33. package/src/client/timelock.d.ts +0 -31
  34. package/src/client/vault.d.ts +0 -90
  35. package/src/client.d.ts +0 -68
  36. package/src/clientConfig.d.ts +0 -29
  37. package/src/constants.d.ts +0 -84
  38. package/src/deser/base.d.ts +0 -18
  39. package/src/deser/index.d.ts +0 -3
  40. package/src/deser/integrationPolicies.d.ts +0 -120
  41. package/src/deser/kaminoLayouts.d.ts +0 -264
  42. package/src/deser/tokenAclLayouts.d.ts +0 -67
  43. package/src/error.d.ts +0 -29
  44. package/src/glamExports.d.ts +0 -5116
  45. package/src/globalConfig.d.ts +0 -27
  46. package/src/index.d.ts +0 -20
  47. package/src/models/acl.d.ts +0 -43
  48. package/src/models/index.d.ts +0 -8
  49. package/src/models/mint.d.ts +0 -64
  50. package/src/models/state.d.ts +0 -104
  51. package/src/models/types.d.ts +0 -28
  52. package/src/react/cluster-provider.d.ts +0 -22
  53. package/src/react/glam.d.ts +0 -47
  54. package/src/react/index.d.ts +0 -5
  55. package/src/react/query-keys.d.ts +0 -38
  56. package/src/react/useVaultBalanceSubscription.d.ts +0 -17
  57. package/src/utils/accounts.d.ts +0 -72
  58. package/src/utils/bitmask.d.ts +0 -53
  59. package/src/utils/blockhash.d.ts +0 -11
  60. package/src/utils/common.d.ts +0 -37
  61. package/src/utils/computeBudget.d.ts +0 -15
  62. package/src/utils/evm.d.ts +0 -10
  63. package/src/utils/fraction.d.ts +0 -29
  64. package/src/utils/glamPDAs.d.ts +0 -15
  65. package/src/utils/index.d.ts +0 -16
  66. package/src/utils/jupiterApi.d.ts +0 -89
  67. package/src/utils/lookupTables.d.ts +0 -53
  68. package/src/utils/pkmap.d.ts +0 -87
  69. package/src/utils/pkset.d.ts +0 -73
  70. package/src/utils/positionCategorizer.d.ts +0 -36
  71. package/src/utils/rpc.d.ts +0 -33
  72. package/src/utils/timelock.d.ts +0 -52
  73. package/src/utils/transaction.d.ts +0 -13
  74. package/target/types/ext_bridge.d.ts +0 -2385
  75. package/target/types/ext_cctp.d.ts +0 -1268
  76. package/target/types/ext_epi.d.ts +0 -2175
  77. package/target/types/ext_kamino.d.ts +0 -3433
  78. package/target/types/ext_loopscale.d.ts +0 -3547
  79. package/target/types/ext_marinade.d.ts +0 -1593
  80. package/target/types/ext_neutral.d.ts +0 -1670
  81. package/target/types/ext_spl.d.ts +0 -1274
  82. package/target/types/ext_stake_pool.d.ts +0 -1622
  83. package/target/types/glam_config.d.ts +0 -755
  84. package/target/types/glam_mint.d.ts +0 -6106
  85. package/target/types/glam_protocol.d.ts +0 -2708
@@ -1,156 +0,0 @@
1
- import { BN } from "@coral-xyz/anchor";
2
- import { PublicKey, VersionedTransaction, TransactionSignature, Keypair, Commitment, Finality, TransactionInstruction, VersionedTransactionResponse } from "@solana/web3.js";
3
- import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
4
- export declare class CctpBridgeEvent {
5
- readonly amount: BN;
6
- readonly sourceDomain: number;
7
- readonly sourceAddress: string;
8
- readonly destinationDomain: number;
9
- readonly destinationCaller: string;
10
- readonly destinationAddress: string;
11
- readonly attestation: string;
12
- readonly nonce: string;
13
- readonly status: string;
14
- readonly txHash: string;
15
- readonly uiAmount: number;
16
- slot?: number;
17
- constructor(amount: BN, sourceDomain: number, sourceAddress: string, destinationDomain: number, destinationCaller: string, destinationAddress: string, attestation: string, nonce: string, status: string, txHash: string);
18
- }
19
- declare class TxBuilder extends BaseTxBuilder<CctpClient> {
20
- /**
21
- * Returns a transaction that calls CCTP's `depositForBurn` instruction that bridges USDC to another chain.
22
- * A keypair is generated for the message sent event account, which must be included as a transaction signer.
23
- */
24
- bridgeUsdcIx(amount: BN, domain: number, destinationAddress: PublicKey, params: {
25
- maxFee: BN;
26
- minFinalityThreshold: number;
27
- destinationCaller?: PublicKey;
28
- }, glamSigner: PublicKey): Promise<[TransactionInstruction, Keypair]>;
29
- bridgeUsdcTx(amount: BN, domain: number, destinationAddress: PublicKey, params: {
30
- maxFee: BN;
31
- minFinalityThreshold: number;
32
- destinationCaller?: PublicKey;
33
- }, txOptions: TxOptions): Promise<[VersionedTransaction, Keypair]>;
34
- receiveMessageIx(sourceDomain: number, messageObj: any): Promise<TransactionInstruction>;
35
- receiveUsdcTx(sourceDomain: number, params: {
36
- txHash?: string;
37
- nonce?: string;
38
- }, txOptions?: TxOptions): Promise<VersionedTransaction>;
39
- }
40
- export declare class CctpClient {
41
- readonly base: BaseClient;
42
- txBuilder: TxBuilder;
43
- constructor(base: BaseClient);
44
- /**
45
- * Bridge USDC to another chain using Circle's CCTP protocol
46
- *
47
- * @param amount Amount of USDC to bridge (in smallest units)
48
- * @param domain Destination domain (e.g., 0 for Ethereum, 1 for Avalanche)
49
- * @param destinationAddress Destination address on target chain (EVM address as PublicKey)
50
- * @param params Additional parameters (maxFee, minFinalityThreshold)
51
- * @param txOptions Transaction options
52
- */
53
- bridgeUsdc(amount: BN | number, domain: number, destinationAddress: PublicKey, params: {
54
- maxFee: BN;
55
- minFinalityThreshold: number;
56
- destinationCaller?: PublicKey;
57
- }, txOptions?: TxOptions): Promise<TransactionSignature>;
58
- /**
59
- * Receive USDC from another chain using Circle's CCTP protocol
60
- *
61
- * @param sourceDomain Source domain (e.g., 0 for Ethereum, 6 for Base)
62
- * @param params Additional parameters (txHash, nonce)
63
- * @param txOptions Transaction options
64
- */
65
- receiveUsdc(sourceDomain: number, params: {
66
- txHash?: string;
67
- nonce?: string;
68
- }, txOptions?: TxOptions): Promise<string>;
69
- getReceiveMessagePdas(messageTransmitterProgram: PublicKey, tokenMessengerMinterProgram: PublicKey, solUsdcMint: PublicKey, remoteUsdcAddressHex: string, remoteDomain: string, nonceHex: string): Promise<{
70
- messageTransmitter: PublicKey;
71
- tokenMessenger: PublicKey;
72
- tokenMinter: PublicKey;
73
- localToken: PublicKey;
74
- remoteTokenMessengerKey: PublicKey;
75
- remoteTokenKey: PublicKey;
76
- tokenPair: PublicKey;
77
- custodyTokenAccount: PublicKey;
78
- authorityPda: PublicKey;
79
- tokenMessengerEventAuthority: PublicKey;
80
- usedNonce: PublicKey;
81
- feeRecipientTokenAccount: PublicKey;
82
- }>;
83
- /**
84
- * Get all PDAs required for CCTP deposit for burn operation
85
- *
86
- * @param messageTransmitterProgram Message transmitter program ID
87
- * @param tokenMessengerMinterProgram Token messenger minter program ID
88
- * @param usdcAddress USDC mint address
89
- * @param destinationDomain Destination domain
90
- * @returns Object containing all required PDAs
91
- */
92
- getDepositForBurnPdas(messageTransmitterProgram: PublicKey, tokenMessengerMinterProgram: PublicKey, usdcAddress: PublicKey, destinationDomain: Number): {
93
- messageTransmitterAccount: PublicKey;
94
- tokenMessengerAccount: PublicKey;
95
- tokenMinterAccount: PublicKey;
96
- localToken: PublicKey;
97
- remoteTokenMessengerKey: PublicKey;
98
- authorityPda: PublicKey;
99
- tokenMessengerEventAuthority: PublicKey;
100
- };
101
- /**
102
- * Find all message accounts onchain for a given sender wallet
103
- *
104
- * TODO: filter by burned token mint
105
- */
106
- findV2Messages(senderWallet: PublicKey, options: {
107
- commitment?: Commitment;
108
- minSlot?: number;
109
- }): Promise<PublicKey[]>;
110
- fetchV2Messages(sourceDomain: number, params: {
111
- txHash?: string;
112
- nonce?: string;
113
- }): Promise<any[]>;
114
- /**
115
- * Get bridge events from Circle API using either txHash or nonce
116
- *
117
- * @param sourceDomain Source domain
118
- * @param params Either txHash or nonce is required
119
- * @returns Array of bridge events
120
- */
121
- parseEventsFromAttestion(sourceDomain: number, { txHash, nonce }: {
122
- txHash?: string;
123
- nonce?: string;
124
- }): Promise<CctpBridgeEvent[]>;
125
- getTransactions(signatures: string[], batchSize: number, commitment?: Finality): Promise<VersionedTransactionResponse[]>;
126
- /**
127
- * Get incoming bridge events (EVM -> Solana)
128
- *
129
- * Unlike outgoing bridge events, incoming bridge events are not stored in Message accounts on Solana.
130
- * We need to examine all transactions to find the ones that contain the bridge events.
131
- * 1. Fetch all transactions involing the vault's USDC token account
132
- * 2. Filter transactions that contain the bridge events
133
- * 3. Parse the bridge events from the transactions
134
- */
135
- getIncomingBridgeEvents(options: {
136
- batchSize?: number;
137
- commitment?: Finality;
138
- txHashes?: string[];
139
- minSlot?: number;
140
- }): Promise<CctpBridgeEvent[]>;
141
- /**
142
- * Get outgoing bridge events (Solana -> EVM)
143
- *
144
- * Each transfer has a Message account on Solana. To get all events:
145
- * 1. Find all Message accounts for the vault
146
- * 2. Get the created transaction for each message account
147
- * 3. Call iris api to get the attestation status and parsed message using each tx hash
148
- */
149
- getOutgoingBridgeEvents(options: {
150
- batchSize?: number;
151
- commitment?: Commitment;
152
- txHashes?: string[];
153
- minSlot?: number;
154
- }): Promise<CctpBridgeEvent[]>;
155
- }
156
- export {};
@@ -1,78 +0,0 @@
1
- import { BN } from "@coral-xyz/anchor";
2
- import { PublicKey, TransactionInstruction, TransactionSignature, VersionedTransaction } from "@solana/web3.js";
3
- import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
4
- type BufferLike32 = Uint8Array | number[] | Buffer;
5
- export type EpiDenominationKindInput = {
6
- usd: Record<string, never>;
7
- } | {
8
- mint: Record<string, never>;
9
- };
10
- export type EpiDenominationSpecInput = {
11
- denom: EpiDenominationKindInput;
12
- mint: PublicKey;
13
- };
14
- export type EpiExternalPositionTypeInput = {
15
- valued: Record<string, never>;
16
- } | {
17
- tokenized: Record<string, never>;
18
- };
19
- export type EpiExternalSourceTypeInput = {
20
- trusted: Record<string, never>;
21
- } | {
22
- native: Record<string, never>;
23
- };
24
- export type EpiNativeCustodyKindInput = {
25
- splToken: Record<string, never>;
26
- } | {
27
- nativeSol: Record<string, never>;
28
- };
29
- export type UpsertExternalPositionParams = {
30
- positionId: BufferLike32;
31
- positionType: EpiExternalPositionTypeInput;
32
- sourceType: EpiExternalSourceTypeInput;
33
- denomination: EpiDenominationSpecInput;
34
- nativeCustodyAccount?: PublicKey;
35
- nativeCustodyKind?: EpiNativeCustodyKindInput;
36
- enabled?: boolean;
37
- freshnessOverrideSecs?: number;
38
- submitAllowlist?: PublicKey[];
39
- validateAllowlist?: PublicKey[];
40
- configureAllowlist?: PublicKey[];
41
- };
42
- export type SubmitExternalObservationParams = {
43
- positionId: BufferLike32;
44
- amount: BN;
45
- denomination: EpiDenominationSpecInput;
46
- observationTimestamp: BN;
47
- externalShares?: BN;
48
- reserved?: Uint8Array | number[] | Buffer;
49
- };
50
- declare class TxBuilder extends BaseTxBuilder<EpiClient> {
51
- upsertExternalPositionIx(params: UpsertExternalPositionParams, signer?: PublicKey): Promise<TransactionInstruction>;
52
- submitExternalObservationIx(params: SubmitExternalObservationParams, signer?: PublicKey): Promise<TransactionInstruction>;
53
- validateExternalObservationIx(positionId: BufferLike32, normalizedBaseAssetAmount: BN | null, signer?: PublicKey): Promise<TransactionInstruction>;
54
- refreshPricedProtocolIx(signer?: PublicKey): Promise<TransactionInstruction>;
55
- submitExternalObservationTx(params: SubmitExternalObservationParams, txOptions?: TxOptions): Promise<VersionedTransaction>;
56
- upsertExternalPositionTx(params: UpsertExternalPositionParams, txOptions?: TxOptions): Promise<VersionedTransaction>;
57
- validateExternalObservationTx(positionId: BufferLike32, normalizedBaseAssetAmount: BN | null, txOptions?: TxOptions): Promise<VersionedTransaction>;
58
- refreshPricedProtocolTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
59
- }
60
- export declare class EpiClient {
61
- readonly base: BaseClient;
62
- readonly txBuilder: TxBuilder;
63
- constructor(base: BaseClient);
64
- getObservationStatePda(): PublicKey;
65
- getIntegrationAuthorityPda(): PublicKey;
66
- fetchObservationState(): Promise<{
67
- glamState: PublicKey;
68
- bump: number;
69
- positionsLen: number;
70
- reserved: number[];
71
- positions: any[];
72
- } | null>;
73
- submitExternalObservation(params: SubmitExternalObservationParams, txOptions?: TxOptions): Promise<TransactionSignature>;
74
- upsertExternalPosition(params: UpsertExternalPositionParams, txOptions?: TxOptions): Promise<TransactionSignature>;
75
- validateExternalObservation(positionId: BufferLike32, normalizedBaseAssetAmount: BN | null, txOptions?: TxOptions): Promise<TransactionSignature>;
76
- refreshPricedProtocol(txOptions?: TxOptions): Promise<TransactionSignature>;
77
- }
78
- export {};
@@ -1,33 +0,0 @@
1
- import { PublicKey, TransactionInstruction, TransactionSignature, VersionedTransaction } from "@solana/web3.js";
2
- import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
3
- import { PriceClient } from "./price";
4
- declare class TxBuilder extends BaseTxBuilder<FeesClient> {
5
- crystallizeFeesIxs(glamSigner: PublicKey): Promise<TransactionInstruction[]>;
6
- crystallizeFeesTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
7
- claimFeesIxs(glamSigner: PublicKey): Promise<TransactionInstruction[]>;
8
- claimFeesTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
9
- chargeProtocolFeeIxs(glamSigner: PublicKey, protocolFeeAuthority: PublicKey): Promise<TransactionInstruction[]>;
10
- chargeProtocolFeeTx(protocolFeeAuthority: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
11
- setProtocolFeesIx(baseFeeBps: number, flowFeeBps: number, signer?: PublicKey): Promise<TransactionInstruction>;
12
- setProtocolFeesTx(baseFeeBps: number, flowFeeBps: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
13
- }
14
- export declare class FeesClient {
15
- readonly base: BaseClient;
16
- readonly price: PriceClient;
17
- readonly txBuilder: TxBuilder;
18
- constructor(base: BaseClient, price: PriceClient);
19
- /**
20
- * Returns claimable fees object
21
- */
22
- getClaimableFees(): Promise<any>;
23
- /**
24
- * Returns claimed fees object
25
- */
26
- getClaimedFees(): Promise<any>;
27
- crystallizeFees(txOptions?: TxOptions): Promise<TransactionSignature>;
28
- claimFees(txOptions?: TxOptions): Promise<TransactionSignature>;
29
- chargeProtocolFee(protocolFeeAuthority: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
30
- setProtocolFeesIx(baseFeeBps: number, flowFeeBps: number, signer?: PublicKey): Promise<TransactionInstruction>;
31
- setProtocolFees(baseFeeBps: number, flowFeeBps: number, txOptions?: TxOptions): Promise<TransactionSignature>;
32
- }
33
- export {};
@@ -1,37 +0,0 @@
1
- import { BN } from "@coral-xyz/anchor";
2
- import { PublicKey, TransactionInstruction, TransactionSignature, VersionedTransaction } from "@solana/web3.js";
3
- import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
4
- import { PendingRequest } from "../models";
5
- declare class TxBuilder extends BaseTxBuilder<InvestClient> {
6
- subscribeIxs(amount: BN, signer: PublicKey): Promise<TransactionInstruction[]>;
7
- subscribeTx(amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
8
- queuedSubscribeIxs(amount: BN, signer: PublicKey): Promise<TransactionInstruction[]>;
9
- queuedSubscribeTx(amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
10
- queuedRedeemIx(amount: BN, signer: PublicKey): Promise<TransactionInstruction>;
11
- queuedRedeemTx(amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
12
- cancelIx(pubkey: PublicKey | null, signer: PublicKey): Promise<TransactionInstruction>;
13
- cancelTx(pubkey: PublicKey | null, txOptions?: TxOptions): Promise<VersionedTransaction>;
14
- fulfillIx(limit: number | null, signer: PublicKey): Promise<TransactionInstruction>;
15
- fulfillTx(limit: number | null, txOptions?: TxOptions): Promise<VersionedTransaction>;
16
- claimIxs(user: PublicKey | null, signer: PublicKey): Promise<TransactionInstruction[]>;
17
- claimTx(user: PublicKey | null, txOptions?: TxOptions): Promise<VersionedTransaction>;
18
- }
19
- export declare class InvestClient {
20
- readonly base: BaseClient;
21
- readonly txBuilder: TxBuilder;
22
- constructor(base: BaseClient);
23
- subscribe(amount: BN, queued?: boolean, txOptions?: TxOptions): Promise<TransactionSignature>;
24
- queuedRedeem(amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
25
- cancel(txOptions?: TxOptions): Promise<TransactionSignature>;
26
- cancelForUser(user: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
27
- fulfill(limit: number | null, txOptions?: TxOptions): Promise<TransactionSignature>;
28
- /**
29
- * Claims the pending request for the signer.
30
- * @param txOptions
31
- * @returns
32
- */
33
- claim(txOptions?: TxOptions): Promise<TransactionSignature>;
34
- claimForUser(user: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
35
- fetchPendingRequest(user?: PublicKey): Promise<PendingRequest | null>;
36
- }
37
- export {};
@@ -1,45 +0,0 @@
1
- import { BN } from "@coral-xyz/anchor";
2
- import { PublicKey, TransactionInstruction, TransactionSignature, VersionedTransaction } from "@solana/web3.js";
3
- import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
4
- import { VaultClient } from "./vault";
5
- import { JupiterApiClient, JupiterInstruction, QuoteParams, QuoteResponse, SwapInstructions } from "../utils/jupiterApi";
6
- import { KaminoLendingClient } from "./kamino";
7
- export type JupiterSwapOptions = {
8
- quoteParams?: QuoteParams;
9
- quoteResponse?: QuoteResponse;
10
- swapInstructions?: SwapInstructions;
11
- trackingAccount?: PublicKey;
12
- };
13
- export type JupiterSwapV2OracleAccounts = {
14
- solUsdOracle?: PublicKey;
15
- inputTokenOracle?: PublicKey;
16
- outputTokenOracle?: PublicKey;
17
- kaminoReservesToRefresh: PublicKey[];
18
- };
19
- export type JupiterSwapV2Options = JupiterSwapOptions & {
20
- skipQuotePriceCheck?: boolean;
21
- };
22
- declare class TxBuilder extends BaseTxBuilder<JupiterSwapClient> {
23
- private resolveSwapInstructionContext;
24
- getSwapV2OracleAccounts(inputMint: PublicKey, outputMint: PublicKey, skipQuotePriceCheck: boolean): Promise<JupiterSwapV2OracleAccounts>;
25
- /**
26
- * Returns the instructions for a Jupiter swap and the lookup tables
27
- */
28
- swapIxs(options: JupiterSwapOptions, glamSigner: PublicKey): Promise<[TransactionInstruction[], PublicKey[]]>;
29
- swapV2Ixs(options: JupiterSwapV2Options, glamSigner: PublicKey): Promise<[TransactionInstruction[], PublicKey[]]>;
30
- swapTx(options: JupiterSwapOptions, txOptions?: TxOptions): Promise<VersionedTransaction>;
31
- swapV2Tx(options: JupiterSwapV2Options, txOptions?: TxOptions): Promise<VersionedTransaction>;
32
- getPreInstructions(signer: PublicKey, inputMint: PublicKey, outputMint: PublicKey, amount: BN, outputTokenProgram?: PublicKey): Promise<TransactionInstruction[]>;
33
- toTransactionInstruction: (ix: JupiterInstruction) => TransactionInstruction;
34
- }
35
- export declare class JupiterSwapClient {
36
- readonly base: BaseClient;
37
- readonly vault: VaultClient;
38
- readonly klend: KaminoLendingClient;
39
- readonly txBuilder: TxBuilder;
40
- readonly jupApi: JupiterApiClient;
41
- constructor(base: BaseClient, vault: VaultClient, klend: KaminoLendingClient);
42
- swap(options: JupiterSwapOptions, txOptions?: TxOptions): Promise<TransactionSignature>;
43
- swapV2(options: JupiterSwapV2Options, txOptions?: TxOptions): Promise<TransactionSignature>;
44
- }
45
- export {};
@@ -1,39 +0,0 @@
1
- import { BN } from "@coral-xyz/anchor";
2
- import { PublicKey, VersionedTransaction, TransactionSignature } from "@solana/web3.js";
3
- import { BaseClient, BaseTxBuilder, TxOptions } from "../base";
4
- import { PkMap } from "../../utils";
5
- import { KaminoLendingClient } from "./lending";
6
- import { ParsedFarmState, ParsedFarmUser } from "./types";
7
- declare class TxBuilder extends BaseTxBuilder<KaminoFarmClient> {
8
- stakeTx(amount: BN, farmState: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
9
- unstakeTx(amount: BN, farmState: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
10
- harvestTx(farmUserStates: PublicKey[], txOptions?: TxOptions): Promise<VersionedTransaction>;
11
- }
12
- export declare class KaminoFarmClient {
13
- readonly base: BaseClient;
14
- readonly kaminoLending: KaminoLendingClient;
15
- txBuilder: TxBuilder;
16
- constructor(base: BaseClient, kaminoLending: KaminoLendingClient);
17
- /**
18
- * Finds and parses farm states for the given owner
19
- */
20
- findAndParseFarmUserStates(owner: PublicKey): Promise<ParsedFarmUser[]>;
21
- parseFarmState(data: Buffer): Promise<ParsedFarmState>;
22
- fetchAndParseFarmStates(farms: PublicKey[]): Promise<PkMap<ParsedFarmState>>;
23
- farmVaultTokenAccount: (farm: PublicKey, mint: PublicKey) => PublicKey;
24
- farmVaultsAuthority: (farm: PublicKey) => PublicKey;
25
- rewardsTreasuryVault: (globalConfig: PublicKey, mint: PublicKey) => PublicKey;
26
- /**
27
- * Harvest rewards from Kamino farms
28
- */
29
- harvest(vaultFarmStates: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
30
- /**
31
- * Stake tokens to a farm
32
- */
33
- stake(amount: BN, farmState: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
34
- /**
35
- * Unstake tokens from a farm
36
- */
37
- unstake(amount: BN, farmState: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
38
- }
39
- export {};
@@ -1,4 +0,0 @@
1
- export * from "./types";
2
- export * from "./lending";
3
- export * from "./farm";
4
- export * from "./vaults";
@@ -1,86 +0,0 @@
1
- import { BN } from "@coral-xyz/anchor";
2
- import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction } from "@solana/web3.js";
3
- import { BaseClient, BaseTxBuilder, TxOptions } from "../base";
4
- import { Reserve, Obligation } from "../../deser/kaminoLayouts";
5
- import { VaultClient } from "../vault";
6
- import { RefreshObligationAccounts, RefreshReserveAccounts, RefreshObligationFarmsForReserveArgs, RefreshObligationFarmsForReserveAccounts } from "./types";
7
- declare class TxBuilder extends BaseTxBuilder<KaminoLendingClient> {
8
- refreshObligationIx(accounts: RefreshObligationAccounts): TransactionInstruction;
9
- refreshReserveIx(accounts: RefreshReserveAccounts): TransactionInstruction;
10
- refreshObligationFarmsForReserveIx(args: RefreshObligationFarmsForReserveArgs, accounts: RefreshObligationFarmsForReserveAccounts): TransactionInstruction;
11
- refreshReservesBatchIx(reserves: Reserve[], skipPriceUpdates: boolean): TransactionInstruction;
12
- refreshReservesIxs(reserves: Reserve[]): TransactionInstruction[];
13
- refreshObligationCollateralFarmsForReservesIxs(obligation: PublicKey, reserves: Reserve[]): TransactionInstruction[];
14
- refreshObligationDebtFarmsForReservesIxs(obligation: PublicKey, reserves: Reserve[]): TransactionInstruction[];
15
- /**
16
- * Returns two instructions that refresh reserves in batch and refresh obligation
17
- */
18
- refreshReservesAndObligationIxs(obligation: PublicKey, targetReserve: Reserve): Promise<TransactionInstruction[]>;
19
- /**
20
- * Returns an instruction to initialize obligation farm user if it doesn't exist
21
- *
22
- * @param mode 0 collateral farm, 1 debt farm
23
- */
24
- initObligationFarmUserForReserveIx(obligation: PublicKey, reserve: Reserve, mode: 0 | 1, signer?: PublicKey): Promise<{
25
- farmUser: null;
26
- initIx: null;
27
- } | {
28
- farmUser: PublicKey;
29
- initIx: TransactionInstruction | null;
30
- }>;
31
- initUserMetadataTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
32
- depositIxs(market: PublicKey, asset: PublicKey, amount: BN, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
33
- depositTx(market: PublicKey, asset: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
34
- withdrawIxs(market: PublicKey, asset: PublicKey, amount: BN, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
35
- withdrawTx(market: PublicKey, asset: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
36
- borrowIxs(market: PublicKey, asset: PublicKey, amount: BN, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
37
- borrowTx(market: PublicKey, asset: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
38
- requestElevationGroupIxs(lendingMarket: PublicKey, elevationGroup: number, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
39
- requestElevationGroupTx(lendingMarket: PublicKey, elevationGroup: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
40
- repayIxs(market: PublicKey, asset: PublicKey, amount: BN, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
41
- repayTx(market: PublicKey, asset: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
42
- }
43
- export declare class KaminoLendingClient {
44
- readonly base: BaseClient;
45
- readonly vault: VaultClient;
46
- private reserves;
47
- private obligations;
48
- txBuilder: TxBuilder;
49
- constructor(base: BaseClient, vault: VaultClient);
50
- /**
51
- * Initializes Kamino user metadata
52
- */
53
- initUserMetadata(txOptions?: TxOptions): Promise<TransactionSignature>;
54
- /**
55
- * Deposits asset to the lending market.
56
- */
57
- deposit(market: PublicKey | string, asset: PublicKey | string, amount: BN | number, txOptions?: TxOptions): Promise<TransactionSignature>;
58
- /**
59
- * Withdraws asset from the lending market.
60
- */
61
- withdraw(market: PublicKey | string, asset: PublicKey | string, amount: BN | number, txOptions?: TxOptions): Promise<TransactionSignature>;
62
- /**
63
- * Borrows asset from the lending market.
64
- */
65
- borrow(market: PublicKey | string, asset: PublicKey | string, amount: BN | number, txOptions?: TxOptions): Promise<TransactionSignature>;
66
- /**
67
- * Requests an elevation group for an obligation.
68
- */
69
- requestElevationGroup(market: PublicKey | string, elevationGroup: number, txOptions?: TxOptions): Promise<TransactionSignature>;
70
- /**
71
- * Repays asset to the lending market.
72
- */
73
- repay(market: PublicKey | string, asset: PublicKey | string, amount: BN | number, txOptions?: TxOptions): Promise<TransactionSignature>;
74
- getUserMetadataPda(owner: PublicKey): PublicKey;
75
- getObligationPda(owner: PublicKey, market: PublicKey, args?: {
76
- tag: number;
77
- id: number;
78
- }): PublicKey;
79
- getFarmUserState(farmUser: PublicKey, farm: PublicKey): PublicKey;
80
- getMarketAuthority(market: PublicKey): PublicKey;
81
- fetchAndParseObligation(obligation: PublicKey): Promise<Obligation>;
82
- fetchAndParseReserves(reserves: PublicKey[]): Promise<Reserve[]>;
83
- findAndParseReserve(market: PublicKey, asset: PublicKey): Promise<Reserve>;
84
- findAndParseObligations(owner: PublicKey, market?: PublicKey): Promise<Obligation[]>;
85
- }
86
- export {};
@@ -1,56 +0,0 @@
1
- import { BN } from "@coral-xyz/anchor";
2
- import { PublicKey } from "@solana/web3.js";
3
- export declare const DEFAULT_OBLIGATION_ARGS: {
4
- tag: number;
5
- id: number;
6
- };
7
- export declare const KAMINO_VAULTS_EVENT_AUTHORITY: PublicKey;
8
- export interface RefreshObligationAccounts {
9
- lendingMarket: PublicKey;
10
- obligation: PublicKey;
11
- reserves: PublicKey[];
12
- }
13
- export interface RefreshReserveAccounts {
14
- reserve: PublicKey;
15
- lendingMarket: PublicKey;
16
- pythOracle: PublicKey;
17
- switchboardPriceOracle: PublicKey;
18
- switchboardTwapOracle: PublicKey;
19
- scopePrices: PublicKey;
20
- }
21
- export interface RefreshObligationFarmsForReserveArgs {
22
- mode: number;
23
- }
24
- export interface RefreshObligationFarmsForReserveAccounts {
25
- crank: PublicKey;
26
- baseAccounts: {
27
- obligation: PublicKey;
28
- lendingMarketAuthority: PublicKey;
29
- reserve: PublicKey;
30
- reserveFarmState: PublicKey;
31
- obligationFarmUserState: PublicKey;
32
- lendingMarket: PublicKey;
33
- };
34
- farmsProgram: PublicKey;
35
- rent: PublicKey;
36
- systemProgram: PublicKey;
37
- }
38
- export interface ParsedFarmState {
39
- globalConfig: PublicKey;
40
- farmTokenMint: PublicKey;
41
- farmTokenDecimals: BN;
42
- farmTokenProgram: PublicKey;
43
- farmVault: PublicKey;
44
- rewards: {
45
- index: number;
46
- mint: PublicKey;
47
- minClaimDurationSeconds: BN;
48
- tokenProgram: PublicKey;
49
- rewardsVault: PublicKey;
50
- }[];
51
- }
52
- export interface ParsedFarmUser {
53
- pubkey: PublicKey;
54
- farmState: PublicKey;
55
- unclaimedRewards: BN[];
56
- }
@@ -1,31 +0,0 @@
1
- import { BN } from "@coral-xyz/anchor";
2
- import { PublicKey, VersionedTransaction, TransactionSignature, AccountMeta, Commitment } from "@solana/web3.js";
3
- import { BaseClient, BaseTxBuilder, TxOptions } from "../base";
4
- import { KVaultAllocation, KVaultState } from "../../deser/kaminoLayouts";
5
- import { KaminoLendingClient } from "./lending";
6
- declare class TxBuilder extends BaseTxBuilder<KaminoVaultsClient> {
7
- depositTx(vault: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
8
- withdrawTx(vault: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
9
- }
10
- export declare class KaminoVaultsClient {
11
- readonly base: BaseClient;
12
- readonly kaminoLending: KaminoLendingClient;
13
- private vaultStates;
14
- private shareMintToVaultPdaMap;
15
- txBuilder: TxBuilder;
16
- constructor(base: BaseClient, kaminoLending: KaminoLendingClient);
17
- /**
18
- * Deposit to a Kamino vault
19
- */
20
- deposit(vault: PublicKey, amount: BN | number, txOptions?: TxOptions): Promise<TransactionSignature>;
21
- /**
22
- * Withdraw from a Kamino vault
23
- */
24
- withdraw(vault: PublicKey, amount: BN | number, txOptions?: TxOptions): Promise<TransactionSignature>;
25
- findAndParseKaminoVaults(commitment?: Commitment): Promise<KVaultState[]>;
26
- get globalConfigPda(): PublicKey;
27
- getVaultPdasByShareMints(mints: PublicKey[]): Promise<PublicKey[]>;
28
- fetchAndParseVaultState(vault: PublicKey): Promise<KVaultState>;
29
- composeRemainingAccounts(allocations: KVaultAllocation[], pricingMode?: boolean): Promise<AccountMeta[]>;
30
- }
31
- export {};
@@ -1,84 +0,0 @@
1
- import { BN } from "@coral-xyz/anchor";
2
- import { PublicKey, TransactionInstruction, TransactionSignature, VersionedTransaction, AccountMeta } from "@solana/web3.js";
3
- import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
4
- export declare const LOOPSCALE_BS_AUTH: PublicKey;
5
- export type LoopscaleExpectedLoanValues = {
6
- expectedApy: BN;
7
- expectedLqt: [number, number, number, number, number];
8
- };
9
- export type CreateLoanParams = {
10
- nonce: BN;
11
- };
12
- export type DepositCollateralParams = {
13
- amount: BN;
14
- assetType: number;
15
- assetIdentifier: PublicKey;
16
- assetIndexGuidance: Buffer;
17
- };
18
- export type UpdateWeightMatrixParams = {
19
- collateralIndex: number;
20
- weightMatrix: [number, number, number, number, number];
21
- expectedLoanValues: LoopscaleExpectedLoanValues;
22
- assetIndexGuidance: Buffer;
23
- };
24
- export type BorrowPrincipalParams = {
25
- amount: BN;
26
- assetIndexGuidance: Buffer;
27
- duration: number;
28
- expectedLoanValues: LoopscaleExpectedLoanValues;
29
- skipSolUnwrap: boolean;
30
- };
31
- export type CreateLoanAccounts = {
32
- loan: PublicKey;
33
- };
34
- export type DepositCollateralAccounts = {
35
- loan: PublicKey;
36
- depositMint: PublicKey;
37
- borrowerCollateralTa?: PublicKey;
38
- loanCollateralTa?: PublicKey;
39
- assetIdentifier?: PublicKey;
40
- tokenProgram?: PublicKey;
41
- associatedTokenProgram?: PublicKey;
42
- };
43
- export type UpdateWeightMatrixAccounts = {
44
- loan: PublicKey;
45
- };
46
- export type BorrowPrincipalAccounts = {
47
- loan: PublicKey;
48
- strategy: PublicKey;
49
- marketInformation: PublicKey;
50
- principalMint: PublicKey;
51
- borrowerTa?: PublicKey;
52
- strategyTa?: PublicKey;
53
- tokenProgram?: PublicKey;
54
- associatedTokenProgram?: PublicKey;
55
- remainingAccounts?: AccountMeta[];
56
- };
57
- export declare function getLoopscaleEventAuthorityPda(programId?: PublicKey): PublicKey;
58
- export declare function getLoopscaleLoanPda(borrower: PublicKey, nonce: BN | bigint | number, programId?: PublicKey): PublicKey;
59
- declare class TxBuilder extends BaseTxBuilder<LoopscaleClient> {
60
- createLoanIx(params: CreateLoanParams, accounts: CreateLoanAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
61
- createLoanTx(params: CreateLoanParams, accounts: CreateLoanAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
62
- depositCollateralIx(params: DepositCollateralParams, accounts: DepositCollateralAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
63
- depositCollateralTx(params: DepositCollateralParams, accounts: DepositCollateralAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
64
- updateWeightMatrixIx(params: UpdateWeightMatrixParams, accounts: UpdateWeightMatrixAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
65
- updateWeightMatrixTx(params: UpdateWeightMatrixParams, accounts: UpdateWeightMatrixAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
66
- borrowPrincipalIx(params: BorrowPrincipalParams, accounts: BorrowPrincipalAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
67
- borrowPrincipalTx(params: BorrowPrincipalParams, accounts: BorrowPrincipalAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
68
- }
69
- export declare class LoopscaleClient {
70
- readonly base: BaseClient;
71
- readonly txBuilder: TxBuilder;
72
- constructor(base: BaseClient);
73
- getIntegrationAuthorityPda(): PublicKey;
74
- getEventAuthorityPda(): PublicKey;
75
- getBsAuth(): PublicKey;
76
- getLoanPda(nonce: BN | bigint | number, borrower?: PublicKey): PublicKey;
77
- getLoanTokenAta(loan: PublicKey, mint: PublicKey, tokenProgram?: PublicKey): PublicKey;
78
- getStrategyTokenAta(strategy: PublicKey, mint: PublicKey, tokenProgram?: PublicKey): PublicKey;
79
- createLoan(params: CreateLoanParams, accounts: CreateLoanAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
80
- depositCollateral(params: DepositCollateralParams, accounts: DepositCollateralAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
81
- updateWeightMatrix(params: UpdateWeightMatrixParams, accounts: UpdateWeightMatrixAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
82
- borrowPrincipal(params: BorrowPrincipalParams, accounts: BorrowPrincipalAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
83
- }
84
- export {};