@glamsystems/glam-sdk 1.1.0-alpha.5 → 1.1.0

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 (137) hide show
  1. package/LICENSE +201 -0
  2. package/buffer-layout.d.ts +88 -0
  3. package/index.cjs.d.ts +1 -0
  4. package/index.cjs.js +1 -92594
  5. package/index.esm.d.ts +1 -0
  6. package/index.esm.js +1 -92146
  7. package/package.json +29 -17
  8. package/src/assets.d.ts +39 -0
  9. package/src/client/access.d.ts +57 -0
  10. package/src/client/base.d.ts +234 -0
  11. package/src/client/bridge.d.ts +205 -0
  12. package/src/client/bridgeRegistry.d.ts +32 -0
  13. package/src/client/cctp.d.ts +164 -0
  14. package/src/client/epi.d.ts +228 -0
  15. package/src/client/fees.d.ts +33 -0
  16. package/src/client/invest.d.ts +37 -0
  17. package/src/client/jupiter-lend/borrow.d.ts +92 -0
  18. package/src/client/jupiter-lend/earn.d.ts +64 -0
  19. package/src/client/jupiter-lend/index.d.ts +3 -0
  20. package/src/client/jupiter-lend/shared.d.ts +129 -0
  21. package/src/client/jupiter.d.ts +53 -0
  22. package/src/client/kamino/farm.d.ts +39 -0
  23. package/src/client/kamino/index.d.ts +4 -0
  24. package/src/client/kamino/lending.d.ts +94 -0
  25. package/src/client/kamino/types.d.ts +56 -0
  26. package/src/client/kamino/vaults.d.ts +39 -0
  27. package/src/client/loopscale/borrow.d.ts +118 -0
  28. package/src/client/loopscale/core.d.ts +604 -0
  29. package/src/client/loopscale/index.d.ts +5 -0
  30. package/src/client/loopscale/lend.d.ts +123 -0
  31. package/src/client/loopscale/vault.d.ts +43 -0
  32. package/src/client/marinade.d.ts +42 -0
  33. package/src/client/mint.d.ts +143 -0
  34. package/src/client/orca.d.ts +255 -0
  35. package/src/client/phoenix.d.ts +214 -0
  36. package/src/client/price.d.ts +182 -0
  37. package/src/client/stake-pool.d.ts +39 -0
  38. package/src/client/stake.d.ts +34 -0
  39. package/src/client/state.d.ts +56 -0
  40. package/src/client/timelock.d.ts +31 -0
  41. package/src/client/vault.d.ts +98 -0
  42. package/src/client.d.ts +82 -0
  43. package/src/clientConfig.d.ts +32 -0
  44. package/src/constants.d.ts +111 -0
  45. package/src/deser/base.d.ts +18 -0
  46. package/src/deser/index.d.ts +4 -0
  47. package/src/deser/integrationPolicies.d.ts +195 -0
  48. package/src/deser/kaminoLayouts.d.ts +264 -0
  49. package/src/deser/loopscaleLayouts.d.ts +157 -0
  50. package/src/deser/tokenAclLayouts.d.ts +67 -0
  51. package/src/error.d.ts +29 -0
  52. package/src/glamExports.d.ts +6260 -0
  53. package/src/globalConfig.d.ts +27 -0
  54. package/src/index.d.ts +24 -0
  55. package/src/models/acl.d.ts +43 -0
  56. package/src/models/index.d.ts +8 -0
  57. package/src/models/mint.d.ts +57 -0
  58. package/src/models/state.d.ts +94 -0
  59. package/src/models/types.d.ts +28 -0
  60. package/src/protocols.d.ts +29 -0
  61. package/src/utils/accounts.d.ts +71 -0
  62. package/src/utils/bitmask.d.ts +53 -0
  63. package/src/utils/blockhash.d.ts +11 -0
  64. package/src/utils/common.d.ts +73 -0
  65. package/src/utils/computeBudget.d.ts +15 -0
  66. package/src/utils/evm.d.ts +10 -0
  67. package/src/utils/fraction.d.ts +29 -0
  68. package/src/utils/glamPDAs.d.ts +15 -0
  69. package/src/utils/helius.d.ts +66 -0
  70. package/src/utils/index.d.ts +17 -0
  71. package/src/utils/jupiterApi.d.ts +95 -0
  72. package/src/utils/lookupTables.d.ts +83 -0
  73. package/src/utils/phoenixApi.d.ts +146 -0
  74. package/src/utils/pkmap.d.ts +87 -0
  75. package/src/utils/pkset.d.ts +73 -0
  76. package/src/utils/positionCategorizer.d.ts +38 -0
  77. package/src/utils/rpc.d.ts +18 -0
  78. package/src/utils/timelock.d.ts +52 -0
  79. package/src/utils/transaction.d.ts +13 -0
  80. package/target/idl/ext_bridge-staging.json +2379 -0
  81. package/target/idl/ext_bridge.json +2379 -0
  82. package/target/idl/ext_drift.json +5464 -0
  83. package/target/idl/ext_epi-staging.json +2862 -0
  84. package/target/idl/ext_epi.json +2862 -0
  85. package/target/idl/ext_loopscale-staging.json +4708 -0
  86. package/target/idl/ext_loopscale.json +4708 -0
  87. package/target/idl/ext_marinade-staging.json +1587 -0
  88. package/target/idl/ext_phoenix-staging.json +3525 -0
  89. package/target/idl/ext_phoenix.json +3525 -0
  90. package/target/idl/mock_layerzero_endpoint.json +144 -0
  91. package/target/idl/mock_layerzero_oft.json +155 -0
  92. package/target/idl/mock_wormhole_verify_vaa_shim.json +58 -0
  93. package/target/types/ext_bridge-staging.d.ts +2385 -0
  94. package/target/types/ext_bridge-staging.ts +2385 -0
  95. package/target/types/ext_bridge.d.ts +2385 -0
  96. package/target/types/ext_bridge.ts +2385 -0
  97. package/target/types/ext_cctp-staging.d.ts +1268 -0
  98. package/target/types/ext_cctp.d.ts +1268 -0
  99. package/target/types/ext_drift.d.ts +5470 -0
  100. package/target/types/ext_drift.ts +5470 -0
  101. package/target/types/ext_epi-staging.d.ts +2868 -0
  102. package/target/types/ext_epi-staging.ts +2868 -0
  103. package/target/types/ext_epi.d.ts +2868 -0
  104. package/target/types/ext_epi.ts +2868 -0
  105. package/target/types/ext_jupiter-staging.d.ts +1966 -0
  106. package/target/types/ext_jupiter.d.ts +1966 -0
  107. package/target/types/ext_kamino-staging.d.ts +3433 -0
  108. package/target/types/ext_kamino.d.ts +3433 -0
  109. package/target/types/ext_loopscale-staging.d.ts +4714 -0
  110. package/target/types/ext_loopscale-staging.ts +4714 -0
  111. package/target/types/ext_loopscale.d.ts +4714 -0
  112. package/target/types/ext_loopscale.ts +4714 -0
  113. package/target/types/ext_marinade-staging.d.ts +1593 -0
  114. package/target/types/ext_marinade-staging.ts +1593 -0
  115. package/target/types/ext_marinade.d.ts +1593 -0
  116. package/target/types/ext_orca-staging.d.ts +2829 -0
  117. package/target/types/ext_orca.d.ts +2829 -0
  118. package/target/types/ext_phoenix-staging.d.ts +3531 -0
  119. package/target/types/ext_phoenix-staging.ts +3531 -0
  120. package/target/types/ext_phoenix.d.ts +3531 -0
  121. package/target/types/ext_phoenix.ts +3531 -0
  122. package/target/types/ext_spl-staging.d.ts +1274 -0
  123. package/target/types/ext_spl.d.ts +1274 -0
  124. package/target/types/ext_stake_pool-staging.d.ts +1622 -0
  125. package/target/types/ext_stake_pool.d.ts +1622 -0
  126. package/target/types/glam_config.d.ts +755 -0
  127. package/target/types/glam_mint-staging.d.ts +8802 -0
  128. package/target/types/glam_mint.d.ts +6349 -0
  129. package/target/types/glam_policies.d.ts +477 -0
  130. package/target/types/glam_protocol-staging.d.ts +3362 -0
  131. package/target/types/glam_protocol.d.ts +2783 -0
  132. package/target/types/mock_layerzero_endpoint.d.ts +150 -0
  133. package/target/types/mock_layerzero_endpoint.ts +150 -0
  134. package/target/types/mock_layerzero_oft.d.ts +161 -0
  135. package/target/types/mock_layerzero_oft.ts +161 -0
  136. package/target/types/mock_wormhole_verify_vaa_shim.d.ts +64 -0
  137. package/target/types/mock_wormhole_verify_vaa_shim.ts +64 -0
