@glamsystems/glam-sdk 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,164 @@
1
+ import { IdlTypes, IdlAccounts } from "@coral-xyz/anchor";
2
+ import { Glam } from "./glamExports";
3
+ import { PublicKey } from "@solana/web3.js";
4
+ import { Mint } from "@solana/spl-token";
5
+ export declare const GlamIntegrations: any[];
6
+ export declare const GlamPermissions: any[];
7
+ export declare const VaultIntegrations: any[];
8
+ export type StateAccount = IdlAccounts<Glam>["fundAccount"];
9
+ export type MetadataAccount = IdlAccounts<Glam>["fundMetadataAccount"];
10
+ export type StateModelType = IdlTypes<Glam>["stateModel"];
11
+ export declare class StateIdlModel implements StateModelType {
12
+ id: PublicKey | null;
13
+ name: string | null;
14
+ uri: string | null;
15
+ metadataUri: string | null;
16
+ isEnabled: boolean | null;
17
+ assets: PublicKey[];
18
+ externalVaultAccounts: PublicKey[];
19
+ mints: ShareClassModel[];
20
+ company: CompanyModel | null;
21
+ owner: ManagerModel | null;
22
+ created: CreatedModel | null;
23
+ delegateAcls: DelegateAcl[];
24
+ integrationAcls: IntegrationAcl[];
25
+ driftMarketIndexesPerp: number[];
26
+ driftMarketIndexesSpot: number[];
27
+ driftOrderTypes: number[];
28
+ isRawOpenfunds: boolean;
29
+ rawOpenfunds: FundOpenfundsModel | null;
30
+ constructor(data: Partial<StateModelType>);
31
+ }
32
+ export declare class StateModel extends StateIdlModel {
33
+ readonly glamProgramId: PublicKey;
34
+ constructor(data: Partial<StateIdlModel>, glamProgramId?: PublicKey);
35
+ get idStr(): string;
36
+ get vaultPda(): PublicKey;
37
+ get openfundsPda(): PublicKey;
38
+ get productType(): "Mint" | "Vault" | "Fund";
39
+ get shareClassMints(): PublicKey[];
40
+ get sparkleKey(): string;
41
+ /**
42
+ * Build a StateModel from onchain accounts
43
+ *
44
+ * @param stateAccount provides core fund data
45
+ * @param openfundsAccount includes fund rawOpenfunds data and share class rawOpenfunds data
46
+ * @param shareClassMint provides share class data
47
+ */
48
+ static fromOnchainAccounts(statePda: PublicKey, stateAccount: StateAccount, openfundsAccount?: MetadataAccount, shareClassMint?: Mint, glamProgramId?: PublicKey): StateModel;
49
+ }
50
+ export type FundOpenfundsModelType = IdlTypes<Glam>["fundOpenfundsModel"];
51
+ export declare class FundOpenfundsModel implements FundOpenfundsModelType {
52
+ fundDomicileAlpha2: string | null;
53
+ legalFundNameIncludingUmbrella: string | null;
54
+ fiscalYearEnd: string | null;
55
+ fundCurrency: string | null;
56
+ fundLaunchDate: string | null;
57
+ investmentObjective: string | null;
58
+ isEtc: boolean | null;
59
+ isEuDirectiveRelevant: boolean | null;
60
+ isFundOfFunds: boolean | null;
61
+ isPassiveFund: boolean | null;
62
+ isReit: boolean | null;
63
+ legalForm: string | null;
64
+ legalFundNameOnly: string | null;
65
+ openEndedOrClosedEndedFundStructure: string | null;
66
+ typeOfEuDirective: string | null;
67
+ ucitsVersion: string | null;
68
+ constructor(data: Partial<FundOpenfundsModelType>);
69
+ }
70
+ export type ShareClassModelType = IdlTypes<Glam>["shareClassModel"];
71
+ export declare class ShareClassIdlModel implements ShareClassModelType {
72
+ symbol: string | null;
73
+ name: string | null;
74
+ uri: string | null;
75
+ fundId: PublicKey | null;
76
+ asset: PublicKey | null;
77
+ imageUri: string | null;
78
+ isRawOpenfunds: boolean;
79
+ rawOpenfunds: ShareClassOpenfundsModel | null;
80
+ allowlist: PublicKey[];
81
+ blocklist: PublicKey[];
82
+ lockUpPeriodInSeconds: number;
83
+ permanentDelegate: PublicKey | null;
84
+ defaultAccountStateFrozen: boolean;
85
+ constructor(data: Partial<ShareClassModelType>);
86
+ }
87
+ export declare class ShareClassModel extends ShareClassIdlModel {
88
+ constructor(data: Partial<ShareClassIdlModel>);
89
+ static mintAddress(statePda: PublicKey, idx?: number, glamProgramId?: PublicKey): PublicKey;
90
+ }
91
+ export type ShareClassOpenfundsModelType = IdlTypes<Glam>["shareClassOpenfundsModel"];
92
+ export declare class ShareClassOpenfundsModel implements ShareClassOpenfundsModelType {
93
+ isin: string | null;
94
+ shareClassCurrency: string | null;
95
+ currencyOfMinimalSubscription: string | null;
96
+ fullShareClassName: string | null;
97
+ investmentStatus: string | null;
98
+ minimalInitialSubscriptionCategory: string | null;
99
+ minimalInitialSubscriptionInAmount: string | null;
100
+ minimalInitialSubscriptionInShares: string | null;
101
+ shareClassDistributionPolicy: string | null;
102
+ shareClassExtension: string | null;
103
+ shareClassLaunchDate: string | null;
104
+ shareClassLifecycle: string | null;
105
+ launchPrice: string | null;
106
+ launchPriceCurrency: string | null;
107
+ launchPriceDate: string | null;
108
+ currencyOfMinimalOrMaximumRedemption: string | null;
109
+ hasLockUpForRedemption: boolean | null;
110
+ isValidIsin: boolean | null;
111
+ lockUpComment: string | null;
112
+ lockUpPeriodInDays: string | null;
113
+ maximumInitialRedemptionInAmount: string | null;
114
+ maximumInitialRedemptionInShares: string | null;
115
+ minimalInitialRedemptionInAmount: string | null;
116
+ minimalInitialRedemptionInShares: string | null;
117
+ minimalRedemptionCategory: string | null;
118
+ shareClassDividendType: string | null;
119
+ cusip: string | null;
120
+ valor: string | null;
121
+ constructor(obj: Partial<ShareClassOpenfundsModelType>);
122
+ }
123
+ export type CompanyModelType = IdlTypes<Glam>["companyModel"];
124
+ export declare class CompanyModel implements CompanyModelType {
125
+ fundGroupName: string | null;
126
+ manCo: string | null;
127
+ domicileOfManCo: string | null;
128
+ emailAddressOfManCo: string | null;
129
+ fundWebsiteOfManCo: string | null;
130
+ constructor(data: Partial<CompanyModelType>);
131
+ }
132
+ export type ManagerModelType = IdlTypes<Glam>["managerModel"];
133
+ export declare class ManagerModel implements ManagerModelType {
134
+ portfolioManagerName: string | null;
135
+ pubkey: PublicKey | null;
136
+ kind: {
137
+ wallet: {};
138
+ } | {
139
+ squads: {};
140
+ } | null;
141
+ constructor(data: Partial<ManagerModelType>);
142
+ }
143
+ export type CreatedModelType = IdlTypes<Glam>["createdModel"];
144
+ export declare class CreatedModel implements CreatedModelType {
145
+ key: number[];
146
+ owner: PublicKey | null;
147
+ constructor(obj: Partial<CreatedModelType>);
148
+ }
149
+ export type Permission = IdlTypes<Glam>["permission"];
150
+ export type DelegateAclType = IdlTypes<Glam>["delegateAcl"];
151
+ export declare class DelegateAcl implements DelegateAclType {
152
+ pubkey: PublicKey;
153
+ permissions: Permission[];
154
+ constructor(obj: Partial<DelegateAclType>);
155
+ }
156
+ export type IntegrationName = IdlTypes<Glam>["integrationName"];
157
+ export type IntegrationAclType = IdlTypes<Glam>["integrationAcl"];
158
+ export declare class IntegrationAcl implements IntegrationAclType {
159
+ name: IntegrationName;
160
+ features: {
161
+ all: {};
162
+ }[];
163
+ constructor(obj: Partial<IntegrationAclType>);
164
+ }
@@ -0,0 +1,21 @@
1
+ import { ReactNode } from "react";
2
+ import { ClusterNetwork } from "../clientConfig";
3
+ interface Cluster {
4
+ name: string;
5
+ endpoint: string;
6
+ network?: ClusterNetwork;
7
+ active?: boolean;
8
+ }
9
+ interface ClusterProviderContext {
10
+ cluster: Cluster;
11
+ clusters: Cluster[];
12
+ addCluster: (cluster: Cluster) => void;
13
+ deleteCluster: (cluster: Cluster) => void;
14
+ setCluster: (cluster: Cluster) => void;
15
+ getExplorerUrl(path: string): string;
16
+ }
17
+ export declare function ClusterProvider({ children }: {
18
+ children: ReactNode;
19
+ }): import("react/jsx-runtime").JSX.Element;
20
+ export declare function useCluster(): ClusterProviderContext;
21
+ export {};
@@ -0,0 +1,62 @@
1
+ import type { DelegateAcl, StateModel } from "../models";
2
+ import { GlamClient } from "../client";
3
+ import { PublicKey } from "@solana/web3.js";
4
+ import { DriftMarketConfigs, GlamDriftUser } from "../client/drift";
5
+ import { TokenAccount } from "../client/base";
6
+ declare global {
7
+ interface Window {
8
+ glamClient: GlamClient;
9
+ }
10
+ }
11
+ export interface JupTokenListItem {
12
+ address: string;
13
+ name: string;
14
+ symbol: string;
15
+ decimals: number;
16
+ logoURI: string;
17
+ tags: string[];
18
+ }
19
+ interface TokenPrice {
20
+ mint: string;
21
+ price: number;
22
+ }
23
+ interface GlamProviderContext {
24
+ glamClient: GlamClient;
25
+ vault: Vault;
26
+ activeGlamState?: GlamStateCache;
27
+ glamStatesList: GlamStateCache[];
28
+ delegateAcls: DelegateAcl[];
29
+ allGlamStates: StateModel[];
30
+ userWallet: UserWallet;
31
+ prices: TokenPrice[];
32
+ jupTokenList?: JupTokenListItem[];
33
+ driftMarketConfigs: DriftMarketConfigs;
34
+ driftUser: GlamDriftUser;
35
+ setActiveGlamState: (f: GlamStateCache) => void;
36
+ refresh: () => Promise<void>;
37
+ }
38
+ interface UserWallet {
39
+ queryKey: string[];
40
+ pubkey?: PublicKey;
41
+ balanceLamports: number;
42
+ uiAmount: number;
43
+ tokenAccounts: TokenAccount[];
44
+ }
45
+ interface Vault {
46
+ pubkey: PublicKey;
47
+ balanceLamports: number;
48
+ uiAmount: number;
49
+ tokenAccounts: TokenAccount[];
50
+ }
51
+ interface GlamStateCache {
52
+ address: string;
53
+ pubkey: PublicKey;
54
+ sparkleKey: string;
55
+ name: string;
56
+ product: "Mint" | "Vault" | "Fund";
57
+ }
58
+ export declare function GlamProvider({ children, }: Readonly<{
59
+ children: React.ReactNode;
60
+ }>): import("react/jsx-runtime").JSX.Element;
61
+ export declare const useGlam: () => GlamProviderContext;
62
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from "../index";
2
+ export * from "./glam";
3
+ export * from "./cluster-provider";
@@ -0,0 +1,21 @@
1
+ import * as anchor from "@coral-xyz/anchor";
2
+ import { BlockhashWithExpiryBlockHeight } from "@solana/web3.js";
3
+ type CachedBlockhash = {
4
+ blockhash: BlockhashWithExpiryBlockHeight;
5
+ expiresAt: number;
6
+ };
7
+ export declare class BlockhashWithCache {
8
+ provider: anchor.Provider;
9
+ isBrowser: boolean;
10
+ nodeCache: Map<string, any>;
11
+ cacheKey: string;
12
+ ttl: number;
13
+ constructor(provider: anchor.Provider, isBrowser: boolean, ttl?: number);
14
+ get(): Promise<BlockhashWithExpiryBlockHeight>;
15
+ set(data: CachedBlockhash): Promise<void>;
16
+ _getFromBrowserCache(): Promise<CachedBlockhash | undefined>;
17
+ _getFromNodeCache(): CachedBlockhash | undefined;
18
+ _setBrowserCache(data: CachedBlockhash): Promise<void>;
19
+ _setNodeCache(data: CachedBlockhash): void;
20
+ }
21
+ export {};
@@ -0,0 +1,2 @@
1
+ import { Connection, PublicKey, TransactionInstruction, AddressLookupTableAccount } from "@solana/web3.js";
2
+ export declare const getSimulationComputeUnits: (connection: Connection, instructions: Array<TransactionInstruction>, payer: PublicKey, lookupTables: Array<AddressLookupTableAccount> | []) => Promise<number | undefined>;
@@ -0,0 +1,3 @@
1
+ import { VersionedTransaction } from "@solana/web3.js";
2
+ export type PriorityLevel = "Min" | "Low" | "Medium" | "High" | "VeryHigh" | "UnsafeMax" | "Default";
3
+ export declare const getPriorityFeeEstimate: (heliusApiKey: string, tx?: VersionedTransaction, accountKeys?: string[], priorityLevel?: PriorityLevel) => Promise<any>;