@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,164 @@
|
|
|
1
|
+
import { BN } from "@coral-xyz/anchor";
|
|
2
|
+
import { PublicKey, VersionedTransaction, TransactionSignature, Keypair, Commitment, Finality, TransactionInstruction, VersionedTransactionResponse } from "@solana/web3.js";
|
|
3
|
+
import { BaseClient, BaseTxBuilder, type ProtocolPolicyClient, type ProtocolPolicyTxBuilder, type TxOptions } from "./base";
|
|
4
|
+
import { CctpPolicy } from "../deser/integrationPolicies";
|
|
5
|
+
export declare class CctpBridgeEvent {
|
|
6
|
+
readonly amount: BN;
|
|
7
|
+
readonly sourceDomain: number;
|
|
8
|
+
readonly sourceAddress: string;
|
|
9
|
+
readonly destinationDomain: number;
|
|
10
|
+
readonly destinationCaller: string;
|
|
11
|
+
readonly destinationAddress: string;
|
|
12
|
+
readonly attestation: string;
|
|
13
|
+
readonly nonce: string;
|
|
14
|
+
readonly status: string;
|
|
15
|
+
readonly txHash: string;
|
|
16
|
+
readonly uiAmount: number;
|
|
17
|
+
slot?: number;
|
|
18
|
+
constructor(amount: BN, sourceDomain: number, sourceAddress: string, destinationDomain: number, destinationCaller: string, destinationAddress: string, attestation: string, nonce: string, status: string, txHash: string);
|
|
19
|
+
}
|
|
20
|
+
declare class TxBuilder extends BaseTxBuilder<CctpClient> implements ProtocolPolicyTxBuilder<CctpPolicy> {
|
|
21
|
+
/**
|
|
22
|
+
* Returns a transaction that calls CCTP's `depositForBurn` instruction that bridges USDC to another chain.
|
|
23
|
+
* A keypair is generated for the message sent event account, which must be included as a transaction signer.
|
|
24
|
+
*/
|
|
25
|
+
bridgeUsdcIx(amount: BN, domain: number, destinationAddress: PublicKey, params: {
|
|
26
|
+
maxFee: BN;
|
|
27
|
+
minFinalityThreshold: number;
|
|
28
|
+
destinationCaller?: PublicKey;
|
|
29
|
+
}, glamSigner: PublicKey): Promise<[TransactionInstruction, Keypair]>;
|
|
30
|
+
bridgeUsdcTx(amount: BN, domain: number, destinationAddress: PublicKey, params: {
|
|
31
|
+
maxFee: BN;
|
|
32
|
+
minFinalityThreshold: number;
|
|
33
|
+
destinationCaller?: PublicKey;
|
|
34
|
+
}, txOptions: TxOptions): Promise<[VersionedTransaction, Keypair]>;
|
|
35
|
+
receiveMessageIx(sourceDomain: number, messageObj: any): Promise<TransactionInstruction>;
|
|
36
|
+
receiveUsdcTx(sourceDomain: number, params: {
|
|
37
|
+
txHash?: string;
|
|
38
|
+
nonce?: string;
|
|
39
|
+
}, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
40
|
+
setPolicyIx(policy: CctpPolicy, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
41
|
+
setPolicyTx(policy: CctpPolicy, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
42
|
+
clearPolicyIx(signer?: PublicKey): Promise<TransactionInstruction>;
|
|
43
|
+
clearPolicyTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
44
|
+
}
|
|
45
|
+
export declare class CctpClient implements ProtocolPolicyClient<CctpPolicy> {
|
|
46
|
+
readonly base: BaseClient;
|
|
47
|
+
txBuilder: TxBuilder;
|
|
48
|
+
constructor(base: BaseClient);
|
|
49
|
+
/**
|
|
50
|
+
* Bridge USDC to another chain using Circle's CCTP protocol
|
|
51
|
+
*
|
|
52
|
+
* @param amount Amount of USDC to bridge (in smallest units)
|
|
53
|
+
* @param domain Destination domain (e.g., 0 for Ethereum, 1 for Avalanche)
|
|
54
|
+
* @param destinationAddress Destination address on target chain (EVM address as PublicKey)
|
|
55
|
+
* @param params Additional parameters (maxFee, minFinalityThreshold)
|
|
56
|
+
* @param txOptions Transaction options
|
|
57
|
+
*/
|
|
58
|
+
bridgeUsdc(amount: BN | number, domain: number, destinationAddress: PublicKey, params: {
|
|
59
|
+
maxFee: BN;
|
|
60
|
+
minFinalityThreshold: number;
|
|
61
|
+
destinationCaller?: PublicKey;
|
|
62
|
+
}, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
63
|
+
/**
|
|
64
|
+
* Receive USDC from another chain using Circle's CCTP protocol
|
|
65
|
+
*
|
|
66
|
+
* @param sourceDomain Source domain (e.g., 0 for Ethereum, 6 for Base)
|
|
67
|
+
* @param params Additional parameters (txHash, nonce)
|
|
68
|
+
* @param txOptions Transaction options
|
|
69
|
+
*/
|
|
70
|
+
receiveUsdc(sourceDomain: number, params: {
|
|
71
|
+
txHash?: string;
|
|
72
|
+
nonce?: string;
|
|
73
|
+
}, txOptions?: TxOptions): Promise<string>;
|
|
74
|
+
fetchPolicy(): Promise<CctpPolicy | null>;
|
|
75
|
+
setPolicy(policy: CctpPolicy, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
76
|
+
clearPolicy(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
77
|
+
getReceiveMessagePdas(messageTransmitterProgram: PublicKey, tokenMessengerMinterProgram: PublicKey, solUsdcMint: PublicKey, remoteUsdcAddressHex: string, remoteDomain: string, nonceHex: string): Promise<{
|
|
78
|
+
messageTransmitter: PublicKey;
|
|
79
|
+
tokenMessenger: PublicKey;
|
|
80
|
+
tokenMinter: PublicKey;
|
|
81
|
+
localToken: PublicKey;
|
|
82
|
+
remoteTokenMessengerKey: PublicKey;
|
|
83
|
+
remoteTokenKey: PublicKey;
|
|
84
|
+
tokenPair: PublicKey;
|
|
85
|
+
custodyTokenAccount: PublicKey;
|
|
86
|
+
authorityPda: PublicKey;
|
|
87
|
+
tokenMessengerEventAuthority: PublicKey;
|
|
88
|
+
usedNonce: PublicKey;
|
|
89
|
+
feeRecipientTokenAccount: PublicKey;
|
|
90
|
+
}>;
|
|
91
|
+
/**
|
|
92
|
+
* Get all PDAs required for CCTP deposit for burn operation
|
|
93
|
+
*
|
|
94
|
+
* @param messageTransmitterProgram Message transmitter program ID
|
|
95
|
+
* @param tokenMessengerMinterProgram Token messenger minter program ID
|
|
96
|
+
* @param usdcAddress USDC mint address
|
|
97
|
+
* @param destinationDomain Destination domain
|
|
98
|
+
* @returns Object containing all required PDAs
|
|
99
|
+
*/
|
|
100
|
+
getDepositForBurnPdas(messageTransmitterProgram: PublicKey, tokenMessengerMinterProgram: PublicKey, usdcAddress: PublicKey, destinationDomain: Number): {
|
|
101
|
+
messageTransmitterAccount: PublicKey;
|
|
102
|
+
tokenMessengerAccount: PublicKey;
|
|
103
|
+
tokenMinterAccount: PublicKey;
|
|
104
|
+
localToken: PublicKey;
|
|
105
|
+
remoteTokenMessengerKey: PublicKey;
|
|
106
|
+
authorityPda: PublicKey;
|
|
107
|
+
tokenMessengerEventAuthority: PublicKey;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Find all message accounts onchain for a given sender wallet
|
|
111
|
+
*
|
|
112
|
+
* TODO: filter by burned token mint
|
|
113
|
+
*/
|
|
114
|
+
findV2Messages(senderWallet: PublicKey, options: {
|
|
115
|
+
commitment?: Commitment;
|
|
116
|
+
minSlot?: number;
|
|
117
|
+
}): Promise<PublicKey[]>;
|
|
118
|
+
fetchV2Messages(sourceDomain: number, params: {
|
|
119
|
+
txHash?: string;
|
|
120
|
+
nonce?: string;
|
|
121
|
+
}): Promise<any[]>;
|
|
122
|
+
/**
|
|
123
|
+
* Get bridge events from Circle API using either txHash or nonce
|
|
124
|
+
*
|
|
125
|
+
* @param sourceDomain Source domain
|
|
126
|
+
* @param params Either txHash or nonce is required
|
|
127
|
+
* @returns Array of bridge events
|
|
128
|
+
*/
|
|
129
|
+
parseEventsFromAttestion(sourceDomain: number, { txHash, nonce }: {
|
|
130
|
+
txHash?: string;
|
|
131
|
+
nonce?: string;
|
|
132
|
+
}): Promise<CctpBridgeEvent[]>;
|
|
133
|
+
getTransactions(signatures: string[], batchSize: number, commitment?: Finality): Promise<VersionedTransactionResponse[]>;
|
|
134
|
+
/**
|
|
135
|
+
* Get incoming bridge events (EVM -> Solana)
|
|
136
|
+
*
|
|
137
|
+
* Unlike outgoing bridge events, incoming bridge events are not stored in Message accounts on Solana.
|
|
138
|
+
* We need to examine all transactions to find the ones that contain the bridge events.
|
|
139
|
+
* 1. Fetch all transactions involing the vault's USDC token account
|
|
140
|
+
* 2. Filter transactions that contain the bridge events
|
|
141
|
+
* 3. Parse the bridge events from the transactions
|
|
142
|
+
*/
|
|
143
|
+
getIncomingBridgeEvents(options: {
|
|
144
|
+
batchSize?: number;
|
|
145
|
+
commitment?: Finality;
|
|
146
|
+
txHashes?: string[];
|
|
147
|
+
minSlot?: number;
|
|
148
|
+
}): Promise<CctpBridgeEvent[]>;
|
|
149
|
+
/**
|
|
150
|
+
* Get outgoing bridge events (Solana -> EVM)
|
|
151
|
+
*
|
|
152
|
+
* Each transfer has a Message account on Solana. To get all events:
|
|
153
|
+
* 1. Find all Message accounts for the vault
|
|
154
|
+
* 2. Get the created transaction for each message account
|
|
155
|
+
* 3. Call iris api to get the attestation status and parsed message using each tx hash
|
|
156
|
+
*/
|
|
157
|
+
getOutgoingBridgeEvents(options: {
|
|
158
|
+
batchSize?: number;
|
|
159
|
+
commitment?: Commitment;
|
|
160
|
+
txHashes?: string[];
|
|
161
|
+
minSlot?: number;
|
|
162
|
+
}): Promise<CctpBridgeEvent[]>;
|
|
163
|
+
}
|
|
164
|
+
export {};
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { BN } from "@coral-xyz/anchor";
|
|
2
|
+
import { PublicKey, AccountMeta, Keypair, TransactionInstruction, TransactionSignature, VersionedTransaction } from "@solana/web3.js";
|
|
3
|
+
import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
|
|
4
|
+
type BufferLike = Uint8Array | number[] | Buffer;
|
|
5
|
+
type BufferLike32 = BufferLike;
|
|
6
|
+
type BufferLike20 = BufferLike;
|
|
7
|
+
export type EpiDenominationKindInput = {
|
|
8
|
+
usd: Record<string, never>;
|
|
9
|
+
} | {
|
|
10
|
+
mint: Record<string, never>;
|
|
11
|
+
};
|
|
12
|
+
export type EpiDenominationSpecInput = {
|
|
13
|
+
denom: EpiDenominationKindInput;
|
|
14
|
+
mint: PublicKey;
|
|
15
|
+
};
|
|
16
|
+
export type EpiExternalPositionTypeInput = {
|
|
17
|
+
valued: Record<string, never>;
|
|
18
|
+
} | {
|
|
19
|
+
tokenized: Record<string, never>;
|
|
20
|
+
};
|
|
21
|
+
export type EpiExternalSourceTypeInput = {
|
|
22
|
+
trusted: Record<string, never>;
|
|
23
|
+
} | {
|
|
24
|
+
native: Record<string, never>;
|
|
25
|
+
} | {
|
|
26
|
+
wormhole: Record<string, never>;
|
|
27
|
+
};
|
|
28
|
+
export type EpiNativeCustodyKindInput = {
|
|
29
|
+
splToken: Record<string, never>;
|
|
30
|
+
} | {
|
|
31
|
+
nativeSol: Record<string, never>;
|
|
32
|
+
};
|
|
33
|
+
export type UpsertExternalPositionParams = {
|
|
34
|
+
positionId: BufferLike32;
|
|
35
|
+
positionType: EpiExternalPositionTypeInput;
|
|
36
|
+
sourceType: EpiExternalSourceTypeInput;
|
|
37
|
+
denomination: EpiDenominationSpecInput;
|
|
38
|
+
nativeCustodyAccount?: PublicKey;
|
|
39
|
+
nativeCustodyKind?: EpiNativeCustodyKindInput;
|
|
40
|
+
enabled?: boolean;
|
|
41
|
+
freshnessOverrideSecs?: number;
|
|
42
|
+
submitAllowlist?: PublicKey[];
|
|
43
|
+
validateAllowlist?: PublicKey[];
|
|
44
|
+
configureAllowlist?: PublicKey[];
|
|
45
|
+
};
|
|
46
|
+
export type SubmitExternalObservationParams = {
|
|
47
|
+
positionId: BufferLike32;
|
|
48
|
+
amount: BN;
|
|
49
|
+
denomination: EpiDenominationSpecInput;
|
|
50
|
+
observationTimestamp: BN;
|
|
51
|
+
externalShares?: BN;
|
|
52
|
+
reserved?: Uint8Array | number[] | Buffer;
|
|
53
|
+
};
|
|
54
|
+
export type ValidateExternalObservationOracleAccounts = {
|
|
55
|
+
glamConfig?: PublicKey | null;
|
|
56
|
+
solUsdOracle?: PublicKey | null;
|
|
57
|
+
baseAssetOracle?: PublicKey | null;
|
|
58
|
+
observedMintOracle?: PublicKey | null;
|
|
59
|
+
};
|
|
60
|
+
export type ValidateExternalObservationParams = {
|
|
61
|
+
positionId: BufferLike32;
|
|
62
|
+
} & ValidateExternalObservationOracleAccounts;
|
|
63
|
+
export type WormholeObservationConfigInput = {
|
|
64
|
+
positionId: BufferLike32;
|
|
65
|
+
emitterChain: number;
|
|
66
|
+
emitterAddress: BufferLike32;
|
|
67
|
+
payloadVersion: number;
|
|
68
|
+
payloadType: number;
|
|
69
|
+
maxAgeSeconds: number;
|
|
70
|
+
};
|
|
71
|
+
export type WormholeHyperliquidObservationConfigInput = {
|
|
72
|
+
positionId: BufferLike32;
|
|
73
|
+
hyperliquidAccount: BufferLike20;
|
|
74
|
+
accountMarginSummaryPrecompile: BufferLike20;
|
|
75
|
+
spotBalancePrecompile: BufferLike20;
|
|
76
|
+
perpDexIndex: number;
|
|
77
|
+
usdcSpotToken: BN;
|
|
78
|
+
};
|
|
79
|
+
export type SubmitExternalObservationWormholeParams = {
|
|
80
|
+
positionId: BufferLike32;
|
|
81
|
+
signedVaa: BufferLike;
|
|
82
|
+
payloadConfigAccounts?: AccountMeta[];
|
|
83
|
+
guardianSignatures?: Keypair;
|
|
84
|
+
guardianSet?: PublicKey;
|
|
85
|
+
wormholeCoreBridgeProgram?: PublicKey;
|
|
86
|
+
wormholeVerifyVaaShimProgram?: PublicKey;
|
|
87
|
+
maxSignaturesPerPost?: number;
|
|
88
|
+
};
|
|
89
|
+
export type SubmitExternalObservationWormholeResult = {
|
|
90
|
+
postSignatureTxs: TransactionSignature[];
|
|
91
|
+
submitTx: TransactionSignature;
|
|
92
|
+
guardianSignatures: PublicKey;
|
|
93
|
+
};
|
|
94
|
+
export type ParsedWormholeSignedVaa = {
|
|
95
|
+
version: number;
|
|
96
|
+
guardianSetIndex: number;
|
|
97
|
+
signatures: Buffer[];
|
|
98
|
+
vaaBody: Buffer;
|
|
99
|
+
};
|
|
100
|
+
export declare function evmAddressToBytes20(address: string): number[];
|
|
101
|
+
export declare function evmAddressToWormholeEmitterAddress(address: string): number[];
|
|
102
|
+
export declare function parseWormholeSignedVaa(signedVaa: BufferLike): ParsedWormholeSignedVaa;
|
|
103
|
+
export declare function getWormholeGuardianSetPda(guardianSetIndex: number, wormholeCoreBridgeProgram?: PublicKey): [PublicKey, number];
|
|
104
|
+
declare class TxBuilder extends BaseTxBuilder<EpiClient> {
|
|
105
|
+
upsertExternalPositionIx(params: UpsertExternalPositionParams, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
106
|
+
upsertExternalPositionWormholeConfigIx(params: WormholeObservationConfigInput, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
107
|
+
upsertExternalPositionWormholeHyperliquidConfigIx(params: WormholeHyperliquidObservationConfigInput, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
108
|
+
submitExternalObservationIx(params: SubmitExternalObservationParams, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
109
|
+
wormholePostSignaturesIx(parsedVaa: ParsedWormholeSignedVaa, guardianSignatures: PublicKey, payer?: PublicKey, signatures?: Buffer[], wormholeVerifyVaaShimProgram?: PublicKey): TransactionInstruction;
|
|
110
|
+
wormholeCloseSignaturesIx(guardianSignatures: PublicKey, refundRecipient?: PublicKey, wormholeVerifyVaaShimProgram?: PublicKey): TransactionInstruction;
|
|
111
|
+
submitExternalObservationWormholeIx(params: SubmitExternalObservationWormholeParams, guardianSignatures: PublicKey, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
112
|
+
validateExternalObservationIx(paramsOrPositionId: BufferLike32 | ValidateExternalObservationParams, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
113
|
+
refreshPricedProtocolIx(signer?: PublicKey): Promise<TransactionInstruction>;
|
|
114
|
+
submitExternalObservationTx(params: SubmitExternalObservationParams, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
115
|
+
upsertExternalPositionTx(params: UpsertExternalPositionParams, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
116
|
+
removeExternalPositionTx(positionId: BufferLike32, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
117
|
+
upsertExternalPositionWormholeConfigTx(params: WormholeObservationConfigInput, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
118
|
+
upsertExternalPositionWormholeHyperliquidConfigTx(params: WormholeHyperliquidObservationConfigInput, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
119
|
+
submitExternalObservationWormholeTx(params: SubmitExternalObservationWormholeParams, guardianSignatures: PublicKey, txOptions?: TxOptions, closeSignatures?: boolean): Promise<VersionedTransaction>;
|
|
120
|
+
validateExternalObservationTx(paramsOrPositionId: BufferLike32 | ValidateExternalObservationParams, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
121
|
+
refreshPricedProtocolTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
122
|
+
}
|
|
123
|
+
export declare class EpiClient {
|
|
124
|
+
readonly base: BaseClient;
|
|
125
|
+
readonly txBuilder: TxBuilder;
|
|
126
|
+
constructor(base: BaseClient);
|
|
127
|
+
getObservationStatePda(): PublicKey;
|
|
128
|
+
getWormholeObservationConfigPda(positionId: BufferLike32): PublicKey;
|
|
129
|
+
getWormholeHyperliquidObservationConfigPda(positionId: BufferLike32): PublicKey;
|
|
130
|
+
getIntegrationAuthorityPda(): PublicKey;
|
|
131
|
+
fetchObservationState(): Promise<{
|
|
132
|
+
glamState: PublicKey;
|
|
133
|
+
bump: number;
|
|
134
|
+
positionsLen: number;
|
|
135
|
+
reserved: number[];
|
|
136
|
+
positions: {
|
|
137
|
+
positionId: number[];
|
|
138
|
+
hasPending: boolean;
|
|
139
|
+
padPending: number[];
|
|
140
|
+
pendingObservation: {
|
|
141
|
+
amount: {
|
|
142
|
+
bytes: number[];
|
|
143
|
+
};
|
|
144
|
+
denomination: {
|
|
145
|
+
denom: ({
|
|
146
|
+
usd?: undefined;
|
|
147
|
+
} & {
|
|
148
|
+
mint: Record<string, never>;
|
|
149
|
+
}) | ({
|
|
150
|
+
mint?: undefined;
|
|
151
|
+
} & {
|
|
152
|
+
usd: Record<string, never>;
|
|
153
|
+
});
|
|
154
|
+
mint: PublicKey;
|
|
155
|
+
};
|
|
156
|
+
padDenom: number[];
|
|
157
|
+
observationTimestamp: BN;
|
|
158
|
+
externalShares: BN;
|
|
159
|
+
submittedBy: PublicKey;
|
|
160
|
+
submittedAtSlot: BN;
|
|
161
|
+
};
|
|
162
|
+
hasValidated: boolean;
|
|
163
|
+
padValidated: number[];
|
|
164
|
+
lastValidatedObservation: {
|
|
165
|
+
amount: {
|
|
166
|
+
bytes: number[];
|
|
167
|
+
};
|
|
168
|
+
denomination: {
|
|
169
|
+
denom: ({
|
|
170
|
+
usd?: undefined;
|
|
171
|
+
} & {
|
|
172
|
+
mint: Record<string, never>;
|
|
173
|
+
}) | ({
|
|
174
|
+
mint?: undefined;
|
|
175
|
+
} & {
|
|
176
|
+
usd: Record<string, never>;
|
|
177
|
+
});
|
|
178
|
+
mint: PublicKey;
|
|
179
|
+
};
|
|
180
|
+
padDenom: number[];
|
|
181
|
+
observationTimestamp: BN;
|
|
182
|
+
externalShares: BN;
|
|
183
|
+
submittedBy: PublicKey;
|
|
184
|
+
submittedAtSlot: BN;
|
|
185
|
+
};
|
|
186
|
+
validatedBy: PublicKey;
|
|
187
|
+
validatedAtSlot: BN;
|
|
188
|
+
validatedBaseAssetAmount: {
|
|
189
|
+
bytes: number[];
|
|
190
|
+
};
|
|
191
|
+
}[];
|
|
192
|
+
} | null>;
|
|
193
|
+
fetchWormholeObservationConfig(positionId: BufferLike32): Promise<{
|
|
194
|
+
glamState: PublicKey;
|
|
195
|
+
positionId: number[];
|
|
196
|
+
emitterChain: number;
|
|
197
|
+
emitterAddress: number[];
|
|
198
|
+
payloadVersion: number;
|
|
199
|
+
payloadType: number;
|
|
200
|
+
maxAgeSeconds: number;
|
|
201
|
+
hasLastSequence: boolean;
|
|
202
|
+
lastSequence: BN;
|
|
203
|
+
lastVaaHash: number[];
|
|
204
|
+
bump: number;
|
|
205
|
+
} | null>;
|
|
206
|
+
fetchWormholeHyperliquidObservationConfig(positionId: BufferLike32): Promise<{
|
|
207
|
+
glamState: PublicKey;
|
|
208
|
+
positionId: number[];
|
|
209
|
+
hyperliquidAccount: number[];
|
|
210
|
+
accountMarginSummaryPrecompile: number[];
|
|
211
|
+
spotBalancePrecompile: number[];
|
|
212
|
+
perpDexIndex: number;
|
|
213
|
+
usdcSpotToken: BN;
|
|
214
|
+
bump: number;
|
|
215
|
+
} | null>;
|
|
216
|
+
submitExternalObservation(params: SubmitExternalObservationParams, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
217
|
+
upsertExternalPosition(params: UpsertExternalPositionParams, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
218
|
+
removeExternalPosition(positionId: BufferLike32, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
219
|
+
upsertExternalPositionWormholeConfig(params: WormholeObservationConfigInput, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
220
|
+
upsertExternalPositionWormholeHyperliquidConfig(params: WormholeHyperliquidObservationConfigInput, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
221
|
+
submitExternalObservationWormhole(params: SubmitExternalObservationWormholeParams, txOptions?: TxOptions): Promise<SubmitExternalObservationWormholeResult>;
|
|
222
|
+
validateExternalObservation(paramsOrPositionId: BufferLike32 | ValidateExternalObservationParams, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
223
|
+
resolveValidateExternalObservationAccounts(params: ValidateExternalObservationParams): Promise<Required<Omit<ValidateExternalObservationOracleAccounts, "observedMintOracle">> & {
|
|
224
|
+
remainingAccounts: AccountMeta[];
|
|
225
|
+
}>;
|
|
226
|
+
refreshPricedProtocol(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
227
|
+
}
|
|
228
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { PublicKey, TransactionInstruction, TransactionSignature, VersionedTransaction } from "@solana/web3.js";
|
|
2
|
+
import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
|
|
3
|
+
import { PriceClient } from "./price";
|
|
4
|
+
declare class TxBuilder extends BaseTxBuilder<FeesClient> {
|
|
5
|
+
crystallizeFeesIxs(glamSigner: PublicKey): Promise<TransactionInstruction[]>;
|
|
6
|
+
crystallizeFeesTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
7
|
+
claimFeesIxs(glamSigner: PublicKey): Promise<TransactionInstruction[]>;
|
|
8
|
+
claimFeesTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
9
|
+
chargeProtocolFeeIxs(glamSigner: PublicKey, protocolFeeAuthority: PublicKey): Promise<TransactionInstruction[]>;
|
|
10
|
+
chargeProtocolFeeTx(protocolFeeAuthority: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
11
|
+
setProtocolFeesIx(baseFeeBps: number, flowFeeBps: number, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
12
|
+
setProtocolFeesTx(baseFeeBps: number, flowFeeBps: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
13
|
+
}
|
|
14
|
+
export declare class FeesClient {
|
|
15
|
+
readonly base: BaseClient;
|
|
16
|
+
readonly price: PriceClient;
|
|
17
|
+
readonly txBuilder: TxBuilder;
|
|
18
|
+
constructor(base: BaseClient, price: PriceClient);
|
|
19
|
+
/**
|
|
20
|
+
* Returns claimable fees object
|
|
21
|
+
*/
|
|
22
|
+
getClaimableFees(): Promise<any>;
|
|
23
|
+
/**
|
|
24
|
+
* Returns claimed fees object
|
|
25
|
+
*/
|
|
26
|
+
getClaimedFees(): Promise<any>;
|
|
27
|
+
crystallizeFees(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
28
|
+
claimFees(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
29
|
+
chargeProtocolFee(protocolFeeAuthority: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
30
|
+
setProtocolFeesIx(baseFeeBps: number, flowFeeBps: number, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
31
|
+
setProtocolFees(baseFeeBps: number, flowFeeBps: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BN } from "@coral-xyz/anchor";
|
|
2
|
+
import { PublicKey, TransactionInstruction, TransactionSignature, VersionedTransaction } from "@solana/web3.js";
|
|
3
|
+
import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
|
|
4
|
+
import { PendingRequest } from "../models";
|
|
5
|
+
declare class TxBuilder extends BaseTxBuilder<InvestClient> {
|
|
6
|
+
subscribeIxs(amount: BN, signer: PublicKey): Promise<TransactionInstruction[]>;
|
|
7
|
+
subscribeTx(amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
8
|
+
queuedSubscribeIxs(amount: BN, signer: PublicKey): Promise<TransactionInstruction[]>;
|
|
9
|
+
queuedSubscribeTx(amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
10
|
+
queuedRedeemIx(amount: BN, signer: PublicKey): Promise<TransactionInstruction>;
|
|
11
|
+
queuedRedeemTx(amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
12
|
+
cancelIx(pubkey: PublicKey | null, signer: PublicKey): Promise<TransactionInstruction>;
|
|
13
|
+
cancelTx(pubkey: PublicKey | null, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
14
|
+
fulfillIx(limit: number | null, signer: PublicKey): Promise<TransactionInstruction>;
|
|
15
|
+
fulfillTx(limit: number | null, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
16
|
+
claimIxs(user: PublicKey | null, signer: PublicKey): Promise<TransactionInstruction[]>;
|
|
17
|
+
claimTx(user: PublicKey | null, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
18
|
+
}
|
|
19
|
+
export declare class InvestClient {
|
|
20
|
+
readonly base: BaseClient;
|
|
21
|
+
readonly txBuilder: TxBuilder;
|
|
22
|
+
constructor(base: BaseClient);
|
|
23
|
+
subscribe(amount: BN, queued?: boolean, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
24
|
+
queuedRedeem(amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
25
|
+
cancel(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
26
|
+
cancelForUser(user: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
27
|
+
fulfill(limit: number | null, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
28
|
+
/**
|
|
29
|
+
* Claims the pending request for the signer.
|
|
30
|
+
* @param txOptions
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
claim(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
34
|
+
claimForUser(user: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
35
|
+
fetchPendingRequest(user?: PublicKey): Promise<PendingRequest | null>;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
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 { VaultClient } from "../vault";
|
|
5
|
+
import { JupiterBorrowPolicy } from "../../deser/integrationPolicies";
|
|
6
|
+
import { JupiterPosition, JupiterTransferType, JupiterVault } from "./shared";
|
|
7
|
+
export type JupiterBorrowInitPositionAccounts = {
|
|
8
|
+
vaultAdmin: PublicKey;
|
|
9
|
+
vaultState: PublicKey;
|
|
10
|
+
position: PublicKey;
|
|
11
|
+
positionMint: PublicKey;
|
|
12
|
+
positionTokenAccount: PublicKey;
|
|
13
|
+
metadataAccount?: PublicKey;
|
|
14
|
+
tokenProgram?: PublicKey;
|
|
15
|
+
associatedTokenProgram?: PublicKey;
|
|
16
|
+
sysvarInstruction?: PublicKey;
|
|
17
|
+
metadataProgram?: PublicKey;
|
|
18
|
+
};
|
|
19
|
+
export type JupiterBorrowOperateAccounts = {
|
|
20
|
+
signerSupplyTokenAccount?: PublicKey;
|
|
21
|
+
signerBorrowTokenAccount?: PublicKey;
|
|
22
|
+
recipient?: PublicKey | null;
|
|
23
|
+
recipientBorrowTokenAccount?: PublicKey | null;
|
|
24
|
+
recipientSupplyTokenAccount?: PublicKey | null;
|
|
25
|
+
vaultConfig: PublicKey;
|
|
26
|
+
vaultState: PublicKey;
|
|
27
|
+
supplyToken: PublicKey;
|
|
28
|
+
borrowToken: PublicKey;
|
|
29
|
+
oracle: PublicKey;
|
|
30
|
+
position: PublicKey;
|
|
31
|
+
positionTokenAccount: PublicKey;
|
|
32
|
+
currentPositionTick: PublicKey;
|
|
33
|
+
finalPositionTick: PublicKey;
|
|
34
|
+
currentPositionTickId: PublicKey;
|
|
35
|
+
finalPositionTickId: PublicKey;
|
|
36
|
+
newBranch: PublicKey;
|
|
37
|
+
supplyTokenReservesLiquidity: PublicKey;
|
|
38
|
+
borrowTokenReservesLiquidity: PublicKey;
|
|
39
|
+
vaultSupplyPositionOnLiquidity: PublicKey;
|
|
40
|
+
vaultBorrowPositionOnLiquidity: PublicKey;
|
|
41
|
+
supplyRateModel: PublicKey;
|
|
42
|
+
borrowRateModel: PublicKey;
|
|
43
|
+
vaultSupplyTokenAccount: PublicKey;
|
|
44
|
+
vaultBorrowTokenAccount: PublicKey;
|
|
45
|
+
supplyTokenClaimAccount?: PublicKey | null;
|
|
46
|
+
borrowTokenClaimAccount?: PublicKey | null;
|
|
47
|
+
liquidity: PublicKey;
|
|
48
|
+
liquidityProgram?: PublicKey;
|
|
49
|
+
oracleProgram?: PublicKey;
|
|
50
|
+
supplyTokenProgram?: PublicKey;
|
|
51
|
+
borrowTokenProgram?: PublicKey;
|
|
52
|
+
associatedTokenProgram?: PublicKey;
|
|
53
|
+
remainingAccounts?: AccountMeta[];
|
|
54
|
+
};
|
|
55
|
+
export type JupiterBorrowPosition = JupiterPosition & {
|
|
56
|
+
positionTokenAccount: PublicKey;
|
|
57
|
+
tokenAmount: string;
|
|
58
|
+
tokenProgram: PublicKey;
|
|
59
|
+
};
|
|
60
|
+
declare class TxBuilder extends BaseTxBuilder<JupiterBorrowClient> implements ProtocolPolicyTxBuilder<JupiterBorrowPolicy> {
|
|
61
|
+
initPositionIx(vaultId: number, nextPositionId: number, accounts: JupiterBorrowInitPositionAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
62
|
+
initPositionTx(vaultId: number, nextPositionId: number, accounts: JupiterBorrowInitPositionAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
63
|
+
operateIx(newCol: BN | bigint | number, newDebt: BN | bigint | number, transferType: JupiterTransferType | null, remainingAccountsIndices: Buffer | Uint8Array | number[], accounts: JupiterBorrowOperateAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
64
|
+
operateTx(newCol: BN | bigint | number, newDebt: BN | bigint | number, transferType: JupiterTransferType | null, remainingAccountsIndices: Buffer | Uint8Array | number[], accounts: JupiterBorrowOperateAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
65
|
+
setPolicyIx(policy: JupiterBorrowPolicy, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
66
|
+
setPolicyTx(policy: JupiterBorrowPolicy, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
67
|
+
clearPolicyIx(signer?: PublicKey): Promise<TransactionInstruction>;
|
|
68
|
+
clearPolicyTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
69
|
+
}
|
|
70
|
+
export declare class JupiterBorrowClient implements ProtocolPolicyClient<JupiterBorrowPolicy> {
|
|
71
|
+
readonly base: BaseClient;
|
|
72
|
+
readonly vault: VaultClient;
|
|
73
|
+
readonly txBuilder: TxBuilder;
|
|
74
|
+
constructor(base: BaseClient, vault: VaultClient);
|
|
75
|
+
getIntegrationAuthorityPda(): PublicKey;
|
|
76
|
+
getPosition(position: PublicKey): Promise<JupiterPosition>;
|
|
77
|
+
listPositions(vaultId?: number): Promise<JupiterBorrowPosition[]>;
|
|
78
|
+
getVault(vaultId: number): Promise<JupiterVault>;
|
|
79
|
+
listVaults(): Promise<JupiterVault[]>;
|
|
80
|
+
initPosition(vaultId: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
81
|
+
deposit(position: PublicKey, amount: BN | bigint | number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
82
|
+
withdraw(position: PublicKey, amount: BN | bigint | number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
83
|
+
borrow(position: PublicKey, amount: BN | bigint | number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
84
|
+
repay(position: PublicKey, amount: BN | bigint | number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
85
|
+
operate(newCol: BN | bigint | number, newDebt: BN | bigint | number, transferType: JupiterTransferType | null, remainingAccountsIndices: Buffer | Uint8Array | number[], accounts: JupiterBorrowOperateAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
86
|
+
fetchPolicy(): Promise<JupiterBorrowPolicy | null>;
|
|
87
|
+
setPolicy(policy: JupiterBorrowPolicy, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
88
|
+
clearPolicy(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
89
|
+
private simulateExpectedFinalTick;
|
|
90
|
+
private runBorrowOperate;
|
|
91
|
+
}
|
|
92
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { BN } from "@coral-xyz/anchor";
|
|
2
|
+
import { PublicKey, TransactionInstruction, TransactionSignature, VersionedTransaction } from "@solana/web3.js";
|
|
3
|
+
import { BaseClient, BaseTxBuilder, type ProtocolPolicyClient, type ProtocolPolicyTxBuilder, type TxOptions } from "../base";
|
|
4
|
+
import { JupiterEarnPolicy } from "../../deser/integrationPolicies";
|
|
5
|
+
export type JupiterEarnDepositAccounts = {
|
|
6
|
+
depositorTokenAccount?: PublicKey;
|
|
7
|
+
recipientTokenAccount?: PublicKey;
|
|
8
|
+
mint: PublicKey;
|
|
9
|
+
lendingAdmin: PublicKey;
|
|
10
|
+
lending: PublicKey;
|
|
11
|
+
fTokenMint: PublicKey;
|
|
12
|
+
supplyTokenReservesLiquidity: PublicKey;
|
|
13
|
+
lendingSupplyPositionOnLiquidity: PublicKey;
|
|
14
|
+
rateModel: PublicKey;
|
|
15
|
+
vault: PublicKey;
|
|
16
|
+
liquidity: PublicKey;
|
|
17
|
+
liquidityProgram?: PublicKey;
|
|
18
|
+
rewardsRateModel: PublicKey;
|
|
19
|
+
tokenProgram?: PublicKey;
|
|
20
|
+
fTokenProgram?: PublicKey;
|
|
21
|
+
associatedTokenProgram?: PublicKey;
|
|
22
|
+
};
|
|
23
|
+
export type JupiterEarnWithdrawAccounts = {
|
|
24
|
+
ownerTokenAccount?: PublicKey;
|
|
25
|
+
recipientTokenAccount?: PublicKey;
|
|
26
|
+
lendingAdmin: PublicKey;
|
|
27
|
+
lending: PublicKey;
|
|
28
|
+
mint: PublicKey;
|
|
29
|
+
fTokenMint: PublicKey;
|
|
30
|
+
supplyTokenReservesLiquidity: PublicKey;
|
|
31
|
+
lendingSupplyPositionOnLiquidity: PublicKey;
|
|
32
|
+
rateModel: PublicKey;
|
|
33
|
+
vault: PublicKey;
|
|
34
|
+
claimAccount: PublicKey;
|
|
35
|
+
liquidity: PublicKey;
|
|
36
|
+
liquidityProgram?: PublicKey;
|
|
37
|
+
rewardsRateModel: PublicKey;
|
|
38
|
+
tokenProgram?: PublicKey;
|
|
39
|
+
fTokenProgram?: PublicKey;
|
|
40
|
+
associatedTokenProgram?: PublicKey;
|
|
41
|
+
};
|
|
42
|
+
declare class TxBuilder extends BaseTxBuilder<JupiterEarnClient> implements ProtocolPolicyTxBuilder<JupiterEarnPolicy> {
|
|
43
|
+
depositIx(amount: BN | bigint | number, minAmountOut: BN | bigint | number, accounts: JupiterEarnDepositAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
44
|
+
depositTx(amount: BN | bigint | number, minAmountOut: BN | bigint | number, accounts: JupiterEarnDepositAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
45
|
+
withdrawIx(amount: BN | bigint | number, maxSharesBurn: BN | bigint | number, accounts: JupiterEarnWithdrawAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
46
|
+
withdrawTx(amount: BN | bigint | number, maxSharesBurn: BN | bigint | number, accounts: JupiterEarnWithdrawAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
47
|
+
setPolicyIx(policy: JupiterEarnPolicy, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
48
|
+
setPolicyTx(policy: JupiterEarnPolicy, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
49
|
+
clearPolicyIx(signer?: PublicKey): Promise<TransactionInstruction>;
|
|
50
|
+
clearPolicyTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
51
|
+
}
|
|
52
|
+
export declare class JupiterEarnClient implements ProtocolPolicyClient<JupiterEarnPolicy> {
|
|
53
|
+
readonly base: BaseClient;
|
|
54
|
+
readonly txBuilder: TxBuilder;
|
|
55
|
+
constructor(base: BaseClient);
|
|
56
|
+
getIntegrationAuthorityPda(): PublicKey;
|
|
57
|
+
deposit(mint: PublicKey, amount: BN | bigint | number, minAmountOut?: BN | bigint | number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
58
|
+
withdraw(mint: PublicKey, amount: BN | bigint | number, maxSharesBurn?: BN | bigint | number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
59
|
+
fetchPolicy(): Promise<JupiterEarnPolicy | null>;
|
|
60
|
+
setPolicy(policy: JupiterEarnPolicy, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
61
|
+
clearPolicy(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
62
|
+
private resolveAccounts;
|
|
63
|
+
}
|
|
64
|
+
export {};
|