@glamsystems/glam-sdk 0.1.22 → 0.1.24
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 +21180 -1455
- package/index.esm.js +21170 -1456
- package/package.json +3 -3
- package/src/client/assets.d.ts +17 -0
- package/src/client/base.d.ts +42 -22
- package/src/client/drift.d.ts +36 -35
- package/src/client/investor.d.ts +10 -10
- package/src/client/jupiter.d.ts +13 -14
- package/src/client/kamino.d.ts +14 -19
- package/src/client/marinade.d.ts +28 -12
- package/src/client/meteora.d.ts +6 -6
- package/src/client/mint.d.ts +13 -21
- package/src/client/price.d.ts +8 -6
- package/src/client/staking.d.ts +21 -27
- package/src/client/state.d.ts +11 -23
- package/src/client/vault.d.ts +27 -0
- package/src/client.d.ts +3 -3
- package/src/clientConfig.d.ts +2 -0
- package/src/constants.d.ts +2 -3
- package/src/index.d.ts +1 -0
- package/src/models.d.ts +47 -8
- package/src/react/glam.d.ts +3 -1
- package/src/utils/glamPDAs.d.ts +18 -0
- package/src/utils/helpers.d.ts +9 -4
- package/target/idl/glam_protocol.json +1116 -437
- package/target/types/glam_protocol.d.ts +1114 -435
- package/target/types/glam_protocol.ts +1115 -436
- package/src/client/wsol.d.ts +0 -11
package/src/client/price.d.ts
CHANGED
|
@@ -2,24 +2,26 @@ import { PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
|
2
2
|
import { KaminoLendingClient } from "./kamino";
|
|
3
3
|
import { BaseClient } from "./base";
|
|
4
4
|
import { PriceDenom } from "../models";
|
|
5
|
+
import { DriftClient } from "./drift";
|
|
5
6
|
export declare class PriceClient {
|
|
6
7
|
readonly base: BaseClient;
|
|
7
8
|
readonly klend: KaminoLendingClient;
|
|
8
|
-
|
|
9
|
+
readonly drift: DriftClient;
|
|
10
|
+
constructor(base: BaseClient, klend: KaminoLendingClient, drift: DriftClient);
|
|
9
11
|
/**
|
|
10
12
|
* !! This is a convenience method that calculates the AUM of the vault based on priced assets.
|
|
11
13
|
* !! It doesn't reflect the actual AUM of the vault.
|
|
12
14
|
* !! If the vault has not been priced or pricing data is outdated, the number is NOT meaningful.
|
|
13
15
|
*/
|
|
14
|
-
getAum(
|
|
15
|
-
|
|
16
|
-
priceVaultIxs(
|
|
17
|
-
remainingAccountsForPricingMeteora: (
|
|
16
|
+
getAum(): Promise<BN>;
|
|
17
|
+
priceKaminoIx(priceDenom: PriceDenom): Promise<TransactionInstruction>;
|
|
18
|
+
priceVaultIxs(priceDenom: PriceDenom): Promise<TransactionInstruction[]>;
|
|
19
|
+
remainingAccountsForPricingMeteora: () => Promise<{
|
|
18
20
|
pubkey: PublicKey;
|
|
19
21
|
isSigner: boolean;
|
|
20
22
|
isWritable: boolean;
|
|
21
23
|
}[]>;
|
|
22
|
-
remainingAccountsForPricingVaultAssets: (
|
|
24
|
+
remainingAccountsForPricingVaultAssets: (baseAssetOnly?: boolean) => Promise<{
|
|
23
25
|
pubkey: PublicKey;
|
|
24
26
|
isSigner: boolean;
|
|
25
27
|
isWritable: boolean;
|
package/src/client/staking.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { BN } from "@coral-xyz/anchor";
|
|
|
2
2
|
import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction } from "@solana/web3.js";
|
|
3
3
|
import { BaseClient, TxOptions } from "./base";
|
|
4
4
|
import { MarinadeClient } from "./marinade";
|
|
5
|
+
import { StakeAccountInfo } from "../utils/helpers";
|
|
5
6
|
interface StakePoolAccountData {
|
|
6
7
|
programId: PublicKey;
|
|
7
8
|
depositAuthority: PublicKey;
|
|
@@ -12,51 +13,44 @@ interface StakePoolAccountData {
|
|
|
12
13
|
tokenProgramId: PublicKey;
|
|
13
14
|
validatorList: PublicKey;
|
|
14
15
|
}
|
|
15
|
-
type StakeAccountInfo = {
|
|
16
|
-
address: PublicKey;
|
|
17
|
-
lamports: number;
|
|
18
|
-
state: string;
|
|
19
|
-
voter?: PublicKey;
|
|
20
|
-
};
|
|
21
16
|
export declare class StakingClient {
|
|
22
17
|
readonly base: BaseClient;
|
|
23
18
|
readonly marinade: MarinadeClient;
|
|
24
19
|
constructor(base: BaseClient, marinade: MarinadeClient);
|
|
25
|
-
unstake(
|
|
26
|
-
stakePoolDepositSol(
|
|
27
|
-
stakePoolDepositStake(
|
|
28
|
-
stakePoolWithdrawStake(
|
|
29
|
-
initializeAndDelegateStake(
|
|
30
|
-
deactivate(
|
|
31
|
-
withdraw(
|
|
32
|
-
merge(
|
|
33
|
-
split(
|
|
20
|
+
unstake(asset: PublicKey, amount: number | BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
21
|
+
stakePoolDepositSol(stakePool: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
22
|
+
stakePoolDepositStake(stakePool: PublicKey, stakeAccount: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
23
|
+
stakePoolWithdrawStake(stakePool: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
24
|
+
initializeAndDelegateStake(vote: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
25
|
+
deactivate(stakeAccounts: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
26
|
+
withdraw(stakeAccounts: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
27
|
+
merge(destinationStake: PublicKey, sourceStake: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
28
|
+
split(existingStake: PublicKey, lamports: BN, txOptions?: TxOptions): Promise<{
|
|
34
29
|
newStake: PublicKey;
|
|
35
30
|
txSig: TransactionSignature;
|
|
36
31
|
}>;
|
|
37
|
-
redelegate(
|
|
32
|
+
redelegate(existingStake: PublicKey, vote: PublicKey, txOptions?: TxOptions): Promise<{
|
|
38
33
|
newStake: PublicKey;
|
|
39
34
|
txSig: TransactionSignature;
|
|
40
35
|
}>;
|
|
41
|
-
getStakeAccountPda(state: PublicKey, accountId: string): [PublicKey, number];
|
|
42
36
|
getStakePoolWithdrawAuthority(programId: PublicKey, stakePool: PublicKey): PublicKey;
|
|
43
37
|
getStakePoolDepositAuthority(programId: PublicKey, stakePool: PublicKey): PublicKey;
|
|
44
|
-
getStakeAccountsWithStates(withdrawAuthority
|
|
38
|
+
getStakeAccountsWithStates(withdrawAuthority?: PublicKey): Promise<StakeAccountInfo[]>;
|
|
45
39
|
getStakeAccountVoter(stakeAccount: PublicKey): Promise<PublicKey | null>;
|
|
46
40
|
getStakePoolAccountData(stakePool: PublicKey): Promise<StakePoolAccountData>;
|
|
47
41
|
createStakeAccount(signer: PublicKey): Promise<[PublicKey, TransactionInstruction]>;
|
|
48
|
-
stakePoolDepositSolTx(
|
|
49
|
-
stakePoolDepositStakeTx(
|
|
50
|
-
stakePoolWithdrawStakeTx(
|
|
51
|
-
initializeAndDelegateStakeTx(
|
|
52
|
-
deactivateStakeTx(
|
|
53
|
-
withdrawStakeTx(
|
|
54
|
-
mergeStakeTx(
|
|
55
|
-
splitStakeTx(
|
|
42
|
+
stakePoolDepositSolTx(stakePool: PublicKey, lamports: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
43
|
+
stakePoolDepositStakeTx(stakePool: PublicKey, stakeAccount: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
44
|
+
stakePoolWithdrawStakeTx(stakePool: PublicKey, amount: BN, deactivate?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
45
|
+
initializeAndDelegateStakeTx(vote: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
46
|
+
deactivateStakeTx(stakeAccounts: PublicKey[], txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
47
|
+
withdrawStakeTx(stakeAccounts: PublicKey[], txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
48
|
+
mergeStakeTx(destinationStake: PublicKey, sourceStake: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
49
|
+
splitStakeTx(existingStake: PublicKey, lamports: BN, txOptions?: TxOptions): Promise<{
|
|
56
50
|
tx: VersionedTransaction;
|
|
57
51
|
newStake: PublicKey;
|
|
58
52
|
}>;
|
|
59
|
-
redelegateStakeTx(
|
|
53
|
+
redelegateStakeTx(existingStake: PublicKey, vote: PublicKey, txOptions?: TxOptions): Promise<{
|
|
60
54
|
tx: VersionedTransaction;
|
|
61
55
|
newStake: PublicKey;
|
|
62
56
|
}>;
|
package/src/client/state.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { PublicKey, VersionedTransaction,
|
|
2
|
-
import { BN } from "@coral-xyz/anchor";
|
|
1
|
+
import { PublicKey, VersionedTransaction, TransactionSignature } from "@solana/web3.js";
|
|
3
2
|
import { BaseClient, TxOptions } from "./base";
|
|
4
3
|
import { DelegateAcl, StateModel } from "../models";
|
|
5
|
-
type PublicKeyOrString = PublicKey | string;
|
|
6
4
|
export declare class StateClient {
|
|
7
5
|
readonly base: BaseClient;
|
|
8
6
|
constructor(base: BaseClient);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
create(partialStateModel: Partial<StateModel>, singleTx?: boolean, txOptions?: TxOptions): Promise<[TransactionSignature, PublicKey]>;
|
|
8
|
+
update(updated: Partial<StateModel>, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
9
|
+
updateApplyTimelock(txOptions?: TxOptions): Promise<string>;
|
|
10
|
+
emergencyUpdate(updated: Partial<StateModel>, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
11
|
+
updateStateTx(updated: Partial<StateModel>, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
12
|
+
updateStateApplyTimelockTx(txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
13
|
+
emergencyUpdateStateTx(updated: Partial<StateModel>, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
14
|
+
close(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
13
15
|
/**
|
|
14
16
|
* Create a full state model from a partial state model
|
|
15
17
|
*/
|
|
@@ -21,20 +23,6 @@ export declare class StateClient {
|
|
|
21
23
|
* @param delegates Public keys of delegates to be deleted
|
|
22
24
|
* @returns
|
|
23
25
|
*/
|
|
24
|
-
deleteDelegateAcls(
|
|
25
|
-
upsertDelegateAcls(
|
|
26
|
-
closeTokenAccounts(glamState: PublicKey, tokenAccounts: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
27
|
-
/**
|
|
28
|
-
* Close vault's token accounts, all token accounts must use the same token program
|
|
29
|
-
*/
|
|
30
|
-
closeTokenAccountIx(glamState: PublicKey, tokenAccounts: PublicKey[], tokenProgram?: PublicKey, txOptions?: TxOptions): Promise<TransactionInstruction>;
|
|
31
|
-
closeTokenAccountsTx(glamState: PublicKey, accounts: PublicKey[], txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
32
|
-
deposit(glamState: PublicKey | string, asset: PublicKey | string, amount: number | BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
33
|
-
depositSol(glamState: PublicKey, lamports: number | BN, wrap?: boolean, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
34
|
-
depositSolTx(glamState: PublicKey, lamports: number | BN, wrap?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
35
|
-
withdraw(glamState: PublicKey, asset: PublicKey | string, amount: number | BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
36
|
-
depositTx(statePda: PublicKey, asset: PublicKey, amount: number | BN, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
37
|
-
withdrawIxs(glamState: PublicKey, asset: PublicKey, amount: number | BN, txOptions: TxOptions): Promise<TransactionInstruction[]>;
|
|
38
|
-
withdrawTx(glamState: PublicKey, asset: PublicKey, amount: number | BN, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
26
|
+
deleteDelegateAcls(delegates: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
27
|
+
upsertDelegateAcls(delegateAcls: DelegateAcl[], txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
39
28
|
}
|
|
40
|
-
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BN } from "@coral-xyz/anchor";
|
|
2
|
+
import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction } from "@solana/web3.js";
|
|
3
|
+
import { BaseClient, TxOptions } from "./base";
|
|
4
|
+
export declare class VaultClient {
|
|
5
|
+
readonly base: BaseClient;
|
|
6
|
+
constructor(base: BaseClient);
|
|
7
|
+
wrap(amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
8
|
+
unwrap(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
9
|
+
systemTransfer(amount: BN | number, to: PublicKey | string, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
10
|
+
closeTokenAccounts(tokenAccounts: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
11
|
+
deposit(asset: PublicKey | string, amount: number | BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
12
|
+
depositSol(lamports: number | BN, wrap?: boolean, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
13
|
+
withdraw(asset: PublicKey | string, amount: number | BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
14
|
+
wrapTx(amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
15
|
+
unwrapTx(txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
16
|
+
systemTransferTx(amount: BN, to: PublicKey, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
17
|
+
/**
|
|
18
|
+
* Returns an instruction that closes multiple vault token accounts
|
|
19
|
+
* All token accounts must be owned by the same token program
|
|
20
|
+
*/
|
|
21
|
+
closeTokenAccountIx(tokenAccounts: PublicKey[], tokenProgram?: PublicKey, txOptions?: TxOptions): Promise<TransactionInstruction>;
|
|
22
|
+
closeTokenAccountsTx(accounts: PublicKey[], txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
23
|
+
depositSolTx(lamports: number | BN, wrap?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
24
|
+
depositTx(asset: PublicKey, amount: number | BN, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
25
|
+
withdrawIxs(asset: PublicKey, amount: number | BN, txOptions: TxOptions): Promise<TransactionInstruction[]>;
|
|
26
|
+
withdrawTx(asset: PublicKey, amount: number | BN, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
27
|
+
}
|
package/src/client.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { DriftClient } from "./client/drift";
|
|
|
4
4
|
import { JupiterSwapClient } from "./client/jupiter";
|
|
5
5
|
import { JupiterVoteClient } from "./client/jupiter";
|
|
6
6
|
import { MarinadeClient } from "./client/marinade";
|
|
7
|
-
import {
|
|
7
|
+
import { VaultClient } from "./client/vault";
|
|
8
8
|
import { StakingClient } from "./client/staking";
|
|
9
9
|
import { StateClient } from "./client/state";
|
|
10
10
|
import { MintClient } from "./client/mint";
|
|
@@ -24,7 +24,7 @@ export declare class GlamClient extends BaseClient {
|
|
|
24
24
|
private _jupiterSwap?;
|
|
25
25
|
private _jupiterVote?;
|
|
26
26
|
private _marinade?;
|
|
27
|
-
private
|
|
27
|
+
private _vault?;
|
|
28
28
|
private _price?;
|
|
29
29
|
private _staking?;
|
|
30
30
|
private _state?;
|
|
@@ -38,7 +38,7 @@ export declare class GlamClient extends BaseClient {
|
|
|
38
38
|
get jupiterSwap(): JupiterSwapClient;
|
|
39
39
|
get jupiterVote(): JupiterVoteClient;
|
|
40
40
|
get marinade(): MarinadeClient;
|
|
41
|
-
get
|
|
41
|
+
get vault(): VaultClient;
|
|
42
42
|
get staking(): StakingClient;
|
|
43
43
|
get price(): PriceClient;
|
|
44
44
|
get state(): StateClient;
|
package/src/clientConfig.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Provider, Wallet } from "@coral-xyz/anchor";
|
|
2
|
+
import { PublicKey } from "@solana/web3.js";
|
|
2
3
|
export declare enum ClusterNetwork {
|
|
3
4
|
Mainnet = "mainnet-beta",
|
|
4
5
|
Testnet = "testnet",
|
|
@@ -9,5 +10,6 @@ export type GlamClientConfig = {
|
|
|
9
10
|
provider?: Provider;
|
|
10
11
|
wallet?: Wallet;
|
|
11
12
|
cluster?: ClusterNetwork;
|
|
13
|
+
statePda?: PublicKey;
|
|
12
14
|
jupiterApi?: string;
|
|
13
15
|
};
|
package/src/constants.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export declare const STAKE_ACCOUNT_SIZE = 200;
|
|
|
9
9
|
export declare const METEORA_POSITION_SIZE = 8120;
|
|
10
10
|
export declare const KAMINO_OBTRIGATION_SIZE = 3344;
|
|
11
11
|
export declare const JITO_TIP_DEFAULT: PublicKey;
|
|
12
|
+
export declare const KAMINO_SCOPE_PRICES: PublicKey;
|
|
13
|
+
export declare const MARINADE_NATIVE_STAKE_AUTHORITY: PublicKey;
|
|
12
14
|
/**
|
|
13
15
|
* Token mints. If no devnet version is defined, assume mainnet and devnet addresses are the same.
|
|
14
16
|
*
|
|
@@ -16,10 +18,7 @@ export declare const JITO_TIP_DEFAULT: PublicKey;
|
|
|
16
18
|
*/
|
|
17
19
|
export declare const WSOL: PublicKey;
|
|
18
20
|
export declare const MSOL: PublicKey;
|
|
19
|
-
export declare const JITOSOL: PublicKey;
|
|
20
21
|
export declare const USDC: PublicKey;
|
|
21
|
-
export declare const WETH: PublicKey;
|
|
22
|
-
export declare const WBTC: PublicKey;
|
|
23
22
|
export declare const JUP: PublicKey;
|
|
24
23
|
/**
|
|
25
24
|
* Program IDs
|
package/src/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from "./client";
|
|
|
5
5
|
export * from "./client/jupiter";
|
|
6
6
|
export * from "./client/drift";
|
|
7
7
|
export * from "./client/base";
|
|
8
|
+
export * from "./utils/glamPDAs";
|
|
8
9
|
export * from "./utils/helpers";
|
|
9
10
|
export * from "./utils/priorityfee";
|
|
10
11
|
export * from "./utils/driftOrderParams";
|
package/src/models.d.ts
CHANGED
|
@@ -22,25 +22,38 @@ export declare class StateIdlModel implements StateModelType {
|
|
|
22
22
|
uri: string | null;
|
|
23
23
|
enabled: boolean | null;
|
|
24
24
|
assets: PublicKey[] | null;
|
|
25
|
-
externalVaultAccounts: PublicKey[] | null;
|
|
26
25
|
mints: MintModel[] | null;
|
|
27
26
|
company: CompanyModel | null;
|
|
28
27
|
owner: ManagerModel | null;
|
|
29
28
|
created: CreatedModel | null;
|
|
29
|
+
baseAsset: PublicKey | null;
|
|
30
|
+
updateTimelock: number | null;
|
|
31
|
+
timeUnit: {
|
|
32
|
+
slot: {};
|
|
33
|
+
} | {
|
|
34
|
+
second: {};
|
|
35
|
+
} | null;
|
|
30
36
|
delegateAcls: DelegateAcl[] | null;
|
|
31
37
|
integrations: Integration[] | null;
|
|
38
|
+
borrowableAssets: PublicKey[] | null;
|
|
32
39
|
driftMarketIndexesPerp: number[] | null;
|
|
33
40
|
driftMarketIndexesSpot: number[] | null;
|
|
34
41
|
driftOrderTypes: number[] | null;
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
kaminoLendingMarkets: PublicKey[] | null;
|
|
43
|
+
meteoraDlmmPools: PublicKey[] | null;
|
|
44
|
+
maxSwapSlippageBps: number | null;
|
|
37
45
|
metadata: Metadata | null;
|
|
38
46
|
rawOpenfunds: FundOpenfundsModel | null;
|
|
39
47
|
constructor(data: Partial<StateModelType>);
|
|
40
48
|
}
|
|
41
49
|
export declare class StateModel extends StateIdlModel {
|
|
42
50
|
readonly glamProgramId: PublicKey;
|
|
43
|
-
|
|
51
|
+
externalVaultAccounts: PublicKey[] | null;
|
|
52
|
+
pricedAssets: any[] | null;
|
|
53
|
+
ledger: LedgerEntry[] | null;
|
|
54
|
+
timelockExpiresAt: number | null;
|
|
55
|
+
pendingUpdates: any | null;
|
|
56
|
+
constructor(data: Partial<StateModel>, glamProgramId?: PublicKey);
|
|
44
57
|
get idStr(): string;
|
|
45
58
|
get vaultPda(): PublicKey;
|
|
46
59
|
get openfundsPda(): PublicKey;
|
|
@@ -49,7 +62,7 @@ export declare class StateModel extends StateIdlModel {
|
|
|
49
62
|
get mintAddresses(): PublicKey[];
|
|
50
63
|
get sparkleKey(): string;
|
|
51
64
|
/**
|
|
52
|
-
* Build a StateModel from onchain
|
|
65
|
+
* Build a StateModel from onchain data
|
|
53
66
|
*
|
|
54
67
|
* @param stateAccount provides core fund data
|
|
55
68
|
* @param openfundsMetadataAccount includes fund rawOpenfunds data and share class rawOpenfunds data
|
|
@@ -87,20 +100,27 @@ export declare class MintIdlModel implements MintModelType {
|
|
|
87
100
|
imageUri: string | null;
|
|
88
101
|
allowlist: PublicKey[] | null;
|
|
89
102
|
blocklist: PublicKey[] | null;
|
|
90
|
-
|
|
103
|
+
lockUpPeriod: number | null;
|
|
104
|
+
yearInSeconds: number | null;
|
|
91
105
|
permanentDelegate: PublicKey | null;
|
|
92
106
|
defaultAccountStateFrozen: boolean | null;
|
|
93
107
|
feeStructure: FeeStructure | null;
|
|
94
108
|
feeParams: FeeParams | null;
|
|
95
|
-
|
|
109
|
+
notifyAndSettle: NotifyAndSettle | null;
|
|
110
|
+
maxCap: BN | null;
|
|
96
111
|
minSubscription: BN | null;
|
|
97
112
|
minRedemption: BN | null;
|
|
113
|
+
subscriptionPaused: boolean | null;
|
|
114
|
+
redemptionPaused: boolean | null;
|
|
98
115
|
isRawOpenfunds: boolean | null;
|
|
99
116
|
rawOpenfunds: MintOpenfundsModel | null;
|
|
100
117
|
constructor(data: Partial<MintModelType>);
|
|
101
118
|
}
|
|
102
119
|
export declare class MintModel extends MintIdlModel {
|
|
103
120
|
constructor(data: Partial<MintIdlModel>);
|
|
121
|
+
/**
|
|
122
|
+
* @deprecated
|
|
123
|
+
*/
|
|
104
124
|
static mintAddress(statePda: PublicKey, idx?: number, glamProgramId?: PublicKey): PublicKey;
|
|
105
125
|
}
|
|
106
126
|
export type MintOpenfundsModelType = IdlTypes<GlamProtocol>["mintOpenfundsModel"];
|
|
@@ -177,7 +197,8 @@ export type Integration = IdlTypes<GlamProtocol>["integration"];
|
|
|
177
197
|
export type FeeStructure = IdlTypes<GlamProtocol>["feeStructure"];
|
|
178
198
|
export type FeeParams = IdlTypes<GlamProtocol>["feeParams"];
|
|
179
199
|
export type AccruedFees = IdlTypes<GlamProtocol>["accruedFees"];
|
|
180
|
-
export type
|
|
200
|
+
export type NotifyAndSettle = IdlTypes<GlamProtocol>["notifyAndSettle"];
|
|
201
|
+
export type LedgerEntry = IdlTypes<GlamProtocol>["ledgerEntry"];
|
|
181
202
|
export declare class PriceDenom {
|
|
182
203
|
static readonly SOL: {
|
|
183
204
|
sol: {};
|
|
@@ -185,4 +206,22 @@ export declare class PriceDenom {
|
|
|
185
206
|
static readonly USD: {
|
|
186
207
|
usd: {};
|
|
187
208
|
};
|
|
209
|
+
static readonly ASSET: {
|
|
210
|
+
asset6: {};
|
|
211
|
+
};
|
|
212
|
+
static fromAsset(asset: PublicKey): {
|
|
213
|
+
sol: {};
|
|
214
|
+
} | {
|
|
215
|
+
usd: {};
|
|
216
|
+
} | {
|
|
217
|
+
asset6: {};
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
export declare class TimeUnit {
|
|
221
|
+
static readonly Slot: {
|
|
222
|
+
slot: {};
|
|
223
|
+
};
|
|
224
|
+
static readonly Second: {
|
|
225
|
+
second: {};
|
|
226
|
+
};
|
|
188
227
|
}
|
package/src/react/glam.d.ts
CHANGED
|
@@ -36,8 +36,9 @@ interface GlamProviderContext {
|
|
|
36
36
|
driftUser: DriftUser;
|
|
37
37
|
setActiveGlamState: (f: GlamStateCache) => void;
|
|
38
38
|
refresh: () => Promise<void>;
|
|
39
|
+
refetchGlamStates: () => Promise<void>;
|
|
39
40
|
}
|
|
40
|
-
interface UserWallet {
|
|
41
|
+
export interface UserWallet {
|
|
41
42
|
queryKey: string[];
|
|
42
43
|
pubkey?: PublicKey;
|
|
43
44
|
balanceLamports: number;
|
|
@@ -49,6 +50,7 @@ export interface Vault {
|
|
|
49
50
|
balanceLamports: number;
|
|
50
51
|
uiAmount: number;
|
|
51
52
|
tokenAccounts: TokenAccount[];
|
|
53
|
+
driftUser?: DriftUser;
|
|
52
54
|
}
|
|
53
55
|
interface GlamStateCache {
|
|
54
56
|
address: string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
|
2
|
+
import { StateModel } from "../models";
|
|
3
|
+
/**
|
|
4
|
+
* Compute state account PDA from state model
|
|
5
|
+
*/
|
|
6
|
+
export declare function getStatePda(stateModel: Partial<StateModel>, programId: PublicKey, owner?: PublicKey): PublicKey;
|
|
7
|
+
/**
|
|
8
|
+
* Compute vault PDA from state PDA
|
|
9
|
+
*/
|
|
10
|
+
export declare function getVaultPda(statePda: PublicKey, programId: PublicKey): PublicKey;
|
|
11
|
+
/**
|
|
12
|
+
* Compute escrow PDA from state PDA
|
|
13
|
+
*/
|
|
14
|
+
export declare function getEscrowPda(statePda: PublicKey, programId: PublicKey): PublicKey;
|
|
15
|
+
export declare function getOpenfundsPda(statePda: PublicKey, programId: PublicKey): PublicKey;
|
|
16
|
+
export declare function getMintPda(statePda: PublicKey, mintIdx: number, programId: PublicKey): PublicKey;
|
|
17
|
+
export declare function getExtraMetasPda(mint: PublicKey): PublicKey;
|
|
18
|
+
export declare function getAccountPolicyPda(tokenAccount: PublicKey): PublicKey;
|
package/src/utils/helpers.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { Connection, PublicKey, TransactionInstruction, AddressLookupTableAccount } from "@solana/web3.js";
|
|
2
|
+
export type StakeAccountInfo = {
|
|
3
|
+
address: PublicKey;
|
|
4
|
+
lamports: number;
|
|
5
|
+
state: string;
|
|
6
|
+
voter?: PublicKey;
|
|
7
|
+
};
|
|
2
8
|
export declare const fetchStakeAccounts: (connection: Connection, withdrawAuthority: PublicKey) => Promise<PublicKey[]>;
|
|
3
|
-
export declare const
|
|
4
|
-
|
|
5
|
-
account: import("@solana/web3.js").AccountInfo<Buffer | import("@solana/web3.js").ParsedAccountData>;
|
|
6
|
-
}[]>;
|
|
9
|
+
export declare const getStakeAccountsWithStates: (connection: Connection, withdrawAuthority: PublicKey) => Promise<StakeAccountInfo[]>;
|
|
10
|
+
export declare const fetchMarinadeTicketAccounts: (connection: Connection, beneficiary: PublicKey) => Promise<import("@solana/web3.js").GetProgramAccountsResponse>;
|
|
7
11
|
export declare const fetchKaminoObligations: (connection: Connection, owner: PublicKey, market?: PublicKey) => Promise<PublicKey[]>;
|
|
8
12
|
export declare const fetchMeteoraPositions: (connection: Connection, owner: PublicKey) => Promise<PublicKey[]>;
|
|
9
13
|
export declare const parseMeteoraPosition: (connection: Connection, position: PublicKey) => Promise<{
|
|
@@ -13,5 +17,6 @@ export declare const parseMeteoraPosition: (connection: Connection, position: Pu
|
|
|
13
17
|
binArrayLower: PublicKey;
|
|
14
18
|
binArrayUpper: PublicKey;
|
|
15
19
|
}>;
|
|
20
|
+
export declare function fetchLookupTables(connection: Connection, authority: PublicKey, firstEntry: PublicKey): Promise<AddressLookupTableAccount[]>;
|
|
16
21
|
export declare const getSimulationComputeUnits: (connection: Connection, instructions: Array<TransactionInstruction>, payer: PublicKey, lookupTables?: Array<AddressLookupTableAccount>) => Promise<number | undefined>;
|
|
17
22
|
export declare const setsAreEqual: (a: Set<any>, b: Set<any>) => boolean;
|