@glamsystems/glam-sdk 1.1.0-alpha.0 → 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.
- package/index.cjs.js +4898 -1183
- package/index.esm.js +4890 -1172
- package/package.json +2 -2
- package/target/idl/glam_mint-staging.json +236 -0
- package/target/idl/glam_protocol-staging.json +5 -0
- package/target/idl/glam_protocol.json +5 -0
- package/target/types/glam_mint-staging.ts +236 -0
- package/target/types/glam_protocol-staging.ts +5 -0
- package/target/types/glam_protocol.ts +5 -0
- package/src/assets.d.ts +0 -39
- package/src/client/access.d.ts +0 -57
- package/src/client/base.d.ts +0 -184
- package/src/client/bridge.d.ts +0 -183
- package/src/client/bridgeRegistry.d.ts +0 -32
- package/src/client/cctp.d.ts +0 -156
- package/src/client/epi.d.ts +0 -78
- package/src/client/fees.d.ts +0 -33
- package/src/client/invest.d.ts +0 -37
- package/src/client/jupiter.d.ts +0 -45
- package/src/client/kamino/farm.d.ts +0 -39
- package/src/client/kamino/index.d.ts +0 -4
- package/src/client/kamino/lending.d.ts +0 -86
- package/src/client/kamino/types.d.ts +0 -56
- package/src/client/kamino/vaults.d.ts +0 -31
- package/src/client/loopscale.d.ts +0 -84
- package/src/client/marinade.d.ts +0 -42
- package/src/client/mint.d.ts +0 -127
- package/src/client/neutral.d.ts +0 -111
- package/src/client/price.d.ts +0 -137
- package/src/client/stake-pool.d.ts +0 -39
- package/src/client/stake.d.ts +0 -34
- package/src/client/state.d.ts +0 -56
- package/src/client/timelock.d.ts +0 -31
- package/src/client/vault.d.ts +0 -90
- package/src/client.d.ts +0 -68
- package/src/clientConfig.d.ts +0 -29
- package/src/constants.d.ts +0 -84
- package/src/deser/base.d.ts +0 -18
- package/src/deser/index.d.ts +0 -3
- package/src/deser/integrationPolicies.d.ts +0 -120
- package/src/deser/kaminoLayouts.d.ts +0 -264
- package/src/deser/tokenAclLayouts.d.ts +0 -67
- package/src/error.d.ts +0 -29
- package/src/glamExports.d.ts +0 -5116
- package/src/globalConfig.d.ts +0 -27
- package/src/index.d.ts +0 -20
- package/src/models/acl.d.ts +0 -43
- package/src/models/index.d.ts +0 -8
- package/src/models/mint.d.ts +0 -64
- package/src/models/state.d.ts +0 -104
- package/src/models/types.d.ts +0 -28
- package/src/react/cluster-provider.d.ts +0 -22
- package/src/react/glam.d.ts +0 -47
- package/src/react/index.d.ts +0 -5
- package/src/react/query-keys.d.ts +0 -38
- package/src/react/useVaultBalanceSubscription.d.ts +0 -17
- package/src/utils/accounts.d.ts +0 -72
- package/src/utils/bitmask.d.ts +0 -53
- package/src/utils/blockhash.d.ts +0 -11
- package/src/utils/common.d.ts +0 -37
- package/src/utils/computeBudget.d.ts +0 -15
- package/src/utils/evm.d.ts +0 -10
- package/src/utils/fraction.d.ts +0 -29
- package/src/utils/glamPDAs.d.ts +0 -15
- package/src/utils/index.d.ts +0 -16
- package/src/utils/jupiterApi.d.ts +0 -89
- package/src/utils/lookupTables.d.ts +0 -53
- package/src/utils/pkmap.d.ts +0 -87
- package/src/utils/pkset.d.ts +0 -73
- package/src/utils/positionCategorizer.d.ts +0 -36
- package/src/utils/rpc.d.ts +0 -33
- package/src/utils/timelock.d.ts +0 -52
- package/src/utils/transaction.d.ts +0 -13
- package/target/types/ext_bridge.d.ts +0 -2385
- package/target/types/ext_cctp.d.ts +0 -1268
- package/target/types/ext_epi.d.ts +0 -2175
- package/target/types/ext_kamino.d.ts +0 -3433
- package/target/types/ext_loopscale.d.ts +0 -3547
- package/target/types/ext_marinade.d.ts +0 -1593
- package/target/types/ext_neutral.d.ts +0 -1786
- package/target/types/ext_spl.d.ts +0 -1274
- package/target/types/ext_stake_pool.d.ts +0 -1622
- package/target/types/glam_config.d.ts +0 -755
- package/target/types/glam_mint.d.ts +0 -6106
- package/target/types/glam_protocol.d.ts +0 -2708
package/src/globalConfig.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
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/neutral";
|
|
12
|
-
export * from "./client/price";
|
|
13
|
-
export * from "./deser/integrationPolicies";
|
|
14
|
-
export * from "./deser/tokenAclLayouts";
|
|
15
|
-
export * from "./client/base";
|
|
16
|
-
export * from "./assets";
|
|
17
|
-
export * from "./globalConfig";
|
|
18
|
-
export * from "./constants";
|
|
19
|
-
export * from "./error";
|
|
20
|
-
export * from "./utils";
|
package/src/models/acl.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
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
|
-
}
|
package/src/models/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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";
|
package/src/models/mint.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
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<GlamProtocol>["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 declare class EmergencyUpdateMintArgs implements EmergencyUpdateMintArgsType {
|
|
42
|
-
requestType: RequestType;
|
|
43
|
-
setPaused: boolean;
|
|
44
|
-
}
|
|
45
|
-
export declare class RequestType {
|
|
46
|
-
static readonly SUBSCRIPTION: {
|
|
47
|
-
subscription: {};
|
|
48
|
-
};
|
|
49
|
-
static readonly REDEMPTION: {
|
|
50
|
-
redemption: {};
|
|
51
|
-
};
|
|
52
|
-
static equals(a: RequestType, b: RequestType): boolean;
|
|
53
|
-
static fromInt(int: number): {
|
|
54
|
-
subscription: {};
|
|
55
|
-
} | {
|
|
56
|
-
redemption: {};
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
export type OracleConfigsType = IdlTypes<GlamProtocol>["oracleConfigs"];
|
|
60
|
-
export declare class OracleConfigs implements OracleConfigsType {
|
|
61
|
-
readonly maxAgesSeconds: number[][];
|
|
62
|
-
padding: number[];
|
|
63
|
-
constructor(maxAgesSeconds: number[][]);
|
|
64
|
-
}
|
package/src/models/state.d.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
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 OracleConfigsType = IdlTypes<GlamProtocol>["oracleConfigs"];
|
|
12
|
-
/**
|
|
13
|
-
* State model class as defined in the IDL.
|
|
14
|
-
*/
|
|
15
|
-
export declare class StateIdlModel implements StateModelType {
|
|
16
|
-
accountType: StateAccountType | null;
|
|
17
|
-
name: number[] | null;
|
|
18
|
-
uri: string | null;
|
|
19
|
-
enabled: boolean | null;
|
|
20
|
-
oracleConfigs: OracleConfigsType | null;
|
|
21
|
-
assets: PublicKey[] | null;
|
|
22
|
-
created: CreatedModel | null;
|
|
23
|
-
owner: PublicKey | null;
|
|
24
|
-
portfolioManagerName: number[] | null;
|
|
25
|
-
borrowable: PublicKey[] | null;
|
|
26
|
-
timelockDuration: number | null;
|
|
27
|
-
integrationAcls: IntegrationAcl[] | null;
|
|
28
|
-
delegateAcls: DelegateAcl[] | null;
|
|
29
|
-
constructor(data: Partial<StateModelType>);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Enriched state model built from multiple onchain accounts
|
|
33
|
-
*/
|
|
34
|
-
export declare class StateModel extends StateIdlModel {
|
|
35
|
-
accountType: StateAccountType;
|
|
36
|
-
name: number[];
|
|
37
|
-
enabled: boolean;
|
|
38
|
-
assets: PublicKey[];
|
|
39
|
-
created: CreatedModel;
|
|
40
|
-
owner: PublicKey;
|
|
41
|
-
portfolioManagerName: number[];
|
|
42
|
-
timelockDuration: number;
|
|
43
|
-
integrationAcls: IntegrationAcl[];
|
|
44
|
-
delegateAcls: DelegateAcl[];
|
|
45
|
-
id: PublicKey;
|
|
46
|
-
vault: PublicKey;
|
|
47
|
-
mint: PublicKey | null;
|
|
48
|
-
mintModel: MintModel | null;
|
|
49
|
-
baseAssetMint: PublicKey;
|
|
50
|
-
baseAssetTokenProgram: number;
|
|
51
|
-
baseAssetDecimals: number;
|
|
52
|
-
pendingStateUpdates: any | null;
|
|
53
|
-
pendingMintUpdates: any | null;
|
|
54
|
-
timelockExpiresAt: number | null;
|
|
55
|
-
externalPositions: PublicKey[];
|
|
56
|
-
pricedProtocols: any[];
|
|
57
|
-
constructor(data: Partial<StateModel>);
|
|
58
|
-
get idStr(): string;
|
|
59
|
-
get nameStr(): string;
|
|
60
|
-
get productType(): string;
|
|
61
|
-
get launchDate(): string;
|
|
62
|
-
get sparkleKey(): string;
|
|
63
|
-
get baseAssetTokenProgramId(): PublicKey;
|
|
64
|
-
get assetsForPricing(): PublicKey[];
|
|
65
|
-
/**
|
|
66
|
-
* Build a StateModel from onchain data
|
|
67
|
-
*
|
|
68
|
-
* @param stateAccount provides core fund data
|
|
69
|
-
* @param openfundsMetadataAccount includes fund rawOpenfunds data and share class rawOpenfunds data
|
|
70
|
-
* @param glamMint
|
|
71
|
-
*/
|
|
72
|
-
static fromOnchainAccounts(statePda: PublicKey, stateAccount: StateAccount, staging: boolean, glamMint?: Mint, requestQueue?: RequestQueue): StateModel;
|
|
73
|
-
}
|
|
74
|
-
export type CreatedModelType = IdlTypes<GlamProtocol>["createdModel"];
|
|
75
|
-
export declare class CreatedModel implements CreatedModelType {
|
|
76
|
-
key: number[];
|
|
77
|
-
createdBy: PublicKey;
|
|
78
|
-
createdAt: BN;
|
|
79
|
-
constructor(obj: Partial<CreatedModelType>);
|
|
80
|
-
}
|
|
81
|
-
export declare class StateAccountType {
|
|
82
|
-
static readonly VAULT: {
|
|
83
|
-
vault: {};
|
|
84
|
-
};
|
|
85
|
-
static readonly TOKENIZED_VAULT: {
|
|
86
|
-
tokenizedVault: {};
|
|
87
|
-
};
|
|
88
|
-
static readonly MINT: {
|
|
89
|
-
mint: {};
|
|
90
|
-
};
|
|
91
|
-
static readonly SINGLE_ASSET_VAULT: {
|
|
92
|
-
singleAssetVault: {};
|
|
93
|
-
};
|
|
94
|
-
static equals(a: StateAccountType, b: StateAccountType): boolean;
|
|
95
|
-
static from(s: string): {
|
|
96
|
-
vault: {};
|
|
97
|
-
} | {
|
|
98
|
-
tokenizedVault: {};
|
|
99
|
-
} | {
|
|
100
|
-
mint: {};
|
|
101
|
-
} | {
|
|
102
|
-
singleAssetVault: {};
|
|
103
|
-
};
|
|
104
|
-
}
|
package/src/models/types.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import { ClusterNetwork } from "../clientConfig";
|
|
3
|
-
export 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 declare function getClusterUrlParam(cluster: Cluster): string;
|
|
22
|
-
export {};
|
package/src/react/glam.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { DelegateAcl, StateModel, IntegrationAcl } from "../models";
|
|
2
|
-
import { GlamClient } from "../client";
|
|
3
|
-
import { PublicKey } from "@solana/web3.js";
|
|
4
|
-
import { TokenAccount } from "../client/base";
|
|
5
|
-
import { JupTokenList } from "../utils/jupiterApi";
|
|
6
|
-
import { VaultHoldings } from "../client/price";
|
|
7
|
-
declare global {
|
|
8
|
-
interface Window {
|
|
9
|
-
glam: GlamClient;
|
|
10
|
-
PublicKey: any;
|
|
11
|
-
BN: any;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
interface GlamProviderContext {
|
|
15
|
-
glamClient: GlamClient;
|
|
16
|
-
vault: Vault;
|
|
17
|
-
vaultHoldings?: VaultHoldings;
|
|
18
|
-
activeGlamState?: GlamStateCache;
|
|
19
|
-
glamStatesList: GlamStateCache[];
|
|
20
|
-
delegateAcls: DelegateAcl[];
|
|
21
|
-
integrationAcls: IntegrationAcl[];
|
|
22
|
-
allGlamStates: StateModel[];
|
|
23
|
-
jupTokenList?: JupTokenList;
|
|
24
|
-
wsConnected: boolean;
|
|
25
|
-
setActiveGlamState: (f: GlamStateCache) => void;
|
|
26
|
-
refresh: () => Promise<void>;
|
|
27
|
-
refetchGlamStates: () => Promise<void>;
|
|
28
|
-
}
|
|
29
|
-
export interface Vault {
|
|
30
|
-
pubkey: PublicKey;
|
|
31
|
-
balanceLamports: number;
|
|
32
|
-
uiAmount: number;
|
|
33
|
-
tokenAccounts: TokenAccount[];
|
|
34
|
-
}
|
|
35
|
-
interface GlamStateCache {
|
|
36
|
-
address: string;
|
|
37
|
-
pubkey: PublicKey;
|
|
38
|
-
owner: PublicKey;
|
|
39
|
-
sparkleKey: string;
|
|
40
|
-
name: string;
|
|
41
|
-
product: "Mint" | "Vault" | "TokenizedVault" | "SingleAssetVault";
|
|
42
|
-
}
|
|
43
|
-
export declare function GlamProvider({ children, }: Readonly<{
|
|
44
|
-
children: React.ReactNode;
|
|
45
|
-
}>): import("react/jsx-runtime").JSX.Element;
|
|
46
|
-
export declare const useGlam: () => GlamProviderContext;
|
|
47
|
-
export {};
|
package/src/react/index.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export declare const queryKeys: {
|
|
2
|
-
readonly vault: {
|
|
3
|
-
readonly all: (pk: string, cluster: string) => readonly ["vault", string, string];
|
|
4
|
-
readonly balances: (pk: string, cluster: string) => readonly ["vault", string, string, "balances"];
|
|
5
|
-
readonly holdings: (pk: string, cluster: string) => readonly ["vault", string, string, "holdings"];
|
|
6
|
-
readonly acls: (pk: string, cluster: string) => readonly ["vault", string, string, "acls"];
|
|
7
|
-
readonly config: (pk: string, cluster: string) => readonly ["vault", string, string, "config"];
|
|
8
|
-
readonly stakes: (pk: string, cluster: string) => readonly ["vault", string, string, "stakes"];
|
|
9
|
-
readonly holders: (mint: string, cluster: string) => readonly ["vault", "holders", string, string];
|
|
10
|
-
};
|
|
11
|
-
readonly wallet: {
|
|
12
|
-
readonly balances: (pk: string, cluster: string) => readonly ["wallet", string, "balances", string];
|
|
13
|
-
};
|
|
14
|
-
readonly global: {
|
|
15
|
-
readonly allStates: (cluster: string) => readonly ["global", "all-states", string];
|
|
16
|
-
readonly jupTokens: (cluster: string) => readonly ["global", "jup-tokens", string];
|
|
17
|
-
readonly jupDexes: (cluster: string) => readonly ["global", "jup-dexes", string];
|
|
18
|
-
readonly kaminoMarkets: (cluster: string) => readonly ["global", "kamino-markets", string];
|
|
19
|
-
readonly kaminoVaults: (cluster: string) => readonly ["global", "kamino-vaults", string];
|
|
20
|
-
readonly priorityFee: (cluster: string) => readonly ["global", "priority-fee", string];
|
|
21
|
-
};
|
|
22
|
-
readonly vaultGraph: {
|
|
23
|
-
readonly vault: (vaultId: string, cluster: string) => readonly ["vault-graph", "vault", string, string];
|
|
24
|
-
readonly tokenData: (mint: string, cluster: string) => readonly ["vault-graph", "token-data", string, string];
|
|
25
|
-
readonly availableIntegrations: (cluster: string) => readonly ["vault-graph", "available-integrations", string];
|
|
26
|
-
};
|
|
27
|
-
readonly tx: {
|
|
28
|
-
readonly status: (sig: string) => readonly ["tx", string];
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
export type InvalidationScope = "balance" | "acls" | "wallet" | "graph" | "stakes" | "all";
|
|
32
|
-
export interface InvalidationContext {
|
|
33
|
-
vaultPk: string;
|
|
34
|
-
walletPk: string;
|
|
35
|
-
cluster: string;
|
|
36
|
-
}
|
|
37
|
-
/** Maps invalidation scopes to the query keys that need to be invalidated. */
|
|
38
|
-
export declare function getInvalidationKeys(scopes: InvalidationScope[], ctx: InvalidationContext): readonly (readonly string[])[];
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Connection, PublicKey } from "@solana/web3.js";
|
|
2
|
-
import { QueryClient } from "@tanstack/react-query";
|
|
3
|
-
import { TokenAccount } from "../client/base";
|
|
4
|
-
export interface UseVaultBalanceSubscriptionOptions {
|
|
5
|
-
connection: Connection;
|
|
6
|
-
queryClient: QueryClient;
|
|
7
|
-
vaultPda: PublicKey | undefined;
|
|
8
|
-
/** Base58 string of the active vault state pubkey (used for query key scoping) */
|
|
9
|
-
pk: string;
|
|
10
|
-
/** Cluster network string for query key scoping */
|
|
11
|
-
cluster: string;
|
|
12
|
-
tokenAccounts: TokenAccount[];
|
|
13
|
-
enabled: boolean;
|
|
14
|
-
/** Called when WebSocket connection status changes (for polling fallback) */
|
|
15
|
-
onWsStatusChange: (connected: boolean) => void;
|
|
16
|
-
}
|
|
17
|
-
export declare function useVaultBalanceSubscription({ connection, queryClient, vaultPda, pk, cluster, tokenAccounts, enabled, onWsStatusChange, }: UseVaultBalanceSubscriptionOptions): void;
|
package/src/utils/accounts.d.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
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
|
-
/**
|
|
11
|
-
* Fetches all the token accounts owned by the specified pubkey.
|
|
12
|
-
*/
|
|
13
|
-
export declare function getTokenAccountsByOwner(connection: Connection, owner: PublicKey): Promise<TokenAccount[]>;
|
|
14
|
-
export declare function getSolAndTokenBalances(connection: Connection, owner: PublicKey): Promise<{
|
|
15
|
-
balanceLamports: number;
|
|
16
|
-
uiAmount: number;
|
|
17
|
-
tokenAccounts: TokenAccount[];
|
|
18
|
-
}>;
|
|
19
|
-
export declare const findStakeAccounts: (connection: Connection, withdrawAuthority: PublicKey) => Promise<PublicKey[]>;
|
|
20
|
-
export declare const getStakeAccountsWithStates: (connection: Connection, withdrawAuthority: PublicKey) => Promise<StakeAccountInfo[]>;
|
|
21
|
-
/**
|
|
22
|
-
* Parses mint account info to extract mint and token program
|
|
23
|
-
*
|
|
24
|
-
* @param accountInfo The account info buffer
|
|
25
|
-
* @param pubkey The mint public key
|
|
26
|
-
* @returns Mint object and token program ID
|
|
27
|
-
*/
|
|
28
|
-
export declare function parseMintAccountInfo(accountInfo: AccountInfo<Buffer>, pubkey: PublicKey): {
|
|
29
|
-
mint: Mint;
|
|
30
|
-
tokenProgram: PublicKey;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Fetches mint accounts and token program IDs for the given mint pubkeys
|
|
34
|
-
*
|
|
35
|
-
* @param connection Solana connection
|
|
36
|
-
* @param mintPubkeys Array of mint public keys
|
|
37
|
-
* @returns Array of mint objects with their token program IDs
|
|
38
|
-
*/
|
|
39
|
-
export declare function fetchMintsAndTokenPrograms(connection: Connection, mintPubkeys: PublicKey[]): Promise<{
|
|
40
|
-
mint: Mint;
|
|
41
|
-
tokenProgram: PublicKey;
|
|
42
|
-
}[]>;
|
|
43
|
-
/**
|
|
44
|
-
* Fetches mint account and token program ID for the given mint pubkey
|
|
45
|
-
*
|
|
46
|
-
* @param connection Solana connection
|
|
47
|
-
* @param mintPubkey Mint public key
|
|
48
|
-
* @returns Mint object and token program ID
|
|
49
|
-
*/
|
|
50
|
-
export declare function fetchMintAndTokenProgram(connection: Connection, mintPubkey: PublicKey): Promise<{
|
|
51
|
-
mint: Mint;
|
|
52
|
-
tokenProgram: PublicKey;
|
|
53
|
-
}>;
|
|
54
|
-
/**
|
|
55
|
-
* Checks if Token ACL (sRFC-37) is enabled for the given mint by verifying
|
|
56
|
-
* the freeze authority is set to the Token ACL program.
|
|
57
|
-
*/
|
|
58
|
-
export declare function isTokenAclEnabled(connection: Connection, mintPubkey: PublicKey): Promise<boolean>;
|
|
59
|
-
/**
|
|
60
|
-
* Finds all Address Lookup Tables (ALTs) associated with the current vault.
|
|
61
|
-
*
|
|
62
|
-
* First attempts to fetch lookup tables from the GLAM API if configured.
|
|
63
|
-
* Falls back to querying the ALT program directly using `getProgramAccounts`
|
|
64
|
-
* with filters.
|
|
65
|
-
*
|
|
66
|
-
* @returns Array of AddressLookupTableAccount objects for the vault
|
|
67
|
-
* @throws RPC errors from `getProgramAccounts`. Callers that only use the
|
|
68
|
-
* result to optimize transaction size may want to catch and fall back to an
|
|
69
|
-
* empty list; callers that rely on the result for correctness (e.g. ALT
|
|
70
|
-
* management commands) should let the error propagate.
|
|
71
|
-
*/
|
|
72
|
-
export declare function findGlamLookupTables(statePda: PublicKey, vaultPda: PublicKey, connection: Connection): Promise<AddressLookupTableAccount[]>;
|
package/src/utils/bitmask.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
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
|
-
};
|
package/src/utils/blockhash.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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
|
-
}
|
package/src/utils/common.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { BN } from "@coral-xyz/anchor";
|
|
2
|
-
/**
|
|
3
|
-
* Converts a buffer or array of character codes to a string
|
|
4
|
-
*/
|
|
5
|
-
export declare function charsToString(chars: number[] | Buffer): string;
|
|
6
|
-
export declare function charsToName(chars: number[] | Buffer): string;
|
|
7
|
-
/**
|
|
8
|
-
* Converts a string to an array of character codes
|
|
9
|
-
*/
|
|
10
|
-
export declare function stringToChars(name: string, length?: number): number[];
|
|
11
|
-
export declare function nameToChars(name: string, length?: number): number[];
|
|
12
|
-
/**
|
|
13
|
-
* Safely converts a BN amount to a UI amount (with decimals).
|
|
14
|
-
*
|
|
15
|
-
* @param amount - The amount in base units (BN)
|
|
16
|
-
* @param decimals - The number of decimals (e.g., 9)
|
|
17
|
-
* @returns The UI amount as a number
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* // Convert 10010000000 base units with 9 decimals
|
|
21
|
-
* const uiAmount = toUiAmount(new BN(10010000000), 9); // Returns 10.01
|
|
22
|
-
*
|
|
23
|
-
* @throws Error if the BN amount is too large to safely convert to number
|
|
24
|
-
*/
|
|
25
|
-
export declare function toUiAmount(amount: BN, decimals: number): number;
|
|
26
|
-
/**
|
|
27
|
-
* Safely converts a UI amount (with decimals) to a BN amount.
|
|
28
|
-
*
|
|
29
|
-
* @param amount - The UI amount (e.g., 10.01)
|
|
30
|
-
* @param decimals - The number of decimals (e.g., 9)
|
|
31
|
-
* @returns BN representing the amount in base units
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* // Convert 10.01 with 9 decimals
|
|
35
|
-
* const amount = fromUiAmount(10.01, 9); // Returns BN(10010000000)
|
|
36
|
-
*/
|
|
37
|
-
export declare function fromUiAmount(amount: number | string, decimals: number): BN;
|
|
@@ -1,15 +0,0 @@
|
|
|
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>>;
|
package/src/utils/evm.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
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;
|
package/src/utils/fraction.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
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: any;
|
|
17
|
-
static MAX_BF_BN: any;
|
|
18
|
-
static MIN_BN: any;
|
|
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;
|