@glamsystems/glam-sdk 1.1.0-alpha.6 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/buffer-layout.d.ts +88 -0
- package/index.cjs.d.ts +1 -0
- package/index.cjs.js +1 -92594
- package/index.esm.d.ts +1 -0
- package/index.esm.js +1 -92146
- package/package.json +29 -17
- package/src/assets.d.ts +39 -0
- package/src/client/access.d.ts +57 -0
- package/src/client/base.d.ts +234 -0
- package/src/client/bridge.d.ts +205 -0
- package/src/client/bridgeRegistry.d.ts +32 -0
- package/src/client/cctp.d.ts +164 -0
- package/src/client/epi.d.ts +228 -0
- package/src/client/fees.d.ts +33 -0
- package/src/client/invest.d.ts +37 -0
- package/src/client/jupiter-lend/borrow.d.ts +92 -0
- package/src/client/jupiter-lend/earn.d.ts +64 -0
- package/src/client/jupiter-lend/index.d.ts +3 -0
- package/src/client/jupiter-lend/shared.d.ts +129 -0
- package/src/client/jupiter.d.ts +53 -0
- package/src/client/kamino/farm.d.ts +39 -0
- package/src/client/kamino/index.d.ts +4 -0
- package/src/client/kamino/lending.d.ts +94 -0
- package/src/client/kamino/types.d.ts +56 -0
- package/src/client/kamino/vaults.d.ts +39 -0
- package/src/client/loopscale/borrow.d.ts +118 -0
- package/src/client/loopscale/core.d.ts +604 -0
- package/src/client/loopscale/index.d.ts +5 -0
- package/src/client/loopscale/lend.d.ts +123 -0
- package/src/client/loopscale/vault.d.ts +43 -0
- package/src/client/marinade.d.ts +42 -0
- package/src/client/mint.d.ts +143 -0
- package/src/client/orca.d.ts +255 -0
- package/src/client/phoenix.d.ts +214 -0
- package/src/client/price.d.ts +182 -0
- package/src/client/stake-pool.d.ts +39 -0
- package/src/client/stake.d.ts +34 -0
- package/src/client/state.d.ts +56 -0
- package/src/client/timelock.d.ts +31 -0
- package/src/client/vault.d.ts +98 -0
- package/src/client.d.ts +82 -0
- package/src/clientConfig.d.ts +32 -0
- package/src/constants.d.ts +111 -0
- package/src/deser/base.d.ts +18 -0
- package/src/deser/index.d.ts +4 -0
- package/src/deser/integrationPolicies.d.ts +195 -0
- package/src/deser/kaminoLayouts.d.ts +264 -0
- package/src/deser/loopscaleLayouts.d.ts +157 -0
- package/src/deser/tokenAclLayouts.d.ts +67 -0
- package/src/error.d.ts +29 -0
- package/src/glamExports.d.ts +6260 -0
- package/src/globalConfig.d.ts +27 -0
- package/src/index.d.ts +24 -0
- package/src/models/acl.d.ts +43 -0
- package/src/models/index.d.ts +8 -0
- package/src/models/mint.d.ts +57 -0
- package/src/models/state.d.ts +94 -0
- package/src/models/types.d.ts +28 -0
- package/src/protocols.d.ts +29 -0
- package/src/utils/accounts.d.ts +71 -0
- package/src/utils/bitmask.d.ts +53 -0
- package/src/utils/blockhash.d.ts +11 -0
- package/src/utils/common.d.ts +73 -0
- package/src/utils/computeBudget.d.ts +15 -0
- package/src/utils/evm.d.ts +10 -0
- package/src/utils/fraction.d.ts +29 -0
- package/src/utils/glamPDAs.d.ts +15 -0
- package/src/utils/helius.d.ts +66 -0
- package/src/utils/index.d.ts +17 -0
- package/src/utils/jupiterApi.d.ts +95 -0
- package/src/utils/lookupTables.d.ts +83 -0
- package/src/utils/phoenixApi.d.ts +146 -0
- package/src/utils/pkmap.d.ts +87 -0
- package/src/utils/pkset.d.ts +73 -0
- package/src/utils/positionCategorizer.d.ts +38 -0
- package/src/utils/rpc.d.ts +18 -0
- package/src/utils/timelock.d.ts +52 -0
- package/src/utils/transaction.d.ts +13 -0
- package/target/idl/ext_bridge-staging.json +2379 -0
- package/target/idl/ext_bridge.json +2379 -0
- package/target/idl/ext_drift.json +5464 -0
- package/target/idl/ext_epi-staging.json +2862 -0
- package/target/idl/ext_epi.json +2862 -0
- package/target/idl/ext_loopscale-staging.json +4708 -0
- package/target/idl/ext_loopscale.json +4708 -0
- package/target/idl/ext_marinade-staging.json +1587 -0
- package/target/idl/ext_phoenix-staging.json +3525 -0
- package/target/idl/ext_phoenix.json +3525 -0
- package/target/idl/mock_layerzero_endpoint.json +144 -0
- package/target/idl/mock_layerzero_oft.json +155 -0
- package/target/idl/mock_wormhole_verify_vaa_shim.json +58 -0
- package/target/types/ext_bridge-staging.d.ts +2385 -0
- package/target/types/ext_bridge-staging.ts +2385 -0
- package/target/types/ext_bridge.d.ts +2385 -0
- package/target/types/ext_bridge.ts +2385 -0
- package/target/types/ext_cctp-staging.d.ts +1268 -0
- package/target/types/ext_cctp.d.ts +1268 -0
- package/target/types/ext_drift.d.ts +5470 -0
- package/target/types/ext_drift.ts +5470 -0
- package/target/types/ext_epi-staging.d.ts +2868 -0
- package/target/types/ext_epi-staging.ts +2868 -0
- package/target/types/ext_epi.d.ts +2868 -0
- package/target/types/ext_epi.ts +2868 -0
- package/target/types/ext_jupiter-staging.d.ts +1966 -0
- package/target/types/ext_jupiter.d.ts +1966 -0
- package/target/types/ext_kamino-staging.d.ts +3433 -0
- package/target/types/ext_kamino.d.ts +3433 -0
- package/target/types/ext_loopscale-staging.d.ts +4714 -0
- package/target/types/ext_loopscale-staging.ts +4714 -0
- package/target/types/ext_loopscale.d.ts +4714 -0
- package/target/types/ext_loopscale.ts +4714 -0
- package/target/types/ext_marinade-staging.d.ts +1593 -0
- package/target/types/ext_marinade-staging.ts +1593 -0
- package/target/types/ext_marinade.d.ts +1593 -0
- package/target/types/ext_orca-staging.d.ts +2829 -0
- package/target/types/ext_orca.d.ts +2829 -0
- package/target/types/ext_phoenix-staging.d.ts +3531 -0
- package/target/types/ext_phoenix-staging.ts +3531 -0
- package/target/types/ext_phoenix.d.ts +3531 -0
- package/target/types/ext_phoenix.ts +3531 -0
- package/target/types/ext_spl-staging.d.ts +1274 -0
- package/target/types/ext_spl.d.ts +1274 -0
- package/target/types/ext_stake_pool-staging.d.ts +1622 -0
- package/target/types/ext_stake_pool.d.ts +1622 -0
- package/target/types/glam_config.d.ts +755 -0
- package/target/types/glam_mint-staging.d.ts +8802 -0
- package/target/types/glam_mint.d.ts +6349 -0
- package/target/types/glam_policies.d.ts +477 -0
- package/target/types/glam_protocol-staging.d.ts +3362 -0
- package/target/types/glam_protocol.d.ts +2783 -0
- package/target/types/mock_layerzero_endpoint.d.ts +150 -0
- package/target/types/mock_layerzero_endpoint.ts +150 -0
- package/target/types/mock_layerzero_oft.d.ts +161 -0
- package/target/types/mock_layerzero_oft.ts +161 -0
- package/target/types/mock_wormhole_verify_vaa_shim.d.ts +64 -0
- package/target/types/mock_wormhole_verify_vaa_shim.ts +64 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { BN } from "@coral-xyz/anchor";
|
|
2
|
+
import { Commitment, Keypair, PublicKey, TransactionInstruction, TransactionSignature } from "@solana/web3.js";
|
|
3
|
+
import { BaseClient, type ProtocolPolicyClient, type TxOptions } from "../base";
|
|
4
|
+
import { LoopscaleLendingPolicy } from "../../deser/integrationPolicies";
|
|
5
|
+
import { LoopscaleLoan, LoopscaleMarketInformation, LoopscaleStrategy } from "../../deser";
|
|
6
|
+
import { CloseStrategyAccounts, CreateStrategyParams, DepositStrategyAccounts, LoopscaleApiCollateralTermUpdate, LoopscaleApiUpdateStrategyParams, LoopscaleCoreClient, LoopscaleLendTxBuilder, LoopscaleMappedTransaction, LoopscaleMultiCollateralTermsUpdateParams, LoopscaleSellLedgerTerms, LoopscaleStrategyWithMarket, PriceStrategiesAccounts, SellLedgerAccounts, SellLedgerParams, WithdrawStrategyAccounts } from "./core";
|
|
7
|
+
export type CreateStrategyResult = {
|
|
8
|
+
nonce: PublicKey;
|
|
9
|
+
strategy: PublicKey;
|
|
10
|
+
signature: TransactionSignature;
|
|
11
|
+
signatures: TransactionSignature[];
|
|
12
|
+
};
|
|
13
|
+
export type PriceStrategiesParams = {
|
|
14
|
+
commitment?: Commitment;
|
|
15
|
+
solUsdOracle?: PublicKey;
|
|
16
|
+
baseAssetOracle?: PublicKey;
|
|
17
|
+
};
|
|
18
|
+
export declare class LoopscaleLendClient implements ProtocolPolicyClient<LoopscaleLendingPolicy> {
|
|
19
|
+
private readonly core;
|
|
20
|
+
readonly txBuilder: LoopscaleLendTxBuilder;
|
|
21
|
+
constructor(core: LoopscaleCoreClient);
|
|
22
|
+
get base(): BaseClient;
|
|
23
|
+
get programId(): PublicKey;
|
|
24
|
+
get integrationAuthorityPda(): PublicKey;
|
|
25
|
+
getEventAuthorityPda(): PublicKey;
|
|
26
|
+
getStrategyPda(nonce: PublicKey): PublicKey;
|
|
27
|
+
getStrategyTokenAta(strategy: PublicKey, mint: PublicKey, tokenProgram?: PublicKey): PublicKey;
|
|
28
|
+
fetchPolicy(): Promise<LoopscaleLendingPolicy | null>;
|
|
29
|
+
setPolicy(policy: LoopscaleLendingPolicy, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
30
|
+
clearPolicy(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
31
|
+
fetchMarketInformation(marketInformation: PublicKey): Promise<LoopscaleMarketInformation>;
|
|
32
|
+
fetchStrategy(strategy: PublicKey): Promise<LoopscaleStrategy>;
|
|
33
|
+
fetchOwnedStrategy(strategy: PublicKey, lender?: PublicKey): Promise<LoopscaleStrategy>;
|
|
34
|
+
fetchRegisteredStrategies(commitment?: Commitment): Promise<LoopscaleStrategy[]>;
|
|
35
|
+
fetchStrategyMarket(strategy: PublicKey | LoopscaleStrategy): Promise<LoopscaleMarketInformation>;
|
|
36
|
+
fetchOwnedStrategyWithMarket(strategy: PublicKey, lender?: PublicKey): Promise<LoopscaleStrategyWithMarket>;
|
|
37
|
+
assertStrategyClosable(strategy: LoopscaleStrategy): void;
|
|
38
|
+
resolveSellLedgerMarketAccounts(params: {
|
|
39
|
+
loan: PublicKey | LoopscaleLoan;
|
|
40
|
+
ledgerIndex: number;
|
|
41
|
+
newStrategy: PublicKey | LoopscaleStrategy;
|
|
42
|
+
}): Promise<LoopscaleSellLedgerTerms>;
|
|
43
|
+
buildApiSellLedgerIxs(params: {
|
|
44
|
+
loan: PublicKey;
|
|
45
|
+
oldStrategy: PublicKey;
|
|
46
|
+
newStrategy: PublicKey;
|
|
47
|
+
ledgerIndex: number;
|
|
48
|
+
expectedSalePrice: BN;
|
|
49
|
+
assetIndexGuidance: number[];
|
|
50
|
+
}): Promise<TransactionInstruction[]>;
|
|
51
|
+
buildApiDepositStrategyIxs(params: {
|
|
52
|
+
strategy: PublicKey;
|
|
53
|
+
amount: BN;
|
|
54
|
+
}): Promise<TransactionInstruction[]>;
|
|
55
|
+
buildApiWithdrawStrategyIxs(params: {
|
|
56
|
+
strategy: PublicKey;
|
|
57
|
+
principalMint?: PublicKey;
|
|
58
|
+
amount: BN;
|
|
59
|
+
withdrawAll: boolean;
|
|
60
|
+
}): Promise<TransactionInstruction[]>;
|
|
61
|
+
buildApiCloseStrategyIxs(params: {
|
|
62
|
+
strategy: PublicKey;
|
|
63
|
+
}): Promise<TransactionInstruction[]>;
|
|
64
|
+
buildApiUpdateStrategyTxs(params: {
|
|
65
|
+
strategy: PublicKey;
|
|
66
|
+
collateralTerms?: LoopscaleApiCollateralTermUpdate;
|
|
67
|
+
updateParams?: LoopscaleApiUpdateStrategyParams;
|
|
68
|
+
}): Promise<LoopscaleMappedTransaction[]>;
|
|
69
|
+
buildApiCreateStrategyTxs(params: CreateStrategyParams & {
|
|
70
|
+
amount: BN;
|
|
71
|
+
collateralTerms: LoopscaleMultiCollateralTermsUpdateParams[];
|
|
72
|
+
}, accounts: {
|
|
73
|
+
marketInformation: PublicKey;
|
|
74
|
+
principalMint: PublicKey;
|
|
75
|
+
nonce: Keypair;
|
|
76
|
+
}): Promise<{
|
|
77
|
+
nonce: Keypair;
|
|
78
|
+
strategy: PublicKey;
|
|
79
|
+
txs: LoopscaleMappedTransaction[];
|
|
80
|
+
}>;
|
|
81
|
+
private replaceApiCreateStrategyAccounts;
|
|
82
|
+
/**
|
|
83
|
+
* Creates a strategy account using local ix builder
|
|
84
|
+
*
|
|
85
|
+
* @param params
|
|
86
|
+
* @param accounts
|
|
87
|
+
* @param txOptions
|
|
88
|
+
* @returns
|
|
89
|
+
*/
|
|
90
|
+
createStrategy(params: CreateStrategyParams, accounts: {
|
|
91
|
+
marketInformation: PublicKey;
|
|
92
|
+
principalMint: PublicKey;
|
|
93
|
+
nonce?: Keypair;
|
|
94
|
+
}, txOptions?: TxOptions): Promise<CreateStrategyResult>;
|
|
95
|
+
/**
|
|
96
|
+
* Creates a strategy account and deposits initial principal using API
|
|
97
|
+
*
|
|
98
|
+
* @param params
|
|
99
|
+
* @param accounts
|
|
100
|
+
* @param txOptions
|
|
101
|
+
* @returns
|
|
102
|
+
*/
|
|
103
|
+
createAndDepositStrategy(params: CreateStrategyParams & {
|
|
104
|
+
amount: BN;
|
|
105
|
+
collateralTerms: LoopscaleMultiCollateralTermsUpdateParams[];
|
|
106
|
+
}, accounts: {
|
|
107
|
+
marketInformation: PublicKey;
|
|
108
|
+
principalMint: PublicKey;
|
|
109
|
+
nonce?: Keypair;
|
|
110
|
+
}, txOptions?: TxOptions): Promise<CreateStrategyResult>;
|
|
111
|
+
depositStrategy(amount: BN, accounts: DepositStrategyAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
112
|
+
updateStrategy(params: {
|
|
113
|
+
strategy: PublicKey;
|
|
114
|
+
collateralTerms?: LoopscaleApiCollateralTermUpdate;
|
|
115
|
+
updateParams?: LoopscaleApiUpdateStrategyParams;
|
|
116
|
+
}, txOptions?: TxOptions): Promise<TransactionSignature[]>;
|
|
117
|
+
withdrawStrategy(amount: BN, withdrawAll: boolean, accounts: WithdrawStrategyAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
118
|
+
closeStrategy(accounts: CloseStrategyAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
119
|
+
sellLedger(params: SellLedgerParams, accounts: SellLedgerAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
120
|
+
priceStrategiesIx(params?: PriceStrategiesParams): Promise<TransactionInstruction | null>;
|
|
121
|
+
priceStrategies(params?: PriceStrategiesParams, txOptions?: TxOptions): Promise<TransactionSignature | null>;
|
|
122
|
+
getPriceStrategiesAccounts(commitment?: Commitment): Promise<PriceStrategiesAccounts | null>;
|
|
123
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { BN } from "@coral-xyz/anchor";
|
|
2
|
+
import { Commitment, Keypair, PublicKey, TransactionSignature } from "@solana/web3.js";
|
|
3
|
+
import { BaseClient, type ProtocolPolicyClient, type TxOptions } from "../base";
|
|
4
|
+
import { LoopscaleVault } from "../../deser";
|
|
5
|
+
import { LoopscaleVaultPolicy } from "../../deser/integrationPolicies";
|
|
6
|
+
import { ClaimVaultRewardsAccounts, DepositWithdrawUserVaultAccounts, LoopscaleCoreClient, PriceVaultsAccounts, LoopscaleVaultStakeParams, LoopscaleVaultTxBuilder, LoopscaleVaultUnstakeParams, StakeUserVaultLpAccounts, UnstakeUserVaultLpAccounts } from "./core";
|
|
7
|
+
export type LoopscaleVaultDepositWithdrawAmounts = {
|
|
8
|
+
amountIn: BN;
|
|
9
|
+
minAmountOut: BN;
|
|
10
|
+
} | {
|
|
11
|
+
amountOut: BN;
|
|
12
|
+
maxAmountIn: BN;
|
|
13
|
+
};
|
|
14
|
+
export type LoopscaleVaultData = {
|
|
15
|
+
lpDecimals: number;
|
|
16
|
+
principalDecimals: number;
|
|
17
|
+
accounts: DepositWithdrawUserVaultAccounts;
|
|
18
|
+
};
|
|
19
|
+
export declare class LoopscaleVaultClient implements ProtocolPolicyClient<LoopscaleVaultPolicy> {
|
|
20
|
+
private readonly core;
|
|
21
|
+
readonly txBuilder: LoopscaleVaultTxBuilder;
|
|
22
|
+
constructor(core: LoopscaleCoreClient);
|
|
23
|
+
get base(): BaseClient;
|
|
24
|
+
get programId(): PublicKey;
|
|
25
|
+
get integrationAuthorityPda(): PublicKey;
|
|
26
|
+
getEventAuthorityPda(): PublicKey;
|
|
27
|
+
getVaultPda(vaultNonce: PublicKey): PublicKey;
|
|
28
|
+
getVaultStrategyPda(vault: PublicKey): PublicKey;
|
|
29
|
+
getVaultRewardsInfoPda(vault: PublicKey): PublicKey;
|
|
30
|
+
getVaultStakePda(stakeNonce: PublicKey, vault: PublicKey): PublicKey;
|
|
31
|
+
getUserRewardsInfoPda(vaultStake: PublicKey): PublicKey;
|
|
32
|
+
fetchVault(vault: PublicKey): Promise<LoopscaleVault>;
|
|
33
|
+
resolveVaultData(vault: PublicKey): Promise<LoopscaleVaultData>;
|
|
34
|
+
fetchPolicy(): Promise<LoopscaleVaultPolicy | null>;
|
|
35
|
+
setPolicy(policy: LoopscaleVaultPolicy, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
36
|
+
clearPolicy(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
37
|
+
depositUserVault(amounts: LoopscaleVaultDepositWithdrawAmounts, accounts: DepositWithdrawUserVaultAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
38
|
+
withdrawUserVault(amounts: LoopscaleVaultDepositWithdrawAmounts, accounts: DepositWithdrawUserVaultAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
39
|
+
stakeUserVaultLp(params: LoopscaleVaultStakeParams, accounts: StakeUserVaultLpAccounts, txOptions?: TxOptions, additionalSigners?: Keypair[]): Promise<TransactionSignature>;
|
|
40
|
+
unstakeUserVaultLp(params: LoopscaleVaultUnstakeParams, accounts: UnstakeUserVaultLpAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
41
|
+
claimVaultRewards(mints: PublicKey[], accounts: ClaimVaultRewardsAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
42
|
+
getPriceVaultsAccounts(commitment?: Commitment): Promise<PriceVaultsAccounts | null>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BN } from "@coral-xyz/anchor";
|
|
2
|
+
import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction, Keypair } from "@solana/web3.js";
|
|
3
|
+
import { MarinadeState } from "@marinade.finance/marinade-ts-sdk";
|
|
4
|
+
import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
|
|
5
|
+
import { StakeAccountInfo } from "../utils/accounts";
|
|
6
|
+
import { StakeClient } from "./stake";
|
|
7
|
+
export type Ticket = {
|
|
8
|
+
address: PublicKey;
|
|
9
|
+
lamports: number;
|
|
10
|
+
createdEpoch: number;
|
|
11
|
+
isDue: boolean;
|
|
12
|
+
isClaimable: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare class TxBuilder extends BaseTxBuilder<MarinadeClient> {
|
|
15
|
+
depositIxs(amount: BN, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
|
|
16
|
+
depositTx(amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
17
|
+
depositNativeIxs(amount: BN, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
|
|
18
|
+
depositNativeTx(amount: BN, txOptions: TxOptions): Promise<any>;
|
|
19
|
+
depositStakeAccountIx(stakeAccount: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
20
|
+
depositStakeAccountTx(stakeAccount: PublicKey, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
21
|
+
withdrawStakeAccountIxs(amount: BN, deactivate: boolean | undefined, glamSigner: PublicKey): Promise<[TransactionInstruction[], Keypair]>;
|
|
22
|
+
withdrawStakeAccountTx(amount: BN, deactivate: boolean | undefined, txOptions: TxOptions): Promise<[VersionedTransaction, Keypair]>;
|
|
23
|
+
}
|
|
24
|
+
export declare class MarinadeClient {
|
|
25
|
+
readonly base: BaseClient;
|
|
26
|
+
readonly stake: StakeClient;
|
|
27
|
+
private marinadeState;
|
|
28
|
+
txBuilder: TxBuilder;
|
|
29
|
+
constructor(base: BaseClient, stake: StakeClient);
|
|
30
|
+
deposit(amount: BN | number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
31
|
+
depositNative(amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
32
|
+
depositStakeAccount(stakeAccount: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
33
|
+
withdrawStakeAccount(amount: BN, deactivate?: boolean, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
34
|
+
fetchMarinadeState(): Promise<MarinadeState>;
|
|
35
|
+
getParsedStakeAccountInfo(stakeAccount: PublicKey): Promise<any>;
|
|
36
|
+
parseAccountList(data: Buffer, itemSize: number): PublicKey[];
|
|
37
|
+
getIndexes(stakeAccount: StakeAccountInfo, stakeList: any, validatorList: any): Promise<{
|
|
38
|
+
stakeIndex: number;
|
|
39
|
+
validatorIndex: number;
|
|
40
|
+
}>;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { BN } from "@coral-xyz/anchor";
|
|
2
|
+
import { Connection, PublicKey, TransactionInstruction, TransactionSignature, VersionedTransaction } from "@solana/web3.js";
|
|
3
|
+
import { BaseClient, BaseTxBuilder, type ProtocolPolicyClient, type ProtocolPolicyTxBuilder, TokenAccount, type TxOptions } from "./base";
|
|
4
|
+
import { PriceClient } from "./price";
|
|
5
|
+
import { MintIdlModel, RequestType, StateAccountType } from "../models";
|
|
6
|
+
import { MintPolicy } from "../deser/integrationPolicies";
|
|
7
|
+
import { UpdateStateParams } from "./state";
|
|
8
|
+
export type InitMintParams = {
|
|
9
|
+
accountType: StateAccountType;
|
|
10
|
+
name: number[];
|
|
11
|
+
symbol: string;
|
|
12
|
+
uri: string;
|
|
13
|
+
baseAssetMint: PublicKey;
|
|
14
|
+
decimals?: number;
|
|
15
|
+
} & Partial<MintIdlModel>;
|
|
16
|
+
export type UpdateMintParams = {
|
|
17
|
+
permanentDelegate?: PublicKey;
|
|
18
|
+
defaultAccountStateFrozen?: boolean;
|
|
19
|
+
lockupPeriod?: number;
|
|
20
|
+
maxCap?: BN;
|
|
21
|
+
minSubscription?: BN;
|
|
22
|
+
minRedemption?: BN;
|
|
23
|
+
allowlist?: PublicKey[];
|
|
24
|
+
blocklist?: PublicKey[];
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Resolves the list config + wallet entry pairs needed for permissionless thaw.
|
|
28
|
+
* Returns empty array if Token ACL is not enabled or no matching pairs found.
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolveThawAccounts(connection: Connection, mintPda: PublicKey, wallet: PublicKey): Promise<{
|
|
31
|
+
listConfig: PublicKey;
|
|
32
|
+
walletEntry: PublicKey;
|
|
33
|
+
}[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Builds a permissionless thaw instruction for the Token ACL program.
|
|
36
|
+
* Standalone version of TxBuilder.thawPermissionlessIx for use outside
|
|
37
|
+
* the MintClient context (e.g., in invest.ts).
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildThawPermissionlessIx(mintPda: PublicKey, wallet: PublicKey, listAndWalletPairs: {
|
|
40
|
+
listConfig: PublicKey;
|
|
41
|
+
walletEntry: PublicKey;
|
|
42
|
+
}[], signer: PublicKey): TransactionInstruction;
|
|
43
|
+
declare class TxBuilder extends BaseTxBuilder<MintClient> implements ProtocolPolicyTxBuilder<MintPolicy> {
|
|
44
|
+
setTokenAccountsStatesIx(tokenAccounts: PublicKey[], frozen: boolean, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
45
|
+
setTokenAccountsStatesTx(tokenAccounts: PublicKey[], frozen: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
46
|
+
createTokenAccountIxs(owner: PublicKey, setFrozen: boolean, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
|
|
47
|
+
createTokenAccountTx(owner: PublicKey, setFrozen?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
48
|
+
mintIxs(recipient: PublicKey, amount: BN, forceThaw: boolean | undefined, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
|
|
49
|
+
mintTx(recipient: PublicKey, amount: BN, forceThaw?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
50
|
+
burnIxs(from: PublicKey, amount: BN, forceThaw: boolean, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
|
|
51
|
+
burnTx(from: PublicKey, amount: BN, forceThaw?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
52
|
+
forceTransferIxs(from: PublicKey, to: PublicKey, amount: BN, forceThaw: boolean, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
|
|
53
|
+
forceTransferTx(from: PublicKey, to: PublicKey, amount: BN, forceThaw?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
54
|
+
initializeIxs(initMintParams: InitMintParams, stateParams: UpdateStateParams | null, glamSigner: PublicKey): Promise<[TransactionInstruction[], PublicKey]>;
|
|
55
|
+
initializeTx(initMintParams: InitMintParams, stateParams: UpdateStateParams | null, txOptions?: TxOptions): Promise<[VersionedTransaction, PublicKey]>;
|
|
56
|
+
crystallizeFeesIxs(glamSigner: PublicKey): Promise<TransactionInstruction[]>;
|
|
57
|
+
updateIx(mintModel: Partial<MintIdlModel>, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
58
|
+
updateTx(mintModel: Partial<MintIdlModel>, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
59
|
+
emergencyUpdateIx(requestType: RequestType, setPaused: boolean, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
60
|
+
pauseSubscriptionTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
61
|
+
unpauseSubscriptionTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
62
|
+
pauseRedemptionTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
63
|
+
unpauseRedemptionTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
64
|
+
closeMintIx(signer?: PublicKey): Promise<TransactionInstruction>;
|
|
65
|
+
closeMintTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
66
|
+
enableTokenAclIx(gatingProgram: PublicKey | undefined, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
67
|
+
enableTokenAclTx(gatingProgram: PublicKey | undefined, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
68
|
+
aclGateCreateListIx(seed: Buffer, mode: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
69
|
+
aclGateCreateListTx(seed: Buffer, mode: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
70
|
+
aclGateAddWalletIx(listConfig: PublicKey, wallet: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
71
|
+
aclGateAddWalletTx(listConfig: PublicKey, wallet: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
72
|
+
aclGateRemoveWalletIx(listConfig: PublicKey, walletEntry: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
73
|
+
aclGateRemoveWalletTx(listConfig: PublicKey, walletEntry: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
74
|
+
aclGateDeleteListIx(listConfig: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
75
|
+
aclGateDeleteListTx(listConfig: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
76
|
+
aclGateSetupExtraMetasIx(listConfigs: PublicKey[], glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
77
|
+
aclGateSetupExtraMetasTx(listConfigs: PublicKey[], txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
78
|
+
tokenAclFreezeIx(tokenAccounts: PublicKey[], glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
79
|
+
tokenAclFreezeTx(tokenAccounts: PublicKey[], txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
80
|
+
tokenAclThawIx(tokenAccounts: PublicKey[], glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
81
|
+
tokenAclThawTx(tokenAccounts: PublicKey[], txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
82
|
+
thawPermissionlessIx(wallet: PublicKey, listAndWalletPairs: {
|
|
83
|
+
listConfig: PublicKey;
|
|
84
|
+
walletEntry: PublicKey;
|
|
85
|
+
}[], signer: PublicKey): TransactionInstruction;
|
|
86
|
+
thawPermissionlessTx(wallet: PublicKey, listAndWalletPairs: {
|
|
87
|
+
listConfig: PublicKey;
|
|
88
|
+
walletEntry: PublicKey;
|
|
89
|
+
}[], txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
90
|
+
setPolicyIx(policy: MintPolicy, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
91
|
+
setMintPolicyIx(policy: MintPolicy, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
92
|
+
setPolicyTx(policy: MintPolicy, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
93
|
+
setMintPolicyTx(policy: MintPolicy, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
94
|
+
clearPolicyIx(signer?: PublicKey): Promise<TransactionInstruction>;
|
|
95
|
+
clearMintPolicyIx(signer?: PublicKey): Promise<TransactionInstruction>;
|
|
96
|
+
clearPolicyTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
97
|
+
clearMintPolicyTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
98
|
+
}
|
|
99
|
+
export declare class MintClient implements ProtocolPolicyClient<MintPolicy> {
|
|
100
|
+
readonly base: BaseClient;
|
|
101
|
+
private readonly getPrice?;
|
|
102
|
+
readonly txBuilder: TxBuilder;
|
|
103
|
+
constructor(base: BaseClient, getPrice?: (() => PriceClient) | undefined);
|
|
104
|
+
get price(): PriceClient;
|
|
105
|
+
fetchPolicy(): Promise<MintPolicy | null>;
|
|
106
|
+
fetchMintPolicy(): Promise<MintPolicy | null>;
|
|
107
|
+
setPolicy(policy: MintPolicy, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
108
|
+
setMintPolicy(policy: MintPolicy, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
109
|
+
clearPolicy(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
110
|
+
clearMintPolicy(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
111
|
+
/**
|
|
112
|
+
* Fetches token holders of the GLAM mint using helius RPC. Falls back to
|
|
113
|
+
* getHolders if helius API key is not provided or cluster is not mainnet.
|
|
114
|
+
*/
|
|
115
|
+
fetchTokenHolders(showZeroBalance?: boolean): Promise<TokenAccount[]>;
|
|
116
|
+
getHolders(showZeroBalance?: boolean): Promise<TokenAccount[]>;
|
|
117
|
+
initialize(initMintParams: InitMintParams, txOptions?: TxOptions): Promise<string>;
|
|
118
|
+
initializeWithStateParams(initMintParams: InitMintParams, stateParams: UpdateStateParams, txOptions?: TxOptions): Promise<string>;
|
|
119
|
+
update(mintModel: Partial<MintIdlModel>, txOptions?: TxOptions): Promise<string>;
|
|
120
|
+
pauseSubscription(txOptions?: TxOptions): Promise<string>;
|
|
121
|
+
unpauseSubscription(txOptions?: TxOptions): Promise<string>;
|
|
122
|
+
pauseRedemption(txOptions?: TxOptions): Promise<string>;
|
|
123
|
+
unpauseRedemption(txOptions?: TxOptions): Promise<string>;
|
|
124
|
+
close(txOptions?: TxOptions): Promise<string>;
|
|
125
|
+
mint(to: PublicKey, amount: BN | number, unfreeze?: boolean, txOptions?: TxOptions): Promise<string>;
|
|
126
|
+
burn(from: PublicKey, amount: BN | number, unfreeze?: boolean, txOptions?: TxOptions): Promise<string>;
|
|
127
|
+
createTokenAccount(owner: PublicKey, setFrozen: boolean, txOptions?: TxOptions): Promise<string>;
|
|
128
|
+
setTokenAccountsStates(tokenAccounts: PublicKey[], frozen: boolean, txOptions?: TxOptions): Promise<string>;
|
|
129
|
+
enableTokenAcl(gatingProgram?: PublicKey, txOptions?: TxOptions): Promise<string>;
|
|
130
|
+
forceTransfer(from: PublicKey, to: PublicKey, amount: BN | number, unfreeze?: boolean, txOptions?: TxOptions): Promise<string>;
|
|
131
|
+
tokenAclFreeze(tokenAccounts: PublicKey[], txOptions?: TxOptions): Promise<string>;
|
|
132
|
+
tokenAclThaw(tokenAccounts: PublicKey[], txOptions?: TxOptions): Promise<string>;
|
|
133
|
+
aclGateCreateList(seed: Buffer, mode?: number, txOptions?: TxOptions): Promise<string>;
|
|
134
|
+
aclGateAddWallet(listConfig: PublicKey, wallet: PublicKey, txOptions?: TxOptions): Promise<string>;
|
|
135
|
+
aclGateRemoveWallet(listConfig: PublicKey, walletEntry: PublicKey, txOptions?: TxOptions): Promise<string>;
|
|
136
|
+
aclGateDeleteList(listConfig: PublicKey, txOptions?: TxOptions): Promise<string>;
|
|
137
|
+
aclGateSetupExtraMetas(listConfigs: PublicKey[], txOptions?: TxOptions): Promise<string>;
|
|
138
|
+
thawPermissionless(wallet: PublicKey, listAndWalletPairs: {
|
|
139
|
+
listConfig: PublicKey;
|
|
140
|
+
walletEntry: PublicKey;
|
|
141
|
+
}[], txOptions?: TxOptions): Promise<string>;
|
|
142
|
+
}
|
|
143
|
+
export {};
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { BN } from "@coral-xyz/anchor";
|
|
2
|
+
import { AccountMeta, PublicKey, TransactionInstruction, TransactionSignature, VersionedTransaction } from "@solana/web3.js";
|
|
3
|
+
import { BaseClient, BaseTxBuilder, type ProtocolPolicyClient, type ProtocolPolicyTxBuilder, type TxOptions } from "./base";
|
|
4
|
+
import { WhirlpoolsPolicy } from "../deser/integrationPolicies";
|
|
5
|
+
type Numeric = BN | bigint | number;
|
|
6
|
+
export declare const ORCA_POSITION_METADATA_UPDATE_AUTHORITY: PublicKey;
|
|
7
|
+
export type OrcaAccountsType = {
|
|
8
|
+
transferHookA: Record<string, never>;
|
|
9
|
+
} | {
|
|
10
|
+
transferHookB: Record<string, never>;
|
|
11
|
+
} | {
|
|
12
|
+
transferHookReward: Record<string, never>;
|
|
13
|
+
} | {
|
|
14
|
+
transferHookInput: Record<string, never>;
|
|
15
|
+
} | {
|
|
16
|
+
transferHookIntermediate: Record<string, never>;
|
|
17
|
+
} | {
|
|
18
|
+
transferHookOutput: Record<string, never>;
|
|
19
|
+
} | {
|
|
20
|
+
supplementalTickArrays: Record<string, never>;
|
|
21
|
+
} | {
|
|
22
|
+
supplementalTickArraysOne: Record<string, never>;
|
|
23
|
+
} | {
|
|
24
|
+
supplementalTickArraysTwo: Record<string, never>;
|
|
25
|
+
} | {
|
|
26
|
+
transferHookDepositA: Record<string, never>;
|
|
27
|
+
} | {
|
|
28
|
+
transferHookDepositB: Record<string, never>;
|
|
29
|
+
} | {
|
|
30
|
+
transferHookWithdrawalA: Record<string, never>;
|
|
31
|
+
} | {
|
|
32
|
+
transferHookWithdrawalB: Record<string, never>;
|
|
33
|
+
};
|
|
34
|
+
export type OrcaRemainingAccountsInfo = {
|
|
35
|
+
slices: Array<{
|
|
36
|
+
accountsType: OrcaAccountsType;
|
|
37
|
+
length: number;
|
|
38
|
+
}>;
|
|
39
|
+
};
|
|
40
|
+
export type OrcaPriceDeviationAccounts = {
|
|
41
|
+
glamConfig?: PublicKey;
|
|
42
|
+
tokenMintAOracle: PublicKey;
|
|
43
|
+
tokenMintBOracle: PublicKey;
|
|
44
|
+
solUsdOracle?: PublicKey;
|
|
45
|
+
kaminoReserves?: PublicKey[];
|
|
46
|
+
};
|
|
47
|
+
export type OrcaPriceDeviationRemainingAccounts = {
|
|
48
|
+
priceDeviationAccounts?: OrcaPriceDeviationAccounts;
|
|
49
|
+
};
|
|
50
|
+
export type OrcaV2RemainingAccounts = {
|
|
51
|
+
remainingAccountsInfo?: OrcaRemainingAccountsInfo | null;
|
|
52
|
+
remainingAccounts?: AccountMeta[];
|
|
53
|
+
};
|
|
54
|
+
export type OpenOrcaPositionWithTokenExtensionsParams = {
|
|
55
|
+
tickLowerIndex: number;
|
|
56
|
+
tickUpperIndex: number;
|
|
57
|
+
withTokenMetadataExtension?: boolean;
|
|
58
|
+
};
|
|
59
|
+
export type OpenOrcaPositionWithTokenExtensionsAccounts = {
|
|
60
|
+
whirlpool: PublicKey;
|
|
61
|
+
positionMint: PublicKey;
|
|
62
|
+
position?: PublicKey;
|
|
63
|
+
positionTokenAccount?: PublicKey;
|
|
64
|
+
metadataUpdateAuth?: PublicKey;
|
|
65
|
+
};
|
|
66
|
+
export type InitializeOrcaTickArrayParams = {
|
|
67
|
+
startTickIndex: number;
|
|
68
|
+
};
|
|
69
|
+
export type IncreaseOrcaLiquidityV2Params = OrcaV2RemainingAccounts & OrcaPriceDeviationRemainingAccounts & {
|
|
70
|
+
liquidityAmount: Numeric;
|
|
71
|
+
tokenMaxA: Numeric;
|
|
72
|
+
tokenMaxB: Numeric;
|
|
73
|
+
};
|
|
74
|
+
export type DecreaseOrcaLiquidityV2Params = OrcaV2RemainingAccounts & OrcaPriceDeviationRemainingAccounts & {
|
|
75
|
+
liquidityAmount: Numeric;
|
|
76
|
+
tokenMinA: Numeric;
|
|
77
|
+
tokenMinB: Numeric;
|
|
78
|
+
};
|
|
79
|
+
export type IncreaseOrcaLiquidityByTokenAmountsMethod = {
|
|
80
|
+
byTokenAmounts: {
|
|
81
|
+
tokenMaxA: Numeric;
|
|
82
|
+
tokenMaxB: Numeric;
|
|
83
|
+
minSqrtPrice: Numeric;
|
|
84
|
+
maxSqrtPrice: Numeric;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
export type IncreaseOrcaLiquidityByTokenAmountsV2Params = OrcaV2RemainingAccounts & OrcaPriceDeviationRemainingAccounts & {
|
|
88
|
+
method: IncreaseOrcaLiquidityByTokenAmountsMethod;
|
|
89
|
+
};
|
|
90
|
+
export type RepositionOrcaLiquidityMethod = {
|
|
91
|
+
byLiquidity: {
|
|
92
|
+
newLiquidityAmount: Numeric;
|
|
93
|
+
existingRangeTokenMinA: Numeric;
|
|
94
|
+
existingRangeTokenMinB: Numeric;
|
|
95
|
+
newRangeTokenMaxA: Numeric;
|
|
96
|
+
newRangeTokenMaxB: Numeric;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
export type RepositionOrcaLiquidityV2Params = OrcaV2RemainingAccounts & OrcaPriceDeviationRemainingAccounts & {
|
|
100
|
+
newTickLowerIndex: number;
|
|
101
|
+
newTickUpperIndex: number;
|
|
102
|
+
method: RepositionOrcaLiquidityMethod;
|
|
103
|
+
};
|
|
104
|
+
export type OrcaPositionAccounts = {
|
|
105
|
+
whirlpool: PublicKey;
|
|
106
|
+
position: PublicKey;
|
|
107
|
+
positionMint: PublicKey;
|
|
108
|
+
positionTokenAccount?: PublicKey;
|
|
109
|
+
};
|
|
110
|
+
export type OrcaUpdateFeesAndRewardsAccounts = {
|
|
111
|
+
whirlpool: PublicKey;
|
|
112
|
+
position: PublicKey;
|
|
113
|
+
tickArrayLower: PublicKey;
|
|
114
|
+
tickArrayUpper: PublicKey;
|
|
115
|
+
};
|
|
116
|
+
export type OrcaLiquidityV2Accounts = OrcaPositionAccounts & OrcaV2RemainingAccounts & OrcaPriceDeviationRemainingAccounts & {
|
|
117
|
+
tokenMintA: PublicKey;
|
|
118
|
+
tokenMintB: PublicKey;
|
|
119
|
+
tokenVaultA: PublicKey;
|
|
120
|
+
tokenVaultB: PublicKey;
|
|
121
|
+
tickArrayLower: PublicKey;
|
|
122
|
+
tickArrayUpper: PublicKey;
|
|
123
|
+
tokenOwnerAccountA?: PublicKey;
|
|
124
|
+
tokenOwnerAccountB?: PublicKey;
|
|
125
|
+
tokenProgramA?: PublicKey;
|
|
126
|
+
tokenProgramB?: PublicKey;
|
|
127
|
+
memoProgram?: PublicKey;
|
|
128
|
+
};
|
|
129
|
+
export type InitializeOrcaTickArrayAccounts = {
|
|
130
|
+
whirlpool: PublicKey;
|
|
131
|
+
tickArray?: PublicKey;
|
|
132
|
+
};
|
|
133
|
+
export type RepositionOrcaLiquidityV2Accounts = Omit<OrcaLiquidityV2Accounts, "tickArrayLower" | "tickArrayUpper"> & {
|
|
134
|
+
existingTickArrayLower: PublicKey;
|
|
135
|
+
existingTickArrayUpper: PublicKey;
|
|
136
|
+
newTickArrayLower: PublicKey;
|
|
137
|
+
newTickArrayUpper: PublicKey;
|
|
138
|
+
};
|
|
139
|
+
export type CollectOrcaFeesV2Accounts = OrcaPositionAccounts & OrcaV2RemainingAccounts & {
|
|
140
|
+
tokenMintA: PublicKey;
|
|
141
|
+
tokenMintB: PublicKey;
|
|
142
|
+
tokenOwnerAccountA?: PublicKey;
|
|
143
|
+
tokenOwnerAccountB?: PublicKey;
|
|
144
|
+
tokenVaultA: PublicKey;
|
|
145
|
+
tokenVaultB: PublicKey;
|
|
146
|
+
tokenProgramA?: PublicKey;
|
|
147
|
+
tokenProgramB?: PublicKey;
|
|
148
|
+
memoProgram?: PublicKey;
|
|
149
|
+
};
|
|
150
|
+
export type CollectOrcaRewardV2Accounts = OrcaPositionAccounts & OrcaV2RemainingAccounts & {
|
|
151
|
+
rewardMint: PublicKey;
|
|
152
|
+
rewardVault: PublicKey;
|
|
153
|
+
rewardOwnerAccount?: PublicKey;
|
|
154
|
+
rewardTokenProgram?: PublicKey;
|
|
155
|
+
memoProgram?: PublicKey;
|
|
156
|
+
};
|
|
157
|
+
export type ParsedOrcaPosition = {
|
|
158
|
+
whirlpool: PublicKey;
|
|
159
|
+
positionMint: PublicKey;
|
|
160
|
+
liquidity: bigint;
|
|
161
|
+
tickLowerIndex: number;
|
|
162
|
+
tickUpperIndex: number;
|
|
163
|
+
rewardInfos: Array<{
|
|
164
|
+
growthInsideCheckpoint: bigint;
|
|
165
|
+
amountOwed: bigint;
|
|
166
|
+
}>;
|
|
167
|
+
rewardAmountsOwed: bigint[];
|
|
168
|
+
};
|
|
169
|
+
export type ParsedOrcaWhirlpool = {
|
|
170
|
+
tokenMintA: PublicKey;
|
|
171
|
+
tokenMintB: PublicKey;
|
|
172
|
+
tickSpacing: number;
|
|
173
|
+
liquidity: bigint;
|
|
174
|
+
tickCurrentIndex: number;
|
|
175
|
+
rewardLastUpdatedTimestamp: bigint;
|
|
176
|
+
rewardInfos: Array<{
|
|
177
|
+
mint: PublicKey;
|
|
178
|
+
emissionsPerSecondX64: bigint;
|
|
179
|
+
growthGlobalX64: bigint;
|
|
180
|
+
}>;
|
|
181
|
+
};
|
|
182
|
+
export type ParsedOrcaTick = {
|
|
183
|
+
rewardGrowthsOutside: bigint[];
|
|
184
|
+
};
|
|
185
|
+
export type OrcaWhirlpoolPricingAccounts = {
|
|
186
|
+
numPositions: number;
|
|
187
|
+
remainingAccounts: AccountMeta[];
|
|
188
|
+
kaminoReserves: PublicKey[];
|
|
189
|
+
};
|
|
190
|
+
export declare function getOrcaPositionPda(positionMint: PublicKey, programId?: PublicKey): [PublicKey, number];
|
|
191
|
+
export declare function getOrcaTickArrayPda(whirlpool: PublicKey, startTickIndex: number, programId?: PublicKey): [PublicKey, number];
|
|
192
|
+
export declare function parseOrcaPosition(data: Buffer): ParsedOrcaPosition;
|
|
193
|
+
export declare function parseOrcaWhirlpool(data: Buffer): ParsedOrcaWhirlpool;
|
|
194
|
+
export declare function parseOrcaTickArrayTick(data: Buffer, expectedWhirlpool: PublicKey, expectedStartTickIndex: number, tickIndex: number, tickSpacing: number): ParsedOrcaTick;
|
|
195
|
+
export declare function getOrcaTickArrayStartIndex(tickIndex: number, tickSpacing: number): number;
|
|
196
|
+
export declare function deriveTickArrayForPosition(whirlpool: PublicKey, tickIndex: number, tickSpacing: number): PublicKey;
|
|
197
|
+
declare class TxBuilder extends BaseTxBuilder<OrcaWhirlpoolsClient> implements ProtocolPolicyTxBuilder<WhirlpoolsPolicy> {
|
|
198
|
+
setPolicyIx(policy: WhirlpoolsPolicy, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
199
|
+
setPolicyTx(policy: WhirlpoolsPolicy, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
200
|
+
clearPolicyIx(signer?: PublicKey): Promise<TransactionInstruction>;
|
|
201
|
+
clearPolicyTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
202
|
+
openPositionWithTokenExtensionsIx(params: OpenOrcaPositionWithTokenExtensionsParams, accounts: OpenOrcaPositionWithTokenExtensionsAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
203
|
+
openPositionWithTokenExtensionsTx(params: OpenOrcaPositionWithTokenExtensionsParams, accounts: OpenOrcaPositionWithTokenExtensionsAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
204
|
+
initializeTickArrayIx(params: InitializeOrcaTickArrayParams, accounts: InitializeOrcaTickArrayAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
205
|
+
initializeTickArrayTx(params: InitializeOrcaTickArrayParams, accounts: InitializeOrcaTickArrayAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
206
|
+
increaseLiquidityV2Ix(params: IncreaseOrcaLiquidityV2Params, accounts: OrcaLiquidityV2Accounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
207
|
+
increaseLiquidityV2Tx(params: IncreaseOrcaLiquidityV2Params, accounts: OrcaLiquidityV2Accounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
208
|
+
increaseLiquidityByTokenAmountsV2Ix(params: IncreaseOrcaLiquidityByTokenAmountsV2Params, accounts: OrcaLiquidityV2Accounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
209
|
+
increaseLiquidityByTokenAmountsV2Tx(params: IncreaseOrcaLiquidityByTokenAmountsV2Params, accounts: OrcaLiquidityV2Accounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
210
|
+
decreaseLiquidityV2Ix(params: DecreaseOrcaLiquidityV2Params, accounts: OrcaLiquidityV2Accounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
211
|
+
decreaseLiquidityV2Tx(params: DecreaseOrcaLiquidityV2Params, accounts: OrcaLiquidityV2Accounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
212
|
+
repositionLiquidityV2Ix(params: RepositionOrcaLiquidityV2Params, accounts: RepositionOrcaLiquidityV2Accounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
213
|
+
repositionLiquidityV2Tx(params: RepositionOrcaLiquidityV2Params, accounts: RepositionOrcaLiquidityV2Accounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
214
|
+
updateFeesAndRewardsIx(accounts: OrcaUpdateFeesAndRewardsAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
215
|
+
updateFeesAndRewardsTx(accounts: OrcaUpdateFeesAndRewardsAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
216
|
+
collectFeesV2Ix(accounts: CollectOrcaFeesV2Accounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
217
|
+
collectFeesV2Tx(accounts: CollectOrcaFeesV2Accounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
218
|
+
collectRewardV2Ix(rewardIndex: number, accounts: CollectOrcaRewardV2Accounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
219
|
+
collectRewardV2Tx(rewardIndex: number, accounts: CollectOrcaRewardV2Accounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
220
|
+
closePositionWithTokenExtensionsIx(accounts: OrcaPositionAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
221
|
+
closePositionWithTokenExtensionsTx(accounts: OrcaPositionAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
222
|
+
private sharedBaseAccounts;
|
|
223
|
+
private liquidityV2Accounts;
|
|
224
|
+
private tokenPrograms;
|
|
225
|
+
private tokenProgramForMint;
|
|
226
|
+
private withRemainingAccounts;
|
|
227
|
+
private priceDeviationAccountMetas;
|
|
228
|
+
private withKaminoReserveRefreshTxOptions;
|
|
229
|
+
private fetchAndParseKaminoReserves;
|
|
230
|
+
private refreshKaminoReservesBatchIx;
|
|
231
|
+
}
|
|
232
|
+
export declare class OrcaWhirlpoolsClient implements ProtocolPolicyClient<WhirlpoolsPolicy> {
|
|
233
|
+
readonly base: BaseClient;
|
|
234
|
+
readonly txBuilder: TxBuilder;
|
|
235
|
+
constructor(base: BaseClient);
|
|
236
|
+
getIntegrationAuthorityPda(): PublicKey;
|
|
237
|
+
getPositionPda(positionMint: PublicKey): [PublicKey, number];
|
|
238
|
+
getTickArrayPda(whirlpool: PublicKey, startTickIndex: number): [PublicKey, number];
|
|
239
|
+
getPositionTokenAta(positionMint: PublicKey): PublicKey;
|
|
240
|
+
remainingAccountsForPricingWhirlpoolPositions(orcaPositions: PublicKey[]): Promise<OrcaWhirlpoolPricingAccounts | null>;
|
|
241
|
+
fetchPolicy(): Promise<WhirlpoolsPolicy | null>;
|
|
242
|
+
setPolicy(policy: WhirlpoolsPolicy, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
243
|
+
clearPolicy(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
244
|
+
openPositionWithTokenExtensions(params: OpenOrcaPositionWithTokenExtensionsParams, accounts: OpenOrcaPositionWithTokenExtensionsAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
245
|
+
initializeTickArray(params: InitializeOrcaTickArrayParams, accounts: InitializeOrcaTickArrayAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
246
|
+
increaseLiquidityV2(params: IncreaseOrcaLiquidityV2Params, accounts: OrcaLiquidityV2Accounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
247
|
+
increaseLiquidityByTokenAmountsV2(params: IncreaseOrcaLiquidityByTokenAmountsV2Params, accounts: OrcaLiquidityV2Accounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
248
|
+
decreaseLiquidityV2(params: DecreaseOrcaLiquidityV2Params, accounts: OrcaLiquidityV2Accounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
249
|
+
repositionLiquidityV2(params: RepositionOrcaLiquidityV2Params, accounts: RepositionOrcaLiquidityV2Accounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
250
|
+
updateFeesAndRewards(accounts: OrcaUpdateFeesAndRewardsAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
251
|
+
collectFeesV2(accounts: CollectOrcaFeesV2Accounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
252
|
+
collectRewardV2(rewardIndex: number, accounts: CollectOrcaRewardV2Accounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
253
|
+
closePositionWithTokenExtensions(accounts: OrcaPositionAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
254
|
+
}
|
|
255
|
+
export {};
|