@@ -0,0 +1,27 @@
1
+ import { Connection, PublicKey } from "@solana/web3.js";
2
+ import { Decodable } from "./deser/base";
3
+ import { PkMap } from "./utils";
4
+ type RawAssetMeta = {
5
+ asset: PublicKey;
6
+ decimals: number;
7
+ oracle: PublicKey;
8
+ oracleSourceOrdinal: number;
9
+ maxAgeSeconds: number;
10
+ priority: number;
11
+ padding: number[];
12
+ };
13
+ export declare function fetchGlobalConfig(connection: Connection, address?: PublicKey): Promise<GlobalConfig>;
14
+ export declare class GlobalConfig extends Decodable {
15
+ discriminator: number[];
16
+ admin: PublicKey;
17
+ feeAuthority: PublicKey;
18
+ referrer: PublicKey;
19
+ baseFeeBps: number;
20
+ flowFeeBps: number;
21
+ assetMetas: RawAssetMeta[];
22
+ static _layout: any;
23
+ static encode(data: any): Buffer;
24
+ }
25
+ export declare function getOracleName(ordinal: number): string;
26
+ export declare function fetchOnchainAssetMetas(connection: Connection, address?: PublicKey): Promise<PkMap<RawAssetMeta>>;
27
+ export {};
package/src/index.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ export * from "./glamExports";
2
+ export * from "./models";
3
+ export * from "./clientConfig";
4
+ export * from "./client";
5
+ export * from "./client/jupiter";
6
+ export * from "./client/timelock";
7
+ export * from "./client/cctp";
8
+ export * from "./client/bridge";
9
+ export * from "./client/epi";
10
+ export * from "./client/loopscale";
11
+ export * from "./client/phoenix";
12
+ export * from "./client/jupiter-lend";
13
+ export * from "./client/orca";
14
+ export * from "./client/price";
15
+ export * from "./deser/integrationPolicies";
16
+ export * from "./deser/loopscaleLayouts";
17
+ export * from "./deser/tokenAclLayouts";
18
+ export * from "./client/base";
19
+ export * from "./assets";
20
+ export * from "./globalConfig";
21
+ export * from "./constants";
22
+ export * from "./protocols";
23
+ export * from "./error";
24
+ export * from "./utils";
@@ -0,0 +1,43 @@
1
+ import { IdlTypes } from "@coral-xyz/anchor";
2
+ import { GlamProtocol } from "../glamExports";
3
+ import { PublicKey } from "@solana/web3.js";
4
+ import { BN } from "@coral-xyz/anchor";
5
+ export type IntegrationPermissionsType = IdlTypes<GlamProtocol>["integrationPermissions"];
6
+ export type ProtocolPermissionsType = IdlTypes<GlamProtocol>["protocolPermissions"];
7
+ export declare class IntegrationPermissions implements IntegrationPermissionsType {
8
+ integrationProgram: PublicKey;
9
+ protocolPermissions: ProtocolPermissionsType[];
10
+ constructor(obj: Partial<IntegrationPermissionsType>);
11
+ }
12
+ export declare class ProtocolPermissions implements ProtocolPermissionsType {
13
+ protocolBitflag: number;
14
+ permissionsBitmask: BN;
15
+ constructor(obj: Partial<ProtocolPermissionsType>);
16
+ }
17
+ export type ProtocolPolicyType = IdlTypes<GlamProtocol>["protocolPolicy"];
18
+ export declare class ProtocolPolicy implements ProtocolPolicyType {
19
+ protocolBitflag: number;
20
+ data: Buffer;
21
+ constructor(obj: Partial<ProtocolPolicyType>);
22
+ }
23
+ export type IntegrationAclType = IdlTypes<GlamProtocol>["integrationAcl"];
24
+ export declare class IntegrationAcl implements IntegrationAclType {
25
+ integrationProgram: PublicKey;
26
+ protocolsBitmask: number;
27
+ protocolPolicies: ProtocolPolicy[];
28
+ constructor(obj: Partial<IntegrationAclType>);
29
+ }
30
+ export type DelegateAclType = IdlTypes<GlamProtocol>["delegateAcl"];
31
+ export declare class DelegateAcl implements DelegateAclType {
32
+ pubkey: PublicKey;
33
+ integrationPermissions: IntegrationPermissions[];
34
+ expiresAt: BN;
35
+ constructor(obj: Partial<DelegateAclType>);
36
+ }
37
+ export type EmergencyAccessUpdateArgsType = IdlTypes<GlamProtocol>["emergencyAccessUpdateArgs"];
38
+ export declare class EmergencyAccessUpdateArgs implements EmergencyAccessUpdateArgsType {
39
+ disabledIntegrations: PublicKey[];
40
+ disabledDelegates: PublicKey[];
41
+ stateEnabled: boolean | null;
42
+ constructor(obj: Partial<EmergencyAccessUpdateArgsType>);
43
+ }
@@ -0,0 +1,8 @@
1
+ export { StateIdlModel, StateModel, CreatedModel, StateAccountType, } from "./state";
2
+ export type { StateAccount, StateModelType, CreatedModelType } from "./state";
3
+ export { MintIdlModel, MintModel, EmergencyUpdateMintArgs, RequestType, } from "./mint";
4
+ export type { MintModelType, EmergencyUpdateMintArgsType, FeeStructure, FeeParams, AccruedFees, NotifyAndSettle, } from "./mint";
5
+ export { IntegrationPermissions, ProtocolPermissions, ProtocolPolicy, IntegrationAcl, DelegateAcl, EmergencyAccessUpdateArgs, } from "./acl";
6
+ export type { IntegrationPermissionsType, ProtocolPermissionsType, ProtocolPolicyType, IntegrationAclType, DelegateAclType, EmergencyAccessUpdateArgsType, } from "./acl";
7
+ export { PriceDenom, TimeUnit, VoteAuthorize } from "./types";
8
+ export type { RequestQueue, PendingRequest } from "./types";
@@ -0,0 +1,57 @@
1
+ import { IdlTypes } from "@coral-xyz/anchor";
2
+ import { GlamProtocol, GlamMint } from "../glamExports";
3
+ import { PublicKey } from "@solana/web3.js";
4
+ import { BN } from "@coral-xyz/anchor";
5
+ export type FeeStructure = IdlTypes<GlamProtocol>["feeStructure"];
6
+ export type FeeParams = IdlTypes<GlamProtocol>["feeParams"];
7
+ export type AccruedFees = IdlTypes<GlamProtocol>["accruedFees"];
8
+ export type NotifyAndSettle = IdlTypes<GlamProtocol>["notifyAndSettle"];
9
+ export type MintModelType = IdlTypes<GlamMint>["mintModel"];
10
+ export declare class MintIdlModel implements MintModelType {
11
+ symbol: string | null;
12
+ name: number[] | null;
13
+ uri: string | null;
14
+ yearInSeconds: number | null;
15
+ permanentDelegate: PublicKey | null;
16
+ defaultAccountStateFrozen: boolean | null;
17
+ feeStructure: FeeStructure | null;
18
+ notifyAndSettle: NotifyAndSettle | null;
19
+ lockupPeriod: number | null;
20
+ maxCap: BN | null;
21
+ minSubscription: BN | null;
22
+ minRedemption: BN | null;
23
+ allowlist: PublicKey[] | null;
24
+ blocklist: PublicKey[] | null;
25
+ constructor(data: Partial<MintModelType>);
26
+ }
27
+ export declare class MintModel extends MintIdlModel {
28
+ statePda: PublicKey | null;
29
+ baseAssetMint: PublicKey | null;
30
+ transferHookProgram: PublicKey | null;
31
+ claimableFees: AccruedFees | null;
32
+ claimedFees: AccruedFees | null;
33
+ feeParams: FeeParams | null;
34
+ subscriptionPaused: boolean | null;
35
+ redemptionPaused: boolean | null;
36
+ pendingRequests: any[] | null;
37
+ constructor(data: Partial<MintModel>);
38
+ get nameStr(): string;
39
+ }
40
+ export type EmergencyUpdateMintArgsType = IdlTypes<GlamMint>["emergencyUpdateMintArgs"];
41
+ export type RequestType = EmergencyUpdateMintArgsType["requestType"];
42
+ export declare class EmergencyUpdateMintArgs implements EmergencyUpdateMintArgsType {
43
+ requestType: RequestType;
44
+ setPaused: boolean;
45
+ }
46
+ export declare const RequestType: {
47
+ SUBSCRIPTION: RequestType;
48
+ REDEMPTION: RequestType;
49
+ equals(a: RequestType, b: RequestType): boolean;
50
+ fromInt(int: number): RequestType;
51
+ };
52
+ export type OracleConfigsType = IdlTypes<GlamProtocol>["oracleConfigs"];
53
+ export declare class OracleConfigs implements OracleConfigsType {
54
+ readonly maxAgesSeconds: number[][];
55
+ padding: number[];
56
+ constructor(maxAgesSeconds: number[][]);
57
+ }
@@ -0,0 +1,94 @@
1
+ import { IdlTypes, IdlAccounts } from "@coral-xyz/anchor";
2
+ import { GlamProtocol } from "../glamExports";
3
+ import { PublicKey } from "@solana/web3.js";
4
+ import { Mint } from "@solana/spl-token";
5
+ import { BN } from "@coral-xyz/anchor";
6
+ import { MintModel } from "./mint";
7
+ import type { RequestQueue } from "./types";
8
+ import type { IntegrationAcl, DelegateAcl } from "./acl";
9
+ export type StateAccount = IdlAccounts<GlamProtocol>["stateAccount"];
10
+ export type StateModelType = IdlTypes<GlamProtocol>["stateModel"];
11
+ export type StateAccountType = NonNullable<StateModelType["accountType"]>;
12
+ export type OracleConfigsType = IdlTypes<GlamProtocol>["oracleConfigs"];
13
+ type StateIdlModelInput = Partial<StateModelType> & {
14
+ oracleConfigs?: OracleConfigsType | null;
15
+ };
16
+ /**
17
+ * State model class as defined in the IDL.
18
+ */
19
+ export declare class StateIdlModel implements StateModelType {
20
+ accountType: StateAccountType | null;
21
+ name: number[] | null;
22
+ uri: string | null;
23
+ enabled: boolean | null;
24
+ oracleConfigs: OracleConfigsType | null;
25
+ assets: PublicKey[] | null;
26
+ created: CreatedModel | null;
27
+ owner: PublicKey | null;
28
+ portfolioManagerName: number[] | null;
29
+ borrowable: PublicKey[] | null;
30
+ timelockDuration: number | null;
31
+ integrationAcls: IntegrationAcl[] | null;
32
+ delegateAcls: DelegateAcl[] | null;
33
+ constructor(data: StateIdlModelInput);
34
+ }
35
+ /**
36
+ * Enriched state model built from multiple onchain accounts
37
+ */
38
+ export declare class StateModel extends StateIdlModel {
39
+ accountType: StateAccountType;
40
+ name: number[];
41
+ enabled: boolean;
42
+ assets: PublicKey[];
43
+ created: CreatedModel;
44
+ owner: PublicKey;
45
+ portfolioManagerName: number[];
46
+ timelockDuration: number;
47
+ integrationAcls: IntegrationAcl[];
48
+ delegateAcls: DelegateAcl[];
49
+ id: PublicKey;
50
+ vault: PublicKey;
51
+ mint: PublicKey | null;
52
+ mintModel: MintModel | null;
53
+ baseAssetMint: PublicKey;
54
+ baseAssetTokenProgram: number;
55
+ baseAssetDecimals: number;
56
+ pendingStateUpdates: any | null;
57
+ pendingMintUpdates: any | null;
58
+ timelockExpiresAt: number | null;
59
+ externalPositions: PublicKey[];
60
+ pricedProtocols: any[];
61
+ constructor(data: Partial<StateModel>);
62
+ get idStr(): string;
63
+ get nameStr(): string;
64
+ get productType(): string;
65
+ get launchDate(): string;
66
+ get sparkleKey(): string;
67
+ get baseAssetTokenProgramId(): PublicKey;
68
+ get assetsForPricing(): PublicKey[];
69
+ /**
70
+ * Build a StateModel from onchain data
71
+ *
72
+ * @param stateAccount provides core fund data
73
+ * @param openfundsMetadataAccount includes fund rawOpenfunds data and share class rawOpenfunds data
74
+ * @param glamMint
75
+ */
76
+ static fromOnchainAccounts(statePda: PublicKey, stateAccount: StateAccount, staging: boolean, glamMint?: Mint, requestQueue?: RequestQueue): StateModel;
77
+ }
78
+ export type CreatedModelType = IdlTypes<GlamProtocol>["createdModel"];
79
+ export declare class CreatedModel implements CreatedModelType {
80
+ key: number[];
81
+ createdBy: PublicKey;
82
+ createdAt: BN;
83
+ constructor(obj: Partial<CreatedModelType>);
84
+ }
85
+ export declare const StateAccountType: {
86
+ VAULT: StateAccountType;
87
+ TOKENIZED_VAULT: StateAccountType;
88
+ MINT: StateAccountType;
89
+ SINGLE_ASSET_VAULT: StateAccountType;
90
+ equals(a: StateAccountType, b: StateAccountType): boolean;
91
+ from(s: string): StateAccountType;
92
+ hasRequestQueue(accountType: StateAccountType): boolean;
93
+ };
94
+ export {};
@@ -0,0 +1,28 @@
1
+ import { IdlTypes } from "@coral-xyz/anchor";
2
+ import { GlamMint } from "../glamExports";
3
+ export type RequestQueue = IdlTypes<GlamMint>["requestQueue"];
4
+ export type PendingRequest = IdlTypes<GlamMint>["pendingRequest"];
5
+ export declare class PriceDenom {
6
+ static readonly SOL: {
7
+ sol: {};
8
+ };
9
+ static readonly USD: {
10
+ usd: {};
11
+ };
12
+ }
13
+ export declare class TimeUnit {
14
+ static readonly Slot: {
15
+ slot: {};
16
+ };
17
+ static readonly Second: {
18
+ second: {};
19
+ };
20
+ }
21
+ export declare class VoteAuthorize {
22
+ static readonly Voter: {
23
+ voter: {};
24
+ };
25
+ static readonly Withdrawer: {
26
+ withdrawer: {};
27
+ };
28
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Protocol bitmask values and priced protocol identifiers.
3
+ *
4
+ * Keep these separate from program-id constants so call sites are explicit
5
+ * about whether they are selecting an integration program or a protocol bit.
6
+ */
7
+ export declare const SYSTEM_PROTOCOL: number;
8
+ export declare const STAKE_PROTOCOL: number;
9
+ export declare const JUPITER_SWAP_PROTOCOL: number;
10
+ export declare const GLAM_MINT_PROTOCOL: number;
11
+ export declare const SPL_TOKEN_PROTOCOL: number;
12
+ export declare const CCTP_PROTOCOL: number;
13
+ export declare const PHOENIX_PROTOCOL: number;
14
+ export declare const KAMINO_LENDING_PROTOCOL: number;
15
+ export declare const KAMINO_VAULTS_PROTOCOL: number;
16
+ export declare const KAMINO_FARMS_PROTOCOL: number;
17
+ export declare const JUPITER_EARN_PROTOCOL: number;
18
+ export declare const JUPITER_BORROW_PROTOCOL: number;
19
+ export declare const ORCA_WHIRLPOOLS_PROTOCOL: number;
20
+ export declare const LOOPSCALE_BORROW_PROTOCOL: number;
21
+ export declare const LOOPSCALE_LENDING_PROTOCOL: number;
22
+ export declare const LOOPSCALE_VAULT_PROTOCOL: number;
23
+ export declare const LAYERZERO_OFT_PROTOCOL: number;
24
+ export declare const BRIDGE_MANAGED_TRANSFERS_PROTOCOL = 0;
25
+ export declare const EPI_PROTOCOL: number;
26
+ export declare const MARINADE_PROTOCOL: number;
27
+ export declare const STAKE_POOL_PROTOCOL: number;
28
+ export declare const SANCTUM_SINGLE_VALIDATOR_STAKE_POOL_PROTOCOL: number;
29
+ export declare const SANCTUM_MULTI_VALIDATOR_STAKE_POOL_PROTOCOL: number;
@@ -0,0 +1,71 @@
1
+ import { AccountInfo, Connection, PublicKey, AddressLookupTableAccount } from "@solana/web3.js";
2
+ import { type TokenAccount } from "../client/base";
3
+ import { Mint } from "@solana/spl-token";
4
+ export type StakeAccountInfo = {
5
+ address: PublicKey;
6
+ lamports: number;
7
+ state: string;
8
+ voter?: PublicKey;
9
+ };
10
+ export declare const getStakeDelegationState: (activationEpoch: string | number, deactivationEpoch: string | number, currentEpoch: string | number) => "active" | "inactive" | "activating" | "deactivating";
11
+ /**
12
+ * Fetches all the token accounts owned by the specified pubkey.
13
+ */
14
+ export declare function getTokenAccountsByOwner(connection: Connection, owner: PublicKey): Promise<TokenAccount[]>;
15
+ export declare function getSolAndTokenBalances(connection: Connection, owner: PublicKey): Promise<{
16
+ balanceLamports: number;
17
+ uiAmount: number;
18
+ tokenAccounts: TokenAccount[];
19
+ }>;
20
+ export declare const findStakeAccounts: (connection: Connection, withdrawAuthority: PublicKey) => Promise<PublicKey[]>;
21
+ export declare const getStakeAccountsWithStates: (connection: Connection, withdrawAuthority: PublicKey) => Promise<StakeAccountInfo[]>;
22
+ /**
23
+ * Parses mint account info to extract mint and token program
24
+ *
25
+ * @param accountInfo The account info buffer
26
+ * @param pubkey The mint public key
27
+ * @returns Mint object and token program ID
28
+ */
29
+ export declare function parseMintAccountInfo(accountInfo: AccountInfo<Buffer>, pubkey: PublicKey): {
30
+ mint: Mint;
31
+ tokenProgram: PublicKey;
32
+ };
33
+ /**
34
+ * Fetches mint accounts and token program IDs for the given mint pubkeys
35
+ *
36
+ * @param connection Solana connection
37
+ * @param mintPubkeys Array of mint public keys
38
+ * @returns Array of mint objects with their token program IDs
39
+ */
40
+ export declare function fetchMintsAndTokenPrograms(connection: Connection, mintPubkeys: PublicKey[]): Promise<{
41
+ mint: Mint;
42
+ tokenProgram: PublicKey;
43
+ }[]>;
44
+ /**
45
+ * Fetches mint account and token program ID for the given mint pubkey
46
+ *
47
+ * @param connection Solana connection
48
+ * @param mintPubkey Mint public key
49
+ * @returns Mint object and token program ID
50
+ */
51
+ export declare function fetchMintAndTokenProgram(connection: Connection, mintPubkey: PublicKey): Promise<{
52
+ mint: Mint;
53
+ tokenProgram: PublicKey;
54
+ }>;
55
+ /**
56
+ * Checks if Token ACL (sRFC-37) is enabled for the given mint by verifying
57
+ * the freeze authority is set to the Token ACL program.
58
+ */
59
+ export declare function isTokenAclEnabled(connection: Connection, mintPubkey: PublicKey): Promise<boolean>;
60
+ /**
61
+ * Finds all Address Lookup Tables (ALTs) associated with the current vault.
62
+ *
63
+ * Queries the ALT program directly using `getProgramAccounts` with filters.
64
+ *
65
+ * @returns Array of AddressLookupTableAccount objects for the vault
66
+ * @throws RPC errors from `getProgramAccounts`. Callers that only use the
67
+ * result to optimize transaction size may want to catch and fall back to an
68
+ * empty list; callers that rely on the result for correctness (e.g. ALT
69
+ * management commands) should let the error propagate.
70
+ */
71
+ export declare function findGlamLookupTables(statePda: PublicKey, vaultPda: PublicKey, connection: Connection): Promise<AddressLookupTableAccount[]>;
@@ -0,0 +1,53 @@
1
+ import { PublicKey } from "@solana/web3.js";
2
+ import { BN } from "@coral-xyz/anchor";
3
+ export declare function resolveStateAclsStaging(integrationAcls: Array<{
4
+ integrationProgram: PublicKey;
5
+ }> | null | undefined, fallback: boolean): boolean;
6
+ /**
7
+ * Formats a bitmask as a binary string.
8
+ *
9
+ * @param bitmask - The bitmask to format, either a number or a BN.
10
+ * @param padding - The number of bits to pad the bitmask with.
11
+ * @returns e.g. '0000000000001100' if bitmask is 12 and padding is 16.
12
+ */
13
+ export declare function formatBits(bitmask: number | BN, padding?: number): string;
14
+ /**
15
+ * Parses a bitmask into a binary string and a list of protocol names.
16
+ *
17
+ * @param integrationProgram - The integration program ID.
18
+ * @param protocolsBitmask - The bitmask to parse.
19
+ * @returns An object containing the bitmask string and a list of protocol names.
20
+ */
21
+ export declare function parseProtocolsBitmask(integrationProgram: PublicKey, protocolsBitmask: number | BN, staging: boolean): {
22
+ protocols: {
23
+ bitflag: number | BN;
24
+ name: string;
25
+ }[];
26
+ };
27
+ /**
28
+ * Parses a permissions bitmask for a specific protocol to get permission names.
29
+ *
30
+ * @param integrationProgram - The integration program ID.
31
+ * @param protocolBitflag - The protocol bitflag to identify which protocol.
32
+ * @param permissionsBitmask - The permissions bitmask to parse.
33
+ * @returns An object containing the bitmask string and a list of permission names.
34
+ */
35
+ export declare function parseProtocolPermissionsBitmask(integrationProgram: PublicKey, protocolBitflag: number | BN, permissionsBitmask: number | BN, staging: boolean): {
36
+ protocol: string;
37
+ permissions: {
38
+ bitflag: number | BN;
39
+ name: string;
40
+ }[];
41
+ };
42
+ /**
43
+ * Given the protocol name and a list of permission names, returns the permissions bitmask.
44
+ */
45
+ export declare function parsePermissionNames({ protocolName, permissionNames, staging, }: {
46
+ protocolName: string;
47
+ permissionNames: string[];
48
+ staging: boolean;
49
+ }): {
50
+ integrationProgram: PublicKey;
51
+ protocolBitflag: number;
52
+ permissionsBitmask: BN;
53
+ };
@@ -0,0 +1,11 @@
1
+ import * as anchor from "@coral-xyz/anchor";
2
+ import { BlockhashWithExpiryBlockHeight } from "@solana/web3.js";
3
+ export declare class BlockhashWithCache {
4
+ readonly provider: anchor.Provider;
5
+ readonly ttl: number;
6
+ private cachedBlockhash;
7
+ private fetchPromise;
8
+ constructor(provider: anchor.Provider, ttl?: number);
9
+ get(): Promise<BlockhashWithExpiryBlockHeight>;
10
+ clear(): void;
11
+ }
@@ -0,0 +1,73 @@
1
+ import { BN } from "@coral-xyz/anchor";
2
+ export declare const MAX_SAFE_INTEGER_BN: BN;
3
+ export declare const U8_MAX = 255;
4
+ export declare const U16_MAX = 65535;
5
+ export declare const U32_MAX = 4294967295;
6
+ export declare const U64_MAX_BIGINT: bigint;
7
+ export declare const U128_MAX_BIGINT: bigint;
8
+ export declare const U64_MAX_BN: BN;
9
+ export declare const U128_MAX_BN: BN;
10
+ /**
11
+ * Converts a buffer or array of character codes to a string
12
+ */
13
+ export declare function charsToString(chars: number[] | Buffer): string;
14
+ /**
15
+ * @deprecated Use `charsToString` instead.
16
+ */
17
+ export declare function charsToName(chars: number[] | Buffer): string;
18
+ /**
19
+ * Converts a string to an array of character codes
20
+ */
21
+ export declare function stringToChars(name: string, length?: number): number[];
22
+ /**
23
+ * @deprecated Use `stringToChars` instead.
24
+ */
25
+ export declare function nameToChars(name: string, length?: number): number[];
26
+ /**
27
+ * Returns the first 8 raw SHA-256 bytes for PDA seed derivation.
28
+ */
29
+ export declare function sha256First8Bytes(chars: number[]): Promise<number[]>;
30
+ /**
31
+ * Values accepted by helpers that normalize integer/base-unit values into BN.
32
+ */
33
+ export type BnInput = BN | bigint | number | string;
34
+ /**
35
+ * Normalizes an integer/base-unit value into a BN while preserving existing BN values.
36
+ */
37
+ export declare function toBn(value: BnInput): BN;
38
+ /**
39
+ * Backward-compatible alias for amount-oriented call sites.
40
+ *
41
+ * @deprecated Use `toBn` instead.
42
+ */
43
+ export declare function toBnAmount(amount: BnInput): BN;
44
+ /**
45
+ * Converts a BN to a JavaScript number when it is known to fit safely.
46
+ */
47
+ export declare function bnToSafeNumber(value: BN, label?: string): number;
48
+ /**
49
+ * Safely converts a BN amount to a UI amount (with decimals).
50
+ *
51
+ * @param amount - The amount in base units (BN)
52
+ * @param decimals - The number of decimals (e.g., 9)
53
+ * @returns The UI amount as a number
54
+ *
55
+ * @example
56
+ * // Convert 10010000000 base units with 9 decimals
57
+ * const uiAmount = toUiAmount(new BN(10010000000), 9); // Returns 10.01
58
+ *
59
+ * @throws Error if the BN amount is too large to safely convert to number
60
+ */
61
+ export declare function toUiAmount(amount: BN, decimals: number): number;
62
+ /**
63
+ * Safely converts a UI amount (with decimals) to a BN amount.
64
+ *
65
+ * @param amount - The UI amount (e.g., 10.01)
66
+ * @param decimals - The number of decimals (e.g., 9)
67
+ * @returns BN representing the amount in base units
68
+ *
69
+ * @example
70
+ * // Convert 10.01 with 9 decimals
71
+ * const amount = fromUiAmount(10.01, 9); // Returns BN(10010000000)
72
+ */
73
+ export declare function fromUiAmount(amount: number | string, decimals: number): BN;
@@ -0,0 +1,15 @@
1
+ import { TransactionInstruction, VersionedTransaction } from "@solana/web3.js";
2
+ export type ComputeBudgetOptions = {
3
+ vTx?: VersionedTransaction;
4
+ getPriorityFeeMicroLamports?: (tx: VersionedTransaction) => Promise<number>;
5
+ maxFeeLamports?: number;
6
+ useMaxFee?: boolean;
7
+ };
8
+ /**
9
+ * Builds compute budget instructions for a transaction
10
+ *
11
+ * @param computeUnitLimit The compute unit limit
12
+ * @param options Compute budget options
13
+ * @returns Array of compute budget instructions
14
+ */
15
+ export declare function buildComputeBudgetInstructions(computeUnitLimit: number, options?: ComputeBudgetOptions): Promise<Array<TransactionInstruction>>;
@@ -0,0 +1,10 @@
1
+ import { PublicKey } from "@solana/web3.js";
2
+ export declare const evmAddressToBytes32: (address: string) => string;
3
+ export declare const hexToBytes: (hex: string) => number[];
4
+ export declare const evmAddressToPublicKey: (address: string) => PublicKey;
5
+ export declare const bytesToHex: (bytes: number[] | Uint8Array) => string;
6
+ export declare const publicKeyToEvmAddress: (publicKey: PublicKey) => string;
7
+ /**
8
+ * Validates if a string is a valid EVM address (40 hex characters)
9
+ */
10
+ export declare const isValidEvmAddress: (addr: string) => boolean;
@@ -0,0 +1,29 @@
1
+ import { BN } from "@coral-xyz/anchor";
2
+ import Decimal from "decimal.js";
3
+ export interface BigFractionBytes {
4
+ value: BN[];
5
+ padding: BN[];
6
+ }
7
+ /**
8
+ * Replicates the Fraction class from the klend-sdk:
9
+ * https://github.com/Kamino-Finance/klend-sdk/blob/2fbc31a5b165aca3e2ca2e3d0e6162848743192d/src/classes/fraction.ts#L26
10
+ */
11
+ export declare class Fraction {
12
+ static MAX_SIZE_F: number;
13
+ static MAX_SIZE_BF: number;
14
+ static FRACTIONS: number;
15
+ static MULTIPLIER: Decimal;
16
+ static MAX_F_BN: BN;
17
+ static MAX_BF_BN: BN;
18
+ static MIN_BN: BN;
19
+ valueSf: BN;
20
+ constructor(valueSf: BN);
21
+ toDecimal(): Decimal;
22
+ getValue(): BN;
23
+ gt(x: Fraction): boolean;
24
+ lt(x: Fraction): boolean;
25
+ gte(x: Fraction): boolean;
26
+ lte(x: Fraction): boolean;
27
+ eq(x: Fraction): boolean;
28
+ }
29
+ export declare function bfToDecimal(x: BigFractionBytes): Decimal;
@@ -0,0 +1,15 @@
1
+ import { PublicKey } from "@solana/web3.js";
2
+ export declare function getStatePda(initKey: Uint8Array | number[], owner: PublicKey, programId: PublicKey): PublicKey;
3
+ export declare function getVaultPda(statePda: PublicKey, programId: PublicKey): PublicKey;
4
+ export declare function getMintPda(statePda: PublicKey, mintIdx: number, programId: PublicKey): PublicKey;
5
+ export declare function getEscrowPda(mintPda: PublicKey, programId: PublicKey): PublicKey;
6
+ export declare function getRequestQueuePda(glamMint: PublicKey, programId: PublicKey): PublicKey;
7
+ export declare function getExtraMetasPda(mint: PublicKey): PublicKey;
8
+ export declare function getAccountPolicyPda(tokenAccount: PublicKey): PublicKey;
9
+ export declare function getTokenAclMintConfigPda(mint: PublicKey): PublicKey;
10
+ export declare function getTokenAclFlagAccountPda(tokenAccount: PublicKey): PublicKey;
11
+ export declare function getTokenAclGateListConfigPda(authority: PublicKey, seed: Buffer): PublicKey;
12
+ export declare function getTokenAclGateWalletEntryPda(listConfig: PublicKey, wallet: PublicKey): PublicKey;
13
+ export declare function getTokenAclGateExtraMetasPda(mint: PublicKey): PublicKey;
14
+ export declare function getGlobalConfigPda(): PublicKey;
15
+ export declare function getIntegrationAuthorityPda(integrationProgram: PublicKey): PublicKey;
@@ -0,0 +1,66 @@
1
+ import { AccountInfo, Finality, GetProgramAccountsConfig, PublicKey, SignaturesForAddressOptions, VersionedTransaction, VersionedTransactionResponse } from "@solana/web3.js";
2
+ export declare function isHeliusRpc(rpcUrl: string): boolean;
3
+ export declare function getHeliusApiKey(): string | undefined;
4
+ export declare function getHeliusRpcUrl(apiKey?: string): string;
5
+ export type HeliusFetchOptions = {
6
+ rpcUrl?: string;
7
+ apiKey?: string;
8
+ };
9
+ export declare function heliusFetch<T = any>(method: string, params: unknown, options?: HeliusFetchOptions): Promise<T>;
10
+ export type HeliusAsset = {
11
+ id: string;
12
+ content?: {
13
+ metadata?: {
14
+ name?: string;
15
+ symbol?: string;
16
+ };
17
+ links?: {
18
+ image?: string;
19
+ };
20
+ };
21
+ token_info?: {
22
+ symbol?: string;
23
+ decimals?: number;
24
+ };
25
+ };
26
+ export declare function getAsset(mint: string, options?: HeliusFetchOptions): Promise<HeliusAsset | null>;
27
+ export type HeliusTokenAccount = {
28
+ address: string;
29
+ owner: string;
30
+ mint: string;
31
+ amount: string | number;
32
+ delegated_amount?: string | number;
33
+ frozen?: boolean;
34
+ };
35
+ export type GetTokenAccountsByMintOptions = HeliusFetchOptions & {
36
+ showZeroBalance?: boolean;
37
+ limit?: number;
38
+ };
39
+ export type HeliusTokenAccountsByMintResult = {
40
+ token_accounts: HeliusTokenAccount[];
41
+ total?: number;
42
+ };
43
+ export declare function getTokenAccountsByMintResult(mint: PublicKey | string, options?: GetTokenAccountsByMintOptions): Promise<HeliusTokenAccountsByMintResult>;
44
+ export declare function getTokenAccountsByMint(mint: PublicKey | string, options?: GetTokenAccountsByMintOptions): Promise<HeliusTokenAccount[]>;
45
+ export type PriorityLevel = "Recommended" | "Min" | "Low" | "Medium" | "High" | "VeryHigh" | "UnsafeMax" | "Default";
46
+ export type GetPriorityFeeEstimateOptions = {
47
+ heliusApiKey?: string;
48
+ tx?: VersionedTransaction;
49
+ accountKeys?: string[];
50
+ priorityLevel?: PriorityLevel;
51
+ };
52
+ export declare function getPriorityFeeEstimate(options: GetPriorityFeeEstimateOptions): Promise<number>;
53
+ export interface GetTransactionsOptions {
54
+ commitment?: Finality;
55
+ sinceSlot?: number;
56
+ transactionDetails?: "full" | "signatures";
57
+ }
58
+ export declare function heliusGetTransactionsForAddress(rpcUrl: string, address: PublicKey, options?: SignaturesForAddressOptions & GetTransactionsOptions): Promise<(VersionedTransactionResponse | null)[]>;
59
+ export type HeliusGetProgramAccountsV2Config = {
60
+ limit?: number;
61
+ changedSinceSlot?: number;
62
+ };
63
+ export declare function heliusGetProgramAccountsV2(rpcUrl: string, programId: PublicKey, config: GetProgramAccountsConfig & HeliusGetProgramAccountsV2Config): Promise<{
64
+ pubkey: PublicKey;
65
+ account: AccountInfo<Buffer>;
66
+ }[]>;