@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,90 +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
- declare class TxBuilder extends BaseTxBuilder<VaultClient> {
5
- wrapIxs(amount: BN, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
6
- wrapTx(amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
7
- unwrapIx(glamSigner: PublicKey): Promise<TransactionInstruction>;
8
- unwrapTx(txOptions: TxOptions): Promise<VersionedTransaction>;
9
- systemTransferIx(amount: BN, to: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction>;
10
- systemTransferTx(amount: BN, to: PublicKey, txOptions: TxOptions): Promise<VersionedTransaction>;
11
- /**
12
- * Returns an instruction that closes the specified vault token account
13
- */
14
- closeTokenAccountIx(tokenAccount: PublicKey, tokenProgram: PublicKey, signer?: PublicKey): Promise<TransactionInstruction>;
15
- closeTokenAccountsTx(pubkeys: PublicKey[], txOptions: TxOptions): Promise<VersionedTransaction>;
16
- depositSolIxs(lamports: number | BN, wrap: boolean, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
17
- depositSolTx(lamports: number | BN, wrap?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
18
- depositIxs(asset: PublicKey, amount: number | BN, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
19
- depositTx(asset: PublicKey, amount: number | BN, txOptions: TxOptions): Promise<VersionedTransaction>;
20
- /**
21
- * Transfers tokens held by the vault to the specified recipient
22
- */
23
- tokenTransferIxs(mint: PublicKey, amount: number | BN, to: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
24
- tokenTransferTx(mint: PublicKey, amount: number | BN, to: PublicKey, txOptions: TxOptions): Promise<VersionedTransaction>;
25
- }
26
- export declare class VaultClient {
27
- readonly base: BaseClient;
28
- readonly txBuilder: TxBuilder;
29
- constructor(base: BaseClient);
30
- /**
31
- * Wraps vault SOL to wSOL
32
- *
33
- * @param amount
34
- * @param txOptions
35
- */
36
- wrap(amount: BN | number, txOptions?: TxOptions): Promise<TransactionSignature>;
37
- /**
38
- * Unwraps vault wSOL to SOL
39
- *
40
- * @param txOptions
41
- */
42
- unwrap(txOptions?: TxOptions): Promise<TransactionSignature>;
43
- /**
44
- * Transfers SOL from vault to another account
45
- *
46
- * @param amount
47
- * @param to
48
- * @param txOptions
49
- */
50
- systemTransfer(amount: BN | number, to: PublicKey | string, txOptions?: TxOptions): Promise<TransactionSignature>;
51
- /**
52
- * Transfers token from vault to another account
53
- *
54
- * @param mint
55
- * @param amount
56
- * @param txOptions
57
- */
58
- tokenTransfer(mint: PublicKey | string, amount: number | BN, to: PublicKey | string, txOptions?: TxOptions): Promise<TransactionSignature>;
59
- /**
60
- * Closes multiple vault token accounts
61
- *
62
- * @param tokenAccounts
63
- * @param txOptions
64
- */
65
- closeTokenAccounts(tokenAccounts: PublicKey[] | string[], txOptions?: TxOptions): Promise<TransactionSignature>;
66
- /**
67
- * Deposits token to vault
68
- *
69
- * @param mint Token mint
70
- * @param amount
71
- * @param txOptions
72
- */
73
- deposit(mint: PublicKey | string, amount: number | BN, txOptions?: TxOptions): Promise<TransactionSignature>;
74
- /**
75
- * Deposits SOL to vault
76
- *
77
- * @param lamports
78
- * @param wrap Whether to wrap SOL to wSOL or not
79
- * @param txOptions
80
- */
81
- depositSol(lamports: number | BN, wrap?: boolean, txOptions?: TxOptions): Promise<TransactionSignature>;
82
- /**
83
- * Generates instructions to wrap SOL into wSOL if the vault doesn't have enough wSOL
84
- *
85
- * @param lamports Desired amount of wSOL
86
- * @returns Array of instructions, empty if wSOL is sufficient
87
- */
88
- maybeWrapSol(lamports: number | BN, signer?: PublicKey): Promise<TransactionInstruction[]>;
89
- }
90
- export {};
package/src/client.d.ts DELETED
@@ -1,68 +0,0 @@
1
- import { GlamClientConfig } from "./clientConfig";
2
- import { BaseClient } from "./client/base";
3
- import { JupiterSwapClient } from "./client/jupiter";
4
- import { MarinadeClient } from "./client/marinade";
5
- import { VaultClient } from "./client/vault";
6
- import { StateClient } from "./client/state";
7
- import { KaminoLendingClient, KaminoFarmClient, KaminoVaultsClient } from "./client/kamino";
8
- import { InvestClient } from "./client/invest";
9
- import { PriceClient } from "./client/price";
10
- import { FeesClient } from "./client/fees";
11
- import { MintClient } from "./client/mint";
12
- import { AccessClient } from "./client/access";
13
- import { TimelockClient } from "./client/timelock";
14
- import { StakeClient } from "./client/stake";
15
- import { StakePoolClient } from "./client/stake-pool";
16
- import { CctpClient } from "./client/cctp";
17
- import { BridgeClient } from "./client/bridge";
18
- import { EpiClient } from "./client/epi";
19
- import { LoopscaleClient } from "./client/loopscale";
20
- import { NeutralClient } from "./client/neutral";
21
- /**
22
- * Main entrypoint for the GLAM SDK
23
- *
24
- * Lazy loads each client/module at first use
25
- */
26
- export declare class GlamClient extends BaseClient {
27
- private _invest?;
28
- private _jupiterSwap?;
29
- private _marinade?;
30
- private _vault?;
31
- private _price?;
32
- private _stake?;
33
- private _stakePool?;
34
- private _state?;
35
- private _mint?;
36
- private _access?;
37
- private _kaminoLending?;
38
- private _kaminoFarm?;
39
- private _kaminoVaults?;
40
- private _fees?;
41
- private _timelock?;
42
- private _cctp?;
43
- private _bridge?;
44
- private _epi?;
45
- private _loopscale?;
46
- private _neutral?;
47
- constructor(config?: GlamClientConfig);
48
- get invest(): InvestClient;
49
- get fees(): FeesClient;
50
- get jupiterSwap(): JupiterSwapClient;
51
- get marinade(): MarinadeClient;
52
- get vault(): VaultClient;
53
- get stake(): StakeClient;
54
- get stakePool(): StakePoolClient;
55
- get price(): PriceClient;
56
- get state(): StateClient;
57
- get access(): AccessClient;
58
- get mint(): MintClient;
59
- get kaminoLending(): KaminoLendingClient;
60
- get kaminoFarm(): KaminoFarmClient;
61
- get kaminoVaults(): KaminoVaultsClient;
62
- get timelock(): TimelockClient;
63
- get cctp(): CctpClient;
64
- get bridge(): BridgeClient;
65
- get epi(): EpiClient;
66
- get loopscale(): LoopscaleClient;
67
- get neutral(): NeutralClient;
68
- }
@@ -1,29 +0,0 @@
1
- import { Provider, Wallet } from "@coral-xyz/anchor";
2
- import { PublicKey } from "@solana/web3.js";
3
- import { JupiterApiClient } from "./utils";
4
- export declare enum ClusterNetwork {
5
- Mainnet = "mainnet-beta",
6
- Testnet = "testnet",
7
- Devnet = "devnet",
8
- Localnet = "localnet",
9
- Custom = "custom"
10
- }
11
- export declare namespace ClusterNetwork {
12
- function fromStr(cluster: string): ClusterNetwork;
13
- /**
14
- * Detects the Solana cluster network from an RPC endpoint URL
15
- *
16
- * @param rpcUrl The RPC endpoint URL
17
- * @returns The detected cluster network
18
- */
19
- function fromUrl(rpcUrl: string): ClusterNetwork;
20
- }
21
- export type GlamClientConfig = {
22
- provider?: Provider;
23
- wallet?: Wallet;
24
- cluster?: ClusterNetwork;
25
- statePda?: PublicKey;
26
- jupiterApiKey?: string;
27
- jupiterApiClient?: JupiterApiClient;
28
- useStaging?: boolean;
29
- };
@@ -1,84 +0,0 @@
1
- import { PublicKey } from "@solana/web3.js";
2
- export declare const SEED_STATE = "state";
3
- export declare const SEED_VAULT = "vault";
4
- export declare const SEED_METADATA = "metadata";
5
- export declare const SEED_MINT = "mint";
6
- export declare const SEED_ESCROW = "escrow";
7
- export declare const SEED_REQUEST_QUEUE = "request-queue";
8
- export declare const SEED_ACCOUNT_POLICY = "account-policy";
9
- export declare const SEED_EXTRA_ACCOUNT_METAS = "extra-account-metas";
10
- export declare const SEED_GLOBAL_CONFIG = "global-config";
11
- export declare const SEED_INTEGRATION_AUTHORITY = "integration-authority";
12
- export declare const SEED_OBSERVATION_STATE = "observation-state";
13
- export declare const SEED_BRIDGE_REGISTRY = "bridge-registry";
14
- export declare const SEED_BRIDGE_SESSION = "bridge-session";
15
- export declare const SEED_BRIDGE_TRANSFER_RECORD = "bridge-transfer-record";
16
- export declare const STAKE_ACCOUNT_SIZE = 200;
17
- export declare const METEORA_POSITION_SIZE = 8120;
18
- export declare const KAMINO_OBTRIGATION_SIZE = 3344;
19
- export declare const KAMINO_RESERVE_SIZE = 8624;
20
- export declare const KAMINO_VAULT_STATE_SIZE = 62552;
21
- export declare const JITO_TIP_DEFAULT: PublicKey;
22
- export declare const MARINADE_NATIVE_STAKE_AUTHORITY: PublicKey;
23
- /**
24
- * Token mints. If no devnet version is defined, assume mainnet and devnet addresses are the same.
25
- *
26
- * Unless otherwise noted, all mints have 9 decimals.
27
- */
28
- export declare const WSOL: PublicKey;
29
- export declare const MSOL: PublicKey;
30
- export declare const USDC: PublicKey;
31
- export declare const USDC_DEVNET: PublicKey;
32
- export declare const USDT: PublicKey;
33
- export declare const JUP: PublicKey;
34
- /**
35
- * Program IDs
36
- */
37
- export declare const MARINADE_PROGRAM_ID: PublicKey;
38
- export declare const JUPITER_PROGRAM_ID: PublicKey;
39
- export declare const SANCTUM_STAKE_POOL_PROGRAM_ID: PublicKey;
40
- export declare const KAMINO_LENDING_PROGRAM: PublicKey;
41
- export declare const KAMINO_VAULTS_PROGRAM: PublicKey;
42
- export declare const KAMINO_FARM_PROGRAM: PublicKey;
43
- export declare const MEMO_PROGRAM: PublicKey;
44
- export declare const ALT_PROGRAM_ID: PublicKey;
45
- export declare const TOKEN_MESSENGER_MINTER_V2: PublicKey;
46
- export declare const MESSAGE_TRANSMITTER_V2: PublicKey;
47
- export declare const LOOPSCALE_PROGRAM_ID: PublicKey;
48
- export declare const NTBUNDLE_PROGRAM_ID: PublicKey;
49
- /**
50
- * Token ACL (sRFC-37)
51
- */
52
- export declare const TOKEN_ACL_PROGRAM: PublicKey;
53
- export declare const TOKEN_ACL_GATE_PROGRAM: PublicKey;
54
- /**
55
- * GLAM programs
56
- */
57
- export declare const TRANSFER_HOOK_PROGRAM: PublicKey;
58
- export declare const GLAM_CONFIG_PROGRAM: PublicKey;
59
- /**
60
- * Referrers
61
- */
62
- export declare const GLAM_REFERRER: PublicKey;
63
- /**
64
- * CCTP domain to chain name mapping
65
- */
66
- export declare const CCTP_DOMAIN_MAPPING: Record<number, string>;
67
- /**
68
- * Get protocol and permission mappings at runtime to ensure correct program IDs based on environment.
69
- *
70
- * This method provides the source of truth for protocol and permission mappings and staging status in SDK.
71
- */
72
- export declare const getProtocolsAndPermissions: (staging: boolean) => Record<string, Record<string, {
73
- name: string;
74
- staging: boolean;
75
- permissions: Record<number, string>;
76
- }>>;
77
- /**
78
- * (Program ID, Bitflag) -> Protocol Name
79
- */
80
- export declare const getProtocolNameByProgramAndBitflag: (staging: boolean) => Record<string, Record<string, string>>;
81
- /**
82
- * Protocol Name -> (Program ID, Bitflag)
83
- */
84
- export declare const getProgramAndBitflagByProtocolName: (staging: boolean) => Record<string, [string, string]>;
@@ -1,18 +0,0 @@
1
- import { struct } from "@coral-xyz/borsh";
2
- import { PublicKey } from "@solana/web3.js";
3
- /**
4
- * Base class for decodable on-chain account structures.
5
- *
6
- * This class provides a generic decode method that can be inherited by all
7
- * account deserializer classes, eliminating the need to implement the same
8
- * decode logic in each class.
9
- */
10
- export declare abstract class Decodable {
11
- readonly _address: PublicKey;
12
- static _layout: ReturnType<typeof struct>;
13
- static decode<T extends Decodable>(this: {
14
- new (): T;
15
- _layout: ReturnType<typeof struct>;
16
- }, address: PublicKey, buffer: Buffer): T;
17
- getAddress(): PublicKey;
18
- }
@@ -1,3 +0,0 @@
1
- export { Decodable } from "./base";
2
- export * from "./kaminoLayouts";
3
- export * from "./tokenAclLayouts";
@@ -1,120 +0,0 @@
1
- import { BN } from "@coral-xyz/anchor";
2
- import { PublicKey } from "@solana/web3.js";
3
- export declare class MintPolicy {
4
- lockupPeriod: number;
5
- maxCap: BN;
6
- minSubscription: BN;
7
- minRedemption: BN;
8
- reserved: BN;
9
- allowlist: PublicKey[] | null;
10
- blocklist: PublicKey[] | null;
11
- static _layout: any;
12
- constructor(lockupPeriod: number, maxCap: BN, minSubscription: BN, minRedemption: BN, reserved: BN, allowlist: PublicKey[] | null, blocklist: PublicKey[] | null);
13
- static decode(buffer: Buffer): MintPolicy;
14
- encode(): Buffer;
15
- }
16
- export declare class JupiterSwapPolicy {
17
- maxSlippageBps: number;
18
- swapAllowlist: PublicKey[] | null;
19
- maxDeviationBps: number;
20
- constructor(maxSlippageBps: number, swapAllowlist: PublicKey[] | null, maxDeviationBps?: number);
21
- static decode(buffer: Buffer<ArrayBufferLike>): JupiterSwapPolicy;
22
- encode(): Buffer;
23
- }
24
- export declare class TransferPolicy {
25
- allowlist: PublicKey[];
26
- static _layout: any;
27
- constructor(allowlist: PublicKey[]);
28
- static decode(buffer: Buffer<ArrayBufferLike>): TransferPolicy;
29
- encode(): Buffer;
30
- }
31
- export declare class KaminoLendingPolicy {
32
- marketsAllowlist: PublicKey[];
33
- borrowAllowlist: PublicKey[];
34
- static _layout: any;
35
- constructor(marketsAllowlist: PublicKey[], borrowAllowlist: PublicKey[]);
36
- static decode(buffer: Buffer<ArrayBufferLike>): KaminoLendingPolicy;
37
- encode(): Buffer;
38
- }
39
- export declare class KaminoVaultsPolicy {
40
- vaultsAllowlist: PublicKey[];
41
- static _layout: any;
42
- constructor(vaultsAllowlist: PublicKey[]);
43
- static decode(buffer: Buffer<ArrayBufferLike>): KaminoVaultsPolicy;
44
- encode(): Buffer;
45
- }
46
- export declare class LoopscalePolicy {
47
- strategiesAllowlist: PublicKey[];
48
- static _layout: any;
49
- constructor(strategiesAllowlist: PublicKey[]);
50
- static decode(buffer: Buffer<ArrayBufferLike>): LoopscalePolicy;
51
- encode(): Buffer;
52
- }
53
- export declare class NeutralPolicy {
54
- bundlesAllowlist: PublicKey[];
55
- static _layout: any;
56
- constructor(bundlesAllowlist: PublicKey[]);
57
- static decode(buffer: Buffer<ArrayBufferLike>): NeutralPolicy;
58
- encode(): Buffer;
59
- }
60
- export declare class CctpPolicy {
61
- allowedDestinations: {
62
- domain: number;
63
- address: PublicKey;
64
- }[];
65
- static _layout: any;
66
- constructor(allowedDestinations: {
67
- domain: number;
68
- address: PublicKey;
69
- }[]);
70
- static decode(buffer: Buffer<ArrayBufferLike>): CctpPolicy;
71
- encode(): Buffer;
72
- get domainToAddressesMap(): Map<number, PublicKey[]>;
73
- }
74
- export declare enum RouteManagementMode {
75
- UnmanagedOnly = 0,
76
- ManagedOnly = 1,
77
- Either = 2
78
- }
79
- export type LayerzeroOftRoute = {
80
- sourceMint: PublicKey;
81
- destinationChain: number;
82
- destinationRecipient: PublicKey;
83
- providerProgram: PublicKey;
84
- managementMode: RouteManagementMode;
85
- minAmount: BN;
86
- maxAmount: BN;
87
- };
88
- export declare class LayerzeroOftPolicy {
89
- routes: LayerzeroOftRoute[];
90
- static _layout: any;
91
- constructor(routes: LayerzeroOftRoute[]);
92
- static decode(buffer: Buffer<ArrayBufferLike>, _staging?: boolean): LayerzeroOftPolicy;
93
- encode(): Buffer;
94
- }
95
- export declare enum PeriodType {
96
- Day = 0,
97
- Week = 1,
98
- Month = 2
99
- }
100
- export interface AssetRateLimit {
101
- mint: PublicKey;
102
- periodType: number;
103
- amount: BN;
104
- }
105
- export interface DelegateRateLimit {
106
- delegate: PublicKey;
107
- limits: AssetRateLimit[];
108
- }
109
- export declare class TransferRateLimitPolicy {
110
- vaultDefaults: AssetRateLimit[];
111
- delegateOverrides: DelegateRateLimit[];
112
- static _layout: any;
113
- constructor(vaultDefaults: AssetRateLimit[], delegateOverrides: DelegateRateLimit[]);
114
- static decode(buffer: Buffer<ArrayBufferLike>): TransferRateLimitPolicy;
115
- encode(): Buffer;
116
- /**
117
- * Derive the TransferTracker PDA address for a given vault state, signer, and mint.
118
- */
119
- static getTransferTrackerPda(glamState: PublicKey, signer: PublicKey, mint: PublicKey, programId: PublicKey): [PublicKey, number];
120
- }
@@ -1,264 +0,0 @@
1
- import { BN } from "@coral-xyz/anchor";
2
- import { PublicKey } from "@solana/web3.js";
3
- import { BigFractionBytes } from "../utils";
4
- import { Decodable } from "./base";
5
- import Decimal from "decimal.js";
6
- export interface KVaultAllocation {
7
- reserve: PublicKey;
8
- ctokenVault: PublicKey;
9
- targetAllocationWeight: BN;
10
- tokenAllocationCap: BN;
11
- ctokenVaultBump: BN;
12
- configPadding: BN[];
13
- ctokenAllocation: BN;
14
- lastInvestSlot: BN;
15
- tokenTargetAllocationSf: BN;
16
- statePadding: BN[];
17
- }
18
- export declare class KVaultState extends Decodable {
19
- discriminator: number[];
20
- vaultAdminAuthority: PublicKey;
21
- baseVaultAuthority: PublicKey;
22
- baseVaultAuthorityBump: BN;
23
- tokenMint: PublicKey;
24
- tokenMintDecimals: BN;
25
- tokenVault: PublicKey;
26
- tokenProgram: PublicKey;
27
- sharesMint: PublicKey;
28
- sharesMintDecimals: BN;
29
- tokenAvailable: BN;
30
- sharesIssued: BN;
31
- availableCrankFunds: BN;
32
- padding0: BN;
33
- performanceFeeBps: BN;
34
- managementFeeBps: BN;
35
- lastFeeChargeTimestamp: BN;
36
- prevAumSf: BN;
37
- pendingFeesSf: BN;
38
- vaultAllocationStrategy: KVaultAllocation[];
39
- padding1: BN[];
40
- minDepositAmount: BN;
41
- minWithdrawAmount: BN;
42
- minInvestAmount: BN;
43
- minInvestDelaySlots: BN;
44
- crankFundFeePerReserve: BN;
45
- pendingAdmin: PublicKey;
46
- cumulativeEarnedInterestSf: BN;
47
- cumulativeMgmtFeesSf: BN;
48
- cumulativePerfFeesSf: BN;
49
- name: number[];
50
- vaultLookupTable: PublicKey;
51
- vaultFarm: PublicKey;
52
- creationTimestamp: BN;
53
- padding2: BN;
54
- allocationAdmin: PublicKey;
55
- padding3: BN[];
56
- static _layout: any;
57
- get nameStr(): string;
58
- get validAllocations(): KVaultAllocation[];
59
- }
60
- interface LastUpdate {
61
- slot: BN;
62
- stale: number;
63
- priceStatus: number;
64
- placeholder: number[];
65
- }
66
- interface PriceHeuristic {
67
- lower: BN;
68
- upper: BN;
69
- exp: BN;
70
- }
71
- interface ScopeConfiguration {
72
- priceFeed: PublicKey;
73
- priceChain: number[];
74
- twapChain: number[];
75
- }
76
- interface SwitchboardConfiguration {
77
- priceAggregator: PublicKey;
78
- twapAggregator: PublicKey;
79
- }
80
- interface PythConfiguration {
81
- price: PublicKey;
82
- }
83
- interface TokenInfo {
84
- name: number[];
85
- heuristic: PriceHeuristic;
86
- maxTwapDivergenceBps: BN;
87
- maxAgePriceSeconds: BN;
88
- maxAgeTwapSeconds: BN;
89
- scopeConfiguration: ScopeConfiguration;
90
- switchboardConfiguration: SwitchboardConfiguration;
91
- pythConfiguration: PythConfiguration;
92
- blockPriceUsage: number;
93
- reserved: number[];
94
- padding: BN[];
95
- }
96
- interface ReserveFees {
97
- borrowFeeSf: BN;
98
- flashLoanFeeSf: BN;
99
- padding: number[];
100
- }
101
- interface CurvePoint {
102
- utilizationRateBps: number;
103
- borrowRateBps: number;
104
- }
105
- interface BorrowRateCurve {
106
- points: CurvePoint[];
107
- }
108
- interface WithdrawalCaps {
109
- configCapacity: BN;
110
- currentTotal: BN;
111
- lastIntervalStartTimestamp: BN;
112
- configIntervalLengthSeconds: BN;
113
- }
114
- interface ReserveLiquidity {
115
- mintPubkey: PublicKey;
116
- supplyVault: PublicKey;
117
- feeVault: PublicKey;
118
- availableAmount: BN;
119
- borrowedAmountSf: BN;
120
- marketPriceSf: BN;
121
- marketPriceLastUpdatedTs: BN;
122
- mintDecimals: BN;
123
- depositLimitCrossedTimestamp: BN;
124
- borrowLimitCrossedTimestamp: BN;
125
- cumulativeBorrowRateBsf: BigFractionBytes;
126
- accumulatedProtocolFeesSf: BN;
127
- accumulatedReferrerFeesSf: BN;
128
- pendingReferrerFeesSf: BN;
129
- absoluteReferralRateSf: BN;
130
- tokenProgram: PublicKey;
131
- padding2: BN[];
132
- padding3: BN[];
133
- }
134
- interface ReserveCollateral {
135
- mintPubkey: PublicKey;
136
- mintTotalSupply: BN;
137
- supplyVault: PublicKey;
138
- padding1: BN[];
139
- padding2: BN[];
140
- }
141
- interface ReserveConfig {
142
- status: number;
143
- assetTier: number;
144
- hostFixedInterestRateBps: number;
145
- reserved2: number[];
146
- protocolOrderExecutionFeePct: number;
147
- protocolTakeRatePct: number;
148
- protocolLiquidationFeePct: number;
149
- loanToValuePct: number;
150
- liquidationThresholdPct: number;
151
- minLiquidationBonusBps: number;
152
- maxLiquidationBonusBps: number;
153
- badDebtLiquidationBonusBps: number;
154
- deleveragingMarginCallPeriodSecs: BN;
155
- deleveragingThresholdDecreaseBpsPerDay: BN;
156
- fees: ReserveFees;
157
- borrowRateCurve: BorrowRateCurve;
158
- borrowFactorPct: BN;
159
- depositLimit: BN;
160
- borrowLimit: BN;
161
- tokenInfo: TokenInfo;
162
- depositWithdrawalCap: WithdrawalCaps;
163
- debtWithdrawalCap: WithdrawalCaps;
164
- elevationGroups: number[];
165
- disableUsageAsCollOutsideEmode: number;
166
- utilizationLimitBlockBorrowingAbovePct: number;
167
- autodeleverageEnabled: number;
168
- reserved1: number[];
169
- borrowLimitOutsideElevationGroup: BN;
170
- borrowLimitAgainstThisCollateralInElevationGroup: BN[];
171
- }
172
- export declare class Reserve extends Decodable {
173
- discriminator: number[];
174
- version: BN;
175
- lastUpdate: LastUpdate;
176
- lendingMarket: PublicKey;
177
- farmCollateral: PublicKey;
178
- farmDebt: PublicKey;
179
- liquidity: ReserveLiquidity;
180
- reserveLiquidityPadding: BN[];
181
- collateral: ReserveCollateral;
182
- reserveCollateralPadding: BN[];
183
- config: ReserveConfig;
184
- configPadding: BN[];
185
- borrowedAmountOutsideElevationGroup: BN;
186
- borrowedAmountsAgainstThisReserveInElevationGroups: BN[];
187
- padding: BN[];
188
- static _layout: any;
189
- get cumulativeBorrowRate(): Decimal;
190
- /**
191
- * @returns the stale exchange rate between the collateral tokens and the liquidity - this is a decimal number scaled by 1e18
192
- */
193
- get collateralExchangeRate(): Decimal;
194
- get totalSupply(): Decimal;
195
- get borrowedAmount(): Decimal;
196
- get accumulatedProtocolFees(): Decimal;
197
- get accumulatedReferrerFees(): Decimal;
198
- get pendingReferrerFees(): Decimal;
199
- get scopePriceFeed(): PublicKey;
200
- get liquidityFeeReceiver(): PublicKey;
201
- get farmDebtNullable(): PublicKey | null;
202
- get farmCollateralNullable(): PublicKey | null;
203
- }
204
- interface ObligationCollateral {
205
- depositReserve: PublicKey;
206
- depositedAmount: BN;
207
- marketValueSf: BN;
208
- borrowedAmountAgainstThisCollateralInElevationGroup: BN;
209
- padding: BN[];
210
- }
211
- interface ObligationLiquidity {
212
- borrowReserve: PublicKey;
213
- cumulativeBorrowRateBsf: BigFractionBytes;
214
- padding: BN;
215
- borrowedAmountSf: BN;
216
- marketValueSf: BN;
217
- borrowFactorAdjustedMarketValueSf: BN;
218
- borrowedAmountOutsideElevationGroups: BN;
219
- padding2: BN[];
220
- }
221
- interface ObligationOrder {
222
- conditionThresholdSf: BN;
223
- opportunityParameterSf: BN;
224
- minExecutionBonusBps: number;
225
- maxExecutionBonusBps: number;
226
- conditionType: number;
227
- opportunityType: number;
228
- padding1: number[];
229
- padding2: BN[];
230
- }
231
- export declare class Obligation extends Decodable {
232
- discriminator: number[];
233
- tag: BN;
234
- lastUpdate: LastUpdate;
235
- lendingMarket: PublicKey;
236
- owner: PublicKey;
237
- deposits: ObligationCollateral[];
238
- lowestReserveDepositLiquidationLtv: BN;
239
- depositedValueSf: BN;
240
- borrows: ObligationLiquidity[];
241
- borrowFactorAdjustedDebtValueSf: BN;
242
- borrowedAssetsMarketValueSf: BN;
243
- allowedBorrowValueSf: BN;
244
- unhealthyBorrowValueSf: BN;
245
- depositsAssetTiers: number[];
246
- borrowsAssetTiers: number[];
247
- elevationGroup: number;
248
- numOfObsoleteDepositReserves: number;
249
- hasDebt: number;
250
- referrer: PublicKey;
251
- borrowingDisabled: number;
252
- autodeleverageTargetLtvPct: number;
253
- lowestReserveDepositMaxLtvPct: number;
254
- numOfObsoleteBorrowReserves: number;
255
- reserved: number[];
256
- highestBorrowFactorPct: BN;
257
- autodeleverageMarginCallStartedTimestamp: BN;
258
- orders: ObligationOrder[];
259
- padding3: BN[];
260
- static _layout: any;
261
- get activeDeposits(): ObligationCollateral[];
262
- get activeBorrows(): ObligationLiquidity[];
263
- }
264
- export {};