@glamsystems/glam-sdk 1.1.0 → 1.1.1-alpha.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.
- package/index.cjs.d.ts +0 -1
- package/index.cjs.js +120789 -1
- package/index.esm.d.ts +0 -1
- package/index.esm.js +120308 -1
- package/package.json +15 -27
- package/target/idl/glam_mint-staging.json +480 -1
- package/target/idl/glam_mint.json +247 -1
- package/target/types/glam_mint-staging.ts +480 -1
- package/target/types/glam_mint.ts +247 -1
- package/LICENSE +0 -201
- package/buffer-layout.d.ts +0 -88
- package/src/assets.d.ts +0 -39
- package/src/client/access.d.ts +0 -57
- package/src/client/base.d.ts +0 -234
- package/src/client/bridge.d.ts +0 -205
- package/src/client/bridgeRegistry.d.ts +0 -32
- package/src/client/cctp.d.ts +0 -164
- package/src/client/epi.d.ts +0 -228
- package/src/client/fees.d.ts +0 -33
- package/src/client/invest.d.ts +0 -37
- package/src/client/jupiter-lend/borrow.d.ts +0 -92
- package/src/client/jupiter-lend/earn.d.ts +0 -64
- package/src/client/jupiter-lend/index.d.ts +0 -3
- package/src/client/jupiter-lend/shared.d.ts +0 -129
- package/src/client/jupiter.d.ts +0 -53
- 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 -94
- package/src/client/kamino/types.d.ts +0 -56
- package/src/client/kamino/vaults.d.ts +0 -39
- package/src/client/loopscale/borrow.d.ts +0 -118
- package/src/client/loopscale/core.d.ts +0 -604
- package/src/client/loopscale/index.d.ts +0 -5
- package/src/client/loopscale/lend.d.ts +0 -123
- package/src/client/loopscale/vault.d.ts +0 -43
- package/src/client/marinade.d.ts +0 -42
- package/src/client/mint.d.ts +0 -143
- package/src/client/orca.d.ts +0 -255
- package/src/client/phoenix.d.ts +0 -214
- package/src/client/price.d.ts +0 -182
- 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 -98
- package/src/client.d.ts +0 -82
- package/src/clientConfig.d.ts +0 -32
- package/src/constants.d.ts +0 -111
- package/src/deser/base.d.ts +0 -18
- package/src/deser/index.d.ts +0 -4
- package/src/deser/integrationPolicies.d.ts +0 -195
- package/src/deser/kaminoLayouts.d.ts +0 -264
- package/src/deser/loopscaleLayouts.d.ts +0 -157
- package/src/deser/tokenAclLayouts.d.ts +0 -67
- package/src/error.d.ts +0 -29
- package/src/glamExports.d.ts +0 -6260
- package/src/globalConfig.d.ts +0 -27
- package/src/index.d.ts +0 -24
- package/src/models/acl.d.ts +0 -43
- package/src/models/index.d.ts +0 -8
- package/src/models/mint.d.ts +0 -57
- package/src/models/state.d.ts +0 -94
- package/src/models/types.d.ts +0 -28
- package/src/protocols.d.ts +0 -29
- package/src/utils/accounts.d.ts +0 -71
- package/src/utils/bitmask.d.ts +0 -53
- package/src/utils/blockhash.d.ts +0 -11
- package/src/utils/common.d.ts +0 -73
- 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/helius.d.ts +0 -66
- package/src/utils/index.d.ts +0 -17
- package/src/utils/jupiterApi.d.ts +0 -95
- package/src/utils/lookupTables.d.ts +0 -83
- package/src/utils/phoenixApi.d.ts +0 -146
- package/src/utils/pkmap.d.ts +0 -87
- package/src/utils/pkset.d.ts +0 -73
- package/src/utils/positionCategorizer.d.ts +0 -38
- package/src/utils/rpc.d.ts +0 -18
- package/src/utils/timelock.d.ts +0 -52
- package/src/utils/transaction.d.ts +0 -13
- package/target/idl/ext_bridge-staging.json +0 -2379
- package/target/idl/ext_bridge.json +0 -2379
- package/target/idl/ext_drift.json +0 -5464
- package/target/idl/ext_epi-staging.json +0 -2862
- package/target/idl/ext_epi.json +0 -2862
- package/target/idl/ext_loopscale-staging.json +0 -4708
- package/target/idl/ext_loopscale.json +0 -4708
- package/target/idl/ext_marinade-staging.json +0 -1587
- package/target/idl/ext_phoenix-staging.json +0 -3525
- package/target/idl/ext_phoenix.json +0 -3525
- package/target/idl/mock_layerzero_endpoint.json +0 -144
- package/target/idl/mock_layerzero_oft.json +0 -155
- package/target/idl/mock_wormhole_verify_vaa_shim.json +0 -58
- package/target/types/ext_bridge-staging.d.ts +0 -2385
- package/target/types/ext_bridge-staging.ts +0 -2385
- package/target/types/ext_bridge.d.ts +0 -2385
- package/target/types/ext_bridge.ts +0 -2385
- package/target/types/ext_cctp-staging.d.ts +0 -1268
- package/target/types/ext_cctp.d.ts +0 -1268
- package/target/types/ext_drift.d.ts +0 -5470
- package/target/types/ext_drift.ts +0 -5470
- package/target/types/ext_epi-staging.d.ts +0 -2868
- package/target/types/ext_epi-staging.ts +0 -2868
- package/target/types/ext_epi.d.ts +0 -2868
- package/target/types/ext_epi.ts +0 -2868
- package/target/types/ext_jupiter-staging.d.ts +0 -1966
- package/target/types/ext_jupiter.d.ts +0 -1966
- package/target/types/ext_kamino-staging.d.ts +0 -3433
- package/target/types/ext_kamino.d.ts +0 -3433
- package/target/types/ext_loopscale-staging.d.ts +0 -4714
- package/target/types/ext_loopscale-staging.ts +0 -4714
- package/target/types/ext_loopscale.d.ts +0 -4714
- package/target/types/ext_loopscale.ts +0 -4714
- package/target/types/ext_marinade-staging.d.ts +0 -1593
- package/target/types/ext_marinade-staging.ts +0 -1593
- package/target/types/ext_marinade.d.ts +0 -1593
- package/target/types/ext_orca-staging.d.ts +0 -2829
- package/target/types/ext_orca.d.ts +0 -2829
- package/target/types/ext_phoenix-staging.d.ts +0 -3531
- package/target/types/ext_phoenix-staging.ts +0 -3531
- package/target/types/ext_phoenix.d.ts +0 -3531
- package/target/types/ext_phoenix.ts +0 -3531
- package/target/types/ext_spl-staging.d.ts +0 -1274
- package/target/types/ext_spl.d.ts +0 -1274
- package/target/types/ext_stake_pool-staging.d.ts +0 -1622
- package/target/types/ext_stake_pool.d.ts +0 -1622
- package/target/types/glam_config.d.ts +0 -755
- package/target/types/glam_mint-staging.d.ts +0 -8802
- package/target/types/glam_mint.d.ts +0 -6349
- package/target/types/glam_policies.d.ts +0 -477
- package/target/types/glam_protocol-staging.d.ts +0 -3362
- package/target/types/glam_protocol.d.ts +0 -2783
- package/target/types/mock_layerzero_endpoint.d.ts +0 -150
- package/target/types/mock_layerzero_endpoint.ts +0 -150
- package/target/types/mock_layerzero_oft.d.ts +0 -161
- package/target/types/mock_layerzero_oft.ts +0 -161
- package/target/types/mock_wormhole_verify_vaa_shim.d.ts +0 -64
- package/target/types/mock_wormhole_verify_vaa_shim.ts +0 -64
package/src/client/phoenix.d.ts
DELETED
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import { BN, type IdlTypes } from "@coral-xyz/anchor";
|
|
2
|
-
import { type AccountMeta, PublicKey, type TransactionInstruction, type TransactionSignature, type VersionedTransaction } from "@solana/web3.js";
|
|
3
|
-
import { PhoenixPolicy } from "../deser/integrationPolicies";
|
|
4
|
-
import type { ExtPhoenix } from "../glamExports";
|
|
5
|
-
import { PhoenixApiClient, PhoenixSnapshot } from "../utils/phoenixApi";
|
|
6
|
-
import { BaseClient, BaseTxBuilder, type ProtocolPolicyClient, type ProtocolPolicyTxBuilder, type TxOptions } from "./base";
|
|
7
|
-
export type PhoenixIdlTypes = IdlTypes<ExtPhoenix>;
|
|
8
|
-
export type PhoenixBaseLots = PhoenixIdlTypes["baseLots"];
|
|
9
|
-
export type PhoenixCancelUpToInstruction = PhoenixIdlTypes["cancelUpToInstruction"];
|
|
10
|
-
export type PhoenixDepositFundsInstruction = PhoenixIdlTypes["depositFundsInstruction"];
|
|
11
|
-
export type PhoenixDepositParams = PhoenixIdlTypes["depositParams"];
|
|
12
|
-
export type PhoenixOrderFlags = PhoenixIdlTypes["orderFlags"];
|
|
13
|
-
export type PhoenixOrderIds = PhoenixIdlTypes["orderIds"];
|
|
14
|
-
export type PhoenixOrderPacket = PhoenixIdlTypes["orderPacket"];
|
|
15
|
-
export type PhoenixQuoteLots = PhoenixIdlTypes["quoteLots"];
|
|
16
|
-
export type PhoenixRegisterTraderParams = PhoenixIdlTypes["registerTraderParams"];
|
|
17
|
-
export type PhoenixSelfTradeBehavior = PhoenixIdlTypes["selfTradeBehavior"];
|
|
18
|
-
export type PhoenixSide = PhoenixIdlTypes["side"];
|
|
19
|
-
export type PhoenixTicks = PhoenixIdlTypes["ticks"];
|
|
20
|
-
export type PhoenixWithdrawFundsInstruction = PhoenixIdlTypes["withdrawFundsInstruction"];
|
|
21
|
-
export type PhoenixWithdrawParams = PhoenixIdlTypes["withdrawParams"];
|
|
22
|
-
export type PhoenixPolicyInput = PhoenixIdlTypes["phoenixPolicy"];
|
|
23
|
-
export type PhoenixTraderIndexes = {
|
|
24
|
-
traderPdaIndex?: number;
|
|
25
|
-
subaccountIndex?: number;
|
|
26
|
-
};
|
|
27
|
-
export type PhoenixRemainingAccounts = {
|
|
28
|
-
remainingAccounts: AccountMeta[];
|
|
29
|
-
};
|
|
30
|
-
export type PhoenixRegisterTraderAccounts = {
|
|
31
|
-
traderAccount?: PublicKey;
|
|
32
|
-
logAuthority?: PublicKey;
|
|
33
|
-
globalConfig?: PublicKey;
|
|
34
|
-
};
|
|
35
|
-
export type PhoenixEmberAccounts = {
|
|
36
|
-
inputMint: PublicKey;
|
|
37
|
-
outputMint: PublicKey;
|
|
38
|
-
inputTokenAccount?: PublicKey;
|
|
39
|
-
outputTokenAccount?: PublicKey;
|
|
40
|
-
emberState?: PublicKey;
|
|
41
|
-
emberVault?: PublicKey;
|
|
42
|
-
tokenProgram?: PublicKey;
|
|
43
|
-
};
|
|
44
|
-
export declare function getPhoenixTraderPda(authority: PublicKey, traderPdaIndex?: number, subaccountIndex?: number): PublicKey;
|
|
45
|
-
export declare function getPhoenixSplineCollectionPda(market: PublicKey): PublicKey;
|
|
46
|
-
export declare function getPhoenixGlobalVaultPda(mint: PublicKey): PublicKey;
|
|
47
|
-
export declare function getEmberStatePda(): PublicKey;
|
|
48
|
-
export declare function getEmberVaultPda(): PublicKey;
|
|
49
|
-
declare class TxBuilder extends BaseTxBuilder<PhoenixClient> implements ProtocolPolicyTxBuilder<PhoenixPolicy> {
|
|
50
|
-
getEmberCpiAccounts(accounts: PhoenixEmberAccounts, signer?: PublicKey): {
|
|
51
|
-
glamState: PublicKey;
|
|
52
|
-
glamVault: PublicKey;
|
|
53
|
-
glamSigner: PublicKey;
|
|
54
|
-
integrationAuthority: PublicKey;
|
|
55
|
-
cpiProgram: PublicKey;
|
|
56
|
-
glamProtocolProgram: PublicKey;
|
|
57
|
-
systemProgram: PublicKey;
|
|
58
|
-
emberState: PublicKey;
|
|
59
|
-
inputMint: PublicKey;
|
|
60
|
-
outputMint: PublicKey;
|
|
61
|
-
inputTokenAccount: PublicKey;
|
|
62
|
-
outputTokenAccount: PublicKey;
|
|
63
|
-
emberVault: PublicKey;
|
|
64
|
-
tokenProgram: PublicKey;
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* Account map shared by every ext_phoenix Phoenix-CPI instruction
|
|
68
|
-
* (`glam_state`, `glam_vault`, `glam_signer`, integration authority,
|
|
69
|
-
* `cpi_program=Phoenix`, the GLAM protocol program, system program).
|
|
70
|
-
*/
|
|
71
|
-
getPhoenixCpiAccounts(signer?: PublicKey): {
|
|
72
|
-
glamState: PublicKey;
|
|
73
|
-
glamVault: PublicKey;
|
|
74
|
-
glamSigner: PublicKey;
|
|
75
|
-
integrationAuthority: PublicKey;
|
|
76
|
-
cpiProgram: PublicKey;
|
|
77
|
-
glamProtocolProgram: PublicKey;
|
|
78
|
-
systemProgram: PublicKey;
|
|
79
|
-
};
|
|
80
|
-
registerTraderIx(params: PhoenixRegisterTraderParams, accounts?: PhoenixRegisterTraderAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
81
|
-
updateTraderStateIx(accounts: PhoenixRemainingAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
82
|
-
emberDepositIx(params: PhoenixDepositParams, accounts: PhoenixEmberAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
83
|
-
depositFundsIx(params: PhoenixDepositFundsInstruction, accounts: PhoenixRemainingAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
84
|
-
emberWithdrawIx(params: PhoenixWithdrawParams, accounts: PhoenixEmberAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
85
|
-
withdrawFundsIx(params: PhoenixWithdrawFundsInstruction, accounts: PhoenixRemainingAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
86
|
-
placeLimitOrderIx(packet: PhoenixOrderPacket, accounts: PhoenixRemainingAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
87
|
-
placeMarketOrderIx(packet: PhoenixOrderPacket, accounts: PhoenixRemainingAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
88
|
-
cancelAllIx(accounts: PhoenixRemainingAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
89
|
-
cancelOrdersByIdIx(orderIds: PhoenixOrderIds, accounts: PhoenixRemainingAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
90
|
-
cancelUpToIx(args: PhoenixCancelUpToInstruction, accounts: PhoenixRemainingAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
91
|
-
setPolicyIx(policy: PhoenixPolicy, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
92
|
-
setPolicyTx(policy: PhoenixPolicy, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
93
|
-
clearPolicyIx(signer?: PublicKey): Promise<TransactionInstruction>;
|
|
94
|
-
clearPolicyTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
95
|
-
registerTraderTx(params: PhoenixRegisterTraderParams, accounts?: PhoenixRegisterTraderAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
96
|
-
updateTraderStateTx(accounts: PhoenixRemainingAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
97
|
-
/**
|
|
98
|
-
* Remaining-accounts list for `deposit_funds` — the vault token account
|
|
99
|
-
* holding the canonical collateral, the trader PDA, Phoenix's global vault
|
|
100
|
-
* for that mint, the SPL token program, and the trader-index/active-buffer
|
|
101
|
-
* chunks from the snapshot.
|
|
102
|
-
*/
|
|
103
|
-
getDepositRemainingAccounts(snapshot: PhoenixSnapshot, indexes?: PhoenixTraderIndexes): AccountMeta[];
|
|
104
|
-
/**
|
|
105
|
-
* Remaining-accounts list for `withdraw_funds`. Same shape as the deposit
|
|
106
|
-
* variant plus the perp asset map and the global withdraw queue, which the
|
|
107
|
-
* withdraw path mutates.
|
|
108
|
-
*/
|
|
109
|
-
getWithdrawRemainingAccounts(snapshot: PhoenixSnapshot, indexes?: PhoenixTraderIndexes): AccountMeta[];
|
|
110
|
-
deposit(amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
111
|
-
withdraw(amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
112
|
-
depositFundsTx(params: PhoenixDepositFundsInstruction, accounts: PhoenixRemainingAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
113
|
-
withdrawFundsTx(params: PhoenixWithdrawFundsInstruction, accounts: PhoenixRemainingAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
114
|
-
placeLimitOrderTx(packet: PhoenixOrderPacket, accounts: PhoenixRemainingAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
115
|
-
placeMarketOrderTx(packet: PhoenixOrderPacket, accounts: PhoenixRemainingAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
116
|
-
cancelAllTx(accounts: PhoenixRemainingAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
117
|
-
cancelOrdersByIdTx(orderIds: PhoenixOrderIds, accounts: PhoenixRemainingAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
118
|
-
cancelUpToTx(args: PhoenixCancelUpToInstruction, accounts: PhoenixRemainingAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
119
|
-
}
|
|
120
|
-
export declare class PhoenixClient implements ProtocolPolicyClient<PhoenixPolicy> {
|
|
121
|
-
readonly base: BaseClient;
|
|
122
|
-
readonly txBuilder: TxBuilder;
|
|
123
|
-
readonly phoenixApi: PhoenixApiClient;
|
|
124
|
-
constructor(base: BaseClient);
|
|
125
|
-
/** The ext_phoenix program id this client talks to. */
|
|
126
|
-
get programId(): PublicKey;
|
|
127
|
-
/** Bit flag identifying Phoenix inside the GLAM integration ACL bitmask. */
|
|
128
|
-
get protocolBitflag(): number;
|
|
129
|
-
/** PDA the ext_phoenix program signs CPIs with into Phoenix and Ember. */
|
|
130
|
-
getIntegrationAuthorityPda(): PublicKey;
|
|
131
|
-
/**
|
|
132
|
-
* PDA of a Phoenix trader account owned by the GLAM vault (defaults to the
|
|
133
|
-
* vault PDA as authority). `traderPdaIndex` selects the parent trader and
|
|
134
|
-
* `subaccountIndex` selects a child subaccount under that parent.
|
|
135
|
-
*/
|
|
136
|
-
getTraderPda(traderPdaIndex?: number, subaccountIndex?: number, authority?: PublicKey): PublicKey;
|
|
137
|
-
/** PDA of the spline-collection account associated with a Phoenix market. */
|
|
138
|
-
getSplineCollectionPda(market: PublicKey): PublicKey;
|
|
139
|
-
/** PDA of Phoenix's global-vault token account for a given mint. */
|
|
140
|
-
getGlobalVaultPda(mint: PublicKey): PublicKey;
|
|
141
|
-
/** PDA of the Ember exchange-state account that backs Phoenix conversions. */
|
|
142
|
-
getEmberStatePda(): PublicKey;
|
|
143
|
-
/** PDA of Ember's USDC vault that mints/burns canonical collateral. */
|
|
144
|
-
getEmberVaultPda(): PublicKey;
|
|
145
|
-
/**
|
|
146
|
-
* The three accounts every Phoenix CPI begins with (program, log authority,
|
|
147
|
-
* global config). `globalConfigWritable` toggles the writable flag on the
|
|
148
|
-
* global config — set true for instructions that mutate exchange state.
|
|
149
|
-
*/
|
|
150
|
-
getPhoenixRemainingPrefix(globalConfigWritable: boolean): AccountMeta[];
|
|
151
|
-
/**
|
|
152
|
-
* Remaining-accounts list for place/cancel/order-book CPIs against a single
|
|
153
|
-
* Phoenix market. Includes the trader PDA, perp asset map, trader indices,
|
|
154
|
-
* the market itself, and its spline collection.
|
|
155
|
-
*/
|
|
156
|
-
getMarketRemainingAccounts(snapshot: PhoenixSnapshot, market: PublicKey | string, indexes?: PhoenixTraderIndexes): AccountMeta[];
|
|
157
|
-
/**
|
|
158
|
-
* Remaining-accounts list for `update_trader_state` — settles funding for
|
|
159
|
-
* the trader and may evict it from the active-trader buffer once it no
|
|
160
|
-
* longer holds resting orders.
|
|
161
|
-
*/
|
|
162
|
-
getUpdateTraderStateRemainingAccounts(snapshot: PhoenixSnapshot, indexes?: PhoenixTraderIndexes): AccountMeta[];
|
|
163
|
-
/** Fetches the on-chain PhoenixPolicy stored under this vault, if any. */
|
|
164
|
-
fetchPolicy(): Promise<PhoenixPolicy | null>;
|
|
165
|
-
/** Writes the PhoenixPolicy (market allowlist, order types, etc.). */
|
|
166
|
-
setPolicy(policy: PhoenixPolicy, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
167
|
-
/** Deletes the stored PhoenixPolicy. Future Phoenix policy checks fail closed. */
|
|
168
|
-
clearPolicy(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
169
|
-
/**
|
|
170
|
-
* Creates a Phoenix trader account for the vault (parent or child subaccount)
|
|
171
|
-
* sized to hold `maxPositions`.
|
|
172
|
-
*/
|
|
173
|
-
registerTrader(params: PhoenixRegisterTraderParams, accounts?: PhoenixRegisterTraderAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
174
|
-
/**
|
|
175
|
-
* Settles funding for the vault's trader and may evict it from the active
|
|
176
|
-
* buffer when no resting orders remain. Idempotent housekeeping call.
|
|
177
|
-
*/
|
|
178
|
-
updateTraderState(accounts: PhoenixRemainingAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
179
|
-
/**
|
|
180
|
-
* Full deposit flow in one transaction: converts USDC to canonical
|
|
181
|
-
* collateral via Ember, then deposits the canonical amount into the vault's
|
|
182
|
-
* Phoenix trader account.
|
|
183
|
-
*/
|
|
184
|
-
deposit(amount: BN | number, txOptions?: TxOptions): Promise<string>;
|
|
185
|
-
/**
|
|
186
|
-
* Full withdraw flow in one transaction: withdraws canonical collateral
|
|
187
|
-
* from Phoenix and converts it back to USDC via Ember.
|
|
188
|
-
*/
|
|
189
|
-
withdraw(amount: BN | number, txOptions?: TxOptions): Promise<string>;
|
|
190
|
-
/**
|
|
191
|
-
* Phoenix-only `deposit_funds` (no Ember leg) — moves an already-canonical
|
|
192
|
-
* token balance from the vault's token account into Phoenix.
|
|
193
|
-
*/
|
|
194
|
-
depositFunds(params: PhoenixDepositFundsInstruction, accounts: PhoenixRemainingAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
195
|
-
/**
|
|
196
|
-
* Phoenix-only `withdraw_funds` (no Ember leg) — pulls canonical collateral
|
|
197
|
-
* out of Phoenix back to the vault's token account.
|
|
198
|
-
*/
|
|
199
|
-
withdrawFunds(params: PhoenixWithdrawFundsInstruction, accounts: PhoenixRemainingAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
200
|
-
/** Places a Phoenix limit order against the market in `accounts`. */
|
|
201
|
-
placeLimitOrder(packet: PhoenixOrderPacket, accounts: PhoenixRemainingAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
202
|
-
/** Places an immediate-or-cancel market order against the market. */
|
|
203
|
-
placeMarketOrder(packet: PhoenixOrderPacket, accounts: PhoenixRemainingAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
204
|
-
/** Cancels all resting orders the vault has on the given market. */
|
|
205
|
-
cancelAll(accounts: PhoenixRemainingAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
206
|
-
/** Cancels the specific resting orders identified by `orderIds`. */
|
|
207
|
-
cancelOrdersById(orderIds: PhoenixOrderIds, accounts: PhoenixRemainingAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
208
|
-
/**
|
|
209
|
-
* Cancels up to `num_orders_to_cancel` resting orders on a side, optionally
|
|
210
|
-
* bounded by a price tick limit.
|
|
211
|
-
*/
|
|
212
|
-
cancelUpTo(args: PhoenixCancelUpToInstruction, accounts: PhoenixRemainingAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
213
|
-
}
|
|
214
|
-
export {};
|
package/src/client/price.d.ts
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { AccountMeta, AddressLookupTableAccount, Commitment, PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
2
|
-
import { BN } from "@coral-xyz/anchor";
|
|
3
|
-
import { KaminoLendingClient, KaminoVaultsClient } from "./kamino";
|
|
4
|
-
import { BaseClient } from "./base";
|
|
5
|
-
import { StateModel } from "../models";
|
|
6
|
-
import { PkMap, PkSet } from "../utils";
|
|
7
|
-
import { KVaultState, Reserve } from "../deser";
|
|
8
|
-
import { JupiterApiClient, TokenListItem } from "../utils/jupiterApi";
|
|
9
|
-
import { BridgeClient } from "./bridge";
|
|
10
|
-
import { EpiClient } from "./epi";
|
|
11
|
-
import { LoopscaleBorrowClient, LoopscaleLendClient, LoopscaleVaultClient } from "./loopscale";
|
|
12
|
-
/**
|
|
13
|
-
* Represents a single asset holding within a vault.
|
|
14
|
-
*
|
|
15
|
-
* @param mintAddress - The SPL token mint address of the held asset
|
|
16
|
-
* @param decimals - Number of decimal places for the token (e.g., 6 for USDC, 9 for SOL)
|
|
17
|
-
* @param amount - Unsigned token amount in native units; direction (deposit/borrow) is in protocolMeta
|
|
18
|
-
* @param price - Current price of the asset denominated in the base asset (e.g., USD, SOL)
|
|
19
|
-
* @param priceMeta - Additional pricing context (e.g., source, slot, base asset). Default base asset, if not specified, is USD.
|
|
20
|
-
* @param protocol - Protocol identifier where the asset is allocated
|
|
21
|
-
* @param protocolMeta - Protocol-specific metadata (e.g., market index, position direction, reserve address)
|
|
22
|
-
*/
|
|
23
|
-
export declare class Holding {
|
|
24
|
-
readonly mintAddress: PublicKey;
|
|
25
|
-
readonly decimals: number;
|
|
26
|
-
readonly amount: BN;
|
|
27
|
-
readonly price: number;
|
|
28
|
-
readonly priceMeta: Record<string, any>;
|
|
29
|
-
readonly protocol: string;
|
|
30
|
-
readonly protocolMeta: Record<string, any>;
|
|
31
|
-
readonly uiAmount: number;
|
|
32
|
-
constructor(mintAddress: PublicKey, decimals: number, amount: BN, price: number, priceMeta: Record<string, any> | undefined, protocol: string, protocolMeta?: Record<string, any>);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Aggregates all holdings for a GLAM vault.
|
|
36
|
-
* Includes token balances and supported DeFi positions.
|
|
37
|
-
*
|
|
38
|
-
* @param vaultState - The vault's state account address (stores vault configuration)
|
|
39
|
-
* @param vaultPda - The vault's PDA that holds tokens and positions
|
|
40
|
-
* @param priceBaseAssetMint - The base asset mint used for pricing (e.g., PublicKey.default for USD, So11111111111111111111111111111111111111112 for SOL)
|
|
41
|
-
* @param slot - The Solana slot at which holdings were fetched
|
|
42
|
-
* @param timestamp - Unix timestamp (seconds) when holdings were fetched
|
|
43
|
-
* @param commitment - The Solana commitment level used for fetching account data
|
|
44
|
-
*/
|
|
45
|
-
export declare class VaultHoldings {
|
|
46
|
-
readonly vaultState: PublicKey;
|
|
47
|
-
readonly vaultPda: PublicKey;
|
|
48
|
-
readonly priceBaseAssetMint: PublicKey;
|
|
49
|
-
readonly slot: number;
|
|
50
|
-
readonly timestamp: number;
|
|
51
|
-
readonly commitment: Commitment;
|
|
52
|
-
holdings: Holding[];
|
|
53
|
-
constructor(vaultState: PublicKey, vaultPda: PublicKey, priceBaseAssetMint: PublicKey, slot: number, timestamp: number, commitment: Commitment);
|
|
54
|
-
add(holding: Holding): void;
|
|
55
|
-
toJson(): string;
|
|
56
|
-
}
|
|
57
|
-
type PricingChunk = {
|
|
58
|
-
ixs: TransactionInstruction[];
|
|
59
|
-
kaminoReserves: PublicKey[];
|
|
60
|
-
};
|
|
61
|
-
export declare class PriceClient {
|
|
62
|
-
readonly base: BaseClient;
|
|
63
|
-
readonly klend: KaminoLendingClient;
|
|
64
|
-
readonly kvaults: KaminoVaultsClient;
|
|
65
|
-
readonly bridge: BridgeClient;
|
|
66
|
-
readonly epi: EpiClient;
|
|
67
|
-
readonly loopscaleBorrow: LoopscaleBorrowClient;
|
|
68
|
-
readonly loopscaleLend: LoopscaleLendClient;
|
|
69
|
-
readonly loopscaleVault: LoopscaleVaultClient;
|
|
70
|
-
private readonly getJupiterApi;
|
|
71
|
-
private _stateModel;
|
|
72
|
-
private _lookupTables;
|
|
73
|
-
private _kaminoVaults;
|
|
74
|
-
private _priceVaultIxsQueue;
|
|
75
|
-
constructor(base: BaseClient, klend: KaminoLendingClient, kvaults: KaminoVaultsClient, bridge: BridgeClient, epi: EpiClient, loopscaleBorrow: LoopscaleBorrowClient, loopscaleLend: LoopscaleLendClient, loopscaleVault: LoopscaleVaultClient, getJupiterApi: () => JupiterApiClient);
|
|
76
|
-
get jupiterApi(): JupiterApiClient;
|
|
77
|
-
get cachedStateModel(): StateModel | null;
|
|
78
|
-
set cachedStateModel(stateModel: StateModel);
|
|
79
|
-
get lookupTables(): AddressLookupTableAccount[];
|
|
80
|
-
get kaminoVaults(): PublicKey[];
|
|
81
|
-
private getKaminoObligationReserveSets;
|
|
82
|
-
/**
|
|
83
|
-
* Fetches all holdings in the vault.
|
|
84
|
-
*
|
|
85
|
-
* The source of truth for external positions is the `externalPositions` array
|
|
86
|
-
* from the state account, which tracks:
|
|
87
|
-
* - Kamino obligation accounts (lending positions)
|
|
88
|
-
* - Kamino vault share ATAs (shares in kamino vaults)
|
|
89
|
-
*
|
|
90
|
-
* @param commitment Commitment level for fetching accounts
|
|
91
|
-
* @param priceBaseAssetMint Price reference/numeraire asset mint (default: PublicKey.default for USD).
|
|
92
|
-
* Pass a token mint (e.g., WSOL) to get prices denominated in that asset.
|
|
93
|
-
* @returns VaultHoldings object containing all holdings
|
|
94
|
-
*/
|
|
95
|
-
getVaultHoldings(commitment: Commitment, priceBaseAssetMint?: PublicKey): Promise<VaultHoldings>;
|
|
96
|
-
getPubkeysForTokenHoldings(externalPositionsSet: PkSet, commitment?: Commitment): Promise<PublicKey[]>;
|
|
97
|
-
/**
|
|
98
|
-
* Gets kamino obligation reserves from known obligation pubkeys.
|
|
99
|
-
*/
|
|
100
|
-
getPubkeysForKaminoHoldings(obligationPubkeys: PublicKey[], commitment?: Commitment): Promise<PkMap<PkSet>>;
|
|
101
|
-
/**
|
|
102
|
-
* Gets kamino vault states from known share ATA pubkeys.
|
|
103
|
-
* Used by getVaultHoldingsV2 to process vault shares from externalPositions.
|
|
104
|
-
*/
|
|
105
|
-
getKaminoVaultStatesFromAtas(shareAtaPubkeys: PublicKey[], commitment?: Commitment): Promise<PkMap<KVaultState>>;
|
|
106
|
-
/**
|
|
107
|
-
* Fetches token price from the prefetched map, falling back to Jupiter API if not found.
|
|
108
|
-
* @throws Error if price cannot be fetched from either source
|
|
109
|
-
*/
|
|
110
|
-
private getTokenPrice;
|
|
111
|
-
private getHoldingTokenPrice;
|
|
112
|
-
private getTokenMintDecimals;
|
|
113
|
-
getTokenHoldings(tokenAccountPubkeys: PublicKey[], accountsDataMap: PkMap<Buffer>, tokenPricesMap: PkMap<TokenListItem>, tokenMintDecimalsMap: PkMap<number>, priceSource: string): Promise<Holding[]>;
|
|
114
|
-
getKaminoLendHoldings(obligationPubkeys: Iterable<PublicKey>, reservesMap: PkMap<Reserve>, accountsDataMap: PkMap<Buffer>, tokenPricesMap: PkMap<TokenListItem>, priceSource: string): Promise<Holding[]>;
|
|
115
|
-
getKaminoVaultsHoldings(kvaultAtasAndStates: PkMap<KVaultState>, reservesMap: PkMap<Reserve>, accountsDataMap: PkMap<Buffer>, tokenPricesMap: PkMap<TokenListItem>, priceSource: string): Promise<Holding[]>;
|
|
116
|
-
/**
|
|
117
|
-
* Returns an instruction that prices Kamino obligations.
|
|
118
|
-
* If there are no Kamino obligations, returns null.
|
|
119
|
-
*/
|
|
120
|
-
priceKaminoObligationsIxs(): Promise<PricingChunk>;
|
|
121
|
-
priceKaminoVaultSharesIx(): Promise<PricingChunk | null>;
|
|
122
|
-
/**
|
|
123
|
-
* Returns an instruction that prices vault balance and tokens
|
|
124
|
-
*/
|
|
125
|
-
priceVaultTokensIx(): Promise<PricingChunk>;
|
|
126
|
-
/**
|
|
127
|
-
* Returns an instruction that prices stake accounts.
|
|
128
|
-
* If there are no stake accounts, returns null.
|
|
129
|
-
*/
|
|
130
|
-
priceStakeAccountsIx(): Promise<TransactionInstruction | null>;
|
|
131
|
-
private findPhoenixTraderAccounts;
|
|
132
|
-
private getPhoenixPerpAssetMap;
|
|
133
|
-
/**
|
|
134
|
-
* Returns the program instruction that prices Phoenix trader external positions.
|
|
135
|
-
* If there are no registered Phoenix trader accounts, returns null.
|
|
136
|
-
*/
|
|
137
|
-
pricePhoenixTradersIx(stateModel?: StateModel | null): Promise<TransactionInstruction | null>;
|
|
138
|
-
/**
|
|
139
|
-
* Returns Phoenix trader pricing instructions with required compute budget pre-instructions.
|
|
140
|
-
* If there are no registered Phoenix trader accounts, returns null.
|
|
141
|
-
*/
|
|
142
|
-
pricePhoenixTradersIxs(stateModel?: StateModel | null): Promise<PricingChunk | null>;
|
|
143
|
-
/**
|
|
144
|
-
* Returns the program instruction that prices Loopscale loan external positions.
|
|
145
|
-
* If there are no registered Loopscale loans, returns null.
|
|
146
|
-
*
|
|
147
|
-
* Remaining accounts are laid out as N loan accounts followed by the oracle
|
|
148
|
-
* accounts needed to price the loans' collateral and debt.
|
|
149
|
-
*/
|
|
150
|
-
priceLoopscaleLoansIx(): Promise<TransactionInstruction | null>;
|
|
151
|
-
/**
|
|
152
|
-
* Returns the program instruction that prices Loopscale strategy external positions.
|
|
153
|
-
* If there are no registered Loopscale strategies, returns null.
|
|
154
|
-
*
|
|
155
|
-
* Remaining accounts are laid out as N strategy accounts followed by the
|
|
156
|
-
* oracle accounts needed to price the strategies' principal mints.
|
|
157
|
-
*/
|
|
158
|
-
priceLoopscaleStrategiesIx(): Promise<TransactionInstruction | null>;
|
|
159
|
-
/**
|
|
160
|
-
* Returns the program instruction that prices registered Loopscale vault LP
|
|
161
|
-
* token accounts and registered staked LP positions.
|
|
162
|
-
* If there are no registered Loopscale vault LP positions, returns null.
|
|
163
|
-
*
|
|
164
|
-
* Remaining accounts are laid out as N (vault, vault strategy, GLAM vault LP
|
|
165
|
-
* ATA) groups for vaults with tracked LP or stake positions, followed by
|
|
166
|
-
* VaultStake accounts, followed by oracle accounts.
|
|
167
|
-
*/
|
|
168
|
-
priceLoopscaleVaultPositionsIx(): Promise<TransactionInstruction | null>;
|
|
169
|
-
priceOrcaWhirlpoolPositionsIxs(stateModel?: StateModel | null): Promise<PricingChunk | null>;
|
|
170
|
-
priceVaultIxs(): Promise<TransactionInstruction[]>;
|
|
171
|
-
private enqueuePriceVaultIxs;
|
|
172
|
-
private priceManagedTransfersIxs;
|
|
173
|
-
private priceEpiValidatedPositionsIx;
|
|
174
|
-
private _priceVaultIxsImpl;
|
|
175
|
-
validateAumIx(): Promise<TransactionInstruction>;
|
|
176
|
-
getBaseAssetOracle(): Promise<PublicKey>;
|
|
177
|
-
remainingAccountsForPricingVaultAssets(): Promise<[
|
|
178
|
-
AccountMeta[],
|
|
179
|
-
PublicKey[]
|
|
180
|
-
]>;
|
|
181
|
-
}
|
|
182
|
-
export {};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { BN } from "@coral-xyz/anchor";
|
|
2
|
-
import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction } from "@solana/web3.js";
|
|
3
|
-
import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
|
|
4
|
-
import { MarinadeClient } from "./marinade";
|
|
5
|
-
import { StakeClient } from "./stake";
|
|
6
|
-
interface StakePoolAccountData {
|
|
7
|
-
programId: PublicKey;
|
|
8
|
-
depositAuthority: PublicKey;
|
|
9
|
-
withdrawAuthority: PublicKey;
|
|
10
|
-
poolMint: PublicKey;
|
|
11
|
-
feeAccount: PublicKey;
|
|
12
|
-
reserveStake: PublicKey;
|
|
13
|
-
tokenProgramId: PublicKey;
|
|
14
|
-
validatorList: PublicKey;
|
|
15
|
-
}
|
|
16
|
-
declare class TxBuilder extends BaseTxBuilder<StakePoolClient> {
|
|
17
|
-
depositSolIxs(stakePool: PublicKey, lamports: BN, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
|
|
18
|
-
depositSolTx(stakePool: PublicKey, lamports: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
19
|
-
depositStakeIxs(stakePool: PublicKey, stakeAccount: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
|
|
20
|
-
depositStakeTx(stakePool: PublicKey, stakeAccount: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
21
|
-
withdrawStakeIxs(stakePool: PublicKey, amount: BN, deactivate: boolean | undefined, glamSigner: PublicKey): Promise<[TransactionInstruction[], PublicKey]>;
|
|
22
|
-
withdrawStakeTx(stakePool: PublicKey, amount: BN, deactivate?: boolean, txOptions?: TxOptions): Promise<[VersionedTransaction, PublicKey]>;
|
|
23
|
-
}
|
|
24
|
-
export declare class StakePoolClient {
|
|
25
|
-
readonly base: BaseClient;
|
|
26
|
-
readonly stake: StakeClient;
|
|
27
|
-
readonly marinade: MarinadeClient;
|
|
28
|
-
readonly txBuilder: TxBuilder;
|
|
29
|
-
constructor(base: BaseClient, stake: StakeClient, marinade: MarinadeClient);
|
|
30
|
-
unstake(asset: PublicKey, amount: number | BN, deactivate?: boolean, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
31
|
-
depositSol(stakePool: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
32
|
-
depositStake(stakePool: PublicKey, stakeAccount: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
33
|
-
withdrawStake(stakePool: PublicKey, amount: BN, deactivate?: boolean, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
34
|
-
getStakePoolWithdrawAuthority(programId: PublicKey, stakePool: PublicKey): PublicKey;
|
|
35
|
-
getStakePoolDepositAuthority(programId: PublicKey, stakePool: PublicKey): PublicKey;
|
|
36
|
-
getStakeAccountVoter(stakeAccount: PublicKey): Promise<PublicKey | null>;
|
|
37
|
-
getStakePoolAccountData(stakePool: PublicKey): Promise<StakePoolAccountData>;
|
|
38
|
-
}
|
|
39
|
-
export {};
|
package/src/client/stake.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { BN } from "@coral-xyz/anchor";
|
|
2
|
-
import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction } from "@solana/web3.js";
|
|
3
|
-
import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
|
|
4
|
-
declare class TxBuilder extends BaseTxBuilder<StakeClient> {
|
|
5
|
-
initializeAndDelegateStakeIxs(vote: PublicKey, amount: BN, glamSigner: PublicKey): Promise<[TransactionInstruction[], PublicKey]>;
|
|
6
|
-
initializeAndDelegateStakeTx(vote: PublicKey, amount: BN, txOptions?: TxOptions): Promise<[VersionedTransaction, PublicKey]>;
|
|
7
|
-
deactivateStakesIx(stakeAccounts: PublicKey[], glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
8
|
-
deactivateStakesTx(stakeAccounts: PublicKey[], txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
9
|
-
withdrawStakesIx(stakeAccounts: PublicKey[], glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
10
|
-
withdrawStakesTx(stakeAccounts: PublicKey[], txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
11
|
-
mergeStakeIx(destinationStake: PublicKey, sourceStake: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
12
|
-
mergeStakeTx(destinationStake: PublicKey, sourceStake: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
13
|
-
splitStakeIxs(existingStake: PublicKey, lamports: BN, glamSigner: PublicKey): Promise<[TransactionInstruction[], PublicKey]>;
|
|
14
|
-
splitStakeTx(existingStake: PublicKey, lamports: BN, txOptions?: TxOptions): Promise<[VersionedTransaction, PublicKey]>;
|
|
15
|
-
moveStakeIx(sourceStake: PublicKey, destinationStake: PublicKey, amount: BN, glamSigner: PublicKey): Promise<any>;
|
|
16
|
-
moveStakeTx(sourceStake: PublicKey, destinationStake: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
17
|
-
}
|
|
18
|
-
export declare class StakeClient {
|
|
19
|
-
readonly base: BaseClient;
|
|
20
|
-
readonly txBuilder: TxBuilder;
|
|
21
|
-
constructor(base: BaseClient);
|
|
22
|
-
initializeAndDelegateStake(vote: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
23
|
-
deactivate(stakeAccounts: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
24
|
-
withdraw(stakeAccounts: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
25
|
-
merge(destinationStake: PublicKey, sourceStake: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
26
|
-
split(existingStake: PublicKey, lamports: BN, txOptions?: TxOptions): Promise<{
|
|
27
|
-
newStake: PublicKey;
|
|
28
|
-
txSig: TransactionSignature;
|
|
29
|
-
}>;
|
|
30
|
-
move(sourceStake: PublicKey, destinationStake: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
31
|
-
getStakeAccountVoter(stakeAccount: PublicKey): Promise<PublicKey | null>;
|
|
32
|
-
createStakeAccount(signer: PublicKey): Promise<[PublicKey, TransactionInstruction]>;
|
|
33
|
-
}
|
|
34
|
-
export {};
|
package/src/client/state.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { VersionedTransaction, TransactionSignature, PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
2
|
-
import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
|
|
3
|
-
import { StateIdlModel, StateAccountType } from "../models";
|
|
4
|
-
export type InitStateParams = {
|
|
5
|
-
accountType: StateAccountType;
|
|
6
|
-
name: number[];
|
|
7
|
-
baseAssetMint: PublicKey;
|
|
8
|
-
} & Partial<StateIdlModel>;
|
|
9
|
-
/**
|
|
10
|
-
* A subset of StateIdlModel fields that are updatable using updateState instruction
|
|
11
|
-
*/
|
|
12
|
-
export type UpdateStateParams = {
|
|
13
|
-
name?: number[];
|
|
14
|
-
owner?: PublicKey;
|
|
15
|
-
portfolioManagerName?: number[];
|
|
16
|
-
timelockDuration?: number;
|
|
17
|
-
assets?: PublicKey[];
|
|
18
|
-
borrowable?: PublicKey[];
|
|
19
|
-
};
|
|
20
|
-
declare class TxBuilder extends BaseTxBuilder<StateClient> {
|
|
21
|
-
initializeIx(params: InitStateParams, glamSigner: PublicKey): Promise<[TransactionInstruction, PublicKey]>;
|
|
22
|
-
initializeTx(params: InitStateParams, txOptions?: TxOptions): Promise<[VersionedTransaction, PublicKey]>;
|
|
23
|
-
updateIx(params: UpdateStateParams, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
24
|
-
updateTx(params: UpdateStateParams, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
25
|
-
extendIx(newBytes: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
26
|
-
extendTx(newBytes: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
27
|
-
closeIx(glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
28
|
-
closeTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
29
|
-
}
|
|
30
|
-
export declare class StateClient {
|
|
31
|
-
readonly base: BaseClient;
|
|
32
|
-
readonly txBuilder: TxBuilder;
|
|
33
|
-
constructor(base: BaseClient);
|
|
34
|
-
/**
|
|
35
|
-
* Creates a new GLAM state
|
|
36
|
-
*/
|
|
37
|
-
initialize(params: InitStateParams, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
38
|
-
/**
|
|
39
|
-
* Updates the GLAM state account.
|
|
40
|
-
*
|
|
41
|
-
* If no timelock , the updates will be applied immediately.
|
|
42
|
-
* If timelock is enabled, the updates will be staged and can be applied after the timelock period.
|
|
43
|
-
*
|
|
44
|
-
* Only the fields provided in `params` will be updated; omitted fields remain unchanged.
|
|
45
|
-
*/
|
|
46
|
-
update(params: UpdateStateParams, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
47
|
-
/**
|
|
48
|
-
* Extends GLAM state account size
|
|
49
|
-
*/
|
|
50
|
-
extend(newBytes: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
51
|
-
/**
|
|
52
|
-
* Closes GLAM state account
|
|
53
|
-
*/
|
|
54
|
-
close(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
55
|
-
}
|
|
56
|
-
export {};
|
package/src/client/timelock.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { VersionedTransaction, TransactionSignature, PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
2
|
-
import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
|
|
3
|
-
import { StateClient } from "./state";
|
|
4
|
-
declare class TxBuilder extends BaseTxBuilder<TimelockClient> {
|
|
5
|
-
applyStateTimelockIx(glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
6
|
-
applyStateTimelockTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
7
|
-
applyMintTimelockIx(glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
8
|
-
applyMintTimelockTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
9
|
-
cancelTimelockIx(glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
10
|
-
cancelTimelockTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
11
|
-
}
|
|
12
|
-
export declare class TimelockClient {
|
|
13
|
-
readonly base: BaseClient;
|
|
14
|
-
readonly stateClient: StateClient;
|
|
15
|
-
readonly txBuilder: TxBuilder;
|
|
16
|
-
constructor(base: BaseClient, stateClient: StateClient);
|
|
17
|
-
/**
|
|
18
|
-
* Sets the timelock duration in seconds
|
|
19
|
-
* @param durationSeconds Duration in seconds for timelock period
|
|
20
|
-
*/
|
|
21
|
-
set(durationSeconds: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
22
|
-
/**
|
|
23
|
-
* Applies pending timelock updates after timelock expires.
|
|
24
|
-
*/
|
|
25
|
-
apply(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
26
|
-
/**
|
|
27
|
-
* Cancels pending timelock updates
|
|
28
|
-
*/
|
|
29
|
-
cancel(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
30
|
-
}
|
|
31
|
-
export {};
|
package/src/client/vault.d.ts
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { BN } from "@coral-xyz/anchor";
|
|
2
|
-
import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction } from "@solana/web3.js";
|
|
3
|
-
import { BaseClient, BaseTxBuilder, ProtocolPolicyClient, ProtocolPolicyTxBuilder, TxOptions } from "./base";
|
|
4
|
-
import { TransferPolicy } from "../deser/integrationPolicies";
|
|
5
|
-
declare class TxBuilder extends BaseTxBuilder<VaultClient> implements ProtocolPolicyTxBuilder<TransferPolicy> {
|
|
6
|
-
setPolicyIx(policy: TransferPolicy, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
7
|
-
setPolicyTx(policy: TransferPolicy, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
8
|
-
clearPolicyIx(signer?: PublicKey): Promise<TransactionInstruction>;
|
|
9
|
-
clearPolicyTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
10
|
-
wrapIxs(amount: BN, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
|
|
11
|
-
wrapTx(amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
12
|
-
unwrapIx(glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
13
|
-
unwrapTx(txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
14
|
-
systemTransferIx(amount: BN, to: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
15
|
-
systemTransferTx(amount: BN, to: PublicKey, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
16
|
-
/**
|
|
17
|
-
* Returns an instruction that closes the specified vault token account
|
|
18
|
-
*/
|
|
19
|
-
closeTokenAccountIx(tokenAccount: PublicKey, tokenProgram: PublicKey, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
20
|
-
closeTokenAccountsTx(pubkeys: PublicKey[], txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
21
|
-
depositSolIxs(lamports: number | BN, wrap: boolean, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
|
|
22
|
-
depositSolTx(lamports: number | BN, wrap?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
23
|
-
depositIxs(asset: PublicKey, amount: number | BN, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
|
|
24
|
-
depositTx(asset: PublicKey, amount: number | BN, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
25
|
-
/**
|
|
26
|
-
* Transfers tokens held by the vault to the specified recipient
|
|
27
|
-
*/
|
|
28
|
-
tokenTransferIxs(mint: PublicKey, amount: number | BN, to: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
|
|
29
|
-
tokenTransferTx(mint: PublicKey, amount: number | BN, to: PublicKey, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
30
|
-
}
|
|
31
|
-
export declare class VaultClient implements ProtocolPolicyClient<TransferPolicy> {
|
|
32
|
-
readonly base: BaseClient;
|
|
33
|
-
readonly txBuilder: TxBuilder;
|
|
34
|
-
constructor(base: BaseClient);
|
|
35
|
-
fetchPolicy(): Promise<TransferPolicy | null>;
|
|
36
|
-
setPolicy(policy: TransferPolicy, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
37
|
-
clearPolicy(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
38
|
-
/**
|
|
39
|
-
* Wraps vault SOL to wSOL
|
|
40
|
-
*
|
|
41
|
-
* @param amount
|
|
42
|
-
* @param txOptions
|
|
43
|
-
*/
|
|
44
|
-
wrap(amount: BN | number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
45
|
-
/**
|
|
46
|
-
* Unwraps vault wSOL to SOL
|
|
47
|
-
*
|
|
48
|
-
* @param txOptions
|
|
49
|
-
*/
|
|
50
|
-
unwrap(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
51
|
-
/**
|
|
52
|
-
* Transfers SOL from vault to another account
|
|
53
|
-
*
|
|
54
|
-
* @param amount
|
|
55
|
-
* @param to
|
|
56
|
-
* @param txOptions
|
|
57
|
-
*/
|
|
58
|
-
systemTransfer(amount: BN | number, to: PublicKey | string, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
59
|
-
/**
|
|
60
|
-
* Transfers token from vault to another account
|
|
61
|
-
*
|
|
62
|
-
* @param mint
|
|
63
|
-
* @param amount
|
|
64
|
-
* @param txOptions
|
|
65
|
-
*/
|
|
66
|
-
tokenTransfer(mint: PublicKey | string, amount: number | BN, to: PublicKey | string, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
67
|
-
/**
|
|
68
|
-
* Closes multiple vault token accounts
|
|
69
|
-
*
|
|
70
|
-
* @param tokenAccounts
|
|
71
|
-
* @param txOptions
|
|
72
|
-
*/
|
|
73
|
-
closeTokenAccounts(tokenAccounts: PublicKey[] | string[], txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
74
|
-
/**
|
|
75
|
-
* Deposits token to vault
|
|
76
|
-
*
|
|
77
|
-
* @param mint Token mint
|
|
78
|
-
* @param amount
|
|
79
|
-
* @param txOptions
|
|
80
|
-
*/
|
|
81
|
-
deposit(mint: PublicKey | string, amount: number | BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
82
|
-
/**
|
|
83
|
-
* Deposits SOL to vault
|
|
84
|
-
*
|
|
85
|
-
* @param lamports
|
|
86
|
-
* @param wrap Whether to wrap SOL to wSOL or not
|
|
87
|
-
* @param txOptions
|
|
88
|
-
*/
|
|
89
|
-
depositSol(lamports: number | BN, wrap?: boolean, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
90
|
-
/**
|
|
91
|
-
* Generates instructions to wrap SOL into wSOL if the vault doesn't have enough wSOL
|
|
92
|
-
*
|
|
93
|
-
* @param lamports Desired amount of wSOL
|
|
94
|
-
* @returns Array of instructions, empty if wSOL is sufficient
|
|
95
|
-
*/
|
|
96
|
-
maybeWrapSol(lamports: number | BN, signer?: PublicKey): Promise<TransactionInstruction[]>;
|
|
97
|
-
}
|
|
98
|
-
export {};
|